Skip to content
Snippets Groups Projects
Commit 509d5657 authored by Saran Kumar's avatar Saran Kumar
Browse files

First commit

parents
No related branches found
No related tags found
No related merge requests found
Showing
with 790 additions and 0 deletions
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
.externalNativeBuild
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
<entry name="!?*.aj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>
\ No newline at end of file
<component name="CopyrightManager">
<settings default="" />
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AndroidLintMissingConstraints" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="LoggerInitializedWithForeignClass" enabled="false" level="WARNING" enabled_by_default="false">
<option name="loggerClassName" value="org.apache.log4j.Logger,org.slf4j.LoggerFactory,org.apache.commons.logging.LogFactory,java.util.logging.Logger" />
<option name="loggerFactoryMethodName" value="getLogger,getLogger,getLog,getLogger" />
</inspection_tool>
</profile>
</component>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" value="Project Default" />
<option name="USE_PROJECT_PROFILE" value="true" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/AmritaOD.iml" filepath="$PROJECT_DIR$/AmritaOD.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
/build
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.peruse.saran.amritaod"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
compile 'com.android.support:recyclerview-v7:25.2.0'
compile 'com.android.support:gridlayout-v7:25.2.0'
compile 'com.android.support:cardview-v7:25.2.0'
compile 'com.android.support:design:26.0.0-alpha1'
compile 'com.jakewharton:butterknife:6.1.0'
testCompile 'junit:junit:4.12'
}
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\Users\Saran\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
package com.peruse.saran.amritaod;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.assertEquals;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.peruse.saran.amritaod", appContext.getPackageName());
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.peruse.saran.amritaod">
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".splash.splashScreen"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".register.advisorRegister"
android:label="Advisor Registration"
android:screenOrientation="portrait"
android:theme="@style/AppTheme1" />
<activity
android:name=".register.studentRegister"
android:label="Student Registration"
android:screenOrientation="portrait"
android:theme="@style/AppTheme1" />
<activity
android:name=".actionareas.userAreaActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme1" />
<activity
android:name=".register.representativeRegister"
android:label="Representative Registration"
android:screenOrientation="portrait"
android:theme="@style/AppTheme1" />
<activity
android:name=".actionareas.applyodActivity"
android:label="Apply Leave"
android:screenOrientation="portrait"
android:theme="@style/AppTheme1" />
<activity
android:name=".recycler.odApproveActivity"
android:label="Approve Leave"
android:screenOrientation="portrait"
android:theme="@style/AppTheme1" />
<activity
android:name=".actionareas.MainActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme" />
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.example.android.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
<activity
android:name=".actionareas.advisorActivity"
android:label="Advisor"
android:screenOrientation="portrait"
android:theme="@style/AppTheme1" />
<activity android:name=".approvedrecycler.approvedActivity"
android:label="Approved Leave(s)"
android:screenOrientation="portrait"
android:theme="@style/AppTheme1">
</activity>
</application>
</manifest>
\ No newline at end of file
package com.peruse.saran.amritaod.actionareas;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Toast;
import com.peruse.saran.amritaod.R;
import com.peruse.saran.amritaod.recycler.odApproveActivity;
public class advisorActivity extends AppCompatActivity {
private boolean doubleBackToExitPressedOnce = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_advisor);
}
@Override
public void onBackPressed() {
if (doubleBackToExitPressedOnce) {
super.onBackPressed();
return;
}
this.doubleBackToExitPressedOnce = true;
Toast.makeText(this, "Press the back button again to Logout", Toast.LENGTH_SHORT).show();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
doubleBackToExitPressedOnce=false;
}
}, 2000);
}
protected void odapprove(View view){
Intent intent = new Intent(this,odApproveActivity.class);
startActivity(intent);
}
}
package com.peruse.saran.amritaod.actionareas;
import android.app.DatePickerDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.support.v4.content.FileProvider;
import android.support.v7.app.AppCompatActivity;
import android.util.Base64;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.Volley;
import com.peruse.saran.amritaod.R;
import com.peruse.saran.amritaod.templates.odapplyTemplate;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class applyodActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener {
final Calendar calendar = Calendar.getInstance();
//When Camera button is clicked 'takepicture' function should be called via onClick attribute
//when Gallery Button is clicked 'showFileChooser' function should be called via onClick attribute
//When Apply button is clicked 'applyOd' function should be called via onClick attribute
String[] leavetype = {"-Select Leave Type-", "Medical Leave", "On Duty Leave", "Normal Leave"};
private String setleavetype;
private Bitmap bitmap = null;
private String mCurrentPhotoPath,
sendstartdate=null,
sendenddate=null,
recievedUsername,
recievedRollno,
recievedSemester,
recievedBranch,
currentdate,
currentdatesend,
startperiod=null,
endperiod=null,
reason=null;
private int PICK_IMAGE_REQUEST = 1,
CAMERA_REQUEST = 2,
startyear = calendar.get(Calendar.YEAR),
startmonth = calendar.get(Calendar.MONTH),
startdate = calendar.get(Calendar.DAY_OF_MONTH);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_applyod);
Spinner spinner = (Spinner) findViewById(R.id.spinner);
spinner.setOnItemSelectedListener(this);
ArrayAdapter adapter = new ArrayAdapter(this,android.R.layout.simple_spinner_item,leavetype);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
TextView odnamedisp = (TextView)findViewById(R.id.odapplyname_id);
TextView odrollnodisp = (TextView)findViewById(R.id.odapplyrollno_id);
TextView oddatedisp = (TextView)findViewById(R.id.odapplydate_id);
TextView odsemesterdisp = (TextView)findViewById(R.id.odapplysemester_id);
TextView odbranchdisp = (TextView)findViewById(R.id.odapplybranch_id);
EditText odapplystartdate = (EditText)findViewById(R.id.odapplystartdate_id);
EditText odapplyenddate = (EditText)findViewById(R.id.odapplyenddate_id);
Intent intent = getIntent();
recievedUsername = intent.getExtras().getString("recievedUsername");
recievedRollno = intent.getExtras().getString("recievedRollno");
recievedSemester = intent.getExtras().getString("recievedSemester");
recievedBranch = intent.getExtras().getString("recievedBranch");
currentdate = ""+startdate+'/'+startmonth+"/"+startyear;
currentdatesend = ""+startyear+'/'+(startmonth+1)+'/'+startdate;
oddatedisp.setText(currentdate);
odnamedisp.setText(recievedUsername);
odrollnodisp.setText(recievedRollno);
odsemesterdisp.setText(recievedSemester);
odbranchdisp.setText(recievedBranch);
odapplystartdate.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
v.onTouchEvent(event);
InputMethodManager imm = (InputMethodManager)v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
}
return true;
}
});
odapplyenddate.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
v.onTouchEvent(event);
InputMethodManager imm = (InputMethodManager)v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
}
return true;
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == PICK_IMAGE_REQUEST && resultCode == RESULT_OK && data != null && data.getData() != null) {
Uri filePath = data.getData();
try {
bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), filePath);
} catch (IOException e) {
e.printStackTrace();
}
}
if (requestCode == CAMERA_REQUEST && resultCode == userAreaActivity.RESULT_OK) {
bitmap = BitmapFactory.decodeFile(mCurrentPhotoPath);
}
}
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
setleavetype = leavetype[position];
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
Toast.makeText(this, "Select the leave type", Toast.LENGTH_SHORT).show();
}
protected void startdateselect(View view) {
final EditText startdateselect = (EditText)findViewById(R.id.odapplystartdate_id);
DatePickerDialog mdiDialog =new DatePickerDialog(this,new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
String date = ""+dayOfMonth+'-'+(monthOfYear+1)+'-'+year;
sendstartdate = ""+year+'-'+(monthOfYear+1)+'-'+dayOfMonth;
startdateselect.setText(date);
}
}, startyear, startmonth, startdate);
mdiDialog.show();
}
protected void enddateselect(View view) {
DatePickerDialog mdiDialog =new DatePickerDialog(this,new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
EditText enddateselect = (EditText)findViewById(R.id.odapplyenddate_id);
String date = ""+dayOfMonth+'-'+(monthOfYear+1)+'-'+year;
sendenddate = ""+year+'-'+(monthOfYear+1)+'-'+dayOfMonth;
enddateselect.setText(date);
}
}, startyear, startmonth, startdate);
mdiDialog.show();
}
private String getStringImage(Bitmap bmp){
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.JPEG, 40, baos);
byte[] imageBytes = baos.toByteArray();
return Base64.encodeToString(imageBytes, Base64.DEFAULT);
}
protected void applyOd(View view){
EditText odapplystartperiod = (EditText) findViewById(R.id.odapplystartperiod_id);
EditText odapplyendperiod = (EditText) findViewById(R.id.odapplyendperiod_id);
EditText odapplyreason = (EditText) findViewById(R.id.odapplyreason_id);
reason = odapplyreason.getText().toString();
startperiod = odapplystartperiod.getText().toString();
endperiod = odapplyendperiod.getText().toString();
if(bitmap==null){
Toast.makeText(this, "Please Select an Image", Toast.LENGTH_SHORT).show();
}
else if(leavetype[0].equals("-Select Leave Type-")){
Toast.makeText(this,"Please Select the Leave Type", Toast.LENGTH_SHORT).show();
}
else if(sendstartdate==null){
Toast.makeText(this, "Please Select the Start Date", Toast.LENGTH_SHORT).show();
}
else if(sendenddate==null){
Toast.makeText(this, "Please Select the End Date", Toast.LENGTH_SHORT).show();
}
else if(startperiod==null){
Toast.makeText(this, "Please Select the Start Period", Toast.LENGTH_SHORT).show();
}
else if(endperiod==null){
Toast.makeText(this, "Please Select the End Period", Toast.LENGTH_SHORT).show();
}
else {
final ProgressDialog progressDialog = new ProgressDialog(this);
RequestQueue queue;
Response.Listener<String> responseListener = new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
JSONObject jsonResponse = new JSONObject(response);
progressDialog.dismiss();
boolean success = jsonResponse.getBoolean("success");
if (success) {
Toast.makeText(applyodActivity.this, "Applied successfully!", Toast.LENGTH_SHORT).show();
finish();
} else {
String message = jsonResponse.getString("message");
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(applyodActivity.this);
builder.setMessage(message)
.setNegativeButton("Ok", null)
.create()
.show();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
};
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(applyodActivity.this);
builder.setMessage("Oops! an error has occured,Please retry!")
.setNegativeButton("OK", null)
.create()
.show();
Log.d("volley", "error");
}
};
String baseimage = getStringImage(bitmap);
odapplyTemplate odapplyTemplate = new odapplyTemplate(recievedRollno, currentdatesend, sendstartdate, sendenddate, startperiod, endperiod, reason, setleavetype, baseimage, responseListener);
queue = Volley.newRequestQueue(this);
queue.add(odapplyTemplate);
progressDialog.setMessage("Applying...");
progressDialog.show();
progressDialog.setCanceledOnTouchOutside(false);
progressDialog.setCancelable(false);
}
}
protected void takepicture(View view){
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
File photoFile = null;
try {
photoFile = createImageFile();
} catch (IOException ignored) {
}
if (photoFile != null) {
Uri photoURI = FileProvider.getUriForFile(this,
"com.example.android.fileprovider",
photoFile);
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
startActivityForResult(takePictureIntent, CAMERA_REQUEST);
}
}
}
protected void showFileChooser(View view) {
Intent intentimg = new Intent();
intentimg.setType("image/*");
intentimg.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intentimg, "Select Picture"), PICK_IMAGE_REQUEST);
}
private File createImageFile() throws IOException {
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
String imageFileName = "JPEG_" + timeStamp + "_";
File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);
File image = File.createTempFile(imageFileName,".jpg",storageDir);
mCurrentPhotoPath = image.getAbsolutePath();
return image;
}
}
package com.peruse.saran.amritaod.actionareas;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import com.peruse.saran.amritaod.R;
import com.peruse.saran.amritaod.recycler.odApproveActivity;
public class userAreaActivity extends AppCompatActivity {
String recievedUsername, recievedRollno, recievedSemester, recievedBranch;
//When Apply Button is clicked 'apply' function should be called via onClick attribute in xml
private boolean doubleBackToExitPressedOnce = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_area);
Intent intent = getIntent();
TextView recievedUsernameDisplay = (TextView) findViewById(R.id.usernamedisplay_id);
TextView recievedSemesterDisplay = (TextView) findViewById(R.id.textView2);
recievedUsername = intent.getExtras().getString("recievedUsername");
recievedRollno = intent.getExtras().getString("recievedRollno");
recievedSemester = intent.getExtras().getString("recievedSemester");
recievedBranch = intent.getExtras().getString("recievedBranch");
recievedUsernameDisplay.setText("Hi " + recievedUsername + '!');
recievedSemesterDisplay.setText(recievedSemester);
}
@Override
public void onBackPressed() {
if (doubleBackToExitPressedOnce) {
super.onBackPressed();
return;
}
this.doubleBackToExitPressedOnce = true;
Toast.makeText(this, "Press the back button again to Logout", Toast.LENGTH_SHORT).show();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
doubleBackToExitPressedOnce=false;
}
}, 2000);
}
protected void apply(View v){
TextView recievedUsernameDisplay = (TextView) findViewById(R.id.usernamedisplay_id);
TextView recievedSemesterDisplay = (TextView) findViewById(R.id.textView2);
Intent newintent = new Intent(this,applyodActivity.class);
newintent.putExtra("recievedUsername",recievedUsername)
.putExtra("recievedRollno",recievedRollno)
.putExtra("recievedSemester",recievedSemester)
.putExtra("recievedBranch",recievedBranch);
startActivity(newintent);
}
protected void odapprove(View view){
Intent intent = new Intent(this,odApproveActivity.class);
startActivity(intent);
}
}
package com.peruse.saran.amritaod.approvedrecycler;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.NetworkImageView;
import com.peruse.saran.amritaod.R;
import com.peruse.saran.amritaod.recycler.CustomVolleyRequest;
import com.peruse.saran.amritaod.templates.oddetailstemplate;
import java.util.List;
public class CardAdapter extends RecyclerView.Adapter<com.peruse.saran.amritaod.approvedrecycler.CardAdapter.ViewHolder> {
List<oddetailstemplate> listOdApprove;
private ImageLoader imageLoader;
private Context context;
public CardAdapter(List<oddetailstemplate> listOdApprove, Context context){
super();
this.listOdApprove = listOdApprove;
this.context = context;
}
@Override
public com.peruse.saran.amritaod.approvedrecycler.CardAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.odapprovedlist, parent, false);
com.peruse.saran.amritaod.approvedrecycler.CardAdapter.ViewHolder viewHolder = new com.peruse.saran.amritaod.approvedrecycler.CardAdapter.ViewHolder(v);
return viewHolder;
}
@Override
public void onBindViewHolder(final com.peruse.saran.amritaod.approvedrecycler.CardAdapter.ViewHolder holder, int position) {
oddetailstemplate superHero = listOdApprove.get(position);
final String id = superHero.getId();
imageLoader = CustomVolleyRequest.getInstance(context).getImageLoader();
imageLoader.get(superHero.getImageUrl(), ImageLoader.getImageListener(holder.imageView, R.drawable.image, R.drawable.loaderror));
holder.imageView.setImageUrl(superHero.getImageUrl(), imageLoader);
holder.textViewName.setText(superHero.getName());
holder.textViewPublisher.setText(superHero.getPublisher());
holder.textViewfromdate.setText(superHero.getFromdate());
holder.textViewtodate.setText(superHero.getTodate());
holder.textViewfromdateperiod.setText(superHero.getFromdateperiod());
holder.textViewtodateperiod.setText(superHero.getTodateperiod());
holder.textViewreason.setText(superHero.getReason());
}
@Override
public int getItemCount() {
return listOdApprove.size();
}
class ViewHolder extends RecyclerView.ViewHolder{
public NetworkImageView imageView;
public TextView textViewName;
public TextView textViewPublisher;
public TextView textViewfromdate;
public TextView textViewtodate;
public Button approvebutton,denybutton;
public TextView textViewfromdateperiod;
public TextView textViewtodateperiod;
public TextView textViewreason;
public ViewHolder(View itemView) {
super(itemView);
imageView = (NetworkImageView) itemView.findViewById(R.id.imageViewHero);
textViewName = (TextView) itemView.findViewById(R.id.textViewName);
textViewPublisher = (TextView) itemView.findViewById(R.id.textViewPublisher);
approvebutton = (Button) itemView.findViewById(R.id.odapprovebutton_id);
denybutton = (Button) itemView.findViewById(R.id.oddenybutton_id);
textViewfromdate = (TextView)itemView.findViewById(R.id.fromdateid);
textViewtodate = (TextView)itemView.findViewById(R.id.todateid);
textViewfromdateperiod = (TextView)itemView.findViewById(R.id.fromdateperiodid);
textViewtodateperiod = (TextView)itemView.findViewById(R.id.todateperiodid);
textViewreason = (TextView)itemView.findViewById(R.id.textviewreasonid);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment