diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..1046d98 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +MyApplication \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..61a9130 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..15a15b2 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..b617266 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,23 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..bcc4135 --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..d5d35ec --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/.idea/.gitignore b/app/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/app/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/app/.idea/encodings.xml b/app/.idea/encodings.xml new file mode 100644 index 0000000..15a15b2 --- /dev/null +++ b/app/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/app/.idea/gradle.xml b/app/.idea/gradle.xml new file mode 100644 index 0000000..0cb0e08 --- /dev/null +++ b/app/.idea/gradle.xml @@ -0,0 +1,15 @@ + + + + + + \ No newline at end of file diff --git a/app/.idea/misc.xml b/app/.idea/misc.xml new file mode 100644 index 0000000..f845854 --- /dev/null +++ b/app/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/app/.idea/modules.xml b/app/.idea/modules.xml new file mode 100644 index 0000000..e1f9e1c --- /dev/null +++ b/app/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..65fcd6d --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,120 @@ +plugins { + id 'com.android.application' +} + +android { + compileSdkVersion 29 + buildToolsVersion "30.0.2" + + defaultConfig { + applicationId "com.leadcampusapp" + minSdkVersion 18 + targetSdkVersion 29 + versionCode 51 + versionName "4.6" + + multiDexEnabled true + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + lintOptions { + checkReleaseBuilds false + // Or, if you prefer, you can continue to check for errors in release builds, + // but continue the build even when errors are found: + abortOnError false + } + + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + packagingOptions{ + exclude 'META-INF/rxjava.properties' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + +} + +dependencies { + + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'com.google.android.material:material:1.3.0' + implementation 'androidx.constraintlayout:constraintlayout:2.0.4' + testImplementation 'junit:junit:4.+' + androidTestImplementation 'androidx.test.ext:junit:1.1.2' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' + + + + + + + // implementation 'com.google.android.gms:play-services-tagmanager:11.6.0' + + implementation 'androidx.vectordrawable:vectordrawable-animated:1.0.0' + implementation 'androidx.exifinterface:exifinterface:1.0.0' + implementation 'androidx.cardview:cardview:1.0.0' + implementation 'androidx.browser:browser:1.0.0' + implementation 'androidx.media:media:1.0.0' + //implementation 'androidx.legacy:legacy-support-v4:1.0.0' + implementation 'androidx.multidex:multidex:2.0.0' + implementation 'com.android.support:multidex:1.0.3' + + + implementation 'com.google.android.material:material:1.0.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + implementation "androidx.recyclerview:recyclerview:1.1.0" + implementation 'com.kofigyan.stateprogressbar:stateprogressbar:1.0.0' + + implementation 'com.github.bumptech.glide:glide:3.7.0' + implementation 'com.codesgood:justifiedtextview:1.0.2' + implementation 'com.github.PhilJay:MPAndroidChart:v2.2.4' + implementation 'de.hdodenhof:circleimageview:2.2.0' + implementation 'pl.bclogic:pulsator4droid:1.0.3' + implementation 'net.danlew:android.joda:2.9.9' + + implementation 'com.facebook.shimmer:shimmer:0.4.0' + implementation files('libs/YouTubeAndroidPlayerApi.jar') + implementation 'com.github.k0shk0sh:PermissionHelper:1.0.7' + implementation 'com.cocosw:bottomsheet:1.+@aar' + + + + implementation 'com.google.android.material:material:1.0.0-rc01' + implementation 'com.google.android.material:material:1.1.0-alpha07' + + + implementation 'com.squareup.retrofit2:retrofit:2.3.0' + implementation 'com.squareup.retrofit2:converter-gson:2.1.0' + implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0' + + + + + //implementation 'com.paytm.appinvokesdk:appinvokesdk:1.2' + implementation 'com.paytm.appinvokesdk:appinvokesdk:1.5.4' + + + + + implementation 'com.google.android.gms:play-services-auth:18.1.0' + implementation 'com.google.firebase:firebase-auth:16.0.1' + implementation 'com.google.firebase:firebase-messaging:17.0.0' + implementation 'com.google.firebase:firebase-core:16.0.0' + implementation 'com.google.android.gms:play-services-tagmanager:16.0.0' + + + implementation files('libs/rxjava-1.0.2.jar') + implementation files('libs/additionnal.jar') + implementation files('libs/ftp4j-1.6.jar') + implementation files('libs/commons-net-3.3.jar') + implementation files('libs/ksoap2-android-assembly-2.4-jar-with-dependencies.jar') +} +apply plugin: 'com.google.gms.google-services' \ No newline at end of file diff --git a/app/google-services.json b/app/google-services.json new file mode 100644 index 0000000..62d692a --- /dev/null +++ b/app/google-services.json @@ -0,0 +1,56 @@ +{ + "project_info": { + "project_number": "830064162862", + "firebase_url": "https://df-leadcampus.firebaseio.com", + "project_id": "df-leadcampus", + "storage_bucket": "df-leadcampus.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:830064162862:android:55ef121e7473d84b", + "android_client_info": { + "package_name": "com.leadcampusapp" + } + }, + "oauth_client": [ + { + "client_id": "830064162862-5vh60pec1mctjus7eo7donicdl7fif6g.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "com.leadcampusapp", + "certificate_hash": "8a7cfff8d13816f1e754b1012a3fd235a199de06" + } + }, + { + "client_id": "830064162862-ctn3l98e2igqoom1t7lk1lenapskvmic.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "com.leadcampusapp", + "certificate_hash": "6a22b9f289d8a4cc8899dc224ff931ee034380b0" + } + }, + { + "client_id": "830064162862-nohid6fk5j27f2g6fvc0qdrn81pumdkg.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyAl6P7is4pIcI5BkkxHwbDrnMojAw9VkrQ" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "830064162862-nohid6fk5j27f2g6fvc0qdrn81pumdkg.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/app/libs/YouTubeAndroidPlayerApi.jar b/app/libs/YouTubeAndroidPlayerApi.jar new file mode 100644 index 0000000..0acbebd Binary files /dev/null and b/app/libs/YouTubeAndroidPlayerApi.jar differ diff --git a/app/libs/activation.jar b/app/libs/activation.jar new file mode 100644 index 0000000..614a03c Binary files /dev/null and b/app/libs/activation.jar differ diff --git a/app/libs/additionnal.jar b/app/libs/additionnal.jar new file mode 100644 index 0000000..aeb9611 Binary files /dev/null and b/app/libs/additionnal.jar differ diff --git a/app/libs/commons-net-3.3.jar b/app/libs/commons-net-3.3.jar new file mode 100644 index 0000000..f4f19a9 Binary files /dev/null and b/app/libs/commons-net-3.3.jar differ diff --git a/app/libs/ftp4j-1.6.jar b/app/libs/ftp4j-1.6.jar new file mode 100644 index 0000000..8097d58 Binary files /dev/null and b/app/libs/ftp4j-1.6.jar differ diff --git a/app/libs/ksoap2-android-assembly-2.4-jar-with-dependencies.jar b/app/libs/ksoap2-android-assembly-2.4-jar-with-dependencies.jar new file mode 100644 index 0000000..33ef6e8 Binary files /dev/null and b/app/libs/ksoap2-android-assembly-2.4-jar-with-dependencies.jar differ diff --git a/app/libs/mail.jar b/app/libs/mail.jar new file mode 100644 index 0000000..ea594fd Binary files /dev/null and b/app/libs/mail.jar differ diff --git a/app/libs/rxjava-1.0.2.jar b/app/libs/rxjava-1.0.2.jar new file mode 100644 index 0000000..4362a9f Binary files /dev/null and b/app/libs/rxjava-1.0.2.jar differ diff --git a/app/libs/session.jar b/app/libs/session.jar new file mode 100644 index 0000000..b3d74c3 Binary files /dev/null and b/app/libs/session.jar differ diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# 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 \ No newline at end of file diff --git a/app/release/app-release.apk b/app/release/app-release.apk new file mode 100644 index 0000000..ce68c23 Binary files /dev/null and b/app/release/app-release.apk differ diff --git a/app/release/leadcampus_Ver4.6.apk b/app/release/leadcampus_Ver4.6.apk new file mode 100644 index 0000000..ce68c23 Binary files /dev/null and b/app/release/leadcampus_Ver4.6.apk differ diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json new file mode 100644 index 0000000..cbe6afc --- /dev/null +++ b/app/release/output-metadata.json @@ -0,0 +1,18 @@ +{ + "version": 2, + "artifactType": { + "type": "APK", + "kind": "Directory" + }, + "applicationId": "com.leadcampusapp", + "variantName": "processReleaseResources", + "elements": [ + { + "type": "SINGLE", + "filters": [], + "versionCode": 51, + "versionName": "4.6", + "outputFile": "app-release.apk" + } + ] +} \ No newline at end of file diff --git a/app/src/androidTest/java/com/leadcampusapp/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/leadcampusapp/ExampleInstrumentedTest.java new file mode 100644 index 0000000..2ad61c2 --- /dev/null +++ b/app/src/androidTest/java/com/leadcampusapp/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.leadcampusapp; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("com.leadcampusapp", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..ee2e6b8 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,305 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/assets/Testing.txt b/app/src/main/assets/Testing.txt new file mode 100644 index 0000000..0a90125 --- /dev/null +++ b/app/src/main/assets/Testing.txt @@ -0,0 +1 @@ +Testing \ No newline at end of file diff --git a/app/src/main/assets/lead4_14mb.gif b/app/src/main/assets/lead4_14mb.gif new file mode 100644 index 0000000..9d135a1 Binary files /dev/null and b/app/src/main/assets/lead4_14mb.gif differ diff --git a/app/src/main/java/com/leadcampusapp/AboutUsActivity.java b/app/src/main/java/com/leadcampusapp/AboutUsActivity.java new file mode 100644 index 0000000..c674f86 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/AboutUsActivity.java @@ -0,0 +1,281 @@ +package com.leadcampusapp; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import android.content.Intent; +import android.os.Build; +import android.os.Bundle; + +import androidx.appcompat.app.AppCompatActivity; +import android.view.MenuItem; +import android.view.View; +import android.view.View.MeasureSpec; +import android.view.ViewGroup; +import android.widget.ExpandableListAdapter; +import android.widget.ExpandableListView; +import android.widget.ExpandableListView.OnGroupClickListener; +import android.widget.ExpandableListView.OnGroupExpandListener; +import android.widget.ListAdapter; +import android.widget.ScrollView; +import android.widget.TextView; +import androidx.annotation.RequiresApi; + +//import com.android.sripad.leadnew_22_6_2018.R; + +public class AboutUsActivity extends AppCompatActivity { + + + ExpandableListView expandableListView; + ExpandableListAdapter expandableListAdapter; + List expandableListTitle; + HashMap> expandableListDetail; + ScrollView scrollView; + + @RequiresApi(api = Build.VERSION_CODES.M) + @Override + protected void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_about_us); + + //Added by Sripad + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + // getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background)); + + View actionBarView = getSupportActionBar().getCustomView(); + TextView actionBarTV = (TextView) actionBarView.findViewById(R.id.txt_actionBar); + actionBarTV.setText("About LEAD"); + + getSupportActionBar().setDisplayShowHomeEnabled(true); + getSupportActionBar().setHomeButtonEnabled(true); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + + + + + scrollView = (ScrollView) findViewById(R.id.scrollViewDrawer); + + expandableListView = (ExpandableListView) findViewById(R.id.expandableListView); + expandableListDetail = ExpandableListDataPump.getData(AboutUsActivity.this); + expandableListTitle = new ArrayList(expandableListDetail.keySet()); + expandableListAdapter = new CustomExpandableListAdapter(this, expandableListTitle, expandableListDetail); + expandableListView.setAdapter(expandableListAdapter); + + /* LinearLayout.LayoutParams param = (LinearLayout.LayoutParams) expandableListView.getLayoutParams(); + param.height = (3 * expandableListView.getHeight()); + expandableListView.setLayoutParams(param); + expandableListView.refreshDrawableState(); + scrollView.refreshDrawableState();*/ + + setListViewHeight(expandableListView); + + expandableListView.setOnGroupClickListener(new OnGroupClickListener() { + + @Override + public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) { + setListViewHeight(parent, groupPosition); + return false; + } + }); + + expandableListView.setOnGroupExpandListener(new OnGroupExpandListener() { + int previousGroup = -1; + + @Override + public void onGroupExpand(int groupPosition) { + if(groupPosition != previousGroup) + expandableListView.collapseGroup(previousGroup); + previousGroup = groupPosition; + } + }); + /* expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() { + + @Override + public void onGroupExpand(int groupPosition) { + + /* Toast.makeText(getApplicationContext(), + expandableListTitle.get(groupPosition) + " List Expanded.", + Toast.LENGTH_SHORT).show();*/ + + /* LinearLayout.LayoutParams param = (LinearLayout.LayoutParams) expandableListView.getLayoutParams(); + param.height = (3 * expandableListView.getHeight()); + expandableListView.setLayoutParams(param); + expandableListView.refreshDrawableState(); + scrollView.refreshDrawableState();*/ + /* } + });*/ + + expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() { + + @Override + public void onGroupCollapse(int groupPosition) { + /* LinearLayout.LayoutParams param = (LinearLayout.LayoutParams) expandableListView.getLayoutParams(); + param.height = LinearLayout.LayoutParams.WRAP_CONTENT; + expandableListView.setLayoutParams(param); + expandableListView.refreshDrawableState(); + scrollView.refreshDrawableState();*/ + + } + }); + + /* expandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() { + @Override + public boolean onChildClick(ExpandableListView parent, View v, + int groupPosition, int childPosition, long id) { + Toast.makeText( + getApplicationContext(), + expandableListTitle.get(groupPosition) + + " -> " + + expandableListDetail.get( + expandableListTitle.get(groupPosition)).get( + childPosition), Toast.LENGTH_SHORT + ).show(); + return false; + } + });*/ + + + } + + private void setListViewHeight(ExpandableListView listView) { + ListAdapter listAdapter = listView.getAdapter(); + int totalHeight = 0; + for (int i = 0; i < listAdapter.getCount(); i++) { + View listItem = listAdapter.getView(i, null, listView); + listItem.measure(0, 0); + totalHeight += listItem.getMeasuredHeight(); + } + + ViewGroup.LayoutParams params = listView.getLayoutParams(); + params.height = totalHeight + + (listView.getDividerHeight() * (listAdapter.getCount() - 1)); + listView.setLayoutParams(params); + listView.requestLayout(); + } + + private void setListViewHeight(ExpandableListView listView, + int group) { + ExpandableListAdapter listAdapter = listView.getExpandableListAdapter(); + int totalHeight = 0; + int desiredWidth = MeasureSpec.makeMeasureSpec(listView.getWidth(), + MeasureSpec.AT_MOST); + for (int i = 0; i < listAdapter.getGroupCount(); i++) { + View groupItem = listAdapter.getGroupView(i, false, null, listView); + groupItem.measure(desiredWidth, MeasureSpec.UNSPECIFIED); + totalHeight += groupItem.getMeasuredHeight(); + + if (((listView.isGroupExpanded(i)) && (i != group)) + || ((!listView.isGroupExpanded(i)) && (i == group))) { + for (int j = 0; j < listAdapter.getChildrenCount(i); j++) { + View listItem = listAdapter.getChildView(i, j, false, null, + listView); + listItem.measure(desiredWidth, MeasureSpec.UNSPECIFIED); + + totalHeight += listItem.getMeasuredHeight(); + } + } + } + + ViewGroup.LayoutParams params = listView.getLayoutParams(); + int height = totalHeight + + (listView.getDividerHeight() * (listAdapter.getGroupCount() - 1)); + if (height < 10) + height = 200; + params.height = height; + listView.setLayoutParams(params); + listView.requestLayout(); + + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + if (id == android.R.id.home) { + String fromwhere = getIntent().getStringExtra("From"); + if(fromwhere.equalsIgnoreCase("student")) { + Intent ittAboutToHome = new Intent(AboutUsActivity.this, HomeActivity.class); + startActivity(ittAboutToHome); + } else if(fromwhere.equalsIgnoreCase("Principle")) { + Intent ittAboutToHome = new Intent(AboutUsActivity.this, PrincipleHomeActivity.class); + startActivity(ittAboutToHome); + }else{ + Intent ittAboutToHome = new Intent(AboutUsActivity.this, PMHomeActivity.class); + startActivity(ittAboutToHome); + } + return true; + } + + return super.onOptionsItemSelected(item); + } + + + /* @Override + protected void onResume() { + super.onResume(); + + // register connection status listener + MyApplication.getInstance().setConnectivityListener(this); + } + + @Override + public void onNetworkConnectionChanged(boolean isConnected) { + showSnack(isConnected); + } + + private void showSnack(boolean isConnected) { + + if (!isConnected) { + + AlertDialog.Builder adb = new AlertDialog.Builder(AboutUsActivity.this); + + + //adb.setView(alertDialogView); + + + adb.setTitle("Sorry! Not connected to Internet"); + + + adb.setIcon(android.R.drawable.ic_dialog_alert); + + + adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + + adb.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + adb.setCancelable(true); + adb.show(); + } + +*//* String message; + int color; + if (isConnected) { + message = "Good! Connected to Internet"; + color = Color.WHITE; + } else { + message = "Sorry! Not connected to internet"; + color = Color.RED; + } + + Snackbar snackbar = Snackbar + .make(findViewById(R.id.coordinator_layout), message, Snackbar.LENGTH_LONG); + + View sbView = snackbar.getView(); + TextView textView = (TextView) sbView.findViewById(android.support.design.R.id.snackbar_text); + textView.setTextColor(color); + snackbar.show();*//* + }*/ + +} diff --git a/app/src/main/java/com/leadcampusapp/Activity_confirmoldpin.java b/app/src/main/java/com/leadcampusapp/Activity_confirmoldpin.java new file mode 100644 index 0000000..b231512 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Activity_confirmoldpin.java @@ -0,0 +1,763 @@ +package com.leadcampusapp; + +import android.app.AlertDialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.graphics.Color; +import android.os.AsyncTask; +import android.os.Bundle; +import android.text.Editable; +import android.text.InputType; +import android.text.TextWatcher; +import android.util.Log; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.appcompat.app.AppCompatActivity; + +import com.google.gson.Gson; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import retrofit2.Call; +import retrofit2.Callback; +import retrofit2.Response; + +//import com.covid.R; + +public class Activity_confirmoldpin extends AppCompatActivity { + + + Button verfiy_oldpin_bt; + TextView forgotpin_tv; + EditText otp1_et,otp2_et,otp3_et,otp4_et; + + public static final String sharedpreference_usercredential = "sharedpreferencebook_usercredential"; + public static final String KeyValue_userid = "KeyValue_userid"; + public static final String KeyValue_username = "KeyValue_username"; + public static final String KeyValue_user_mailid = "KeyValue_user_mailid"; + public static final String KeyValue_usercategory = "KeyValue_usercategory"; + public static final String KeyValue_usercellno = "KeyValue_usercellno"; + public static final String KeyValue_isuser_setpin = "KeyValue_isuser_setpin"; + public static final String KeyValue_isuser_changepin = "KeyValue_isuser_changepin"; + public static final String KeyValue_loggedfromgoogle = "KeyValue_loggedfromgoogle"; + + + SharedPreferences sharedpreference_usercredential_Obj; + SharedPreferences.Editor editor_obj; + + public static final String sharedpreference_setpincredential = "sharedpreference_pincredential"; + public static final String KeyValue_setpin = "KeyValue_setpin"; + SharedPreferences sharedpreference_setpin_Obj; + String str_username,str_userID; + + + Class_InternetDectector internetDectector; + Boolean isInternetPresent = false; + String str_confirmoldpin,str_isuser_loggedfromgoogle; + EditText pin1masked_et,pin2masked_et,pin3masked_et,pin4masked_et; + + public static final String PREFBook_PM = "prefbook_pm"; //sharedpreference Book + public static final String PrefID_pm_username = "prefid_pm_username"; // + + SharedPreferences shardprefPM_obj; + + SharedPreferences shardpref_S_obj; + + public static final String PREFBook_Stud= "prefbook_stud"; //sharedpreference Book + public static final String PrefId_S_Username = "prefid_susername"; + public static final String PrefID_Role = "prefid_role"; + + String str_role; + + @Override + protected void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_confirmoldpin); + + verfiy_oldpin_bt =(Button) findViewById(R.id.verfiy_oldpin_bt); + forgotpin_tv=(TextView)findViewById(R.id.forgotpin_tv); + + otp1_et=(EditText) findViewById(R.id.otp1_et); + otp2_et=(EditText) findViewById(R.id.otp2_et); + otp3_et=(EditText) findViewById(R.id.otp3_et); + otp4_et=(EditText) findViewById(R.id.otp4_et); + + pin1masked_et=(EditText)findViewById(R.id.pin1masked_et); + pin2masked_et=(EditText)findViewById(R.id.pin2masked_et); + pin3masked_et=(EditText)findViewById(R.id.pin3masked_et); + pin4masked_et=(EditText)findViewById(R.id.pin4masked_et); + + otp1_et.setInputType(InputType.TYPE_CLASS_NUMBER); + otp2_et.setInputType(InputType.TYPE_CLASS_NUMBER); + otp3_et.setInputType(InputType.TYPE_CLASS_NUMBER); + otp4_et.setInputType(InputType.TYPE_CLASS_NUMBER); + + sharedpreference_setpin_Obj=getSharedPreferences(sharedpreference_setpincredential, Context.MODE_PRIVATE); + // str_setpin = sharedpreference_setpin_Obj.getString(KeyValue_setpin, "").trim(); + + /* sharedpreference_usercredential_Obj=getSharedPreferences(sharedpreference_usercredential, Context.MODE_PRIVATE); + str_username= sharedpreference_usercredential_Obj.getString(KeyValue_username, "").trim(); + str_isuser_loggedfromgoogle=sharedpreference_usercredential_Obj.getString(KeyValue_loggedfromgoogle, "").trim(); + + + sharedpreference_usercredential_Obj=getSharedPreferences(sharedpreference_usercredential, Context.MODE_PRIVATE); + str_userID= sharedpreference_usercredential_Obj.getString(KeyValue_userid, "").trim(); + Log.e("confirmpinuserid",str_userID);*/ + shardpref_S_obj= getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + + shardpref_S_obj.getString(PrefID_Role, "").trim(); + str_role = shardpref_S_obj.getString(PrefID_Role, "").trim(); + Log.e("str_role:", str_role); + + if(str_role.equalsIgnoreCase("Student")) { + + //otp4_et + shardpref_S_obj = getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + + shardpref_S_obj.getString(PrefId_S_Username, "").trim(); + str_username = shardpref_S_obj.getString(PrefId_S_Username, "").trim(); + Log.d("str_username", str_username); + }else { + shardprefPM_obj = getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + str_username = shardprefPM_obj.getString(PrefID_pm_username, "").trim(); + Log.e("str_pm_username:", str_username); + + } + + otp1_et.requestFocus(); + + otp1_et.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + if(otp1_et.getText().toString().length()>=1) + { + pin1masked_et.setVisibility(View.VISIBLE); + otp1_et.setVisibility(View.GONE); + pin1masked_et.setText("*"); + + otp2_et.requestFocus(); + + } + } + + @Override + public void afterTextChanged(Editable editable) { + + } + }); + + + + pin1masked_et.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void afterTextChanged(Editable editable) + { + if(pin1masked_et.getText().toString().length()==0) + { + pin1masked_et.setVisibility(View.GONE); + otp1_et.setVisibility(View.VISIBLE); + otp1_et.setText(""); + otp1_et.requestFocus(); + } + } + }); + + + + otp2_et.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + if(otp2_et.getText().toString().length()>=1) + { + pin2masked_et.setVisibility(View.VISIBLE); + otp2_et.setVisibility(View.GONE); + pin2masked_et.setText("*"); + otp3_et.requestFocus(); + } + } + + @Override + public void afterTextChanged(Editable editable) { + + } + }); + + + + pin2masked_et.addTextChangedListener(new TextWatcher() + { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void afterTextChanged(Editable editable) + { + if(pin2masked_et.getText().toString().length()==0) + { + pin2masked_et.setVisibility(View.GONE); + otp2_et.setVisibility(View.VISIBLE); + otp2_et.setText(""); + otp2_et.requestFocus(); + } + } + }); + + + otp3_et.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + if(otp3_et.getText().toString().length()>=1) + { + pin3masked_et.setVisibility(View.VISIBLE); + otp3_et.setVisibility(View.GONE); + pin3masked_et.setText("*"); + otp4_et.requestFocus(); + } + } + + @Override + public void afterTextChanged(Editable editable) { + + } + }); + + + pin3masked_et.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void afterTextChanged(Editable editable) + { + if(pin3masked_et.getText().toString().length()==0) + { + pin3masked_et.setVisibility(View.GONE); + otp3_et.setVisibility(View.VISIBLE); + otp3_et.setText(""); + otp3_et.requestFocus(); + } + } + }); + + + + otp4_et.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + if(otp4_et.getText().toString().length()>=1) + { + + pin4masked_et.setVisibility(View.VISIBLE); + otp4_et.setVisibility(View.GONE); + pin4masked_et.setText("*"); + + otp4_et.requestFocus(); + } + } + + @Override + public void afterTextChanged(Editable editable) + { + + } + }); + + + + pin4masked_et.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void afterTextChanged(Editable editable) + { + + if(pin4masked_et.getText().toString().length()==0) + { + pin4masked_et.setVisibility(View.GONE); + otp4_et.setVisibility(View.VISIBLE); + otp4_et.setText(""); + otp4_et.requestFocus(); + } + } + }); + + + + verfiy_oldpin_bt.setOnClickListener(new View.OnClickListener() + { + @Override + public void onClick(View v) + { + if(validation()) { + + str_confirmoldpin = otp1_et.getText().toString() + + otp2_et.getText().toString() + + otp3_et.getText().toString() + + otp4_et.getText().toString(); + + if (2>1) + { + + internetDectector = new Class_InternetDectector(getApplicationContext()); + isInternetPresent = internetDectector.isConnectingToInternet(); + if (isInternetPresent) { + + UpdatePinPassword updatePinPassword=new UpdatePinPassword(Activity_confirmoldpin.this); + updatePinPassword.execute(); + // AsyncTask_ValidateUserPIN(); + } + + + } else{ + Toast.makeText(getApplicationContext(),"PIN doesn't match", Toast.LENGTH_LONG).show(); + } + + } + } + }); + + + + + forgotpin_tv.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) + { + + AlertDialog.Builder dialog = new AlertDialog.Builder(Activity_confirmoldpin.this); + dialog.setCancelable(false); + dialog.setTitle(R.string.forgotpin); + dialog.setMessage("You need to relogin to the application for set new PIN.\n" + + "Do you want to proceed"); + + dialog.setPositiveButton("Continue", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) + { + internetDectector = new Class_InternetDectector(getApplicationContext()); + isInternetPresent = internetDectector.isConnectingToInternet(); + if (isInternetPresent) { + editor_obj = sharedpreference_usercredential_Obj.edit(); + editor_obj.putString(KeyValue_isuser_setpin, ""); + editor_obj.commit(); + + editor_obj = sharedpreference_usercredential_Obj.edit(); + editor_obj.putString(KeyValue_isuser_changepin, ""); + editor_obj.commit(); + + + if(str_isuser_loggedfromgoogle.isEmpty()) + { + + }else{ + editor_obj = sharedpreference_usercredential_Obj.edit(); + editor_obj.putString(KeyValue_loggedfromgoogle, "yes"); + editor_obj.commit(); + } + + + Intent i = new Intent(Activity_confirmoldpin.this, MainActivity.class); + startActivity(i); + finish(); + + } + else + { + Toast.makeText(Activity_confirmoldpin.this, "Kindly connect to internet", Toast.LENGTH_SHORT).show(); + } + } + }) + .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + //Action for "Cancel". + dialog.dismiss(); + } + }); + + final AlertDialog alert = dialog.create(); + alert.setOnShowListener(new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface arg0) { + alert.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(Color.RED); + alert.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#004D40")); + } + }); + alert.show(); + + } + }); + + + + + }//On create() + + + + + public boolean validation() + { + boolean b_otp1, b_otp2, b_otp3, b_otp4; + b_otp1=b_otp2=b_otp3=b_otp4=true; + + + + if (otp1_et.getText().toString().trim().length() == 0) { + otp1_et.setError("Enter PIN"); + otp1_et.requestFocus(); + b_otp1 = false; + } + + if (otp2_et.getText().toString().trim().length() == 0) { + otp2_et.setError("Enter PIN"); + otp2_et.requestFocus(); + b_otp2 = false; + } + + if (otp3_et.getText().toString().trim().length() == 0) { + otp3_et.setError("Enter PIN"); + otp3_et.requestFocus(); + b_otp3 = false; + } + if(otp4_et.getText().toString().trim().length()==0) + { + otp4_et.setError("Enter PIN"); + otp4_et.requestFocus(); + b_otp4=false; + } + + return (b_otp1 && b_otp2 && b_otp3&& b_otp4); + } + + + + @Override + public void onBackPressed() + { + + /*AlertDialog.Builder dialog = new AlertDialog.Builder(Activity_confirmoldpin.this); + dialog.setCancelable(false); + dialog.setTitle(R.string.alert); + dialog.setMessage("Are you sure want to go back"); + + dialog.setPositiveButton("Yes", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) + { + + finish(); + } + }) + .setNegativeButton("No", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + //Action for "Cancel". + dialog.dismiss(); + } + }); + + final AlertDialog alert = dialog.create(); + alert.setOnShowListener(new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface arg0) { + alert.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(Color.RED); + alert.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#004D40")); + } + }); + alert.show();*/ + Intent startMain = new Intent(Intent.ACTION_MAIN); + startMain.addCategory(Intent.CATEGORY_HOME); + startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(startMain); + } + + + + + + + public class UpdatePinPassword extends AsyncTask { + + Context context; + //AlertDialog alertDialog; + + //private ProgressBar progressBar; + + private ProgressDialog progressDialog; + + UpdatePinPassword(Context ctx) { + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(String... params) { + + SoapObject response = UpdatePinPassword(); + + //Log.d("ResponseCommitsss", response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressDialog.setMessage("Loading"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapObject result) { + + + String str_result=result.getProperty("Status").toString(); + + if(str_result.equals("Success")){ + // dialog.dismiss(); + // Toast.makeText(context,"Your Request sent to the manager",Toast.LENGTH_LONG).show(); + Intent i = new Intent(Activity_confirmoldpin.this, Activity_setpin.class); + i.putExtra("Key_confirmoldpin", "yes"); + i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); + startActivity(i); + finish(); + }else{ + + Toast toast = Toast.makeText(getApplicationContext(), "Wrong PIN", Toast.LENGTH_LONG); + TextView toastMessage = (TextView) toast.getView().findViewById(android.R.id.message); + toastMessage.setTextColor(Color.RED); + toast.show(); + } + + progressDialog.dismiss(); + } + + } + + + private SoapObject UpdatePinPassword() + { + + String METHOD_NAME = "ValidateLogin_PIN"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/ValidateLogin_PIN"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + request.addProperty("Username", str_username);//string + //request.addProperty("StudentName",edt_studName.getText().toString()); + request.addProperty("PIN",str_confirmoldpin);//string + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Login.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + // SendStudentRequestforManager{Lead_Id=MF00993; Email_id=testing; Student_MobileNo=9689240475; Message=testing; } + + Log.d("tag","Request UpdatePinPassword="+request.toString()); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + // Log.d("soapResponseyyyyyyy",envelope.getResponse().toString()); + + SoapObject response = (SoapObject) envelope.getResponse(); + Log.d("tag","soapRespons UpdatePinPassword="+response.toString()); + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.d("exception outside",t.getMessage().toString()); + } + return null; + + + } + + /* public void AsyncTask_ValidateUserPIN() + { + + final ProgressDialog progressDialog; + progressDialog = new ProgressDialog(com.dfcovid.Activity_confirmoldpin.this); + progressDialog.setMessage("Loading...."); + progressDialog.setTitle("Please wait fetching Details...."); + progressDialog.setCancelable(false); + progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); + progressDialog.show(); + + + + Class_loginPinrequest request = new Class_loginPinrequest(); + request.setUsername(str_username); + request.setPIN(str_confirmoldpin); + + + Interface_userservice userService; + userService = Class_ApiUtils.getUserService(); + Call call = userService.Post_ValidateUserPIN(request); + + Log.e("TAG", "pinreq : " + new Gson().toJson(request)); + + call.enqueue(new Callback() { + @Override + public void onResponse(Call call, Response response) + { + Log.e("response", response.toString()); + + Log.e("TAG", "pinRes: " + new Gson().toJson(response)); + Log.e("tag","PinResponse body"+ String.valueOf(response.body())); + // DefaultResponse error1 = ErrorUtils.parseError(response); + *//* Log.e("response new:",error1.getMsg()); + Log.e("response new status:", String.valueOf(error1.getstatus()));*//* + + Class_normalloginresponse user_object; + user_object = (Class_normalloginresponse) response.body(); + + if (response.isSuccessful()) + { + + progressDialog.dismiss(); + + String str_userstatus=user_object.getMessage().trim().toString(); + if(str_userstatus.equalsIgnoreCase("Success")) + { + + Intent i = new Intent(com.dfcovid.Activity_confirmoldpin.this, com.dfcovid.Activity_setpin.class); + i.putExtra("Key_confirmoldpin", "yes"); + i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); + startActivity(i); + finish(); + + + } + else{ + + Toast toast = Toast.makeText(getApplicationContext(), "Wrong PIN", Toast.LENGTH_LONG); + TextView toastMessage = (TextView) toast.getView().findViewById(android.R.id.message); + toastMessage.setTextColor(Color.RED); + toast.show(); + } + + + + } else { + + + DefaultResponse error = ErrorUtils.parseError(response); + // … and use it to show error information + + // … or just log the issue like we’re doing :) + Log.d("responseerror", error.getMsg()); + + Toast.makeText(com.dfcovid.Activity_confirmoldpin.this, "Wrong PIN", Toast.LENGTH_SHORT).show(); + progressDialog.dismiss(); + } + } + + @Override + public void onFailure(Call call, Throwable t) + { + + Log.d("retrofiteerror", t.toString()); + Toast.makeText(com.dfcovid.Activity_confirmoldpin.this, t.getMessage(), Toast.LENGTH_SHORT).show(); + } + });// end of call + + }*/ + + + + + +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/Activity_confirmpin.java b/app/src/main/java/com/leadcampusapp/Activity_confirmpin.java new file mode 100644 index 0000000..20a9db3 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Activity_confirmpin.java @@ -0,0 +1,705 @@ +package com.leadcampusapp; + +import android.app.AlertDialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.graphics.Color; +import android.os.AsyncTask; +import android.os.Bundle; +import android.text.Editable; +import android.text.InputType; +import android.text.TextWatcher; +import android.util.Log; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.Toast; + +import androidx.appcompat.app.AppCompatActivity; + +import com.google.gson.Gson; +import com.leadcampusapp.remote.Interface_userservice; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import retrofit2.Call; +import retrofit2.Callback; +import retrofit2.Response; + +//import com.covid.R; + +public class Activity_confirmpin extends AppCompatActivity { + + + Button submit_pin_bt,reset_pin_bt; + EditText otp1_et,otp2_et,otp3_et,otp4_et; + + + + public static final String sharedpreference_usercredential = "sharedpreferencebook_usercredential"; + public static final String KeyValue_userid = "KeyValue_userid"; + public static final String KeyValue_username = "KeyValue_username"; + public static final String KeyValue_user_mailid = "KeyValue_user_mailid"; + public static final String KeyValue_usercategory = "KeyValue_usercategory"; + public static final String KeyValue_usercellno = "KeyValue_usercellno"; + public static final String KeyValue_isuser_setpin = "KeyValue_isuser_setpin"; + + + SharedPreferences sharedpreference_usercredential_Obj; + SharedPreferences.Editor editor_obj; + + public static final String sharedpreference_setpincredential = "sharedpreference_pincredential"; + public static final String KeyValue_setpin = "KeyValue_setpin"; + SharedPreferences sharedpreference_setpin_Obj; + String str_setpin,str_userID; + + + Class_InternetDectector internetDectector; + Boolean isInternetPresent = false; + EditText pin1masked_et,pin2masked_et,pin3masked_et,pin4masked_et; + + SharedPreferences shardpref_S_obj; + SharedPreferences.Editor editor_S; + public static final String PREFBook_Stud= "prefbook_stud"; //sharedpreference Book + public static final String PrefID_RegID = "prefid_regid"; // + public static final String PrefID_Role = "prefid_role"; + + String str_RegID,str_role; + + public static final String PREFBook_PM = "prefbook_pm"; //sharedpreference Book + public static final String PrefID_pm_username = "prefid_pm_username"; // + + SharedPreferences shardprefPM_obj; + + + @Override + protected void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_confirmpin); + + submit_pin_bt =(Button) findViewById(R.id.submit_pin_bt); + reset_pin_bt =(Button) findViewById(R.id.reset_pin_bt); + otp1_et=(EditText) findViewById(R.id.otp1_et); + otp2_et=(EditText) findViewById(R.id.otp2_et); + otp3_et=(EditText) findViewById(R.id.otp3_et); + otp4_et=(EditText) findViewById(R.id.otp4_et); + + pin1masked_et=(EditText)findViewById(R.id.pin1masked_et); + pin2masked_et=(EditText)findViewById(R.id.pin2masked_et); + pin3masked_et=(EditText)findViewById(R.id.pin3masked_et); + pin4masked_et=(EditText)findViewById(R.id.pin4masked_et); + + + otp1_et.setInputType(InputType.TYPE_CLASS_NUMBER); + otp2_et.setInputType(InputType.TYPE_CLASS_NUMBER); + otp3_et.setInputType(InputType.TYPE_CLASS_NUMBER); + otp4_et.setInputType(InputType.TYPE_CLASS_NUMBER); + + sharedpreference_setpin_Obj=getSharedPreferences(sharedpreference_setpincredential, Context.MODE_PRIVATE); + str_setpin = sharedpreference_setpin_Obj.getString(KeyValue_setpin, "").trim(); + + + sharedpreference_usercredential_Obj=getSharedPreferences(sharedpreference_usercredential, Context.MODE_PRIVATE); + /* str_userID= sharedpreference_usercredential_Obj.getString(KeyValue_userid, "").trim(); + Log.e("confirmpinuserid",str_userID);*/ + + shardpref_S_obj= getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + shardpref_S_obj.getString(PrefID_Role, "").trim(); + str_role = shardpref_S_obj.getString(PrefID_Role, "").trim(); + Log.e("tag","str_role="+str_role); + shardpref_S_obj.getString(PrefID_RegID, "").trim(); + str_RegID = shardpref_S_obj.getString(PrefID_RegID, "").trim(); + Log.e("tag","str_RegID="+str_RegID); + + + + otp1_et.requestFocus(); + + otp1_et.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + if(otp1_et.getText().toString().length()>=1) + { + pin1masked_et.setVisibility(View.VISIBLE); + otp1_et.setVisibility(View.GONE); + pin1masked_et.setText("*"); + + otp2_et.requestFocus(); + } + } + + @Override + public void afterTextChanged(Editable editable) { + + } + }); + + + + pin1masked_et.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void afterTextChanged(Editable editable) + { + if(pin1masked_et.getText().toString().length()==0) + { + pin1masked_et.setVisibility(View.GONE); + otp1_et.setVisibility(View.VISIBLE); + otp1_et.setText(""); + otp1_et.requestFocus(); + } + + } + }); + + + + + + otp2_et.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + if(otp2_et.getText().toString().length()>=1) + { + + pin2masked_et.setVisibility(View.VISIBLE); + otp2_et.setVisibility(View.GONE); + pin2masked_et.setText("*"); + + + otp3_et.requestFocus(); + } + } + + @Override + public void afterTextChanged(Editable editable) { + + } + }); + + + + pin2masked_et.addTextChangedListener(new TextWatcher() + { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void afterTextChanged(Editable editable) + { + if(pin2masked_et.getText().toString().length()==0) + { + pin2masked_et.setVisibility(View.GONE); + otp2_et.setVisibility(View.VISIBLE); + otp2_et.setText(""); + otp2_et.requestFocus(); + } + } + }); + + + + + + otp3_et.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + if(otp3_et.getText().toString().length()>=1) + { + pin3masked_et.setVisibility(View.VISIBLE); + otp3_et.setVisibility(View.GONE); + pin3masked_et.setText("*"); + + otp4_et.requestFocus(); + } + } + + @Override + public void afterTextChanged(Editable editable) { + + } + }); + + + pin3masked_et.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void afterTextChanged(Editable editable) + { + if(pin3masked_et.getText().toString().length()==0) + { + pin3masked_et.setVisibility(View.GONE); + otp3_et.setVisibility(View.VISIBLE); + otp3_et.setText(""); + otp3_et.requestFocus(); + } + } + }); + + + + + otp4_et.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + if(otp4_et.getText().toString().length()>=1) + { + + pin4masked_et.setVisibility(View.VISIBLE); + otp4_et.setVisibility(View.GONE); + pin4masked_et.setText("*"); + + otp4_et.requestFocus(); + } + } + + @Override + public void afterTextChanged(Editable editable) + { + + } + }); + + + + pin4masked_et.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void afterTextChanged(Editable editable) + { + + if(pin4masked_et.getText().toString().length()==0) + { + pin4masked_et.setVisibility(View.GONE); + otp4_et.setVisibility(View.VISIBLE); + otp4_et.setText(""); + otp4_et.requestFocus(); + } + } + }); + + + + + + + + submit_pin_bt.setOnClickListener(new View.OnClickListener() + { + @Override + public void onClick(View v) + { + if(validation()) { + + String str_confirmpin = otp1_et.getText().toString() + + otp2_et.getText().toString() + + otp3_et.getText().toString() + + otp4_et.getText().toString(); + + if (str_setpin.equals(str_confirmpin)) + { + + internetDectector = new Class_InternetDectector(getApplicationContext()); + isInternetPresent = internetDectector.isConnectingToInternet(); + if (isInternetPresent) { + + //AsyncTask_setthepin(); + UpdatePinPassword updatePinPassword = new UpdatePinPassword(Activity_confirmpin.this); + updatePinPassword.execute(); + } + + + } else{ + Toast.makeText(getApplicationContext(),"PIN doesn't match", Toast.LENGTH_LONG).show(); + } + + } + } + }); + + + reset_pin_bt.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) + { + onBackPressed(); + } + }); + + + }//On create() + + + + + public boolean validation() + { + boolean b_otp1, b_otp2, b_otp3, b_otp4; + b_otp1=b_otp2=b_otp3=b_otp4=true; + + + + if (otp1_et.getText().toString().trim().length() == 0) { + otp1_et.setError("Enter OTP"); + otp1_et.requestFocus(); + b_otp1 = false; + } + + if (otp2_et.getText().toString().trim().length() == 0) { + otp2_et.setError("Enter OTP"); + otp2_et.requestFocus(); + b_otp2 = false; + } + + if (otp3_et.getText().toString().trim().length() == 0) { + otp3_et.setError("Enter OTP"); + otp3_et.requestFocus(); + b_otp3 = false; + } + if(otp4_et.getText().toString().trim().length()==0) + { + otp4_et.setError("Enter OTP"); + otp4_et.requestFocus(); + b_otp4=false; + } + + return (b_otp1 && b_otp2 && b_otp3&& b_otp4); + } + + + + @Override + public void onBackPressed() + { + + /*AlertDialog.Builder dialog = new AlertDialog.Builder(Activity_confirmpin.this); + dialog.setCancelable(false); + dialog.setTitle(R.string.alert); + dialog.setMessage("Are you sure want to go back"); + + dialog.setPositiveButton("Yes", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) + { + Intent i = new Intent(Activity_confirmpin.this, Activity_setpin.class); + startActivity(i); + finish(); + } + }) + .setNegativeButton("No", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + //Action for "Cancel". + dialog.dismiss(); + } + }); + + final AlertDialog alert = dialog.create(); + alert.setOnShowListener(new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface arg0) { + alert.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(Color.RED); + alert.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#004D40")); + } + }); + alert.show();*/ + Intent startMain = new Intent(Intent.ACTION_MAIN); + startMain.addCategory(Intent.CATEGORY_HOME); + startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(startMain); + } + + + public class UpdatePinPassword extends AsyncTask { + + Context context; + //AlertDialog alertDialog; + + //private ProgressBar progressBar; + + private ProgressDialog progressDialog; + + UpdatePinPassword(Context ctx) { + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapPrimitive doInBackground(String... params) { + + SoapPrimitive response = UpdatePinPassword(); + + //Log.d("ResponseCommitsss", response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressDialog.setMessage("Loading"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + + + + if(result.toString().equalsIgnoreCase("Updated.")){ + // dialog.dismiss(); + Toast.makeText(Activity_confirmpin.this, "PIN Updated Successfully", Toast.LENGTH_SHORT).show(); + + editor_obj = sharedpreference_usercredential_Obj.edit(); + editor_obj.putString(KeyValue_isuser_setpin, "yes"); + editor_obj.commit(); + + if(str_role.equalsIgnoreCase("Student")) { + Intent i = new Intent(Activity_confirmpin.this, HomeActivity.class); + startActivity(i); + finish(); + }else if(str_role.equalsIgnoreCase("Manager")){ + Intent i = new Intent(Activity_confirmpin.this, PMHomeActivity.class); + startActivity(i); + finish(); + }else if(str_role.equalsIgnoreCase("Principal")){ + Intent i = new Intent(Activity_confirmpin.this, PrincipleHomeActivity.class); + startActivity(i); + finish(); + } + }else{ + + progressDialog.dismiss(); + Toast.makeText(Activity_confirmpin.this, "WS:Error", Toast.LENGTH_SHORT).show(); + + } + + progressDialog.dismiss(); + } + + } + + + private SoapPrimitive UpdatePinPassword() + { + + String METHOD_NAME = "UpdatePinPassword"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/UpdatePinPassword"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + request.addProperty("User_Id", str_RegID);//string + //request.addProperty("StudentName",edt_studName.getText().toString()); + request.addProperty("PIN",str_setpin);//string + request.addProperty("User_Type",str_role);//string + request.addProperty("Set_Type","");// string + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Login.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + // SendStudentRequestforManager{Lead_Id=MF00993; Email_id=testing; Student_MobileNo=9689240475; Message=testing; } + + Log.d("tag","Request UpdatePinPassword="+request.toString()); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + // Log.d("soapResponseyyyyyyy",envelope.getResponse().toString()); + + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + Log.d("tag","soapRespons UpdatePinPassword="+response.toString()); + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.d("exception outside",t.getMessage().toString()); + } + return null; + + + } + + /*public void AsyncTask_setthepin() + { + + final ProgressDialog progressDialog; + progressDialog = new ProgressDialog(Activity_confirmpin.this); + progressDialog.setMessage("Loading...."); + progressDialog.setTitle("Please wait Updating PIN...."); + progressDialog.setCancelable(false); + progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); + progressDialog.show(); + + + + Class_pinrequest request = new Class_pinrequest(); + request.setUser_Id(str_userID); + request.setPIN(str_setpin); + + + Interface_userservice userService; + userService = Class_ApiUtils.getUserService(); + Call call = userService.Post_UpdateUserPIN(request); + + Log.e("TAG", "pinreq : " + new Gson().toJson(request)); + + call.enqueue(new Callback() { + @Override + public void onResponse(Call call, Response response) + { + Log.e("response", response.toString()); + + Log.e("TAG", "pinRes: " + new Gson().toJson(response)); + Log.e("tag","PinResponse body"+ String.valueOf(response.body())); + + // "Status": true, + // "Message": "Success", + *//*"Status": false, + "Message": "Invalid Username"*//* + + Class_normalloginresponse user_object; + user_object = (Class_normalloginresponse) response.body(); + + if (response.isSuccessful()) { + + if (user_object.getMessage().equalsIgnoreCase("Success")) + { + + progressDialog.dismiss(); + + Toast.makeText(Activity_confirmpin.this, "PIN Updated Successfully", Toast.LENGTH_SHORT).show(); + + editor_obj = sharedpreference_usercredential_Obj.edit(); + editor_obj.putString(KeyValue_isuser_setpin, "yes"); + editor_obj.commit(); + + Intent i = new Intent(Activity_confirmpin.this, Dashboard_Activity.class); + startActivity(i); + finish(); + + }else{ + + progressDialog.dismiss(); + Toast.makeText(Activity_confirmpin.this, "WS:Error", Toast.LENGTH_SHORT).show(); + + } + } else { + + + DefaultResponse error = ErrorUtils.parseError(response); + // … and use it to show error information + + // … or just log the issue like we’re doing :) + Log.d("responseerror", error.getMsg()); + + Toast.makeText(Activity_confirmpin.this, error.getMsg(), Toast.LENGTH_SHORT).show(); + progressDialog.dismiss(); + } + } + + @Override + public void onFailure(Call call, Throwable t) + { + + Log.d("retrofiteerror", t.toString()); + Toast.makeText(Activity_confirmpin.this, t.getMessage(), Toast.LENGTH_SHORT).show(); + } + });// end of call + + }*/ + + + + + + +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/Activity_pinlogin.java b/app/src/main/java/com/leadcampusapp/Activity_pinlogin.java new file mode 100644 index 0000000..25b3738 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Activity_pinlogin.java @@ -0,0 +1,988 @@ +package com.leadcampusapp; + +import android.app.AlertDialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.graphics.Color; +import android.os.AsyncTask; +import android.os.Bundle; +import android.text.Editable; +import android.text.InputType; +import android.text.TextWatcher; +import android.util.Log; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.view.WindowManager; +import android.widget.EditText; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.appcompat.app.AppCompatActivity; + +import com.google.gson.Gson; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import retrofit2.Call; +import retrofit2.Callback; +import retrofit2.Response; + +//import br.com.sapereaude.maskedEditText.MaskedEditText; + +//import com.covid.R; + +public class Activity_pinlogin extends AppCompatActivity +{ + + + public static final String sharedpreference_usercredential = "sharedpreferencebook_usercredential"; + public static final String KeyValue_userid = "KeyValue_userid"; + public static final String KeyValue_username = "KeyValue_username"; + public static final String KeyValue_user_mailid = "KeyValue_user_mailid"; + public static final String KeyValue_usercategory = "KeyValue_usercategory"; + public static final String KeyValue_usercellno = "KeyValue_usercellno"; + public static final String KeyValue_isuser_setpin = "KeyValue_isuser_setpin"; + public static final String KeyValue_isuser_changepin = "KeyValue_isuser_changepin"; + public static final String KeyValue_loggedfromgoogle = "KeyValue_loggedfromgoogle"; + + + SharedPreferences sharedpreference_usercredential_Obj; + SharedPreferences.Editor editor_obj; + + TextView forgotpin_tv; + //EditText otp1_et,otp2_et,otp3_et,otp4_et; + EditText otp1_et,otp2_et,otp3_et,otp4_et; + EditText pin1masked_et,pin2masked_et,pin3masked_et,pin4masked_et; + + Class_InternetDectector internetDectector; + Boolean isInternetPresent = false; + + String str_userID,str_username,str_loginpin,str_isuser_loggedfromgoogle=""; + String str_pin1,str_pin2,str_pin3,str_pin4; + + public static final String PREFBook_PM = "prefbook_pm"; //sharedpreference Book + public static final String PrefID_pm_username = "prefid_pm_username"; // + + SharedPreferences shardprefPM_obj; + + SharedPreferences shardpref_S_obj; + + public static final String PREFBook_Stud= "prefbook_stud"; //sharedpreference Book + public static final String PrefId_S_Username = "prefid_susername"; + public static final String PrefID_Role = "prefid_role"; + + String str_role; + + @Override + protected void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_otp); + forgotpin_tv=(TextView)findViewById(R.id.forgotpin_tv); + otp1_et= (EditText) findViewById(R.id.otp1_et); + otp2_et=(EditText) findViewById(R.id.otp2_et); + otp3_et=(EditText) findViewById(R.id.otp3_et); + otp4_et=(EditText) findViewById(R.id.otp4_et); + pin1masked_et=(EditText)findViewById(R.id.pin1masked_et); + pin2masked_et=(EditText)findViewById(R.id.pin2masked_et); + pin3masked_et=(EditText)findViewById(R.id.pin3masked_et); + pin4masked_et=(EditText)findViewById(R.id.pin4masked_et); + + + otp1_et.setInputType(InputType.TYPE_CLASS_NUMBER); + otp2_et.setInputType(InputType.TYPE_CLASS_NUMBER); + otp3_et.setInputType(InputType.TYPE_CLASS_NUMBER); + otp4_et.setInputType(InputType.TYPE_CLASS_NUMBER); + + getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); + + str_pin1=str_pin2=str_pin3=str_pin4=""; + + sharedpreference_usercredential_Obj=getSharedPreferences(sharedpreference_usercredential, Context.MODE_PRIVATE); + /* str_userID= sharedpreference_usercredential_Obj.getString(KeyValue_userid, "").trim(); + str_username= sharedpreference_usercredential_Obj.getString(KeyValue_username, "").trim(); + str_isuser_loggedfromgoogle=sharedpreference_usercredential_Obj.getString(KeyValue_loggedfromgoogle, "").trim(); +*/ + // shardprefPM_obj_count = getSharedPreferences(PREFBook_PM_Count, Context.MODE_PRIVATE); + + shardpref_S_obj= getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + shardpref_S_obj.getString(PrefID_Role, "").trim(); + str_role = shardpref_S_obj.getString(PrefID_Role, "").trim(); + Log.e("str_role:", str_role); + + if(str_role.equalsIgnoreCase("Student")) { + + //otp4_et + shardpref_S_obj = getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + + shardpref_S_obj.getString(PrefId_S_Username, "").trim(); + str_username = shardpref_S_obj.getString(PrefId_S_Username, "").trim(); + Log.d("str_username", str_username); + }else { + shardprefPM_obj = getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + str_username = shardprefPM_obj.getString(PrefID_pm_username, "").trim(); + Log.e("str_pm_username:", str_username); + + } + + otp1_et.requestFocus(); + + otp1_et.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + if(otp1_et.getText().toString().length()>=1) + { + + + pin1masked_et.setVisibility(View.VISIBLE); + otp1_et.setVisibility(View.GONE); + pin1masked_et.setText("*"); + + + otp2_et.requestFocus(); + otp4_et.setText(""); + } + + } + + @Override + public void afterTextChanged(Editable editable) { + // Toast.makeText(getApplicationContext(),"afterTextchanged",Toast.LENGTH_SHORT).show(); + + } + }); + + + + + + pin1masked_et.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + } + + @Override + public void afterTextChanged(Editable editable) + { + if(pin1masked_et.getText().toString().length()==0) + { + + pin1masked_et.setVisibility(View.GONE); + otp1_et.setVisibility(View.VISIBLE); + otp1_et.setText(""); + otp4_et.setText(""); + otp1_et.requestFocus(); + } + } + }); + + + + + + + otp2_et.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + if(otp2_et.getText().toString().length()>=1) + { + pin2masked_et.setVisibility(View.VISIBLE); + otp2_et.setVisibility(View.GONE); + pin2masked_et.setText("*"); + + otp3_et.requestFocus(); + otp4_et.setText(""); + } + } + + @Override + public void afterTextChanged(Editable editable) { + + } + }); + + + + + + + pin2masked_et.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void afterTextChanged(Editable editable) + { + + if(pin2masked_et.getText().toString().length()==0) + { + + pin2masked_et.setVisibility(View.GONE); + otp2_et.setVisibility(View.VISIBLE); + otp2_et.setText(""); + otp4_et.setText(""); + otp2_et.requestFocus(); + } + + } + }); + + + + + + + + + + otp3_et.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + if(otp3_et.getText().toString().length()>=1) + { + + + pin3masked_et.setVisibility(View.VISIBLE); + otp3_et.setVisibility(View.GONE); + pin3masked_et.setText("*"); + + + + + otp4_et.requestFocus(); + otp4_et.setText(""); + } + } + + @Override + public void afterTextChanged(Editable editable) { + + } + }); + + + + pin3masked_et.addTextChangedListener(new TextWatcher() + { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void afterTextChanged(Editable editable) + { + + if(pin3masked_et.getText().toString().length()==0) + { + + pin3masked_et.setVisibility(View.GONE); + otp3_et.setVisibility(View.VISIBLE); + otp3_et.setText(""); + otp4_et.setText(""); + otp3_et.requestFocus(); + } + } + }); + + + + + otp4_et.addTextChangedListener(new TextWatcher() + { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) + { + + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) + { + + if(s.toString().trim().isEmpty()) + { + + + } + else + { + + if(validation()) + { + internetDectector = new Class_InternetDectector(getApplicationContext()); + isInternetPresent = internetDectector.isConnectingToInternet(); + if (isInternetPresent) + { + + str_loginpin=otp1_et.getText().toString()+ + otp2_et.getText().toString()+ + otp3_et.getText().toString()+ + otp4_et.getText().toString(); + + + pin4masked_et.setVisibility(View.VISIBLE); + otp4_et.setVisibility(View.GONE); + pin4masked_et.setText("*"); + + + + + /*str_loginpin=str_pin1.trim()+ + str_pin2.trim()+ + str_pin3.trim()+ + otp4_et.getText().toString();*/ + + UpdatePinPassword updatePinPassword=new UpdatePinPassword(Activity_pinlogin.this); + updatePinPassword.execute(); + // AsyncTask_ValidateUserPIN(); + + } + + + } + + + } + + } + + @Override + public void afterTextChanged(Editable s) { + + } + }); + + + + + pin4masked_et.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void afterTextChanged(Editable editable) + { + + if(pin4masked_et.getText().toString().length()==0) + { + + pin4masked_et.setVisibility(View.GONE); + otp4_et.setVisibility(View.VISIBLE); + otp4_et.setText(""); + otp4_et.requestFocus(); + } + } + }); + + + + + + + + + + + + + + + forgotpin_tv.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) + { + + AlertDialog.Builder dialog = new AlertDialog.Builder(Activity_pinlogin.this); + dialog.setCancelable(false); + dialog.setTitle(R.string.forgotpin); + dialog.setMessage("You need to relogin to the application for set new PIN.\n" + + "Do you want to proceed"); + + dialog.setPositiveButton("Continue", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) + { + + internetDectector = new Class_InternetDectector(getApplicationContext()); + isInternetPresent = internetDectector.isConnectingToInternet(); + if (isInternetPresent) + { + + editor_obj = sharedpreference_usercredential_Obj.edit(); + editor_obj.putString(KeyValue_isuser_setpin, ""); + editor_obj.commit(); + + editor_obj = sharedpreference_usercredential_Obj.edit(); + editor_obj.putString(KeyValue_isuser_changepin, ""); + editor_obj.commit(); + + if(str_isuser_loggedfromgoogle.isEmpty()) + { + + }else{ + editor_obj = sharedpreference_usercredential_Obj.edit(); + editor_obj.putString(KeyValue_loggedfromgoogle, "yes"); + editor_obj.commit(); + } + + Intent i = new Intent(Activity_pinlogin.this, LoginActivity.class); + startActivity(i); + finish(); + + } + else{ + + Toast.makeText(Activity_pinlogin.this, "Kindly connect to internet", Toast.LENGTH_SHORT).show(); + } + } + }) + .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + //Action for "Cancel". + dialog.dismiss(); + } + }); + + final AlertDialog alert = dialog.create(); + alert.setOnShowListener(new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface arg0) { + alert.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(Color.RED); + alert.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#004D40")); + } + }); + alert.show(); + + } + }); + + }//On create + + + + + public boolean validation() + { + boolean b_otp1, b_otp2, b_otp3, b_otp4; + b_otp1=b_otp2=b_otp3=b_otp4=true; + + + + if (otp1_et.getText().toString().trim().length() == 0) { + otp1_et.setError("Enter OTP"); + otp1_et.requestFocus(); + b_otp1 = false; + } + + if (otp2_et.getText().toString().trim().length() == 0) { + otp2_et.setError("Enter OTP"); + otp2_et.requestFocus(); + b_otp2 = false; + } + + if (otp3_et.getText().toString().trim().length() == 0) { + otp3_et.setError("Enter OTP"); + otp3_et.requestFocus(); + b_otp3 = false; + } + + + return (b_otp1 && b_otp2 && b_otp3 ); + } + + + + + public class UpdatePinPassword extends AsyncTask { + + Context context; + //AlertDialog alertDialog; + + //private ProgressBar progressBar; + + private ProgressDialog progressDialog; + + UpdatePinPassword(Context ctx) { + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(String... params) { + + SoapObject response = UpdatePinPassword(); + + //Log.d("ResponseCommitsss", response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressDialog.setMessage("Loading"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapObject result) { + + + + String str_result=result.getProperty("Status").toString(); + if(str_result.equalsIgnoreCase("Success")){ + // dialog.dismiss(); + // Toast.makeText(context,"Your Request sent to the manager",Toast.LENGTH_LONG).show(); + Toast.makeText(Activity_pinlogin.this, "PIN Success", Toast.LENGTH_SHORT).show(); + + editor_obj = sharedpreference_usercredential_Obj.edit(); + editor_obj.putString(KeyValue_isuser_setpin, "yes"); + editor_obj.commit(); + + if(str_role.equalsIgnoreCase("Student")) { + Intent i = new Intent(Activity_pinlogin.this, HomeActivity.class); + startActivity(i); + finish(); + }else if(str_role.equalsIgnoreCase("Manager")){ + Intent i = new Intent(Activity_pinlogin.this, PMHomeActivity.class); + startActivity(i); + finish(); + }else if(str_role.equalsIgnoreCase("Principal")){ + Intent i = new Intent(Activity_pinlogin.this, PrincipleHomeActivity.class); + startActivity(i); + finish(); + } + } + else{ + + Toast toast = Toast.makeText(getApplicationContext(), "Wrong PIN", Toast.LENGTH_LONG); + TextView toastMessage = (TextView) toast.getView().findViewById(android.R.id.message); + toastMessage.setTextColor(Color.RED); + toast.show(); + } + + progressDialog.dismiss(); + } + + } + + + private SoapObject UpdatePinPassword() + { + + String METHOD_NAME = "ValidateLogin_PIN"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/ValidateLogin_PIN"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + request.addProperty("Username", str_username);//string + //request.addProperty("StudentName",edt_studName.getText().toString()); + request.addProperty("PIN",str_loginpin);//string + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Login.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + // SendStudentRequestforManager{Lead_Id=MF00993; Email_id=testing; Student_MobileNo=9689240475; Message=testing; } + + Log.e("tag","Request ValidateLogin_PIN="+request.toString()); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + // Log.d("soapResponseyyyyyyy",envelope.getResponse().toString()); + + SoapObject response = (SoapObject) envelope.getResponse(); + Log.d("tag","soapRespons ValidateLogin_PIN="+response.toString()); + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.d("exception outside",t.getMessage().toString()); + } + return null; + + + } + + /*public void AsyncTask_ValidateUserPIN() + { + + final ProgressDialog progressDialog; + progressDialog = new ProgressDialog(com.dfcovid.Activity_pinlogin.this); + progressDialog.setMessage("Loading...."); + progressDialog.setTitle("Please wait fetching Details...."); + progressDialog.setCancelable(false); + progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); + progressDialog.show(); + + + + Class_loginPinrequest request = new Class_loginPinrequest(); + request.setUsername(str_username); + request.setPIN(str_loginpin); + + + Interface_userservice userService; + userService = Class_ApiUtils.getUserService(); + Call call = userService.Post_ValidateUserPIN(request); + + Log.e("TAG", "pinreq : " + new Gson().toJson(request)); + + call.enqueue(new Callback() { + @Override + public void onResponse(Call call, Response response) + { + Log.e("response", response.toString()); + + Log.e("TAG", "pinRes: " + new Gson().toJson(response)); + Log.e("tag","PinResponse body"+ String.valueOf(response.body())); + // DefaultResponse error1 = ErrorUtils.parseError(response); + *//* Log.e("response new:",error1.getMsg()); + Log.e("response new status:", String.valueOf(error1.getstatus()));*//* + + Class_normalloginresponse user_object; + user_object = (Class_normalloginresponse) response.body(); + + if (response.isSuccessful()) + { + + progressDialog.dismiss(); + + String str_userstatus=user_object.getMessage().trim().toString(); + if(str_userstatus.equalsIgnoreCase("Success")) + { + Toast.makeText(com.dfcovid.Activity_pinlogin.this, "PIN Success", Toast.LENGTH_SHORT).show(); + + Intent i = new Intent(com.dfcovid.Activity_pinlogin.this, Dashboard_Activity.class); + startActivity(i); + finish(); + } + else{ + + Toast toast = Toast.makeText(getApplicationContext(), "Wrong PIN", Toast.LENGTH_LONG); + TextView toastMessage = (TextView) toast.getView().findViewById(android.R.id.message); + toastMessage.setTextColor(Color.RED); + toast.show(); + } + + + + } else { + + + DefaultResponse error = ErrorUtils.parseError(response); + // … and use it to show error information + + // … or just log the issue like we’re doing :) + Log.d("responseerror", error.getMsg()); + + Toast.makeText(com.dfcovid.Activity_pinlogin.this, "Wrong PIN", Toast.LENGTH_SHORT).show(); + progressDialog.dismiss(); + } + } + + @Override + public void onFailure(Call call, Throwable t) + { + + Log.d("retrofiteerror", t.toString()); + Toast.makeText(com.dfcovid.Activity_pinlogin.this, t.getMessage(), Toast.LENGTH_SHORT).show(); + } + });// end of call + + }*/ + + + + + @Override + public void onBackPressed() + { + Intent startMain = new Intent(Intent.ACTION_MAIN); + startMain.addCategory(Intent.CATEGORY_HOME); + startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(startMain); + + /*AlertDialog.Builder dialog = new AlertDialog.Builder(Activity_pinlogin.this); + dialog.setCancelable(false); + dialog.setTitle(R.string.alert); + dialog.setMessage("Are you sure want to Exit"); + + dialog.setPositiveButton("Yes", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) + { + + Intent i = new Intent(getApplicationContext(), LoginActivity.class); + i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); + startActivity(i); + finish(); + + } + }) + .setNegativeButton("No", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + //Action for "Cancel". + dialog.dismiss(); + } + }); + + final AlertDialog alert = dialog.create(); + alert.setOnShowListener(new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface arg0) { + alert.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(Color.RED); + alert.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#004D40")); + } + }); + alert.show();*/ + } + + + + + + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + //getMenuInflater().inflate(R.menu.home_menu, menu); + getMenuInflater().inflate(R.menu.dashboard_menu, menu); + + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) + { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); + //noinspection SimplifiableIfStatement + + if(id==R.id.changepin) + { + + + AlertDialog.Builder dialog = new AlertDialog.Builder(Activity_pinlogin.this); + dialog.setCancelable(false); + dialog.setTitle(R.string.alert); + dialog.setMessage("Are you sure you want to Change PIN?"); + + dialog.setPositiveButton("Yes", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) + { + + editor_obj = sharedpreference_usercredential_Obj.edit(); + editor_obj.putString(KeyValue_isuser_setpin, ""); + editor_obj.commit(); + + editor_obj = sharedpreference_usercredential_Obj.edit(); + editor_obj.putString(KeyValue_isuser_changepin, "yes"); + editor_obj.commit(); + + Intent i = new Intent(getApplicationContext(), Activity_confirmoldpin.class); + i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); + startActivity(i); + finish(); + } + }) + .setNegativeButton("No", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + //Action for "Cancel". + dialog.dismiss(); + } + }); + + final AlertDialog alert = dialog.create(); + alert.setOnShowListener(new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface arg0) { + alert.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(Color.RED); + alert.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#004D40")); + } + }); + alert.show(); + + return true; + } + /*else if(id==R.id.aboutus) + { + + + internetDectector = new Class_InternetDectector(getApplicationContext()); + isInternetPresent = internetDectector.isConnectingToInternet(); + + if (isInternetPresent) + { + Intent i = new Intent(Activity_pinlogin.this, Activity_HelpLineCenter.class); + i.putExtra("flag","from_Activity_pinlogin"); + i.putExtra("loggedinflag","loggegdin"); + startActivity(i); + finish(); + return true; + } + else{ + Toast.makeText(getApplicationContext(), "No Internet", Toast.LENGTH_SHORT).show(); + } + }*//* + + + + + + + + + *//*if (id == R.id.logout) + { + // Toast.makeText(CalenderActivity.this, "Action clicked", Toast.LENGTH_LONG).show(); + internetDectector = new Class_InternetDectector(getApplicationContext()); + isInternetPresent = internetDectector.isConnectingToInternet(); + + if (isInternetPresent) + { + + + + + AlertDialog.Builder dialog = new AlertDialog.Builder(Activity_pinlogin.this); + dialog.setCancelable(false); + dialog.setTitle(R.string.alert); + dialog.setMessage("Are you sure want to Logout?"); + + dialog.setPositiveButton("Yes", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) + { + + *//**//* SaveSharedPreference.setUserName(Activity_HomeScreen.this, ""); + + Intent i = new Intent(getApplicationContext(), MainActivity.class); + i.putExtra("Key_Logout", "yes"); + i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); + startActivity(i); + finish();*//**//* + + + } + }) + .setNegativeButton("No", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + //Action for "Cancel". + dialog.dismiss(); + } + }); + + final AlertDialog alert = dialog.create(); + alert.setOnShowListener(new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface arg0) { + alert.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(Color.RED); + alert.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#004D40")); + } + }); + alert.show(); + + + //} + } else { + Toast.makeText(getApplicationContext(), "No Internet", Toast.LENGTH_SHORT).show(); + } + return true; + }*/ + + + return super.onOptionsItemSelected(item); + } + + + + + + +}//end of class \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/Activity_setpin.java b/app/src/main/java/com/leadcampusapp/Activity_setpin.java new file mode 100644 index 0000000..1332f3a --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Activity_setpin.java @@ -0,0 +1,429 @@ +package com.leadcampusapp; + +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.graphics.Color; +import android.os.Bundle; +import android.text.Editable; +import android.text.InputType; +import android.text.TextWatcher; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.TextView; + +import androidx.appcompat.app.AppCompatActivity; + +//import com.covid.R; + +public class Activity_setpin extends AppCompatActivity { + + + public static final String sharedpreference_usercredential = "sharedpreferencebook_usercredential"; + public static final String KeyValue_userid = "KeyValue_userid"; + public static final String KeyValue_username = "KeyValue_username"; + public static final String KeyValue_user_mailid = "KeyValue_user_mailid"; + public static final String KeyValue_usercategory = "KeyValue_usercategory"; + public static final String KeyValue_usercellno = "KeyValue_usercellno"; + public static final String KeyValue_isuser_setpin = "KeyValue_isuser_setpin"; + + + SharedPreferences sharedpreference_usercredential_Obj; + + + public static final String sharedpreference_setpincredential = "sharedpreference_pincredential"; + public static final String KeyValue_setpin = "KeyValue_setpin"; + SharedPreferences sharedpreference_setpin_Obj; + SharedPreferences.Editor editor_obj; + + Button confirm_pin_bt; + EditText otp1_et,otp2_et,otp3_et,otp4_et; + TextView title_tv; + EditText pin1masked_et,pin2masked_et,pin3masked_et,pin4masked_et; + + @Override + protected void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_setpin); + + confirm_pin_bt =(Button) findViewById(R.id.confirm_pin_bt); + otp1_et=(EditText) findViewById(R.id.otp1_et); + otp2_et=(EditText) findViewById(R.id.otp2_et); + otp3_et=(EditText) findViewById(R.id.otp3_et); + otp4_et=(EditText) findViewById(R.id.otp4_et); + title_tv=(TextView)findViewById(R.id.title_tv); + + pin1masked_et=(EditText)findViewById(R.id.pin1masked_et); + pin2masked_et=(EditText)findViewById(R.id.pin2masked_et); + pin3masked_et=(EditText)findViewById(R.id.pin3masked_et); + pin4masked_et=(EditText)findViewById(R.id.pin4masked_et); + + otp1_et.setInputType(InputType.TYPE_CLASS_NUMBER); + otp2_et.setInputType(InputType.TYPE_CLASS_NUMBER); + otp3_et.setInputType(InputType.TYPE_CLASS_NUMBER); + otp4_et.setInputType(InputType.TYPE_CLASS_NUMBER); + + sharedpreference_setpin_Obj=getSharedPreferences(sharedpreference_setpincredential, Context.MODE_PRIVATE); + + + + + Intent myIntent = getIntent(); + + if(myIntent!=null) + { + + String str_fromconfirmoldpin="no"; + str_fromconfirmoldpin = myIntent.getStringExtra("Key_confirmoldpin"); + if(str_fromconfirmoldpin!=null && (str_fromconfirmoldpin.equalsIgnoreCase("yes"))) + { + title_tv.setText("Set new PIN"); + } + } + + + + + otp1_et.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + if(otp1_et.getText().toString().length()>=1) + { + + pin1masked_et.setVisibility(View.VISIBLE); + otp1_et.setVisibility(View.GONE); + pin1masked_et.setText("*"); + + otp2_et.requestFocus(); + } + } + + @Override + public void afterTextChanged(Editable editable) { + + } + }); + + + + + pin1masked_et.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void afterTextChanged(Editable editable) + { + if(pin1masked_et.getText().toString().length()==0) + { + pin1masked_et.setVisibility(View.GONE); + otp1_et.setVisibility(View.VISIBLE); + otp1_et.setText(""); + otp1_et.requestFocus(); + } + } + }); + + + + + + otp2_et.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + if(otp2_et.getText().toString().length()>=1) + { + pin2masked_et.setVisibility(View.VISIBLE); + otp2_et.setVisibility(View.GONE); + pin2masked_et.setText("*"); + + otp3_et.requestFocus(); + } + } + + @Override + public void afterTextChanged(Editable editable) { + + } + }); + + + + pin2masked_et.addTextChangedListener(new TextWatcher() + { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void afterTextChanged(Editable editable) + { + if(pin2masked_et.getText().toString().length()==0) + { + pin2masked_et.setVisibility(View.GONE); + otp2_et.setVisibility(View.VISIBLE); + otp2_et.setText(""); + otp2_et.requestFocus(); + } + } + }); + + + + otp3_et.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + if(otp3_et.getText().toString().length()>=1) + { + + pin3masked_et.setVisibility(View.VISIBLE); + otp3_et.setVisibility(View.GONE); + pin3masked_et.setText("*"); + + otp4_et.requestFocus(); + } + } + + @Override + public void afterTextChanged(Editable editable) { + + } + }); + + pin3masked_et.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void afterTextChanged(Editable editable) + { + if(pin3masked_et.getText().toString().length()==0) + { + pin3masked_et.setVisibility(View.GONE); + otp3_et.setVisibility(View.VISIBLE); + otp3_et.setText(""); + otp3_et.requestFocus(); + } + } + }); + + + + + + otp4_et.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) + { + + if(otp4_et.getText().toString().length()>=1) + { + + pin4masked_et.setVisibility(View.VISIBLE); + otp4_et.setVisibility(View.GONE); + pin4masked_et.setText("*"); + + otp4_et.requestFocus(); + } + } + + @Override + public void afterTextChanged(Editable editable) + { + + } + }); + + + + pin4masked_et.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { + + } + + @Override + public void afterTextChanged(Editable editable) + { + + if(pin4masked_et.getText().toString().length()==0) + { + pin4masked_et.setVisibility(View.GONE); + otp4_et.setVisibility(View.VISIBLE); + otp4_et.setText(""); + otp4_et.requestFocus(); + } + } + }); + + + + + + confirm_pin_bt.setOnClickListener(new View.OnClickListener() + { + @Override + public void onClick(View v) + { + + if(validation()) + { + + String str_setpin=otp1_et.getText().toString()+ + otp2_et.getText().toString()+ + otp3_et.getText().toString()+ + otp4_et.getText().toString(); + + + editor_obj = sharedpreference_setpin_Obj.edit(); + editor_obj.putString(KeyValue_setpin,str_setpin); + editor_obj.commit(); + + Intent i = new Intent(Activity_setpin.this, Activity_confirmpin.class); + startActivity(i); + finish(); + } + } + }); + + + } + + + public boolean validation() + { + boolean b_otp1, b_otp2, b_otp3, b_otp4; + b_otp1=b_otp2=b_otp3=b_otp4=true; + + + + if (otp1_et.getText().toString().trim().length() == 0) { + otp1_et.setError("Enter PIN"); + otp1_et.requestFocus(); + b_otp1 = false; + } + + if (otp2_et.getText().toString().trim().length() == 0) { + otp2_et.setError("Enter PIN"); + otp2_et.requestFocus(); + b_otp2 = false; + } + + if (otp3_et.getText().toString().trim().length() == 0) { + otp3_et.setError("Enter PIN"); + otp3_et.requestFocus(); + b_otp3 = false; + } + if(otp4_et.getText().toString().trim().length()==0) + { + otp4_et.setError("Enter PIN"); + otp4_et.requestFocus(); + b_otp4=false; + } + + return (b_otp1 && b_otp2 && b_otp3&& b_otp4); + } + + + + @Override + public void onBackPressed() + { + + /*AlertDialog.Builder dialog = new AlertDialog.Builder(Activity_setpin.this); + dialog.setCancelable(false); + dialog.setTitle(R.string.alert); + dialog.setMessage("Are you sure want to Exit"); + + dialog.setPositiveButton("Yes", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) + { + finish(); + System.exit(0); + + } + }) + .setNegativeButton("No", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + //Action for "Cancel". + dialog.dismiss(); + } + }); + + final AlertDialog alert = dialog.create(); + alert.setOnShowListener(new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface arg0) { + alert.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(Color.RED); + alert.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#004D40")); + } + }); + alert.show();*/ + Intent startMain = new Intent(Intent.ACTION_MAIN); + startMain.addCategory(Intent.CATEGORY_HOME); + startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(startMain); + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/Activity_studentUPI.java b/app/src/main/java/com/leadcampusapp/Activity_studentUPI.java new file mode 100644 index 0000000..beaab8b --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Activity_studentUPI.java @@ -0,0 +1,1458 @@ +package com.leadcampusapp; + +import android.app.AlertDialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.graphics.Color; +import android.os.AsyncTask; +import android.os.Bundle; +import android.text.TextUtils; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.BaseAdapter; +import android.widget.Button; +import android.widget.EditText; +import android.widget.ListView; +import android.widget.Spinner; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.appcompat.app.AppCompatActivity; + +import com.google.gson.Gson; +import com.leadcampusapp.remote.Class_ApiUtils; +import com.leadcampusapp.remote.Interface_userservice; +import com.paytm.pgsdk.PaytmOrder; +import com.paytm.pgsdk.PaytmPaymentTransactionCallback; +import com.paytm.pgsdk.TransactionManager; + +import org.json.JSONObject; +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.io.BufferedReader; +import java.io.DataOutputStream; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Random; + +import retrofit2.Call; +import retrofit2.Callback; +import retrofit2.Response; + +public class Activity_studentUPI extends AppCompatActivity { + EditText upi; + Button payment_bt,summarydetails_bt; + String upiId,str_amount,str_vendorname; + TextView amount_tv,vendorname_tv; + + + + public static final String PREFBook_Stud= "prefbook_stud"; //sharedpreference Book + public static final String PrefID_RegID = "prefid_regid"; // + public static final String PrefID_SName = "prefid_sname"; // + public static final String PrefID_PM_SName = "prefid_pmsname"; // + public static final String PrefID_SLeadID = "prefid_sleadid"; // + public static final String PrefID_PM_SEmailID = "prefid_pm_semailid"; // + public static final String PrefID_SCellNo = "prefid_scellno"; // + public static final String PrefID_S_isprofileEdited = "prefid_isprofileEdited"; + public static final String PrefID_SStudentType = "prefid_sstudentType"; + public static final String PrefId_S_Gender = "prefid_sgender"; + public static final String PrefId_S_AcademicId = "prefid_sacademicid"; + + SharedPreferences shardpref_S_obj; + String str_sname,str_studentregistrationID,str_academicID; + + String str_detailspayment_response,str_feesmaster_response; + private ListView summarylist_listview; + + Class_studentpayment_summary[] studentpayment_summary_arryObj; + Class_studentpayment_summary studentpayment_summary_obj; + + Class_FeesCatMaster[] feesCatMasters_arryObj; + Class_FeesCatMaster feesCatMasters_Obj; + String str_feesID,str_feescatID; + + Spinner paymentfor_sp; + String str_orderid,str_checksumtoken,str_transcation_token,str_savedpayment_response,str_yyyy_mm_dd; + TransactionManager transactionManager; + Integer ActivityRequestCode = 2; + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_studentupi); + + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + //getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background)); + + View actionBarView = getSupportActionBar().getCustomView(); + TextView actionBarTV = (TextView) actionBarView.findViewById(R.id.txt_actionBar); + actionBarTV.setText("Lead Payment"); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); + + + upi = findViewById(R.id.upi); + vendorname_tv=findViewById(R.id.vendorname_tv); + amount_tv=findViewById(R.id.amount_tv); + payment_bt = findViewById(R.id.payment_bt); + summarydetails_bt=findViewById(R.id.summarydetails_bt); + summarylist_listview=findViewById(R.id.summarylist_listview); + paymentfor_sp=findViewById(R.id.paymentfor_sp); + + + shardpref_S_obj = getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + str_sname = shardpref_S_obj.getString(PrefID_SName, "").trim(); + vendorname_tv.setText(str_sname); + + str_studentregistrationID=shardpref_S_obj.getString(PrefID_RegID, "").trim(); + str_academicID=shardpref_S_obj.getString(PrefId_S_AcademicId, "").trim(); + + Log.e("academic",shardpref_S_obj.getString(PrefId_S_AcademicId, "").trim()); + Log.e("studentregID",shardpref_S_obj.getString(PrefID_RegID, "").trim()); +// 41275 7 + + // https://mis.leadcampus.org:8084/leadws/Login.asmx/GetstateList?stateid=0&Manager_Id=0 + //https://mis.leadcampus.org:8084/leadws/managerws.asmx/Get_Fees_Category_Master?Registration_Id=41275&College_ID=0 + // https://mis.leadcampus.org:8084/leadws/Login.asmx/GetstateList?stateid=0&Manager_Id=0 + + //https://mis.leadcampus.org:8084/leadws/managerws.asmx/Get_Fees_Category_Master?Registration_Id=41275&College_ID=0 + /*int int_feespaid= Integer.parseInt("1.0"); + Log.e("amount", String.valueOf(int_feespaid));*/ + + +// start click + + + Get_Fees_Category_Master_AsynTask task_fees=new Get_Fees_Category_Master_AsynTask(Activity_studentUPI.this); + task_fees.execute(); + + + StudentSummaryDetails_AsynTask task = new StudentSummaryDetails_AsynTask(Activity_studentUPI.this); + task.execute(); + + + payment_bt.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) + { + upiId = upi.getText().toString(); + str_vendorname=vendorname_tv.getText().toString(); + str_amount=amount_tv.getText().toString(); + if (TextUtils.isEmpty(upiId)) { + upi.setError("Required"); + return; + } + + //Intent intent = new Intent(getApplicationContext(), StudentUPIPayment.class); + + /*Intent intent = new Intent(getApplicationContext(), StudentUPIPayment.class); + intent.putExtra("upi", upiId); + intent.putExtra("amount", str_amount); + intent.putExtra("vendorname",str_vendorname); + intent.putExtra("studentregistrationID",str_studentregistrationID); + intent.putExtra("studentfeesID",str_feesID); + intent.putExtra("studentfeescatID",str_feescatID); + startActivity(intent);*/ + + str_orderid=str_checksumtoken=str_transcation_token=str_yyyy_mm_dd="0"; + fetch_token(); + + } + }); + + + + + + paymentfor_sp.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView parent, View view, int position, long id) + { + feesCatMasters_Obj = (Class_FeesCatMaster) paymentfor_sp.getSelectedItem(); + str_feesID = feesCatMasters_Obj.getFees_ID().toString(); + str_feescatID=feesCatMasters_Obj.getFees_Category_Slno().toString(); + + + + + } + + @Override + public void onNothingSelected(AdapterView parent) { + + } + }); + + + + + summarydetails_bt.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) + { + + } + }); + + + } + + + @Override + public void onBackPressed() { + + { + AlertDialog.Builder dialog = new AlertDialog.Builder(Activity_studentUPI.this); + dialog.setCancelable(false); + dialog.setTitle("LEADCampus"); + dialog.setMessage("Are you sure want to Exit Payment Module"); + + dialog.setPositiveButton("Yes", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) { + Intent i = new Intent(Activity_studentUPI.this, HomeActivity.class); + startActivity(i); + finish(); + } + }) + .setNegativeButton("No", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + //Action for "Cancel". + dialog.dismiss(); + } + }); + + final AlertDialog alert = dialog.create(); + alert.setOnShowListener(new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface arg0) { + alert.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(Color.RED); + alert.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#004D40")); + } + }); + alert.show(); + + //alert.getWindow().setBackgroundDrawableResource(android.R.color.background_dark); + } + } + + + + + private class Get_Fees_Category_Master_AsynTask extends AsyncTask { + ProgressDialog dialog; + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + dialog.setMessage("Please wait,Fetching Fees Details.."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + Get_Fees_Category_Master(); // + return null; + } + + public Get_Fees_Category_Master_AsynTask(Activity_studentUPI activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @Override + protected void onPostExecute(Void result) { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + + dialog.dismiss(); + + + + + if(str_feesmaster_response.equalsIgnoreCase("Success")) + { + + + ArrayAdapter dataAdapter = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle,feesCatMasters_arryObj); + dataAdapter.setDropDownViewResource(R.layout.spinnercustomstyle); + paymentfor_sp.setAdapter(dataAdapter); + + + + }else{ + //alert(); + } + + } + + } + + + + + + public void Get_Fees_Category_Master() + { + + String URL = Class_URL.URL_Manager.toString().trim(); + + + String METHOD_NAME = "Get_Fees_Category_Master"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/Get_Fees_Category_Master"; + +//int +// int + + + int int_regID= Integer.parseInt(str_studentregistrationID); + + try { + str_feesmaster_response="x"; + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + request.addProperty("Registration_Id",int_regID );//int + request.addProperty("College_ID",0 );//int + +//https://mis.leadcampus.org:8084/leadws/managerws.asmx/Get_Fees_Category_Master?Registration_Id=41275&College_ID=0 + // + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + + + //SoapPrimitive response = (SoapPrimitive ) envelope.getResponse(); + SoapObject response = (SoapObject) envelope.getResponse(); + SoapObject response_SO = (SoapObject) response.getProperty(0); + Log.e("Feestatus",response_SO.getProperty("Status").toString()); + + str_feesmaster_response=response_SO.getProperty("Status").toString(); + //Log.e("fees", String.valueOf(response.getPropertyCount())); + int count =response.getPropertyCount(); + + feesCatMasters_arryObj=new Class_FeesCatMaster[count]; + + /*anyType{vmGET_FeeCategory_Master=anyType{Fees_Category_Slno=1; fees_category_code=RG; +Fees_category_description=Registration; Fees=1; Fees_ID=486; academic_year=0; Status=Success; }; }*/ + + //Action means my doing + + for(int i=0;i " + t.getMessage()); + //internet_issue1 = "savepayment"; + // Toast.makeText(getApplicationContext(), "Request failed: " + t.toString(),Toast.LENGTH_LONG).show(); + + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + Toast.makeText(getApplicationContext(), "Fees Details: " + t.toString(),Toast.LENGTH_LONG).show(); + } + + + + + + + + + + } + + + + + + + + + + + + + + private class StudentSummaryDetails_AsynTask extends AsyncTask { + ProgressDialog dialog; + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + dialog.setMessage("Please wait,Fetching Payment Details.."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + Get_Payment_Details(); // + return null; + } + + public StudentSummaryDetails_AsynTask(Activity_studentUPI activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @Override + protected void onPostExecute(Void result) { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + + dialog.dismiss(); + + if(str_detailspayment_response.equalsIgnoreCase("Success")) + { + + + if (studentpayment_summary_arryObj != null) + { + CustomAdapter_paymentdetails adapter = new CustomAdapter_paymentdetails(); + summarylist_listview.setAdapter(adapter); + + int y = studentpayment_summary_arryObj.length; + + Log.e("length adapter", "" + y); + } else { + Log.d("length adapter", "zero"); + } + + }else{ + //alert(); + } + + } + + } + + + + + + + public void Get_Payment_Details() + { +//https://mis.leadcampus.org:8084/leadws/managerws.asmx/Get_Payment_Details?Registration_ID=41275&Manager_Id=0&Academic_Id=7 + /* + + */ + String URL = Class_URL.URL_Manager.toString().trim(); + + + String METHOD_NAME = "Get_Payment_Details"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/Get_Payment_Details"; + + + int int_regID= Integer.parseInt(str_studentregistrationID); + int int_mangerID=0; + int int_academicID= Integer.parseInt(str_academicID); + try { + str_detailspayment_response="x"; + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + request.addProperty("Registration_ID",int_regID );//int + request.addProperty("Manager_Id", int_mangerID);//int + request.addProperty("Academic_Id",int_academicID );//int + +// + // + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + + + //SoapPrimitive response = (SoapPrimitive ) envelope.getResponse(); + SoapObject response = (SoapObject) envelope.getResponse(); + SoapObject response_SO = (SoapObject) response.getProperty(0); + Log.e("status",response_SO.getProperty("Status").toString()); + + str_detailspayment_response=response_SO.getProperty("Status").toString(); + // Log.e("status", String.valueOf(response.getPropertyCount())); + int count =response.getPropertyCount(); + + studentpayment_summary_arryObj=new Class_studentpayment_summary[count]; + + for(int i=0;i1612960865 + studentpayment_summary_innerObj.setStr_Auto_Receipt_No(responses_SO.getProperty("Auto_Receipt_No").toString());//19 + studentpayment_summary_innerObj.setStr_Created_Date(responses_SO.getProperty("Created_Date").toString());//10-02-2021 06:02;30 06:11:30 PM + + Log.e("payresp",responses_SO.getProperty("reference_id").toString()); + + + + studentpayment_summary_arryObj[i]=studentpayment_summary_innerObj; + + } + + + + + Log.e("resp_details",response.toString()); + + + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("saved payment fail", "> " + t.getMessage()); + //internet_issue1 = "savepayment"; + // Toast.makeText(getApplicationContext(), "Request failed: " + t.toString(),Toast.LENGTH_LONG).show(); + + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + Toast.makeText(getApplicationContext(), "Request failed: " + t.toString(),Toast.LENGTH_LONG).show(); + } + + }//End of uploaddetails + + + + + + + + + + + + + + private class Holder_offline { + TextView holder_paymentstatus_tv; + TextView holder_payment_tranID_tv; + TextView holder_date_tv; + TextView holder_receipt_no_tv; + + } + + + + public class CustomAdapter_paymentdetails extends BaseAdapter + { + + + public CustomAdapter_paymentdetails() { + + super(); + Log.d("Inside CustomAdapter()", "Inside CustomAdapter()"); + } + + @Override + public int getCount() { + + String x = Integer.toString(studentpayment_summary_arryObj.length); + System.out.println("studentpayment_summary_arryObj.length" + x); + return studentpayment_summary_arryObj.length; + } + + @Override + public Object getItem(int position) { + String x = Integer.toString(position); + Log.d("getItem position", "x"); + return studentpayment_summary_arryObj[position]; + } + + + @Override + public long getItemId(int position) { + String x = Integer.toString(position); + + Log.d("getItemId position", x); + return position; + } + + @Override + public View getView(int position, View convertView1, ViewGroup parent) + { + + final Holder_offline holder; + + Log.d("CustomAdapter", "position: " + position); + + if (convertView1 == null) { + holder = new Holder_offline(); + convertView1 = LayoutInflater.from(getApplicationContext()).inflate(R.layout.listview_row_item_student_paymentdetails, parent, false); + + + + // holder.holder_paymentstatus_tv = (TextView) convertView1.findViewById(R.id.payment_status_tv); + holder.holder_payment_tranID_tv = (TextView) convertView1.findViewById(R.id.payment_tranID_tv); + holder.holder_receipt_no_tv = (TextView) convertView1.findViewById(R.id.receipt_no_tv); + holder.holder_date_tv= (TextView) convertView1.findViewById(R.id.date_tv); + + Log.d("Inside If convertView1", "Inside If convertView1"); + + convertView1.setTag(holder); + + } else { + holder = (Holder_offline) convertView1.getTag(); + Log.d("else convertView1", "else convertView1"); + } + + // Class_farmponddetails_offline farmponddetails_obj; + studentpayment_summary_obj = (Class_studentpayment_summary) getItem(position); + + + if (studentpayment_summary_obj != null) { + if ((studentpayment_summary_obj.getStr_Status().equalsIgnoreCase("Success"))) { + + + Log.e("payment",studentpayment_summary_obj.getStr_reference_id().toString()); + //holder.holder_paymentstatus_tv.setText(studentpayment_summary_obj.getStr_Status().toString()); + holder.holder_payment_tranID_tv.setText(studentpayment_summary_obj.getStr_reference_id().toString()); + holder.holder_date_tv.setText(studentpayment_summary_obj.getStr_Created_Date().toString()); + holder.holder_receipt_no_tv.setText(studentpayment_summary_obj.getStr_Auto_Receipt_No().toString()); + + + } + + + } + + + + return convertView1; + + }//End of custom getView + }//End of CustomAdapter + + + +//--------------------Paytm------------------------------------------------- + + public void fetch_token() + { + + + Calendar c = Calendar.getInstance(); + SimpleDateFormat df = new SimpleDateFormat("ddMMyyyy"); + String date = df.format(c.getTime()); + Random rand = new Random(); + int min =1000, max= 9999; +// nextInt as provided by Random is exclusive of the top value so you need to add 1 + int randomNum = rand.nextInt((max - min) + 1) + min; + str_orderid = date+String.valueOf(randomNum); + Log.e("orderid",str_orderid); + + + + final ProgressDialog progressDialog; + progressDialog = new ProgressDialog(Activity_studentUPI.this); + progressDialog.setMessage("Fetching CheckSum Token...."); + progressDialog.setTitle("Please wait...."); + progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); + progressDialog.show(); + + Interface_userservice userService; + userService = Class_ApiUtils.getUserService(); + + + // String MID = "Deshpa57179173206691";//Staging + String MID="DesFou64628105401332";//Production + String order_id = str_orderid; + String Website = "WEBSTAGING"; + + + String Amount = "1"; + + //String callback="https://securegw-stage.paytm.in/theia/paytmCallback?ORDER_ID="+order_id; + String callback="https://securegw.paytm.in/theia/paytmCallback?ORDER_ID="+order_id; + + + String Str_checksum1 = "{\"requestType\":\"Payment\",\"mid\":\"" + MID + "\",\"orderId\":\"" + order_id + "\"," + + "\"websiteName\":\"" + Website + "\",\"txnAmount\":{\"value\":\"" + Amount + "\",\"currency\":\"INR\"}," + + "\"userInfo\":{\"custId\":\"WE25622\"},\"enablePaymentMode\":[{\"mode\":\"UPI\", \"channels\":[\"UPIPUSH\",\"UPIPUSHEXPRESS\"]}]," + + "\"callbackUrl\":\"" + callback + "\"}"; + + String Str_checksum = "{\"requestType\":\"Payment\",\"mid\":\""+MID+"\",\"orderId\":\""+order_id+"\"," + + "\"websiteName\":\""+Website+"\",\"txnAmount\":{\"value\":\""+Amount+"\",\"currency\":\"INR\"}," + + "\"userInfo\":{\"custId\":\"WE25622\"},\"callbackUrl\":\""+callback+"\"}"; + + // Call call = userService.getpaytmchecksumkey(orderIdString); + Call call = userService.getpaytmchecksumkey(Str_checksum); + // Call call = userService.getpaytmchecksumkey("jkk12345678912345612123"); + //jkk12345678912345612123 + + Log.e("checksum_url","https://www.dfindia.org:82/api/Authentication/getpaytmchecksumkey?OrderId="+str_orderid); + + + call.enqueue(new Callback() { + @Override + public void onResponse(Call call, Response response) + { + // Log.e("token_response", "token_response: " + new Gson().toJson(response)); + + + + try{ + + + + if(response.isSuccessful()) + { + + Class_token_response loc_obj = response.body(); + Log.e("response.body", response.body().getMessage().toString()); + + Log.e("checksum_token",loc_obj.getTokenresp().getPaytmChecksum().toString()); + + Log.e("checksum :","Validation"); + Log.e("checksum_validateion",loc_obj.getTokenresp().getVerifySignature()); + + str_checksumtoken=loc_obj.getTokenresp().getPaytmChecksum().toString().trim(); + + // checksumtoken_et.setText(loc_obj.getTokenresp().getPaytmChecksum().toString()); + // txnToken.setText(loc_obj.getTokenresp().getPaytmChecksumNew().toString()); + + // Log.e("response.body", response.body().size); + progressDialog.dismiss(); + + Log.e("call", "PayTM Transcation API"); + Transactiontoken_AsynTask task= new Transactiontoken_AsynTask(Activity_studentUPI.this); + task.execute(); + + + } + + }catch(Exception ex) + { + Log.e("error", String.valueOf(ex)); + progressDialog.dismiss(); + } + + } + + @Override + public void onFailure(Call call, Throwable t) { + progressDialog.dismiss(); + Log.e("WS", "error" + t.getMessage()); + Toast.makeText(Activity_studentUPI.this, "WS:" + t.getMessage(), Toast.LENGTH_LONG).show(); + } + }); + + + + } + + + private class Transactiontoken_AsynTask extends AsyncTask { + ProgressDialog dialog; + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + dialog.setMessage("Please wait,fetching transcation token..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + get_transcationtoken(); // + return null; + } + + public Transactiontoken_AsynTask(Activity_studentUPI activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @Override + protected void onPostExecute(Void result) + { + dialog.dismiss(); + if(str_transcation_token.equalsIgnoreCase("0")) + { + + }else{ + do_paytm_transcation(); + } + } + + } + + + + + public void get_transcationtoken() + { + + //String MID = "Deshpa57179173206691";//Staging + String MID="DesFou64628105401332";//Production + String order_id = str_orderid; + String Website = "WEBSTAGING"; + String Merchant_key = "kYCILDoti4a8hb5f"; + + + String Amount = "1"; + //String value = "https://securegw-stage.paytm.in/theia/api/v1/initiateTransaction?mid=Deshpa57179173206691&orderId="+order_id; + String value = "https://securegw.paytm.in/theia/api/v1/initiateTransaction?mid=DesFou64628105401332&orderId="+order_id; //Production + + String callback="https://securegw.paytm.in/theia/paytmCallback?ORDER_ID="+order_id; + + + String json_for_checksum1 = "{\"requestType\":\"Payment\",\"mid\":\"" + MID + "\",\"orderId\":\"" + order_id + "\"," + + "\"websiteName\":\"" + Website + "\",\"txnAmount\":{\"value\":\"" + Amount + "\",\"currency\":\"INR\"}," + + "\"userInfo\":{\"custId\":\"WE25622\"},\"enablePaymentMode\":[{\"mode\":\"UPI\", \"channels\":[\"UPIPUSH\",\"UPIPUSHEXPRESS\"]}]," + + "\"callbackUrl\":\"" + callback + "\"}"; + + + //"enablePaymentMode" : [{ "mode":"UPI", "channels":["UPIPUSH","UPIPUSHEXPRESS"] }] + + String json_for_checksum = "{\"requestType\":\"Payment\",\"mid\":\""+MID+"\",\"orderId\":\""+order_id+"\"," + + "\"websiteName\":\""+Website+"\",\"txnAmount\":{\"value\":\""+Amount+"\",\"currency\":\"INR\"}," + + "\"userInfo\":{\"custId\":\"WE25622\"},\"callbackUrl\":\""+callback+"\"}"; + + Log.e("json_for_checksum",json_for_checksum); + + + + //String checksum = PaytmChecksum.generateSignature(body.toString(), "YOUR_MERCHANT_KEY"); + + + //String Second_jason = "{\"head\":{\"signature\":\"" + str_checksumtoken + "\"},\"body\":" + json_for_checksum + "}"; + + String Second_jason = "{\"head\":{\"signature\":\"" + str_checksumtoken + "\"},\"body\":"+json_for_checksum+"}"; + + + String post_data = Second_jason.toString(); + + + + /* for Staging */ + URL url = null; + try { + //url = new URL("https://securegw-stage.paytm.in/theia/api/v1/initiateTransaction?mid=YOUR_MID_HERE&orderId=ORDERID_98765"); + String str_staging_url=value; + Log.e("str_staging_url",str_staging_url); + url = new URL(str_staging_url); + } catch (MalformedURLException e) { + e.printStackTrace(); + } + + /* for Production */ +// URL url = new URL("https://securegw.paytm.in/theia/api/v1/initiateTransaction?mid=YOUR_MID_HERE&orderId=ORDERID_98765"); + + Log.e("parameters","of Head & Body"); + Log.e("parameter_passed",post_data); + + try { + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + connection.setRequestMethod("POST"); + connection.setRequestProperty("Content-Type", "application/json"); + connection.setDoOutput(true); + + DataOutputStream requestWriter = new DataOutputStream(connection.getOutputStream()); + requestWriter.writeBytes(post_data); + requestWriter.close(); + String responseData = ""; + InputStream is = connection.getInputStream(); + BufferedReader responseReader = new BufferedReader(new InputStreamReader(is)); + if ((responseData = responseReader.readLine()) != null) + { + System.out.append("TransResponse: " + responseData); + Log.e("response", String.valueOf(responseData)); + + /*JSONObject jsonObject = new JSONObject(responseData); + + JSONObject myResponse = jsonObject.getJSONObject("body"); + JSONArray tsmresponse = (JSONArray) myResponse.get("body"); + + Log.e("length", String.valueOf(tsmresponse.length()));*/ + + + // tsmresponse.getJSONObject(0).getString("name"); + + JSONObject jsonObject = new JSONObject(responseData); + JSONObject myResponse = jsonObject.getJSONObject("body"); + str_transcation_token=myResponse.getString("txnToken").toString(); + //txnToken_et.setText(str_transcation_token); + Log.e("transcationToken",myResponse.getString("txnToken").toString()); + + } + responseReader.close(); + } catch (Exception exception) + { + exception.printStackTrace(); + Log.e("error", String.valueOf(exception)); + } + + + } + + + + + public void do_paytm_transcation() + { + + + final ProgressDialog progressDialog; + progressDialog = new ProgressDialog(Activity_studentUPI.this); + progressDialog.setMessage("PayTM Transcation...."); + progressDialog.setTitle("Please wait...."); + progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); + progressDialog.show(); + + + + + String str_txnAmount = "1"; + //txnAmountString = "1.00"; + // String str_txnmid ="Deshpa57179173206691";//Staging + String str_txnmid="DesFou64628105401332";// production + String str_txnorderId =str_orderid; + String str_txnToken= str_transcation_token; + + String host = "https://securegw-stage.paytm.in/"; + /*if(environment.isChecked()){ + host = "https://securegw.paytm.in/"; + }*/ + + progressDialog.dismiss(); + if(2>1) + { + String orderDetails = "MID: " + str_txnmid + ", OrderId: " + str_txnorderId + ", TxnToken: " + str_txnToken + ", Amount: " + str_txnAmount; + Toast.makeText(this, orderDetails, Toast.LENGTH_SHORT).show(); + + + + // String callBackUrl = host + "theia/paytmCallback?ORDER_ID="+orderIdString; + + String callBackUrl="http://localhost:50559/callbackRes.aspx"; + + //String callBackUrl="https://securegw-stage.paytm.in/theia/paytmCallback?ORDER_ID=PYTM_ORDR_"+orderIdString; + + + // https://securegw-stage.paytm.in/theia/paytmCallback?ORDER_ID=PYTM_ORDR_1618228030" + //https://securegw-stage.paytm.in/theia/paytmCallback? + + Log.e("callbackurl : ",callBackUrl); + + + PaytmOrder paytmOrder = new PaytmOrder(str_txnorderId, str_txnmid, str_txnToken, str_txnAmount, callBackUrl); + + //Log.e("callbackurl : ", String.valueOf(paytmOrder)); + Log.e("paytmOrder : ", new Gson().toJson(paytmOrder)); + + transactionManager = new TransactionManager(paytmOrder, new PaytmPaymentTransactionCallback() + { + + @Override + public void onTransactionResponse(Bundle bundle) + { + Log.e("transactionManager : ", new Gson().toJson(transactionManager)); + + Log.e("onTransactionResp : ", bundle.toString()); + + String str_bundle=bundle.toString(); + Log.e("onTransactionResp : ", str_bundle); + + // Toast.makeText(Activity_studentUPI.this, "Response (onTransactionResponse) : "+bundle.toString(), Toast.LENGTH_SHORT).show(); + /* SaveStudentPaymentDetails_AsynTask task = new SaveStudentPaymentDetails_AsynTask(Activity_studentUPI.this); + task.execute();*/ + + + savepaymentdetails(); + } + + @Override + public void networkNotAvailable() + { + + } + + @Override + public void onErrorProceed(String s) { + Log.e("onErrorProceed : ", s.toString()); + } + + @Override + public void clientAuthenticationFailed(String s) { + Log.e("clientAuthenFailed: ", s.toString()); + } + + @Override + public void someUIErrorOccurred(String s) { + Log.e("someUIErrorOccur: ", s.toString()); + } + + @Override + public void onErrorLoadingWebPage(int i, String s, String s1) { + Log.e("ErrorLoadingWebPage: ", s.toString()); + } + + @Override + public void onBackPressedCancelTransaction() { + + } + + @Override + public void onTransactionCancel(String s, Bundle bundle) { + + } + }); + + transactionManager.setShowPaymentUrl(host + "theia/api/v1/showPaymentPage"); + Log.e("ShowPaymentUrl: ", host + "theia/api/v1/showPaymentPage"); + transactionManager.startTransaction(this, ActivityRequestCode); + + Log.e("transcation","completed1"); + } + + + Log.e("transcation","completed2"); + + } + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + if (requestCode == ActivityRequestCode && data != null) + { + + Bundle bundle = data.getExtras(); + if (bundle != null) { + for (String key : bundle.keySet()) { + Log.e("tag", key + " : " + (bundle.get(key) != null ? bundle.get(key) : "NULL")); + } + } + + Log.e("nativeSdkForMerchMsg:",data.getStringExtra("nativeSdkForMerchantMessage")); + Log.e("onActivityRes:", data.getStringExtra("response")); + Toast.makeText(this, "Response: "+data.getStringExtra("nativeSdkForMerchantMessage") + data.getStringExtra("response"), Toast.LENGTH_SHORT).show(); + + Log.e("transcation","completed3"); + } + } + + + + + public void savepaymentdetails() + { + SaveStudentPaymentDetails_AsynTask task = new SaveStudentPaymentDetails_AsynTask(Activity_studentUPI.this); + task.execute(); + } + + + + private class SaveStudentPaymentDetails_AsynTask extends AsyncTask + { + ProgressDialog dialog_savepayment; + Context context; + + protected void onPreExecute() + { + // Log.i(TAG, "onPreExecute---tab2"); + dialog_savepayment.setMessage("Please wait,Updating Payment Details.."); + dialog_savepayment.setCanceledOnTouchOutside(false); + dialog_savepayment.show(); + + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + SaveStudentPaymentDetails(); // + return null; + } + + public SaveStudentPaymentDetails_AsynTask(Activity_studentUPI activity) { + context = activity; + dialog_savepayment = new ProgressDialog(activity); + } + + @Override + protected void onPostExecute(Void result) { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + + dialog_savepayment.dismiss(); + + if(str_savedpayment_response.equalsIgnoreCase("Success")) + { + // finish(); + Payment_alertdialog("Success"); + + }else{ + //alert(); + } + + } + + } + + + + + public void SaveStudentPaymentDetails() + { + + Calendar c = Calendar.getInstance(); + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); + str_yyyy_mm_dd = df.format(c.getTime()); + // formattedDate have current date/time + Log.e("date", str_yyyy_mm_dd); + + String URL = Class_URL.URL_Projects.toString().trim(); + + String METHOD_NAME = "Save_Student_PaymentDetails"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/Save_Student_PaymentDetails"; + + + + try { + str_savedpayment_response="false"; + + int int_studentregID= Integer.parseInt(str_studentregistrationID); + + int int_feesID= Integer.parseInt(str_feesID); + // int int_feespaid= Integer.parseInt(str_amount); + // int int_referenceID= Integer.parseInt("12345678"); + String str_referenceID="123456"; + + // BigInteger int_referenceID=new BigInteger(str_orderid); + + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + request.addProperty("Fees_Category_ID",str_feescatID );//string + request.addProperty("Programe_ID", 1);//int + request.addProperty("Registration_ID",int_studentregID );//int + request.addProperty("Paid_fees", 1);//int + request.addProperty("Paid_date", str_yyyy_mm_dd);//string + request.addProperty("Payment_Type", "UPI");//string + request.addProperty("Payeer_Id", " ");//string + request.addProperty("Transaction_ID", "0");//int + request.addProperty("Reference_ID", str_referenceID);//int + request.addProperty("Transaction_Status", "Success");//string + request.addProperty("Created_User_Type", "Student");// string + request.addProperty("User_Id", int_studentregID);//int + request.addProperty("Fees_ID", int_feesID);// int + + + +// + // + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + + + //SoapPrimitive response = (SoapPrimitive ) envelope.getResponse(); + SoapObject response = (SoapObject) envelope.getResponse(); + + SoapObject payment_response = (SoapObject) response.getProperty(0); + Log.e("status",payment_response.getProperty("Status").toString()); + + str_savedpayment_response = payment_response.getProperty("Status").toString(); + Log.e("resp_savepayment",response.toString()); + + + + + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("saved payment fail", "> " + t.getMessage()); + //internet_issue1 = "savepayment"; + // Toast.makeText(getApplicationContext(), "Request failed: " + t.toString(),Toast.LENGTH_LONG).show(); + + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + Toast.makeText(getApplicationContext(), "Request failed: " + t.toString(),Toast.LENGTH_LONG).show(); + } + + }//End of uploaddetails + + + + + + + public void Payment_alertdialog(String Success) + { + + { + AlertDialog.Builder dialog = new AlertDialog.Builder(Activity_studentUPI.this); + dialog.setCancelable(false); + dialog.setTitle("Alert"); + if(Success.equalsIgnoreCase("Success")) { + dialog.setMessage("Congrants Payment is Successfull"); + } + else if (Success.equalsIgnoreCase("cancelled")) + { + dialog.setMessage("Payment is cancelled!"); + }else{ + dialog.setMessage("Kindy install digital wallet application"); + } + + dialog.setPositiveButton("Ok", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) + { + + /* SaveStudentPaymentDetails_AsynTask task = new SaveStudentPaymentDetails_AsynTask(StudentUPIPayment.this); + task.execute();*/ + Intent i = new Intent(Activity_studentUPI.this, Activity_studentUPI.class); + startActivity(i); + finish(); + } + }); + + final AlertDialog alert = dialog.create(); + alert.setOnShowListener(new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface arg0) { + alert.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(Color.RED); + alert.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#004D40")); + } + }); + alert.show(); + + //alert.getWindow().setBackgroundDrawableResource(android.R.color.background_dark); + } + } + + + + + + + +}//end of class + + + + + + + + + + + + + + + + + + + + + + + + + + + /*public void SaveStudentPaymentDetails() + { + + String URL = Class_URL.URL_Manager.toString().trim(); + *//*String METHOD_NAME = "UpdateStudentProfilewithstring"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/UpdateStudentProfilewithstring"; +*//* + + String METHOD_NAME = "Save_Student_PaymentDetails"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/Save_Student_PaymentDetails"; + + + + try { + str_savedpayment_response="x"; + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + request.addProperty("Fees_Category_ID","1" );//string + request.addProperty("Programe_ID", 1);//int + request.addProperty("Registration_ID",43676 );//int + request.addProperty("Paid_fees", 100);//int + request.addProperty("Paid_date", "2020-01-21");//string + request.addProperty("Payment_Type", "UPI");//string + request.addProperty("Payeer_Id", "empty");//string + request.addProperty("Transaction_ID", 123567);//int + request.addProperty("Reference_ID", 1234567);//int + request.addProperty("Transaction_Status", "Success");//string + request.addProperty("Created_User_Type", "Student");// string + request.addProperty("User_Id", 43676);//int + + + +// + // + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + + + //SoapPrimitive response = (SoapPrimitive ) envelope.getResponse(); + SoapObject response = (SoapObject) envelope.getResponse(); + SoapObject root = (SoapObject) response.getProperty(0); + Log.e("status",root.getProperty("Status").toString()); + + //str_savedpayment_response = response.toString(); + Log.e("resp editprofile",response.toString()); + + + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("saved payment fail", "> " + t.getMessage()); + //internet_issue1 = "savepayment"; + // Toast.makeText(getApplicationContext(), "Request failed: " + t.toString(),Toast.LENGTH_LONG).show(); + + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + Toast.makeText(getApplicationContext(), "Request failed: " + t.toString(),Toast.LENGTH_LONG).show(); + } + + }//End of uploaddetails*/ + + + /* anyType{vmPayment_Details=anyType{Payment_Id=12; Lead_Id=MI00001; + StudentName=Sharad Noolvi; Registration_Id=43676; Paid_Fees=100; + paid_date=21-January-20; Created_Date=10-02-2021 04:02;13 04:34:13 PM; + Auto_Receipt_No=12; transanction_Id=123567; reference_id=1234567; + Fees_Category_description=Registration; transactionStatus=success; + YearCode=2020-21; Payment_Type=UPI; Payeer_Id=empty; Status=Success; }; }*/ + diff --git a/app/src/main/java/com/leadcampusapp/AddProjectFragment.java b/app/src/main/java/com/leadcampusapp/AddProjectFragment.java new file mode 100644 index 0000000..0c5095e --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/AddProjectFragment.java @@ -0,0 +1,1802 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 22-06-2018. + */ + +import android.annotation.SuppressLint; +import android.app.AlertDialog; +import android.app.DatePickerDialog; +import android.app.Dialog; +import android.app.DialogFragment; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.graphics.Color; +import android.os.AsyncTask; +import android.os.Bundle; +import androidx.fragment.app.Fragment; +import androidx.core.content.ContextCompat; +import androidx.appcompat.widget.AppCompatSpinner; + +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.DatePicker; +import android.widget.EditText; +import android.widget.ImageButton; +import android.widget.LinearLayout; +import android.widget.TextView; +import android.widget.Toast; + +//import com.android.sripad.leadnew_22_6_2018.R; + +import org.json.JSONObject; +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.HashMap; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import org.joda.time.Days; +import org.joda.time.LocalDate; + +public class AddProjectFragment extends Fragment { + Context context; + AppCompatSpinner spin_projectType; + + ImageButton imgBtn_addMaterial; + LinearLayout lnrlyt_material; + private LinearLayout parentLinearLayout; + private LinearLayout parentLinearLayoutTM; + + //Button btn_addMaterial; + Button delete_button; + EditText edt_materialcost; + + double grandSum=0; + + int childLayoutId; + + ImageButton btn_addMaterial; + + ImageButton btn_addMember; + + + List listEdMaterialCost = new ArrayList(); + List listEdMaterialName = new ArrayList(); + + + List listEdMemberName = new ArrayList(); + List listEdMemberMailId = new ArrayList(); + + /* List listEdMemb = new ArrayList(); + List listEdMemberMailId = new ArrayList();*/ + + + ArrayList listMaterialName = new ArrayList(); + ArrayList listMaterialCost = new ArrayList(); + + ArrayList listMaterialName_newdup = new ArrayList(); + ArrayList listMaterialCost_newdup = new ArrayList(); + + ArrayList listMemberName = new ArrayList(); + ArrayList listMemberMailId = new ArrayList(); + + + + EditText mainEdt_Material; + EditText mainEdt_Cost; + + + EditText mainEdt_MemberName; + EditText mainEdt_MemberMailId; + + + EditText edt_projTitle; + EditText edt_beneficiaries; + EditText edt_beneficiaries_name; + + EditText edt_objective; + EditText edt_actionPlan; + + String str_Title; + String str_projectType; + String str_beneficiaries; + String str_objectives; + String str_actionPlan; + private HashMap hashProjTypeId = new HashMap(); + private AddProjectObject addProjectObject = new AddProjectObject(); + + + public static final String PREFBook_Stud= "prefbook_stud"; //sharedpreference Book + public static final String PrefID_RegID = "prefid_regid"; // + public static final String PrefID_SName = "prefid_sname"; // + public static final String PrefID_PM_SName = "prefid_pmsname"; // + public static final String PrefID_SLeadID = "prefid_sleadid"; // + public static final String PrefID_PM_SEmailID = "prefid_pm_semailid"; // + public static final String PrefID_SCellNo = "prefid_scellno"; // + + + public static final String PrefId_S_AcademicId = "prefid_sacademicid"; + + + private SharedPreferences shardpref_S_obj; + private String str_leadId,str_RegistrationId,str_academicCode; + + private ProgressDialog progressDialog; + + View view; + + Button btn_projsubmit; + + int count=0; + + private EditText edt_placeOfImpl; + private EditText edt_currentSituation; + + private String memberMailId; + private String mainMemberMailId; + private String mainMemberMailIdCheckMandatory; + //private String emailPattern = "[a-zA-Z0-9._-]+@[a-z]+\\.+[a-z]+"; + final String emailPattern = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; + Pattern pattern; + Matcher matcher; + int countEmailIds=0; + + + static TextView clickstartprojectdate_tv; + static TextView clickendprojectdate_tv; + static String yyyyMMdd_startdate = ""; + static String yyyyMMdd_enddate = ""; + + + + private LinearLayout parent_linear_layout1; + private ImageButton add_field_button; + + + private LinearLayout parent_linearlayout_material; + private ImageButton addmaterial_ib; + + private static TextView numberofdays_tv; + + static Class_alert_msg obj_class_alert_msg; + static Context static_context1; + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) + { + + context = getActivity().getBaseContext(); + + view = inflater.inflate(R.layout.addproject_fragment, container, false); + + + + static_context1=view.getContext(); + obj_class_alert_msg = new Class_alert_msg(static_context1); + edt_currentSituation = (EditText) view.findViewById(R.id.edt_currentSituation); + + parentLinearLayout = (LinearLayout) view.findViewById(R.id.parent_linear_layout); + parentLinearLayoutTM = (LinearLayout) view.findViewById(R.id.parent_linear_layout_TM); + + + + parent_linear_layout1= (LinearLayout) view.findViewById(R.id.parent_linear_layout1); + parent_linearlayout_material=(LinearLayout) view.findViewById(R.id.parent_linearlayout_material); + + + spin_projectType = (AppCompatSpinner) view.findViewById(R.id.spin_projectType); + getProjectType(); + //setProjectTypeSpinner(); + + clickstartprojectdate_tv = (TextView) view.findViewById(R.id.clickstartprojectdate_TV); + clickendprojectdate_tv = (TextView) view.findViewById(R.id.clickendprojectdate_TV); + numberofdays_tv=(TextView)view.findViewById(R.id.numberofdays_tv); + clickendprojectdate_tv.setVisibility(View.INVISIBLE); + + add_field_button=(ImageButton) view.findViewById(R.id.add_field_button); + addmaterial_ib=(ImageButton)view.findViewById(R.id.addmaterial_ib); + + + + shardpref_S_obj=getActivity().getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + + + shardpref_S_obj.getString(PrefId_S_AcademicId, "").trim(); + str_academicCode = shardpref_S_obj.getString(PrefId_S_AcademicId, "").trim(); + Log.d("str_academicCode:",str_academicCode); + + + + + + shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + str_leadId = shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + Log.d("str_leadId:",str_leadId); + //Toast.makeText(getActivity(),"LeadId: "+str_leadId,Toast.LENGTH_LONG).show(); + + shardpref_S_obj.getString(PrefID_RegID, "").trim(); + str_RegistrationId = shardpref_S_obj.getString(PrefID_RegID, "").trim(); + Log.d("str_RegistrationId:",str_RegistrationId); + //Toast.makeText(getActivity(),"RegistrationId: "+str_RegistrationId,Toast.LENGTH_LONG).show(); + + + + listEdMaterialName.clear(); + listEdMaterialCost.clear(); + listEdMemberName.clear(); + listEdMemberMailId.clear(); + listMaterialName.clear(); + listMaterialCost.clear(); + listMemberName.clear(); + listMemberMailId.clear(); + + + + + + + mainEdt_MemberName = (EditText) view.findViewById(R.id.edt_memberName); + mainEdt_MemberMailId = (EditText) view.findViewById(R.id.edt_memberMailId); + + + mainEdt_MemberMailId.setOnFocusChangeListener(new View.OnFocusChangeListener() { + @Override + public void onFocusChange(View v, boolean hasFocus) { + if(!hasFocus) { + mainMemberMailId = mainEdt_MemberMailId.getText().toString().trim(); + if (mainMemberMailId.length() > 0) { + if (!isValidEmail(mainMemberMailId)) { + mainEdt_MemberMailId.setError("Enter correct mail id"); + //mainEdt_MemberMailId.requestFocus(); + } + } + } + } + }); + + + + + + + + + + edt_placeOfImpl = (EditText) view.findViewById(R.id.edt_placeOfImpl); + + + btn_addMember = (ImageButton) view.findViewById(R.id.imgbtn_addMember); + btn_addMember.setOnClickListener(new View.OnClickListener() + { + @Override + public void onClick(View v) + { + Log.d("insidepppp","onclick"); + LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + + final View rowView = inflater.inflate(R.layout.add_member_layout, null); + // Add the new row before the add add_material_layout button. + + parentLinearLayoutTM.addView(rowView, parentLinearLayoutTM.getChildCount() - 1); + + Log.e("count",String.valueOf(parentLinearLayoutTM.getChildCount())); + + + + EditText edt_memberName = (EditText) rowView.findViewById(R.id.edt_memberName); + listEdMemberName.add(edt_memberName); + + final EditText edt_memberMailId = (EditText) rowView.findViewById(R.id.edt_memberMailId); + listEdMemberMailId.add(edt_memberMailId); + + + + + edt_memberMailId.setOnFocusChangeListener(new View.OnFocusChangeListener() { + @Override + public void onFocusChange(View v, boolean hasFocus) { + if(!hasFocus) { + memberMailId = edt_memberMailId.getText().toString().trim(); + if (memberMailId.length() > 0) { + if (!isValidEmail(memberMailId)) { + edt_memberMailId.setError("Enter correct mail id"); + } + } + } + } + }); + + + + Button delete_button_member = (Button) rowView.findViewById(R.id.delete_button_member); + delete_button_member.setOnClickListener(new View.OnClickListener() + { + @Override + public void onClick(View v) { + Log.d("Insidexxx","delete button member"); +/* Log.d("Materialcostxxxxxxxx",edt_materialcost.getText().toString()); + Double removedCost = Double.parseDouble(edt_materialcost.getText().toString()); + grandSum = grandSum - removedCost;*/ + //Log.d("grandsumxxxxx", String.valueOf(grandSum)); + parentLinearLayoutTM.removeView((View) v.getParent()); + + View rowView = (View) v.getParent(); + final EditText edt_memberMailId = (EditText) rowView.findViewById(R.id.edt_memberMailId); + listEdMemberMailId.remove(edt_memberMailId); + + final EditText edt_memberName = (EditText) rowView.findViewById(R.id.edt_memberName); + listEdMemberName.remove(edt_memberName); + + } + }); + } + });// end add button + + + //new + + add_field_button.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) + { + //LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + LayoutInflater inflater = (LayoutInflater) view.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + final View rowView = inflater.inflate(R.layout.field, null); + // Add the new row before the add field button. + parent_linear_layout1.addView(rowView, parent_linear_layout1.getChildCount() - 1); + + + EditText edt_memberName = (EditText) rowView.findViewById(R.id.edt_memberName); + listEdMemberName.add(edt_memberName); + + final EditText edt_memberMailId = (EditText) rowView.findViewById(R.id.edt_memberMailId); + listEdMemberMailId.add(edt_memberMailId); + + + + + edt_memberMailId.setOnFocusChangeListener(new View.OnFocusChangeListener() { + @Override + public void onFocusChange(View v, boolean hasFocus) { + if(!hasFocus) { + memberMailId = edt_memberMailId.getText().toString().trim(); + if (memberMailId.length() > 0) { + if (!isValidEmail(memberMailId)) { + edt_memberMailId.setError("Enter correct mail id"); + } + } + } + } + }); + + Button delete_button_member = (Button) rowView.findViewById(R.id.delete_button_member); + delete_button_member.setOnClickListener(new View.OnClickListener() + { + @Override + public void onClick(View v) { + Log.d("Insidexxx","delete button member"); +/* Log.d("Materialcostxxxxxxxx",edt_materialcost.getText().toString()); + Double removedCost = Double.parseDouble(edt_materialcost.getText().toString()); + grandSum = grandSum - removedCost;*/ + //Log.d("grandsumxxxxx", String.valueOf(grandSum)); + parent_linear_layout1.removeView((View) v.getParent()); + + View rowView = (View) v.getParent(); + final EditText edt_memberMailId = (EditText) rowView.findViewById(R.id.edt_memberMailId); + listEdMemberMailId.remove(edt_memberMailId); + + final EditText edt_memberName = (EditText) rowView.findViewById(R.id.edt_memberName); + listEdMemberName.remove(edt_memberName); + + } + }); + + + + } + }); + + + + + + addmaterial_ib.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) + { + LayoutInflater inflater = (LayoutInflater)view.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + + final View rowView = inflater.inflate(R.layout.field_material, null); + // Add the new row before the add field button. + parent_linearlayout_material.addView(rowView, parent_linearlayout_material.getChildCount() - 1); + + + EditText edt_materialname = (EditText) rowView.findViewById(R.id.edt_materialname); + listEdMaterialName.add(edt_materialname); + /* String materialName_str=edt_materialname.getText().toString(); + Log.e("tag","materialName_str="+materialName_str); + if(listEdMaterialName.contains(materialName_str)){ + Toast.makeText(getActivity(),materialName_str+ "is duplicated",Toast.LENGTH_LONG).show(); + + }else { + listEdMaterialName.add(edt_materialname); +*/ + final EditText edt_materialcost = (EditText) rowView.findViewById(R.id.edt_materialcost); + listEdMaterialCost.add(edt_materialcost); + // } + // final EditText edt_materialcost = (EditText) rowView.findViewById(R.id.edt_materialcost); + // listEdMaterialCost.add(edt_materialcost); + + + + + + Button delete_button_material = (Button) rowView.findViewById(R.id.delete_button_material); + delete_button_material.setOnClickListener(new View.OnClickListener() + { + @Override + public void onClick(View v) { + Log.d("Insidexxx","delete button member"); +/* Log.d("Materialcostxxxxxxxx",edt_materialcost.getText().toString()); + Double removedCost = Double.parseDouble(edt_materialcost.getText().toString()); + grandSum = grandSum - removedCost;*/ + //Log.d("grandsumxxxxx", String.valueOf(grandSum)); + parent_linearlayout_material.removeView((View) v.getParent()); + + View rowView = (View) v.getParent(); + final EditText edt_materialname = (EditText) rowView.findViewById(R.id.edt_materialname); + listEdMaterialName.remove(edt_materialname); + + final EditText edt_materialcost = (EditText) rowView.findViewById(R.id.edt_materialcost); + listEdMaterialCost.remove(edt_materialcost); + + } + }); + + + + } + }); + + + + + + + + + + + + + + + + + //new + + + + + + + + + + + + + + + + btn_addMaterial = (ImageButton) view.findViewById(R.id.imgbtn_addmaterial1); + btn_addMaterial.setOnClickListener(new View.OnClickListener() + { + @Override + public void onClick(View v) + { + Log.d("insidepppp","onclick"); + LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + final View rowView = inflater.inflate(R.layout.add_material_layout, null); + // Add the new row before the add add_material_layout button. + + parentLinearLayout.addView(rowView, parentLinearLayout.getChildCount() - 1); + + + + EditText edt_materialName = (EditText) rowView.findViewById(R.id.edt_materialname); + String materialName_str=edt_materialName.getText().toString(); + Log.e("tag","materialName_str="+materialName_str); + /* if(listEdMaterialName.contains(materialName_str)){ + Toast.makeText(getActivity(),materialName_str+ "is duplicated",Toast.LENGTH_LONG).show(); + + }else {*/ + listEdMaterialName.add(edt_materialName); + + final EditText edt_materialcost = (EditText) rowView.findViewById(R.id.edt_materialcost); + listEdMaterialCost.add(edt_materialcost); + // } + + Button del_button = (Button) rowView.findViewById(R.id.delete_button); + del_button.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Log.d("Insidexxx","delete button"); +/* Log.d("Materialcostxxxxxxxx",edt_materialcost.getText().toString()); + Double removedCost = Double.parseDouble(edt_materialcost.getText().toString()); + grandSum = grandSum - removedCost;*/ + Log.d("grandsumxxxxx", String.valueOf(grandSum)); + parentLinearLayout.removeView((View) v.getParent()); + + View rowView = (View) v.getParent(); + final EditText edt_materialcost = (EditText) rowView.findViewById(R.id.edt_materialcost); + listEdMaterialCost.remove(edt_materialcost); + + final EditText edt_materialName = (EditText) rowView.findViewById(R.id.edt_materialname); + listEdMaterialName.remove(edt_materialName); + + } + }); + + /* edt_materialcost.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + + } + + @Override + public void afterTextChanged(Editable s) { + //materialCost1 = s.toString(); + //calculategrandSum(); + } + });*/ + + + } + }); + + edt_materialcost = (EditText) view.findViewById(R.id.edt_materialcost); + + /* edt_materialcost.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + + } + + @Override + public void afterTextChanged(Editable s) { + //materialCost2 = s.toString(); + //calculategrandSum(); + } + });*/ + + + edt_projTitle = (EditText) view.findViewById(R.id.edt_title); + edt_beneficiaries = (EditText) view.findViewById(R.id.edt_noOfBeneficiaries); + + edt_beneficiaries_name = (EditText) view.findViewById(R.id.edt_whoareBeneficiaries); + + edt_objective = (EditText) view.findViewById(R.id.edt_objective); + edt_actionPlan = (EditText) view.findViewById(R.id.edt_actionplan); + + btn_projsubmit = (Button) view.findViewById(R.id.btn_projsubmit); + mainEdt_Material = (EditText) view.findViewById(R.id.edt_materialname); + mainEdt_Cost = (EditText) view.findViewById(R.id.edt_materialcost); + + btn_projsubmit.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) + { + + countEmailIds = 0; + listMaterialName.clear(); + listMaterialCost.clear(); + if(!(mainEdt_Material.getText().toString().isEmpty()) && !(mainEdt_Material.getText().toString().equals(""))) { + Log.e("mainEdt_Material","mainEdt_Material="+mainEdt_Material.getText().toString()); + Log.e("mainEdt_Cost","mainEdt_Cost="+mainEdt_Cost.getText().toString()); + listMaterialName.add(mainEdt_Material.getText().toString()); + listMaterialCost.add(mainEdt_Cost.getText().toString()); + + } + if(listMaterialName.size()!=0) { + String arr_materialName[] = new String[0]; + for (int i = 0; i < listEdMaterialName.size(); i++) { + String materialName = listEdMaterialName.get(i).getText().toString(); + + listMaterialName.add(materialName); + + } + + // Log.e("tag","bruteforce(listMaterialName)=="+bruteforce(listMaterialName)); + + } + if(checkMandatoryFields()) + { + btn_projsubmit.setVisibility(View.GONE); + + Log.d("Insideyyyyy","true"); + + + + if(!(mainEdt_MemberName.getText().toString().isEmpty()) && !(mainEdt_MemberName.getText().toString().equals(""))) { + listMemberName.add(mainEdt_MemberName.getText().toString()); + listMemberMailId.add(mainEdt_MemberMailId.getText().toString()); + } + + + /*for(int i = 0; i < listEdMaterialName.size(); i++) + { + + if(!listMaterialName.contains(listEdMaterialName.get(i).getText().toString())) + { + listMaterialName.add(listEdMaterialName.get(i).getText().toString()); + } + else{ + Log.e("tag","duplicate"); + } + }*/ + + + Log.e("tag","listMaterialName=="+listMaterialName); + Log.e("tag","listMaterialName_newdup=="+listMaterialName_newdup); + if(!listEdMaterialCost.equals(null)) + { + + for (int i = 0; i < listEdMaterialCost.size(); i++) { + + if (!listEdMaterialCost.get(i).getText().toString().equals("") && !listEdMaterialCost.get(i).getText().toString().isEmpty() && !listEdMaterialName.get(i).getText().toString().equals("") && !listEdMaterialName.get(i).getText().toString().isEmpty()) { + String materialCost = listEdMaterialCost.get(i).getText().toString(); + listMaterialCost.add(materialCost); + + double sumval = Double.parseDouble(materialCost); + grandSum = grandSum + sumval; + Log.d("Value ", "Val " + materialCost); + } + } + + } + + for(int i = 0; i < listEdMemberName.size(); i++) + { + String memberName = listEdMemberName.get(i).getText().toString(); + listMemberName.add(memberName); + } + + if(!listEdMemberMailId.equals(null)) + { + for (int i = 0; i < listEdMemberMailId.size(); i++) { + if (!listEdMemberMailId.get(i).getText().toString().equals("") && !listEdMemberMailId.get(i).getText().toString().isEmpty()) { + String memberMailId = listEdMemberMailId.get(i).getText().toString(); + listMemberMailId.add(memberMailId); + } + } + } + + /*for (int j1=0;j1 { + + Context context; + AlertDialog alertDialog; + + /* private ProgressBar progressBar;*/ + + AddProject (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapPrimitive response = addProjectDetails(); + + //Log.d("Soap response is",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { +/* progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + + progressDialog.setMessage("Submitting"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + /*progressBar.setVisibility(View.GONE);*/ + + progressDialog.dismiss(); + + if(result!=null) { + if (result.toString().equalsIgnoreCase("success")) { + Toast.makeText(getActivity(), "Project Added Successfully", Toast.LENGTH_LONG).show(); + clearAllFields(); + getActivity().finish(); + Intent ittEditProjToProjDtls = new Intent(getActivity(), ProjectDetails.class); + startActivity(ittEditProjToProjDtls); + } else { + Toast.makeText(getActivity(), result.toString(), Toast.LENGTH_LONG).show(); + } + }else{ + + } + + /* String finalResult = result.toString(); + String finals = finalResult.replace("anyType",""); + Log.d("Finals is",finals); + + + SoapPrimitive status = (SoapPrimitive) result.getProperty("Status"); + //Log.d("Status is:",status.toString()); + + if(status.toString().equals("Success")) { + SoapPrimitive role = (SoapPrimitive) result.getProperty("Role"); + Log.d("Role is:", role.toString()); + + if(role.toString().equals("Student")){ + *//* Intent ittLoginToEditProfile = new Intent(LoginActivity.this,EditProfileActivity.class); + ittLoginToEditProfile.putExtra("leadid",leadid); + startActivity(ittLoginToEditProfile);*//* + } + }else{ + Log.d("Status is: ",status.toString()); + }*/ + + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private void clearAllFields() { + getActivity().finish(); + } + + private SoapPrimitive addProjectDetails() + { + + String METHOD_NAME = "AddProjectproposal1json"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/AddProjectproposal1json"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + + ArrayList matModel = new ArrayList(); + + vmmaterial material = new vmmaterial(); + material.setSlno(1); + material.setMeterialCost(50); + material.setMeterialName("Material 1"); + matModel.add(material); + + request.addProperty("Student_Id",str_RegistrationId); + request.addProperty("Lead_Id",str_leadId); + request.addProperty("Title",edt_projTitle.getText().toString()); + request.addProperty("BeneficiaryNo",Integer.valueOf(edt_beneficiaries.getText().toString())); + + request.addProperty("Beneficiary",edt_beneficiaries_name.getText().toString()); + + str_projectType = spin_projectType.getSelectedItem().toString(); + long projectTypeId = (long) hashProjTypeId.get(str_projectType); + + Log.d("projectIdinSubmissionxx", String.valueOf(projectTypeId)); + + request.addProperty("ProjectType",String.valueOf(projectTypeId)); + request.addProperty("Objectives",edt_objective.getText().toString()); + request.addProperty("ActionPlan",edt_actionPlan.getText().toString()); + + + JSONObject jsonObject = new JSONObject(); + + for(int k=0;kstring + request.addProperty("ProjectEndDate",yyyyMMdd_enddate.toString());//string + + + + Log.d("grandSumissss",String.valueOf(grandSum)); + + Log.d("AddProject_request",request.toString()); + + //request.addProperty("materials",) + +/* + SoapObject groupSoap=new SoapObject("http://mis.leadcampus.org/",METHOD_NAME); + SoapObject vmMaterial=new SoapObject("http://mis.leadcampus.org/",METHOD_NAME); + + vmMaterial.addProperty("slno",1); + vmMaterial.addProperty("MeterialName","material1"); + vmMaterial.addProperty("MeterialCost",5); + + groupSoap.addProperty("vmmaterial",vmMaterial); + + + PropertyInfo materialProp = new PropertyInfo(); + materialProp.setName("materials");i + materialProp.setValue(groupSoap);*/ + //materialProp.setType(groupSoap.getClass()); + + //request.addProperty(materialProp); + + + + + //request.addProperty("materials",matModel); + + + + + //request.addProperty("vmp",addProjectObject); + //users.ad + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + ///envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Projects.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + // Log.d("soap response1xxxx",envelope.getResponse().toString()); + + + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + Log.e("soap responseyyyyyyy",response.toString()); + + return response; + + //return response; + + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + t.printStackTrace(); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + }catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + + t.printStackTrace(); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + } + + private boolean checkMandatoryFields() + { + String str_Title = edt_projTitle.getText().toString(); + String str_beneficiaries = edt_beneficiaries.getText().toString(); + String str_beneficiaries_name = edt_beneficiaries_name.getText().toString(); + String str_objectives = edt_objective.getText().toString(); + String str_actionPlan = edt_actionPlan.getText().toString(); + String str_projectType = spin_projectType.getSelectedItem().toString(); + String str_placeOfImpl = edt_placeOfImpl.getText().toString(); + String str_currentSituation = edt_currentSituation.getText().toString(); + + + + + Boolean b_currentsituation,b_titlename,b_beneficiaries,b_beneficiaries_name, + b_placeofimpl,b_selecttype,b_objectives,b_datevalidation1, + b_actionplan,b_datevalidation2,b_materialName; + + b_currentsituation=b_titlename=b_beneficiaries=b_beneficiaries_name= + b_placeofimpl=b_selecttype=b_objectives=b_datevalidation1= + b_actionplan=b_datevalidation2= true; + + /* if(listEdMaterialName.size()!=0){ + for(int i1=0;i1 0) + { + if (!isValidEmail(mainMemberMailIdCheckMandatory)) + { + mainEdt_MemberMailId.setError("Enter correct mail id"); + mainEdt_MemberMailId.requestFocus(); + return false; + } + } + + + + if(!listEdMemberMailId.equals(null)) + { + Log.d("Insidedddd","listEdMemberMailIdnotnull"); + for (int i = 0; i < listEdMemberMailId.size(); i++) + { + /* if (listEdMemberMailId.get(i).getError()!=null) { + *//* String memberMailId = listEdMemberMailId.get(i).getText().toString(); + listMemberMailId.add(memberMailId);*//* + //return true; + countEmailIds++; + }*/ + + memberMailId = listEdMemberMailId.get(i).getText().toString().trim(); + if (memberMailId.length() > 0) + { + if (!isValidEmail(memberMailId)) { + listEdMemberMailId.get(i).setError("Enter correct mail id"); + listEdMemberMailId.get(i).requestFocus(); + return false; + } + } + + + } + + /*Log.d("countValueissss", String.valueOf(countEmailIds)); + + if(countEmailIds!=0){ + return false; + }*/ + + + +/* + if(countEmailIds==listEdMemberMailId.size()){ + *//* if(mainEdt_MemberMailId!=null && !mainEdt_MemberMailId.getText().toString().isEmpty() && mainEdt_MemberMailId.getError()!=null){ + return true; + }*//* + return true; + } + else{ + return false; + }*/ + } + + + + + + if(str_currentSituation.equals(null) || str_currentSituation.equals("") || str_currentSituation.isEmpty()){ + edt_currentSituation.setError("Enter current situation"); + edt_currentSituation.requestFocus(); + b_currentsituation=false; + // return false; + } + + + if(str_Title.equals(null) || str_Title.equals("") || str_Title.isEmpty()){ + edt_projTitle.setError("Enter title of the project"); + edt_projTitle.requestFocus(); + b_titlename=false; + //return false; + } + + if(str_beneficiaries.equals(null) || str_beneficiaries.equals("") || str_beneficiaries.isEmpty()){ + edt_beneficiaries.setError("Enter no. of beneficiaries"); + edt_beneficiaries.requestFocus(); + b_beneficiaries=false; + //return false; + } + + + + + if(str_beneficiaries_name.equals(null) || str_beneficiaries_name.equals("") || str_beneficiaries_name.isEmpty()){ + edt_beneficiaries_name.setError("Enter who are they"); + edt_beneficiaries_name.requestFocus(); + b_beneficiaries_name=false; + // return false; + } + + if(str_placeOfImpl.equals(null) || str_placeOfImpl.equals("") || str_placeOfImpl.isEmpty()){ + edt_placeOfImpl.setError("Enter place of Implementation"); + edt_placeOfImpl.requestFocus(); + b_placeofimpl=false; + //return false; + } + + if(str_projectType.contains("Select")){ +/* edt_beneficiaries.setError("Enter no. of beneficiaries"); + edt_beneficiaries.requestFocus();*/ + Toast.makeText(context,"Please select the Project Type",Toast.LENGTH_LONG).show(); + b_selecttype=false; + // return false; + } + + + + + if(str_objectives.equals(null) || str_objectives.equals("") || str_objectives.isEmpty()){ + edt_objective.setError("Enter objective of the project"); + edt_objective.requestFocus(); + b_objectives=false; + //return false; + } + + + +//vijay + /*if(clickstartprojectdate_tv.getText().toString().equalsIgnoreCase("Click for Calendar") + ||clickendprojectdate_tv.getText().toString().equalsIgnoreCase("Click for Calendar")) + { + Toast.makeText(context, "Kindly enter the date", Toast.LENGTH_SHORT).show(); + b_datevalidation1=false; + // return false; + }*/ + + + + if(clickstartprojectdate_tv.getText().toString().equalsIgnoreCase("Click for Calendar") + ||clickendprojectdate_tv.getText().toString().equalsIgnoreCase("Click for Calendar")) + { + Toast.makeText(context, "Kindly enter the date", Toast.LENGTH_SHORT).show(); + b_datevalidation1=false; + } + + + + + if((!clickstartprojectdate_tv.getText().toString().equalsIgnoreCase("Click for Calendar")) + &&(!clickendprojectdate_tv.getText().toString().equalsIgnoreCase("Click for Calendar"))) + + { + + + + + if ((clickstartprojectdate_tv.getText().toString().length() != 0) && (clickendprojectdate_tv.getText().toString().length() != 0)) { + /*if(date1.compareTo(date2)<0){ //0 comes when two date are same, + //1 comes when date1 is higher then date2 + //-1 comes when date1 is lower then date2 }*/ + + + SimpleDateFormat mdyFormat = new SimpleDateFormat("yyyy-MM-dd"); //2017-06-22 + + try { + Date fromdate = mdyFormat.parse(yyyyMMdd_startdate); + Date todate = mdyFormat.parse(yyyyMMdd_enddate); + + if (fromdate.compareTo(todate) <= 0) + { + //return true; + } else { + Toast.makeText(context, "Kindly enter valid date", Toast.LENGTH_SHORT).show(); + b_datevalidation2 = false; + //return false; + } + + + } catch (ParseException e) { + e.printStackTrace(); + } + }//end of if + + } + + + + if(str_actionPlan.equals(null) || str_actionPlan.equals("") || str_actionPlan.isEmpty()){ + edt_actionPlan.setError("Enter action plan of the project"); + edt_actionPlan.requestFocus(); + b_actionplan=false; + // return false; + } + /*else{ + return true; + }*/ + + + + return( b_currentsituation&&b_titlename&&b_beneficiaries&&b_beneficiaries_name&& + b_placeofimpl&&b_selecttype&& b_objectives&&b_datevalidation1&& + b_actionplan&&b_datevalidation2&&b_materialName); + + + } + + private void setProjectTypeSpinner(ArrayList projectTypeList) { + + //getProjectType(); + + /*final ArrayList projType = new ArrayList(); + projType.add("Education"); + projType.add("Health Care"); + projType.add("Sports");*/ + + ArrayAdapter dataAdapter2 = new ArrayAdapter(context, R.layout.simple_spinner_items, projectTypeList); + + // Drop down layout style - list view with radio button + //dataAdapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter2.setDropDownViewResource(R.layout.spinnercustomstyle); + + // attaching data adapter to spinner + spin_projectType.setAdapter(dataAdapter2); + //spin_projectType.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorWhite)); + + } + + private void getProjectType() { + ProjectType projType = new ProjectType(getActivity()); + projType.execute(); + } + + public class ProjectType extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + //private ProgressBar progressBar; + + ProjectType (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + String METHOD_NAME = "GetThemeList"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetThemeList"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Login.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapObject response = (SoapObject) envelope.getResponse(); + Log.d("GetThemeList:",response.toString()); + + return response; + + } + + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + + t.printStackTrace(); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + catch (Exception t) { + Log.d("exception outside",t.getMessage().toString()); + + t.printStackTrace(); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + + return null; + + + //Log.d("Soap response is",response.toString()); + + //return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + + progressDialog.setMessage("Loading"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapObject result) { + /* progressBar.setVisibility(View.GONE);*/ + progressDialog.dismiss(); + + if(result!=null) { + String finalResult = result.toString(); + String finals = finalResult.replace("anyType", ""); + Log.d("Finals is", finals); + + ArrayList projectTypeList = new ArrayList(); + projectTypeList.add("Select Project Type"); + + Log.d("finalResultsssss", finalResult); + + for (int i = 0; i < result.getPropertyCount(); i++) { + SoapObject list = (SoapObject) result.getProperty(i); + SoapPrimitive S_ThemeId, S_ThemeName, S_Status; + Object O_ThemeId, O_ThemeName, O_Status; + + int projectTypeId = 0; + + String str_ProjectTypeId = null, str_ProjectType = null, str_status = null; + + O_ThemeId = list.getProperty("ThemeId"); + if (!O_ThemeId.toString().equals("anyType") && !O_ThemeId.toString().equals(null) && !O_ThemeId.toString().equals("anyType{}")) { + S_ThemeId = (SoapPrimitive) list.getProperty("ThemeId"); + Log.d("ThemeId", S_ThemeId.toString()); + str_ProjectTypeId = O_ThemeId.toString(); + projectTypeId = Integer.valueOf(str_ProjectTypeId); + } + + O_ThemeName = list.getProperty("ThemeName"); + if (!O_ThemeName.toString().equals("anyType") && !O_ThemeName.toString().equals(null) && !O_ThemeName.toString().equals("anyType{}")) { + S_ThemeName = (SoapPrimitive) list.getProperty("ThemeName"); + Log.d("ProjectType Name", S_ThemeName.toString()); + str_ProjectType = O_ThemeName.toString(); + + projectTypeList.add(str_ProjectType); + + hashProjTypeId.put(str_ProjectType, projectTypeId); + } + + + } + + setProjectTypeSpinner(projectTypeList); + + } + //SoapPrimitive status = (SoapPrimitive) result.getProperty("Status"); + //Log.d("Status is:",status.toString()); + + /*if(status.toString().equals("Success")) { + SoapPrimitive role = (SoapPrimitive) result.getProperty("Role"); + Log.d("Role is:", role.toString()); + + if(role.toString().equals("Student")){ + *//* Intent ittLoginToEditProfile = new Intent(LoginActivity.this,EditProfileActivity.class); + ittLoginToEditProfile.putExtra("leadid",leadid); + startActivity(ittLoginToEditProfile);*//* + } + }else{ + Log.d("Status is: ",status.toString()); + }*/ + + + //setProjectTypeSpinner(); + + + + + + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private boolean isValidEmail(String email) { + String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{3,})$"; + + Pattern pattern = Pattern.compile(EMAIL_PATTERN); + Matcher matcher = pattern.matcher(email); + return matcher.matches(); + } + + + + + + public static void alerts_dialog(String str_error,String ws,Context context) + { + + AlertDialog.Builder dialog = new AlertDialog.Builder(static_context1); + dialog.setCancelable(false); + dialog.setTitle("LeadMIS"); + dialog.setMessage("Kindly submit the data before exiting"); + + /*Activity activity = (Activity) context; + fragmentManager = activity.getFragmentManager(); +*/ + + + dialog.setPositiveButton("OK", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) + { + + /*FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); + + fragmentTransaction.replace(R.id.frame_container, new Fragment_RHolidays()); + fragmentTransaction.commit();*/ + + dialog.dismiss(); + + } + }); + + + + + final AlertDialog alert = dialog.create(); + alert.setOnShowListener(new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface arg0) { + alert.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#004D40")); + } + }); + alert.show(); + + + } + + public static boolean bruteforce(ArrayList input) { + for (int i = 0; i < input.size(); i++) { + for (int j = 0; j < input.size(); j++) { + if (input.get(i).equals(input.get(j)) && i != j) { + return false; + } + } + } + return true; + } + + +} diff --git a/app/src/main/java/com/leadcampusapp/AddProjectObject.java b/app/src/main/java/com/leadcampusapp/AddProjectObject.java new file mode 100644 index 0000000..ab9983b --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/AddProjectObject.java @@ -0,0 +1,118 @@ +package com.leadcampusapp; + +import org.ksoap2.serialization.KvmSerializable; +import org.ksoap2.serialization.PropertyInfo; + +import java.util.ArrayList; +import java.util.Hashtable; + +/** + * Created by Shripad on 08-07-2018. + */ + +public class AddProjectObject implements KvmSerializable { + ArrayList materials; + String Title; + long Beneficiaries; + String Objectives; + String ActionPlan; + long PDId; + String Lead_Id; + + public AddProjectObject(){ + + } + +/* public AddProjectObject(ArrayList matModel, String title, String beneficiaries, String objectives, String actionPlan, long PDId) { + this.vmmaterial = matModel; + Title = title; + Beneficiaries = beneficiaries; + Objectives = objectives; + ActionPlan = actionPlan; + this.PDId = PDId; + }*/ + + /* public ArrayList getMatModel() { + return materials; + } + + public void setMatModel(ArrayList matModel) { + this.materials = matModel; + }*/ + + public ArrayList getMaterials() { + return materials; + } + + public void setMaterials(ArrayList materials) { + this.materials = materials; + } + + public String getLead_Id() { + return Lead_Id; + } + + public void setLead_Id(String lead_Id) { + Lead_Id = lead_Id; + } + + public String getTitle() { + return Title; + } + + public void setTitle(String title) { + Title = title; + } + + public long getBeneficiaries() { + return Beneficiaries; + } + + public void setBeneficiaries(long beneficiaries) { + Beneficiaries = beneficiaries; + } + + public String getObjectives() { + return Objectives; + } + + public void setObjectives(String objectives) { + Objectives = objectives; + } + + public String getActionPlan() { + return ActionPlan; + } + + public void setActionPlan(String actionPlan) { + ActionPlan = actionPlan; + } + + public long getPDId() { + return PDId; + } + + public void setPDId(long PDId) { + this.PDId = PDId; + } + + @Override + public Object getProperty(int i) { + return null; + } + + @Override + public int getPropertyCount() { + return 0; + } + + @Override + public void setProperty(int i, Object o) { + + } + + @Override + public void getPropertyInfo(int i, Hashtable hashtable, PropertyInfo propertyInfo) { + + } +} diff --git a/app/src/main/java/com/leadcampusapp/AmbassadorRequestFragment.java b/app/src/main/java/com/leadcampusapp/AmbassadorRequestFragment.java new file mode 100644 index 0000000..1690883 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/AmbassadorRequestFragment.java @@ -0,0 +1,416 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 20-07-2018. + */ + +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.SharedPreferences; +import android.graphics.Color; +import android.os.AsyncTask; +import android.os.Bundle; +import androidx.fragment.app.Fragment; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; + +import android.widget.ListAdapter; +import android.widget.ListView; +import android.widget.ProgressBar; +import android.widget.SimpleAdapter; + +import android.widget.Toast; + +//import com.android.sripad.leadnew_22_6_2018.R; +import com.leadcampusapp.module.AmbassadorRequestList; +import com.leadcampusapp.module.AmbassadorRequestListModule; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.util.ArrayList; +import java.util.HashMap; + +public class AmbassadorRequestFragment extends Fragment +{ + + ListView list,list_head; + ArrayList> mylist, mylist_title; + ListAdapter adapter_title, adapter; + HashMap map1, map2; + + AmbassadorRequestListModule ambassadorRequestListObj; + ArrayList ambassadorRequestListModules; + private ProgressBar progressBar; + AmbassadorRequestListModule[] ambassadorRequestInfosarr; + int responseCount=0; + int i=0; + String str_Lead_Id; + + // Integer ManagerId; + + public static final String PREFBook_PM= "prefbook_pm"; //sharedpreference Book + public static final String PrefID_PMID = "prefid_pmid"; // + SharedPreferences shardprefPM_obj; + String str_MangerID; + Integer MDId; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + + View view=inflater.inflate(R.layout.ambassadorrequest_fragment, container, false); + + list = (ListView) view.findViewById(R.id.lv_ambassadorlist); + list_head = (ListView) view.findViewById(R.id.lv_ambassadorlisthead); + progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + ambassadorRequestListObj = new AmbassadorRequestListModule(); + +/* ManagerId = getActivity().getIntent().getExtras().getInt("ManagerId"); + Log.i("tag","MangerID PMProjectDetails="+ManagerId); +*/ + + shardprefPM_obj= getActivity().getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MangerID = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + Log.d("str_leadId:",str_MangerID); + // Toast.makeText(this,"LeadId: "+str_MangerID,Toast.LENGTH_LONG).show(); + MDId=Integer.parseInt(str_MangerID); + + GetAmbassadorRequestDetails getAmbassadorRequestDetails = new GetAmbassadorRequestDetails(getActivity()); + getAmbassadorRequestDetails.execute(MDId); + + // showActivity(); + return view; + } + + public void showActivity() { + + mylist = new ArrayList>(); + mylist_title = new ArrayList>(); + + /**********Display the headings************/ + map1 = new HashMap(); + + // map1.put("slno", "Lead Id"); + map1.put("one", " LEAD Id"); + map1.put("two", "Student Name"); + map1.put("three","Student Type"); + /* map1.put("three","Applied"); + map1.put("four","Disperse Amount"); + map1.put("five","Balance Amount");*/ + mylist_title.add(map1); + + + try { + adapter_title = new SimpleAdapter(getContext(), mylist_title, R.layout.pmmasterrequest_list, + new String[]{ "one", "two","three"}, new int[]{ + R.id.LeadId, R.id.StudentName, R.id.StudentType}); + list_head.setAdapter(adapter_title); + } catch (Exception e) { + + } + + /********************************************************/ + + + for (int i = 0; i < AmbassadorRequestList.listview_arr.size(); i++) { + + map2 = new HashMap(); + map2.put("one", AmbassadorRequestList.listview_arr.get(i).getLead_Id()); + map2.put("two", AmbassadorRequestList.listview_arr.get(i).getStudentName()); + map2.put("three", AmbassadorRequestList.listview_arr.get(i).getStudent_Type()); + // map2.put("four", ApprovedProjectList.listview_arr.get(i).getDisperse_amount()); + //map2.put("five", ApprovedProjectList.listview_arr.get(i).getBalance_amount()); + mylist.add(map2); + + /* if(ApprovedProjectList.listview_arr.get(i).getApproved_amount().equals("0")){ + list.setBackgroundColor(Color.GREEN); + }*/ + } + + try { + adapter = new SimpleAdapter(getContext(), mylist, R.layout.pmmasterrequest_list, + new String[]{"one", "two","three"}, new int[]{ + R.id.LeadId, R.id.StudentName, R.id.StudentType}); + list.setAdapter(adapter); + } catch (Exception e) { + + } + /* if (ApprovedProjectList.listview_arr.get(i).getApproved_amount().equals("0")) { + list.setBackgroundColor(Color.YELLOW); + }*/ + + list.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + + Object o = list.getItemAtPosition(position); + + str_Lead_Id=AmbassadorRequestList.listview_arr.get(position).getLead_Id(); + + AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity()); + alertDialogBuilder.setMessage("Are you sure, You wanted to make LEAD Ambassador"); + alertDialogBuilder.setPositiveButton("Yes", + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface arg0, int arg1) { + // Toast.makeText(getActivity(), "You clicked yes button", Toast.LENGTH_LONG).show(); + SubmitDetails submitDetails = new SubmitDetails(); + submitDetails.execute(); + } + }); + alertDialogBuilder.setNegativeButton("No",new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + getActivity().finish(); + } + }); + + final AlertDialog alertDialog = alertDialogBuilder.create(); + + alertDialog.setOnShowListener( new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface arg0) { + alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(Color.RED); + alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#004D40")); + } + }); + alertDialog.show(); + } + + }); + } + + public class SubmitDetails extends AsyncTask { + + AlertDialog alertDialog; + // private ProgressBar progressBar; + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapPrimitive response = AmbassadorRequest(); + + // SoapObject response = ReApplyProjectDetails(); + Log.d("Soap response issssss",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressBar.setVisibility(View.VISIBLE); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + if(result != null) { + if (result.toString().equals("Error")) { + Toast.makeText(getContext(), "Error occured while saving to database", Toast.LENGTH_LONG).show(); + } else { + Toast.makeText(getContext(), "Sucessfully updated to Lead Ambassador", Toast.LENGTH_LONG).show(); + /*Intent ittEditProjToProjStatus = new Intent(getContext(),PMProjectDetailActivity.class); + ittEditProjToProjStatus.putExtra("pageCount",0); + startActivity(ittEditProjToProjStatus);*/ + GetAmbassadorRequestDetails getAmbassadorRequestDetails = new GetAmbassadorRequestDetails(getActivity()); + getAmbassadorRequestDetails.execute(MDId); + } + } + progressBar.setVisibility(View.GONE); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapPrimitive AmbassadorRequest() { + String METHOD_NAME = "Applyleadmasterandambassador"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/Applyleadmasterandambassador"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + request.addProperty("Lead_Id",str_Lead_Id); + Log.d("PDIdssssssxxxx","hi"); + + request.addProperty("Student_Type","Lead Ambassador"); + + Log.d("Requestisxxxxx",request.toString()); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + Log.e("tag","soap masterrequest update"+envelope.getResponse().toString()); + + //return null; + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + } + return null; + + } + + + public class GetAmbassadorRequestDetails extends AsyncTask { + + Context context; + + GetAmbassadorRequestDetails (Context ctx){ + context = ctx; + } + + + @Override + protected SoapObject doInBackground(Integer... params) { + Integer ManagerId = (Integer) params [0]; + //SoapObject response = getStudDtls(leadid); + + //unapprovedProjectListObj = new UnapprovedProjectListModule(); + ambassadorRequestListModules = new ArrayList(); + + String METHOD_NAME = "ApplayedLeadAmbassador"; + String NamespaceMail="http://mis.leadcampus.org/", SOAP_ACTION1="http://mis.leadcampus.org/ApplayedLeadAmbassador";//namespace+methodname + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + request.addProperty("ManagerId", ManagerId); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapObject response = (SoapObject) envelope.getResponse(); + + Log.d("Tag", "soap response ApplayedLeadAmbassador=" + response.toString()); + + + responseCount = response.getPropertyCount(); + + + Log.d("count ambassador", String.valueOf(response.getPropertyCount())); + + AmbassadorRequestList.listview_arr.clear(); + AmbassadorRequestListModule.listview_arr.clear(); + + if (responseCount > 0) { + + ambassadorRequestInfosarr = new AmbassadorRequestListModule[responseCount]; + for (i = 0; i < responseCount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + String Status=response_soapobj.getProperty("Status").toString(); + Log.i("tag","Status"+Status); + + if( Status.equals("Success")) { + ambassadorRequestListObj.setStudentName(response_soapobj.getProperty("StudentName").toString()); + ambassadorRequestListObj.setLead_Id(response_soapobj.getProperty("Lead_Id").toString()); + ambassadorRequestListObj.setIsApply_MasterLeader(response_soapobj.getProperty("isApply_MasterLeader").toString()); + ambassadorRequestListObj.setIsApply_LeadAmbassador(response_soapobj.getProperty("isApply_LeadAmbassador").toString()); + ambassadorRequestListObj.setStudent_Type(response_soapobj.getProperty("Student_Type").toString()); + + // approvedProjectListObj.setBalance_amount(response_soapobj.getProperty("Amount").toString()); + ambassadorRequestListModules.add(ambassadorRequestListObj); + + Log.d("tag", "ambassadorRequestListModules.get(i)=" + ambassadorRequestListModules.get(i).getStudentName()); + Log.d("tag", "ambassadorRequestListModules=" + ambassadorRequestListModules.size()); + Log.d("tag", "ambassadorRequestListModules=" + ambassadorRequestListObj.getStudentName()); + + String StudentName = response_soapobj.getProperty("StudentName").toString(); + String Lead_Id = response_soapobj.getProperty("Lead_Id").toString(); + String isApply_MasterLeader = response_soapobj.getProperty("isApply_MasterLeader").toString(); + String isApply_LeadAmbassador = response_soapobj.getProperty("isApply_LeadAmbassador").toString(); + String Student_Type = response_soapobj.getProperty("Student_Type").toString(); + + + ambassadorRequestInfosarr[i] = ambassadorRequestListObj; + + AmbassadorRequestList.listview_arr.add(new AmbassadorRequestList(Lead_Id, StudentName, isApply_MasterLeader, isApply_LeadAmbassador, Student_Type)); + + Log.i("Tag", "AmbassadorRequestList.size=" + AmbassadorRequestList.listview_arr.size()); + }else{ + return null; + } + } + } + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.d("exception outside",t.getMessage().toString()); + } + + return null; + } + + @Override + protected void onPreExecute() { + + progressBar.setVisibility(View.VISIBLE); + } + + @Override + protected void onPostExecute(SoapObject result) { + progressBar.setVisibility(View.GONE); + + /* if(result==null){ + Toast.makeText(getActivity(),"There is no student applied for LEAD Ambassador ",Toast.LENGTH_LONG).show(); + }*/ + if(result!= null) { + showActivity(); + } + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + +}//end of fragment class diff --git a/app/src/main/java/com/leadcampusapp/AnalyticAdapter.java b/app/src/main/java/com/leadcampusapp/AnalyticAdapter.java new file mode 100644 index 0000000..f7754de --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/AnalyticAdapter.java @@ -0,0 +1,43 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 22-06-2018. + */ +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentStatePagerAdapter; + +public class AnalyticAdapter extends FragmentStatePagerAdapter { + int mNumOfTabs; + + public AnalyticAdapter(FragmentManager fm, int NumOfTabs) { + super(fm); + this.mNumOfTabs = NumOfTabs; + } + + @Override + public Fragment getItem(int position) { + + switch (position) { + case 0: + ChartProjectCountFragment tab1 = new ChartProjectCountFragment(); + return tab1; + /* case 1: + ChartStud_CollgCountFragment tab2 = new ChartStud_CollgCountFragment(); + return tab2;*/ + case 1: + ChartThemeProjCountFragment tab3 = new ChartThemeProjCountFragment(); + return tab3; + case 2: + ChartFundAmtCountFragment tab4 = new ChartFundAmtCountFragment(); + return tab4; + default: + return null; + } + } + + @Override + public int getCount() { + return mNumOfTabs; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/AnalyticChartActivity.java b/app/src/main/java/com/leadcampusapp/AnalyticChartActivity.java new file mode 100644 index 0000000..a9e86e4 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/AnalyticChartActivity.java @@ -0,0 +1,162 @@ +package com.leadcampusapp; + +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.graphics.Color; +import android.os.Bundle; +//import android.support.design.widget.TabLayout; +import androidx.viewpager.widget.ViewPager; +import androidx.appcompat.app.AppCompatActivity; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.ImageButton; +import android.widget.TextView; + +import com.google.android.material.tabs.TabLayout; + +//import com.android.sripad.leadnew_22_6_2018.R; + +public class AnalyticChartActivity extends AppCompatActivity { + + ImageButton img_eventsBack; + + public static final String PREFBook_Stud= "prefbook_stud"; + private SharedPreferences shardpref_S_obj; + public static final String PrefID_Role = "prefid_role"; + public String str_role = null; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_analyticchart); + + shardpref_S_obj=AnalyticChartActivity.this.getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + shardpref_S_obj.getString(PrefID_Role, "").trim(); + str_role = shardpref_S_obj.getString(PrefID_Role, "").trim(); + + + /* img_eventsBack = (ImageButton) findViewById(R.id.img_eventsBack);*/ + + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + //getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background)); + + View actionBarView = getSupportActionBar().getCustomView(); + TextView actionBarTV = (TextView) actionBarView.findViewById(R.id.txt_actionBar); + actionBarTV.setText("Analytical Charts"); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); + + + View view1; + LayoutInflater inflater1 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view1 = inflater1.inflate(R.layout.pm_projectcountchart_tablayout, null); + + /* View view2; + LayoutInflater inflater2 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view2 = inflater2.inflate(R.layout.pm_stu_collchart_tablayout, null); +*/ + View view3; + LayoutInflater inflater3 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view3 = inflater3.inflate(R.layout.pm_themeproject_tablayout, null); + + View view4; + LayoutInflater inflater4 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view4 = inflater4.inflate(R.layout.pm_fundamt_tablayout, null); + + + TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); + tabLayout.addTab(tabLayout.newTab().setCustomView(view1)); + // tabLayout.addTab(tabLayout.newTab().setCustomView(view2)); + tabLayout.addTab(tabLayout.newTab().setCustomView(view3)); + tabLayout.addTab(tabLayout.newTab().setCustomView(view4)); + + TabLayout.Tab selectedTab = tabLayout.getTabAt(0); + View view = selectedTab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.txt_analytictabtitle); + selectedText.setTextColor(Color.parseColor("#000000")); + + + //tabLayout.addTab(tabLayout.newTab().setText("Tab 3")); + //tabLayout.setTabGravity(TabLayout.GRAVITY_FILL); + + final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); + final AnalyticAdapter adapter = new AnalyticAdapter(getSupportFragmentManager(), tabLayout.getTabCount()); + viewPager.setAdapter(adapter); + viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); + tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { + @Override + public void onTabSelected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.txt_analytictabtitle); + selectedText.setTextColor(Color.parseColor("#000000")); + viewPager.setCurrentItem(tab.getPosition()); + } + + @Override + public void onTabUnselected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.txt_analytictabtitle); + selectedText.setTextColor(Color.parseColor("#000000")); + } + + @Override + public void onTabReselected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.txt_analytictabtitle); + selectedText.setTextColor(Color.parseColor("#000000")); + } + }); + + /*img_eventsBack.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + finish(); + } + });*/ + } + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_main, menu); + MenuItem action_editProfile = menu.findItem(R.id.action_editProfile); + action_editProfile.setVisible(false); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + + /* if (id == R.id.action_editProfile) { + Intent ittEventsToEditProfile = new Intent(EventsActivity.this ,EditProfileActivity.class); + startActivity(ittEventsToEditProfile); + return true; + }*/ + + if (id == R.id.action_logout) { + Intent ittEventsToLogin = new Intent(AnalyticChartActivity.this ,LoginActivity.class); + startActivity(ittEventsToLogin); + return true; + } + + if (id == android.R.id.home) { + + if(str_role.equals("Student")) { + Intent ittEventsToStudHome = new Intent(AnalyticChartActivity.this, HomeActivity.class); + startActivity(ittEventsToStudHome); + }else{ + Intent ittEventsToPMHome = new Intent(AnalyticChartActivity.this, PMHomeActivity.class); + startActivity(ittEventsToPMHome); + } + return true; + } + return super.onOptionsItemSelected(item); + } +} diff --git a/app/src/main/java/com/leadcampusapp/AnalyticsTrackers.java b/app/src/main/java/com/leadcampusapp/AnalyticsTrackers.java new file mode 100644 index 0000000..2464774 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/AnalyticsTrackers.java @@ -0,0 +1,69 @@ +package com.leadcampusapp; + +import android.content.Context; + +import com.google.android.gms.analytics.GoogleAnalytics; +import com.google.android.gms.analytics.Tracker; + +import java.util.HashMap; +import java.util.Map; + + + + +import com.leadcampusapp.R; +/* +public class AnalyticsTrackers { +} +*/ +public final class AnalyticsTrackers { + + public enum Target { + APP, + // Add more trackers here if you need, and update the code in #get(Target) below + } + + private static AnalyticsTrackers sInstance; + + public static synchronized void initialize(Context context) { + if (sInstance != null) { + throw new IllegalStateException("Extra call to initialize analytics trackers"); + } + + sInstance = new AnalyticsTrackers(context); + } + + public static synchronized AnalyticsTrackers getInstance() { + if (sInstance == null) { + throw new IllegalStateException("Call initialize() before getInstance()"); + } + + return sInstance; + } + + private final Map mTrackers = new HashMap(); + private final Context mContext; + + /** + * Don't instantiate directly - use {@link #getInstance()} instead. + */ + private AnalyticsTrackers(Context context) { + mContext = context.getApplicationContext(); + } + + public synchronized Tracker get(Target target) { + if (!mTrackers.containsKey(target)) { + Tracker tracker; + switch (target) { + case APP: + tracker = GoogleAnalytics.getInstance(mContext).newTracker(R.xml.app_tracker); + break; + default: + throw new IllegalArgumentException("Unhandled analytics target " + target); + } + mTrackers.put(target, tracker); + } + + return mTrackers.get(target); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/AutoFitGridLayoutManager.java b/app/src/main/java/com/leadcampusapp/AutoFitGridLayoutManager.java new file mode 100644 index 0000000..5e4cddc --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/AutoFitGridLayoutManager.java @@ -0,0 +1,46 @@ +package com.leadcampusapp; + +import android.content.Context; +//import androidx.appcompat.widget.GridLayoutManager; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +/** + * Created by anupamchugh on 05/03/17. + */ + +public class AutoFitGridLayoutManager extends GridLayoutManager { + + private int columnWidth; + private boolean columnWidthChanged = true; + + public AutoFitGridLayoutManager(Context context, int columnWidth) { + super(context, 1); + + setColumnWidth(columnWidth); + } + + + public void setColumnWidth(int newColumnWidth) { + if (newColumnWidth > 0 && newColumnWidth != columnWidth) { + columnWidth = newColumnWidth; + columnWidthChanged = true; + } + } + + @Override + public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) { + if (columnWidthChanged && columnWidth > 0) { + int totalSpace; + if (getOrientation() == VERTICAL) { + totalSpace = getWidth() - getPaddingRight() - getPaddingLeft(); + } else { + totalSpace = getHeight() - getPaddingTop() - getPaddingBottom(); + } + int spanCount = Math.max(1, totalSpace / columnWidth); + setSpanCount(spanCount); + columnWidthChanged = false; + } + super.onLayoutChildren(recycler, state); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/BottomSheetFragment.java b/app/src/main/java/com/leadcampusapp/BottomSheetFragment.java new file mode 100644 index 0000000..9939360 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/BottomSheetFragment.java @@ -0,0 +1,345 @@ +package com.leadcampusapp; + +import android.annotation.SuppressLint; +import android.app.Dialog; +import android.content.Context; +import android.content.Intent; +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.drawable.Drawable; +import android.media.MediaScannerConnection; +import android.net.Uri; +import android.os.Build; +import android.os.Environment; +import androidx.annotation.NonNull; +//import android.support.design.widget.BottomSheetBehavior; +//import android.support.design.widget.BottomSheetDialogFragment; +import androidx.annotation.RequiresApi; +import androidx.coordinatorlayout.widget.CoordinatorLayout; +import androidx.core.content.FileProvider; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.ImageView; +import android.widget.RelativeLayout; +import android.widget.TextView; +import android.widget.Toast; + +import com.google.android.material.bottomsheet.BottomSheetBehavior; +import com.google.android.material.bottomsheet.BottomSheetDialogFragment; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; + +/** + * Created by gurleensethi on 15/01/18. + */ + +@SuppressLint("ValidFragment") +public class BottomSheetFragment extends BottomSheetDialogFragment { + + + TextView btn_readMore1; + ImageView shareit1; + ImageView iv_top; + Context mContext; + RelativeLayout share_images; + String story_blog; + String Story_Type; + public File pictureFile; + File pictureFileDir; + String Story_Video; + private BottomSheetBehavior mBottomSheetBehaviour; + + @SuppressLint("ValidFragment") + public BottomSheetFragment(Context mContext, RelativeLayout share_images, String story_blog, File pictureFile,String Story_Type) { + this.mContext = mContext; + this.share_images = share_images; + this.story_blog = story_blog; + this.pictureFile = pictureFile; + this.Story_Type = Story_Type; + } + + public BottomSheetFragment(Context mContext, RelativeLayout share_images, String story_blog, File pictureFile, String story_type, String story_video) { + this.mContext = mContext; + this.share_images = share_images; + this.story_blog = story_blog; + this.pictureFile = pictureFile; + this.Story_Type = story_type; + this.Story_Video = story_video; + } + + + /*@SuppressLint("ValidFragment") + public BottomSheetFragment(Context mContext, String story_Blog, File pictureFile, RelativeLayout share_images){ + this.mContext=mContext; + story_blog=story_blog; + this.pictureFile=pictureFile; + this.share_images=share_images; + }*/ + + /* public BottomSheetFragment(String story_blog) { + this.story_blog=story_blog; + }*/ + /* @SuppressLint("ValidFragment") + public BottomSheetFragment(String story_blog, File pictureFile) { + // this.Story_Type=Story_Type; + this.story_blog=story_blog; + this.pictureFile=pictureFile; + }*/ + + @SuppressLint("RestrictedApi") + @Override + public void setupDialog + (Dialog dialog, int style) { + super.setupDialog(dialog, style); + + //Set the custom view + View view = LayoutInflater.from(getContext()).inflate(R.layout.fragment_bottom_sheet, null); + dialog.setContentView(view); + + Log.i("tag","story_blog=="+story_blog); + btn_readMore1 = (TextView) view.findViewById(R.id.btn_readMore1); + shareit1=(ImageView) view.findViewById(R.id.shareit1); + iv_top=(ImageView) view.findViewById(R.id.iv_top); + + // btn_readMore1.setVisibility(View.GONE); + + /*btn_readMore1.setTextColor(Color.GRAY); + btn_readMore1.setClickable(false); + btn_readMore1.setFocusable(false);*/ + /* } + else{ + btn_readMore1.setVisibility(View.VISIBLE); + + }*/ + Log.i("tag","Story_Type="+Story_Type); + if(Story_Type.equals("1")){ + btn_readMore1.setVisibility(View.GONE); + }else { + if(story_blog.equals("") || story_blog.equals("anyType{}") || story_blog.equals("null") || story_blog.equals("")) { + btn_readMore1.setVisibility(View.GONE); + } + else { + btn_readMore1.setVisibility(View.VISIBLE); + } + } + + CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) ((View) view.getParent()).getLayoutParams(); + final CoordinatorLayout.Behavior behavior = params.getBehavior(); + + if (behavior != null && behavior instanceof BottomSheetBehavior) { + ((BottomSheetBehavior) behavior).setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() { + @Override + public void onStateChanged(@NonNull View bottomSheet, int newState) { + String state = ""; + + switch (newState) { + case BottomSheetBehavior.STATE_DRAGGING: { + state = "DRAGGING"; + break; + } + case BottomSheetBehavior.STATE_SETTLING: { + state = "SETTLING"; + break; + } + case BottomSheetBehavior.STATE_EXPANDED: { + state = "EXPANDED"; + break; + } + case BottomSheetBehavior.STATE_COLLAPSED: { + state = "COLLAPSED"; + break; + } + case BottomSheetBehavior.STATE_HIDDEN: { + dismiss(); + state = "HIDDEN"; + break; + } + } + + Toast.makeText(getContext(), "Bottom Sheet State Changed to: " + state, Toast.LENGTH_SHORT).show(); + } + + @Override + public void onSlide(@NonNull View bottomSheet, float slideOffset) { + } + }); + } + + + + shareit1.setOnClickListener(new View.OnClickListener() { + @RequiresApi(api = Build.VERSION_CODES.KITKAT) + public void onClick(View v) { + Log.i("TAG", "pictureFile=bottom="+pictureFile); + File file = saveBitMap(mContext, share_images); + if (file != null) { + Log.i("TAG", "Drawing saved to the gallery!"); + } else { + Log.i("TAG", "Oops! Image could not be saved."); + } + if(Story_Type.equals("4")){ + shareVideo(); + }else { + shareImage(); + } + + // state. BottomSheetBehavior.STATE_HIDDEN; + dismiss(); + } + }); + + btn_readMore1.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(story_blog)); + mContext.startActivity(browserIntent); + } + }); + + iv_top.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + //verticalViewPager.setAdapter(new VerticlePagerAdapter(getActivity(), LeadStoryList.listview_arr)); + + //verticalViewPager.setPageTransformer(true, new VerticalPageTransformerAnimate()); + //verticalViewPager.setCurrentItem(0); + LeadStoryFragment.verticalFunction(); + // mBottomSheetBehaviour.setState(BottomSheetBehavior.STATE_COLLAPSED); + dismiss(); + } + }); + } + @RequiresApi(api = Build.VERSION_CODES.KITKAT) + public File saveBitMap(Context context, View drawView){ + pictureFileDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS),"Logicchip"); + if (!pictureFileDir.exists()) { + boolean isDirectoryCreated = pictureFileDir.mkdirs(); + if(!isDirectoryCreated) + Log.i("TAG", "Can't create directory to save the image"); + return null; + } + String filename = pictureFileDir.getPath() + File.separator+ System.currentTimeMillis()+".jpg"; + pictureFile = new File(filename); + Bitmap bitmap =getBitmapFromView(drawView); + try { + pictureFile.createNewFile(); + FileOutputStream oStream = new FileOutputStream(pictureFile); + bitmap.compress(Bitmap.CompressFormat.PNG, 100, oStream); + oStream.flush(); + oStream.close(); + } catch (IOException e) { + e.printStackTrace(); + Log.i("TAG", "There was an issue saving the image."); + } + scanGallery( context,pictureFile.getAbsolutePath()); + Log.i("tag","pictureFile="+pictureFile); + return pictureFile; + } + private void scanGallery(Context cntx, String path) { + try { + MediaScannerConnection.scanFile(cntx, new String[]{path}, null, new MediaScannerConnection.OnScanCompletedListener() { + public void onScanCompleted(String path, Uri uri) { + } + }); + } catch (Exception e) { + e.printStackTrace(); + Log.i("TAG", "There was an issue scanning gallery."); + } + } + private Bitmap getBitmapFromView(View view) { + //Define a bitmap with the same size as the view + Bitmap returnedBitmap; + if(Build.VERSION.SDK_INT == Build.VERSION_CODES.M){ + returnedBitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(),Bitmap.Config.ARGB_8888); + }else if(Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP){ + returnedBitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(),Bitmap.Config.ARGB_8888); + }else if(Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP_MR1){ + returnedBitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(),Bitmap.Config.ARGB_8888); + }else { + returnedBitmap = Bitmap.createBitmap(1080, 1500, Bitmap.Config.ARGB_8888); + } + //Bind a canvas to it + Canvas canvas = new Canvas(returnedBitmap); + //Get the view's background + Drawable bgDrawable =view.getBackground(); + if (bgDrawable!=null) { + //has background drawable, then draw it on the canvas + bgDrawable.draw(canvas); + } else{ + //does not have background drawable, then draw white background on the canvas + canvas.drawColor(Color.WHITE); + } + // draw the view on the canvas + view.draw(canvas); + //return the bitmap + return returnedBitmap; + } + + /* private Bitmap getBitmapFromView(View view) { + //Define a bitmap with the same size as the view + Bitmap returnedBitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888); + //Bind a canvas to it + Canvas canvas = new Canvas(returnedBitmap); + //Get the view's background + Drawable bgDrawable =view.getBackground(); + if (bgDrawable!=null) { + //has background drawable, then draw it on the canvas + bgDrawable.draw(canvas); + } else{ + //does not have background drawable, then draw white background on the canvas + canvas.drawColor(Color.WHITE); + } + // draw the view on the canvas + view.draw(canvas); + //return the bitmap + return returnedBitmap; + } +*/ + public void shareVideo() { + Intent share = new Intent(Intent.ACTION_SEND); + share.setType("image/*"); + + String imagePath= pictureFile.getAbsolutePath(); + Log.i("tag","pictureFile="+imagePath); + File imageFileToShare = new File(imagePath); + + //Uri uri = Uri.fromFile(pictureFile); + Uri uri = FileProvider.getUriForFile(getContext(), "com.mydomain.fileprovider", pictureFile); + share.putExtra(android.content.Intent.EXTRA_SUBJECT, "Leader Story"); + share.putExtra(Intent.EXTRA_TEXT,"http://www.youtube.com/embed/"+Story_Video); + share.putExtra(Intent.EXTRA_STREAM, uri); + + startActivity(Intent.createChooser(share, "Share Image!")); + // File fdelete = new File(imagePath); + // if (pictureFileDir.exists()) { + + //} + } + public void shareImage() { + Intent share = new Intent(Intent.ACTION_SEND); + share.setType("image/*"); + + String imagePath= pictureFile.getAbsolutePath(); + Log.i("tag","pictureFile="+imagePath); + File imageFileToShare = new File(imagePath); + + // Uri uri = Uri.fromFile(pictureFile); + Uri uri = FileProvider.getUriForFile(getContext(), "com.mydomain.fileprovider", pictureFile); + share.putExtra(android.content.Intent.EXTRA_SUBJECT, "Leader Story"); + // share.putExtra(Intent.EXTRA_TEXT,"http://www.youtube.com/embed/"+story_blog); + share.putExtra(Intent.EXTRA_STREAM, uri); + + startActivity(Intent.createChooser(share, "Share Image!")); + // File fdelete = new File(imagePath); + // if (pictureFileDir.exists()) { + + //} + } + /* public void show(FragmentManager supportFragmentManager, String tag, String story_blog) { + Log.i("tag","story_blog"+story_blog); + }*/ +} diff --git a/app/src/main/java/com/leadcampusapp/ChartFundAmtCountFragment.java b/app/src/main/java/com/leadcampusapp/ChartFundAmtCountFragment.java new file mode 100644 index 0000000..9c9d3d5 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ChartFundAmtCountFragment.java @@ -0,0 +1,641 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 20-07-2018. + */ + +import android.annotation.SuppressLint; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.SharedPreferences; +import android.graphics.Color; +import android.os.AsyncTask; +import android.os.Bundle; +import androidx.fragment.app.Fragment; +import androidx.core.content.ContextCompat; +import androidx.appcompat.widget.AppCompatSpinner; + +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; + +//import com.android.sripad.leadnew_22_6_2018.R; +import com.github.mikephil.charting.charts.BarChart; +import com.github.mikephil.charting.charts.PieChart; +import com.github.mikephil.charting.components.Legend; +import com.github.mikephil.charting.components.XAxis; +import com.github.mikephil.charting.components.YAxis; +import com.github.mikephil.charting.data.BarData; +import com.github.mikephil.charting.data.BarDataSet; +import com.github.mikephil.charting.data.BarEntry; +import com.github.mikephil.charting.data.Entry; +import com.github.mikephil.charting.data.PieData; +import com.github.mikephil.charting.data.PieDataSet; +import com.github.mikephil.charting.formatter.PercentFormatter; +import com.github.mikephil.charting.utils.ColorTemplate; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.util.ArrayList; +import java.util.HashMap; + +public class ChartFundAmtCountFragment extends Fragment +{ + + private ArrayList listThemeName; + private ArrayList listCount; + + public static final String PREFBook_PM= "prefbook_pm"; //sharedpreference Book + public static final String PrefID_PMID = "prefid_pmid"; // + SharedPreferences shardprefPM_obj; + String str_MangerID; + Integer MDId; + BarChart barChart; + String AcademicYear; + private HashMap mapYearCode; + AppCompatSpinner sandbox_spin,year_spin; + PieChart pieChart; + String str_Status=null,str_fundriserdamount=null,str_Counts=null,str_SanctionAmount,str_fundRelised,str_AcademicCode; + + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + + View view=inflater.inflate(R.layout.activity_pm_fundamt_count, container, false); + listThemeName = new ArrayList(); + listCount = new ArrayList(); + + shardprefPM_obj= getActivity().getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MangerID = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + Log.d("str_MDId:",str_MangerID); + // Toast.makeText(this,"LeadId: "+str_MangerID,Toast.LENGTH_LONG).show(); + MDId=Integer.parseInt(str_MangerID); + + barChart = (BarChart) view.findViewById(R.id.piechart); + + /* pieChart = (PieChart) view.findViewById(R.id.piechart); + pieChart.setUsePercentValues(true);*/ + + year_spin=(AppCompatSpinner) view.findViewById(R.id.spin_year); + mapYearCode = new HashMap(); + initializeSpinnerYear(); + + year_spin.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView parent, View view, int position, long id) { + AcademicYear = year_spin.getSelectedItem().toString(); + + if(AcademicYear!="Select Year"){ + GetFundAmtCount getFundAmtCount = new GetFundAmtCount(getActivity()); + getFundAmtCount.execute(); + } + } + + @Override + public void onNothingSelected(AdapterView parent) { + + } + }); + + // GetFundAmtCount getFundAmtCount = new GetFundAmtCount(getActivity()); + // getFundAmtCount.execute(); + + return view; + } + + @SuppressLint("RestrictedApi") + private void initializeSpinnerYear() { + final ArrayList listYear = new ArrayList(); + + // listYear.add("Select Year"); + listYear.add("2018-2019"); + listYear.add("2017-2018"); + listYear.add("2016-2017"); + listYear.add("2015-2016"); + listYear.add("2014-2015"); + listYear.add("Below 2014"); + + mapYearCode.put("Below 2014",0); + mapYearCode.put("2014-2015",1); + mapYearCode.put("2015-2016",2); + mapYearCode.put("2016-2017",3); + mapYearCode.put("2017-2018",4); + mapYearCode.put("2018-2019",5); + + ArrayAdapter dataAdapterListYear = new ArrayAdapter(getContext(), R.layout.simple_spinner_items, listYear); + dataAdapterListYear.setDropDownViewResource(R.layout.spinnercustomstyle); + + year_spin.setAdapter(dataAdapterListYear); + year_spin.setSupportBackgroundTintList(ContextCompat.getColorStateList(getContext(), R.color.colorBlack)); + + } + + public class GetFundAmtCount extends AsyncTask { + + Context context; + //AlertDialog alertDialog; + private ProgressDialog progressDialog; + + //private ProgressBar progressBar; + + GetFundAmtCount (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String str_leadId = (String) params [0]; + //String versionCode = (String) params[2]; + + SoapObject response = getFundAmtCount(); + + //Log.d("GetThemeWiseProjCout",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + + progressDialog.setMessage("Loading"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + + } + + @Override + protected void onPostExecute(SoapObject result) { + + Log.d("GetFundAmt resp",result.toString()); + + SoapPrimitive S_Status,S_ThemeName,S_Counts,S_fundriserdamount,S_SanctionAmount,S_fundRelised,S_AcademicCode; + Object O_Status,O_ThemeName,O_Counts,O_fundriserdamount,O_SanctionAmount,O_fundRelised,O_AcademicCode; + + for(int i=0;i < result.getPropertyCount();i++) { + SoapObject list = (SoapObject) result.getProperty(i); + + Log.d("finalStringssssss",list.toString()); + SoapPrimitive indivisualObject = (SoapPrimitive) list.getProperty("Status"); + + O_Status = list.getProperty("Status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) list.getProperty("Status"); + Log.d("Status:", S_Status.toString()); + str_Status = S_Status.toString(); + } + + + if(str_Status.equalsIgnoreCase("Success")) { + O_AcademicCode = list.getProperty("AcademicCode"); + if (!O_AcademicCode.toString().equals("anyType{}") && !O_AcademicCode.toString().equals(null)) { + S_AcademicCode = (SoapPrimitive) list.getProperty("AcademicCode"); + Log.d("S_AcademicCode", S_AcademicCode.toString()); + str_AcademicCode = S_AcademicCode.toString(); + } + int yearId = mapYearCode.get(AcademicYear); + if(str_AcademicCode.equals(String.valueOf(yearId))){ + O_fundriserdamount = list.getProperty("fundriserdamount"); + if (!O_fundriserdamount.toString().equals("anyType{}") && !O_fundriserdamount.toString().equals(null)) { + S_fundriserdamount = (SoapPrimitive) list.getProperty("fundriserdamount"); + Log.d("S_fundriserdamount", S_fundriserdamount.toString()); + str_fundriserdamount = S_fundriserdamount.toString(); + } + + O_SanctionAmount = list.getProperty("SanctionAmount"); + if (!O_SanctionAmount.toString().equals("anyType{}") && !O_SanctionAmount.toString().equals(null)) { + S_SanctionAmount = (SoapPrimitive) list.getProperty("SanctionAmount"); + Log.d("SanctionAmount", S_SanctionAmount.toString()); + str_SanctionAmount = S_SanctionAmount.toString(); + } + + O_fundRelised = list.getProperty("fundRelised"); + if (!O_fundRelised.toString().equals("anyType{}") && !O_fundRelised.toString().equals(null)) { + S_fundRelised = (SoapPrimitive) list.getProperty("fundRelised"); + Log.d("fundRelised", S_fundRelised.toString()); + str_fundRelised = S_fundRelised.toString(); + } + + } + + + + /* if (str_ThemeName != null && !str_ThemeName.isEmpty() && str_ThemeName != "" && !str_ThemeName.equals("anyType{}") && str_ThemeName != "{}") { + //txt.setText(str_ThemeName); + Log.d("ThemeNameIsss",str_ThemeName); + listThemeName.add(str_ThemeName); + } +*/ + /* if (str_Counts != null && !str_Counts.isEmpty() && str_Counts != "" && !str_Counts.equals("anyType{}") && str_Counts != "{}") { + //txt.setText(str_ThemeName); + Log.d("Countssissss",str_Counts); + listCount.add(str_Counts); + }*/ + + /* if (str_StudCollegeName != null && !str_StudCollegeName.isEmpty() && str_StudCollegeName != "" && !str_StudCollegeName.equals("anyType{}") && str_StudCollegeName != "{}") { + txt_studCollegeName.setText(str_StudCollegeName); + } + + if (str_StudLeadId != null && !str_StudLeadId.isEmpty() && str_StudLeadId != "" && !str_StudLeadId.equals("anyType{}") && str_StudLeadId != "{}") { + txt_leadId.setText(str_StudLeadId); + } + + if (str_StudType != null && !str_StudType.isEmpty() && str_StudType != "" && !str_StudType.equals("anyType{}") && str_StudType != "{}") { + txt_studType.setText(str_StudType); + } +*/ + } + + } + + // multiBarchartsInOne(); + // pieChartFunction(); + newbarchart(); + progressDialog.dismiss(); + + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapObject getFundAmtCount() + { + + String METHOD_NAME = "GetFundamountYearwise"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetFundamountYearwise"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + request.addProperty("ManagerId", MDId); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + Log.d("soap responseyyyyyyy",envelope.getResponse().toString()); + SoapObject response = (SoapObject) envelope.getResponse(); + Log.d("soap responseyyyyyyy",response.toString()); + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.d("exception outside",t.getMessage().toString()); + } + return null; + + + } + + private void pieChartFunction(){ + + Float AcademicCode_float= Float.valueOf(str_AcademicCode).floatValue(); + Float fundriserdamount_float= Float.valueOf(str_fundriserdamount).floatValue(); + Float fundRelised_float= Float.valueOf(str_fundRelised).floatValue(); + Float SanctionAmount_float= Float.valueOf(str_SanctionAmount).floatValue(); + + ArrayList yvalues2 = new ArrayList(); + ArrayList xVals2 = new ArrayList(); + + if(fundriserdamount_float!=0) { + yvalues2.add(new Entry(fundriserdamount_float, 0)); + } + if(fundRelised_float!=0) { + yvalues2.add(new Entry(fundRelised_float, 1)); + } + if(SanctionAmount_float!=0) { + yvalues2.add(new Entry(SanctionAmount_float, 2)); + } + /*if(Not_Assigned_Per_float!=0) { + yvalues2.add(new Entry(Not_Assigned_Per_float, 3)); + }*/ + + + // PieDataSet dataSet2 = new PieDataSet(yvalues2, ""); + // pieChart.getDescription().setEnabled(false); + + xVals2.add("Fund Raised"); + xVals2.add("Fund Released"); + xVals2.add("Approved Amount"); + // xVals2.add("Not_Assigned_Per"); + + // pieChart.setEntryLabelColor(Color.BLACK); + PieDataSet dataSet = new PieDataSet(yvalues2, ""); + + final int[] MY_COLORS = {Color.rgb(45, 170, 165), Color.rgb(198, 53, 53), Color.rgb(243, 200, 61), + Color.rgb(45, 170, 165), Color.rgb(146,208,80), Color.rgb(0,176,80), Color.rgb(79,129,189)}; + ArrayList colors = new ArrayList(); + + for(int c: MY_COLORS) colors.add(c); + + /* ArrayList colors = new ArrayList(); + + for (int c : ColorTemplate.VORDIPLOM_COLORS) + colors.add(c); + + for (int c : ColorTemplate.JOYFUL_COLORS) + colors.add(c); + + for (int c : ColorTemplate.COLORFUL_COLORS) + colors.add(c); + + for (int c : ColorTemplate.LIBERTY_COLORS) + colors.add(c); + + for (int c : ColorTemplate.PASTEL_COLORS) + colors.add(c);*/ + + // colors.add(ColorTemplate.getHoloBlue()); + + dataSet.setColors(colors); + + PieData data = new PieData(xVals2,dataSet); + // In Percentage term + data.setValueFormatter(new PercentFormatter()); + // Default value + //data.setValueFormatter(new DefaultValueFormatter(0)); + pieChart.setData(data); + /* pieChart.setDescription("Student and College Counts"); + pieChart.setDescriptionColor(Color.WHITE); + pieChart.setDescriptionPosition(450,100); + pieChart.setDescriptionTextSize(20f);*/ + pieChart.getLegend().setTextColor(Color.BLACK); + pieChart.setDrawHoleEnabled(true); + pieChart.setTransparentCircleRadius(25f); + pieChart.setHoleRadius(25f); + pieChart.setDrawSliceText(false); + // dataSet.setColors(ColorTemplate.JOYFUL_COLORS); + data.setValueTextSize(10f); + data.setValueTextColor(Color.DKGRAY); + pieChart.setDescriptionColor(Color.WHITE); + + // pieChart.setOnChartValueSelectedListener(this); + + pieChart.animateXY(1400, 1400); + + } + private void multiBarchartsInOne() { + // create BarEntry for Bar Group 1 +/* HorizontalBarChart barChart = (HorizontalBarChart) findViewById(R.id.barchart); + + ArrayList bargroup1 = new ArrayList<>(); + bargroup1.add(new BarEntry(8f, 0)); + bargroup1.add(new BarEntry(2f, 1)); + bargroup1.add(new BarEntry(5f, 2)); + bargroup1.add(new BarEntry(20f, 3)); + bargroup1.add(new BarEntry(15f, 4)); + bargroup1.add(new BarEntry(19f, 5)); + +// create BarEntry for Bar Group 1 + ArrayList bargroup2 = new ArrayList<>(); + bargroup2.add(new BarEntry(6f, 0)); + bargroup2.add(new BarEntry(10f, 1)); + bargroup2.add(new BarEntry(5f, 2)); + bargroup2.add(new BarEntry(25f, 3)); + bargroup2.add(new BarEntry(4f, 4)); + bargroup2.add(new BarEntry(17f, 5)); + +// creating dataset for Bar Group1 + BarDataSet barDataSet1 = new BarDataSet(bargroup1, "Bar Group 1"); + +//barDataSet1.setColor(Color.rgb(0, 155, 0)); + barDataSet1.setColors(ColorTemplate.COLORFUL_COLORS); + +// creating dataset for Bar Group 2 + BarDataSet barDataSet2 = new BarDataSet(bargroup2, "Bar Group 2"); + barDataSet2.setColors(ColorTemplate.COLORFUL_COLORS); + + List dataSets = new ArrayList<>(); // combined all dataset into an arraylist + dataSets.add(barDataSet1); + dataSets.add(barDataSet2); + + + + + + + + //BarDataSet bardataset = new BarDataSet(entries, "Cells"); + + ArrayList labels = new ArrayList(); + labels.add("2016"); + labels.add("2015"); + labels.add("2014"); + labels.add("2013"); + labels.add("2012"); + labels.add("2011"); + labels.add("2010"); + labels.add("2009"); + labels.add("2008"); + labels.add("2007"); + labels.add("2006"); + labels.add("2005"); + labels.add("2004"); + labels.add("2003"); + + + //BarData data = new BarData(labels,dataSets); + BarData data = new BarData(labels,dataSets); + barChart.setData(data); // set the data and list of lables into chart + + barChart.setDescription("Set Bar Chart Description"); // set the description + + //bardataset.setColors(ColorTemplate.COLORFUL_COLORS); + + barChart.animateY(5000);*/ + + + + + + //HorizontalBarChart barChart = (HorizontalBarChart) findViewById(R.id.barchart); + + ArrayList entries = new ArrayList<>(); + + + for(int k=0;k labels = new ArrayList(); + labels.add("2016"); + labels.add("2015"); + labels.add("2014"); + labels.add("2013"); + labels.add("2012"); + labels.add("2011"); + + // barChart.getXAxis().setValueFormatter(new IndexAxisValueFormatter(labels)); + // XAxis xAxis = barChart.getXAxis(); + // xAxis.setValueFormatter(new IndexAxisValueFormatter(labels)); + + String[] arrString = new String[listThemeName.size()]; + + for(int l=0;l colors = new ArrayList(); + + for(int c: MY_COLORS) colors.add(c); + + bardataset.setColors(colors); + + + Legend legend = barChart.getLegend(); + legend.setEnabled(false); + legend.setPosition(Legend.LegendPosition.BELOW_CHART_CENTER); + legend.setForm(Legend.LegendForm.SQUARE); + /* legend.setColors(colors); + legend.setLabels(labels);*/ + + barChart.setDescription(null); + XAxis xLabels = barChart.getXAxis(); + // xLabels.setPosition(XAxis.XAxisPosition.BOTTOM_INSIDE); + xLabels.setTextColor(Color.BLACK); + YAxis yLabels = (YAxis) barChart.getAxisLeft(); + yLabels.setTextColor(Color.BLACK); + + YAxis yLabels1 = (YAxis) barChart.getAxisRight(); + yLabels1.setTextColor(Color.BLACK); + // xLabels.setLabelRotationAngle(-30f); + + barChart.setDescriptionColor(Color.WHITE); + + barChart.animateY(3000); + + } + +}//end of fragment class diff --git a/app/src/main/java/com/leadcampusapp/ChartProjectCountFragment.java b/app/src/main/java/com/leadcampusapp/ChartProjectCountFragment.java new file mode 100644 index 0000000..dea8cee --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ChartProjectCountFragment.java @@ -0,0 +1,574 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 20-07-2018. + */ + +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.graphics.Color; +import android.os.AsyncTask; +import android.os.Bundle; +import androidx.fragment.app.Fragment; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +//import com.android.sripad.leadnew_22_6_2018.R; +import com.github.mikephil.charting.charts.BarChart; +import com.github.mikephil.charting.charts.PieChart; +import com.github.mikephil.charting.components.Legend; +import com.github.mikephil.charting.components.XAxis; +import com.github.mikephil.charting.components.YAxis; +import com.github.mikephil.charting.data.BarData; +import com.github.mikephil.charting.data.BarDataSet; +import com.github.mikephil.charting.data.BarEntry; +import com.github.mikephil.charting.data.Entry; +import com.github.mikephil.charting.data.PieData; +import com.github.mikephil.charting.data.PieDataSet; +import com.github.mikephil.charting.formatter.PercentFormatter; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.util.ArrayList; + +public class ChartProjectCountFragment extends Fragment //implements OnChartValueSelectedListener +{ + + int count=0; + Integer MDId; + SharedPreferences shardprefPM_obj; + public static final String PREFBook_PM= "prefbook_pm"; //sharedpreference Book + public static final String PrefID_PMID = "prefid_pmid"; + String str_MangerID; + PieChart pieChart; + + String str_responsecount,str_responseStatus,str_studentcount,str_collegecount; + String ApprovedCount="0",ComplitedCount="0",UnapprovedCount="0",RequestForCompletion="0",Rejected="0",RequestForModification="0"; + + public static final String PREFBook_PM_Count= "prefbook_pm_count"; //sharedpreference Book + public static final String PrefID_UNCount = "prefid_UNCount"; // + public static final String PrefID_ComCount = "prefid_ComCount"; // + public static final String PrefID_AppCount = "prefid_AppCount"; // + public static final String PrefID_ReqModCount = "prefid_ReqModCount"; // + public static final String PrefID_RejCount = "prefid_RejCount"; // + public static final String PrefID_ReqComCount = "prefid_ReqComCount"; // + + SharedPreferences shardprefPM_obj_count; + SharedPreferences.Editor editor_PM_count; + BarChart barChart; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + + View view=inflater.inflate(R.layout.frag_project_countchart, container, false); + Intent intent = getActivity().getIntent(); + + // barChart = (BarChart) view.findViewById(R.id.piechart); + + shardprefPM_obj= getActivity().getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MangerID = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + Log.d("str_leadId:",str_MangerID); + // Toast.makeText(this,"LeadId: "+str_MangerID,Toast.LENGTH_LONG).show(); + MDId=Integer.parseInt(str_MangerID); + + shardprefPM_obj_count=getActivity().getSharedPreferences(PREFBook_PM_Count, Context.MODE_PRIVATE); + + shardprefPM_obj_count.getString(PrefID_AppCount, "").trim(); + ApprovedCount = shardprefPM_obj_count.getString(PrefID_AppCount, "").trim(); + Log.d("ApprovedCount:",ApprovedCount); + + shardprefPM_obj_count.getString(PrefID_UNCount, "").trim(); + UnapprovedCount = shardprefPM_obj_count.getString(PrefID_UNCount, "").trim(); + Log.d("ApprovedCount:",UnapprovedCount); + + shardprefPM_obj_count.getString(PrefID_RejCount, "").trim(); + Rejected = shardprefPM_obj_count.getString(PrefID_RejCount, "").trim(); + Log.d("ApprovedCount:",Rejected); + + shardprefPM_obj_count.getString(PrefID_ReqComCount, "").trim(); + RequestForCompletion = shardprefPM_obj_count.getString(PrefID_ReqComCount, "").trim(); + Log.d("RequestForCompletion:",RequestForCompletion); + + shardprefPM_obj_count.getString(PrefID_ReqModCount, "").trim(); + RequestForModification = shardprefPM_obj_count.getString(PrefID_ReqModCount, "").trim(); + Log.d("PrefID_ReqModCount:",RequestForModification); + + shardprefPM_obj_count.getString(PrefID_ComCount, "").trim(); + ComplitedCount = shardprefPM_obj_count.getString(PrefID_ComCount, "").trim(); + Log.d("PrefID_ComCount:",ComplitedCount); + + /*String UnapprovedCount=intent.getStringExtra("UnapprovedCount"); + String ComplitedCount=intent.getStringExtra("ComplitedCount"); + String ApprovedCount=intent.getStringExtra("ApprovedCount"); + String RequestForCompletion=intent.getStringExtra("RequestForCompletion"); + String RequestForModification=intent.getStringExtra("RequestForModification"); + String Rejected=intent.getStringExtra("Rejected"); + String str_studentcount=intent.getStringExtra("str_studentcount"); + String str_collegecount=intent.getStringExtra("str_collegecount");*/ + + pieChart = (PieChart) view.findViewById(R.id.piechart); + pieChart.setUsePercentValues(true); + + Log.i("tag","UnapprovedCount"+UnapprovedCount); + + + /* ArrayList yvalues = new ArrayList(); + ArrayList xVals = new ArrayList(); + + + if(unapproved_float!=0) { + yvalues.add(new Entry(unapproved_float, 0)); + xVals.add("Proposed"); + } + if(approved_float!=0) { + yvalues.add(new Entry(approved_float, 2)); + xVals.add("Approved"); + } + if(complited_float!=0) { + yvalues.add(new Entry(complited_float, 1)); + xVals.add("Completed"); + } + if(rejected_float!=0) { + yvalues.add(new Entry(rejected_float, 5)); + xVals.add("Rejected"); + } + if(requestforcomplition_float!=0) { + yvalues.add(new Entry(requestforcomplition_float, 3)); + xVals.add("Completion"); + } + if(requestformodification_float!=0) { + yvalues.add(new Entry(requestformodification_float, 4)); + xVals.add("Modification"); + } +*/ + + + + + /* PieDataSet dataSet = new PieDataSet(yvalues, ""); + PieData data = new PieData(xVals,dataSet); + + data.setValueFormatter(new DefaultValueFormatter(1));*/ + // Default value + //data.setValueFormatter(new DefaultValueFormatter(0)); + + /* Log.i("tag","data="+data.toString()+pieChart.getData()); + pieChart.getData(); + pieChart.setData(data); + pieChart.setDescription("Project Counts"); + pieChart.setDescriptionColor(Color.WHITE); + pieChart.setDescriptionPosition(450,100); + pieChart.setDescriptionTextSize(20f); + pieChart.getLegend().setTextColor(Color.BLACK); + pieChart.setDrawHoleEnabled(true); + pieChart.setTransparentCircleRadius(25f); + pieChart.setHoleRadius(25f); + pieChart.setDrawSliceText(false); + final int[] MY_COLORS = {Color.rgb(229, 154, 29),Color.rgb(243, 200, 61), Color.rgb(144, 193, 51),Color.rgb(198, 53, 53), Color.rgb( 255, 0, 128), + Color.rgb(45, 170, 165), Color.rgb(127, 0, 255), Color.rgb(185, 98, 237)}; + ArrayList colors = new ArrayList(); + + for(int c: MY_COLORS) colors.add(c); + dataSet.setColors(colors); + + // dataSet.setColors(ColorTemplate.JOYFUL_COLORS); + data.setValueTextSize(10f); + data.setValueTextColor(Color.DKGRAY); + pieChart.setClickable(false);*/ + + // pieChart.setOnChartValueSelectedListener(this); + + // pieChart.animateXY(1400, 1400); + + // showActivity(); + pieChartFunction(); + // newbarchart(); + return view; + } + private void newbarchart(){ + + Float unapproved_float=Float.valueOf(UnapprovedCount).floatValue(); + Float complited_float=Float.valueOf(ComplitedCount).floatValue(); + Float approved_float=Float.valueOf(ApprovedCount).floatValue(); + Float requestforcomplition_float=Float.valueOf(RequestForCompletion).floatValue(); + Float requestformodification_float=Float.valueOf(RequestForModification).floatValue(); + Float rejected_float=Float.valueOf(Rejected).floatValue(); + + + ArrayList entries = new ArrayList<>(); + if(unapproved_float!=0) { + entries.add(new BarEntry(unapproved_float, 0)); + } + if(approved_float!=0) { + entries.add(new BarEntry(approved_float, 1)); + } + if(complited_float!=0) { + entries.add(new BarEntry(complited_float, 2)); + } + if(rejected_float!=0) { + entries.add(new BarEntry(rejected_float, 3)); + } + if(requestforcomplition_float!=0) { + entries.add(new BarEntry(requestforcomplition_float, 4)); + } + if(requestformodification_float!=0) { + entries.add(new BarEntry(requestformodification_float, 5)); + } + /*entries.add(new BarEntry(20f, 3)); + entries.add(new BarEntry(15f, 4)); + entries.add(new BarEntry(19f, 5));*/ + + /* for(int k=0;k labels = new ArrayList(); + if(unapproved_float!=0) { + labels.add("Proposed"); + } + if(approved_float!=0) { + labels.add("Approved"); + } + if(complited_float!=0) { + labels.add("Completed"); + } + if(rejected_float!=0) { + labels.add("Rejected"); + } + if(requestforcomplition_float!=0) { + labels.add("Completion"); + } + if(requestformodification_float!=0) { + labels.add("Modification"); + } + + BarDataSet bardataset = new BarDataSet(entries, null); + + + /* labels.add("2013"); + labels.add("2012"); + labels.add("2011");*/ + + + BarData data1 = new BarData(labels, bardataset); + barChart.setData(data1); // set the data and list of lables into chart + + + // barChart.setDescription(""); // set the description + final int[] MY_COLORS = {Color.rgb(229, 154, 29),Color.rgb(243, 200, 61), Color.rgb(144, 193, 51),Color.rgb(198, 53, 53), Color.rgb( 255, 0, 128), + Color.rgb(45, 170, 165), Color.rgb(127, 0, 255), Color.rgb(185, 98, 237)}; + ArrayList colors = new ArrayList(); + + for(int c: MY_COLORS) colors.add(c); + + bardataset.setColors(colors); + + + Legend legend = barChart.getLegend(); + legend.setEnabled(false); + legend.setPosition(Legend.LegendPosition.BELOW_CHART_CENTER); + legend.setForm(Legend.LegendForm.SQUARE); + /* legend.setColors(colors); + legend.setLabels(labels);*/ + + barChart.setDescription(null); + XAxis xLabels = barChart.getXAxis(); + // xLabels.setPosition(XAxis.XAxisPosition.BOTTOM_INSIDE); + xLabels.setTextColor(Color.BLACK); + xLabels.setPosition(XAxis.XAxisPosition.BOTTOM); + xLabels.setDrawLabels(true); + // barChart.getXAxis().setAxisMinValue(6); + // barChart.getXAxis().setAxisMaxValue(6); + xLabels.setValues(labels); + YAxis yLabels = (YAxis) barChart.getAxisLeft(); + yLabels.setTextColor(Color.BLACK); + + YAxis yLabels1 = (YAxis) barChart.getAxisRight(); + yLabels1.setTextColor(Color.BLACK); + // xLabels.setLabelRotationAngle(-30f); + + barChart.setDescriptionColor(Color.WHITE); +barChart.getXAxis().setAxisMaxValue(6); + barChart.animateY(3000); + + } + + private void pieChartFunction(){ + + Float unapproved_float=Float.valueOf(UnapprovedCount).floatValue(); + Float complited_float=Float.valueOf(ComplitedCount).floatValue(); + Float approved_float=Float.valueOf(ApprovedCount).floatValue(); + Float requestforcomplition_float=Float.valueOf(RequestForCompletion).floatValue(); + Float requestformodification_float=Float.valueOf(RequestForModification).floatValue(); + Float rejected_float=Float.valueOf(Rejected).floatValue(); + + Log.i("tag","Proposed="+unapproved_float+"complited_float="+complited_float); + Log.i("tag","approved_float="+approved_float+"requestforcomplition_float="+requestforcomplition_float); + Log.i("tag","requestformodification_float="+requestformodification_float+"rejected_float="+rejected_float); + + ArrayList yvalues2 = new ArrayList(); + ArrayList xVals2 = new ArrayList(); + + if(unapproved_float!=0) { + yvalues2.add(new Entry(unapproved_float, 0)); + } + if(approved_float!=0) { + yvalues2.add(new Entry(approved_float, 1)); + } + if(complited_float!=0) { + yvalues2.add(new Entry(complited_float, 2)); + } + if(rejected_float!=0) { + yvalues2.add(new Entry(rejected_float, 3)); + } + if(requestforcomplition_float!=0) { + yvalues2.add(new Entry(requestforcomplition_float, 4)); + } + if(requestformodification_float!=0) { + yvalues2.add(new Entry(requestformodification_float, 5)); + } + + /*if(Not_Assigned_Per_float!=0) { + yvalues2.add(new Entry(Not_Assigned_Per_float, 3)); + }*/ + + + // PieDataSet dataSet2 = new PieDataSet(yvalues2, ""); + // pieChart.getDescription().setEnabled(false); + + xVals2.add("Proposed"); + xVals2.add("Approved"); + xVals2.add("Completed"); + xVals2.add("Rejected"); + xVals2.add("Completion"); + xVals2.add("Modification"); + // xVals2.add("Not_Assigned_Per"); + + // pieChart.setEntryLabelColor(Color.BLACK); + PieDataSet dataSet = new PieDataSet(yvalues2, ""); + + final int[] MY_COLORS = {Color.rgb(229, 154, 29),Color.rgb(243, 200, 61), Color.rgb(144, 193, 51),Color.rgb(198, 53, 53), Color.rgb( 255, 0, 128), + Color.rgb(45, 170, 165), Color.rgb(127, 0, 255), Color.rgb(185, 98, 237)}; + ArrayList colors = new ArrayList(); + + for(int c: MY_COLORS) colors.add(c); + + /* ArrayList colors = new ArrayList(); + + for (int c : ColorTemplate.VORDIPLOM_COLORS) + colors.add(c); + + for (int c : ColorTemplate.JOYFUL_COLORS) + colors.add(c); + + for (int c : ColorTemplate.COLORFUL_COLORS) + colors.add(c); + + for (int c : ColorTemplate.LIBERTY_COLORS) + colors.add(c); + + for (int c : ColorTemplate.PASTEL_COLORS) + colors.add(c);*/ + + // colors.add(ColorTemplate.getHoloBlue()); + + dataSet.setColors(colors); + + PieData data = new PieData(xVals2,dataSet); + // In Percentage term + data.setValueFormatter(new PercentFormatter()); + // Default value + //data.setValueFormatter(new DefaultValueFormatter(0)); + pieChart.setData(data); + /* pieChart.setDescription("Student and College Counts"); + pieChart.setDescriptionColor(Color.WHITE); + pieChart.setDescriptionPosition(450,100); + pieChart.setDescriptionTextSize(20f);*/ + pieChart.getLegend().setTextColor(Color.BLACK); + pieChart.setDrawHoleEnabled(true); + pieChart.setTransparentCircleRadius(25f); + pieChart.setHoleRadius(25f); + pieChart.setDrawSliceText(false); + // dataSet.setColors(ColorTemplate.JOYFUL_COLORS); + data.setValueTextSize(10f); + data.setValueTextColor(Color.DKGRAY); + pieChart.setDescriptionColor(Color.WHITE); + + // pieChart.setOnChartValueSelectedListener(this); + + pieChart.animateXY(1400, 1400); + + } + + /* @Override + public void onValueSelected(Entry e, int dataSetIndex, Highlight h) { + if (e == null) + return; + Log.i("VAL SELECTED", + "Value: " + e.getVal() + ", xIndex: " + e.getXIndex() + + ", DataSet index: " + dataSetIndex);*/ + /* if(e.getXIndex()==0){ + Intent ittEditProjToProjStatus = new Intent(getContext(),PMProjectDetailActivity.class); + ittEditProjToProjStatus.putExtra("pageCount",0); + startActivity(ittEditProjToProjStatus); + } + if(e.getXIndex()==2){ + Intent ittEditProjToProjStatus = new Intent(getContext(),PMProjectDetailActivity.class); + ittEditProjToProjStatus.putExtra("pageCount",1); + startActivity(ittEditProjToProjStatus); + } + if(e.getXIndex()==1){ + Intent ittEditProjToProjStatus = new Intent(getContext(),PMProjectDetailActivity.class); + ittEditProjToProjStatus.putExtra("pageCount",3); + startActivity(ittEditProjToProjStatus); + } + if(e.getXIndex()==3){ + Intent ittEditProjToProjStatus = new Intent(getContext(),PMProjectDetailActivity.class); + ittEditProjToProjStatus.putExtra("pageCount",2); + startActivity(ittEditProjToProjStatus); + }*/ + /* } + + @Override + public void onNothingSelected() { + Log.i("PieChart", "nothing selected"); + } +*/ + + + public class GetProjectCount extends AsyncTask { + + Context context; + + //ProgressBar progressBar; + + GetProjectCount (Context ctx){ + context = ctx; + } + + + @Override + protected SoapObject doInBackground(Integer... params) { + Integer ManagerId = (Integer) params [0]; + //SoapObject response = getStudDtls(leadid); + + String METHOD_NAME = "GetProjectCount"; + String NamespaceMail="http://mis.leadcampus.org/", SOAP_ACTION1="http://mis.leadcampus.org/GetProjectCount";//namespace+methodname + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + request.addProperty("ManagerId", ManagerId); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + + //anyType{Counts=1; ProjectStatus=Approved; Status=Success; }; + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapObject response = (SoapObject) envelope.getResponse(); + Log.d("tag","soap response project count"+response.toString()); + + int int_projectcount =response.getPropertyCount(); + + Log.e("projectcount", Integer.toString(int_projectcount)); + + for(int i=0;i " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.d("exception outside",t.getMessage().toString()); + } + + //Log.d("Soap response is",response.toString()); + + return null; + } + + @Override + protected void onPreExecute() { + + } + + @Override + protected void onPostExecute(SoapObject result) { + /*compeleted_tv.setText(ComplitedCount); + pending_tv.setText(UnapprovedCount); + approved_tv.setText(ApprovedCount);*/ + /* setupComplited(); + setupApproved(); + setupUnapproved();*/ + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + +}//end of fragment class diff --git a/app/src/main/java/com/leadcampusapp/ChartStud_CollgCountFragment.java b/app/src/main/java/com/leadcampusapp/ChartStud_CollgCountFragment.java new file mode 100644 index 0000000..53b6dc7 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ChartStud_CollgCountFragment.java @@ -0,0 +1,110 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 20-07-2018. + */ + +import android.content.Intent; +import android.graphics.Color; +import android.os.Bundle; +import androidx.fragment.app.Fragment; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +//import com.android.sripad.leadnew_22_6_2018.R; +import com.github.mikephil.charting.charts.PieChart; +import com.github.mikephil.charting.data.Entry; +import com.github.mikephil.charting.data.PieData; +import com.github.mikephil.charting.data.PieDataSet; +import com.github.mikephil.charting.formatter.PercentFormatter; +import com.github.mikephil.charting.highlight.Highlight; +import com.github.mikephil.charting.listener.OnChartValueSelectedListener; +import com.github.mikephil.charting.utils.ColorTemplate; + +import java.util.ArrayList; + +public class ChartStud_CollgCountFragment extends Fragment implements OnChartValueSelectedListener +{ + + int count=0; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + + View view=inflater.inflate(R.layout.frag_project_countchart, container, false); + Intent intent = getActivity().getIntent(); + /* String UnapprovedCount=intent.getStringExtra("UnapprovedCount"); + String ComplitedCount=intent.getStringExtra("ComplitedCount"); + String ApprovedCount=intent.getStringExtra("ApprovedCount"); + String RequestForCompletion=intent.getStringExtra("RequestForCompletion"); + String RequestForModification=intent.getStringExtra("RequestForModification"); + String Rejected=intent.getStringExtra("Rejected");*/ + String str_studentcount=intent.getStringExtra("str_studentcount"); + String str_collegecount=intent.getStringExtra("str_collegecount"); + + PieChart pieChart = (PieChart) view.findViewById(R.id.piechart); + pieChart.setUsePercentValues(true); + + /* Float unapproved_float=Float.valueOf(UnapprovedCount).floatValue(); + Float complited_float=Float.valueOf(ComplitedCount).floatValue(); + Float approved_float=Float.valueOf(ApprovedCount).floatValue(); + Float requestforcomplition_float=Float.valueOf(RequestForCompletion).floatValue(); + Float requestformodification_float=Float.valueOf(RequestForModification).floatValue(); + Float rejected_float=Float.valueOf(Rejected).floatValue();*/ + Float collegecount_float=Float.valueOf(str_collegecount).floatValue(); + + Float studentcount_float=Float.valueOf(str_studentcount).floatValue(); + + ArrayList yvalues2 = new ArrayList(); + ArrayList xVals2 = new ArrayList(); + + yvalues2.add(new Entry(studentcount_float, 0)); + yvalues2.add(new Entry(collegecount_float,1)); + PieDataSet dataSet2 = new PieDataSet(yvalues2, ""); + + xVals2.add("No of Students"); + xVals2.add("No of Colleges"); + + PieDataSet dataSet = new PieDataSet(yvalues2, ""); + PieData data = new PieData(xVals2,dataSet); + // In Percentage term + data.setValueFormatter(new PercentFormatter()); + // Default value + //data.setValueFormatter(new DefaultValueFormatter(0)); + pieChart.setData(data); + pieChart.setDescription("Student and College Counts"); + pieChart.setDescriptionColor(Color.WHITE); + pieChart.setDescriptionPosition(450,100); + pieChart.setDescriptionTextSize(20f); + pieChart.getLegend().setTextColor(Color.WHITE); + pieChart.setDrawHoleEnabled(true); + pieChart.setTransparentCircleRadius(25f); + pieChart.setHoleRadius(25f); + + dataSet.setColors(ColorTemplate.JOYFUL_COLORS); + data.setValueTextSize(10f); + data.setValueTextColor(Color.DKGRAY); + // pieChart.setOnChartValueSelectedListener(this); + + pieChart.animateXY(1400, 1400); + + // showActivity(); + return view; + } + @Override + public void onValueSelected(Entry e, int dataSetIndex, Highlight h) { + if (e == null) + return; + Log.i("VAL SELECTED", + "Value: " + e.getVal() + ", xIndex: " + e.getXIndex() + + ", DataSet index: " + dataSetIndex); + } + + @Override + public void onNothingSelected() { + Log.i("PieChart", "nothing selected"); + } + +}//end of fragment class diff --git a/app/src/main/java/com/leadcampusapp/ChartThemeProjCountFragment.java b/app/src/main/java/com/leadcampusapp/ChartThemeProjCountFragment.java new file mode 100644 index 0000000..907a36d --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ChartThemeProjCountFragment.java @@ -0,0 +1,500 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 20-07-2018. + */ + +import android.app.ProgressDialog; +import android.content.Context; +import android.content.SharedPreferences; +import android.graphics.Color; +import android.os.AsyncTask; +import android.os.Bundle; +import androidx.fragment.app.Fragment; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +//import com.android.sripad.leadnew_22_6_2018.R; +import com.github.mikephil.charting.charts.BarChart; +import com.github.mikephil.charting.components.Legend; +import com.github.mikephil.charting.components.XAxis; +import com.github.mikephil.charting.components.YAxis; +import com.github.mikephil.charting.data.BarData; +import com.github.mikephil.charting.data.BarDataSet; +import com.github.mikephil.charting.data.BarEntry; +import com.github.mikephil.charting.utils.ColorTemplate; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.util.ArrayList; + +public class ChartThemeProjCountFragment extends Fragment +{ + + private ArrayList listThemeName; + private ArrayList listCount; + + public static final String PREFBook_PM= "prefbook_pm"; //sharedpreference Book + public static final String PrefID_PMID = "prefid_pmid"; // + SharedPreferences shardprefPM_obj; + String str_MangerID; + Integer MDId; + BarChart barChart; + + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + + View view=inflater.inflate(R.layout.activity_pmget_theme_wise_project_count, container, false); + listThemeName = new ArrayList(); + listCount = new ArrayList(); + + shardprefPM_obj= getActivity().getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MangerID = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + Log.d("str_leadId:",str_MangerID); + // Toast.makeText(this,"LeadId: "+str_MangerID,Toast.LENGTH_LONG).show(); + MDId=Integer.parseInt(str_MangerID); + + barChart = (BarChart) view.findViewById(R.id.barchart); + + + GetThemeWiseProjCount getThemeWiseProjCount = new GetThemeWiseProjCount(getActivity()); + getThemeWiseProjCount.execute(); + + return view; + } + + public class GetThemeWiseProjCount extends AsyncTask { + + Context context; + //AlertDialog alertDialog; + private ProgressDialog progressDialog; + + //private ProgressBar progressBar; + + GetThemeWiseProjCount (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String str_leadId = (String) params [0]; + //String versionCode = (String) params[2]; + + SoapObject response = getThemeWiseProjCount(); + + //Log.d("GetThemeWiseProjCout",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + + progressDialog.setMessage("Loading"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + + } + + @Override + protected void onPostExecute(SoapObject result) { + + if(result!=null){ + + Log.d("GetStudentDetailssresp", result.toString()); + + /* SoapPrimitive S_Status,S_ThemeName,S_Counts; + Object O_Status,O_ThemeName,O_Counts; + String str_Status=null,str_ThemeName=null,str_Counts=null; + + for(int i=0;i"); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + Log.d("soap responseyyyyyyy",envelope.getResponse().toString()); + SoapObject response = (SoapObject) envelope.getResponse(); + Log.d("soap responseyyyyyyy",response.toString()); + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.d("exception outside",t.getMessage().toString()); + } + return null; + + + } + + + private void multiBarchartsInOne() { + // create BarEntry for Bar Group 1 +/* HorizontalBarChart barChart = (HorizontalBarChart) findViewById(R.id.barchart); + + ArrayList bargroup1 = new ArrayList<>(); + bargroup1.add(new BarEntry(8f, 0)); + bargroup1.add(new BarEntry(2f, 1)); + bargroup1.add(new BarEntry(5f, 2)); + bargroup1.add(new BarEntry(20f, 3)); + bargroup1.add(new BarEntry(15f, 4)); + bargroup1.add(new BarEntry(19f, 5)); + +// create BarEntry for Bar Group 1 + ArrayList bargroup2 = new ArrayList<>(); + bargroup2.add(new BarEntry(6f, 0)); + bargroup2.add(new BarEntry(10f, 1)); + bargroup2.add(new BarEntry(5f, 2)); + bargroup2.add(new BarEntry(25f, 3)); + bargroup2.add(new BarEntry(4f, 4)); + bargroup2.add(new BarEntry(17f, 5)); + +// creating dataset for Bar Group1 + BarDataSet barDataSet1 = new BarDataSet(bargroup1, "Bar Group 1"); + +//barDataSet1.setColor(Color.rgb(0, 155, 0)); + barDataSet1.setColors(ColorTemplate.COLORFUL_COLORS); + +// creating dataset for Bar Group 2 + BarDataSet barDataSet2 = new BarDataSet(bargroup2, "Bar Group 2"); + barDataSet2.setColors(ColorTemplate.COLORFUL_COLORS); + + List dataSets = new ArrayList<>(); // combined all dataset into an arraylist + dataSets.add(barDataSet1); + dataSets.add(barDataSet2); + + + + + + + + //BarDataSet bardataset = new BarDataSet(entries, "Cells"); + + ArrayList labels = new ArrayList(); + labels.add("2016"); + labels.add("2015"); + labels.add("2014"); + labels.add("2013"); + labels.add("2012"); + labels.add("2011"); + labels.add("2010"); + labels.add("2009"); + labels.add("2008"); + labels.add("2007"); + labels.add("2006"); + labels.add("2005"); + labels.add("2004"); + labels.add("2003"); + + + //BarData data = new BarData(labels,dataSets); + BarData data = new BarData(labels,dataSets); + barChart.setData(data); // set the data and list of lables into chart + + barChart.setDescription("Set Bar Chart Description"); // set the description + + //bardataset.setColors(ColorTemplate.COLORFUL_COLORS); + + barChart.animateY(5000);*/ + + + + + + //HorizontalBarChart barChart = (HorizontalBarChart) findViewById(R.id.barchart); + + ArrayList entries = new ArrayList<>(); + + + for(int k=0;k labels = new ArrayList(); + /* labels.add("2016"); + labels.add("2015"); + labels.add("2014"); + labels.add("2013"); + labels.add("2012"); + labels.add("2011");*/ + /* labels.add("abc"); + labels.add("mnc"); + labels.add("xyz"); + labels.add("pmo");*/ + // barChart.getXAxis().setValueFormatter(new IndexAxisValueFormatter(labels)); + // XAxis xAxis = barChart.getXAxis(); + // xAxis.setValueFormatter(new IndexAxisValueFormatter(labels)); + + String[] arrString = new String[listThemeName.size()]; + + for(int l=0;l entries = new ArrayList<>(); + /*entries.add(new BarEntry(8f, 0)); + entries.add(new BarEntry(2f, 1)); + entries.add(new BarEntry(5f, 2)); + entries.add(new BarEntry(20f, 3)); + entries.add(new BarEntry(15f, 4)); + entries.add(new BarEntry(19f, 5));*/ + + for(int k=0;k labels = new ArrayList(); + /* labels.add("2016"); + labels.add("2015"); + labels.add("2014"); + labels.add("2013"); + labels.add("2012"); + labels.add("2011");*/ + + String[] arrString = new String[listThemeName.size()]; + + for(int l=0;l chatHistory; + Class_ChatModule[] class_chatModules_arrayobj; + ArrayList class_chatModulesobj=new ArrayList<>(); + String str_chat_status; + String comments, userType, managerName, studentName,replyTime,projectStatus; + + SharedPreferences shardprefPM_obj; + SharedPreferences.Editor editor_PM; + + public static final String PREFBook_Stud= "prefbook_stud"; //sharedpreference Book + public static final String PrefID_RegID = "prefid_regid"; // + + public static final String PREFBook_PM= "prefbook_pm"; //sharedpreference Book + public static final String PrefID_PMID = "prefid_pmid"; // + + + String userId,intent_projectId,intent_projectStatus,final_projStatus,intent_userType; + String messageText; + Context context; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_chat); + + context=getApplicationContext(); + + intent_projectStatus = getIntent().getStringExtra("projectStatus"); + intent_projectId = getIntent().getStringExtra("projectId"); + intent_userType = getIntent().getStringExtra("userType"); + + + if(intent_projectStatus.equals("completed")){ + /* messageET.setVisibility(View.GONE); + sendBtn.setVisibility(View.GONE);*/ + final_projStatus="Completed"; + } + else if(intent_projectStatus.equals("reapply")){ + final_projStatus="Proposed"; + } + else if(intent_projectStatus.equals("approved")){ + final_projStatus="Approved"; + } + else if(intent_projectStatus.equals("rejected")){ + final_projStatus="Rejected"; + } + else if(intent_projectStatus.equals("requested")){ + final_projStatus="RequestForCompletion"; + } + else if(intent_projectStatus.equals("pending")){ + final_projStatus="Proposed"; + } + + initControls(); + + + + + + sendBtn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + messageText = messageET.getText().toString(); + if (TextUtils.isEmpty(messageText)) { + return; + } + + boolean stud_manag_send; + //if(intent_userType.equals("Student")) { + if (intent_userType.equals("Student")) { + stud_manag_send = false; + } else { + stud_manag_send = true; + } + ChatMessage chatMessage = new ChatMessage(); + chatMessage.setId(Long.parseLong(userId));//dummy + chatMessage.setMessage(messageText); + chatMessage.setDate(DateFormat.getDateTimeInstance().format(new Date())); + chatMessage.setProjectStatus(final_projStatus); + chatMessage.setMe(stud_manag_send); + Log.e("tag","txtProjStatus 1="+final_projStatus+"==="+chatMessage.getProjectStatus()); + + // messageET.setText(""); + + displayMessage(chatMessage); + + SaveMentorMentee saveMentorMentee = new SaveMentorMentee(ChatActivity.this); + saveMentorMentee.execute(); + messageET.setText(""); + + } + }); + + } + + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); + + //noinspection SimplifiableIfStatement + if (id == R.id.action_settings) { + return true; + } + + return super.onOptionsItemSelected(item); + } + + private void initControls() { + messagesContainer = (ListView) findViewById(R.id.messagesContainer); + messageET = (EditText) findViewById(R.id.messageEdit); + sendBtn = (Button) findViewById(R.id.chatSendButton); + + TextView meLabel = (TextView) findViewById(R.id.meLbl); + TextView companionLabel = (TextView) findViewById(R.id.friendLabel); + RelativeLayout container = (RelativeLayout) findViewById(R.id.container); + companionLabel.setText("Me"); + //meLabel.setText("Mentor"); + + if(intent_userType.equals("Student")){ + meLabel.setText("Manager"); + shardprefPM_obj=getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + shardprefPM_obj.getString(PrefID_RegID, "").trim(); + userId = shardprefPM_obj.getString(PrefID_RegID, "").trim(); + }else { + meLabel.setText("Student"); + shardprefPM_obj=getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + userId = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + } + AsyncCallWS_GetMentorMentee asyncCallWS_getMentorMentee = new AsyncCallWS_GetMentorMentee(ChatActivity.this); + asyncCallWS_getMentorMentee.execute(); + + } + + public void displayMessage(ChatMessage message) { + adapter.add(message); + adapter.notifyDataSetChanged(); + scroll(); + } + + private void scroll() { + messagesContainer.setSelection(messagesContainer.getCount() - 1); + } + + private void loadDummyHistory(){ + + chatHistory = new ArrayList(); + + ArrayList msg_final=new ArrayList<>(); + + boolean stud_manag; + /* for (int j=1;j()); + messagesContainer.setAdapter(adapter); + + for(int i=0; i { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + dialog.setMessage("Please wait.."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("DFTech", "doInBackground"); + // GetAllEvents(); + GetMentorMentee(); // call of details + return null; + } + + public AsyncCallWS_GetMentorMentee(ChatActivity context1) { + context = context1; + dialog = new ProgressDialog(context1); + } + + @Override + protected void onPostExecute(Void result) + { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + + dialog.dismiss(); + loadDummyHistory(); + /* if (class_contactus_arrayObj != null) + { + ContactUsActivity.CustomAdapter adapter = new ContactUsActivity.CustomAdapter(); + listView.setAdapter(adapter); + + int x = class_contactus_arrayObj.length; + + System.out.println("Inside the if list adapter" + x); + } else { + Log.d("onPostExecute", "ondutyhistoryclass_arrayObj == null"); + } +*/ + + // Toast.makeText(getApplicationContext(),""+class_contactus_arrayObj[0].getEmailid1().toString(),Toast.LENGTH_LONG).show(); + + + + // System.out.println("Reached the onPostExecute"); + + }//end of onPostExecute + }// end Async task + + public void GetMentorMentee() { + + String URL = Class_URL.URL_Manager.toString(); + String METHOD_NAME = "GetMentorMentee"; + String Namespace = "http://mis.leadcampus.org/", SOAPACTION = "http://mis.leadcampus.org/GetMentorMentee"; + + long PDId= Long.parseLong(intent_projectId); + try { + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + request.addProperty("PDId", PDId); + + Log.e("request", request.toString()); + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + try { + + androidHttpTransport.call(SOAPACTION, envelope); + // Log.i(TAG, "GetAllLoginDetails is running"); + // result1 = (Vector) envelope.getResponse(); + SoapObject response = (SoapObject) envelope.getResponse(); + Log.e("get mentor response", response.toString()); + int int_count = response.getPropertyCount(); + + Log.e("number of rows", "" + int_count); +//Response +// anyType{vmGetMentorMentee=anyType{Comments=testing; UserType=Manager; ManagerName=Anisha Cardoza; StudentName=Mallikarjun kumbar; ReplyTime=14-08-19 02:52:24 PM; ProjectStatus=anyType{}; Status=Success; }; } + + class_chatModules_arrayobj = new Class_ChatModule[int_count]; + class_chatModulesobj.clear(); + // class_chatModulesobj=new ArrayList<>(int_count); + // listitems_arraylist.clear(); + for (int i = 0; i < int_count; i++) { + SoapObject list = (SoapObject) response.getProperty(i); + str_chat_status = (String) list.getProperty("Status").toString(); + // Holidays not found + + if (str_chat_status.equalsIgnoreCase("Success")){ + SoapPrimitive Comments, UserType, ManagerName, StudentName,ReplyTime,ProjectStatus; + String str_ProjectStatus; + String approved = ""; + Comments = (SoapPrimitive) list.getProperty("Comments"); + UserType = (SoapPrimitive) list.getProperty("UserType"); + ManagerName = (SoapPrimitive) list.getProperty("ManagerName"); + StudentName = (SoapPrimitive) list.getProperty("StudentName"); + ReplyTime = (SoapPrimitive) list.getProperty("ReplyTime"); + // ProjectStatus=(SoapPrimitive) list.getProperty("ProjectStatus"); + if(list.getProperty("ProjectStatus").toString().equals("anyType{}")) + { + str_ProjectStatus="anyType{}"; + } + else + { str_ProjectStatus=(String)list.getProperty("ProjectStatus").toString(); } + + + + Class_ChatModule innerObj = new Class_ChatModule(); + innerObj.setComments(Comments.toString()); + innerObj.setUserType(UserType.toString()); + innerObj.setManagerName(ManagerName.toString()); + innerObj.setStudentName(StudentName.toString()); + innerObj.setReplyTime(ReplyTime.toString()); + innerObj.setProjectStatus(str_ProjectStatus); + + + class_chatModules_arrayobj[i] = innerObj; + class_chatModulesobj.add(class_chatModules_arrayobj[i]); + //listitems_arraylist.add(innerObj); + + }//End of for loop + } + } + catch(Throwable t){ + //Toast.makeText(MainActivity.this, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("Chat fail", "> " + t.getMessage()); + + + } + } catch (Throwable t) { + Log.e("Chat Error", "> " + t.getMessage()); + + } + + + + }//End of contactus + + public class SaveMentorMentee extends AsyncTask { + + AlertDialog alertDialog; + // private ProgressBar progressBar; + ProgressDialog dialog; + + SaveMentorMentee (Context ctx){ + context = ctx; + dialog = new ProgressDialog(context); + + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapPrimitive response = SaveMentorMentee(); + + // SoapObject response = ReApplyProjectDetails(); + Log.d("tag","Soap response approvedDetails"+response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + dialog.setMessage("Please wait.."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + if(result!=null) { + if (result.toString().equals("Error")) { + Toast.makeText(getApplicationContext(), "Error occured while saving to database", Toast.LENGTH_LONG).show(); + } else { + Toast.makeText(getApplicationContext(), "Comment sent successfully", Toast.LENGTH_LONG).show(); + finish(); + } + } + dialog.dismiss(); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + private SoapPrimitive SaveMentorMentee() { + String METHOD_NAME = "SaveMentorMentee"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/SaveMentorMentee"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + long projectIds = (long) Integer.valueOf(intent_projectId); + + Log.d("PDIdssssssxxxx", intent_projectId); + Log.d("messageText=", messageText); + request.addProperty("PDId",projectIds); + request.addProperty("Comments",messageText); + request.addProperty("UserType",intent_userType); + request.addProperty("UserId",userId); + request.addProperty("ProjectStatus",final_projStatus); + + Log.d("Requestisxxxxx chat==",request.toString()); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + } + return null; + + } + +} diff --git a/app/src/main/java/com/leadcampusapp/ChatAdapter.java b/app/src/main/java/com/leadcampusapp/ChatAdapter.java new file mode 100644 index 0000000..af1275a --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ChatAdapter.java @@ -0,0 +1,151 @@ +package com.leadcampusapp; + +import android.app.Activity; +import android.content.Context; +import android.util.Log; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.LinearLayout; +import android.widget.RelativeLayout; +import android.widget.TextView; + +import java.util.List; + +/** + * Created by Technovibe on 17-04-2015. + */ +public class ChatAdapter extends BaseAdapter { + + private final List chatMessages; + private Activity context; + + public ChatAdapter(Activity context, List chatMessages) { + this.context = context; + this.chatMessages = chatMessages; + } + + @Override + public int getCount() { + if (chatMessages != null) { + return chatMessages.size(); + } else { + return 0; + } + } + + @Override + public ChatMessage getItem(int position) { + if (chatMessages != null) { + return chatMessages.get(position); + } else { + return null; + } + } + + @Override + public long getItemId(int position) { + return position; + } + + @Override + public View getView(final int position, View convertView, ViewGroup parent) { + ViewHolder holder; + ChatMessage chatMessage = getItem(position); + LayoutInflater vi = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + + if (convertView == null) { + convertView = vi.inflate(R.layout.list_item_chat_message, null); + holder = createViewHolder(convertView); + convertView.setTag(holder); + } else { + holder = (ViewHolder) convertView.getTag(); + } + + boolean myMsg = chatMessage.getIsme() ;//Just a dummy check to simulate whether it me or other sender + setAlignment(holder, myMsg); + holder.txtMessage.setText(chatMessage.getMessage()); + holder.txtInfo.setText(chatMessage.getDate()); + holder.txtProjStatus.setText(chatMessage.getProjectStatus()); + Log.e("tag","txtProjStatus="+chatMessage.getProjectStatus()); + + return convertView; + } + + public void add(ChatMessage message) { + chatMessages.add(message); + } + + public void add(List messages) { + chatMessages.addAll(messages); + } + + private void setAlignment(ViewHolder holder, boolean isMe) { + if (!isMe) { + holder.contentWithBG.setBackgroundResource(R.drawable.in_message_bg); + + LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) holder.contentWithBG.getLayoutParams(); + layoutParams.gravity = Gravity.RIGHT; + holder.contentWithBG.setLayoutParams(layoutParams); + + RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) holder.content.getLayoutParams(); + lp.addRule(RelativeLayout.ALIGN_PARENT_LEFT, 0); + lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); + holder.content.setLayoutParams(lp); + layoutParams = (LinearLayout.LayoutParams) holder.txtMessage.getLayoutParams(); + layoutParams.gravity = Gravity.RIGHT; + holder.txtMessage.setLayoutParams(layoutParams); + + layoutParams = (LinearLayout.LayoutParams) holder.txtInfo.getLayoutParams(); + layoutParams.gravity = Gravity.RIGHT; + holder.txtInfo.setLayoutParams(layoutParams); + + layoutParams = (LinearLayout.LayoutParams) holder.txtProjStatus.getLayoutParams(); + layoutParams.gravity = Gravity.RIGHT; + holder.txtProjStatus.setLayoutParams(layoutParams); + } else { + holder.contentWithBG.setBackgroundResource(R.drawable.out_message_bg); + + LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) holder.contentWithBG.getLayoutParams(); + layoutParams.gravity = Gravity.LEFT; + holder.contentWithBG.setLayoutParams(layoutParams); + + RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) holder.content.getLayoutParams(); + lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0); + lp.addRule(RelativeLayout.ALIGN_PARENT_LEFT); + holder.content.setLayoutParams(lp); + layoutParams = (LinearLayout.LayoutParams) holder.txtMessage.getLayoutParams(); + layoutParams.gravity = Gravity.LEFT; + holder.txtMessage.setLayoutParams(layoutParams); + + layoutParams = (LinearLayout.LayoutParams) holder.txtInfo.getLayoutParams(); + layoutParams.gravity = Gravity.LEFT; + holder.txtInfo.setLayoutParams(layoutParams); + + layoutParams = (LinearLayout.LayoutParams) holder.txtProjStatus.getLayoutParams(); + layoutParams.gravity = Gravity.LEFT; + holder.txtProjStatus.setLayoutParams(layoutParams); + } + } + + private ViewHolder createViewHolder(View v) { + ViewHolder holder = new ViewHolder(); + holder.txtMessage = (TextView) v.findViewById(R.id.txtMessage); + holder.content = (LinearLayout) v.findViewById(R.id.content); + holder.contentWithBG = (LinearLayout) v.findViewById(R.id.contentWithBackground); + holder.txtInfo = (TextView) v.findViewById(R.id.txtInfo); + holder.txtProjStatus=(TextView) v.findViewById(R.id.txtProjStatus); + return holder; + } + + + private static class ViewHolder { + public TextView txtMessage; + public TextView txtInfo; + public TextView txtProjStatus; + public LinearLayout content; + public LinearLayout contentWithBG; + } +} diff --git a/app/src/main/java/com/leadcampusapp/ChatMessage.java b/app/src/main/java/com/leadcampusapp/ChatMessage.java new file mode 100644 index 0000000..d60bbac --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ChatMessage.java @@ -0,0 +1,61 @@ +package com.leadcampusapp; + +/** + * Created by Technovibe on 17-04-2015. + */ +public class ChatMessage { + private long id; + private boolean isMe; + private String message; + private Long userId; + private String dateTime; + private String projectStatus; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public boolean getIsme() { + return isMe; + } + + public void setMe(boolean isMe) { + this.isMe = isMe; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public long getUserId() { + return userId; + } + + public void setUserId(long userId) { + this.userId = userId; + } + + public String getDate() { + return dateTime; + } + + public void setDate(String dateTime) { + this.dateTime = dateTime; + } + + public String getProjectStatus() { + return projectStatus; + } + + public void setProjectStatus(String projectStatus) { + this.projectStatus = projectStatus; + } +} diff --git a/app/src/main/java/com/leadcampusapp/ChatsActivity.java b/app/src/main/java/com/leadcampusapp/ChatsActivity.java new file mode 100644 index 0000000..4dda066 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ChatsActivity.java @@ -0,0 +1,404 @@ +package com.leadcampusapp; + +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.content.Intent; +import android.graphics.Color; +import androidx.appcompat.app.AppCompatActivity; +import android.os.Bundle; +import android.util.Log; + +//import com.android.sripad.leadnew_22_6_2018.R; +import com.github.mikephil.charting.charts.PieChart; +import com.github.mikephil.charting.data.PieData; +import com.github.mikephil.charting.data.PieDataSet; +import com.github.mikephil.charting.formatter.PercentFormatter; +import com.github.mikephil.charting.highlight.Highlight; +import com.github.mikephil.charting.listener.OnChartValueSelectedListener; +import com.github.mikephil.charting.utils.ColorTemplate; + +import com.github.mikephil.charting.data.Entry; + +import java.util.ArrayList; + +public class ChatsActivity extends AppCompatActivity implements OnChartValueSelectedListener,ConnectivityReceiver.ConnectivityReceiverListener { + + int count=0; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_chats); + + Intent intent = getIntent(); + String UnapprovedCount=intent.getStringExtra("UnapprovedCount"); + String ComplitedCount=intent.getStringExtra("ComplitedCount"); + String ApprovedCount=intent.getStringExtra("ApprovedCount"); + String RequestForCompletion=intent.getStringExtra("RequestForCompletion"); + String RequestForModification=intent.getStringExtra("RequestForModification"); + String Rejected=intent.getStringExtra("Rejected"); + String str_studentcount=intent.getStringExtra("str_studentcount"); + String str_collegecount=intent.getStringExtra("str_collegecount"); + + PieChart pieChart = (PieChart) findViewById(R.id.piechart); + pieChart.setUsePercentValues(true); + + PieChart pieChart2 = (PieChart) findViewById(R.id.piechart2); + pieChart.setUsePercentValues(true); + // IMPORTANT: In a PieChart, no values (Entry) should have the same + // xIndex (even if from different DataSets), since no values can be + // drawn above each other. + + Float unapproved_float=Float.valueOf(UnapprovedCount).floatValue(); + Float complited_float=Float.valueOf(ComplitedCount).floatValue(); + Float approved_float=Float.valueOf(ApprovedCount).floatValue(); + Float requestforcomplition_float=Float.valueOf(RequestForCompletion).floatValue(); + Float requestformodification_float=Float.valueOf(RequestForModification).floatValue(); + Float rejected_float=Float.valueOf(Rejected).floatValue(); + Float collegecount_float=Float.valueOf(str_collegecount).floatValue(); + + Float studentcount_float=Float.valueOf(str_studentcount).floatValue(); + + /* ArrayList yvalues = new ArrayList(); + ArrayList xVals = new ArrayList(); + + if(unapproved_float!=0) { + yvalues.add(new PieEntry(unapproved_float, "Proposed")); + xVals.add("Proposed"); + } + if(complited_float!=0) { + yvalues.add(new PieEntry(complited_float, "Complited")); + xVals.add("Complited"); + } + if(approved_float!=0) { + yvalues.add(new PieEntry(approved_float, "Approved")); + xVals.add("Approved"); + } + if(requestforcomplition_float!=0) { + yvalues.add(new PieEntry(requestforcomplition_float, "Completion")); + xVals.add("Completion"); + } + if(requestformodification_float!=0) { + yvalues.add(new PieEntry(requestformodification_float, "Modification")); + xVals.add("Modification"); + } + if(rejected_float!=0) { + yvalues.add(new PieEntry(rejected_float, "Rejected")); + xVals.add("Rejected"); + }*/ + ArrayList yvalues = new ArrayList(); + ArrayList xVals = new ArrayList(); + + if(unapproved_float!=0) { + yvalues.add(new Entry(unapproved_float, 0)); + xVals.add("Proposed"); + } + if(complited_float!=0) { + yvalues.add(new Entry(complited_float, 1)); + xVals.add("Complited"); + } + if(approved_float!=0) { + yvalues.add(new Entry(approved_float, 2)); + xVals.add("Approved"); + } + if(requestforcomplition_float!=0) { + yvalues.add(new Entry(requestforcomplition_float, 3)); + xVals.add("Completion"); + } + if(requestformodification_float!=0) { + yvalues.add(new Entry(requestformodification_float, 4)); + xVals.add("Modification"); + } + if(rejected_float!=0) { + yvalues.add(new Entry(rejected_float, 5)); + xVals.add("Rejected"); + } + + + /* yvalues.add(new Entry(unapproved_float, 0)); + yvalues.add(new Entry(complited_float, 1)); + yvalues.add(new Entry(approved_float, 2)); + yvalues.add(new Entry(requestforcomplition_float, 3)); + yvalues.add(new Entry(requestformodification_float, 4)); + yvalues.add(new Entry(rejected_float, 5)); +*/ + PieDataSet dataSet = new PieDataSet(yvalues, ""); + + + /* xVals.add("Proposed"); + xVals.add("Complited"); + xVals.add("Approved"); + xVals.add("Completion"); + xVals.add("Modification"); + xVals.add("Rejected");*/ + + PieData data = new PieData(xVals,dataSet); + // In Percentage term + data.setValueFormatter(new PercentFormatter()); + // Default value + //data.setValueFormatter(new DefaultValueFormatter(0)); + pieChart.setData(data); + pieChart.setDescription("Project Counts"); + + pieChart.setDrawHoleEnabled(true); + pieChart.setTransparentCircleRadius(25f); + pieChart.setHoleRadius(25f); + + dataSet.setColors(ColorTemplate.JOYFUL_COLORS); + data.setValueTextSize(10f); + data.setValueTextColor(Color.DKGRAY); + pieChart.setOnChartValueSelectedListener(this); + + pieChart.animateXY(1400, 1400); + + /* BarChart barChart = (BarChart) findViewById(R.id.barchart); + + ArrayList entries = new ArrayList<>(); + entries.add(new BarEntry(unapproved_float, 0)); + entries.add(new BarEntry(complited_float, 1)); + entries.add(new BarEntry(approved_float, 2)); + entries.add(new BarEntry(requestforcomplition_float, 3)); + entries.add(new BarEntry(requestformodification_float, 4)); + entries.add(new BarEntry(rejected_float, 5)); + + + + ArrayList labels = new ArrayList(); + labels.add("Proposed"); + labels.add("Complited"); + labels.add("Approved"); + labels.add("Completion"); + labels.add("Modification"); + labels.add("Rejected");*/ + + /* if(unapproved_float!=0) { + entries.add(new BarEntry(unapproved_float, count++)); + labels.add("Proposed"); + } + if(complited_float!=0) { + entries.add(new BarEntry(complited_float, count++)); + labels.add("Complited"); + } + if(approved_float!=0) { + entries.add(new BarEntry(approved_float, count++)); + labels.add("Approved"); + } + if(requestforcomplition_float!=0) { + entries.add(new BarEntry(requestforcomplition_float, count++)); + labels.add("Completion"); + } + if(requestformodification_float!=0) { + entries.add(new BarEntry(requestformodification_float, count++)); + labels.add("Modification"); + } + if(rejected_float!=0) { + entries.add(new BarEntry(rejected_float, count++)); + labels.add("Rejected"); + }*/ + + /*BarDataSet bardataset = new BarDataSet(entries, "Cells"); + + BarData data1 = new BarData(labels, bardataset); + barChart.setData(data1); // set the data and list of lables into chart + + // barChart.setDescription("Set Bar Chart Description"); // set the description + + bardataset.setColors(ColorTemplate.COLORFUL_COLORS); + + barChart.animateY(5000);*/ +//---------------------------------------------------------------------------------------------- + + ArrayList yvalues2 = new ArrayList(); + ArrayList xVals2 = new ArrayList(); + + yvalues2.add(new Entry(studentcount_float, 0)); + yvalues2.add(new Entry(collegecount_float,1)); + PieDataSet dataSet2 = new PieDataSet(yvalues2, ""); + + xVals2.add("No of Students"); + xVals2.add("No of Colleges"); + + /* xVals.add("Proposed"); + xVals.add("Complited"); + xVals.add("Approved"); + xVals.add("Completion"); + xVals.add("Modification"); + xVals.add("Rejected");*/ + + PieData data2 = new PieData(xVals2, dataSet2); + + data2.setValueFormatter(new PercentFormatter()); + // Default value + //data.setValueFormatter(new DefaultValueFormatter(0)); + pieChart2.setData(data2); + // pieChart2.setDescription("Student Counts"); + + pieChart2.setDrawHoleEnabled(true); + pieChart2.setTransparentCircleRadius(25f); + pieChart2.setHoleRadius(25f); + + dataSet2.setColors(ColorTemplate.JOYFUL_COLORS); + data2.setValueTextSize(10f); + data2.setValueTextColor(Color.DKGRAY); + pieChart2.setOnChartValueSelectedListener(this); + + pieChart2.animateXY(1400, 1400); + + } + + + @Override + protected void onResume() { + super.onResume(); + + // register connection status listener + MyApplication.getInstance().setConnectivityListener(this); + } + + @Override + public void onNetworkConnectionChanged(boolean isConnected) { + showSnack(isConnected); + } + + private void showSnack(boolean isConnected) { + + if (!isConnected) { + + AlertDialog.Builder adb = new AlertDialog.Builder(ChatsActivity.this); + //adb.setView(alertDialogView); + + adb.setTitle("Sorry! Not connected to the internet"); + + adb.setIcon(android.R.drawable.ic_dialog_alert); + + adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + + adb.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + adb.setCancelable(true); + adb.show(); + + //finish(); + } + + } + + + + + + + + + + + + + + + @Override + public void onValueSelected(Entry e, int dataSetIndex, Highlight h) { + if (e == null) + return; + Log.i("VAL SELECTED", + "Value: " + e.getVal() + ", xIndex: " + e.getXIndex() + + ", DataSet index: " + dataSetIndex); + if(e.getXIndex()==0){ + Intent ittEditProjToProjStatus = new Intent(ChatsActivity.this,PMProjectDetailActivity.class); + ittEditProjToProjStatus.putExtra("pageCount",0); + startActivity(ittEditProjToProjStatus); + } + if(e.getXIndex()==2){ + Intent ittEditProjToProjStatus = new Intent(ChatsActivity.this,PMProjectDetailActivity.class); + ittEditProjToProjStatus.putExtra("pageCount",1); + startActivity(ittEditProjToProjStatus); + } + if(e.getXIndex()==1){ + Intent ittEditProjToProjStatus = new Intent(ChatsActivity.this,PMProjectDetailActivity.class); + ittEditProjToProjStatus.putExtra("pageCount",3); + startActivity(ittEditProjToProjStatus); + } + if(e.getXIndex()==3){ + Intent ittEditProjToProjStatus = new Intent(ChatsActivity.this,PMProjectDetailActivity.class); + ittEditProjToProjStatus.putExtra("pageCount",2); + startActivity(ittEditProjToProjStatus); + } + } + + /* @Override + public void onValueSelected(Entry e, Highlight h) { + + if (e == null) + return; + Log.i("VAL SELECTED", + "Value: " + e.getY() + ", xIndex: " + e.getX() + + ", DataSet index: " + h.getDataSetIndex()); + if(e.getX()==0){ + Intent ittEditProjToProjStatus = new Intent(ChatsActivity.this,PMProjectDetailActivity.class); + ittEditProjToProjStatus.putExtra("pageCount",0); + startActivity(ittEditProjToProjStatus); + } + if(e.getX()==2){ + Intent ittEditProjToProjStatus = new Intent(ChatsActivity.this,PMProjectDetailActivity.class); + ittEditProjToProjStatus.putExtra("pageCount",1); + startActivity(ittEditProjToProjStatus); + } + if(e.getX()==1){ + Intent ittEditProjToProjStatus = new Intent(ChatsActivity.this,PMProjectDetailActivity.class); + ittEditProjToProjStatus.putExtra("pageCount",3); + startActivity(ittEditProjToProjStatus); + } + if(e.getX()==3){ + Intent ittEditProjToProjStatus = new Intent(ChatsActivity.this,PMProjectDetailActivity.class); + ittEditProjToProjStatus.putExtra("pageCount",2); + startActivity(ittEditProjToProjStatus); + } + } +*/ + @Override + public void onNothingSelected() { + Log.i("PieChart", "nothing selected"); + } + /* @Override + public void onValueSelected(Entry e, int dataSetIndex) { + + if (e == null) + return; + Log.i("VAL SELECTED", + "Value: " + e.getVal() + ", xIndex: " + e.getXIndex() + + ", DataSet index: " + dataSetIndex); + if(e.getXIndex()==0){ + Intent ittEditProjToProjStatus = new Intent(ChatsActivity.this,PMProjectDetailActivity.class); + ittEditProjToProjStatus.putExtra("pageCount",0); + startActivity(ittEditProjToProjStatus); + } + if(e.getXIndex()==2){ + Intent ittEditProjToProjStatus = new Intent(ChatsActivity.this,PMProjectDetailActivity.class); + ittEditProjToProjStatus.putExtra("pageCount",1); + startActivity(ittEditProjToProjStatus); + } + if(e.getXIndex()==1){ + Intent ittEditProjToProjStatus = new Intent(ChatsActivity.this,PMProjectDetailActivity.class); + ittEditProjToProjStatus.putExtra("pageCount",3); + startActivity(ittEditProjToProjStatus); + } + if(e.getXIndex()==3){ + Intent ittEditProjToProjStatus = new Intent(ChatsActivity.this,PMProjectDetailActivity.class); + ittEditProjToProjStatus.putExtra("pageCount",2); + startActivity(ittEditProjToProjStatus); + } + } + + @Override + public void onNothingSelected() { + Log.i("PieChart", "nothing selected"); + }*/ +} diff --git a/app/src/main/java/com/leadcampusapp/CheckForSDCard.java b/app/src/main/java/com/leadcampusapp/CheckForSDCard.java new file mode 100644 index 0000000..ff652cb --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/CheckForSDCard.java @@ -0,0 +1,15 @@ +package com.leadcampusapp; + +import android.os.Environment; + +public class CheckForSDCard { + //Check If SD Card is present or not method + public boolean isSDCardPresent() { + if (Environment.getExternalStorageState().equals( + + Environment.MEDIA_MOUNTED)) { + return true; + } + return false; + } +} diff --git a/app/src/main/java/com/leadcampusapp/Class_ApprovedProjectList.java b/app/src/main/java/com/leadcampusapp/Class_ApprovedProjectList.java new file mode 100644 index 0000000..fa6bfea --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_ApprovedProjectList.java @@ -0,0 +1,117 @@ +package com.leadcampusapp; + +/** + * Created by User on 11/10/2017. + */ + +public class Class_ApprovedProjectList { + + + int id; + + String ProjectSlNo; + String ProjectId; + String ProjectName; + String ProjectStatus; + String ProjectprecentCount; + String WebServiceStatus; + String ImpactProject; + + /*38393 + title15 + Success + 0 + 0*/ + + public Class_ApprovedProjectList(){ + + } + + + public Class_ApprovedProjectList(int id,String slno ,String projectid, String projectname, String projectstatus,String projectprecentcount,String webservicestatus,String impactproject) + { + + this.id = id; + this.ProjectId = projectid; + this.ProjectName = projectname; + this.ProjectStatus=projectstatus; + this.ProjectSlNo=slno; + this.ProjectprecentCount=projectprecentcount; + this.WebServiceStatus=webservicestatus; + this.ImpactProject=impactproject; + + + } + + + public Class_ApprovedProjectList(String slno,String projectid, String projectname, String projectstatus,String projectprecentcount,String webservicestatus,String impactproject){ + + this.ProjectId = projectid; + this.ProjectName = projectname; + this.ProjectStatus=projectstatus; + this.ProjectSlNo=slno; + this.ProjectprecentCount=projectprecentcount; + this.WebServiceStatus=webservicestatus; + this.ImpactProject=impactproject; + } + + //get and set + public String getproject_id(){ + return this.ProjectId; + } + public void setproject_id(String projectid){ + this.ProjectId = projectid; + } + + //get and set + public String getproject_name(){ + return this.ProjectName; + } + public void setproject_name(String projectname){ + this.ProjectName = projectname; + } + + + + //get and set + public String getproject_status(){ + return this.ProjectStatus; + } + public void setproject_status(String project_status){ + this.ProjectStatus = project_status; + } + + +public String getproject_slno() +{ return this.ProjectSlNo;} + + public void setproject_slno(String project_slno){ + this.ProjectSlNo = project_slno; + } + + + public String getproject_precentCount() + { return this.ProjectprecentCount;} + + public void setproject_precentcount(String projectprecentcount) + { + this.ProjectprecentCount = projectprecentcount; + } + + + public String get_webservicestatus() + { return this.WebServiceStatus;} + + public void set_webservicestatus(String webservicestatus) + { + this.WebServiceStatus = webservicestatus; + } + + public String get_impactproject() { + return ImpactProject; + } + + public void set_impactproject(String impactProject) { + ImpactProject = impactProject; + } +}//end of class diff --git a/app/src/main/java/com/leadcampusapp/Class_ChatModule.java b/app/src/main/java/com/leadcampusapp/Class_ChatModule.java new file mode 100644 index 0000000..c002935 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_ChatModule.java @@ -0,0 +1,86 @@ +package com.leadcampusapp; + +/** + * Created by User on 16-Aug-19. + */ + +public class Class_ChatModule { + //anyType{vmGetMentorMentee=anyType{Comments=testing; UserType=Manager; ManagerName=Anisha Cardoza; StudentName=Mallikarjun kumbar; ReplyTime=14-08-19 02:52:24 PM; ProjectStatus=anyType{}; Status=Success; }; } + String Comments; + String UserType; + String ManagerName; + String StudentName; + String ReplyTime; + String ProjectStatus; + String Status; + + public Class_ChatModule(String comments, String userType, String managerName, String studentName, String replyTime, String projectStatus, String status) { + Comments = comments; + UserType = userType; + ManagerName = managerName; + StudentName = studentName; + ReplyTime = replyTime; + ProjectStatus = projectStatus; + Status = status; + } + + public Class_ChatModule() { + + } + + public String getComments() { + return Comments; + } + + public void setComments(String comments) { + Comments = comments; + } + + public String getUserType() { + return UserType; + } + + public void setUserType(String userType) { + UserType = userType; + } + + public String getManagerName() { + return ManagerName; + } + + public void setManagerName(String managerName) { + ManagerName = managerName; + } + + public String getStudentName() { + return StudentName; + } + + public void setStudentName(String studentName) { + StudentName = studentName; + } + + public String getReplyTime() { + return ReplyTime; + } + + public void setReplyTime(String replyTime) { + ReplyTime = replyTime; + } + + public String getProjectStatus() { + return ProjectStatus; + } + + public void setProjectStatus(String projectStatus) { + ProjectStatus = projectStatus; + } + + public String getStatus() { + return Status; + } + + public void setStatus(String status) { + Status = status; + } +} diff --git a/app/src/main/java/com/leadcampusapp/Class_Colleges.java b/app/src/main/java/com/leadcampusapp/Class_Colleges.java new file mode 100644 index 0000000..06e3ba0 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_Colleges.java @@ -0,0 +1,236 @@ +package com.leadcampusapp; + +/** + * Created by User on 11/13/2017. + */ + +public class Class_Colleges { + + int id; + + + String CollegeId; + String College_TID; + String CollegeName; + String CollegeStatus; + String CollegeType; + + String CurrentApplCount; + String CurrentAdmissionCount; + String PreviousApplCount; + String PreviousAdmissionCount; + String Prev2prevApplCount; + String Prev2prevAdmissionCount; + + String Fees; + String Fees_Id; + String Status; + + public Class_Colleges(){ + + } + + public Class_Colleges(int id, String collegeId, String college_tid, String collegename, String collegestatus, String collegetype, + String currentapplcount, String currentadmissioncount, String previousapplcount, String previousadmissioncount, String prev2prevapplcount, String prev2prevadmissioncount) + { + this.id = id; + this.CollegeId = collegeId; + this.College_TID=college_tid; + this.CollegeName = collegename; + this.CollegeStatus=collegestatus; + this.CollegeType=collegetype; + + this.CurrentApplCount=currentapplcount; + this.CurrentAdmissionCount=currentadmissioncount; + this.PreviousApplCount=previousapplcount; + this.PreviousAdmissionCount=previousadmissioncount; + this.Prev2prevApplCount=prev2prevapplcount; + this.Prev2prevAdmissionCount= prev2prevadmissioncount; + } + + public Class_Colleges(String collegeId, String college_tid, String collegename, String collegestatus, String collegetype, + String currentapplcount, String currentadmissioncount, String previousapplcount, String previousadmissioncount, String prev2prevapplcount, String prev2prevadmissioncount) + { + + this.CollegeId = collegeId; + this.College_TID=college_tid; + this.CollegeName = collegename; + this.CollegeStatus=collegestatus; + this.CollegeType=collegetype; + + this.CurrentApplCount=currentapplcount; + this.CurrentAdmissionCount=currentadmissioncount; + this.PreviousApplCount=previousapplcount; + this.PreviousAdmissionCount=previousadmissioncount; + this.Prev2prevApplCount=prev2prevapplcount; + this.Prev2prevAdmissionCount= prev2prevadmissioncount; + } + + + //get and set + public String getcollege_id(){ + return this.CollegeId; + } + public void setcollege_id(String collegeId){ + this.CollegeId = collegeId; + } + + + //get and set + public String getcollege_tid(){ + return this.College_TID; + } + public void setcollege_tid(String college_tid){ + this.College_TID = college_tid; + } + + //get and set + public String getcollegename(){ + return this.CollegeName; + } + public void setcollegename(String collegename){ + this.CollegeName = collegename; + } + + //get and set + public String getcollegestatus(){ + return this.CollegeStatus; + } + public void setcollegestatus(String collegestatus){ + this.CollegeStatus = collegestatus; + } + + + + //get and set + public String getcollegetype(){ + return this.CollegeType; + } + public void setcollegetype(String collegetype){ + this.CollegeType = collegetype; + } + + + + + + + + + + + + //get and set + public String getcurrentapplcount(){ + return this.CurrentApplCount; + } + public void setcurrentapplcount(String currentapplcount){ + this.CurrentApplCount = currentapplcount; + } + + + + //get and set + public String getcurrentadmissioncount(){ + return this.CurrentAdmissionCount; + } + public void setcurrentadmissioncount(String currentadmissioncount){ + this.CurrentAdmissionCount = currentadmissioncount; + } + + //get and set + public String getpreviousapplcount(){ + return this.PreviousApplCount; + } + public void setpreviousapplcount(String previousapplcount){ + this.PreviousApplCount = previousapplcount; + } + + + + + + + //get and set + public String getpreviousadmissioncount(){ + return this.PreviousAdmissionCount; + } + public void setpreviousadmissioncount(String previousadmissioncount){ + this.PreviousAdmissionCount = previousadmissioncount; + } + + + //get and set + public String getprev2prevapplcount(){ + return this.Prev2prevApplCount; + } + public void setprev2prevapplcount(String prev2prevapplcount){ + this.Prev2prevApplCount = prev2prevapplcount; + } + + + //get and set + public String getprev2prevadmissioncount(){ + return this.Prev2prevAdmissionCount; + } + public void setprev2prevadmissioncount(String prev2prevadmissioncount){ + this.Prev2prevAdmissionCount = prev2prevadmissioncount; + } + + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getCollegeId() { + return CollegeId; + } + + public void setCollegeId(String collegeId) { + CollegeId = collegeId; + } + + public String getCollegeName() { + return CollegeName; + } + + public void setCollegeName(String collegeName) { + CollegeName = collegeName; + } + + public String getFees() { + return Fees; + } + + public void setFees(String fees) { + Fees = fees; + } + + public String getFees_Id() { + return Fees_Id; + } + + public void setFees_Id(String fees_Id) { + Fees_Id = fees_Id; + } + + public String getStatus() { + return Status; + } + + public void setStatus(String status) { + Status = status; + } + + //set the string + public String toString() + { + return( this.CollegeName ); + } + + +}//end of class diff --git a/app/src/main/java/com/leadcampusapp/Class_ContactUs.java b/app/src/main/java/com/leadcampusapp/Class_ContactUs.java new file mode 100644 index 0000000..a120695 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_ContactUs.java @@ -0,0 +1,76 @@ +package com.leadcampusapp; + +/* +1 +Any queries in WebApp and Mobile App +Hubballi +Contact Helpline +9686654748 +leadmis@dfmail.org + +Helpline +1 +Success +*/ + + +public class Class_ContactUs +{ +String sandbox_name; + String sandbox_address; + String contact_person; + String contact_number1; + String emailid1; + String emailid2; + + public String getSandbox_name() { + return sandbox_name; + } + + public void setSandbox_name(String sandbox_name) { + this.sandbox_name = sandbox_name; + } + + public String getSandbox_address() { + return sandbox_address; + } + + public void setSandbox_address(String sandbox_address) { + this.sandbox_address = sandbox_address; + } + + public String getContact_person() { + return contact_person; + } + + public void setContact_person(String contact_person) { + this.contact_person = contact_person; + } + + public String getContact_number1() { + return contact_number1; + } + + public void setContact_number1(String contact_number1) { + this.contact_number1 = contact_number1; + } + + public String getEmailid1() { + return emailid1; + } + + public void setEmailid1(String emailid1) { + this.emailid1 = emailid1; + } + + public String getEmailid2() { + return emailid2; + } + + public void setEmailid2(String emailid2) { + this.emailid2 = emailid2; + } + + + +} diff --git a/app/src/main/java/com/leadcampusapp/Class_Course.java b/app/src/main/java/com/leadcampusapp/Class_Course.java new file mode 100644 index 0000000..b81b45a --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_Course.java @@ -0,0 +1,116 @@ +package com.leadcampusapp; + +/** + * Created by User on 12/7/18. + */ + +public class Class_Course +{ + + int id; + + String CourseId; + String CourseName; + String CourseProgCode; + String CourseStatus; + + + /*long + string + long + string*/ + + + + + public Class_Course(){ + + } + + + public Class_Course(int id, String courseId, String coursename, String courseprogcode, String coursestatus){ + this.id = id; + this.CourseId = courseId; + this.CourseName = coursename; + this.CourseProgCode=courseprogcode; + this.CourseStatus=coursestatus; + + + } + + public Class_Course(String courseId, String coursename, String courseprogcode, String coursestatus){ + + this.CourseId = courseId; + this.CourseName = coursename; + this.CourseProgCode=courseprogcode; + this.CourseStatus=coursestatus; + } + + + //get and set + public String getcourse_id(){ + return this.CourseId; + } + public void setcourse_id(String courseId){ + this.CourseId = courseId; + } + + + + + //courseprogcode + + //get and set + public String getcourse_progcode(){ + return this.CourseProgCode; + } + public void setcourse_progcode(String courseprogcode){ + this.CourseProgCode = courseprogcode; + } + + + + + + //get and set + public String getcourse_name(){ + return this.CourseName; + } + public void setcourse_name(String coursename){ + this.CourseName = coursename; + } + + + + + + + + + + + + //get and set + public String getcourse_status(){ + return this.CourseStatus; + } + public void setcourse_status(String coursestatus){ + this.CourseStatus = coursestatus; + } + + + + + + + + + //set the string + public String toString() + { + return( this.CourseName ); + } + + + +}// End of course diff --git a/app/src/main/java/com/leadcampusapp/Class_CurrentEvents.java b/app/src/main/java/com/leadcampusapp/Class_CurrentEvents.java new file mode 100644 index 0000000..7f772ea --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_CurrentEvents.java @@ -0,0 +1,131 @@ +package com.leadcampusapp; + +/** + * Created by User on 20/7/18. + */ + +/*long +string +string +string +string +string +string +string + int +string*/ + + +public class Class_CurrentEvents { + + int _id; + //String EventName; + //String EventDesc; + // String EventImageURL; + String EventApplyURL; //string + String EventURL; //string + byte[] EventImage; //string + String PastorCurrent; //int + String Status; //string + String FromDate;//string + String Todate;//string + + + + + + /* int _id; + String EventApplyURL; + String EventURL; + byte[] EventImage;*/ + + + public Class_CurrentEvents() { + } + + + public Class_CurrentEvents(int id, String eventapplyurl, String eventurl,byte[] eventimage,String pastorcurrent,String status,String fromdate,String todate) { + this._id = id; + this.EventApplyURL = eventapplyurl; + this.EventURL = eventurl; + this.EventImage = eventimage; + this.PastorCurrent=pastorcurrent; + this.Status=status; + this.FromDate=fromdate; + this.Todate=todate; + } + + + + public Class_CurrentEvents(String eventapplyurl, String eventurl,byte[] eventimage,String pastorcurrent,String status,String fromdate,String todate) { + + this.EventApplyURL = eventapplyurl; + this.EventURL = eventurl; + this.EventImage = eventimage; + this.PastorCurrent=pastorcurrent; + this.Status=status; + this.FromDate=fromdate; + this.Todate=todate; + + } + + + public String getEventApplyURL(){ + return this.EventApplyURL; + } + // setting id + public void setEventApplyURL(String eventapplyurl){ + this.EventApplyURL = eventapplyurl; + } + + public String getEventURL(){ + return this.EventURL; + } + // setting id + public void setEventURL(String eventurl){ + this.EventURL = eventurl; + } + + + public byte[] getEventImage(){ + return this.EventImage; + } + public byte[] setEventImage(byte[] eventimage){ + return this.EventImage=eventimage; + } + + + + public String getPastorCurrent(){ + return this.PastorCurrent; + } + // setting id + public void setPastorCurrent(String pastorcurrent){ + this.PastorCurrent = pastorcurrent; + } + + + public String getStatus(){ + return this.Status; + } + // setting id + public void setStatus(String status){ + this.Status = status; + } + + public String getFromDate() { + return FromDate; + } + + public void setFromDate(String fromDate) { + FromDate = fromDate; + } + + public String getTodate() { + return Todate; + } + + public void setTodate(String todate) { + Todate = todate; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/Class_District.java b/app/src/main/java/com/leadcampusapp/Class_District.java new file mode 100644 index 0000000..137dabb --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_District.java @@ -0,0 +1,98 @@ +package com.leadcampusapp; + +/** + * Created by User on 11/10/2017. + */ + +/* + 1 + Nicobar + Success + 1*/ + +public class Class_District { + + int id; + + String DistrictId; + String DistrictName; + String DistrictStatus; + String DStateId; + + /*1 + Nicobar + Success + 1 */ + + public Class_District(){ + + } + + + public Class_District(int id, String districtid, String districtname, String districtstatus, String dstateid){ + this.id = id; + this.DistrictId = districtid; + this.DistrictName = districtname; + this.DistrictStatus=districtstatus; + this.DStateId=dstateid; + + } + + + public Class_District(String districtid, String districtname, String districtstatus, String dstateid){ + + this.DistrictId = districtid; + this.DistrictName = districtname; + this.DistrictStatus=districtstatus; + this.DStateId=dstateid; + } + + //get and set + public String getdistrict_id(){ + return this.DistrictId; + } + public void setdistrict_id(String districtid){ + this.DistrictId = districtid; + } + + //get and set + public String getdistrict_name(){ + return this.DistrictName; + } + public void setdistrict_name(String districtname){ + this.DistrictName = districtname; + } + + + + //get and set + public String getdistrict_status(){ + return this.DistrictStatus; + } + public void setdistrict_status(String districtstatus){ + this.DistrictStatus = districtstatus; + } + + + //get and set + public String getdstateid_id(){ + return this.DStateId; + } + public void setdstateid_id(String dstateid){ + this.DStateId = dstateid; + } + + + public String toString() + { + return( this.DistrictName ); + } + + + + + + + + +}//end of class diff --git a/app/src/main/java/com/leadcampusapp/Class_FeesCatMaster.java b/app/src/main/java/com/leadcampusapp/Class_FeesCatMaster.java new file mode 100644 index 0000000..d8f9b49 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_FeesCatMaster.java @@ -0,0 +1,80 @@ +package com.leadcampusapp; + + + +/*anyType{vmGET_FeeCategory_Master=anyType{Fees_Category_Slno=1; fees_category_code=RG; +Fees_category_description=Registration; Fees=1; Fees_ID=486; academic_year=0; Status=Success; }; }*/ + +public class Class_FeesCatMaster +{ + + private String Fees_Category_Slno; + private String fees_category_code; + private String Fees_category_description; + + private String Fees; + private String Fees_ID; + private String academic_year; + private String Status; + + public String getFees_Category_Slno() { + return Fees_Category_Slno; + } + + public void setFees_Category_Slno(String fees_Category_Slno) { + Fees_Category_Slno = fees_Category_Slno; + } + + public String getFees_category_code() { + return fees_category_code; + } + + public void setFees_category_code(String fees_category_code) { + this.fees_category_code = fees_category_code; + } + + public String getFees_category_description() { + return Fees_category_description; + } + + public void setFees_category_description(String fees_category_description) { + Fees_category_description = fees_category_description; + } + + public String getFees() { + return Fees; + } + + public void setFees(String fees) { + Fees = fees; + } + + public String getFees_ID() { + return Fees_ID; + } + + public void setFees_ID(String fees_ID) { + Fees_ID = fees_ID; + } + + public String getAcademic_year() { + return academic_year; + } + + public void setAcademic_year(String academic_year) { + this.academic_year = academic_year; + } + + public String getStatus() { + return Status; + } + + public void setStatus(String status) { + Status = status; + } + + + public String toString() { + return Fees_category_description; + } +} diff --git a/app/src/main/java/com/leadcampusapp/Class_FeesCatg.java b/app/src/main/java/com/leadcampusapp/Class_FeesCatg.java new file mode 100644 index 0000000..e980978 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_FeesCatg.java @@ -0,0 +1,113 @@ +package com.leadcampusapp; + +/** + * Created by User on 10/02/2021. + */ + +public class Class_FeesCatg { + + int id; + + String Fees_Category_Slno; + String fees_category_code; + String Fees_category_description; + String academic_year; + String Fees; + String Fees_ID; + String Status; + + /*1 + Nicobar + Success + 1 */ + + public Class_FeesCatg(){ + + } + + public Class_FeesCatg(int id, String fees_Category_Slno, String fees_category_code, String fees_category_description, String academic_year, String status) { + this.id = id; + Fees_Category_Slno = fees_Category_Slno; + this.fees_category_code = fees_category_code; + Fees_category_description = fees_category_description; + this.academic_year = academic_year; + Status = status; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getFees_Category_Slno() { + return Fees_Category_Slno; + } + + public void setFees_Category_Slno(String fees_Category_Slno) { + Fees_Category_Slno = fees_Category_Slno; + } + + public String getFees_category_code() { + return fees_category_code; + } + + public void setFees_category_code(String fees_category_code) { + this.fees_category_code = fees_category_code; + } + + public String getFees_category_description() { + return Fees_category_description; + } + + public void setFees_category_description(String fees_category_description) { + Fees_category_description = fees_category_description; + } + + public String getAcademic_year() { + return academic_year; + } + + public void setAcademic_year(String academic_year) { + this.academic_year = academic_year; + } + + public String getStatus() { + return Status; + } + + public void setStatus(String status) { + Status = status; + } + + public String getFees() { + return Fees; + } + + public void setFees(String fees) { + Fees = fees; + } + + public String getFees_ID() { + return Fees_ID; + } + + public void setFees_ID(String fees_ID) { + Fees_ID = fees_ID; + } + + public String toString() + { + return( this.Fees_category_description ); + } + + + + + + + + +}//end of class diff --git a/app/src/main/java/com/leadcampusapp/Class_FileUtil_forImage.java b/app/src/main/java/com/leadcampusapp/Class_FileUtil_forImage.java new file mode 100644 index 0000000..dec8682 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_FileUtil_forImage.java @@ -0,0 +1,109 @@ +package com.leadcampusapp; + +import android.content.Context; +import android.database.Cursor; +import android.net.Uri; +import android.provider.OpenableColumns; +import android.util.Log; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +class Class_FileUtil_forImage { + private static final int EOF = -1; + private static final int DEFAULT_BUFFER_SIZE = 1024 * 4; + + private Class_FileUtil_forImage() { + + } + + public static File from(Context context, Uri uri) throws IOException { + InputStream inputStream = context.getContentResolver().openInputStream(uri); + String fileName = getFileName(context, uri); + String[] splitName = splitFileName(fileName); + File tempFile = File.createTempFile(splitName[0], splitName[1]); + tempFile = rename(tempFile, fileName); + tempFile.deleteOnExit(); + FileOutputStream out = null; + try { + out = new FileOutputStream(tempFile); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + if (inputStream != null) { + copy(inputStream, out); + inputStream.close(); + } + + if (out != null) { + out.close(); + } + return tempFile; + } + + private static String[] splitFileName(String fileName) { + String name = fileName; + String extension = ""; + int i = fileName.lastIndexOf("."); + if (i != -1) { + name = fileName.substring(0, i); + extension = fileName.substring(i); + } + + return new String[]{name, extension}; + } + + private static String getFileName(Context context, Uri uri) { + String result = null; + if (uri.getScheme().equals("content")) { + Cursor cursor = context.getContentResolver().query(uri, null, null, null, null); + try { + if (cursor != null && cursor.moveToFirst()) { + result = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME)); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (cursor != null) { + cursor.close(); + } + } + } + if (result == null) { + result = uri.getPath(); + int cut = result.lastIndexOf(File.separator); + if (cut != -1) { + result = result.substring(cut + 1); + } + } + return result; + } + + private static File rename(File file, String newName) { + File newFile = new File(file.getParent(), newName); + if (!newFile.equals(file)) { + if (newFile.exists() && newFile.delete()) { + Log.d("Class_FileUtil_forImage", "Delete old " + newName + " file"); + } + if (file.renameTo(newFile)) { + Log.d("Class_FileUtil_forImage", "Rename file to " + newName); + } + } + return newFile; + } + + private static long copy(InputStream input, OutputStream output) throws IOException { + long count = 0; + int n; + byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; + while (EOF != (n = input.read(buffer))) { + output.write(buffer, 0, n); + count += n; + } + return count; + } +} diff --git a/app/src/main/java/com/leadcampusapp/Class_FromToDate.java b/app/src/main/java/com/leadcampusapp/Class_FromToDate.java new file mode 100644 index 0000000..80705a5 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_FromToDate.java @@ -0,0 +1,59 @@ +package com.leadcampusapp; + +public class Class_FromToDate { + + String Academic_Id; + String Academic_Code; + String Year_Code; + String From_Date; + String To_Date; + String Status; + + public String getAcademic_Id() { + return Academic_Id; + } + + public void setAcademic_Id(String academic_Id) { + Academic_Id = academic_Id; + } + + public String getAcademic_Code() { + return Academic_Code; + } + + public void setAcademic_Code(String academic_Code) { + Academic_Code = academic_Code; + } + + public String getYear_Code() { + return Year_Code; + } + + public void setYear_Code(String year_Code) { + Year_Code = year_Code; + } + + public String getFrom_Date() { + return From_Date; + } + + public void setFrom_Date(String from_Date) { + From_Date = from_Date; + } + + public String getTo_Date() { + return To_Date; + } + + public void setTo_Date(String to_Date) { + To_Date = to_Date; + } + + public String getStatus() { + return Status; + } + + public void setStatus(String status) { + Status = status; + } +} diff --git a/app/src/main/java/com/leadcampusapp/Class_FundStudList.java b/app/src/main/java/com/leadcampusapp/Class_FundStudList.java new file mode 100644 index 0000000..30e5fbf --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_FundStudList.java @@ -0,0 +1,128 @@ +package com.leadcampusapp; + +import java.util.List; + +public class Class_FundStudList { + /* 37003 + MH03842 + One Test edit + 7619298575 + mallikarjun.tech@dfmail.com + Malnad College + 3rd year (6th sem) + Success + + + 53433 + First project + 25 + 12 + 12 + 0 + 12 + success + + + 53435 + Web Project modify in mobile + 30 + 10 + 10 + 0 + 10 + success + + + */ + String Registration_Id; + String Student_Name; + String Mobile_No; + String Email_Id; + String Lead_Id; + String College_Name; + String Sem_Name; + String Status; + private Class_Fund_Details[] Fund_details; + + List Fund_Details; + + public String getRegistration_Id() { + return Registration_Id; + } + + public void setRegistration_Id(String registration_Id) { + Registration_Id = registration_Id; + } + + public String getStudent_Name() { + return Student_Name; + } + + public void setStudent_Name(String student_Name) { + Student_Name = student_Name; + } + + public String getMobile_No() { + return Mobile_No; + } + + public void setMobile_No(String mobile_No) { + Mobile_No = mobile_No; + } + + public String getEmail_Id() { + return Email_Id; + } + + public void setEmail_Id(String email_Id) { + Email_Id = email_Id; + } + + public String getLead_Id() { + return Lead_Id; + } + + public void setLead_Id(String lead_Id) { + Lead_Id = lead_Id; + } + + public String getCollege_Name() { + return College_Name; + } + + public void setCollege_Name(String college_Name) { + College_Name = college_Name; + } + + public String getSem_Name() { + return Sem_Name; + } + + public void setSem_Name(String sem_Name) { + Sem_Name = sem_Name; + } + + public String getStatus() { + return Status; + } + + public void setStatus(String status) { + Status = status; + } + + /* public List getFund_Details() { + return Fund_Details; + }*/ + + public void setFund_Details(List fund_Details) { + Fund_Details = fund_Details; + } + + public Class_Fund_Details[] getFund_details() { + return Fund_details; + } + + public void setFund_details(Class_Fund_Details[] fund_details) { + Fund_details = fund_details; + } +} diff --git a/app/src/main/java/com/leadcampusapp/Class_Fund_Details.java b/app/src/main/java/com/leadcampusapp/Class_Fund_Details.java new file mode 100644 index 0000000..9f5c2d3 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_Fund_Details.java @@ -0,0 +1,112 @@ +package com.leadcampusapp; + +public class Class_Fund_Details { + /* + 53433 + First project + 25 + 12 + 12 + 0 + 12 + success + */ + + String PDID; + String Project_Title; + String Requested_Amount; + String Santioned_Amount; + String Released_Amount; + String Total_Released_Amount; + String Balance_Amount; + String Status; + String Registration_Id; + + + public String getPDID() { + return PDID; + } + + public void setPDID(String PDID) { + this.PDID = PDID; + } + + public String getProject_Title() { + return Project_Title; + } + + public void setProject_Title(String project_Title) { + Project_Title = project_Title; + } + + public String getRequested_Amount() { + return Requested_Amount; + } + + public void setRequested_Amount(String requested_Amount) { + Requested_Amount = requested_Amount; + } + + public String getSantioned_Amount() { + return Santioned_Amount; + } + + public void setSantioned_Amount(String santioned_Amount) { + Santioned_Amount = santioned_Amount; + } + + public String getReleased_Amount() { + return Released_Amount; + } + + public void setReleased_Amount(String released_Amount) { + Released_Amount = released_Amount; + } + + public String getTotal_Released_Amount() { + return Total_Released_Amount; + } + + public void setTotal_Released_Amount(String total_Released_Amount) { + Total_Released_Amount = total_Released_Amount; + } + + public String getBalance_Amount() { + return Balance_Amount; + } + + public void setBalance_Amount(String balance_Amount) { + Balance_Amount = balance_Amount; + } + + public String getStatus() { + return Status; + } + + public void setStatus(String status) { + Status = status; + } + + public String getRegistration_Id() { + return Registration_Id; + } + + public void setRegistration_Id(String registration_Id) { + Registration_Id = registration_Id; + } + + public Class_Fund_Details(String PDID, String project_Title, String requested_Amount, String santioned_Amount, String released_Amount, String total_Released_Amount, String balance_Amount, String status, String registration_Id) { + this.PDID = PDID; + Project_Title = project_Title; + Requested_Amount = requested_Amount; + Santioned_Amount = santioned_Amount; + Released_Amount = released_Amount; + Total_Released_Amount = total_Released_Amount; + Balance_Amount = balance_Amount; + Status = status; + Registration_Id =registration_Id; + } + + public Class_Fund_Details() { + } +} diff --git a/app/src/main/java/com/leadcampusapp/Class_HintSpinnerAdapter.java b/app/src/main/java/com/leadcampusapp/Class_HintSpinnerAdapter.java new file mode 100644 index 0000000..153714e --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_HintSpinnerAdapter.java @@ -0,0 +1,30 @@ +package com.leadcampusapp; + +/** + * Created by User on 23/7/18. + */ + + import android.content.Context; + import android.widget.ArrayAdapter; + +public class Class_HintSpinnerAdapter extends ArrayAdapter { + + public Class_HintSpinnerAdapter(Context context, int textViewResourceId) { + super(context, textViewResourceId); + // TODO Auto-generated constructor stub + + } + + @Override + public int getCount() { + + // TODO Auto-generated method stub + int count = super.getCount(); + + return count>0 ? count-1 : count ; + + + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/Class_InternetDectector.java b/app/src/main/java/com/leadcampusapp/Class_InternetDectector.java new file mode 100644 index 0000000..06eeb92 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_InternetDectector.java @@ -0,0 +1,43 @@ +package com.leadcampusapp; + +import android.content.Context; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; + +public class Class_InternetDectector { + + private Context _context; + + public Class_InternetDectector(Context context){ + this._context = context; + } + + public boolean isConnectingToInternet() + { + + ConnectivityManager connectivity = (ConnectivityManager) _context.getSystemService(Context.CONNECTIVITY_SERVICE); + if (connectivity != null) + { + NetworkInfo[] info = connectivity.getAllNetworkInfo(); + + NetworkInfo wifiNetwork = connectivity.getNetworkInfo(ConnectivityManager.TYPE_WIFI); + if (wifiNetwork != null && wifiNetwork.isConnected()) { + return true; + } + + NetworkInfo mobileNetwork = connectivity.getNetworkInfo(ConnectivityManager.TYPE_MOBILE); + if (mobileNetwork != null && mobileNetwork.isConnected()) { + return true; + } + + /*if (info != null) + for (int i = 0; i < info.length; i++) + if (info[i].getState() == NetworkInfo.State.CONNECTED) + { + return true; + }*/ + + } + return false; + } +} diff --git a/app/src/main/java/com/leadcampusapp/Class_ManagerSummary.java b/app/src/main/java/com/leadcampusapp/Class_ManagerSummary.java new file mode 100644 index 0000000..60c3ea8 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_ManagerSummary.java @@ -0,0 +1,68 @@ +package com.leadcampusapp; + +public class Class_ManagerSummary { + + String Fees_Category_Id; + String Fees_Category_Name; + String Collected; + String Submitted; + String Balance; + String Total; + String Status; + + public String getFees_Category_Id() { + return Fees_Category_Id; + } + + public void setFees_Category_Id(String fees_Category_Id) { + Fees_Category_Id = fees_Category_Id; + } + + public String getFees_Category_Name() { + return Fees_Category_Name; + } + + public void setFees_Category_Name(String fees_Category_Name) { + Fees_Category_Name = fees_Category_Name; + } + + public String getCollected() { + return Collected; + } + + public void setCollected(String collected) { + Collected = collected; + } + + public String getSubmitted() { + return Submitted; + } + + public void setSubmitted(String submitted) { + Submitted = submitted; + } + + public String getBalance() { + return Balance; + } + + public void setBalance(String balance) { + Balance = balance; + } + + public String getTotal() { + return Total; + } + + public void setTotal(String total) { + Total = total; + } + + public String getStatus() { + return Status; + } + + public void setStatus(String status) { + Status = status; + } +} diff --git a/app/src/main/java/com/leadcampusapp/Class_ManagerSummaryDetails.java b/app/src/main/java/com/leadcampusapp/Class_ManagerSummaryDetails.java new file mode 100644 index 0000000..ba26b02 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_ManagerSummaryDetails.java @@ -0,0 +1,140 @@ +package com.leadcampusapp; + +public class Class_ManagerSummaryDetails { + + String Submission_slno; + String Fees_Category_Id; + String Fees_Category_description; + String Submission_Amount; + String Submitted_Date; + String Submitted_Mode; + String Submitted_Remark; + String Submitted_By; + String Rec_Status; + String Submitter_Name; + String Rec_Date; + String Rec_By; + String Rec_Mail_id; + String Rec_Remark; + String Status; + + public String getSubmission_slno() { + return Submission_slno; + } + + public void setSubmission_slno(String submission_slno) { + Submission_slno = submission_slno; + } + + public String getFees_Category_Id() { + return Fees_Category_Id; + } + + public void setFees_Category_Id(String fees_Category_Id) { + Fees_Category_Id = fees_Category_Id; + } + + public String getFees_Category_description() { + return Fees_Category_description; + } + + public void setFees_Category_description(String fees_Category_description) { + Fees_Category_description = fees_Category_description; + } + + public String getSubmission_Amount() { + return Submission_Amount; + } + + public void setSubmission_Amount(String submission_Amount) { + Submission_Amount = submission_Amount; + } + + public String getSubmitted_Date() { + return Submitted_Date; + } + + public void setSubmitted_Date(String submitted_Date) { + Submitted_Date = submitted_Date; + } + + public String getSubmitted_Mode() { + return Submitted_Mode; + } + + public void setSubmitted_Mode(String submitted_Mode) { + Submitted_Mode = submitted_Mode; + } + + public String getSubmitted_Remark() { + return Submitted_Remark; + } + + public void setSubmitted_Remark(String submitted_Remark) { + Submitted_Remark = submitted_Remark; + } + + public String getSubmitted_By() { + return Submitted_By; + } + + public void setSubmitted_By(String submitted_By) { + Submitted_By = submitted_By; + } + + public String getRec_Status() { + return Rec_Status; + } + + public void setRec_Status(String rec_Status) { + Rec_Status = rec_Status; + } + + public String getSubmitter_Name() { + return Submitter_Name; + } + + public void setSubmitter_Name(String submitter_Name) { + Submitter_Name = submitter_Name; + } + + public String getRec_Date() { + return Rec_Date; + } + + public void setRec_Date(String rec_Date) { + Rec_Date = rec_Date; + } + + public String getRec_By() { + return Rec_By; + } + + public void setRec_By(String rec_By) { + Rec_By = rec_By; + } + + public String getRec_Mail_id() { + return Rec_Mail_id; + } + + public void setRec_Mail_id(String rec_Mail_id) { + Rec_Mail_id = rec_Mail_id; + } + + public String getRec_Remark() { + return Rec_Remark; + } + + public void setRec_Remark(String rec_Remark) { + Rec_Remark = rec_Remark; + } + + public String getStatus() { + return Status; + } + + public void setStatus(String status) { + Status = status; + } +} diff --git a/app/src/main/java/com/leadcampusapp/Class_PaidStudList.java b/app/src/main/java/com/leadcampusapp/Class_PaidStudList.java new file mode 100644 index 0000000..eee2949 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_PaidStudList.java @@ -0,0 +1,236 @@ +package com.leadcampusapp; + +public class Class_PaidStudList { + /* 40 + MH02868 + mamata gundu karambalkar + 35909 + 1 + 22-February-21 + 22-02-2021 04:02;59 04:26:59 PM + 36 + 0 + 0 + Registration + Completed + 2020-21 + + + Manager + Cash + test yest + + + + + + 0 + Success*/ + + String Payment_Id,Lead_Id,StudentName,Registration_Id,Paid_Fees; + String paid_date,Created_Date,Auto_Receipt_No,transanction_Id,reference_id; + String Fees_Category_description,transactionStatus,YearCode,Payment_Type,Payeer_Id; + String Created_User_Type,Payment_Mode,Payment_Remark,Manager_Submission_Status,Payment_Receipt_Path; + String Rec_Date,Rec_Remark,Rec_By,Rec_Status; + String Status; + + public String getPayment_Id() { + return Payment_Id; + } + + public void setPayment_Id(String payment_Id) { + Payment_Id = payment_Id; + } + + public String getLead_Id() { + return Lead_Id; + } + + public void setLead_Id(String lead_Id) { + Lead_Id = lead_Id; + } + + public String getStudentName() { + return StudentName; + } + + public void setStudentName(String studentName) { + StudentName = studentName; + } + + public String getRegistration_Id() { + return Registration_Id; + } + + public void setRegistration_Id(String registration_Id) { + Registration_Id = registration_Id; + } + + public String getPaid_Fees() { + return Paid_Fees; + } + + public void setPaid_Fees(String paid_Fees) { + Paid_Fees = paid_Fees; + } + + public String getPaid_date() { + return paid_date; + } + + public void setPaid_date(String paid_date) { + this.paid_date = paid_date; + } + + public String getCreated_Date() { + return Created_Date; + } + + public void setCreated_Date(String created_Date) { + Created_Date = created_Date; + } + + public String getAuto_Receipt_No() { + return Auto_Receipt_No; + } + + public void setAuto_Receipt_No(String auto_Receipt_No) { + Auto_Receipt_No = auto_Receipt_No; + } + + public String getTransanction_Id() { + return transanction_Id; + } + + public void setTransanction_Id(String transanction_Id) { + this.transanction_Id = transanction_Id; + } + + public String getReference_id() { + return reference_id; + } + + public void setReference_id(String reference_id) { + this.reference_id = reference_id; + } + + public String getFees_Category_description() { + return Fees_Category_description; + } + + public void setFees_Category_description(String fees_Category_description) { + Fees_Category_description = fees_Category_description; + } + + public String getTransactionStatus() { + return transactionStatus; + } + + public void setTransactionStatus(String transactionStatus) { + this.transactionStatus = transactionStatus; + } + + public String getYearCode() { + return YearCode; + } + + public void setYearCode(String yearCode) { + YearCode = yearCode; + } + + public String getPayment_Type() { + return Payment_Type; + } + + public void setPayment_Type(String payment_Type) { + Payment_Type = payment_Type; + } + + public String getPayeer_Id() { + return Payeer_Id; + } + + public void setPayeer_Id(String payeer_Id) { + Payeer_Id = payeer_Id; + } + + public String getCreated_User_Type() { + return Created_User_Type; + } + + public void setCreated_User_Type(String created_User_Type) { + Created_User_Type = created_User_Type; + } + + public String getPayment_Mode() { + return Payment_Mode; + } + + public void setPayment_Mode(String payment_Mode) { + Payment_Mode = payment_Mode; + } + + public String getPayment_Remark() { + return Payment_Remark; + } + + public void setPayment_Remark(String payment_Remark) { + Payment_Remark = payment_Remark; + } + + public String getManager_Submission_Status() { + return Manager_Submission_Status; + } + + public void setManager_Submission_Status(String manager_Submission_Status) { + Manager_Submission_Status = manager_Submission_Status; + } + + public String getPayment_Receipt_Path() { + return Payment_Receipt_Path; + } + + public void setPayment_Receipt_Path(String payment_Receipt_Path) { + Payment_Receipt_Path = payment_Receipt_Path; + } + + public String getRec_Date() { + return Rec_Date; + } + + public void setRec_Date(String rec_Date) { + Rec_Date = rec_Date; + } + + public String getRec_Remark() { + return Rec_Remark; + } + + public void setRec_Remark(String rec_Remark) { + Rec_Remark = rec_Remark; + } + + public String getRec_By() { + return Rec_By; + } + + public void setRec_By(String rec_By) { + Rec_By = rec_By; + } + + public String getRec_Status() { + return Rec_Status; + } + + public void setRec_Status(String rec_Status) { + Rec_Status = rec_Status; + } + + public String getStatus() { + return Status; + } + + public void setStatus(String status) { + Status = status; + } +} diff --git a/app/src/main/java/com/leadcampusapp/Class_PastEvents.java b/app/src/main/java/com/leadcampusapp/Class_PastEvents.java new file mode 100644 index 0000000..590c1ec --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_PastEvents.java @@ -0,0 +1,78 @@ +package com.leadcampusapp; + +/** + * Created by User on 24/7/18. + */ + +public class Class_PastEvents +{ + int _id; + + byte[] EventImage; //string + String PastorCurrent; //int + String Status; //string + String PastEventURL; + + + + public Class_PastEvents() { + } + + + public Class_PastEvents(int id, byte[] eventimage, String pastorcurrent, String status,String pasteventurl) { + this._id = id; + this.EventImage = eventimage; + this.PastorCurrent=pastorcurrent; + this.Status=status; + this.PastEventURL = pasteventurl; + } + + + + public Class_PastEvents(byte[] eventimage, String pastorcurrent, String status,String pasteventurl) + { + this.EventImage = eventimage; + this.PastorCurrent=pastorcurrent; + this.Status=status; + this.PastEventURL = pasteventurl; + } + + + public byte[] getEventImage(){ + return this.EventImage; + } + public byte[] setEventImage(byte[] eventimage){ + return this.EventImage=eventimage; + } + + + public String getPastorCurrent(){ + return this.PastorCurrent; + } + // setting id + public void setPastorCurrent(String pastorcurrent){ + this.PastorCurrent = pastorcurrent; + } + + + public String getStatus(){ + return this.Status; + } + // setting id + public void setStatus(String status){ + this.Status = status; + } + + + + public String getPastEventURL(){ + return this.PastEventURL; + } + public void setPastEventURL(String pastEventURL) + { + this.PastEventURL=pastEventURL; + } + + + +}//end of class diff --git a/app/src/main/java/com/leadcampusapp/Class_PaymentMode.java b/app/src/main/java/com/leadcampusapp/Class_PaymentMode.java new file mode 100644 index 0000000..b04618a --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_PaymentMode.java @@ -0,0 +1,62 @@ +package com.leadcampusapp; + +/** + * Created by User on 11/10/2017. + */ + +public class Class_PaymentMode { + + + int id; + + String payment_mode_slno; + String short_code; + String description; + String Status; + + + public Class_PaymentMode(){ + + } + + public String getPayment_mode_slno() { + return payment_mode_slno; + } + + public void setPayment_mode_slno(String payment_mode_slno) { + this.payment_mode_slno = payment_mode_slno; + } + + public String getShort_code() { + return short_code; + } + + public void setShort_code(String short_code) { + this.short_code = short_code; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getStatus() { + return Status; + } + + public void setStatus(String status) { + Status = status; + } + + public String toString() + { + return( this.description ); + } + + + + +}//end of class diff --git a/app/src/main/java/com/leadcampusapp/Class_Program.java b/app/src/main/java/com/leadcampusapp/Class_Program.java new file mode 100644 index 0000000..f252161 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_Program.java @@ -0,0 +1,86 @@ +package com.leadcampusapp; + +/** + * Created by User on 12/7/18. + */ + +public class Class_Program +{ + int id; + + String ProgramId; + String ProgramName; + String ProgramStatus; + + + /* long + string + string*/ + + + + + public Class_Program(){ + + } + + + + + public Class_Program(int id, String programId, String programname, String programstatus){ + this.id = id; + this.ProgramId = programId; + this.ProgramName = programname; + this.ProgramStatus=programstatus; + + + } + + public Class_Program(String programId, String programname, String programstatus){ + + this.ProgramId = programId; + this.ProgramName = programname; + this.ProgramStatus=programstatus; + } + + + //get and set + public String getprogram_id(){ + return this.ProgramId; + } + public void setprogram_id(String programId){ + this.ProgramId = programId; + } + + + + //get and set + public String getprog_name(){ + return this.ProgramName; + } + public void setprog_name(String programname){ + this.ProgramName = programname; + } + + + + + //get and set + public String getprog_status(){ + return this.ProgramStatus; + } + public void setprog_status(String programstatus){ + this.ProgramStatus = programstatus; + } + + + + //set the string + public String toString() + { + return( this.ProgramName ); + } + + + +} diff --git a/app/src/main/java/com/leadcampusapp/Class_Project_FundMain.java b/app/src/main/java/com/leadcampusapp/Class_Project_FundMain.java new file mode 100644 index 0000000..7ce8589 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_Project_FundMain.java @@ -0,0 +1,56 @@ +package com.leadcampusapp; + +public class Class_Project_FundMain { + + String Slno; + String Ticket_Status; + String Manager_Alert_Days; + String Account_Alert_Days; + String Status; + + public String getSlno() { + return Slno; + } + + public void setSlno(String slno) { + Slno = slno; + } + + public String getTicket_Status() { + return Ticket_Status; + } + + public void setTicket_Status(String ticket_Status) { + Ticket_Status = ticket_Status; + } + + public String getManager_Alert_Days() { + return Manager_Alert_Days; + } + + public void setManager_Alert_Days(String manager_Alert_Days) { + Manager_Alert_Days = manager_Alert_Days; + } + + public String getAccount_Alert_Days() { + return Account_Alert_Days; + } + + public void setAccount_Alert_Days(String account_Alert_Days) { + Account_Alert_Days = account_Alert_Days; + } + + public String getStatus() { + return Status; + } + + public void setStatus(String status) { + Status = status; + } + + public String toString() + { + return( this.Ticket_Status ); + } + +} diff --git a/app/src/main/java/com/leadcampusapp/Class_Sem.java b/app/src/main/java/com/leadcampusapp/Class_Sem.java new file mode 100644 index 0000000..7aa32f6 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_Sem.java @@ -0,0 +1,87 @@ +package com.leadcampusapp; + +/** + * Created by User on 12/7/18. + */ + + + + + + +public class Class_Sem +{ + + int id; + + String SemId; + String SemName; + String SemStatus; + + + /*long +string +string*/ + + + + public Class_Sem(){ + + } + + + public Class_Sem(int id, String semId, String semname, String semstatus){ + this.id = id; + this.SemId = semId; + this.SemName = semname; + this.SemStatus=semstatus; + + } + + public Class_Sem(String semId, String semname, String semstatus){ + + this.SemId = semId; + this.SemName = semname; + this.SemStatus=semstatus; + } + + + + //get and set + public String getsem_id(){ + return this.SemId; + } + public void setsem_id(String semId){ + this.SemId = semId; + } + + + + + //get and set + public String getsem_name(){ + return this.SemName; + } + public void setsem_name(String semname){ + this.SemName = semname; + } + + + //get and set + public String getsem_status(){ + return this.SemStatus; + } + public void setsem_status(String semstatus){ + this.SemStatus = semstatus; + } + + + //set the string + public String toString() + { + return( this.SemName ); + } + + + +}// end of class diff --git a/app/src/main/java/com/leadcampusapp/Class_States.java b/app/src/main/java/com/leadcampusapp/Class_States.java new file mode 100644 index 0000000..0aaaac4 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_States.java @@ -0,0 +1,77 @@ +package com.leadcampusapp; + +/** + * Created by User on 11/10/2017. + */ + +public class Class_States { + + + int id; + + String StateId; + String StateName; + String StateStatus; + + /* 1 + Andaman and Nicobar Islands + Success + */ + + public Class_States(){ + + } + + + public Class_States(int id, String stateid, String statename, String statestatus){ + this.id = id; + this.StateId = stateid; + this.StateName = statename; + this.StateStatus=statestatus; + + } + + + public Class_States(String stateid, String statename, String statestatus){ + + this.StateId = stateid; + this.StateName = statename; + this.StateStatus=statestatus; + } + + //get and set + public String getstate_id(){ + return this.StateId; + } + public void setstate_id(String stateid){ + this.StateId = stateid; + } + + //get and set + public String getstate_name(){ + return this.StateName; + } + public void setstate_name(String statename){ + this.StateName = statename; + } + + + + //get and set + public String getstate_status(){ + return this.StateStatus; + } + public void setstate_status(String statestatus){ + this.StateStatus = statestatus; + } + + + public String toString() + { + return( this.StateName ); + } + + + + +}//end of class diff --git a/app/src/main/java/com/leadcampusapp/Class_Taluk.java b/app/src/main/java/com/leadcampusapp/Class_Taluk.java new file mode 100644 index 0000000..f08afb3 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_Taluk.java @@ -0,0 +1,91 @@ +package com.leadcampusapp; + +/** + * Created by User on 11/13/2017. + */ + +public class Class_Taluk +{ + + int id; + + String TalukId; + String Taluk_DID; + String TalukName; + String TalukStatus; + + /* + 70 + 266 + Hubli + Success + + */ + + public Class_Taluk(){ + + } + + + + public Class_Taluk(int id, String talukId, String taluk_did, String talukname, String talukstatus){ + this.id = id; + this.TalukId = talukId; + this.Taluk_DID=taluk_did; + this.TalukName = talukname; + this.TalukStatus=talukstatus; + } + + public Class_Taluk(String talukId, String taluk_did, String talukname, String talukstatus){ + + this.TalukId = talukId; + this.Taluk_DID=taluk_did; + this.TalukName = talukname; + this.TalukStatus=talukstatus; + } + + + + //get and set + public String gettaluk_id(){ + return this.TalukId; + } + public void settaluk_id(String talukId){ + this.TalukId = talukId; + } + + //get and set + public String gettaluk_did(){ + return this.Taluk_DID; + } + public void settaluk_did(String taluk_did){ + this.Taluk_DID = taluk_did; + } + + + //get and set + public String gettalukname(){ + return this.TalukName; + } + public void settalukname(String talukname){ + this.TalukName = talukname; + } + + + //get and set + public String gettalukstatus(){ + return this.TalukStatus; + } + public void settalukstatus(String talukstatus){ + this.TalukStatus = talukstatus; + } + + + //set the string + public String toString() + { + return( this.TalukName ); + } + + +}// end of class diff --git a/app/src/main/java/com/leadcampusapp/Class_URL.java b/app/src/main/java/com/leadcampusapp/Class_URL.java new file mode 100644 index 0000000..b507c69 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_URL.java @@ -0,0 +1,68 @@ +package com.leadcampusapp; + +/** + * Created by User on 2/8/18. + */ + +public class Class_URL +{ + public String packagename="com.leadcampusapp."; + + /*public static String URL_Login ="http://mis.leadcampus.org/leadws/Login.asmx?WSDL"; + + public static String URL_Projects ="http://mis.leadcampus.org/leadws/Projectsws.asmx?WSDL"; + public static String URL_Manager ="http://mis.leadcampus.org/leadws/Managerws.asmx?WSDL"; + public static String ServerPath ="http://mis.leadcampus.org/";*/ + + + + + /* public static String URL_Login ="https://mis.leadcampus.org/leadws/Login.asmx?WSDL"; + + public static String URL_Projects ="https://mis.leadcampus.org/leadws/Projectsws.asmx?WSDL"; + public static String URL_Manager ="https://mis.leadcampus.org/leadws/Managerws.asmx?WSDL"; + public static String ServerPath ="https://mis.leadcampus.org/";*/ + + +//Testbed + + public static String URL_Login ="https://mis.leadcampus.org:8084/leadws/Login.asmx?WSDL"; + + public static String URL_Projects ="https://mis.leadcampus.org:8084/leadws/Projectsws.asmx?WSDL"; + public static String URL_Manager ="https://mis.leadcampus.org:8084/leadws/Managerws.asmx?WSDL"; + public static String ServerPath ="https://mis.leadcampus.org:8084/"; + //Testbed + + /*public static String URL_Login ="http://mis.leadcampus.org:8000/leadws/Login.asmx?WSDL"; + + public static String URL_Projects ="http://mis.leadcampus.org:8000/leadws/Projectsws.asmx?WSDL"; + public static String URL_Manager ="http://mis.leadcampus.org:8000/leadws/Managerws.asmx?WSDL"; + public static String ServerPath ="http://mis.leadcampus.org:8000/";*/ + + + + + //http://testbed.dfindia.org/leadws/Login.asmx + + + /*public static String URL_Login ="http://testbed.dfindia.org/leadws/Login.asmx?WSDL"; + public static String URL_Projects ="http://testbed.dfindia.org/leadws/Projectsws.asmx?WSDL"; + public static String URL_Manager ="http://testbed.dfindia.org/leadws/Managerws.asmx?WSDL"; + + public static String ServerPath ="http://testbed.dfindia.org/";*/ + + + + + + // public static String URL_Login ="http://testbed.dfindia.org/leadws/Login.asmx?WSDL"; + /* public static String URL_Login ="http://testbed.dfindia.org/leadws/Login.asmx?WSDL"; + public static String URL_Projects ="http://testbed.dfindia.org/leadws/Projectsws.asmx?WSDL"; + public static String URL_Manager ="http://testbed.dfindia.org/leadws/Managerws.asmx?WSDL"; + // public static String ServerPath ="http://mis.leadcampus.org/"; + public static String ServerPath ="http://testbed.dfindia.org/";*/ + + + + +} diff --git a/app/src/main/java/com/leadcampusapp/Class_UnpaidStudList.java b/app/src/main/java/com/leadcampusapp/Class_UnpaidStudList.java new file mode 100644 index 0000000..8ec5d9b --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_UnpaidStudList.java @@ -0,0 +1,184 @@ +package com.leadcampusapp; + +public class Class_UnpaidStudList { + /* 51311 + Ashwini Nalawade + 9019319197 + ashwininalawade872@gmail.com + MJ00924 + 17 + 256 + 15 + 110 + DMS Mandal`s BCA College of computer application + 17 + 1/18/2021 8:40:16 PM + 1 + 0 + Success + 0 + 0 */ + String Registration_Id; + String StudentName; + String MobileNo; + String MaidId; + String Lead_id; + String StateCode; + String DistrictCode; + String TalukaCode; + String CollegeCode; + String CollegeName; + String StreamId; + String RegistrationDate; + String Fees; + String isFeePaid; + String Status; + String projectcount; + String RequestedId; + String Payment_Mode; + + + public String getRegistration_Id() { + return Registration_Id; + } + + public void setRegistration_Id(String registration_Id) { + Registration_Id = registration_Id; + } + + public String getStudentName() { + return StudentName; + } + + public void setStudentName(String studentName) { + StudentName = studentName; + } + + public String getMobileNo() { + return MobileNo; + } + + public void setMobileNo(String mobileNo) { + MobileNo = mobileNo; + } + + public String getMaidId() { + return MaidId; + } + + public void setMaidId(String maidId) { + MaidId = maidId; + } + + public String getLead_id() { + return Lead_id; + } + + public void setLead_id(String lead_id) { + Lead_id = lead_id; + } + + public String getStateCode() { + return StateCode; + } + + public void setStateCode(String stateCode) { + StateCode = stateCode; + } + + public String getDistrictCode() { + return DistrictCode; + } + + public void setDistrictCode(String districtCode) { + DistrictCode = districtCode; + } + + public String getTalukaCode() { + return TalukaCode; + } + + public void setTalukaCode(String talukaCode) { + TalukaCode = talukaCode; + } + + public String getCollegeCode() { + return CollegeCode; + } + + public void setCollegeCode(String collegeCode) { + CollegeCode = collegeCode; + } + + public String getCollegeName() { + return CollegeName; + } + + public void setCollegeName(String collegeName) { + CollegeName = collegeName; + } + + public String getStreamId() { + return StreamId; + } + + public void setStreamId(String streamId) { + StreamId = streamId; + } + + public String getRegistrationDate() { + return RegistrationDate; + } + + public void setRegistrationDate(String registrationDate) { + RegistrationDate = registrationDate; + } + + public String getFees() { + return Fees; + } + + public void setFees(String fees) { + Fees = fees; + } + + public String getIsFeePaid() { + return isFeePaid; + } + + public void setIsFeePaid(String isFeePaid) { + this.isFeePaid = isFeePaid; + } + + public String getStatus() { + return Status; + } + + public void setStatus(String status) { + Status = status; + } + + public String getProjectcount() { + return projectcount; + } + + public void setProjectcount(String projectcount) { + this.projectcount = projectcount; + } + + public String getRequestedId() { + return RequestedId; + } + + public void setRequestedId(String requestedId) { + RequestedId = requestedId; + } + + public String getPayment_Mode() { + return Payment_Mode; + } + + public void setPayment_Mode(String payment_Mode) { + Payment_Mode = payment_Mode; + } +} diff --git a/app/src/main/java/com/leadcampusapp/Class_YearList.java b/app/src/main/java/com/leadcampusapp/Class_YearList.java new file mode 100644 index 0000000..92e2cba --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_YearList.java @@ -0,0 +1,37 @@ +package com.leadcampusapp; + +public class Class_YearList { + + String slno; + String AcademicCode; + String Status; + + public String getSlno() { + return slno; + } + + public void setSlno(String slno) { + this.slno = slno; + } + + public String getAcademicCode() { + return AcademicCode; + } + + public void setAcademicCode(String academicCode) { + AcademicCode = academicCode; + } + + public String getStatus() { + return Status; + } + + public void setStatus(String status) { + Status = status; + } + public String toString() + { + return( this.AcademicCode ); + } + +} diff --git a/app/src/main/java/com/leadcampusapp/Class_alert_msg.java b/app/src/main/java/com/leadcampusapp/Class_alert_msg.java new file mode 100644 index 0000000..1f5762e --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_alert_msg.java @@ -0,0 +1,134 @@ +package com.leadcampusapp; + +import android.app.Activity; +import android.app.AlertDialog; +import android.app.FragmentManager; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.graphics.Color; + +public class Class_alert_msg +{ + private final Context mContext; + + private FragmentManager fragmentManager; + + public Class_alert_msg(Context context) { + this.mContext = context; + + } + + + + + + + public static void alerts_dialog(String str_error,String ws,Context context) + { + + AlertDialog.Builder dialog = new AlertDialog.Builder(context); + dialog.setCancelable(false); + dialog.setTitle("LeadMIS"); + dialog.setMessage("End Date should be after Start Date"); + + Activity activity = (Activity) context; + // fragmentManager = activity.getFragmentManager(); + + + dialog.setPositiveButton("OK", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) + { + + /*FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); + + fragmentTransaction.replace(R.id.frame_container, new Fragment_RHolidays()); + fragmentTransaction.commit();*/ + + dialog.dismiss(); + + } + }); + + + + + final AlertDialog alert = dialog.create(); + alert.setOnShowListener(new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface arg0) { + alert.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#004D40")); + } + }); + alert.show(); + + + } + + + + public void alerts_dialog2(final Context context, final Class classname) + { + + AlertDialog.Builder dialog = new AlertDialog.Builder(mContext); + dialog.setCancelable(false); + dialog.setTitle("LEADCampus"); + dialog.setMessage("Are you sure you want to leave this page?"); + + final Activity activity = (Activity) context; + fragmentManager = activity.getFragmentManager(); + + dialog.setPositiveButton("Yes", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) + { + + /*FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); + + fragmentTransaction.replace(R.id.frame_container, new Fragment_RHolidays()); + fragmentTransaction.commit();*/ + + + + Intent lauchactivity = new Intent(context ,classname); + context.startActivity(lauchactivity); + ((Activity) context).finish(); + + + + + } + }); + + + + + dialog.setNegativeButton("No", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int i) + { + dialog.dismiss(); + } + }); + + final AlertDialog alert = dialog.create(); + + alert.setOnShowListener(new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface arg0) { + alert.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#004D40")); + alert.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(Color.parseColor("#ff0000")); + } + }); + alert.show(); + + + } + + + + + + +} diff --git a/app/src/main/java/com/leadcampusapp/Class_fundticket_resp.java b/app/src/main/java/com/leadcampusapp/Class_fundticket_resp.java new file mode 100644 index 0000000..1ebc355 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_fundticket_resp.java @@ -0,0 +1,142 @@ +package com.leadcampusapp; + + +/* +anyType{vmGet_Funding_Status=anyType{Ticket_Id=1; Requeted_By=Abhinandan; + Requested_Date=04-05-2021; Approved_By=Pending; Approved_Date= ; + Approved_Remark= ; Approval_Status=Pending; Requested_Project=2; + Manager_Approved_Project=0; Account_Approved_Project=0; Requested_Amount=200; + Manager_Approved_Amount=0; Account_Approved_Amount=0; status=success; }; +*/ + +public class Class_fundticket_resp { + + + String str_ticketid; + String str_requestedby; + String str_requesteddate; + String str_approvedby; + String str_approveddate; + String str_approvedremarks; + String str_approvalstatus; + String str_requestedproject; + String str_managerapprovedproject; + String str_accountapprovedprojects; + String str_requestedamount; + String str_managerapprovedamount; + String str_accountapprovedamount; + String str_status; + + + public String getStr_ticketid() { + return str_ticketid; + } + + public void setStr_ticketid(String str_ticketid) { + this.str_ticketid = str_ticketid; + } + + public String getStr_requestedby() { + return str_requestedby; + } + + public void setStr_requestedby(String str_requestedby) { + this.str_requestedby = str_requestedby; + } + + public String getStr_requesteddate() { + return str_requesteddate; + } + + public void setStr_requesteddate(String str_requesteddate) { + this.str_requesteddate = str_requesteddate; + } + + public String getStr_approvedby() { + return str_approvedby; + } + + public void setStr_approvedby(String str_approvedby) { + this.str_approvedby = str_approvedby; + } + + public String getStr_approveddate() { + return str_approveddate; + } + + public void setStr_approveddate(String str_approveddate) { + this.str_approveddate = str_approveddate; + } + + public String getStr_approvedremarks() { + return str_approvedremarks; + } + + public void setStr_approvedremarks(String str_approvedremarks) { + this.str_approvedremarks = str_approvedremarks; + } + + public String getStr_approvalstatus() { + return str_approvalstatus; + } + + public void setStr_approvalstatus(String str_approvalstatus) { + this.str_approvalstatus = str_approvalstatus; + } + + public String getStr_requestedproject() { + return str_requestedproject; + } + + public void setStr_requestedproject(String str_requestedproject) { + this.str_requestedproject = str_requestedproject; + } + + public String getStr_managerapprovedproject() { + return str_managerapprovedproject; + } + + public void setStr_managerapprovedproject(String str_managerapprovedproject) { + this.str_managerapprovedproject = str_managerapprovedproject; + } + + public String getStr_accountapprovedprojects() { + return str_accountapprovedprojects; + } + + public void setStr_accountapprovedprojects(String str_accountapprovedprojects) { + this.str_accountapprovedprojects = str_accountapprovedprojects; + } + + public String getStr_requestedamount() { + return str_requestedamount; + } + + public void setStr_requestedamount(String str_requestedamount) { + this.str_requestedamount = str_requestedamount; + } + + public String getStr_managerapprovedamount() { + return str_managerapprovedamount; + } + + public void setStr_managerapprovedamount(String str_managerapprovedamount) { + this.str_managerapprovedamount = str_managerapprovedamount; + } + + public String getStr_accountapprovedamount() { + return str_accountapprovedamount; + } + + public void setStr_accountapprovedamount(String str_accountapprovedamount) { + this.str_accountapprovedamount = str_accountapprovedamount; + } + + public String getStr_status() { + return str_status; + } + + public void setStr_status(String str_status) { + this.str_status = str_status; + } +} diff --git a/app/src/main/java/com/leadcampusapp/Class_imagedelete.java b/app/src/main/java/com/leadcampusapp/Class_imagedelete.java new file mode 100644 index 0000000..0dafe92 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_imagedelete.java @@ -0,0 +1,34 @@ +package com.leadcampusapp; + +import android.app.Activity; +import android.app.AlertDialog; +import android.app.FragmentManager; +import android.app.FragmentTransaction; +import android.content.Context; +import android.content.DialogInterface; +import android.content.SharedPreferences; +import android.database.sqlite.SQLiteDatabase; +import android.graphics.Color; + +public class Class_imagedelete +{ + private final Context mContext; + + + SharedPreferences prefs_book; + + public Class_imagedelete(Context context) + { + this.mContext = context; + + } + + + public void alerts_dialog_Error(int x) + { + + + } + + +} diff --git a/app/src/main/java/com/leadcampusapp/Class_studentpayment_summary.java b/app/src/main/java/com/leadcampusapp/Class_studentpayment_summary.java new file mode 100644 index 0000000..3f195ea --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_studentpayment_summary.java @@ -0,0 +1,159 @@ +package com.leadcampusapp; + + +/*19 +MH08103 +Mallikarjun kumbar +41275 +1 +10-February-21 +10-02-2021 06:02;30 06:11:30 PM +19 +0 +1612960865 +Registration +success +2020-21 +UPI +empty +Success*/ +public class Class_studentpayment_summary +{ + + String Str_paymentid; + String Str_Lead_Id; + String Str_StudentName; + String Str_Registration_Id; + String Str_Paid_Fees; + String Str_Created_Date; + String Str_Auto_Receipt_No; + String Str_transanction_Id; + String Str_reference_id; + String Str_Fees_Category_description; + String Str_transactionStatus; + String Str_YearCode; + String Str_Payment_Type; + String Str_Payeer_Id; + String Str_Status; + + + public String getStr_paymentid() { + return Str_paymentid; + } + + public void setStr_paymentid(String str_paymentid) { + Str_paymentid = str_paymentid; + } + + public String getStr_Lead_Id() { + return Str_Lead_Id; + } + + public void setStr_Lead_Id(String str_Lead_Id) { + Str_Lead_Id = str_Lead_Id; + } + + public String getStr_StudentName() { + return Str_StudentName; + } + + public void setStr_StudentName(String str_StudentName) { + Str_StudentName = str_StudentName; + } + + public String getStr_Registration_Id() { + return Str_Registration_Id; + } + + public void setStr_Registration_Id(String str_Registration_Id) { + Str_Registration_Id = str_Registration_Id; + } + + public String getStr_Paid_Fees() { + return Str_Paid_Fees; + } + + public void setStr_Paid_Fees(String str_Paid_Fees) { + Str_Paid_Fees = str_Paid_Fees; + } + + public String getStr_Created_Date() { + return Str_Created_Date; + } + + public void setStr_Created_Date(String str_Created_Date) { + Str_Created_Date = str_Created_Date; + } + + public String getStr_Auto_Receipt_No() { + return Str_Auto_Receipt_No; + } + + public void setStr_Auto_Receipt_No(String str_Auto_Receipt_No) { + Str_Auto_Receipt_No = str_Auto_Receipt_No; + } + + public String getStr_transanction_Id() { + return Str_transanction_Id; + } + + public void setStr_transanction_Id(String str_transanction_Id) { + Str_transanction_Id = str_transanction_Id; + } + + public String getStr_reference_id() { + return Str_reference_id; + } + + public void setStr_reference_id(String str_reference_id) { + Str_reference_id = str_reference_id; + } + + public String getStr_Fees_Category_description() { + return Str_Fees_Category_description; + } + + public void setStr_Fees_Category_description(String str_Fees_Category_description) { + Str_Fees_Category_description = str_Fees_Category_description; + } + + public String getStr_transactionStatus() { + return Str_transactionStatus; + } + + public void setStr_transactionStatus(String str_transactionStatus) { + Str_transactionStatus = str_transactionStatus; + } + + public String getStr_YearCode() { + return Str_YearCode; + } + + public void setStr_YearCode(String str_YearCode) { + Str_YearCode = str_YearCode; + } + + public String getStr_Payment_Type() { + return Str_Payment_Type; + } + + public void setStr_Payment_Type(String str_Payment_Type) { + Str_Payment_Type = str_Payment_Type; + } + + public String getStr_Payeer_Id() { + return Str_Payeer_Id; + } + + public void setStr_Payeer_Id(String str_Payeer_Id) { + Str_Payeer_Id = str_Payeer_Id; + } + + public String getStr_Status() { + return Str_Status; + } + + public void setStr_Status(String str_Status) { + Str_Status = str_Status; + } +} diff --git a/app/src/main/java/com/leadcampusapp/Class_token.java b/app/src/main/java/com/leadcampusapp/Class_token.java new file mode 100644 index 0000000..25bb873 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_token.java @@ -0,0 +1,60 @@ +package com.leadcampusapp; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +// "PaytmChecksum": "EkdqSgtcbVT5bw4dkPZtFnnvr/AHeaOiDgFG4DoFzBYz3UdiNs4NM9MBxbu65kCUEOnRXcvwRP9e0hNYtFJGpuvr1bOJlM4YTEQAhkaevHI=", +// "VerifySignature": true, +public class Class_token +{ + + @SerializedName("PaytmChecksum") + @Expose + private String PaytmChecksum; + + @SerializedName("VerifySignature") + @Expose + private String VerifySignature; + + + @SerializedName("PaytmChecksumNew") + @Expose + private String PaytmChecksumNew; + + @SerializedName("VerifySignatureNew") + @Expose + private String VerifySignatureNew; + + + public String getPaytmChecksum() { + return PaytmChecksum; + } + + public void setPaytmChecksum(String paytmChecksum) { + PaytmChecksum = paytmChecksum; + } + + public String getVerifySignature() { + return VerifySignature; + } + + public void setVerifySignature(String verifySignature) { + VerifySignature = verifySignature; + } + + public String getPaytmChecksumNew() { + return PaytmChecksumNew; + } + + public void setPaytmChecksumNew(String paytmChecksumNew) { + PaytmChecksumNew = paytmChecksumNew; + } + + public String getVerifySignatureNew() { + return VerifySignatureNew; + } + + public void setVerifySignatureNew(String verifySignatureNew) { + VerifySignatureNew = verifySignatureNew; + } +} diff --git a/app/src/main/java/com/leadcampusapp/Class_token_response.java b/app/src/main/java/com/leadcampusapp/Class_token_response.java new file mode 100644 index 0000000..6337096 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Class_token_response.java @@ -0,0 +1,47 @@ +package com.leadcampusapp; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + + +public class Class_token_response +{ + + @SerializedName("Status") + @Expose + private Boolean status; + + @SerializedName("Message") + @Expose + private String message; + + + @SerializedName("obj") + @Expose + private Class_token tokenresp = null; + + + public Boolean getStatus() { + return status; + } + + public void setStatus(Boolean status) { + this.status = status; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public Class_token getTokenresp() { + return tokenresp; + } + + public void setTokenresp(Class_token tokenresp) { + this.tokenresp = tokenresp; + } +} diff --git a/app/src/main/java/com/leadcampusapp/CommonUtils.java b/app/src/main/java/com/leadcampusapp/CommonUtils.java new file mode 100644 index 0000000..68538a2 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/CommonUtils.java @@ -0,0 +1,177 @@ +package com.leadcampusapp; + +import android.app.Activity; +import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.Canvas; +import android.graphics.Matrix; +import android.graphics.Paint; +import android.media.ExifInterface; +import android.os.Environment; +import android.view.inputmethod.InputMethodManager; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +/** + * Created by Grishma on 14/3/16. + */ +public class CommonUtils { + private static final float maxHeight = 1280.0f; + private static final float maxWidth = 1280.0f; + + public static int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) { + final int height = options.outHeight; + final int width = options.outWidth; + int inSampleSize = 1; + + if (height > reqHeight || width > reqWidth) { + final int heightRatio = Math.round((float) height / (float) reqHeight); + final int widthRatio = Math.round((float) width / (float) reqWidth); + inSampleSize = heightRatio < widthRatio ? heightRatio : widthRatio; + } + final float totalPixels = width * height; + final float totalReqPixelsCap = reqWidth * reqHeight * 2; + while (totalPixels / (inSampleSize * inSampleSize) > totalReqPixelsCap) { + inSampleSize++; + } + return inSampleSize; + } + + + /** + * Reduces the size of an image without affecting its quality. + * + * @param imagePath -Path of an image + * @return + */ + public static String compressImage(String imagePath) { + Bitmap scaledBitmap = null; + BitmapFactory.Options options = new BitmapFactory.Options(); + options.inJustDecodeBounds = true; + Bitmap bmp = BitmapFactory.decodeFile(imagePath, options); + + int actualHeight = options.outHeight; + int actualWidth = options.outWidth; + + float imgRatio = (float) actualWidth / (float) actualHeight; + float maxRatio = maxWidth / maxHeight; + + if (actualHeight > maxHeight || actualWidth > maxWidth) { + if (imgRatio < maxRatio) { + imgRatio = maxHeight / actualHeight; + actualWidth = (int) (imgRatio * actualWidth); + actualHeight = (int) maxHeight; + } else if (imgRatio > maxRatio) { + imgRatio = maxWidth / actualWidth; + actualHeight = (int) (imgRatio * actualHeight); + actualWidth = (int) maxWidth; + } else { + actualHeight = (int) maxHeight; + actualWidth = (int) maxWidth; + } + } + options.inSampleSize = calculateInSampleSize(options, actualWidth, actualHeight); + options.inJustDecodeBounds = false; + options.inDither = false; + options.inPurgeable = true; + options.inInputShareable = true; + options.inTempStorage = new byte[16 * 1024]; + try { + bmp = BitmapFactory.decodeFile(imagePath, options); + } catch (OutOfMemoryError exception) { + exception.printStackTrace(); + } + try { + scaledBitmap = Bitmap.createBitmap(actualWidth, actualHeight, Bitmap.Config.RGB_565); + } catch (OutOfMemoryError exception) { + exception.printStackTrace(); + } + + float ratioX = actualWidth / (float) options.outWidth; + float ratioY = actualHeight / (float) options.outHeight; + float middleX = actualWidth / 2.0f; + float middleY = actualHeight / 2.0f; + Matrix scaleMatrix = new Matrix(); + scaleMatrix.setScale(ratioX, ratioY, middleX, middleY); + Canvas canvas = new Canvas(scaledBitmap); + canvas.setMatrix(scaleMatrix); + canvas.drawBitmap(bmp, middleX - bmp.getWidth() / 2, middleY - bmp.getHeight() / 2, new Paint(Paint.FILTER_BITMAP_FLAG)); + if (bmp != null) { + bmp.recycle(); + } + ExifInterface exif; + try { + exif = new ExifInterface(imagePath); + int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, 0); + Matrix matrix = new Matrix(); + if (orientation == 6) { + matrix.postRotate(90); + } else if (orientation == 3) { + matrix.postRotate(180); + } else if (orientation == 8) { + matrix.postRotate(270); + } + scaledBitmap = Bitmap.createBitmap(scaledBitmap, 0, 0, scaledBitmap.getWidth(), scaledBitmap.getHeight(), matrix, true); + } catch (IOException e) { + e.printStackTrace(); + } + FileOutputStream out = null; + String filepath = CompletionGalleryFolderSelectActivity.imageFilePath;//getFilename(); + try { + //new File(imageFilePath).delete(); + out = new FileOutputStream(filepath); + + //write the compressed bitmap at the destination specified by filename. + scaledBitmap.compress(Bitmap.CompressFormat.JPEG, 100, out); + + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + + return filepath; + } + + public static String getFilename() { + File mediaStorageDir = new File(Environment.getExternalStorageDirectory() + + "/ImageCompApp/Images"); + + // Create the storage directory if it does not exist + if (!mediaStorageDir.exists()) { + mediaStorageDir.mkdirs(); + } + + String mImageName = "IMG_" + String.valueOf(System.currentTimeMillis()) + ".jpg"; + String uriString = (mediaStorageDir.getAbsolutePath() + "/" + mImageName); + return uriString; + } + + public static void hideKeyboard(Activity context) { + try { + if (context == null) return; + InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); + imm.hideSoftInputFromWindow(context.getWindow().getCurrentFocus().getWindowToken(), 0); + } catch (Exception e) { + } + } + + public static void copyFile(String selectedImagePath, String mdestinationPath) throws IOException { + InputStream in = new FileInputStream(selectedImagePath); + OutputStream out = new FileOutputStream(mdestinationPath); + + // Transfer bytes from in to out + byte[] buf = new byte[1024]; + int len; + while ((len = in.read(buf)) > 0) { + out.write(buf, 0, len); + } + in.close(); + out.close(); + } +} diff --git a/app/src/main/java/com/leadcampusapp/CompletionAdapter_PhotosFolder.java b/app/src/main/java/com/leadcampusapp/CompletionAdapter_PhotosFolder.java new file mode 100644 index 0000000..7fa4c73 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/CompletionAdapter_PhotosFolder.java @@ -0,0 +1,131 @@ +package com.leadcampusapp; + +/** + * Created by deepshikha on 3/3/17. + */ + +import android.content.Context; +import android.util.Log; +import android.util.SparseBooleanArray; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.ImageView; +import android.widget.TextView; + +import com.bumptech.glide.Glide; +import com.bumptech.glide.load.engine.DiskCacheStrategy; + +import java.util.ArrayList; + + +public class CompletionAdapter_PhotosFolder extends ArrayAdapter { + + Context context; + ViewHolder viewHolder; + ArrayList al_menu = new ArrayList<>(); + private SparseBooleanArray mSparseBooleanArray; + + + public CompletionAdapter_PhotosFolder(Context context, ArrayList al_menu) { + super(context, R.layout.activity_completion_adapter_photosfolder, al_menu); + this.al_menu = al_menu; + this.context = context; + mSparseBooleanArray = new SparseBooleanArray(); + } + + /* CompoundButton.OnCheckedChangeListener mCheckedChangeListener = new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + mSparseBooleanArray.put((Integer) buttonView.getTag(), isChecked); + } + };*/ + + +/* public ArrayList getCheckedItems() { + ArrayList mTempArry = new ArrayList(); + + for(int i=0;i 0) { + return al_menu.size(); + } else { + return 1; + } + } + + @Override + public long getItemId(int position) { + return position; + } + + + @Override + public View getView(final int position, View convertView, ViewGroup parent) { + + if (convertView == null) { + + viewHolder = new ViewHolder(); + convertView = LayoutInflater.from(getContext()).inflate(R.layout.activity_completion_adapter_photosfolder, parent, false); + viewHolder.tv_foldern = (TextView) convertView.findViewById(R.id.tv_folder); + viewHolder.tv_foldersize = (TextView) convertView.findViewById(R.id.tv_folder2); + viewHolder.iv_image = (ImageView) convertView.findViewById(R.id.iv_image); + + //viewHolder.check_1 = (CheckBox) convertView.findViewById(R.id.checkBox1); + + + + convertView.setTag(viewHolder); + } else { + viewHolder = (ViewHolder) convertView.getTag(); + } + + viewHolder.tv_foldern.setText(al_menu.get(position).getStr_folder()); + viewHolder.tv_foldersize.setText(al_menu.get(position).getAl_imagepath().size()+""); + + //viewHolder.checkBox.setOnCheckedChangeListener(mCheckedChangeListener); + + + + Glide.with(context).load("file://" + al_menu.get(position).getAl_imagepath().get(0)) + .diskCacheStrategy(DiskCacheStrategy.NONE) + .skipMemoryCache(true) + .into(viewHolder.iv_image); + + + return convertView; + + } + + + private static class ViewHolder { + TextView tv_foldern, tv_foldersize; + ImageView iv_image; + //CheckBox check_1; + } + + +} diff --git a/app/src/main/java/com/leadcampusapp/CompletionDocumentFolderSelectActivity.java b/app/src/main/java/com/leadcampusapp/CompletionDocumentFolderSelectActivity.java new file mode 100644 index 0000000..3e7eeb1 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/CompletionDocumentFolderSelectActivity.java @@ -0,0 +1,204 @@ +package com.leadcampusapp; + +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.content.Intent; +import android.os.Bundle; +import android.os.Environment; +import androidx.appcompat.app.AppCompatActivity; +import android.util.Log; +import android.view.View; +import android.widget.Button; +import android.widget.GridView; +import android.widget.Toast; + +import java.io.File; +import java.util.ArrayList; + +/** + * Created by deepshikha on 20/3/17. + */ + +public class CompletionDocumentFolderSelectActivity extends AppCompatActivity implements ConnectivityReceiver.ConnectivityReceiverListener{ + int int_position; + private GridView gridView; + private CompletionDocumentGridViewAdapter adapter; + private ArrayList mTempArry; + private String path; + private ArrayList completionDocumentModelArrLst; + private ArrayList filePaths,filenames; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_completion_document_photo_select); + + Log.d("Insidexxx","photosActivitysss"); + + //Toast.makeText(getApplicationContext(),"Inside CompletionGalleryFolderSelectActivity",Toast.LENGTH_LONG).show(); + + completionDocumentModelArrLst = new ArrayList(); + filePaths = new ArrayList(); + filenames = new ArrayList(); + + + //ArrayList filenames = new ArrayList(); + path = Environment.getExternalStorageDirectory() + File.separator; + + File directory = new File(path); + File[] files = directory.listFiles(); + + + + if (android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED)) + { + ///mounted + File dir= android.os.Environment.getExternalStorageDirectory(); + walkdir(dir); + } + + + +/* for (int i = 0; i < files.length; i++) { + String file_name = files[i].getName(); + + if(file_name.endsWith(".pdf") || file_name.endsWith(".doc")) { + Log.d("file_nameissss", files[i].getAbsolutePath()); + filePaths.add(files[i].getAbsolutePath()); + filenames.add(file_name); + } + // you can store name to arraylist and use it later + + }*/ + + CompletionDocumentModel completionDocumentModel = new CompletionDocumentModel(); + completionDocumentModel.setAl_documentpath(filePaths); + completionDocumentModel.setAl_documentName(filenames); + + completionDocumentModelArrLst.add(completionDocumentModel); + + + + gridView = (GridView)findViewById(R.id.gv_folder); + int_position = getIntent().getIntExtra("value", 0); + adapter = new CompletionDocumentGridViewAdapter(this, completionDocumentModelArrLst,0); + + + + //adapter.getCheckedItems(); + + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.activity_completion_document_actionbar_layouts); + + View custView = getSupportActionBar().getCustomView(); + Button btn_selectAll = (Button) custView.findViewById(R.id.btn_selectAll); + btn_selectAll.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + mTempArry = adapter.getCheckedItems(); + Toast.makeText(getApplicationContext(),"Selected Items: "+mTempArry.size(),Toast.LENGTH_SHORT).show(); + + if(mTempArry.size()==1) { + + for (int i = 0; i < mTempArry.size(); i++) { + Log.d("FileNameisss:", mTempArry.get(i)); + } + + CompletionProjectStaticClass.setFileDocString(mTempArry); + + // Intent documentToCompletion = new Intent(getApplicationContext(), ProjectDetails.class);// for fragment + + Intent documentToCompletion = new Intent(getApplicationContext(), FinalProjectCompletion_Activity.class);// for Activity + //photosToCompletion.putExtra("fromTeam","CompletionGalleryFolderSelectActivity"); + documentToCompletion.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); + //photosToCompletion.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + CompletionProjectStaticClass.setCountDocumentCompletion(1);// for fragment + startActivity(documentToCompletion); + }else{ + Toast.makeText(getApplicationContext(),"You can upload only one document",Toast.LENGTH_SHORT).show(); + } + + //finish(); + } + }); + + gridView.setAdapter(adapter); + } + + @Override + protected void onResume() { + super.onResume(); + + // register connection status listener + MyApplication.getInstance().setConnectivityListener(this); + } + + @Override + public void onNetworkConnectionChanged(boolean isConnected) { + showSnack(isConnected); + } + + private void showSnack(boolean isConnected) { + + if (!isConnected) { + + AlertDialog.Builder adb = new AlertDialog.Builder(CompletionDocumentFolderSelectActivity.this); + //adb.setView(alertDialogView); + + adb.setTitle("Sorry! Not connected to the internet"); + + adb.setIcon(android.R.drawable.ic_dialog_alert); + + adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + + adb.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + adb.setCancelable(true); + adb.show(); + } + } + + + + + + private void walkdir(File dir) { + File listFile[] = dir.listFiles(); + + if (listFile != null) { + for (int i = 0; i < listFile.length; i++) { + + if (listFile[i].isDirectory()) {// if its a directory need to get the files under that directory + walkdir(listFile[i]); + } else {// add path of files to your arraylist for later use + + //Do what ever u want + //filepath.add(listFile[i].getAbsolutePath()); + String file_name = listFile[i].getName(); + + if(file_name.endsWith(".pdf") || file_name.endsWith(".doc") || file_name.endsWith(".docx") || file_name.endsWith(".xls") || file_name.endsWith(".xlsx")) { + Log.d("file_nameissss", listFile[i].getAbsolutePath()); + filePaths.add(listFile[i].getAbsolutePath()); + filenames.add(file_name); + } + + } + } + } + } + + @Override + public void onBackPressed() { + super.onBackPressed(); + } + +} diff --git a/app/src/main/java/com/leadcampusapp/CompletionDocumentGridViewAdapter.java b/app/src/main/java/com/leadcampusapp/CompletionDocumentGridViewAdapter.java new file mode 100644 index 0000000..9094b24 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/CompletionDocumentGridViewAdapter.java @@ -0,0 +1,152 @@ +package com.leadcampusapp; + +/** + * Created by deepshikha on 3/3/17. + */ + +import android.content.Context; +import android.util.Log; +import android.util.SparseBooleanArray; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.CheckBox; +import android.widget.CompoundButton; +import android.widget.ImageView; +import android.widget.TextView; + +import java.util.ArrayList; + + +public class CompletionDocumentGridViewAdapter extends ArrayAdapter { + + Context context; + ViewHolder viewHolder; + ArrayList al_menu = new ArrayList<>(); + private int int_position; + private SparseBooleanArray mSparseBooleanArray; + private boolean barray[]; + + + public CompletionDocumentGridViewAdapter(Context context, ArrayList al_menu,int int_position) { + super(context, R.layout.activity_completion_document_adapter_photosfolder, al_menu); + this.al_menu = al_menu; + this.context = context; + this.int_position = int_position; + mSparseBooleanArray = new SparseBooleanArray(); + } + + /* CompoundButton.OnCheckedChangeListener mCheckedChangeListener = new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + mSparseBooleanArray.put((Integer) buttonView.getTag(), isChecked); + } + };*/ + + public ArrayList getCheckedItems() { + ArrayList mTempArry = new ArrayList(); + + for(int i=0;i 0) { + return al_menu.get(int_position).getAl_documentpath().size(); + } else { + return 1; + } + } + + @Override + public long getItemId(int position) { + return position; + } + + + @Override + public View getView(final int position, View convertView, ViewGroup parent) { + + if (convertView == null) { + + viewHolder = new ViewHolder(); + + convertView = LayoutInflater.from(getContext()).inflate(R.layout.activity_completion_document_adapter_photosfolders, parent, false); + + viewHolder.iv_image = (ImageView) convertView.findViewById(R.id.iv_image); + + viewHolder.checkBox = (CheckBox) convertView.findViewById(R.id.checkBox1); + + viewHolder.tv_fileName = (TextView) convertView.findViewById(R.id.tv_fileName); + + + viewHolder.tv_fileName.setText(al_menu.get(int_position).getAl_documentName().get(position)); + + //viewHolder.checkBox = (CheckBox) convertView.findViewById(R.id.checkBox1); + viewHolder.checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + Log.d("IsCheckedssskddf", String.valueOf(isChecked)); + //mSparseBooleanArray.put(buttonView.getId(), isChecked); + mSparseBooleanArray.put(position, isChecked); + } + }); + + convertView.setTag(viewHolder); + } else { + viewHolder = (ViewHolder) convertView.getTag(); + } + + + if(al_menu.get(int_position).getAl_documentpath().get(position).endsWith(".doc") || al_menu.get(int_position).getAl_documentpath().get(position).endsWith(".docx")){ + viewHolder.iv_image.setImageResource(R.drawable.microsoft_office_word); + } + + if(al_menu.get(int_position).getAl_documentpath().get(position).endsWith(".xls") || al_menu.get(int_position).getAl_documentpath().get(position).endsWith(".xlsx")){ + viewHolder.iv_image.setImageResource(R.drawable.microsoft_office_excel); + } + + +/* viewHolder.tv_foldern.setVisibility(View.GONE); + viewHolder.tv_foldersize.setVisibility(View.GONE);*/ + + + + /* Glide.with(context).load("file://" + al_menu.get(int_position).getAl_documentpath().get(position)) + .diskCacheStrategy(DiskCacheStrategy.NONE) + .skipMemoryCache(true) + .into(viewHolder.iv_image);*/ + + + return convertView; + + } + + private static class ViewHolder { + ImageView iv_image; + CheckBox checkBox; + TextView tv_fileName; + } + + +} diff --git a/app/src/main/java/com/leadcampusapp/CompletionDocumentModel.java b/app/src/main/java/com/leadcampusapp/CompletionDocumentModel.java new file mode 100644 index 0000000..5c23dbd --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/CompletionDocumentModel.java @@ -0,0 +1,37 @@ +package com.leadcampusapp; + +import java.util.ArrayList; + +/** + * Created by deepshikha on 3/3/17. + */ + +public class CompletionDocumentModel { + ArrayList al_documentpath; + String str_folder; + ArrayList al_documentName; + + public String getStr_folder() { + return str_folder; + } + + public void setStr_folder(String str_folder) { + this.str_folder = str_folder; + } + + public ArrayList getAl_documentpath() { + return al_documentpath; + } + + public void setAl_documentpath(ArrayList al_documentpath) { + this.al_documentpath = al_documentpath; + } + + public ArrayList getAl_documentName() { + return al_documentName; + } + + public void setAl_documentName(ArrayList al_documentName) { + this.al_documentName = al_documentName; + } +} diff --git a/app/src/main/java/com/leadcampusapp/CompletionGalleryFolderSelectActivity.java b/app/src/main/java/com/leadcampusapp/CompletionGalleryFolderSelectActivity.java new file mode 100644 index 0000000..3474206 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/CompletionGalleryFolderSelectActivity.java @@ -0,0 +1,214 @@ +package com.leadcampusapp; + +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.content.Intent; +import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; +import android.util.Log; +import android.view.View; +import android.widget.Button; +import android.widget.GridView; +import android.widget.Toast; + +import java.util.ArrayList; + +/** + * Created by deepshikha on 20/3/17. + */ + +public class CompletionGalleryFolderSelectActivity extends AppCompatActivity{ //implements ConnectivityReceiver.ConnectivityReceiverListener{ + int int_position; + private GridView gridView; + CompletionGalleryGridViewAdapter adapter; + ArrayList mTempArry; + ArrayList mCompressArry; + byte[] imageInByte; + ArrayList mImageInByte; + ArrayList mImageInByteAll; + public static String imageFilePath; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_completion_photo_select); + + Log.d("Insidexxx","photosActivitysss"); + + //Toast.makeText(getApplicationContext(),"Inside CompletionGalleryFolderSelectActivity",Toast.LENGTH_LONG).show(); + + + gridView = (GridView)findViewById(R.id.gv_folder); + int_position = getIntent().getIntExtra("value", 0); + adapter = new CompletionGalleryGridViewAdapter(this, CompletionGallerySelectActivity.al_images,int_position); + + + + //adapter.getCheckedItems(); + + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.activity_completion_actionbar_layouts); + + View custView = getSupportActionBar().getCustomView(); + Button btn_selectAll = (Button) custView.findViewById(R.id.btn_selectAll); + btn_selectAll.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + mTempArry = adapter.getCheckedItems(); + Toast.makeText(getApplicationContext(),"Selected Items: "+mTempArry.size(),Toast.LENGTH_SHORT).show(); + + Log.d("ImageUrl gallery", String.valueOf(mTempArry.size())); + // + // Log.d("tag","ImageUrl name ="+ String.valueOf(mTempArry.toString())); + + + mCompressArry=new ArrayList(); + mImageInByte=new ArrayList<>(); + mImageInByteAll=new ArrayList<>(); + + for(int i=0;i { + Context context; + ViewHolder viewHolder; + ArrayList al_menu = new ArrayList<>(); + int int_position; + private SparseBooleanArray mSparseBooleanArray; + private boolean barray[]; + + + public CompletionGalleryGridViewAdapter(Context context, ArrayList al_menu, int int_position) { + super(context, R.layout.activity_completion_adapter_photosfolder, al_menu); + this.al_menu = al_menu; + this.context = context; + this.int_position = int_position; + mSparseBooleanArray = new SparseBooleanArray(); + barray = new boolean[al_menu.get(int_position).getAl_imagepath().size()]; + } + + /* CompoundButton.OnCheckedChangeListener mCheckedChangeListener = new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + mSparseBooleanArray.put((Integer) buttonView.getTag(), isChecked); + } + };*/ + + public ArrayList getCheckedItems() { + ArrayList mTempArry = new ArrayList(); + + for(int i=0;i 0) { + return al_menu.get(int_position).getAl_imagepath().size(); + } else { + return 1; + } + } + + @Override + public long getItemId(int position) { + return position; + } + + + @Override + public View getView(final int position, View convertView, ViewGroup parent) { + + if (convertView == null) { + + viewHolder = new ViewHolder(); + convertView = LayoutInflater.from(getContext()).inflate(R.layout.activity_completion_adapter_photosfolders, parent, false); + viewHolder.tv_foldern = (TextView) convertView.findViewById(R.id.tv_folder); + viewHolder.tv_foldersize = (TextView) convertView.findViewById(R.id.tv_folder2); + viewHolder.iv_image = (ImageView) convertView.findViewById(R.id.iv_image); + + viewHolder.checkBox = (CheckBox) convertView.findViewById(R.id.checkBox1); + viewHolder.checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + Log.d("IsCheckedssskddf", String.valueOf(isChecked)); + //mSparseBooleanArray.put(buttonView.getId(), isChecked); + mSparseBooleanArray.put(position, isChecked); + } + }); + + convertView.setTag(viewHolder); + } else { + viewHolder = (ViewHolder) convertView.getTag(); + } + + viewHolder.tv_foldern.setVisibility(View.GONE); + viewHolder.tv_foldersize.setVisibility(View.GONE); + + + + Glide.with(context).load("file://" + al_menu.get(int_position).getAl_imagepath().get(position)) + .diskCacheStrategy(DiskCacheStrategy.NONE) + .skipMemoryCache(true) + .into(viewHolder.iv_image); + + + return convertView; + + } + + private static class ViewHolder { + TextView tv_foldern, tv_foldersize; + ImageView iv_image; + CheckBox checkBox; + } + + +} diff --git a/app/src/main/java/com/leadcampusapp/CompletionGallerySelectActivity.java b/app/src/main/java/com/leadcampusapp/CompletionGallerySelectActivity.java new file mode 100644 index 0000000..31f2e5b --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/CompletionGallerySelectActivity.java @@ -0,0 +1,310 @@ +package com.leadcampusapp; + +import android.Manifest; +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.database.Cursor; +import android.net.Uri; +import android.provider.MediaStore; +import androidx.core.app.ActivityCompat; +import androidx.core.content.ContextCompat; +import androidx.appcompat.app.AppCompatActivity; +import android.os.Bundle; +import android.util.Log; +import android.view.View; +import android.widget.AdapterView; +import android.widget.GridView; +import android.widget.Toast; + +import java.util.ArrayList; + +public class CompletionGallerySelectActivity extends AppCompatActivity implements ConnectivityReceiver.ConnectivityReceiverListener{ + public static ArrayList al_images = new ArrayList<>(); + boolean boolean_folder; + CompletionAdapter_PhotosFolder obj_adapter; + GridView gv_folder; + private static final int REQUEST_PERMISSIONS = 100; + String path; + Context context; + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_completion_photo_select); + + + context = CompletionGallerySelectActivity.this; + + + + + gv_folder = (GridView)findViewById(R.id.gv_folder); + + gv_folder.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView adapterView, View view, int i, long l) { + Log.d("Insidexxx","gv_folderssss"); + Intent intent = new Intent(getApplicationContext(), CompletionGalleryFolderSelectActivity.class); + intent.putExtra("value",i); + //intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + startActivityForResult(intent,100); + //startActivity(intent); + } + }); + + + if ((ContextCompat.checkSelfPermission(getApplicationContext(), + android.Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) && (ContextCompat.checkSelfPermission(getApplicationContext(), + android.Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED)) { + if ((ActivityCompat.shouldShowRequestPermissionRationale(CompletionGallerySelectActivity.this, + android.Manifest.permission.WRITE_EXTERNAL_STORAGE)) && (ActivityCompat.shouldShowRequestPermissionRationale(CompletionGallerySelectActivity.this, + android.Manifest.permission.READ_EXTERNAL_STORAGE))) { + + } else { + ActivityCompat.requestPermissions(CompletionGallerySelectActivity.this, + new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE}, + REQUEST_PERMISSIONS); + } + }else { + Log.e("Else","Else"); + fn_imagespath(); + } + + } + + @Override + protected void onResume() { + super.onResume(); + + // register connection status listener + MyApplication.getInstance().setConnectivityListener(this); + } + + @Override + public void onNetworkConnectionChanged(boolean isConnected) { + showSnack(isConnected); + } + + private void showSnack(boolean isConnected) { + + if (!isConnected) { + + AlertDialog.Builder adb = new AlertDialog.Builder(CompletionGallerySelectActivity.this); + //adb.setView(alertDialogView); + + adb.setTitle("Sorry! Not connected to the internet"); + + adb.setIcon(android.R.drawable.ic_dialog_alert); + + adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + + adb.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + adb.setCancelable(true); + adb.show(); + } + +/* String message; + int color; + if (isConnected) { + message = "Good! Connected to Internet"; + color = Color.WHITE; + } else { + message = "Sorry! Not connected to internet"; + color = Color.RED; + } + + Snackbar snackbar = Snackbar + .make(findViewById(R.id.coordinator_layout), message, Snackbar.LENGTH_LONG); + + View sbView = snackbar.getView(); + TextView textView = (TextView) sbView.findViewById(android.support.design.R.id.snackbar_text); + textView.setTextColor(color); + snackbar.show();*/ + } + + @Override + public void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + + if (resultCode == RESULT_OK) { + if (requestCode == 100) { + Log.d("Inside","Resultreturned"); + //finish(); + } + } + } + + + + + + + + + + + + + public ArrayList fn_imagespath() { + al_images.clear(); + + int int_position = 0; + Uri uri; + Cursor cursor; + int column_index_data, column_index_folder_name,column_mime_type; + + + String absolutePathOfImage = null; + uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; + + String[] projection = {MediaStore.MediaColumns.DATA, MediaStore.Images.Media.BUCKET_DISPLAY_NAME}; + + final String orderBy = MediaStore.Images.Media.DATE_TAKEN; + cursor = getApplicationContext().getContentResolver().query(uri, projection, null, null, orderBy + " DESC"); + + column_index_data = cursor.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA); + column_index_folder_name = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.BUCKET_DISPLAY_NAME); + + /*Log.e("cursor", String.valueOf(cursor)); + Log.e("cursorindex", String.valueOf(column_index_data)); + Log.e("cursorindexfoldername", String.valueOf(column_index_folder_name));*/ + + + + while (cursor.moveToNext()) + { + absolutePathOfImage = cursor.getString(column_index_data); + // Log.e("Column", absolutePathOfImage); + // Log.e("Folder", cursor.getString(column_index_folder_name)); + + for (int i = 0; i < al_images.size(); i++) { + // Log.e("al_images", al_images.get(i).getStr_folder()); + //Log.e("cursorname", cursor.getString(column_index_folder_name)); + try{ + if (al_images.get(i).getStr_folder().equals(cursor.getString(column_index_folder_name))) { + boolean_folder = true; + int_position = i; + break; + } else { + boolean_folder = false; + } + + }catch(Exception ex) + { + String exp= String.valueOf(ex); + + Log.e("exp",""+exp); + } + } + + + if (boolean_folder) { + ArrayList al_path = new ArrayList<>(); + al_path.addAll(al_images.get(int_position).getAl_imagepath()); + al_path.add(absolutePathOfImage); + al_images.get(int_position).setAl_imagepath(al_path); + } else { + ArrayList al_path = new ArrayList<>(); + al_path.add(absolutePathOfImage); + CompletionModelImages obj_model = new CompletionModelImages(); + obj_model.setStr_folder(cursor.getString(column_index_folder_name)); + obj_model.setAl_imagepath(al_path); + + al_images.add(obj_model); + } + + } + + + + /* ArrayList filenames = new ArrayList(); + path = Environment.getExternalStorageDirectory() + + File.separator; + + File directory = new File(path); + File[] files = directory.listFiles(); + + for (int i = 0; i < files.length; i++) + { + String file_name = files[i].getName(); + + if(file_name.endsWith(".pdf")) { + Log.d("file_nameissss", files[i].getAbsolutePath()); + } + // you can store name to arraylist and use it later + filenames.add(file_name); + }*/ + + + + /*ContentResolver cr = context.getContentResolver(); + Uri uriExternal = MediaStore.Files.getContentUri("internal"); + + String[] projections = null; + String sortOrder = null; // unordered + + String selectionMimeType = MediaStore.Files.FileColumns.MIME_TYPE + "=?"; + String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension("pdf"); + String[] selectionArgsPdf = new String[]{ mimeType }; + Cursor allPdfFiles = cr.query(uri, projections, selectionMimeType, selectionArgsPdf, sortOrder); + + column_index_data = allPdfFiles.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA); + column_index_folder_name = allPdfFiles.getColumnIndexOrThrow(MediaStore..Media.BUCKET_DISPLAY_NAME); + + while (allPdfFiles.moveToNext()){ + Log.d("FileNameis,",allPdfFiles.getString(column_index_data)); + Log.d("FolderNameiss,",allPdfFiles.getString(column_index_folder_name)); + }*/ + + + + + + + + + + /* for (int i = 0; i < al_images.size(); i++) { + Log.e("FOLDER", al_images.get(i).getStr_folder()); + for (int j = 0; j < al_images.get(i).getAl_imagepath().size(); j++) { + Log.e("FILE", al_images.get(i).getAl_imagepath().get(j)); + } + }*/ + + obj_adapter = new CompletionAdapter_PhotosFolder(getApplicationContext(),al_images); + gv_folder.setAdapter(obj_adapter); + return al_images; + } + + + @Override + public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults); + + switch (requestCode) { + case REQUEST_PERMISSIONS: { + for (int i = 0; i < grantResults.length; i++) { + if (grantResults.length > 0 && grantResults[i] == PackageManager.PERMISSION_GRANTED) { + fn_imagespath(); + } else { + Toast.makeText(CompletionGallerySelectActivity.this, "The app was not allowed to read or write to your storage. Hence, it cannot function properly. Please consider granting it this permission", Toast.LENGTH_LONG).show(); + } + } + } + } + } +} diff --git a/app/src/main/java/com/leadcampusapp/CompletionModelImages.java b/app/src/main/java/com/leadcampusapp/CompletionModelImages.java new file mode 100644 index 0000000..210a666 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/CompletionModelImages.java @@ -0,0 +1,28 @@ +package com.leadcampusapp; + +import java.util.ArrayList; + +/** + * Created by deepshikha on 3/3/17. + */ + +public class CompletionModelImages { + String str_folder; + ArrayList al_imagepath; + + public String getStr_folder() { + return str_folder; + } + + public void setStr_folder(String str_folder) { + this.str_folder = str_folder; + } + + public ArrayList getAl_imagepath() { + return al_imagepath; + } + + public void setAl_imagepath(ArrayList al_imagepath) { + this.al_imagepath = al_imagepath; + } +} diff --git a/app/src/main/java/com/leadcampusapp/CompletionProjectFragment.java b/app/src/main/java/com/leadcampusapp/CompletionProjectFragment.java new file mode 100644 index 0000000..d042a37 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/CompletionProjectFragment.java @@ -0,0 +1,2377 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 22-06-2018. + */ + +import android.app.AlertDialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.database.Cursor; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.Canvas; +import android.graphics.Matrix; +import android.graphics.Paint; +import android.media.ExifInterface; +import android.net.Uri; +import android.os.AsyncTask; +import android.os.Bundle; +import android.os.Environment; +import android.provider.MediaStore; +import androidx.fragment.app.Fragment; +import androidx.appcompat.widget.AppCompatSpinner; +//import androidx.appcompat.widget.DefaultItemAnimator; +//import androidx.appcompat.widget.GridLayoutManager; +import androidx.recyclerview.widget.DefaultItemAnimator; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import android.util.Log; +import android.view.KeyEvent; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.EditText; +import android.widget.ImageButton; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.ProgressBar; +import android.widget.RelativeLayout; +import android.widget.TextView; +import android.widget.Toast; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.MarshalBase64; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Set; + +import it.sauronsoftware.ftp4j.FTPClient; +import it.sauronsoftware.ftp4j.FTPDataTransferListener; + +import static android.app.Activity.RESULT_CANCELED; +import static android.app.Activity.RESULT_OK; +import static android.view.View.GONE; +import static com.leadcampusapp.CompletionGalleryFolderSelectActivity.imageFilePath; + +public class CompletionProjectFragment extends Fragment { + private Context context; + private AppCompatSpinner spin_completedProject; + private String userChoosenTask; + private int REQUEST_CAMERA = 2, SELECT_FILE = 1; + private View view4; + + + + private Button btn_submitCompletion; + private HashMap mapProjectIdProject; + + private LinearLayout lnrlyt_ProjectName; + private LinearLayout lnrlyt_projectType; + private LinearLayout lnrlyt_projObjective; + private LinearLayout lnrlyt_placeOfimpl; + private LinearLayout lnrlyt_leadFunded; + private LinearLayout lnrlyt_challanges; + //private LinearLayout lnrlyt_uploadImage; + private Button lnrlyt_submit; + + private LinearLayout lnrlyt_txtUploadProj; + private LinearLayout lnrlyt_uploadDocument; + + private String selectedProject; + + private TextView txt_projectName; + private TextView txt_projectType; + private TextView txt_beneficiaries; + private TextView txt_objective; + private TextView txt_leadFunded; + private TextView txt_approvedAmt; + + private EditText edt_fundRaised; + private EditText edt_challanges; + private EditText edt_learning; + private EditText edt_story; + private EditText edt_resourcesUtilised; + //private EditText edt_resourcesUtilisedAmt; + + public static final String PREFBook_Stud= "prefbook_stud"; //sharedpreference Book + public static final String PrefID_RegID = "prefid_regid"; // + public static final String PrefID_SLeadID = "prefid_sleadid"; // + private SharedPreferences shardpref_S_obj; + private String str_leadId,str_RegistrationId; + + // public static String imageFilePath; + + static final String FTP_HOST= "54.169.178.228"; + + /********* FTP USERNAME ***********/ + static final String FTP_USER = "administrator"; + + /********* FTP PASSWORD ***********/ + static final String FTP_PASS ="y7Kvso7;ZFz"; + + private ArrayList arrlstUploadedImageBitmap = null; + + private ArrayList arrlstUploadImageByteArray = null; + + private ProgressDialog progressDialog; + private ImageView btn_uploadReport; + private static final int PICKFILE_RESULT_CODE = 45; + private byte[] docbyteArray = null; + private String extensions = null; + private ImageButton btn_additional; + private Button btn_removeProjImag; + private RelativeLayout rl_relativelayout; + private TextView txt_placeOfImpl; + + + private File actualImage,compressedImage; + + private TextView fileSelected; + + private RelativeLayout rowLinearLayout; + + private File img; + private static Uri fileUri; + File imageFile; + String path; + ImageView imgProj; + + private ImageAdapter imageAdapter; + private ArrayList imageUrls; + private ArrayList imgurlss; + private HashMap cameraImgMap; + private ProgressDialog pd; + private List imagesEncodedList; + private List imagesbyteEncodedList; + private ArrayList imagesbyteEncodedListAll; + private String imageEncoded; + + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) + { + + context = getActivity().getBaseContext(); + final View view = inflater.inflate(R.layout.completionproject_fragment, container, false); + view4 = view; + + + shardpref_S_obj=getActivity().getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + str_leadId = shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + Log.d("str_leadId:",str_leadId); + //Toast.makeText(context,"LeadId: "+str_leadId,Toast.LENGTH_LONG).show(); + + shardpref_S_obj.getString(PrefID_RegID, "").trim(); + str_RegistrationId = shardpref_S_obj.getString(PrefID_RegID, "").trim(); + Log.d("str_RegistrationId:",str_RegistrationId); + + + + initializeViews(); + + rl_relativelayout = (RelativeLayout) view4.findViewById(R.id.relativelayout_RL); + rl_relativelayout.setVisibility(View.INVISIBLE); + + LoadApprovedProject loadApprovedProject = new LoadApprovedProject(getActivity()); + loadApprovedProject.execute(); + + + btn_submitCompletion.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + //Toast.makeText(context,"You clicked on submit please wait",Toast.LENGTH_SHORT).show(); + + /* pd = new ProgressDialog(context); + pd.setMessage("Submitting please wait"); + pd.show();*/ + + + if (checkMandatory()) + { + btn_submitCompletion.setVisibility(View.GONE); + /* imgurlss.clear(); + imgurlss.addAll(imageAdapter.getImageList());*/ + + //Log.d("imgurlsssizeisss", String.valueOf(imageAdapter.getImageList().size())); + + /* for(String imgUrl : imgurlss) + { + Log.d("imgUrlissssss",imgUrl); + Bitmap bitmap; + BitmapFactory.Options bmOptions = new BitmapFactory.Options(); + + if(imgUrl.startsWith("content")){ + bitmap = cameraImgMap.get(imgUrl); + }else { + bitmap = BitmapFactory.decodeFile(imgUrl, bmOptions); + } + + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); + byte[] imageInByte; + imageInByte = stream.toByteArray(); +*/ + //String encodedImageString = Base64.encodeToString(imageInByte, Base64.DEFAULT); + //Log.d("encodeImageStringssssss",encodedImageString); + + /* if(!imgUrl.startsWith("content")) { + String where = MediaStore.MediaColumns.DATA + "=?"; + String[] selectionArgs = new String[]{imgUrl}; + ContentResolver contentResolver = context.getContentResolver(); + Uri filesUri = MediaStore.Files.getContentUri("external"); + + int deleted = contentResolver.delete(filesUri, where, selectionArgs); + Log.d("deltedCountcontentissss", String.valueOf(deleted)); + }else{ + ContentResolver contentResolver = context.getContentResolver(); + Uri filesUri = Uri.parse(imgUrl); + int deleted = contentResolver.delete(filesUri, null, null); + Log.d("deletedCountCameraissss", String.valueOf(deleted)); + }*/ + + //arrlstUploadedImageBitmap.add(encodedImageString); + + /* arrlstUploadImageByteArray.add(imageInByte); + }*/ + + //bitmap = Bitmap.createScaledBitmap(bitmap,parent.getWidth(),parent.getHeight(),true); + //imageView.setImageBitmap(bitmap); + + // ArrayList byteArrayImage = CompletionProjectStaticClass.getByteArrayImage(); + byte[] byteImage = CompletionProjectStaticClass.getBytesImage(); + ArrayList byteArrayImage; + byteArrayImage = new ArrayList<>(); + + byteArrayImage.addAll(imagesbyteEncodedListAll); + + /* if(byteArrayImage!=null){ + for(int i=0;i= 4) { + btn_submitCompletion.setVisibility(View.VISIBLE); + Log.d("insidesizessssss", "greater than 4"); + //Toast.makeText(getActivity(),"Inside size greater than 4",Toast.LENGTH_SHORT).show(); + //pd.dismiss(); + UploadProjectImages uploadProjectImages = new UploadProjectImages(getActivity()); + uploadProjectImages.execute(); + } else { + //pd.dismiss(); + Toast.makeText(getActivity(), "Please Upload atleast 4 images", Toast.LENGTH_LONG).show(); + //btn_submitCompletion.setVisibility(View.VISIBLE); + } + } + } + } + }); + + + btn_removeProjImag.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if(imageAdapter!=null) { + imageAdapter.clear(); + imageUrls.clear(); + imageAdapter = null; + }else{ + Toast.makeText(context,"No Images to remove",Toast.LENGTH_SHORT).show(); + } + } + }); + + + spin_completedProject.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView parent, View view, int position, long id) { + if(!spin_completedProject.getSelectedItem().toString().equals("List Of Projects") && !spin_completedProject.getSelectedItem().toString().equals("No Approved Projects")){ + selectedProject = spin_completedProject.getSelectedItem().toString(); + + GetProjectDetails getProjctDtls = new GetProjectDetails(getActivity()); + getProjctDtls.execute(); + } + } + + @Override + public void onNothingSelected(AdapterView parent) { + + } + }); + + + btn_additional.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + selectImage(); + } + }); + + btn_uploadReport.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + /* String[] mimeTypes = {"application/pdf","application/msword","application/vnd.ms-excel"}; + + String mimeTypesStr = ""; + for (String mimeType : mimeTypes) { + mimeTypesStr += mimeType + "|"; + } + + Intent intent = new Intent(Intent.ACTION_GET_CONTENT); + intent.setType(mimeTypesStr.substring(0,mimeTypesStr.length() - 1)); + startActivityForResult(intent,PICKFILE_RESULT_CODE);*/ + Intent documentIntent = new Intent(getActivity().getBaseContext(),CompletionDocumentFolderSelectActivity.class); + startActivityForResult(documentIntent,SELECT_FILE); + + + + } + }); + + return view; + + + }// end of oncreate() + +/* @Override + public void onDetach() { + Log.d("insideexitsss","exitsssss"); + + for(String imgUrl : imageUrls){ + if(!imgUrl.startsWith("content")) { + String where = MediaStore.MediaColumns.DATA + "=?"; + String[] selectionArgs = new String[]{imgUrl}; + ContentResolver contentResolver = context.getContentResolver(); + Uri filesUri = MediaStore.Files.getContentUri("external"); + + int deleted = contentResolver.delete(filesUri, where, selectionArgs); + Log.d("deltedCountcontentissss", String.valueOf(deleted)); + }else{ + ContentResolver contentResolver = context.getContentResolver(); + Uri filesUri = Uri.parse(imgUrl); + int deleted = contentResolver.delete(filesUri, null, null); + Log.d("deletedCountCameraissss", String.valueOf(deleted)); + } + } + super.onDetach(); + }*/ + + private boolean checkMandatory() { + + String str_challanges = edt_challanges.getText().toString(); + String str_learning = edt_learning.getText().toString(); + String str_story = edt_story.getText().toString(); + + + if(str_challanges.isEmpty()){ + //pd.dismiss(); + edt_challanges.setError("Enter the challenges"); + edt_challanges.requestFocus(); + return false; + } + + if(str_learning.isEmpty()){ + //pd.dismiss(); + edt_learning.setError("Enter the learnings"); + edt_learning.requestFocus(); + return false; + } + + if(str_story.isEmpty()){ + //pd.dismiss(); + edt_story.setError("Enter the story"); + edt_story.requestFocus(); + return false; + } + else{ + return true; + } + } + + + public class UploadProjectImages extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + /*private ProgressBar progressBar;*/ + + UploadProjectImages (Context ctx) + { + context = ctx; + pd = new ProgressDialog(context); + pd.setMessage("Submitting your request please wait. If you press back button your request will be uploaded in the backend"); + pd.show(); + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + SoapPrimitive response =null; + + /* for(int k=0;k " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + //getActivity().finish(); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + + } + }); + /* getActivity().finish();*/ + } + return null; + } + + public class SubmitForCompletion extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + SubmitForCompletion (Context ctx){ + context = ctx; + } + + @Override + protected SoapPrimitive doInBackground(Void... params) { + SoapPrimitive response = submitCompletionProject(); + return response; + } + + @Override + protected void onPreExecute() { + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + Toast.makeText(getActivity(),result.toString(),Toast.LENGTH_LONG).show(); + pd.dismiss(); + //progressDialog.dismiss(); + if(result!=null) { + if (result.toString().equalsIgnoreCase("success")) { + //pd.dismiss(); + getActivity().finish(); + } + }else{ + //getActivity().finish(); + } + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapPrimitive submitCompletionProject() { + String METHOD_NAME = "UpdateProjectCompletions"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/UpdateProjectCompletions"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + Log.d("Insidexxxxx","submitCompletionProject"); + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + request.addProperty("leadId",str_leadId); + request.addProperty("RegistrationId",str_RegistrationId); + + Log.d("Projectssssssss", String.valueOf(mapProjectIdProject.get(selectedProject))); + + request.addProperty("ProjectId",mapProjectIdProject.get(selectedProject)); + + if(edt_fundRaised != null){ + int length = edt_fundRaised.getText().length(); + Log.d("Lengthisss", String.valueOf(length)); + if(length > 0) { + Log.d("beforelengthgreaterthan","zero"); + String str_fundRaised = edt_fundRaised.getText().toString(); + Log.d("str_fundraisedafter", str_fundRaised); + if (!str_fundRaised.equals(null) && !str_fundRaised.isEmpty() && !str_fundRaised.equals("")) { + request.addProperty("FundsRaised", str_fundRaised); + } else { + request.addProperty("FundsRaised", "0"); + } + }else{ + request.addProperty("FundsRaised", "0"); + } + }else{ + request.addProperty("FundsRaised", "0"); + } + + if(edt_challanges.getText()!=null) { + String str_Challanges = edt_challanges.getText().toString(); + if (!str_Challanges.isEmpty() && !str_Challanges.equals("") && !str_Challanges.equals(null)) { + request.addProperty("Challenge", str_Challanges); + } else { + request.addProperty("Challenge", ""); + } + }else{ + request.addProperty("Challenge", ""); + } + + if(edt_learning.getText()!=null) { + String str_learning = edt_learning.getText().toString(); + if (!str_learning.isEmpty() && !str_learning.equals("") && !str_learning.equals(null)) { + request.addProperty("Learning", str_learning); + } else { + request.addProperty("Learning", ""); + } + }else{ + request.addProperty("Learning", ""); + } + + if(edt_story.getText()!=null) { + String str_story = edt_story.getText().toString(); + if (!str_story.isEmpty() && !str_story.equals("") && !str_story.equals(null)) { + request.addProperty("AsAStory", str_story); + } else { + request.addProperty("AsAStory", ""); + } + }else{ + request.addProperty("AsAStory", ""); + } + + if(edt_resourcesUtilised.getText() != null){ + String str_resourceUtilised = edt_resourcesUtilised.getText().toString(); + Log.d("StringResourcesUtilised",str_resourceUtilised); + + if (!str_resourceUtilised.isEmpty() && !str_resourceUtilised.equals("") && !str_resourceUtilised.equals(null)) { + request.addProperty("Resource", str_resourceUtilised); + } else { + request.addProperty("Resource", ""); + } + } + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //new MarshalBase64().register(envelope); + //new Marshal.register(envelope); + + envelope.dotNet = true; + + + + + //Set output SOAP object + envelope.setOutputSoapObject(request); + + + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Projects.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + Log.d("soaprespsubmitComplnPrj",envelope.getResponse().toString()); + + //Log.d("Requestsssss",request.toString()); + + + //SoapObject response = (SoapObject) envelope.getResponse(); + + //return null; + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + //Log.e("soaprespsubmitComplnPrj",response.toString()); + return response; + + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + //getActivity().finish(); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + + } + + public class UploadProjectDocument extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + UploadProjectDocument (Context ctx){ + context = ctx; + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + SoapPrimitive response =null; + + response = uploadProjectDocument(); + + //Log.d("Soap response is",response.toString()); + return response; + + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) view4.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + /* Toast.makeText(getActivity(),result.toString(),Toast.LENGTH_LONG).show(); + progressDialog.dismiss();*/ + + + if(result != null) { + if (result.toString().equalsIgnoreCase("success")) { + //Log.d("FinalSoapResult",result.toString()); +/* LoadApprovedProject loadApprovedProject = new LoadApprovedProject(getActivity()); + loadApprovedProject.execute();*/ + + SubmitForCompletion submitForCompletion = new SubmitForCompletion(getActivity()); + submitForCompletion.execute(); + } else { + Toast.makeText(getActivity(), result.toString(), Toast.LENGTH_LONG).show(); + progressDialog.dismiss(); + } + + Log.d("Resultisssss", result.toString()); + }else{ + progressDialog.dismiss(); + } + + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapPrimitive uploadProjectDocument() { + String METHOD_NAME = "UpdateProjectCompletionDocument"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/UpdateProjectCompletionDocument"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + Log.d("Insidexxxxx","uploadProjectDocumentssss"); + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + request.addProperty("leadId",str_leadId); + request.addProperty("RegistrationId",str_RegistrationId); + + Log.d("Projectssssssss", String.valueOf(mapProjectIdProject.get(selectedProject))); + request.addProperty("ProjectId",mapProjectIdProject.get(selectedProject)); + + request.addProperty("docFile",docbyteArray); + request.addProperty("extension",extensions); + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + new MarshalBase64().register(envelope); + + envelope.dotNet = true; + envelope.setOutputSoapObject(request); + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Projects.toString().trim()); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //Log.d("soaprespUpldPrjctDoc",envelope.getResponse().toString()); + + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + //Log.e("soaprespUpldPrjctDoc",response.toString()); + return response; + + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + //getActivity().finish(); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + } + + + private void initializeViews() { + mapProjectIdProject = new HashMap(); + + lnrlyt_ProjectName = (LinearLayout) view4.findViewById(R.id.lnrlyt_ProjectName); + lnrlyt_projectType = (LinearLayout) view4.findViewById(R.id.lnrlyt_projectType); + lnrlyt_projObjective = (LinearLayout) view4.findViewById(R.id.lnrlyt_projObjective); + lnrlyt_placeOfimpl = (LinearLayout) view4.findViewById(R.id.lnrlyt_placeOfimpl); + lnrlyt_leadFunded = (LinearLayout) view4.findViewById(R.id.lnrlyt_leadFunded); + lnrlyt_challanges = (LinearLayout) view4.findViewById(R.id.lnrlyt_challanges); + //lnrlyt_uploadImage = (LinearLayout) view4.findViewById(R.id.lnrlyt_uploadImage); + //lnrlyt_submit = (Button) view4.findViewById(R.id.lnrlyt_submit); + + lnrlyt_txtUploadProj = (LinearLayout) view4.findViewById(R.id.lnrlyt_txtUploadProj); + lnrlyt_uploadDocument = (LinearLayout) view4.findViewById(R.id.lnrlyt_uploadDocument); + + txt_projectName = (TextView) view4.findViewById(R.id.txt_projectName); + txt_projectType = (TextView) view4.findViewById(R.id.txt_projectType); + txt_beneficiaries = (TextView) view4.findViewById(R.id.txt_beneficiaries); + txt_objective = (TextView) view4.findViewById(R.id.txt_objective); + txt_leadFunded = (TextView) view4.findViewById(R.id.txt_leadFunded); + txt_approvedAmt = (TextView) view4.findViewById(R.id.txt_approvedAmt); + + //edt_placeOfImpl = (EditText) view4.findViewById(R.id.edt_placeOfImpl); + edt_fundRaised = (EditText) view4.findViewById(R.id.edt_fundRaised); + edt_challanges = (EditText) view4.findViewById(R.id.edt_challanges); + edt_learning = (EditText) view4.findViewById(R.id.edt_learning); + edt_story = (EditText) view4.findViewById(R.id.edt_story); + + edt_resourcesUtilised = (EditText) view4.findViewById(R.id.edt_resourcesUtilised); + //edt_resourcesUtilisedAmt = (EditText) view4.findViewById(R.id.edt_resourcesUtilisedAmt); + + spin_completedProject = (AppCompatSpinner) view4.findViewById(R.id.spin_completedProject);// + //btn_uploadReport = (Button) view4.findViewById(R.id.btn_uploadReport); + + btn_uploadReport = (ImageView) view4.findViewById(R.id.btn_uploadReport); + + btn_additional = (ImageButton) view4.findViewById(R.id.btn_addProject); + + fileSelected = (TextView) view4.findViewById(R.id.txt_fileSelected); + + txt_placeOfImpl = (TextView) view4.findViewById(R.id.txt_placeOfImpl); + + btn_submitCompletion = (Button) view4.findViewById(R.id.btn_submitCompletion); + + btn_removeProjImag = (Button) view4.findViewById(R.id.btn_removeProjImag); + + //coordinatorLayout = (CoordinatorLayout) view4.findViewById(R.id.coordinatorLayout); + + imageUrls = new ArrayList(); + + imgurlss = new ArrayList(); + + arrlstUploadedImageBitmap = new ArrayList(); + + cameraImgMap = new HashMap(); + + arrlstUploadImageByteArray = new ArrayList(); + } + + public class LoadApprovedProject extends AsyncTask { + + AlertDialog alertDialog; + + LoadApprovedProject (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + + } + + + @Override + protected SoapObject doInBackground(Void... params) { + SoapObject response = loadApprovedProjects(); + + //Log.d("LoadApprovedProjectRes:",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) view4.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + + progressDialog.setMessage("Loading"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + + if(arrlstUploadedImageBitmap!=null && !arrlstUploadedImageBitmap.isEmpty()) { + arrlstUploadedImageBitmap.clear(); + } + + } + + @Override + protected void onPostExecute(SoapObject result) { + + if(result != null){ + mapProjectIdProject.clear(); + + for (int i = 0; i < result.getPropertyCount(); i++) { + SoapObject list = (SoapObject) result.getProperty(i); + SoapPrimitive S_ProjectTitle, S_ProjectId, S_Status; + Object O_ProjectTitle, O_ProjectId, O_Status; + String str_ProjectTitle = null, str_ProjectId = null, str_Status = null; + + O_Status = list.getProperty("status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) list.getProperty("status"); + Log.d("Status", S_Status.toString()); + str_Status = S_Status.toString(); + } + if (str_Status.equalsIgnoreCase("success")) { + Log.d("Inside", "Successs"); + + O_ProjectTitle = list.getProperty("Title"); + if (!O_ProjectTitle.toString().equals("anyType{}") && !O_ProjectTitle.toString().equals(null)) { + S_ProjectTitle = (SoapPrimitive) list.getProperty("Title"); + Log.d("Title", S_ProjectTitle.toString()); + str_ProjectTitle = O_ProjectTitle.toString(); + } + + O_ProjectId = list.getProperty("PDId"); + if (!O_ProjectId.toString().equals("anyType{}") && !O_ProjectId.toString().equals(null)) { + S_ProjectId = (SoapPrimitive) list.getProperty("PDId"); + Log.d("PDId", S_ProjectId.toString()); + str_ProjectId = O_ProjectId.toString(); + } + + mapProjectIdProject.put(str_ProjectTitle, Integer.valueOf(str_ProjectId)); + } + } + + initListOfCompletedProjectSpinner(); + + if (spin_completedProject.getSelectedItem().toString().equals("List Of Projects") || spin_completedProject.getSelectedItem().toString().contains("No Approved")) { + + rl_relativelayout.setVisibility(View.VISIBLE); + lnrlyt_ProjectName.setVisibility(View.GONE); + lnrlyt_projectType.setVisibility(View.GONE); + lnrlyt_projObjective.setVisibility(View.GONE); + lnrlyt_placeOfimpl.setVisibility(View.GONE); + lnrlyt_leadFunded.setVisibility(View.GONE); + lnrlyt_challanges.setVisibility(View.GONE); + //lnrlyt_uploadImage.setVisibility(View.GONE); + //lnrlyt_submit.setVisibility(View.GONE); + btn_submitCompletion.setVisibility(View.GONE); + + lnrlyt_txtUploadProj.setVisibility(View.GONE); + lnrlyt_uploadDocument.setVisibility(View.GONE); + + + } else { + rl_relativelayout.setVisibility(View.VISIBLE); + lnrlyt_ProjectName.setVisibility(View.VISIBLE); + lnrlyt_projectType.setVisibility(View.VISIBLE); + lnrlyt_projObjective.setVisibility(View.VISIBLE); + lnrlyt_placeOfimpl.setVisibility(View.VISIBLE); + lnrlyt_leadFunded.setVisibility(View.VISIBLE); + lnrlyt_challanges.setVisibility(View.VISIBLE); + //lnrlyt_uploadImage.setVisibility(View.VISIBLE); + //lnrlyt_submit.setVisibility(View.VISIBLE); + btn_submitCompletion.setVisibility(View.VISIBLE); + + lnrlyt_txtUploadProj.setVisibility(View.VISIBLE); + lnrlyt_uploadDocument.setVisibility(View.VISIBLE); + } + + } + + //progressBar.setVisibility(View.GONE); + progressDialog.dismiss(); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + public class GetProjectDetails extends AsyncTask { + + AlertDialog alertDialog; + private ProgressBar progressBar; + + GetProjectDetails (Context ctx){ + context = ctx; + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapObject response = getProjectDtls(); + + //Log.d("Soapresponseissssss",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) view4.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); + } + + @Override + protected void onPostExecute(SoapObject result) { + + if(result!=null) { + + SoapPrimitive S_Status; + Object O_Status; + String str_status = null; + + + O_Status = result.getProperty("status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) result.getProperty("status"); + Log.d("Title", S_Status.toString()); + str_status = O_Status.toString(); + } + + if (!str_status.equals("Success")) { + lnrlyt_ProjectName.setVisibility(View.GONE); + lnrlyt_projectType.setVisibility(View.GONE); + lnrlyt_projObjective.setVisibility(View.GONE); + lnrlyt_placeOfimpl.setVisibility(View.GONE); + lnrlyt_leadFunded.setVisibility(View.GONE); + lnrlyt_challanges.setVisibility(View.GONE); + //lnrlyt_uploadImage.setVisibility(View.GONE); + //lnrlyt_submit.setVisibility(View.GONE); + btn_submitCompletion.setVisibility(View.GONE); + lnrlyt_txtUploadProj.setVisibility(View.GONE); + lnrlyt_uploadDocument.setVisibility(View.GONE); + + + Toast.makeText(getActivity(), str_status, Toast.LENGTH_LONG).show(); + } else { + lnrlyt_ProjectName.setVisibility(View.VISIBLE); + lnrlyt_projectType.setVisibility(View.VISIBLE); + lnrlyt_projObjective.setVisibility(View.VISIBLE); + lnrlyt_placeOfimpl.setVisibility(View.VISIBLE); + lnrlyt_leadFunded.setVisibility(View.VISIBLE); + lnrlyt_challanges.setVisibility(View.VISIBLE); + //lnrlyt_uploadImage.setVisibility(View.VISIBLE); + //lnrlyt_submit.setVisibility(View.VISIBLE); + btn_submitCompletion.setVisibility(View.VISIBLE); + + lnrlyt_txtUploadProj.setVisibility(View.VISIBLE); + lnrlyt_uploadDocument.setVisibility(View.VISIBLE); + + + SoapPrimitive S_ProjectName, S_ProjectType, S_Beneficiaries, S_Objectives, S_LeadFunded, S_ApprovedAmount, S_Placeofimplement; + Object O_ProjectName, O_ProjectType, O_Beneficiaries, O_Objectives, O_LeadFunded, O_ApprovedAmount, O_Placeofimplement; + String str_ProjectName = null, str_ProjectType = null, str_Beneficiaries = null, str_Objectives, str_LeadFunded, str_ApprovedAmount, str_Placeofimplement; + + + O_ProjectName = result.getProperty("Title"); + if (!O_ProjectName.toString().equals("anyType{}") && !O_ProjectName.toString().equals(null)) { + S_ProjectName = (SoapPrimitive) result.getProperty("Title"); + Log.d("Title:", S_ProjectName.toString()); + str_ProjectName = S_ProjectName.toString(); + txt_projectName.setText(str_ProjectName); + } + + O_ProjectType = result.getProperty("ThemeName"); + if (!O_ProjectType.toString().equals("anyType{}") && !O_ProjectType.toString().equals(null)) { + S_ProjectType = (SoapPrimitive) result.getProperty("ThemeName"); + Log.d("Project Type", S_ProjectType.toString()); + str_ProjectType = S_ProjectType.toString(); + txt_projectType.setText(str_ProjectType); + } + + O_Beneficiaries = result.getProperty("BeneficiaryNo"); + if (!O_Beneficiaries.toString().equals("anyType{}") && !O_Beneficiaries.toString().equals(null)) { + S_Beneficiaries = (SoapPrimitive) result.getProperty("BeneficiaryNo"); + Log.d("Beneficiaries:", S_Beneficiaries.toString()); + str_Beneficiaries = S_Beneficiaries.toString(); + txt_beneficiaries.setText(str_Beneficiaries); + } + + O_Objectives = result.getProperty("Objectives"); + if (!O_Objectives.toString().equals("anyType{}") && !O_Objectives.toString().equals(null)) { + S_Objectives = (SoapPrimitive) result.getProperty("Objectives"); + Log.d("Objectives:", S_Objectives.toString()); + str_Objectives = S_Objectives.toString(); + txt_objective.setText(str_Objectives); + } + + O_LeadFunded = result.getProperty("giventotal"); + if (!O_LeadFunded.toString().equals("anyType{}") && !O_LeadFunded.toString().equals(null)) { + S_LeadFunded = (SoapPrimitive) result.getProperty("giventotal"); + Log.d("Lead Funded:", S_LeadFunded.toString()); + str_LeadFunded = S_LeadFunded.toString(); + txt_leadFunded.setText(str_LeadFunded); + } + + O_ApprovedAmount = result.getProperty("SanctionAmount"); + if (!O_ApprovedAmount.toString().equals("anyType{}") && !O_ApprovedAmount.toString().equals(null)) { + S_ApprovedAmount = (SoapPrimitive) result.getProperty("SanctionAmount"); + Log.d("Approved Amount:", S_ApprovedAmount.toString()); + str_ApprovedAmount = S_ApprovedAmount.toString(); + txt_approvedAmt.setText(str_ApprovedAmount); + } + + O_Placeofimplement = result.getProperty("Placeofimplement"); + if (!O_Placeofimplement.toString().equals("anyType{}") && !O_Placeofimplement.toString().equals(null)) { + S_Placeofimplement = (SoapPrimitive) result.getProperty("Placeofimplement"); + Log.d("Placeofimplement:", S_Placeofimplement.toString()); + str_Placeofimplement = S_Placeofimplement.toString(); + txt_placeOfImpl.setText(str_Placeofimplement); + } + + + } + } + progressBar.setVisibility(View.GONE); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapObject getProjectDtls() { + String METHOD_NAME = "CompletionGetApprovedProjectDetails"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/CompletionGetApprovedProjectDetails"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + request.addProperty("leadId",str_leadId); + request.addProperty("PDId",mapProjectIdProject.get(selectedProject)); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + envelope.setOutputSoapObject(request); + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Projects.toString().trim()); + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + SoapObject response = (SoapObject) envelope.getResponse(); + Log.e("soapcompletionxxxx",response.toString()); + return response; + + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + //getActivity().finish(); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + + } + + private SoapObject loadApprovedProjects() + { + String METHOD_NAME = "CompletionGetApprovedProjectList"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/CompletionGetApprovedProjectList"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + request.addProperty("Lead_Id",str_leadId); + + //users.ad + //request.add + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Projects.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + SoapObject response = (SoapObject) envelope.getResponse(); + //Log.e("ResponseGetApproved:",envelope.getResponse().toString()); + return response; + + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + //getActivity().finish(); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + } + + + @Override + public void onActivityResult(int requestCode, int resultCode, Intent data) + { + super.onActivityResult(requestCode, resultCode, data); + + if (resultCode == RESULT_OK) { + // if (requestCode == SELECT_FILE) { + //onSelectFromGalleryResult(data); + + + /* String[] filePathColumn = { MediaStore.Images.Media.DATA }; + imagesEncodedList = new ArrayList(); + if(data.getData()!=null){ + + Uri mImageUri=data.getData(); + + // Get the cursor + Cursor cursor = getActivity().getBaseContext().getContentResolver().query(mImageUri, + filePathColumn, null, null, null); + // Move to first row + cursor.moveToFirst(); + + int columnIndex = cursor.getColumnIndex(filePathColumn[0]); + imageEncoded = cursor.getString(columnIndex); + cursor.close(); + + ArrayList mArrayUri = new ArrayList(); + mArrayUri.add(mImageUri); + + Log.d("ImageEncodedissssssssif",imageEncoded); + + + + *//* galleryAdapter = new GalleryAdapter(getApplicationContext(),mArrayUri); + gvGallery.setAdapter(galleryAdapter); + gvGallery.setVerticalSpacing(gvGallery.getHorizontalSpacing()); + ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) gvGallery + .getLayoutParams(); + mlp.setMargins(0, gvGallery.getHorizontalSpacing(), 0, 0);*//* + + } else { + if (data.getClipData() != null) { + ClipData mClipData = data.getClipData(); + ArrayList mArrayUri = new ArrayList(); + for (int i = 0; i < mClipData.getItemCount(); i++) { + + ClipData.Item item = mClipData.getItemAt(i); + Uri uri = item.getUri(); + mArrayUri.add(uri); + // Get the cursor + Cursor cursor = getActivity().getBaseContext().getContentResolver().query(uri, filePathColumn, null, null, null); + // Move to first row + cursor.moveToFirst(); + + int columnIndex = cursor.getColumnIndex(filePathColumn[0]); + imageEncoded = cursor.getString(columnIndex); + imagesEncodedList.add(imageEncoded); + + Log.d("ImageEncodedisssssssselse",imageEncoded); + + cursor.close(); + + *//* galleryAdapter = new GalleryAdapter(getApplicationContext(),mArrayUri); + gvGallery.setAdapter(galleryAdapter); + gvGallery.setVerticalSpacing(gvGallery.getHorizontalSpacing()); + ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) gvGallery + .getLayoutParams(); + mlp.setMargins(0, gvGallery.getHorizontalSpacing(), 0, 0);*//* + + } + Log.v("LOG_TAG", "Selected Images" + mArrayUri.size()); + } + }*/ + + + /* Log.d("InsideActivity","Resultsssssssssssss"); + + + } + + else*/ if (requestCode == REQUEST_CAMERA) { + String path1= CommonUtils.compressImage(imageFilePath); + Log.e("tag","path1"+path1); + /* GetImageThumbnail getImageThumbnail = new GetImageThumbnail(); + + Bitmap bitmap = null; + try { + bitmap = getImageThumbnail.getThumbnail(fileUri, getActivity()); + } catch (IOException e) { + e.printStackTrace(); + } +*/ + Bitmap bitmap=BitmapFactory.decodeFile(new File(imageFilePath).getAbsolutePath()); + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream); + byte[] imageInByte; + imageInByte = stream.toByteArray(); + Bitmap bm = BitmapFactory.decodeByteArray(imageInByte, 0, imageInByte.length); + // String path = MediaStore.Images.Media.insertImage(getActivity().getContentResolver(), bm, "Titledddd", null); + + cameraImgMap.put(path1,bm); + + CompletionProjectStaticClass.setBytesImage(imageInByte); ///Image(imageInByte); + // arrlstUploadImageByteArray.add(imageInByte); + // Log.e("tag","cameraImgMap="+cameraImgMap); + //imageUrls.add(path); + /* if(imageAdapter!=null) { + //imageUrls.clear(); + imageUrls.addAll(imageAdapter.getImageList()); + imageUrls.add(path); + }else{ + imageUrls.add(path); + }*/ + + + + + /* if(imageAdapter!=null) { + + Log.d("imageAdapterStringsss1",imageAdapter.getImageList().toString()); + Log.d("imageUrlsStringsss1",imageUrls.toString()); + + ArrayList sample = new ArrayList(); + for(String imgUrl : imageUrls){ + for (int j = 0; j < imageAdapter.getImageList().size(); j++) { + if ((imgUrl.equals(imageAdapter.getImageList().get(j)))){ + Log.d("ImageURLtobedeletedisss",imgUrl); + String imgiss = imgUrl; + //imageUrls.remove(imgiss); + + sample.add(imgiss); + } + } + } + imageUrls.removeAll(sample); + + Log.d("imageAdapterStringsss2",imageAdapter.getImageList().toString()); + Log.d("imageUrlsStringsss2",imageUrls.toString()); + + }*/ + + /* ArrayList dummyimageUrls = new ArrayList(); + dummyimageUrls.addAll(imageUrls); + + if(imageAdapter!=null){ + ArrayList currentList = imageAdapter.getImageList(); + + Iterator it = dummyimageUrls.iterator(); + + ArrayList sample = new ArrayList(); + while(it.hasNext()){ + String simple = it.next(); + System.out.println(simple); + if(!currentList.contains(simple)){ + //dummyimageUrls.remove(simple); + sample.add(simple); + } + } + dummyimageUrls.removeAll(sample); + } + + imageUrls.clear(); + imageUrls.addAll(dummyimageUrls);*/ + + + if(imageAdapter!=null) { + imageUrls.clear(); + Log.d("imageAdapterss",imageAdapter.getImageList().toString()); + imageUrls.addAll(imageAdapter.getImageList()); + } + + imageUrls.add(path1); + + /*ArrayList mArrayUri = new ArrayList(); + + LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + final View rowView = inflater.inflate(R.layout.upload_project_image, null); + + ImageView img_proj = (ImageView) rowView.findViewById(R.id.img_projImage); + + Log.d("Childcountisss", String.valueOf(parentLinearLayout.getChildCount())); + + btnUploadId = (parentLinearLayout.getChildCount()+1)*1000; + + projImageId = btnUploadId + 1; + + Log.d("btnUploadId", String.valueOf(btnUploadId)); + + Log.d("projImageId", String.valueOf(projImageId)); + + //btnUploadImage.setId(btnUploadId); + //img_proj.setId(projImageId); + + hashMapBtnImg.put(btnUploadId,projImageId); + + if(parentLinearLayout.getChildCount()<=9) { + parentLinearLayout.addView(rowView, parentLinearLayout.getChildCount()); + rowView.setId(projImageId+1); + rowviewId = rowView.getId(); + + rowView.setVisibility(View.GONE); + } + + if((parentLinearLayout.getChildCount() % 2) == 0){ + rowView.setPadding(160,0,0,0); + }else{ + rowView.setPadding(0,0,0,0); + } + + imageidis = projImageId; + flag = 1; + + Log.d("LOG_TAG", "Selected Images" + mArrayUri.size()); + + int id1 = getResources().getIdentifier(String.valueOf(rowviewId), "id", getActivity().getPackageName()); + rowLinearLayout = (RelativeLayout) view4.findViewById(id1); + rowLinearLayout.setVisibility(View.VISIBLE); + + */ + + /* try { + actualImage = FileUtil.from(getActivity(), Uri.parse(path)); + + Log.d("ActualImageSize", "ActualImageSizeissss " + getReadableFileSize(actualImage.length())); + String fileSize = getReadableFileSize(actualImage.length()); + String fileSizeArray[] = fileSize.split("\\s"); + + if(fileSizeArray[1].equals("GB") || fileSizeArray[1].equals("TB") || (fileSizeArray[1].equals("MB") && (Double.valueOf(fileSizeArray[0]) > 5.0))) { + compressedImage = new Compressor.Builder(getActivity()) + .setMaxWidth(740) + .setMaxHeight(480) + .setQuality(100) + .setCompressFormat(Bitmap.CompressFormat.JPEG) + .setDestinationDirectoryPath(Environment.getExternalStoragePublicDirectory( + Environment.DIRECTORY_PICTURES).getAbsolutePath()) + .build() + .compressToFile(actualImage); + //img_proj.setImageBitmap(BitmapFactory.decodeFile(compressedImage.getAbsolutePath())); + } + + else{ + //imgProj.setImageBitmap(BitmapFactory.decodeFile(actualImage.getAbsolutePath())); + //img_proj.setImageBitmap(BitmapFactory.decodeFile(actualImage.getAbsolutePath())); + } + } catch (IOException e) { + e.printStackTrace(); + }*/ + + //imgurlss.clear(); + //imgurlss.addAll(imageUrls); + initializeRecyclerView(); + //imgurlss.removeAll(imageUrls); + //imgurlss.addAll(imageAdapter.getImageList()); + + } + + else if(requestCode == PICKFILE_RESULT_CODE){ + Uri selectedUri = data.getData(); + + String filePath; + + Log.e("uri",selectedUri.toString()); + + if (selectedUri.toString().startsWith("file:")) { + filePath = selectedUri.getPath(); + } + + else { + String[] filePathColumn = {MediaStore.Images.Media.DATA}; + + Cursor cursor = getActivity().getBaseContext().getContentResolver().query(selectedUri, + filePathColumn, null, null, null); + cursor.moveToFirst(); + + int columnIndex = cursor.getColumnIndex(filePathColumn[0]); + filePath = cursor.getString(columnIndex); + cursor.close(); + } + + Log.d("filePathissssss",filePath); + + //if(selectedImage.toString("")) + + File file = new File(filePath); + + docbyteArray = new byte[(int) file.length()]; + try { + FileInputStream fileInputStream = new FileInputStream(file); + + int offset = 0; + int numRead = 0; + while (offset < docbyteArray.length && (numRead=fileInputStream.read(docbyteArray, offset, docbyteArray.length-offset)) >= 0) { + offset += numRead; + } + + // Ensure all the bytes have been read in + if (offset < docbyteArray.length) { + throw new IOException("Could not completely read file " + file.getName()); + } + + + Log.d("bytearrayisss",docbyteArray.toString()); + + String[] fileArray = filePath.split("/"); + for(int k=0;k fileArrayString; + ArrayList fileArrayByte; + ArrayList fileDocumentString; + + if( CompletionProjectStaticClass.getCountCompletion() == 1 ){ + Log.d("Inside","RESULT_CancelleddddddfromPhotosActivityIntent"); + CompletionProjectStaticClass.setCountCompletion(0); + + fileArrayString = CompletionProjectStaticClass.getFileArrayString(); + fileArrayByte = CompletionProjectStaticClass.getByteArrayImage(); + imagesEncodedList = new ArrayList(); + imagesbyteEncodedList = new ArrayList(); + imagesbyteEncodedListAll = new ArrayList<>(); + for(int i=0;i= 0) { + offset += numRead; + } + + // Ensure all the bytes have been read in + if (offset < docbyteArray.length) { + throw new IOException("Could not completely read file " + file.getName()); + } + + Log.d("bytearrayisss", docbyteArray.toString()); + + String[] fileArray = filePath.split("/"); + for (int k = 0; k < fileArray.length; k++) { + String filePart = fileArray[k]; + Log.d("Kvalueis", String.valueOf(k)); + Log.d("filePartisss", filePart); + } + + //String extArray = fil + extensions = fileArray[fileArray.length - 1].split("\\.")[1]; + + Log.d("extensionisss", extensions); + + + // Close the input stream and return bytes + fileInputStream.close(); + + Toast.makeText(getActivity(), "File is Selected", Toast.LENGTH_LONG).show(); + + fileSelected.setText(filePath); + fileSelected.setVisibility(View.VISIBLE); + + } catch (Exception e) { + + } + } + + + + + } + + + + /* int id1 = getResources().getIdentifier(String.valueOf(rowviewId), "id", getActivity().getPackageName()); + rowLinearLayout = (RelativeLayout) view4.findViewById(id1); + parentLinearLayout.removeView(rowLinearLayout);*/ + } + }// end of onActivityResult + + public String getReadableFileSize(long size) { + if (size <= 0) { + return "0"; + } + final String[] units = new String[]{"B", "KB", "MB", "GB", "TB"}; + int digitGroups = (int) (Math.log10(size) / Math.log10(1024)); + return new DecimalFormat("#,##0.#").format(size / Math.pow(1024, digitGroups)) + " " + units[digitGroups]; + } + + + private void initListOfCompletedProjectSpinner() + { + final ArrayList listCompletedProj = new ArrayList(); + if(mapProjectIdProject.size()>0) + { + rl_relativelayout.setVisibility(View.VISIBLE); + listCompletedProj.add("List Of Projects"); + + Set setCompleted = mapProjectIdProject.keySet(); + + for (String key : setCompleted) { + listCompletedProj.add(key); + } + }else{ + rl_relativelayout.setVisibility(View.INVISIBLE); + listCompletedProj.add("No Approved Projects"); + } + //ArrayAdapter dataAdapterSem = new ArrayAdapter(context, R.layout.simple_spinner_semester, listsemester); + + ArrayAdapter dataAdapterListCompleted = new ArrayAdapter(context, R.layout.simple_spinner_items, listCompletedProj); + + //ArrayAdapter dataAdapterListCompleted = ArrayAdapter.createFromResource(context, R.array.types, R.layout.simple_spinner_items); + + // Drop down layout style - list view with radio button + // dataAdapterListCompleted.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapterListCompleted.setDropDownViewResource(R.layout.spinnercustomstyle); + + // attaching data adapter to spinner + spin_completedProject.setAdapter(dataAdapterListCompleted); + //spin_completedProject.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorWhite)); + } + + + private void selectImage() + { + final CharSequence[] items = { "Take Photo", "Choose From Library", + "Cancel" }; + + AlertDialog.Builder builder; + builder = new AlertDialog.Builder(getActivity()); + + builder.setTitle("Add Photo!"); + builder.setItems(items, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int item) { + if (items[item].equals("Take Photo")) { + userChoosenTask ="Take Photo"; + cameraIntent(); + } else if (items[item].equals("Choose From Library")) { + userChoosenTask ="Choose from Library"; + galleryIntent(); + } else if (items[item].equals("Cancel")) { + /*int id1 = getResources().getIdentifier(String.valueOf(rowviewId), "id", getActivity().getPackageName()); + rowLinearLayout = (RelativeLayout) view4.findViewById(id1); + parentLinearLayout.removeView(rowLinearLayout);*/ + + dialog.dismiss(); + } + } + }); + + + builder.setOnKeyListener(new DialogInterface.OnKeyListener() { + @Override + public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { + if (keyCode == KeyEvent.KEYCODE_BACK) { + dialog.dismiss(); + } + return true; + } + }); + builder.show(); + } + + private void cameraIntent() + { + img=getOutputFromCamera(); + imageFilePath = CommonUtils.getFilename(); + File imageFile = new File(imageFilePath); + Uri imageFileUri = Uri.fromFile(imageFile); // convert path to Uri + Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); + intent.putExtra(MediaStore.EXTRA_OUTPUT, imageFileUri); // set the image file name + startActivityForResult(intent, REQUEST_CAMERA); + /*fileUri= null; + + if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + String filePath = img.getAbsolutePath(); + + ContentValues values = new ContentValues(); + values.put(MediaStore.Images.Media.DATA, filePath); + fileUri = context.getContentResolver().insert( + MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values); + } + + else{ + fileUri = Uri.fromFile(img); + } + + Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); + intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); + startActivityForResult(intent, REQUEST_CAMERA);*/ + } + + private File getOutputFromCamera() { + String timeStamp = new SimpleDateFormat(getString(R.string.txtdateformat), Locale.getDefault()).format(new Date()); + imageFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + getString(R.string.txtFileDocumentUploadImg) + timeStamp + getString(R.string.txtFileExtension)); + try { + imageFile.createNewFile(); + } catch (IOException e) { + e.printStackTrace(); + } + + //Log.d("absolute path is",imageFile.getAbsolutePath()); + return imageFile; + } + + + + + + + private void galleryIntent() + { +/* Intent intent = new Intent(); + intent.setType("image/*"); + intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); + intent.setAction(Intent.ACTION_GET_CONTENT); + startActivityForResult(Intent.createChooser(intent,"Select Picture"), SELECT_FILE);*/ + + Intent photoSelectActivity = new Intent(getActivity().getBaseContext(),CompletionGallerySelectActivity.class); + //photoSelectActivity.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + //photoSelectActivity.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY ); + //startActivity(photoSelectActivity); + startActivityForResult(photoSelectActivity,SELECT_FILE); + + } + + + + public Bitmap compressImage(String filePaths,int type) + { + + /* String filePath = getRealPathFromURI(imageUri); + Bitmap scaledBitmap = null;*/ + + String filePath = null; + + if(type==1){ + filePath = filePaths; + } + + if(type==2){ + filePath = getRealPathFromURI(filePaths); + } + + Bitmap scaledBitmap = null; + + BitmapFactory.Options options = new BitmapFactory.Options(); + +// by setting this field as true, the actual bitmap pixels are not loaded in the memory. Just the bounds are loaded. If +// you try the use the bitmap here, you will get null. + options.inJustDecodeBounds = true; + Bitmap bmp = BitmapFactory.decodeFile(filePath, options); + + int actualHeight = options.outHeight; + int actualWidth = options.outWidth; + +// max Height and width values of the compressed image is taken as 816x612 + + float maxHeight = 816.0f; + float maxWidth = 612.0f; + + + /*float maxHeight = 216.0f; + float maxWidth = 212.0f;*/ + + + float imgRatio = actualWidth / actualHeight; + float maxRatio = maxWidth / maxHeight; + +// width and height values are set maintaining the aspect ratio of the image + + if (actualHeight > maxHeight || actualWidth > maxWidth) { + if (imgRatio < maxRatio) { + imgRatio = maxHeight / actualHeight; + actualWidth = (int) (imgRatio * actualWidth); + actualHeight = (int) maxHeight; + } else if (imgRatio > maxRatio) { + imgRatio = maxWidth / actualWidth; + actualHeight = (int) (imgRatio * actualHeight); + actualWidth = (int) maxWidth; + } else { + actualHeight = (int) maxHeight; + actualWidth = (int) maxWidth; + + } + } + +// setting inSampleSize value allows to load a scaled down version of the original image + + options.inSampleSize = calculateInSampleSize(options, actualWidth, actualHeight); + +// inJustDecodeBounds set to false to load the actual bitmap + options.inJustDecodeBounds = false; + +// this options allow android to claim the bitmap memory if it runs low on memory + options.inPurgeable = true; + options.inInputShareable = true; + options.inTempStorage = new byte[16 * 1024]; + + try { +// load the bitmap from its path + bmp = BitmapFactory.decodeFile(filePath, options); + } catch (OutOfMemoryError exception) { + exception.printStackTrace(); + + } + try { + scaledBitmap = Bitmap.createBitmap(actualWidth, actualHeight, Bitmap.Config.ARGB_8888); + } catch (OutOfMemoryError exception) { + exception.printStackTrace(); + } + + float ratioX = actualWidth / (float) options.outWidth; + float ratioY = actualHeight / (float) options.outHeight; + float middleX = actualWidth / 2.0f; + float middleY = actualHeight / 2.0f; + + Matrix scaleMatrix = new Matrix(); + scaleMatrix.setScale(ratioX, ratioY, middleX, middleY); + + Canvas canvas = new Canvas(scaledBitmap); + canvas.setMatrix(scaleMatrix); + canvas.drawBitmap(bmp, middleX - bmp.getWidth() / 2, middleY - bmp.getHeight() / 2, new Paint(Paint.FILTER_BITMAP_FLAG)); + +// check the rotation of the image and display it properly + ExifInterface exif; + try { + exif = new ExifInterface(filePath); + + int orientation = exif.getAttributeInt( + ExifInterface.TAG_ORIENTATION, 0); + Log.d("EXIF", "Exif: " + orientation); + Matrix matrix = new Matrix(); + if (orientation == 6) { + matrix.postRotate(90); + Log.d("EXIF", "Exif: " + orientation); + } else if (orientation == 3) { + matrix.postRotate(180); + Log.d("EXIF", "Exif: " + orientation); + } else if (orientation == 8) { + matrix.postRotate(270); + Log.d("EXIF", "Exif: " + orientation); + } + scaledBitmap = Bitmap.createBitmap(scaledBitmap, 0, 0, + scaledBitmap.getWidth(), scaledBitmap.getHeight(), matrix, + true); + } catch (IOException e) { + e.printStackTrace(); + } + +/* FileOutputStream out = null; + String filename = getFilename(); + compressedfilepaths=filename;*/ + + /* try {*/ + //out = new FileOutputStream(filename); + +// write the compressed bitmap at the destination specified by filename. + //scaledBitmap.compress(Bitmap.CompressFormat.JPEG, 80, out); + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + + scaledBitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); + + /* } catch (FileNotFoundException e) { + e.printStackTrace(); + }*/ + + return scaledBitmap; + + }//compression Ends + + + private String getRealPathFromURI(String contentURI) { + Uri contentUri = Uri.parse(contentURI); + Cursor cursor = getActivity().getContentResolver().query(contentUri, null, null, null, null); + if (cursor == null) { + return contentUri.getPath(); + } else { + cursor.moveToFirst(); + int index = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA); + return cursor.getString(index); + } + } + + + public int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) { + final int height = options.outHeight; + final int width = options.outWidth; + int inSampleSize = 1; + + if (height > reqHeight || width > reqWidth) { + final int heightRatio = Math.round((float) height / (float) reqHeight); + final int widthRatio = Math.round((float) width / (float) reqWidth); + inSampleSize = heightRatio < widthRatio ? heightRatio : widthRatio; + } + final float totalPixels = width * height; + final float totalReqPixelsCap = reqWidth * reqHeight * 2; + while (totalPixels / (inSampleSize * inSampleSize) > totalReqPixelsCap) { + inSampleSize++; + } + + return inSampleSize; + } + + private void initializeRecyclerView() + { + + imgurlss = new ArrayList(); + + imgurlss.addAll(imageUrls); + + imagesbyteEncodedListAll.addAll(imagesbyteEncodedList); + imageAdapter = new ImageAdapter(getActivity().getApplicationContext(), imgurlss); + + RecyclerView.LayoutManager layoutManager = new GridLayoutManager(getActivity(),3); + + //RecyclerView.LayoutManager layoutManager = new GridLayoutManager(getActivity(),3, LinearLayoutManager.VERTICAL, false); + + //layoutManager.setAutoMeasureEnabled(true); + //layoutManager. + RecyclerView recyclerView = (RecyclerView) view4.findViewById(R.id.recycler_view); + recyclerView.setLayoutManager(layoutManager); + recyclerView.setItemAnimator(new DefaultItemAnimator()); + recyclerView.setHasFixedSize(false); + recyclerView.addItemDecoration(new ItemOffsetDecoration(getActivity().getApplicationContext(), R.dimen.item_offset)); + recyclerView.setAdapter(imageAdapter); + + + } + + + + + + + + + private void doFtp() { + + MyFTPClientFunctions ftpclient = null; + ftpclient = new MyFTPClientFunctions(); + + + final String host = "54.169.178.228"; + final String username = "administrator"; + final String password = "y7Kvso7;ZFz"; + + boolean status = false; + status = ftpclient.ftpConnect(host, username, password, 21); + if (status == true) { + Log.d("Connection Successsssss", "Connection Success"); + } else { + Log.d("Connection faileddddddd", "Connection failed"); + } + } + + + public void uploadFile(File fileName){ + + FTPClient client = new FTPClient(); + String imagePhotofilePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + "CameraContentDemo.jpeg"; + File imagePhotoFile = new File(imagePhotofilePath); + + try { + + client.connect(FTP_HOST,21); + + client.login(FTP_USER, FTP_PASS); + + if(client.isConnected()){ + Log.d("Connectedssssss","Yessss"+client.isConnected()); + client.setType(FTPClient.TYPE_BINARY); + client.changeDirectory("/"); + + client.upload(imagePhotoFile, new MyTransferListener()); + } + else{ + Log.d("Connectedssssss","Noooo"+client.isConnected()); + } + if(client.isAuthenticated()){ + Log.d("Authenticatedsss","Yessss"+client.isAuthenticated()); + } + else{ + Log.d("Authenticatedsss","Noooo"+client.isAuthenticated()); + } + + } catch (Exception e) { + Log.d("Exceptionsssssss",e.toString()); + e.printStackTrace(); + try { + client.disconnect(true); + } catch (Exception e2) { + e2.printStackTrace(); + } + } + + } + + public class MyTransferListener implements FTPDataTransferListener { + + public void started() { + } + + public void transferred(int length) { + + // Yet other length bytes has been transferred since the last time this + // method was called + Toast.makeText(getActivity(), " transferred ..." + length, Toast.LENGTH_SHORT).show(); + //System.out.println(" transferred ..." + length); + } + + + public void completed() { + + //btn.setVisibility(View.VISIBLE); + // Transfer completed + + Toast.makeText(getActivity(), " completed ...", Toast.LENGTH_SHORT).show(); + //System.out.println(" completed ..." ); + } + + public void aborted() { + + //btn.setVisibility(View.VISIBLE); + // Transfer aborted + Toast.makeText(getActivity()," transfer aborted , please try again...", Toast.LENGTH_SHORT).show(); + //System.out.println(" aborted ..." ); + } + + public void failed() { + + //btn.setVisibility(View.VISIBLE); + // Transfer failed + System.out.println(" failed ..." ); + } + + } + + + + public class FTPConnectTask extends AsyncTask { + + private Context context; + private ProgressBar progressBar; + + FTPConnectTask (Context context){ + this.context = context; + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) view4.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); + + } + + @Override + protected Void doInBackground(Void... params) { + File fileName = new File("sample"); + uploadFile(fileName); + return null; + } + + @Override + protected void onPostExecute(Void string) { + progressBar.setVisibility(GONE); + } + } + + +/* private void createButtonClick(int projImageId) { + int id1 = getResources().getIdentifier(String.valueOf(projImageId), "id", getActivity().getPackageName()); + img_projImage1 = (ImageView) view4.findViewById(id1); + + img_projImage1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + //Toast.makeText(getActivity(),"Button id: "+String.valueOf(v.getId()),Toast.LENGTH_LONG).show(); + *//* imageidis = v.getId(); + flag = 1;*//* + selectImage(); + } + }); + }*/ + + public Uri getImageUri(Context inContext, Bitmap inImage) { + ByteArrayOutputStream bao = new ByteArrayOutputStream(); + inImage.compress(Bitmap.CompressFormat.PNG, 100, bao); + String path = MediaStore.Images.Media.insertImage(inContext.getContentResolver(), inImage, "Title", null); + + //Log.e(TAG,"Path="+path); + return Uri.parse(path); + } + + + /** + * Showing Dialog + * */ +} diff --git a/app/src/main/java/com/leadcampusapp/CompletionProjectFragmentWPercent.java b/app/src/main/java/com/leadcampusapp/CompletionProjectFragmentWPercent.java new file mode 100644 index 0000000..293ad4d --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/CompletionProjectFragmentWPercent.java @@ -0,0 +1,496 @@ +package com.leadcampusapp; + +import android.app.ProgressDialog; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.AsyncTask; +import android.os.Bundle; +import android.os.Handler; +import androidx.fragment.app.Fragment; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.BaseAdapter; +import android.widget.ImageView; +import android.widget.ListView; +import android.widget.ProgressBar; +import android.widget.TextView; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +public class CompletionProjectFragmentWPercent extends Fragment +{ + + + private Context context; + private String Str_loadprojectE1 ="no"; + private String Str_loadprojectE2 ="no"; + + public static final String PREFBook_Stud= "prefbook_stud"; //sharedpreference Book + public static final String PrefID_RegID = "prefid_regid"; // + public static final String PrefID_SLeadID = "prefid_sleadid"; // + private SharedPreferences shardpref_S_obj; + + private String str_leadId,str_RegistrationId; + + + + + int int_responsecount; + private int noOfobjects = 0; + Class_ApprovedProjectList[] class_approvedProjectLists_arrayObj,class_approvedProjectLists_arrayObj1; + private ListView listView__projectcompletionWpercent; + + Class_ApprovedProjectList class_approvedProjectLists_obj; + private int progressStatus = 0; + private Handler handler = new Handler(); + + + private int int_setvalue=0; + String str_asyncTask_load_approvedproject_status; + TextView currently_no_project_tv; + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) + { + + // context = getActivity().getBaseContext(); + + final View view = inflater.inflate(R.layout.completionprojectwpercent_fragment, container, false); + //view4 = view; + + listView__projectcompletionWpercent = (ListView) view.findViewById(R.id.listview_projectcompletionWpercent); + + currently_no_project_tv =(TextView)view.findViewById(R.id.currently_no_project_tv); + + shardpref_S_obj=getActivity().getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + str_leadId = shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + Log.d("str_leadId:",str_leadId); + //Toast.makeText(context,"LeadId: "+str_leadId,Toast.LENGTH_LONG).show(); + + str_RegistrationId = shardpref_S_obj.getString(PrefID_RegID, "").trim(); + Log.d("str_RegistrationId:",str_RegistrationId); + + context = getActivity(); + AsyncTask_LoadApprovedProject loadApprovedProject = new AsyncTask_LoadApprovedProject(context); + loadApprovedProject.execute(); + + + + listView__projectcompletionWpercent.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) + { + String projectid = class_approvedProjectLists_arrayObj[position].getproject_id(); + String projectstatus=class_approvedProjectLists_arrayObj[position].getproject_status(); + String str_impactproject_status=class_approvedProjectLists_arrayObj[position].get_impactproject(); + + // Toast.makeText(getActivity(),""+projectid.toString(),Toast.LENGTH_SHORT).show(); + + Intent i = new Intent(getActivity(), FinalProjectCompletion_Activity.class); + i.putExtra("projectid_ValueKey", projectid.toString()); + i.putExtra("projectstatus_ValueKey", projectstatus.toString()); + i.putExtra("impact_projectstatus_ValueKey", str_impactproject_status.toString()); + startActivity(i); + getActivity().finish(); + + + } + }); + + + + + + + + return view; + + + }//end of oncreate(); + + + private class AsyncTask_LoadApprovedProject extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + dialog.setMessage("Please wait,Approved Projects Loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + LoadApprovedProject(); // get the state list + return null; + } + + public AsyncTask_LoadApprovedProject(Context context1) { + context = context1; + dialog = new ProgressDialog(context1); + } + + @Override + protected void onPostExecute(Void result) + { + + dialog.dismiss(); + + if (class_approvedProjectLists_arrayObj != null) + { + currently_no_project_tv.setVisibility(View.GONE);//currently_no_project_tv + + CustomAdapter adapter = new CustomAdapter(); + listView__projectcompletionWpercent.setAdapter(adapter); + + int x1 = class_approvedProjectLists_arrayObj.length; + + System.out.println("Inside the if list adapter" + x1); + } else { + Log.d("onPostExecute", "leavelist == null"); + currently_no_project_tv.setVisibility(View.VISIBLE);//currently_no_project_tv + } + + } + }//end of AsynTask_loadProject + + //CompletionGetApprovedProjectDetails +//CompletionGetApprovedProjectList + +//GetProjectDraftDetails +//UpdateProjectCompletionImgCompressDraft +//UpdateProjectCompletionDocumentDraft + + + + public void LoadApprovedProject() + { + String URL=Class_URL.URL_Projects.toString().trim(); + String METHOD_NAME = "CompletionGetApprovedProjectList"; + String SOAPACTION = "http://mis.leadcampus.org/CompletionGetApprovedProjectList"; + String Namespace = "http://mis.leadcampus.org/"; + + try { + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + + // request.addProperty("currentevents", "0"); + + request.addProperty("Lead_Id",str_leadId); + + // request.addProperty("Lead_Id","mh08245"); + //request.addProperty("Lead_Id","MH04606");//mh08245 + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + /*38393 + title15 + Success + 0 + 0*/ + + + try { + androidHttpTransport.call(SOAPACTION, envelope); + SoapObject response = (SoapObject) envelope.getResponse(); + Log.e("LoadApprovedPr response", response.toString()); + int_responsecount = response.getPropertyCount(); + + noOfobjects = int_responsecount; + + // Success + + SoapObject soapobject_response1 = (SoapObject) response.getProperty(0); + str_asyncTask_load_approvedproject_status= (String) soapobject_response1.getProperty("status").toString(); //Success + + if(str_asyncTask_load_approvedproject_status.equalsIgnoreCase("Success")) { + + + class_approvedProjectLists_arrayObj = new Class_ApprovedProjectList[noOfobjects]; + for (int i = 0; i < int_responsecount; i++) + { + SoapObject soapobject_response = (SoapObject) response.getProperty(i); + SoapPrimitive soapprimitive_projectid, soapprimitive_projectname, soapprimitive_status, soapprimitive_projectstatus, soapprimitive_completionprogress,soapprimitive_impactproject_status; + + soapprimitive_projectid = (SoapPrimitive) soapobject_response.getProperty("PDId"); + soapprimitive_projectname = (SoapPrimitive) soapobject_response.getProperty("Title"); + soapprimitive_completionprogress = (SoapPrimitive) soapobject_response.getProperty("CompletionProgress"); + soapprimitive_status = (SoapPrimitive) soapobject_response.getProperty("status"); + + soapprimitive_projectstatus = (SoapPrimitive) soapobject_response.getProperty("ProjectStatus"); + //Approved // Draft + + soapprimitive_impactproject_status = (SoapPrimitive) soapobject_response.getProperty("isImpact_Project");//0 + + Class_ApprovedProjectList innerObj = new Class_ApprovedProjectList(); + if (soapprimitive_status.toString().equals("Success")) + { + //Class_ApprovedProjectList innerObj = new Class_ApprovedProjectList(); + innerObj.setproject_id(soapprimitive_projectid.toString()); + innerObj.setproject_name(soapprimitive_projectname.toString()); + innerObj.setproject_status(soapprimitive_projectstatus.toString()); + innerObj.setproject_precentcount(soapprimitive_completionprogress.toString()); + innerObj.set_webservicestatus(soapprimitive_status.toString()); + innerObj.set_impactproject(soapprimitive_impactproject_status.toString()); + + class_approvedProjectLists_arrayObj[i] = innerObj; + } else { + innerObj = null; + } + } + + } + + } catch (Throwable t) { + //Toast.makeText(MainActivity.this, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Str_loadprojectE1 ="yes"; + Log.e("request fail", "> " + t.getMessage()); + } + + } catch (Throwable t) { + Str_loadprojectE2="yes"; + Log.e("UnRegister Error", "> " + t.getMessage()); + + } + + + + }// end of class + + // List View calling + + //Holder for customAdapter + private class Holder + { + TextView holder_projecttitle_tv; + TextView holder_project_id_tv; + TextView holder_nopastevents_tv; + TextView holder_pastevent_imageurl_tv; + ProgressBar holder_progressbar_pg; + TextView holder_no_tv; + TextView holder_project_completion_count_tv; + ImageView holder_projectcompletion_iv; + TextView holder_projectstatus_completion_tv; + } + //End of Holder + + + + + public class CustomAdapter extends BaseAdapter + { + + + public CustomAdapter() { + + super(); + Log.d("Inside CustomAdapter()", "Inside CustomAdapter()"); + } + + @Override + public int getCount() { + + String x = Integer.toString(class_approvedProjectLists_arrayObj.length); + Log.d("class_arrayObj.length", x); + return class_approvedProjectLists_arrayObj.length; + + } + + @Override + public Object getItem(int position) { + String x = Integer.toString(position); + System.out.println("getItem position" + x); + Log.d("getItem position", "x"); + return class_approvedProjectLists_arrayObj[position]; + } + + @Override + public long getItemId(int position) { + String x = Integer.toString(position); + System.out.println("getItemId position" + x); + Log.d("getItemId position", x); + return position; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) + { + + final Holder holder; + + Log.d("CustomAdapter", "position: " + position); + // holder = new Holder(); + if (convertView == null) { + holder = new Holder(); + convertView = LayoutInflater.from(getActivity()).inflate(R.layout.row_item_cprojectwpercent, parent, false); + + + //Typeface facebold = Typeface.createFromAsset(getResources().getAssets(), "fonts/centurygothic.ttf"); + //durationlabel_TV + + holder.holder_projecttitle_tv=(TextView) convertView.findViewById(R.id.projecttitle_name_holder_TV); + holder.holder_progressbar_pg =(ProgressBar)convertView.findViewById(R.id.projectcompletion_progressbar_holder_pg); + holder.holder_project_id_tv=(TextView)convertView.findViewById(R.id.project_id_holder_TV); + holder.holder_no_tv =(TextView)convertView.findViewById(R.id.projectcompletion_holder_no_tv); + + holder.holder_project_completion_count_tv =(TextView)convertView.findViewById(R.id.project_completion_count_holder_TV); + //project_completion_count_holder_TV + + holder.holder_projectcompletion_iv=(ImageView)convertView.findViewById(R.id.projstatus_completion_holder_iv); + holder.holder_projectstatus_completion_tv=(TextView)convertView.findViewById(R.id.projectstatus_completion_holder_tv); + + + holder.holder_progressbar_pg.setMax(100); + + Log.d("Inside If convertView", "Inside If convertView"); + + convertView.setTag(holder); + } else { + holder = (Holder) convertView.getTag(); + Log.d("Inside else convertView", "Inside else convertView"); + } + + + + class_approvedProjectLists_obj =(Class_ApprovedProjectList) getItem(position); + + // Class_CurrentEvents[] details =(Class_CurrentEvents) getItem(position); + + + + if(class_approvedProjectLists_arrayObj!=null) + { + + holder.holder_projecttitle_tv.setText(class_approvedProjectLists_obj.getproject_name()); + holder.holder_no_tv.setText(""); + holder.holder_project_id_tv.setText(class_approvedProjectLists_obj.getproject_id()); + holder.holder_project_completion_count_tv.setText(class_approvedProjectLists_obj.getproject_precentCount()); + + holder.holder_projectstatus_completion_tv.setText(class_approvedProjectLists_obj.getproject_status().toString()); + String str_projectstatus_completion=holder.holder_projectstatus_completion_tv.getText().toString(); + + + String str_setvalue=holder.holder_project_completion_count_tv.getText().toString(); + Log.e("value",str_setvalue); + + int_setvalue= Integer.parseInt(str_setvalue); + Log.e("value of Int", String.valueOf(int_setvalue)); + + + + if(str_projectstatus_completion.trim().length()==0|| + str_projectstatus_completion.trim().equals(null)|| + str_projectstatus_completion.isEmpty()) + { + str_projectstatus_completion="empty"; + } + + + if(str_projectstatus_completion.equalsIgnoreCase("RequestForCompletion")) + { + + holder.holder_no_tv.setVisibility(View.GONE); + holder.holder_progressbar_pg.setVisibility(View.GONE); + holder.holder_projectcompletion_iv.setVisibility(View.VISIBLE); + + } + + else + { + + if (int_setvalue > 0) + { + + holder.holder_no_tv.setVisibility(View.VISIBLE); + holder.holder_progressbar_pg.setVisibility(View.VISIBLE); + holder.holder_projectcompletion_iv.setVisibility(View.GONE); + + holder.holder_no_tv.setText(holder.holder_project_completion_count_tv.getText().toString() + ""); + + holder.holder_progressbar_pg.setProgress(Integer.parseInt(holder.holder_project_completion_count_tv.getText().toString())); + + + + /* //progressStatus = 0; + new Thread(new Runnable() { + @Override + public void run() { + while (progressStatus < int_setvalue) { + // Update the progress status + progressStatus += 1; + + // Try to sleep the thread for 20 milliseconds + try { + Thread.sleep(80); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + // Update the progress bar + handler.post(new Runnable() { + @Override + public void run() { + // Show the progress on TextView + holder.holder_no_tv.setText(progressStatus + ""); + holder.holder_progressbar_pg.setProgress(progressStatus); // 50 default progress value for the progress bar + } + }); + } + } + }).start(); // Start the operation + + *//*progressStatus = 0; + int_setvalue = 0;*/ + + } else + { + holder.holder_no_tv.setVisibility(View.VISIBLE); + holder.holder_progressbar_pg.setVisibility(View.VISIBLE); + holder.holder_projectcompletion_iv.setVisibility(View.GONE); + + holder.holder_no_tv.setText(0 + ""); + holder.holder_progressbar_pg.setProgress(0); + } + + } + + + } + + return convertView; + } + + }//End of CustomAdapter + + + + + + + + + + + }//end of class \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/CompletionProjectStaticClass.java b/app/src/main/java/com/leadcampusapp/CompletionProjectStaticClass.java new file mode 100644 index 0000000..740f4e9 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/CompletionProjectStaticClass.java @@ -0,0 +1,61 @@ +package com.leadcampusapp; + +import java.util.ArrayList; + +public class CompletionProjectStaticClass { + private static int countCompletion=0; + private static ArrayList fileArrayString; + private static ArrayList fileDocString; + private static int countDocumentCompletion=0; + + private static ArrayList byteArrayImage; // by madhu + private static byte[] bytesImage; //by madhu + + public static byte[] getBytesImage() { + return bytesImage; + } + + public static void setBytesImage(byte[] bytesImage) { + CompletionProjectStaticClass.bytesImage = bytesImage; + } + + public static ArrayList getByteArrayImage() { + return byteArrayImage; + } + + public static void setByteArrayImage(ArrayList byteArrayImage) { + CompletionProjectStaticClass.byteArrayImage = byteArrayImage; + } + + public static int getCountDocumentCompletion() { + return countDocumentCompletion; + } + + public static void setCountDocumentCompletion(int countDocumentCompletion) { + CompletionProjectStaticClass.countDocumentCompletion = countDocumentCompletion; + } + + public static ArrayList getFileDocString() { + return fileDocString; + } + + public static void setFileDocString(ArrayList fileDocString) { + CompletionProjectStaticClass.fileDocString = fileDocString; + } + + public static ArrayList getFileArrayString() { + return fileArrayString; + } + + public static void setFileArrayString(ArrayList fileArrayString) { + CompletionProjectStaticClass.fileArrayString = fileArrayString; + } + + public static int getCountCompletion() { + return countCompletion; + } + + public static void setCountCompletion(int countCompletion) { + CompletionProjectStaticClass.countCompletion = countCompletion; + } +} diff --git a/app/src/main/java/com/leadcampusapp/ComplitionGallaryActivity.java b/app/src/main/java/com/leadcampusapp/ComplitionGallaryActivity.java new file mode 100644 index 0000000..e5dffd6 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ComplitionGallaryActivity.java @@ -0,0 +1,468 @@ +package com.leadcampusapp; + +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.graphics.Bitmap; +import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; +import android.util.Log; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.AdapterView; +import android.widget.Gallery; +import android.widget.ImageView; +import android.widget.TextView; + +import java.net.URL; +import java.util.ArrayList; + + + +public class ComplitionGallaryActivity extends AppCompatActivity implements ConnectivityReceiver.ConnectivityReceiverListener{ + + ImageView selectedImage; + ArrayList bitmapList; + ArrayList TempUrlList; + ArrayList doc_slno; + ArrayList doc_path; + String LeadId,PDId; + String Student_Image_Path,MobileNo; + String Name; + Integer ManagerId; + + public static final String PREFBook_PM= "prefbook_pm"; //sharedpreference Book + public static final String PrefID_PMID = "prefid_pmid"; // + SharedPreferences shardprefPM_obj; + String str_MangerID; + Integer MDId; + String str_projectid,str_projectstatus,str_impactproject_status; + String status; + int position_value; + + SharedPreferences shardpref_S_obj; + SharedPreferences.Editor editor_S; + public static final String PrefID_SGalleryIntent = "prefid_sgalleryintent"; // + public static final String PREFBook_Stud= "prefbook_stud"; //sharedpreference Book + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_complitiongallary); + + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + // getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background)); + + View actionBarView = getSupportActionBar().getCustomView(); + TextView actionBarTV = (TextView) actionBarView.findViewById(R.id.txt_actionBar); + actionBarTV.setText("Gallery"); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); + + shardpref_S_obj=getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + + Gallery gallery = (Gallery) findViewById(R.id.gallery); + ImageView img_remove = (ImageView) findViewById(R.id.img_delete_gallery); + + TempUrlList = GalleryImageBitmap.getAllImgURL(); + bitmapList = GalleryImageBitmap.getBitmapGalleryImage(); + doc_path = GalleryImageBitmap.getDocument_path(); + doc_slno = GalleryImageBitmap.getDocument_slno(); + + selectedImage=(ImageView)findViewById(R.id.imageView); + Log.e("tag","gallery bitmapList=="+bitmapList); + + if(bitmapList.size()!=0){ + // GalleryImageBitmap.setBitmapGalleryImage(bitmapList); + selectedImage.setImageBitmap(bitmapList.get(0)); + img_remove.setVisibility(View.VISIBLE); + }else{ + selectedImage.setImageResource(R.drawable.no_img_available); + img_remove.setVisibility(View.INVISIBLE); + } + + + /* Intent intent = getIntent(); + if(intent!=null) { + str_projectid = intent.getExtras().getString("projectid_ValueKey"); + str_projectstatus= intent.getExtras().getString("projectstatus_ValueKey"); + str_impactproject_status=intent.getExtras().getString("impact_projectstatus_ValueKey"); + }*/ + /* ManagerId = getIntent().getExtras().getInt("ManagerId"); + Log.i("tag","MangerID PMProjectDetails="+ManagerId);*/ + /*shardprefPM_obj=this.getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MangerID = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + Log.d("str_leadId:",str_MangerID); + // Toast.makeText(this,"LeadId: "+str_MangerID,Toast.LENGTH_LONG).show(); + MDId=Integer.parseInt(str_MangerID); + + Log.e("TAG","LeadId="+LeadId); + Log.e("TAG","PDId="+PDId);*/ + + gallery.setSpacing(5); + gallery.setAnimationDuration(2000); + final GalleryImageAdapter galleryImageAdapter= new GalleryImageAdapter(this,bitmapList); + + gallery.setAdapter(galleryImageAdapter); + + + gallery.setOnItemClickListener(new AdapterView.OnItemClickListener() { + public void onItemClick(AdapterView parent, View v, int position, long id) { + // show the selected Image + //selectedImage.setImageResource(galleryImageAdapter.mImageIds[position]); + selectedImage.setImageBitmap(galleryImageAdapter.mBitmapList.get(position)); + position_value=position; + } + }); + + +//-----------------------------------Delete image in sarver added by madhu------------------------------------------------------ + img_remove.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) + { + Log.e("tag","position_value=="+position_value); + Log.e("tag","position_value doc_path=="+doc_path.get(position_value)); + for(int i=0;i bitmapList) + { + + SQLiteDatabase db6 = openOrCreateDatabase("Leaddb", Context.MODE_PRIVATE, null); + + db6.execSQL("CREATE TABLE IF NOT EXISTS PositionImageList(img BLOB NOT NULL,documentlist_path VARCHAR,documentlist_slno VARCHAR,position VARCHAR);"); + Cursor cursor1 = db6.rawQuery("SELECT * FROM PositionImageList", null); + + int x = cursor1.getCount(); + Log.d("cursor count==", Integer.toString(x)); + + int i=0; + + if(x>0) { + if (cursor1.moveToFirst()) { + do { + + i = Integer.parseInt(cursor1.getString(cursor1.getColumnIndex("position"))); + bitmapList.remove(i); + TempUrlList.remove(i); + doc_slno.remove(i); + doc_path.remove(i); + Delete_PositionImg_B4Insertion(); + } while (cursor1.moveToNext()); + }//if ends + + } + + db6.close(); + + } + public void Delete_PositionImg_B4Insertion() { + + SQLiteDatabase db6 = openOrCreateDatabase("Leaddb", Context.MODE_PRIVATE, null); + + db6.execSQL("CREATE TABLE IF NOT EXISTS PositionImageList(img BLOB NOT NULL,documentlist_path VARCHAR,documentlist_slno VARCHAR,position VARCHAR);"); + Cursor cursor1 = db6.rawQuery("SELECT * FROM PositionImageList", null); + int x = cursor1.getCount(); + if (x > 0) { + db6.delete("PositionImageList", null, null); + } + db6.close(); + } + +//------------------------------------------------------------------------------------------------------------------------ + @Override + protected void onResume() { + super.onResume(); + + // register connection status listener + MyApplication.getInstance().setConnectivityListener(this); + } + + @Override + public void onNetworkConnectionChanged(boolean isConnected) { + showSnack(isConnected); + } + + private void showSnack(boolean isConnected) { + + if (!isConnected) { + + AlertDialog.Builder adb = new AlertDialog.Builder(ComplitionGallaryActivity.this); + //adb.setView(alertDialogView); + + adb.setTitle("Sorry! Not connected to the internet"); + + adb.setIcon(android.R.drawable.ic_dialog_alert); + + adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + + adb.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + adb.setCancelable(true); + adb.show(); + } + +/* String message; + int color; + if (isConnected) { + message = "Good! Connected to Internet"; + color = Color.WHITE; + } else { + message = "Sorry! Not connected to internet"; + color = Color.RED; + } + + Snackbar snackbar = Snackbar + .make(findViewById(R.id.coordinator_layout), message, Snackbar.LENGTH_LONG); + + View sbView = snackbar.getView(); + TextView textView = (TextView) sbView.findViewById(android.support.design.R.id.snackbar_text); + textView.setTextColor(color); + snackbar.show();*/ + } + + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_main, menu); + MenuItem action_editProfile = menu.findItem(R.id.action_editProfile); + action_editProfile.setVisible(false); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + + if (id == R.id.action_logout) { + Intent itthomeToLogin = new Intent(ComplitionGallaryActivity.this ,LoginActivity.class); + startActivity(itthomeToLogin); + return true; + } + + if (id == android.R.id.home) { + + /* GalleryImageBitmap.setAllImgURL(TempUrlList); + editor_S = shardpref_S_obj.edit(); + editor_S.putString(PrefID_SGalleryIntent, "1"); + editor_S.commit();*/ + + GalleryImageBitmap.setAllImgURL(TempUrlList); //added by madhu + FinalProjectCompletion_Activity.LoadGalleryImage loadGalleryImg = new FinalProjectCompletion_Activity.LoadGalleryImage(getApplicationContext()); + loadGalleryImg.execute(); + Intent ittProjDtlsToHome = new Intent(ComplitionGallaryActivity.this ,FinalProjectCompletion_Activity.class); + + ittProjDtlsToHome.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); + + startActivity(ittProjDtlsToHome); + return true; + } + + return super.onOptionsItemSelected(item); + } + @Override + public void onBackPressed() + { + GalleryImageBitmap.setAllImgURL(TempUrlList); //added by madhu + FinalProjectCompletion_Activity.LoadGalleryImage loadGalleryImg = new FinalProjectCompletion_Activity.LoadGalleryImage(getApplicationContext()); + loadGalleryImg.execute(); + Intent ittProjDtlsToHome = new Intent(ComplitionGallaryActivity.this ,FinalProjectCompletion_Activity.class); + ittProjDtlsToHome.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); + startActivity(ittProjDtlsToHome); + // super.onBackPressed(); +/* Intent ittProjDtlsToHome = new Intent(PMGallaryActivity.this ,PMComplitionProjectActivity.class); + ittProjDtlsToHome.putExtra("ManagerId",MDId); + ittProjDtlsToHome.putExtra("name",Name); + ittProjDtlsToHome.putExtra("projectId",PDId); + ittProjDtlsToHome.putExtra("LeadId",LeadId); + ittProjDtlsToHome.putExtra("MobileNo",MobileNo); + ittProjDtlsToHome.putExtra("Student_Image_Path",Student_Image_Path); + startActivity(ittProjDtlsToHome);*/ + } + + /* private class Async_DeleteImage extends AsyncTask + { + ProgressDialog dialog; + + Context context; + + @Override + protected void onPreExecute() + { + Log.i("TAG", "onPreExecute---tab2"); + dialog.setMessage("Please wait.."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + + } + + @Override + protected void onProgressUpdate(Void... values) + { + Log.i("TAG", "onProgressUpdate---tab2"); + } + + public Async_DeleteImage(ComplitionGallaryActivity activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + @Override + protected Void doInBackground(String... params) + { + Log.i("TAG", "doInBackground"); + //submit_PMProfile(ManagerId); + DeleteImage(); + return null; + } + + @Override + protected void onPostExecute(Void result) + { + Log.i("TAG", "onPostExecute"); + + Log.d("ServiceResponseisss: ",status.toString()); + + dialog.dismiss(); + + if(status.equalsIgnoreCase("Image Deleted")) { + Toast.makeText(ComplitionGallaryActivity.this, "Image Deleted Successfully " , + Toast.LENGTH_LONG).show(); + Intent i = new Intent(ComplitionGallaryActivity.this, FinalProjectCompletion_Activity.class); + i.putExtra("projectid_ValueKey", str_projectid); + i.putExtra("projectstatus_ValueKey", str_projectstatus); + i.putExtra("impact_projectstatus_ValueKey", str_impactproject_status); + startActivity(i); + + } + else{ + Toast.makeText(ComplitionGallaryActivity.this, status , + Toast.LENGTH_LONG).show(); + } + } + } + + public void DeleteImage() { + + String URL = Class_URL.URL_Projects.toString().trim(); + String METHOD_NAME = "Delete_ProjectImg"; + String Namespace = "http://mis.leadcampus.org/", SOAPACTION = "http://mis.leadcampus.org/Delete_ProjectImg"; + + try { + + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + + request.addProperty("Img_Slno", doc_slno.get(position_value)); + request.addProperty("img_Path", doc_path.get(position_value)); + + Log.e("tag","soap request delete image="+ request.toString()); + Log.e("tag","soap request position_value="+ position_value); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + Log.e("tag","soap response delete image"+ response.toString()); + + status = response.toString(); + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + }*/ + + +} diff --git a/app/src/main/java/com/leadcampusapp/Compressor.java b/app/src/main/java/com/leadcampusapp/Compressor.java new file mode 100644 index 0000000..2604ea3 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Compressor.java @@ -0,0 +1,117 @@ +package com.leadcampusapp; + +import android.content.Context; +//import android.database.Observable; +import android.graphics.Bitmap; +import android.net.Uri; + +import java.io.File; + +//import rx.Observable; +import rx.Observable; +import rx.functions.Func0; +//import rx.Observable; + +/** + * Created on : June 18, 2016 + * Author : zetbaitsu + * Name : Zetra + * Email : zetra@mail.ugm.ac.id + * GitHub : https://github.com/zetbaitsu + * LinkedIn : https://id.linkedin.com/in/zetbaitsu + */ +public class Compressor { + private static volatile Compressor INSTANCE; + private Context context; + //max width and height values of the compressed image is taken as 612x816 + private float maxWidth = 612.0f; + private float maxHeight = 816.0f; + private Bitmap.CompressFormat compressFormat = Bitmap.CompressFormat.JPEG; + private Bitmap.Config bitmapConfig = Bitmap.Config.ARGB_8888; + private int quality = 80; + private String destinationDirectoryPath; + + private Compressor(Context context) { + this.context = context; + destinationDirectoryPath = context.getCacheDir().getPath() + File.pathSeparator + FileUtil.FILES_PATH; + } + + public static Compressor getDefault(Context context) { + if (INSTANCE == null) { + synchronized (Compressor.class) { + if (INSTANCE == null) { + INSTANCE = new Compressor(context); + } + } + } + return INSTANCE; + } + + public File compressToFile(File file) { + return ImageUtil.compressImage(context, Uri.fromFile(file), maxWidth, maxHeight, compressFormat, bitmapConfig, quality, destinationDirectoryPath); + } + + public Bitmap compressToBitmap(File file) { + return ImageUtil.getScaledBitmap(context, Uri.fromFile(file), maxWidth, maxHeight, bitmapConfig); + } + + public Observable compressToFileAsObservable(final File file) { + return Observable.defer(new Func0>() { + @Override + public Observable call() { + return Observable.just(compressToFile(file)); + } + }); + } + + public Observable compressToBitmapAsObservable(final File file) { + return Observable.defer(new Func0>() { + @Override + public Observable call() { + return Observable.just(compressToBitmap(file)); + } + }); + } + + public static class Builder { + private Compressor compressor; + + public Builder(Context context) { + compressor = new Compressor(context); + } + + public Builder setMaxWidth(float maxWidth) { + compressor.maxWidth = maxWidth; + return this; + } + + public Builder setMaxHeight(float maxHeight) { + compressor.maxHeight = maxHeight; + return this; + } + + public Builder setCompressFormat(Bitmap.CompressFormat compressFormat) { + compressor.compressFormat = compressFormat; + return this; + } + + public Builder setBitmapConfig(Bitmap.Config bitmapConfig) { + compressor.bitmapConfig = bitmapConfig; + return this; + } + + public Builder setQuality(int quality) { + compressor.quality = quality; + return this; + } + + public Builder setDestinationDirectoryPath(String destinationDirectoryPath) { + compressor.destinationDirectoryPath = destinationDirectoryPath; + return this; + } + + public Compressor build() { + return compressor; + } + } +} diff --git a/app/src/main/java/com/leadcampusapp/ConnectivityReceiver.java b/app/src/main/java/com/leadcampusapp/ConnectivityReceiver.java new file mode 100644 index 0000000..aead8d4 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ConnectivityReceiver.java @@ -0,0 +1,48 @@ +package com.leadcampusapp; + +/** + * Created by Lincoln on 18/03/16. + */ + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; + +public class ConnectivityReceiver extends BroadcastReceiver { + + public static ConnectivityReceiverListener connectivityReceiverListener; + + public ConnectivityReceiver() { + super(); + } + + @Override + public void onReceive(Context context, Intent arg1) { + ConnectivityManager cm = (ConnectivityManager) context + .getSystemService(Context.CONNECTIVITY_SERVICE); + NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); + boolean isConnected = activeNetwork != null + && activeNetwork.isConnectedOrConnecting(); + + if (connectivityReceiverListener != null) { + connectivityReceiverListener.onNetworkConnectionChanged(isConnected); + } + } + + public static boolean isConnected() { + ConnectivityManager + cm = (ConnectivityManager) MyApplication.getInstance().getApplicationContext() + .getSystemService(Context.CONNECTIVITY_SERVICE); + NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); + return activeNetwork != null + && activeNetwork.isConnectedOrConnecting(); + } + + + public interface ConnectivityReceiverListener { + void onNetworkConnectionChanged(boolean isConnected); + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/ContactUsActivity.java b/app/src/main/java/com/leadcampusapp/ContactUsActivity.java new file mode 100644 index 0000000..51ef1f4 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ContactUsActivity.java @@ -0,0 +1,730 @@ +package com.leadcampusapp; + +import android.app.ProgressDialog; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.net.Uri; +import android.os.AsyncTask; +import androidx.appcompat.app.AppCompatActivity; +import android.os.Bundle; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.LinearLayout; +import android.widget.ListView; +import android.widget.TextView; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +public class ContactUsActivity extends AppCompatActivity +{ + + Class_ContactUs[] class_contactus_arrayObj; + String str_contactus_status; + int int_count; + + Context context; + private ListView listView; + String str_callno; + + public static final String PREFBook_Stud= "prefbook_stud"; + private SharedPreferences shardpref_S_obj; + public static final String PrefID_Role = "prefid_role"; + public String str_role = null; + + @Override + protected void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_contact_us_new); + context=ContactUsActivity.this; + + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + //getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background)); + + shardpref_S_obj=ContactUsActivity.this.getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + shardpref_S_obj.getString(PrefID_Role, "").trim(); + str_role = shardpref_S_obj.getString(PrefID_Role, "").trim(); + + View actionBarView = getSupportActionBar().getCustomView(); + TextView actionBarTV = (TextView) actionBarView.findViewById(R.id.txt_actionBar); + actionBarTV.setText("Contact Us"); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); + + + + + listView = (ListView) findViewById(R.id.customlistview_contactus); + + AsyncCallWS_GetContactUsDetails task = new AsyncCallWS_GetContactUsDetails(context); + task.execute(); + + + + /* final TextView btn_call=(TextView) findViewById(R.id.btn_call); + + final TextView txt_gmail=(TextView) findViewById(R.id.txt_gmail); + + final TextView btn_call1=(TextView) findViewById(R.id.btn_call1); + + final TextView txt_gmail1=(TextView) findViewById(R.id.txt_gmail1); + + final TextView txt_hubli_mail=(TextView) findViewById(R.id.txt_hubli_mail); + final TextView txt_hubli_call=(TextView) findViewById(R.id.txt_hubli_call); + final TextView txt_kakatiya_call=(TextView) findViewById(R.id.txt_kakatiya_call); + final TextView txt_kakatiya_mail=(TextView) findViewById(R.id.txt_kakatiya_mail); + final TextView txt_ek_call=(TextView) findViewById(R.id.txt_ek_call); + final TextView txt_ek_mail=(TextView) findViewById(R.id.txt_ek_mail); + final TextView txt_eklead_mail=(TextView) findViewById(R.id.eksoch_leadmail); + final TextView txt_hublilead_mail=(TextView) findViewById(R.id.hubli_leadmail); + final TextView txt_kakatiyalead_mail=(TextView) findViewById(R.id.kakatiya_leadmail); + final TextView txt_nalgondalead_mail=(TextView) findViewById(R.id.nalgonda_leadmail); + final TextView txt_nalgonda_call=(TextView) findViewById(R.id.txt_nalgonda_call); + final TextView txt_nalgonda_mail=(TextView) findViewById(R.id.txt_nalgonda_mail); + + + + + + + + + + + btn_call.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) + { + Intent intent = new Intent(Intent.ACTION_DIAL); + intent.setData(Uri.parse("tel:"+btn_call.getText().toString())); + startActivity(intent); + + *//* Intent callIntent = new Intent(Intent.ACTION_CALL); + callIntent.setData(Uri.parse("tel:"+btn_call.getText().toString())); + + if (ActivityCompat.checkSelfPermission(ContactUsActivity.this, + Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) { + return; + } + startActivity(callIntent);*//* + } + }); + btn_call1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(Intent.ACTION_DIAL); + intent.setData(Uri.parse("tel:"+btn_call1.getText().toString())); + startActivity(intent); + + *//* Intent callIntent = new Intent(Intent.ACTION_CALL); + callIntent.setData(Uri.parse("tel:"+btn_call.getText().toString())); + + if (ActivityCompat.checkSelfPermission(ContactUsActivity.this, + Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) { + return; + } + startActivity(callIntent);*//* + } + }); + txt_ek_call.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(Intent.ACTION_DIAL); + intent.setData(Uri.parse("tel:"+txt_ek_call.getText().toString())); + startActivity(intent); + + *//* Intent callIntent = new Intent(Intent.ACTION_CALL); + callIntent.setData(Uri.parse("tel:"+btn_call.getText().toString())); + + if (ActivityCompat.checkSelfPermission(ContactUsActivity.this, + Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) { + return; + } + startActivity(callIntent);*//* + } + }); + txt_hubli_call.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(Intent.ACTION_DIAL); + intent.setData(Uri.parse("tel:"+txt_hubli_call.getText().toString())); + startActivity(intent); + + *//* Intent callIntent = new Intent(Intent.ACTION_CALL); + callIntent.setData(Uri.parse("tel:"+btn_call.getText().toString())); + + if (ActivityCompat.checkSelfPermission(ContactUsActivity.this, + Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) { + return; + } + startActivity(callIntent);*//* + } + }); + txt_kakatiya_call.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(Intent.ACTION_DIAL); + intent.setData(Uri.parse("tel:"+txt_kakatiya_call.getText().toString())); + startActivity(intent); + + *//* Intent callIntent = new Intent(Intent.ACTION_CALL); + callIntent.setData(Uri.parse("tel:"+btn_call.getText().toString())); + + if (ActivityCompat.checkSelfPermission(ContactUsActivity.this, + Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) { + return; + } + startActivity(callIntent);*//* + } + }); + txt_nalgonda_call.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(Intent.ACTION_DIAL); + intent.setData(Uri.parse("tel:"+txt_nalgonda_call.getText().toString())); + startActivity(intent); + + } + }); + txt_gmail.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + *//* Intent intent = new Intent(Intent.ACTION_SENDTO); + intent.setType("text/plain"); + intent.putExtra(Intent.EXTRA_EMAIL, txt_gmail.getText().toString()); + //intent.setData(Uri.parse("tel:"+txt_gmail.getText().toString())); + startActivity(intent);*//* + + Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" + txt_gmail.getText().toString())); + emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Lead Help Line"); + // emailIntent.putExtra(Intent.EXTRA_TEXT, "abc"); +//emailIntent.putExtra(Intent.EXTRA_HTML_TEXT, body); //If you are using HTML in your body text + + startActivity(Intent.createChooser(emailIntent, "Chooser Title")); + } + }); + txt_gmail1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + *//* Intent intent = new Intent(Intent.ACTION_SENDTO); + intent.setType("text/plain"); + intent.putExtra(Intent.EXTRA_EMAIL, txt_gmail.getText().toString()); + //intent.setData(Uri.parse("tel:"+txt_gmail.getText().toString())); + startActivity(intent);*//* + Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" + txt_gmail1.getText().toString())); + emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Lead Help Line"); + // emailIntent.putExtra(Intent.EXTRA_TEXT, "abc"); +//emailIntent.putExtra(Intent.EXTRA_HTML_TEXT, body); //If you are using HTML in your body text + + startActivity(Intent.createChooser(emailIntent, "Chooser Title")); + } + }); + txt_hublilead_mail.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" + txt_hublilead_mail.getText().toString())); + emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Lead Help Line"); + startActivity(Intent.createChooser(emailIntent, "Chooser Title")); + } + }); + + txt_eklead_mail.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" + txt_eklead_mail.getText().toString())); + emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Lead Help Line"); + startActivity(Intent.createChooser(emailIntent, "Chooser Title")); + } + }); + txt_nalgondalead_mail.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" + txt_nalgondalead_mail.getText().toString())); + emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Lead Help Line"); + startActivity(Intent.createChooser(emailIntent, "Chooser Title")); + } + }); + + txt_kakatiyalead_mail.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" + txt_kakatiyalead_mail.getText().toString())); + emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Lead Help Line"); + startActivity(Intent.createChooser(emailIntent, "Chooser Title")); + } + }); + + txt_kakatiya_mail.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + *//* Intent intent = new Intent(Intent.ACTION_SENDTO); + intent.setType("text/plain"); + intent.putExtra(Intent.EXTRA_EMAIL, txt_gmail.getText().toString()); + //intent.setData(Uri.parse("tel:"+txt_gmail.getText().toString())); + startActivity(intent);*//* + Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" + txt_kakatiya_mail.getText().toString())); + emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Lead Kakatiya Sandbox"); + // emailIntent.putExtra(Intent.EXTRA_TEXT, "abc"); +//emailIntent.putExtra(Intent.EXTRA_HTML_TEXT, body); //If you are using HTML in your body text + + startActivity(Intent.createChooser(emailIntent, "Chooser Title")); + } + }); + txt_hubli_mail.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + *//* Intent intent = new Intent(Intent.ACTION_SENDTO); + intent.setType("text/plain"); + intent.putExtra(Intent.EXTRA_EMAIL, txt_gmail.getText().toString()); + //intent.setData(Uri.parse("tel:"+txt_gmail.getText().toString())); + startActivity(intent);*//* + Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" + txt_hubli_mail.getText().toString())); + emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Lead Hubballi Sandbox"); + // emailIntent.putExtra(Intent.EXTRA_TEXT, "abc"); +//emailIntent.putExtra(Intent.EXTRA_HTML_TEXT, body); //If you are using HTML in your body text + + startActivity(Intent.createChooser(emailIntent, "Chooser Title")); + } + }); + txt_ek_mail.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + *//* Intent intent = new Intent(Intent.ACTION_SENDTO); + intent.setType("text/plain"); + intent.putExtra(Intent.EXTRA_EMAIL, txt_gmail.getText().toString()); + //intent.setData(Uri.parse("tel:"+txt_gmail.getText().toString())); + startActivity(intent);*//* + Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" + txt_ek_mail.getText().toString())); + emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Lead EK Soch Sandbox"); + // emailIntent.putExtra(Intent.EXTRA_TEXT, "abc"); +//emailIntent.putExtra(Intent.EXTRA_HTML_TEXT, body); //If you are using HTML in your body text + + startActivity(Intent.createChooser(emailIntent, "Chooser Title")); + } + }); + + txt_nalgonda_mail.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + *//* Intent intent = new Intent(Intent.ACTION_SENDTO); + intent.setType("text/plain"); + intent.putExtra(Intent.EXTRA_EMAIL, txt_gmail.getText().toString()); + //intent.setData(Uri.parse("tel:"+txt_gmail.getText().toString())); + startActivity(intent);*//* + Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" + txt_nalgonda_mail.getText().toString())); + emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Lead Nalgonda Sandbox"); + // emailIntent.putExtra(Intent.EXTRA_TEXT, "abc"); +//emailIntent.putExtra(Intent.EXTRA_HTML_TEXT, body); //If you are using HTML in your body text + + startActivity(Intent.createChooser(emailIntent, "Chooser Title")); + } + }); +*/ + + + + + + + + }// end of create + + + + + + + + private class AsyncCallWS_GetContactUsDetails extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + dialog.setMessage("Please wait.."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("DFTech", "doInBackground"); + // GetAllEvents(); + GetContactList(); // call of details + return null; + } + + public AsyncCallWS_GetContactUsDetails(Context context1) { + context = context1; + dialog = new ProgressDialog(context1); + } + + @Override + protected void onPostExecute(Void result) + { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + + dialog.dismiss(); + + if (class_contactus_arrayObj != null) + { + CustomAdapter adapter = new CustomAdapter(); + listView.setAdapter(adapter); + + int x = class_contactus_arrayObj.length; + + System.out.println("Inside the if list adapter" + x); + } else { + Log.d("onPostExecute", "ondutyhistoryclass_arrayObj == null"); + } + + + // Toast.makeText(getApplicationContext(),""+class_contactus_arrayObj[0].getEmailid1().toString(),Toast.LENGTH_LONG).show(); + + + + // System.out.println("Reached the onPostExecute"); + + }//end of onPostExecute + }// end Async task + + + + public void GetContactList() { + + + + String URL =Class_URL.URL_Login.toString(); + String METHOD_NAME = "GetContactUsDetails"; + String Namespace = "http://mis.leadcampus.org/", SOAPACTION = "http://mis.leadcampus.org/GetContactUsDetails"; + + try { + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + //request.addProperty("email", username); + + + Log.e("request", request.toString()); + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + try { + + androidHttpTransport.call(SOAPACTION, envelope); + // Log.i(TAG, "GetAllLoginDetails is running"); + // result1 = (Vector) envelope.getResponse(); + SoapObject response = (SoapObject) envelope.getResponse(); + Log.e("contact response", response.toString()); + int_count = response.getPropertyCount(); + + Log.e("number of rows", "" + int_count); + + + + + + + class_contactus_arrayObj = new Class_ContactUs[int_count]; + + SoapObject so_list = (SoapObject) response.getProperty(0); + + str_contactus_status = (String) so_list.getProperty("Status").toString(); + // Holidays not found + + if (str_contactus_status.equalsIgnoreCase("Success")) + { + + // listitems_arraylist.clear(); + for (int i = 0; i < int_count; i++) { + SoapObject list = (SoapObject) response.getProperty(i); + SoapPrimitive sandbox_name, Sandbox_Address, Contact_Person, Contact_Mailid1, Contact_Number1,Contact_Mailid2; + String str_Contact_Mailid2; + String approved = ""; + sandbox_name = (SoapPrimitive) list.getProperty("Sandbox_Name"); + Sandbox_Address = (SoapPrimitive) list.getProperty("Sandbox_Address"); + Contact_Person = (SoapPrimitive) list.getProperty("Contact_Person"); + Contact_Number1 = (SoapPrimitive) list.getProperty("Contact_Number1"); + Contact_Mailid1 = (SoapPrimitive) list.getProperty("Contact_Mailid1"); + //Contact_Mailid2=(SoapPrimitive) list.getProperty("Contact_Mailid2"); + if(list.getProperty("Contact_Mailid2").toString().equals("anyType{}")) + { + str_Contact_Mailid2="anyType{}"; + } + else + { str_Contact_Mailid2=(String)list.getProperty("Contact_Mailid2").toString(); } + + + + Class_ContactUs innerObj = new Class_ContactUs(); + + innerObj.setSandbox_name(sandbox_name.toString()); + innerObj.setSandbox_address(Sandbox_Address.toString()); + innerObj.setContact_person(Contact_Person.toString()); + innerObj.setContact_number1(Contact_Number1.toString()); + innerObj.setEmailid1(Contact_Mailid1.toString()); + innerObj.setEmailid2(str_Contact_Mailid2); + + + class_contactus_arrayObj[i] = innerObj; + + //listitems_arraylist.add(innerObj); + + }//End of for loop + } + } + catch(Throwable t){ + //Toast.makeText(MainActivity.this, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("contactus fail", "> " + t.getMessage()); + str_contactus_status = "error"; + } + } catch (Throwable t) { + Log.e("UnRegister hlist Error", "> " + t.getMessage()); + str_contactus_status = "error"; + + } + + + + }//End of contactus + + + + + private class Holder { + TextView holder_sandbox_name; + TextView holder_sandbox_address; + TextView holder_sandbox_contactperson; + TextView holder_sandbox_contactnumber; + TextView holder_sandbox_emailid1; + TextView holder_sandbox_emailid2; + LinearLayout contact_mailid2_ll; + + + } + + + + public class CustomAdapter extends BaseAdapter { + + + public CustomAdapter() { + + super(); + Log.d("Inside CustomAdapter()", "Inside CustomAdapter()"); + } + + @Override + public int getCount() { + + String x = Integer.toString(class_contactus_arrayObj.length); + System.out.println("class_contactus_arrayObj.length" + x); + return class_contactus_arrayObj.length; + } + + @Override + public Object getItem(int position) { + String x = Integer.toString(position); + System.out.println("getItem position" + x); + Log.d("getItem position", "x"); + return class_contactus_arrayObj[position]; + } + + + @Override + public long getItemId(int position) { + String x = Integer.toString(position); + System.out.println("getItemId position" + x); + Log.d("getItemId position", x); + return position; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + + final Holder holder; + + Log.d("CustomAdapter", "position: " + position); + + if (convertView == null) { + holder = new Holder(); + convertView = LayoutInflater.from(getApplicationContext()).inflate(R.layout.listview_contact_us, parent, false); + + + + + holder.holder_sandbox_name = (TextView) convertView.findViewById(R.id.header_TV); + holder.holder_sandbox_address = (TextView) convertView.findViewById(R.id.sandboxaddress_TV); //durationofdays_TV + holder.holder_sandbox_contactperson = (TextView) convertView.findViewById(R.id.contactperson_TV);//Fdate_TV + holder.holder_sandbox_contactnumber = (TextView) convertView.findViewById(R.id.btn_call);//Tdate_TV + holder.holder_sandbox_emailid1 = (TextView) convertView.findViewById(R.id.txt_gmail);//reasonforleave_TV + + holder.holder_sandbox_emailid2=(TextView) convertView.findViewById(R.id.contact_mailid2_TV); + holder.contact_mailid2_ll=(LinearLayout) convertView.findViewById(R.id.contact_mailid2_LL); + + Log.d("Inside If convertView", "Inside If convertView"); + + convertView.setTag(holder); + + } else { + holder = (Holder) convertView.getTag(); + Log.d("Inside else convertView", "Inside else convertView"); + } + + Class_ContactUs detail = (Class_ContactUs) getItem(position); + + + + if (detail != null) { + holder.holder_sandbox_name.setText(detail.getSandbox_name()); + holder.holder_sandbox_address.setText(detail.getSandbox_address()); + holder.holder_sandbox_contactperson.setText(detail.getContact_person()); + holder.holder_sandbox_contactnumber.setText(detail.getContact_number1()); + holder.holder_sandbox_emailid1.setText(detail.getEmailid1()); + + if(detail.getEmailid2().toString().equalsIgnoreCase("anyType{}")) + { holder.contact_mailid2_ll.setVisibility(View.GONE);} + else{ holder.contact_mailid2_ll.setVisibility(View.VISIBLE); + holder.holder_sandbox_emailid2.setText(detail.getEmailid2());} + // + + str_callno=holder.holder_sandbox_contactnumber.getText().toString(); + + holder.holder_sandbox_contactnumber.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) + { + Intent intent = new Intent(Intent.ACTION_DIAL); + intent.setData(Uri.parse("tel:"+holder.holder_sandbox_contactnumber.getText().toString())); + startActivity(intent); + } + }); + + holder.holder_sandbox_emailid1.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) + { + Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" + holder.holder_sandbox_emailid1)); + emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Lead Help Line"); + startActivity(Intent.createChooser(emailIntent, "Chooser Title")); + } + }); + + + + + } + + return convertView; + + }//End of custom getView + }//End of CustomAdapter + + + + + + + + + + + + + + + + + + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_main, menu); + MenuItem action_editProfile = menu.findItem(R.id.action_editProfile); + action_editProfile.setVisible(false); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + + /* if (id == R.id.action_editProfile) { + Intent ittProjDtlsToEditProfile = new Intent(PMUnapproved_DetailsActivity.this ,PMEditProfileActivity.class); + ittProjDtlsToEditProfile.putExtra("ManagerId",ManagerId); + startActivity(ittProjDtlsToEditProfile); + return true; + } + */ + + if (id == R.id.action_logout) { + Intent ittProjDtlsToLogin = new Intent(ContactUsActivity.this ,LoginActivity.class); + startActivity(ittProjDtlsToLogin); + return true; + } + + + if (id == android.R.id.home) { + /* String fromwhere = getIntent().getStringExtra("From"); + if(fromwhere.equalsIgnoreCase("student")) { + Intent ittAboutToHome = new Intent(ContactUsActivity.this, HomeActivity.class); + startActivity(ittAboutToHome); + }else if(fromwhere.equalsIgnoreCase("Principle")) { + Intent ittAboutToHome = new Intent(ContactUsActivity.this, PrincipleHomeActivity.class); + startActivity(ittAboutToHome); + }else{ + Intent ittAboutToHome = new Intent(ContactUsActivity.this, PMHomeActivity.class); + startActivity(ittAboutToHome); + }*/ + if(str_role.equals("Student")) { + Intent ittEventsToStudHome = new Intent(ContactUsActivity.this, HomeActivity.class); + startActivity(ittEventsToStudHome); + }else if(str_role.equalsIgnoreCase("Principal")){ + Intent ittEventsToStudHome = new Intent(ContactUsActivity.this, PrincipleHomeActivity.class); + startActivity(ittEventsToStudHome); + } + else{ + Intent ittEventsToPMHome = new Intent(ContactUsActivity.this, PMHomeActivity.class); + startActivity(ittEventsToPMHome); + } + return true; + } + + + + + return super.onOptionsItemSelected(item); + } +} diff --git a/app/src/main/java/com/leadcampusapp/CurrentEventAdapter.java b/app/src/main/java/com/leadcampusapp/CurrentEventAdapter.java new file mode 100644 index 0000000..cf76ae8 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/CurrentEventAdapter.java @@ -0,0 +1,73 @@ +package com.leadcampusapp; + +import android.app.Activity; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.ImageView; + +//import com.android.sripad.leadnew_22_6_2018.R; + +import java.util.ArrayList; + +/** + * Created by Admin on 28-05-2018. + */ + +public class CurrentEventAdapter extends BaseAdapter { + + public ArrayList currentEventList; + Activity activity; + + public CurrentEventAdapter(Activity activity, ArrayList currentEventList) { + super(); + this.activity = activity; + this.currentEventList = currentEventList; + } + + @Override + public int getCount() { + return currentEventList.size(); + } + + @Override + public Object getItem(int position) { + return currentEventList.get(position); + } + + @Override + public long getItemId(int position) { + return position; + } + + private class ViewHolder { + ImageView mcurrent_eventImg; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + + ViewHolder holder; + LayoutInflater inflater = activity.getLayoutInflater(); + + if (convertView == null) { + convertView = inflater.inflate(R.layout.currentevent_listrow, null); + holder = new ViewHolder(); + + holder.mcurrent_eventImg = (ImageView) convertView.findViewById(R.id.img_currentEvent); + convertView.setTag(holder); + } else { + holder = (ViewHolder) convertView.getTag(); + } + + CurrentEventsModel item = currentEventList.get(position); + + holder.mcurrent_eventImg.setImageResource(item.getEventImg()); + + //holder.mleadFundedStatus.setText(item.getLeadFundedStatus().toString()); + + + return convertView; + } +} diff --git a/app/src/main/java/com/leadcampusapp/CurrentEventsFragment.java b/app/src/main/java/com/leadcampusapp/CurrentEventsFragment.java new file mode 100644 index 0000000..d7e701b --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/CurrentEventsFragment.java @@ -0,0 +1,811 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 20-07-2018. + */ + +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.AsyncTask; +import android.os.Bundle; +import androidx.fragment.app.Fragment; +//import androidx.appcompat.widget.LinearLayoutManager; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.Button; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.ListView; +import android.widget.TextView; +import android.widget.Toast; + +//import com.android.sripad.leadnew_22_6_2018.R; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.io.ByteArrayOutputStream; +import java.net.URL; +import java.util.ArrayList; + +public class CurrentEventsFragment extends Fragment +{ + + private LinearLayout currenteventsfragment_ViewLayout; + Context context; + + + + int noOfobjects = 0; + int noOfCurrentObject; + int count1; + ImageView Image1; + byte[] imageInByte; + Bitmap mIcon11; + + + byte[] x; + Bitmap bitmap1; + + Class_CurrentEvents[] class_currentevents_arrayObj,class_currentevents_arrayObj1; + private ListView listView; + + private String serverPath = Class_URL.ServerPath.toString().trim(); + + byte[] imageBytes={0}; + String Str_error1,Str_error2; + + String str_pastorcurrent,str_imageurl,str_applyurl,str_fromdate,str_todate; + Class_CurrentEvents detail; + + + + ArrayList listitems_Image_arraylist = new ArrayList<>(); + private static RecyclerView.Adapter adapter_recycler; + RecyclerView myrecyclerview_view; + LinearLayoutManager MyLayoutManager; + + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) + { + /* currenteventsfragment_ViewLayout = (LinearLayout) inflater.inflate(R.layout.currentevents_fragment, container, false); + context =currenteventsfragment_ViewLayout.getContext(); + listView = (ListView) currenteventsfragment_ViewLayout.findViewById(R.id.currentevent_listview); +*/ + + + + View view = inflater.inflate(R.layout.currentevents_fragmentcard, container, false); + myrecyclerview_view = (RecyclerView) view.findViewById(R.id.cardView); + + Str_error1=Str_error2="no"; + + + myrecyclerview_view.setHasFixedSize(true); + MyLayoutManager = new LinearLayoutManager(getActivity()); + + MyLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); + myrecyclerview_view.setLayoutManager(MyLayoutManager); + + + + /* Display display; + display = getWindowManager().getDefaultDisplay(); + DisplayMetrics outMetrics = new DisplayMetrics (); + display.getMetrics(outMetrics); + + float density = getResources().getDisplayMetrics().density; + float dpHeight = outMetrics.heightPixels / density; + float dpWidth = outMetrics.widthPixels / density; +*/ + // Getting application context + context = getActivity(); + + AsyncCallWS_currentevents task = new AsyncCallWS_currentevents(context); + task.execute(); + + + + + + //return currenteventsfragment_ViewLayout; + return view; + } + + + private class AsyncCallWS_currentevents extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + dialog.setMessage("Please wait.."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("LeadMIS", "doInBackground"); + // GetAllEvents(); + + CurrentEvents(); // call of current events direct hit + + + return null; + } + + public AsyncCallWS_currentevents(Context context1) { + context = context1; + dialog = new ProgressDialog(context1); + } + + @Override + protected void onPostExecute(Void result) + { + dialog.dismiss(); + + + + if(Str_error1.equals("no")||Str_error2.equals("no")) + { + if (class_currentevents_arrayObj != null) + { + /* CustomAdapter adapter = new CustomAdapter(); + listView.setAdapter(adapter);*/ + + + adapter_recycler = new MyAdapter_Card(listitems_Image_arraylist); + myrecyclerview_view.setAdapter(adapter_recycler); + + + int x1 = class_currentevents_arrayObj.length; + + System.out.println("Inside the if list adapter" + x1); + } else { + Log.d("onPostExecute", "leavelist == null"); + } + } + else + { + Toast.makeText(getActivity(), "Error: WS", Toast.LENGTH_SHORT).show(); + } + + }//end of OnPostExecute + + }// end Async task + + + + + public void CurrentEvents() + { + + + //URL + + String URL = Class_URL.URL_Projects.toString().trim(); + String METHOD_NAME = "GetEvents"; + String Namespace = "http://mis.leadcampus.org/", SOAPACTION = "http://mis.leadcampus.org/GetEvents"; + //URL + + //Toast.makeText(getActivity(),"test image",Toast.LENGTH_SHORT).show(); + + try { + // String versioncode = this.getPackageManager() + // .getPackageInfo(this.getPackageName(), 0).versionName; + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + + // request.addProperty("currentevents", "0"); + + + /*long +string +string +string +string +string +string +string + int +string*/ + + +//E/currentevents response: anyType{vmEvent=anyType{EventId=0; EventStatus=0; Status=Invalid Project status; }; } + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + androidHttpTransport.call(SOAPACTION, envelope); + SoapObject response = (SoapObject) envelope.getResponse(); + Log.e("currentevents response", response.toString()); + count1 = response.getPropertyCount(); // number of count in array in response 6,0-5,5 + + Log.e("number current rows", "" + count1); + + noOfobjects = count1; + noOfobjects = 1; + Log.e("Events","events count"+Integer.toString(noOfobjects)); + + + + noOfCurrentObject=0; + for (int i = 0; i < count1; i++) + { + SoapObject soapobject_response = (SoapObject) response.getProperty(i); + SoapPrimitive soapobject_pastorcurrent; + soapobject_pastorcurrent= (SoapPrimitive) soapobject_response.getProperty("EventStatus"); + if(soapobject_pastorcurrent.toString().equals("1")) + { noOfCurrentObject++; } + } + + + class_currentevents_arrayObj= new Class_CurrentEvents[noOfCurrentObject]; + + //class_currentevents_arrayObj= new Class_CurrentEvents[0]; + listitems_Image_arraylist.clear(); + for (int i = 0,j=0; i < count1; i++) + { + SoapObject soapobject_response = (SoapObject) response.getProperty(i); + SoapPrimitive soapobject_eventapplyurl, soapobject_eventurl, soapobject_imageURL,soapobject_pastorcurrent,soapobject_status,soapprimitive_fromdate,soapprimitive_todate; + String str_soapimageURL,str_status,str_fromdate,str_todate; + soapobject_eventapplyurl=(SoapPrimitive) soapobject_response.getProperty("EventApplyURL");// + soapobject_eventurl=(SoapPrimitive)soapobject_response.getProperty("EventURL"); //imageclickURL + soapobject_imageURL =(SoapPrimitive) soapobject_response.getProperty("Image_Path"); + soapobject_pastorcurrent= (SoapPrimitive) soapobject_response.getProperty("EventStatus"); + soapobject_status = (SoapPrimitive) soapobject_response.getProperty("Status"); + str_soapimageURL =(String) soapobject_response.getProperty("Image_Path").toString(); + soapprimitive_fromdate =(SoapPrimitive)soapobject_response.getProperty("EventFromDate");// + soapprimitive_todate=(SoapPrimitive)soapobject_response.getProperty("EventToDate");// + + if(soapobject_pastorcurrent.toString().equals("1")) { + // Log.e("Soap status"," "+soapobject_pastorcurrent.toString()); + Class_CurrentEvents innerObj = new Class_CurrentEvents(); + innerObj.setEventApplyURL(soapobject_eventapplyurl.toString()); + innerObj.setEventURL(soapobject_eventurl.toString()); + innerObj.setPastorCurrent(soapobject_pastorcurrent.toString()); + innerObj.setStatus(soapobject_status.toString()); + innerObj.setFromDate(soapprimitive_fromdate.toString()); + innerObj.setTodate(soapprimitive_todate.toString()); + + + String arr[] = str_soapimageURL.split("/", 2); + + String firstWord = arr[0]; //the + String secondWord = arr[1]; + + String Str_actualImgUrl = serverPath + secondWord; + // Log.i("tag", "firstWord=" + firstWord + " secondWord=" + secondWord); + // Log.e("student URL", "" + Str_actualImgUrl); + + // java.net.URL url = new URL(Str_actualImgUrl.toString().trim()); + + /*try { + InputStream in = new java.net.URL(Str_actualImgUrl).openStream(); + mIcon11 = BitmapFactory.decodeStream(in); + Log.e("Error Image conversion", "e.getMessage()"); + } catch (Exception e) { + Log.e("Error Image conversion", e.getMessage()); + e.printStackTrace(); + }*/ + + URL url = new URL(Str_actualImgUrl.toString().trim()); + mIcon11 = BitmapFactory.decodeStream(url.openConnection().getInputStream()); + + + ByteArrayOutputStream stream1 = new ByteArrayOutputStream(); + mIcon11.compress(Bitmap.CompressFormat.JPEG, 100, stream1); + imageInByte = stream1.toByteArray(); + + innerObj.setEventImage(imageInByte); + + class_currentevents_arrayObj[j] = innerObj; + j++; + listitems_Image_arraylist.add(innerObj); + } + + }//end of For Loop + + + + + } catch (Throwable t) { + //Toast.makeText(MainActivity.this, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Str_error1 ="yes"; + Log.e("request fail", "> " + t.getMessage()); + } + } catch (Throwable t) { + Str_error2="yes"; + Log.e("UnRegister Error", "> " + t.getMessage()); + + } + + }//end of newsandEvents + + + + + + + +//---------------------------------------------------------------------------------------------------------------------------- + + + + public class MyAdapter_Card extends RecyclerView.Adapter + { + private ArrayList list; + + public MyAdapter_Card(ArrayList Data) + { + list = Data; + } + + @Override + public MyViewHolder_X onCreateViewHolder(ViewGroup parent, int viewType) + { + // create a new view + View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.row_item_event, parent, false); + MyViewHolder_X holder = new MyViewHolder_X(view); + return holder; + } + + @Override + public void onBindViewHolder(final MyViewHolder_X holder, int position) + { + + + + + // Log.e("listvalue", String.valueOf(list.get(position).getImageResourceId())); + /* holder.coverImageView.setImageResource(list.get(position).getImageResourceId()); + holder.coverImageView.setTag(list.get(position).getImageResourceId()); + */ + + x = list.get(position).getEventImage(); + str_pastorcurrent =list.get(position).getPastorCurrent(); + str_imageurl = list.get(position).getEventURL(); + // Log.e("imageURL","URL"+str_imageurl); + str_applyurl= list.get(position).getEventApplyURL(); + str_fromdate=list.get(position).getFromDate(); + str_todate=list.get(position).getTodate(); + + if(!listitems_Image_arraylist.isEmpty()) + { + if (str_pastorcurrent.equals("1")) + { + + holder.holder_coverImageView.setVisibility(View.VISIBLE); + holder.holder_applybuttonc_bt.setVisibility(View.VISIBLE); + + bitmap1 = BitmapFactory.decodeByteArray(x, 0, x.length); + holder.holder_coverImageView.setImageBitmap(bitmap1); + + holder.holder_imageclickurlc_tv.setText(str_imageurl); + holder.holder_applybuttonurlc_tv.setText(str_applyurl); + holder.holder_fromdate_tv.setText(str_fromdate); + holder.holder_todate_tv.setText(str_todate); + + holder.holder_coverImageView.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + //Toast.makeText(getActivity(),"imageurl"+str_imageurl,Toast.LENGTH_SHORT).show(); + try{ + + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(holder.holder_imageclickurlc_tv.getText().toString())); + startActivity(browserIntent); + } + catch (Exception e) + { + // Toast.makeText(getActivity(),"WS:error",Toast.LENGTH_SHORT).show(); + } + + } + }); + + + if(str_applyurl.trim().length()==0) + { + holder.holder_applybuttonc_bt.setVisibility(View.GONE); + }else{ + + holder.holder_applybuttonc_bt.setVisibility(View.VISIBLE); + } + + holder.holder_applybuttonc_bt.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) + { + try { + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(holder.holder_applybuttonurlc_tv.getText().toString())); + startActivity(browserIntent); + //Toast.makeText(getActivity(),"imageurl"+str_applyurl,Toast.LENGTH_SHORT).show(); + } + catch (Exception e) + { + Toast.makeText(getActivity(),"WS:error",Toast.LENGTH_SHORT).show(); + } + + } + }); + + + + } + }//end of if statement + + else + { + + } + + /*holder.coverImageView.setTag(list.get(position).getImageResourceId()); + holder.likeImageView.setTag(R.drawable.ic_like);*/ + + } + + @Override + public int getItemCount() { + Log.e("listsize", String.valueOf(list.size())); + return list.size(); + + } + } + + public class MyViewHolder_X extends RecyclerView.ViewHolder + { + + + public ImageView holder_coverImageView; + TextView holder_imageclickurlc_tv; + Button holder_applybuttonc_bt; + TextView holder_applybuttonurlc_tv; + TextView holder_fromdate_tv; + TextView holder_todate_tv; + + public MyViewHolder_X(View v) + { + super(v); + + holder_coverImageView = (ImageView) v.findViewById(R.id.coverImageView); + holder_imageclickurlc_tv =(TextView) v.findViewById(R.id.imageurlc_TV); + holder_applybuttonc_bt =(Button)v.findViewById(R.id.eventsapplyc_BT); + holder_applybuttonurlc_tv =(TextView) v.findViewById(R.id.applyurlc_TV); + holder_fromdate_tv=(TextView)v.findViewById(R.id.fromdate_currentevent_TV); + holder_todate_tv=(TextView)v.findViewById(R.id.todate_currentevent_TV); + + } + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +//-------------------------------------------------------------------------------------------------------------------------- + + //Holder for customAdapter + private class Holder { + ImageView holder_image; + TextView holder_imageclickurl_tv; + Button holder_applybutton_bt; + TextView holder_applybuttonurl_tv; + TextView holder_passorcurrent_tv; + TextView holder_nocurrentevents_tv; + } + //End of Holder + + + + public class CustomAdapter extends BaseAdapter + { + + + public CustomAdapter() { + + super(); + Log.d("Inside CustomAdapter()", "Inside CustomAdapter()"); + } + + @Override + public int getCount() { + + String x = Integer.toString(class_currentevents_arrayObj.length); + Log.e("class_arrayObj.length", x); + return class_currentevents_arrayObj.length; + + } + + @Override + public Object getItem(int position) { + String x = Integer.toString(position); + System.out.println("getItem position" + x); + Log.d("getItem position", "x"); + return class_currentevents_arrayObj[position]; + } + + @Override + public long getItemId(int position) { + String x = Integer.toString(position); + System.out.println("getItemId position" + x); + Log.d("getItemId position", x); + return position; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) + { + + final Holder holder; + + Log.d("CustomAdapter", "position: " + position); + // holder = new Holder(); + if (convertView == null) { + holder = new Holder(); + convertView = LayoutInflater.from(getActivity()).inflate(R.layout.row_item_events, parent, false); + + + holder.holder_image=(ImageView) convertView.findViewById(R.id.eventsimagedisplay_IV); + holder.holder_imageclickurl_tv=(TextView)convertView.findViewById(R.id.imageurl_TV); + holder.holder_applybuttonurl_tv=(TextView)convertView.findViewById(R.id.applyurl_TV); + holder.holder_passorcurrent_tv=(TextView)convertView.findViewById(R.id.pastorcurrent_TV); + holder.holder_applybutton_bt=(Button)convertView.findViewById(R.id.eventsapply_BT); + holder.holder_nocurrentevents_tv =(TextView)convertView.findViewById(R.id.nocurrentevents_TV); + Log.d("Inside If convertView", "Inside If convertView"); + + convertView.setTag(holder); + } else { + holder = (Holder) convertView.getTag(); + Log.d("Inside else convertView", "Inside else convertView"); + } + + + + detail =(Class_CurrentEvents) getItem(position); + // Log.e("Class postion",getItem(position).toString()); + + // Class_CurrentEvents[] details =(Class_CurrentEvents) getItem(position); + + + if(detail!=null) + { + x = detail.getEventImage(); + str_pastorcurrent =detail.getPastorCurrent(); + + + //Log.e("detail length"," length"+) + + str_imageurl = detail.getEventURL(); + // Log.e("imageURL","URL"+str_imageurl); + str_applyurl= detail.getEventApplyURL(); + if(x!=null) + { + if(str_pastorcurrent.equals("1")) + { + // Log.e("str_pastorcurrent:"," : "+str_pastorcurrent.toString()); + holder.holder_image.setVisibility(View.VISIBLE); + holder.holder_applybutton_bt.setVisibility(View.VISIBLE); + + bitmap1 = BitmapFactory.decodeByteArray(x, 0, x.length); + holder.holder_image.setImageBitmap(bitmap1); + holder.holder_imageclickurl_tv.setText(str_imageurl); + holder.holder_applybuttonurl_tv.setText(str_applyurl); + + + holder.holder_image.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + //Toast.makeText(getActivity(),"imageurl"+str_imageurl,Toast.LENGTH_SHORT).show(); + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(holder.holder_imageclickurl_tv.getText().toString())); + startActivity(browserIntent); + + } + }); + + holder.holder_applybutton_bt.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) + { + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(holder.holder_applybuttonurl_tv.getText().toString())); + startActivity(browserIntent); + //Toast.makeText(getActivity(),"imageurl"+str_applyurl,Toast.LENGTH_SHORT).show(); + } + }); + + }//end of pastorcurrent + } else + { + //holder.holder_image.setVisibility(View.GONE); + + + } + + } + else{ + + // holder.holder_nocurrentevents_tv.setVisibility(View.VISIBLE); + } + + + + + return convertView; + + + } + + + }//End of CustomAdapter + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +}//end of fragment class + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/* +{ + + ArrayList currentEventList; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) + { + View view = inflater.inflate(R.layout.currentevents_fragment, container, false); + + currentEventList = new ArrayList(); + + ListView lview = (ListView) view.findViewById(R.id.listview); + + CurrentEventAdapter adapter = new CurrentEventAdapter(getActivity(), currentEventList); + lview.setAdapter(adapter); + + populateList(); + + adapter.notifyDataSetChanged(); + + return view; + } + + private void populateList() { + + CurrentEventsModel item1, item2, item3, item4, item5; + + item1 = new CurrentEventsModel(R.drawable.event1); + currentEventList.add(item1); + + item2 = new CurrentEventsModel(R.drawable.event2); + currentEventList.add(item2); + + item3 = new CurrentEventsModel(R.drawable.event3); + currentEventList.add(item3); + + + + } +} +*/ + + diff --git a/app/src/main/java/com/leadcampusapp/CurrentEventsModel.java b/app/src/main/java/com/leadcampusapp/CurrentEventsModel.java new file mode 100644 index 0000000..107f89f --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/CurrentEventsModel.java @@ -0,0 +1,21 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 28-05-2018. + */ + +public class CurrentEventsModel { + private int eventImg; + + public int getEventImg() { + return eventImg; + } + + public void setEventImg(int eventImg) { + this.eventImg = eventImg; + } + + public CurrentEventsModel(int eventImg) { + this.eventImg = eventImg; + } +} diff --git a/app/src/main/java/com/leadcampusapp/CustomExpandableListAdapter.java b/app/src/main/java/com/leadcampusapp/CustomExpandableListAdapter.java new file mode 100644 index 0000000..e210b98 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/CustomExpandableListAdapter.java @@ -0,0 +1,106 @@ +package com.leadcampusapp; + +import android.content.Context; +import android.graphics.Typeface; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseExpandableListAdapter; +import android.widget.TextView; + +//import com.android.sripad.leadnew_22_6_2018.R; + +import java.util.HashMap; +import java.util.List; + +public class CustomExpandableListAdapter extends BaseExpandableListAdapter { + + private Context context; + private List expandableListTitle; + private HashMap> expandableListDetail; + + public CustomExpandableListAdapter(Context context, List expandableListTitle, + HashMap> expandableListDetail) { + this.context = context; + this.expandableListTitle = expandableListTitle; + this.expandableListDetail = expandableListDetail; + } + + @Override + public Object getChild(int listPosition, int expandedListPosition) { + return this.expandableListDetail.get(this.expandableListTitle.get(listPosition)) + .get(expandedListPosition); + } + + @Override + public long getChildId(int listPosition, int expandedListPosition) { + return expandedListPosition; + } + + @Override + public View getChildView(int listPosition, final int expandedListPosition, + boolean isLastChild, View convertView, ViewGroup parent) { + final String expandedListText = (String) getChild(listPosition, expandedListPosition); + if (convertView == null) { + LayoutInflater layoutInflater = (LayoutInflater) this.context + .getSystemService(Context.LAYOUT_INFLATER_SERVICE); + convertView = layoutInflater.inflate(R.layout.list_item, null); + } + TextView expandedListTextView = (TextView) convertView + .findViewById(R.id.expandedListItem); + expandedListTextView.setText(expandedListText); + // expandedListTextView.setLineSpacing(2,1); + + // expandedListTextView.setTextColor(context.getResources().getColor(R.color.colorBlack)); + return convertView; + } + + @Override + public int getChildrenCount(int listPosition) { + return this.expandableListDetail.get(this.expandableListTitle.get(listPosition)) + .size(); + } + + @Override + public Object getGroup(int listPosition) { + return this.expandableListTitle.get(listPosition); + } + + @Override + public int getGroupCount() { + return this.expandableListTitle.size(); + } + + @Override + public long getGroupId(int listPosition) { + return listPosition; + } + + @Override + public View getGroupView(int listPosition, boolean isExpanded, + View convertView, ViewGroup parent) { + String listTitle = (String) getGroup(listPosition); + if (convertView == null) { + LayoutInflater layoutInflater = (LayoutInflater) this.context. + getSystemService(Context.LAYOUT_INFLATER_SERVICE); + convertView = layoutInflater.inflate(R.layout.list_group, null); + } + TextView listTitleTextView = (TextView) convertView + .findViewById(R.id.listTitle); + listTitleTextView.setTypeface(null, Typeface.BOLD); + // listTitleTextView.setTextColor(context.getResources().getColor(R.color.colorBlack)); + listTitleTextView.setText(listTitle); + // listTitleTextView.setLineSpacing(10,100); + return convertView; + } + + @Override + public boolean hasStableIds() { + return false; + } + + @Override + public boolean isChildSelectable(int listPosition, int expandedListPosition) { + return true; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/DataModel.java b/app/src/main/java/com/leadcampusapp/DataModel.java new file mode 100644 index 0000000..3153c0d --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/DataModel.java @@ -0,0 +1,20 @@ +package com.leadcampusapp; + +/** + * Created by anupamchugh on 11/02/17. + */ + +public class DataModel { + + + public String text; + public int drawable; + public String color; + + public DataModel(String t, int d, String c ) + { + text=t; + drawable=d; + color=c; + } +} diff --git a/app/src/main/java/com/leadcampusapp/DatabaseHelper.java b/app/src/main/java/com/leadcampusapp/DatabaseHelper.java new file mode 100644 index 0000000..24cf43a --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/DatabaseHelper.java @@ -0,0 +1,215 @@ +package com.leadcampusapp; + + +import android.content.ContentValues; +import android.content.Context; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteOpenHelper; +import android.util.Log; + + +public class DatabaseHelper extends SQLiteOpenHelper { + + public static final String DATABASE_NAME = "LeadDb"; + public static final String TABLE_NAME = "LeadDb_table"; + public static final String STATEMASTER = "statemaster"; + public static final String DISTRICTMASTER = "districtmaster"; + public static final String CITYMASTER = "citymaster"; + public static final String COLLEGEMASTER = "collegemaster"; + public static final String PROGRAMMEMASTER = "programmemaster"; + public static final String COURSEMASTER = "coursemaster"; + public static final String SEMMASTER = "semmaster"; + + + public DatabaseHelper(Context context) { + super(context, DATABASE_NAME, null, 1); + } + + + @Override + public void onCreate(SQLiteDatabase db) { + //db.execSQL("create table " + TABLE_NAME +" (ID INTEGER PRIMARY KEY AUTOINCREMENT,NAME TEXT,MOBILE TEXT, EMAIL TEXT, DOB TEXT, PHOTO TEXT)"); + //db.execSQL("create table " + TABLE_NAME +" (ID INTEGER PRIMARY KEY AUTOINCREMENT,APPLICATIONID TEXT,NAME TEXT,STATUS TEXT,PROGRAM TEXT,HEIGHT TEXT,WEIGHT TEXT,HB TEXT,BG TEXT,AGE TEXT,GENDER TEXT,BMI TEXT,BMR TEXT,PHOTO TEXT)"); + + //db.execSQL("create table " + TABLE_NAME +" (ID INTEGER PRIMARY KEY AUTOINCREMENT,APPLICATIONID TEXT,NAME TEXT,STATUS TEXT,PROGRAM TEXT)"); + + Log.d("Insidexxxxx","Oncreate"); + + String tab_StateMaster = "Create table "+STATEMASTER+" (STATEID INTEGER PRIMARY KEY, STATENAME TEXT, STATUS TEXT)"; + String tab_DistrictMaster = "Create table "+DISTRICTMASTER+" (DISTRICTID INTEGER PRIMARY KEY, STATEID INTEGER, DISTRICTNAME TEXT, FOREIGN KEY(STATEID) REFERENCES "+STATEMASTER+"(STATEID))"; + String tab_CityMaster = "Create table "+CITYMASTER+" (CITYID INTEGER PRIMARY KEY, DISTRICTID INTEGER, CITYNAME TEXT, FOREIGN KEY(DISTRICTID) REFERENCES "+DISTRICTMASTER+"(DISTRICTID))"; + String tab_CollegeMaster = "Create table "+COLLEGEMASTER+" (COLLEGEID INTEGER PRIMARY KEY, CITYID INTEGER, COLLEGENAME TEXT, FOREIGN KEY(CITYID) REFERENCES "+CITYMASTER+"(CITYID))"; + String tab_ProgrammeMaster = "Create table "+PROGRAMMEMASTER+" (PROGRAMMEID INTEGER PRIMARY KEY, PROGRAMMENAME TEXT)"; + String tab_CourseMaster = "Create table "+COURSEMASTER+" (COURSEID INTEGER PRIMARY KEY, PROGRAMMEID INTEGER, COURSENAME TEXT, FOREIGN KEY(PROGRAMMEID) REFERENCES "+PROGRAMMEMASTER+"(PROGRAMMEID))"; + String tab_SemesterMaster = "Create table "+SEMMASTER+" (SEMID INTEGER PRIMARY KEY, SEMNAME TEXT)"; + + + db.execSQL(tab_StateMaster); + db.execSQL(tab_DistrictMaster); + db.execSQL(tab_CityMaster); + db.execSQL(tab_CollegeMaster); + db.execSQL(tab_ProgrammeMaster); + db.execSQL(tab_CourseMaster); + db.execSQL(tab_SemesterMaster); + + Log.d("Insidexxxxx","After Table create"); + + //db.execSQL("create table " + "Filepath" +" (APPLICATIONID TEXT PRIMARY KEY,FILENAME TEXT)"); + + } + + @Override + public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { + //db.execSQL("DROP TABLE IF EXISTS "+TABLE_NAME); + onCreate(db); + } + + public boolean insertApplication(String applicationId, String name, String status, String program) { + SQLiteDatabase db = this.getWritableDatabase(); + ContentValues contentValues = new ContentValues(); + + contentValues.put("APPLICATIONID",applicationId); + contentValues.put("NAME",name); + contentValues.put("STATUS",status); + contentValues.put("PROGRAM",program); + /*contentValues.put("HEIGHT",""); + contentValues.put("WEIGHT",""); + contentValues.put("HB",""); + contentValues.put("BG",""); + contentValues.put("AGE",""); + contentValues.put("GENDER",""); + contentValues.put("BMI",""); + contentValues.put("BMR",""); + contentValues.put("PHOTO","");*/ + + long result = db.insert(TABLE_NAME,null,contentValues); + + Log.d("Result is", String.valueOf(result)); + + if(result == -1) + return false; + else + return true; + } + + + public boolean insertIntoStateDB(int stateId, String stateName, String status) { + SQLiteDatabase db = this.getWritableDatabase(); + ContentValues contentValues = new ContentValues(); + + contentValues.put("STATEID",stateId); + contentValues.put("STATENAME",stateName); + contentValues.put("STATUS",status); + + long result = db.insert(STATEMASTER,null,contentValues); + Log.d("Resultxxxxx is", String.valueOf(result)); + + if(result == -1) + return false; + else + return true; + } + + public boolean insertIntoDistrictDB(int distId, int stateId, String distName, String status) { + SQLiteDatabase db = this.getWritableDatabase(); + ContentValues contentValues = new ContentValues(); + + contentValues.put("DISTRICTID",distId); + contentValues.put("STATEID",stateId); + contentValues.put("DISTRICTNAME",distName); + + long result = db.insert(DISTRICTMASTER,null,contentValues); + Log.d("Resultxxxxx is", String.valueOf(result)); + + if(result == -1) + return false; + else + return true; + } + + + + public Cursor getStateData() { + SQLiteDatabase db = this.getWritableDatabase(); + Cursor res = db.rawQuery("SELECT * FROM "+STATEMASTER,null); + return res; + } + + public Cursor getDistrictInfo(int stateid) { + + SQLiteDatabase db = this.getReadableDatabase(); + + Cursor res = db.query(DISTRICTMASTER, new String[] { + "DISTRICTID", "STATEID", "DISTRICTNAME"}, "STATEID" + "=?", + new String[] { String.valueOf(stateid)}, null, null, null, null); + + Log.d("count", String.valueOf(res.getCount())); + + return res; + } + + + + + + + + +/* public boolean insertFilePath(String applicationId, String fileName) { + SQLiteDatabase db = this.getWritableDatabase(); + ContentValues contentValues = new ContentValues(); + + contentValues.put("APPLICATIONID",applicationId); + contentValues.put("FILENAME",fileName); + + + long result = db.insert("Filepath",null,contentValues); + + Log.d("Result is", String.valueOf(result)); + + if(result == -1) + return false; + else + return true; + }*/ + + + + + + + + public Cursor getAllData() { + SQLiteDatabase db = this.getWritableDatabase(); + Cursor res = db.rawQuery("SELECT * FROM "+TABLE_NAME,null); + return res; + } + + public Cursor getApplicationInfo(String applicationId) { + + SQLiteDatabase db = this.getReadableDatabase(); + + Cursor res = db.query("applicationForm_tabless", new String[] { + "APPLICATIONID", "NAME", "STATUS", "PROGRAM" }, "APPLICATIONID" + "=?", + new String[] { String.valueOf(applicationId)}, null, null, null, null); + + Log.d("count", String.valueOf(res.getCount())); + + return res; + } + + /* public Cursor getFileName(String applicationId) { + + SQLiteDatabase db = this.getReadableDatabase(); + + Cursor res = db.query("Filepath", new String[] { + "FILENAME" }, "APPLICATIONID" + "=?", + new String[] { String.valueOf(applicationId)}, null, null, null, null); + + Log.d("count", String.valueOf(res.getCount())); + + return res; + }*/ + +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/EditProfileActivity.java b/app/src/main/java/com/leadcampusapp/EditProfileActivity.java new file mode 100644 index 0000000..7e18671 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/EditProfileActivity.java @@ -0,0 +1,4617 @@ +package com.leadcampusapp; + +import android.annotation.SuppressLint; +import android.app.Activity; +import android.app.AlertDialog; +//import android.support.v7.app.AlertDialog; +import android.app.DatePickerDialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.Color; +import android.graphics.Matrix; +import android.media.ExifInterface; +import android.net.Uri; +import android.os.AsyncTask; +import android.os.Build; +import android.provider.MediaStore; +import androidx.core.content.ContextCompat; +import androidx.appcompat.app.AppCompatActivity; +import android.os.Bundle; +import androidx.appcompat.widget.AppCompatSpinner; +import android.util.Base64; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.AutoCompleteTextView; +import android.widget.Button; +import android.widget.DatePicker; +import android.widget.EditText; +import android.widget.ImageButton; +import android.widget.ImageView; +import android.widget.RadioButton; +import android.widget.RadioGroup; +import android.widget.TextView; +import android.widget.Toast; + +//import com.android.sripad.leadnew_22_6_2018.R; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.net.URL; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class EditProfileActivity extends AppCompatActivity { + + + private AppCompatSpinner spin_gender; + private AppCompatSpinner spin_bg; + + + private int mYear, mMonth, mDay; + private int cYear, cMonth, cDay; + private Context context; + + // private Button btn_save; + private ImageView btn_save; + private Button btn_addProfile; + private ImageButton imgBtn_addProfile; + + + AppCompatSpinner spin_state; + Class_States[] arrayObj_Class_States, arrayObj_Class_States2; + Class_States obj_Class_States; + int statelistcount; + String str_StateStatus="x"; + + AppCompatSpinner spin_district; + Class_District[] arrayObj_Class_District, arrayObj_Class_District2; + Class_District obj_Class_District; + int districtlistcount; + String str_DistrictStatus="x"; + + AppCompatSpinner spin_city; + Class_Taluk[] arrayObj_Class_Taluk, arrayObj_Class_Taluk2; + Class_Taluk obj_Class_Taluk; + int taluklistcount; + String str_TalukStatus="x"; + + AppCompatSpinner spin_institution; + Class_Colleges[] arrayObj_Class_Colleges, arrayObj_Class_Colleges2,arrayObj_Class_Colleges3; + Class_Colleges obj_Class_Colleges; + int collegeslistcount; + String str_CollegesStatus; + + + AppCompatSpinner spin_semester; + Class_Sem[] arrayObj_Class_Sem, arrayObj_Class_Sem2; + Class_Sem obj_Class_Sem; + int semlistcount; + String str_SemStatus; + String str_semid,str_semname; + + + + + AppCompatSpinner spin_course; + Class_Course[] arrayObj_Class_Course, arrayObj_Class_Course2; + Class_Course obj_Class_Course; + int courselistcount; + String str_CourseStatus; + String str_courseid,str_coursename; + + + + AppCompatSpinner spin_program; + Class_Program[] arrayObj_Class_Program, arrayObj_Class_Program2; + Class_Program obj_Class_Program; + int programlistcount; + String str_ProgramStatus; + String str_programid,str_programname="x"; + + + + private int REQUEST_CAMERA = 0, SELECT_FILE = 1; + private int REQUEST_CAMERA_BANK = 1, SELECT_FILE_BANK = 2; + ImageView img_profilePick,img_bankPick; + DatabaseHelper dbHelper; + + EditText edt_dob; + Calendar myCalendar = Calendar.getInstance(); + String leadid, isprofileEdited; + EditProfileModel edtPrfModel; + + HashMap hashMapState = new HashMap(); + + + Class_InternetDectector internetDectector, internetDectector2; + Boolean isInternetPresent = false; + Boolean isInternetPresent2 = false; + + + String internet_issue = "false"; + String internet_issue1="Noerror"; + + String str_Cityids,str_ColID,str_Sids,str_Dids; + + + + ArrayAdapter dataAdapter, dataAdapter_district, dataAdapter_city, dataAdapter_college,dataAdapter_semlist; + ArrayAdapter dataAdapter_course,dataAdapter_program,dataAdapter_bloodgroup; + + Class_HintSpinnerAdapter class_hintspinneradapter_obj; + + AutoCompleteTextView txtSearch1; + AutoCompleteTextView statesearch_ATV, districtsearch_ATV, citysearch_ATV, collegesearch_ATV; + + + + + String str_editprofile_response,str_gender,str_bloodgroup,str_isProfileEdited,str_bankDoc; + + String str_MobileNo,str_RegID,str_LeadID,str_studenttype,str_academiccode; + EditText edt_studName,alernativecell_et,emailid_et,aadhara_et,account_et,iifscode_et; + + + public static final String PREFBook_Stud= "prefbook_stud"; //sharedpreference Book + public static final String PrefID_RegID = "prefid_regid"; // + public static final String PrefID_SName = "prefid_sname"; // + public static final String PrefID_PM_SName = "prefid_pmsname"; // + public static final String PrefID_SLeadID = "prefid_sleadid"; // + public static final String PrefID_PM_SEmailID = "prefid_pm_semailid"; // + public static final String PrefID_SCellNo = "prefid_scellno"; // + public static final String PrefID_S_isprofileEdited = "prefid_isprofileEdited"; + public static final String PrefID_SStudentType = "prefid_sstudentType"; + public static final String PrefId_S_Gender = "prefid_sgender"; + public static final String PrefId_S_AcademicId = "prefid_sacademicid"; + + SharedPreferences shardpref_S_obj; + SharedPreferences.Editor editor_S; + + + Class_URL config_obj= new Class_URL(); + public static final String PREFBook_LoginTrack= "prefbook_logintrack"; + public static final String PrefID_WhereToGo = "prefid_wheretogo"; // + SharedPreferences shardprefLoginTrack_obj; + SharedPreferences.Editor editor_LoginTrack; + + + + + + + + + byte[] imageinbytesArray={0}; + String studPickBase64 = null; + String bankPicBase64 = null; + + + RadioGroup gender_radiogroup,bankdoc_radiogroup; + + String str_homeactivity="no"; + String O_statename,O_districtname,O_talukname,O_programmename,O_coursename,O_semname,O_collegename; + String O_statecode,O_districtcode,O_talukacode,O_collegenameCode,O_coursecode,O_StreamprogramCode; + String O_RegistrationId,O_StudentName,O_DOB,O_AadharNo,O_Account_No,O_IFSC_code,O_AlternativeMobileNo,O_altermailid,O_Gender,O_MailId,O_BloodGroup,O_leadID,O_MobileNo,O_Student_Image,Str_studentImgUrl,O_Student_Type,O_mytalent; + TextView leadid_tv,mobileno_tv,student_tv; + + TextView stateerror_tv,districterror_tv,cityerror_tv,collegeerror_tv,courseerror_tv,semerror_tv; + + EditText dobseterror_tv; + Bitmap Studentbmp; + + + private File actualImage; + ArrayList stringArrayList = new ArrayList(); + String[] state_stringArray; + + + Bitmap bmp_fromCamera; + + private String serverPath = Class_URL.ServerPath.toString().trim(); + + + private Button btn_submitQuery; + private EditText edt_mailId_Query; + private EditText edt_description_Query; + private EditText request_statename_et,request_districtname_et,request_talukaname_et,request_Collegename_et,request_studentname_et; + private AlertDialog dialog; + + ProgressDialog pd_getstudentdetails; + + TextView statelabel_tv,districtlabel_tv,citylabel_tv,courselabel_tv,institutionlabel_tv,streamlabel_tv; + TextView semlabel_tv,whatsapplabel_tv,emailidlabel_tv,doblabel_tv; + EditText mytalent_et; + @Override + protected void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_edit_profile); + + edtPrfModel = new EditProfileModel(); + + + + + + // isprofileEdited = getIntent().getStringExtra("isProfileEdit");// for first time user + + // Toast.makeText(getApplicationContext(), "Profile" + isprofileEdited.toString(), Toast.LENGTH_SHORT).show(); + + str_Cityids=str_ColID=str_Sids=str_Dids=str_courseid=str_programid=str_semid="x"; + str_gender="M"; + /*getSupportActionBar().setTitle("LeadMIS");*/ + + /*leadid = getIntent().getStringExtra("leadid"); + + Log.d("Lead Id is",leadid);*/ + + str_homeactivity =getIntent().getStringExtra("KeyfromHome"); //fromhomeactivity + + + /* if(str_homeactivity.equals(null)) + { + Toast.makeText(this,"Keyfromhome: "+str_homeactivity,Toast.LENGTH_SHORT).show(); + }*/ + + /* if(TextUtils.isEmpty(str_homeactivity)) { + Toast.makeText(this,"Keyfromhome: "+str_homeactivity,Toast.LENGTH_SHORT).show(); + } + else + { + getStudentDetails(); + }*/ + + context = EditProfileActivity.this; + + + + + + + statelabel_tv=(TextView) findViewById(R.id.statelabel_TV); + districtlabel_tv=(TextView) findViewById(R.id.districtlabel_TV); + citylabel_tv=(TextView) findViewById(R.id.citylabel_TV); + courselabel_tv=(TextView) findViewById(R.id.courselabel_TV); + institutionlabel_tv=(TextView) findViewById(R.id.institutionlabel_TV); + streamlabel_tv=(TextView) findViewById(R.id.streamlabel_TV); + + + edt_studName = (EditText) findViewById(R.id.edt_studName); + + spin_state = (AppCompatSpinner) findViewById(R.id.spin_state); + spin_city = (AppCompatSpinner) findViewById(R.id.spin_city); + spin_institution = (AppCompatSpinner) findViewById(R.id.spin_institution); + spin_semester = (AppCompatSpinner) findViewById(R.id.spin_sem); + edt_dob = (EditText) findViewById(R.id.edt_dob); + //spin_gender = (AppCompatSpinner) findViewById(R.id.spin_gender); + spin_bg = (AppCompatSpinner) findViewById(R.id.spin_bg); + + spin_district = (AppCompatSpinner) findViewById(R.id.spin_district); + + spin_program = (AppCompatSpinner) findViewById(R.id.spin_program); + spin_course = (AppCompatSpinner) findViewById(R.id.spin_course); + + alernativecell_et = (EditText) findViewById(R.id.alernativecell_ET); + emailid_et= (EditText) findViewById(R.id.emailid_ET); + aadhara_et= (EditText) findViewById(R.id.aadhara_ET); + account_et= (EditText) findViewById(R.id.account_ET); + iifscode_et= (EditText) findViewById(R.id.iifscode_ET); + leadid_tv =(TextView)findViewById(R.id.leadid_TV); + mobileno_tv =(TextView)findViewById(R.id.mobileno_TV); + student_tv =(TextView)findViewById(R.id.studenttype_TV); + stateerror_tv =(TextView)findViewById(R.id.stateerror_TV); + districterror_tv =(TextView)findViewById(R.id.districterror_TV); + cityerror_tv =(TextView)findViewById(R.id.cityerror_TV); + collegeerror_tv = (TextView)findViewById(R.id.collegeerror_TV); + courseerror_tv =(TextView)findViewById(R.id.courseerror_TV); + semerror_tv = (TextView)findViewById(R.id.semerror_TV); + dobseterror_tv =(EditText)findViewById(R.id.dobseterror_TV); + mytalent_et= (EditText)findViewById(R.id.mytalent_et); + + gender_radiogroup =(RadioGroup)findViewById(R.id. gender_radiogroup); + + // btn_save = (Button) findViewById(R.id.btn_save); + + btn_save = (ImageView) findViewById(R.id.btn_save); + + + stateerror_tv.setVisibility(View.GONE); + shardpref_S_obj=this.getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + shardprefLoginTrack_obj =this.getSharedPreferences(PREFBook_LoginTrack,Context.MODE_PRIVATE); + + shardpref_S_obj.getString(PrefID_RegID, "").trim(); + str_RegID = shardpref_S_obj.getString(PrefID_RegID, "").trim(); + str_LeadID = shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + str_MobileNo =shardpref_S_obj.getString(PrefID_SCellNo,"").trim(); + str_studenttype=shardpref_S_obj.getString(PrefID_SStudentType,"").trim(); + str_academiccode=shardpref_S_obj.getString(PrefId_S_AcademicId,"").trim(); + + + + + editor_LoginTrack = shardprefLoginTrack_obj.edit(); + editor_LoginTrack.putString(PrefID_WhereToGo,config_obj.packagename+"EditProfileActivity"); + editor_LoginTrack.commit(); + + shardpref_S_obj.getString(PrefID_S_isprofileEdited, "").trim(); + str_isProfileEdited = shardpref_S_obj.getString(PrefID_S_isprofileEdited, "").trim(); + // str_LeadID = shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + Log.i("tag","str_isProfileEdited="+str_isProfileEdited); + //btn_addProfile = (Button) findViewById(R.id.btn_addProfile); + + /*Toast.makeText(this,"str_isProfileEdited : "+str_isProfileEdited.toString(),Toast.LENGTH_SHORT).show(); + Toast.makeText(this,"LeadID : "+str_LeadID.toString(),Toast.LENGTH_SHORT).show();*/ + + imgBtn_addProfile = (ImageButton) findViewById(R.id.imgBtn_addProfile); + + img_profilePick = (ImageView) findViewById(R.id.img_profilePick); + img_bankPick = (ImageView) findViewById(R.id.img_bankPick); + + + dbHelper = new DatabaseHelper(EditProfileActivity.this); + + + txtSearch1 = (AutoCompleteTextView) findViewById(R.id.txtSearch1); + statesearch_ATV = (AutoCompleteTextView) findViewById(R.id.statesearch); + districtsearch_ATV = (AutoCompleteTextView) findViewById(R.id.districtsearch); + citysearch_ATV = (AutoCompleteTextView) findViewById(R.id.citysearch); + collegesearch_ATV = (AutoCompleteTextView) findViewById(R.id.collegesearch); + + + + + + + + + + + /*btn_addProfile.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + selectImage(); + } + });*/ + + imgBtn_addProfile.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + selectImage(); + } + }); + + img_bankPick.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + selectImageBank(); + } + }); + + +/********************** need to be in group *****************************************/ + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + //getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background)); + + + View actionBarView = getSupportActionBar().getCustomView(); + TextView actionBarTV = (TextView) actionBarView.findViewById(R.id.txt_actionBar); + actionBarTV.setText("Edit Profile"); + + + +/********************** need to be in group *****************************************/ + + // getStudentDetails(); + // setStateSpinner(); + // setCitySpinner(); + // setInstitutionSpinner(); + // setSemesterSpinner(); + // setDistrictSpinner(); + //setCourseSpinner(); + //setProgramSpinner(); + setDateOfBirth(); + //setGenderSpinner(); + setBloodGroupSpinner(); + + // setSpinner(); + + + + + + internetDectector = new Class_InternetDectector(getApplicationContext()); + isInternetPresent = internetDectector.isConnectingToInternet(); + + + if (isInternetPresent) + { + // getCollegelist_AsynTask(); + // Update_Semlist_spinner(); + + // getSemlist_AsynTask(); + + + + + if (str_isProfileEdited.equals("0")) { + // Toast.makeText(getApplicationContext(), "First Time", Toast.LENGTH_SHORT).show(); + + SQLiteDatabase db1 = this.openOrCreateDatabase("LeadEditProfileDB", Context.MODE_PRIVATE, null); + db1.execSQL("CREATE TABLE IF NOT EXISTS Statelist(SID VARCHAR,SName VARCHAR);"); + Cursor cursor1 = db1.rawQuery("SELECT * FROM Statelist", null); + int x = cursor1.getCount(); + Log.e("Total DB count", Integer.toString(x)); + + + if (x <= 0) // already values are their in database + { + + leadid_tv.setText(str_LeadID.toString().trim()); + mobileno_tv.setText(str_MobileNo.toString().trim()); + student_tv.setText(str_studenttype.toString().trim()); + // Toast.makeText(getApplicationContext(), "If part", Toast.LENGTH_SHORT).show(); + getstatelist_AsynTask(); + // getProgramlist_AsynTask(); + /*getdistrictlist_AsynTask(); + getTaluklist_AsynTask(); + + getSemlist_AsynTask(); + getCourselist_AsynTask(); + getProgramlist_AsynTask(); + + getCollegelist_AsynTask(); +*/ + + } else //load from database + { + // Toast.makeText(getApplicationContext(), "Else part", Toast.LENGTH_SHORT).show(); + + + // uploadfromDB_Statelist(); + // uploadfromDB_Districtlist(); + Update_Semlist_spinner(); + Update_Programlist_spinner(); + + // Update_Courselist_spinner(); + + + } + + }else if(str_isProfileEdited.equals("1")){ + getStudentDetails(); + getstatelist_AsynTask(); + }else if(str_isProfileEdited.equals("2")){ + getStudentDetails(); + getstatelist_AsynTask(); + } + + } + + + + txtSearch1.setText("Karnataka"); + + + + + + + + + + + + + btn_save.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + /*Intent ittEditToHome = new Intent(EditProfileActivity.this, HomeActivity.class); + startActivity(ittEditToHome); +*/ + + if(validation()) + { + internetDectector2 = new Class_InternetDectector(getApplicationContext()); + isInternetPresent2 = internetDectector2.isConnectingToInternet(); + + if (isInternetPresent2) + { + SaveStudentDetails_AsynTask(); + } + else + { + Toast.makeText(getApplicationContext(),"No Internet",Toast.LENGTH_LONG).show(); + } + } + else + { + Toast.makeText(getApplicationContext(),"Kindly complete the profile",Toast.LENGTH_LONG).show(); + } + + + + /*Intent ittEditToHome = new Intent(EditProfileActivity.this, TestActivity.class); + startActivity(ittEditToHome);*/ + + } + }); + + + + + + spin_state.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected (AdapterView < ? > parent, View view, + int position, long id){ + // TODO Auto-generated method stub + + obj_Class_States = (Class_States) spin_state.getSelectedItem(); + str_Sids = obj_Class_States.getstate_id().toString(); + spin_city.setAdapter(null); + spin_program.setAdapter(null); + spin_institution.setAdapter(null); + spin_course.setAdapter(null); + spin_semester.setAdapter(null); + + str_Cityids=str_ColID=str_Dids=str_courseid=str_programid=str_semid="x"; + //Toast.makeText(getApplicationContext(),"State"+spin_state.getSelectedItem().toString()+"ID:"+str_Sids,Toast.LENGTH_SHORT).show(); + + // Toast.makeText(getApplicationContext(),"State:"+spin_state.getSelectedItem().toString(),Toast.LENGTH_SHORT).show(); + if(!( (str_Sids.equals("x"))|| (str_Sids.equals("0")) )) + { stateerror_tv.setText(""); + stateerror_tv.setVisibility(View.GONE); + getdistrictlist_AsynTask(); + } + + /* String str_spinstate=spin_state.getSelectedItem().toString(); + if(arrayObj_Class_States!=null) + { + for (int i = 0; i < arrayObj_Class_States.length; i ++) { + if (arrayObj_Class_States[i] != null) { + if (arrayObj_Class_States[i].getstate_name().equals(str_spinstate)) { + Toast.makeText(getApplicationContext(), "ID:" + arrayObj_Class_States[i].getstate_id().toString(), Toast.LENGTH_SHORT).show(); + + str_Sids=arrayObj_Class_States[i].getstate_id().toString(); + getdistrictlist_AsynTask(); + break; + } + i++; + } + } + }*/ + + + /* if(spin_state.getSelectedItem().toString().equals("Select State")) + { } + else + { + obj_Class_States = (Class_States) spin_state.getSelectedItem(); + str_Sids = obj_Class_States.getstate_id().toString(); + spin_city.setAdapter(null); + spin_program.setAdapter(null); + spin_institution.setAdapter(null); + spin_course.setAdapter(null); + spin_semester.setAdapter(null); + Toast.makeText(getApplicationContext(),"State"+spin_state.getSelectedItem().toString()+"ID:"+str_Sids,Toast.LENGTH_SHORT).show(); + + if(!(str_Sids.equals("x")||str_Sids.equals("0"))) + { getdistrictlist_AsynTask(); + } + + }*/ + + + + + + + + } + + @Override + public void onNothingSelected (AdapterView < ? > parent){ + // TODO Auto-generated method stub + } + }); + + + + + spin_district.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected (AdapterView < ? > parent, View view, + int position, long id){ + // TODO Auto-generated method stub + obj_Class_District = (Class_District) spin_district.getSelectedItem(); + str_Dids = obj_Class_District.getdistrict_id().toString(); + // Toast.makeText(getApplicationContext(),"District ID"+str_Dids+"State:"+spin_district.getSelectedItem().toString(),Toast.LENGTH_LONG).show(); + + //Toast.makeText(getApplicationContext(),"District ID:"+spin_district.getSelectedItem().toString(),Toast.LENGTH_LONG).show(); + + spin_city.setAdapter(null); + spin_program.setAdapter(null); + spin_institution.setAdapter(null); + spin_course.setAdapter(null); + spin_semester.setAdapter(null); + + // str_Cityids="x"; + if(!(str_Dids.equals("x"))) + { districterror_tv.setVisibility(View.GONE); + getTaluklist_AsynTask(); + } + } + + @Override + public void onNothingSelected (AdapterView < ? > parent){ + // TODO Auto-generated method stub + + } + }); + + + + + + spin_city.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected (AdapterView < ? > parent, View view, + int position, long id){ + // TODO Auto-generated method stub + obj_Class_Taluk = (Class_Taluk) spin_city.getSelectedItem(); + str_Cityids = obj_Class_Taluk.gettaluk_id().toString(); + // Toast.makeText(getApplicationContext(),"City ID"+str_Cityids+"City:"+spin_city.getSelectedItem().toString(),Toast.LENGTH_LONG).show(); + + if(!(str_Cityids.equals("x"))|| !(spin_district.getSelectedItem().toString().equals("Select City"))) + { cityerror_tv.setVisibility(View.GONE); } + getProgramlist_AsynTask(); + } + + @Override + public void onNothingSelected (AdapterView < ? > parent){ + // TODO Auto-generated method stub + + } + }); + + + //Course + spin_program.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected (AdapterView < ? > parent, View view, + int position, long id){ + // TODO Auto-generated method stub + obj_Class_Program = (Class_Program) spin_program.getSelectedItem(); + + str_programid = obj_Class_Program.getprogram_id().toString(); + str_programname = obj_Class_Program.getprog_name().toString(); + + if(!(str_programname.equals("x"))|| !(spin_program.getSelectedItem().toString().equals("Select Course"))) + { getCollegelist_AsynTask(); + } + // Toast.makeText(getApplicationContext(),"str_Programsid: "+str_programid,Toast.LENGTH_SHORT).show(); + } + + @Override + public void onNothingSelected (AdapterView < ? > parent){ + // TODO Auto-generated method stub + } + }); + + spin_institution.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected (AdapterView < ? > parent, View view, + int position, long id){ + // TODO Auto-generated method stub + + if(str_CollegesStatus.equals("Fail")||str_CollegesStatus.equals("There are no colleges")||str_ColID.equals("x")) + { + Log.e("In strCollegesStatus","In str_CollegesStatus"); + } + else { + obj_Class_Colleges = (Class_Colleges) spin_institution.getSelectedItem(); + str_ColID = obj_Class_Colleges.getcollege_id().toString(); + } + + + if(!(str_ColID.equals("x")) || !(spin_institution.getSelectedItem().toString().equals("Select Institution"))||!(spin_institution.getSelectedItem().toString().equals("There are no colleges"))) + { + Log.e("str_ColID",str_ColID.toString()); + Log.e("Institution",spin_institution.getSelectedItem().toString()); + collegeerror_tv.setVisibility(View.GONE); + getCourselist_AsynTask(); + } + } + + @Override + public void onNothingSelected (AdapterView < ? > parent){ + // TODO Auto-generated method stub + + } + }); + + + + + + + spin_course.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected (AdapterView < ? > parent, View view, + int position, long id){ + // TODO Auto-generated method stub + obj_Class_Course = (Class_Course) spin_course.getSelectedItem(); + + str_courseid = obj_Class_Course.getcourse_id().toString(); + str_coursename = obj_Class_Course.getcourse_name().toString(); + + + if( !(str_courseid.equals("x"))|| !(spin_course.getSelectedItem().toString().equals("Select Stream")) ) + { courseerror_tv.setVisibility(View.GONE); + getSemlist_AsynTask(); } + // Toast.makeText(getApplicationContext(),"str_courseid: "+str_courseid+ " " +"str_coursename: "+str_coursename,Toast.LENGTH_SHORT).show(); + } + @Override + public void onNothingSelected (AdapterView < ? > parent){ + // TODO Auto-generated method stub + } + }); + + spin_semester.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected (AdapterView < ? > parent, View view, + int position, long id){ + // TODO Auto-generated method stub + obj_Class_Sem = (Class_Sem) spin_semester.getSelectedItem(); + + str_semid = obj_Class_Sem.getsem_id().toString(); //semID + str_semname = obj_Class_Sem.getsem_name().toString(); //1 + + if( !(str_Sids.equals("x"))|| !(spin_course.getSelectedItem().toString().equals("Select Semester")) ) + { + semerror_tv.setVisibility(View.GONE); + } + + // Toast.makeText(getApplicationContext(),"str_semid: "+str_semid+"str_semname: "+str_semname,Toast.LENGTH_SHORT).show(); + + } + @Override + public void onNothingSelected (AdapterView < ? > parent){ + // TODO Auto-generated method stub + } + }); + + + spin_bg.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected (AdapterView < ? > parent, View view, + int position, long id){ + // TODO Auto-generated method stub + str_bloodgroup = spin_bg.getSelectedItem().toString(); + // Toast.makeText(getApplicationContext(),"Blood:"+str_bloodgroup,Toast.LENGTH_SHORT).show(); + } + @Override + public void onNothingSelected (AdapterView < ? > parent){ + // TODO Auto-generated method stub + + } + }); + + + + + + + //if (str_isProfileEdited.equals("0")) + if(2>1) + { + + btn_submitQuery = (Button) findViewById(R.id.btn_submitQuery); + //btn_submitQuery.setSelected(true); + + + + btn_submitQuery.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + /* if(checkMandatoryNew()){ + + }*/ + + LayoutInflater inflater = getLayoutInflater(); + View alertLayout = inflater.inflate(R.layout.custom_student_query, null); + + + + + Button btn_sendRequest = (Button) alertLayout.findViewById(R.id.btn_sendRequest); + + request_statename_et = (EditText) alertLayout.findViewById(R.id.request_statename_et); + request_districtname_et = (EditText) alertLayout.findViewById(R.id.request_districtname_et); + request_talukaname_et=(EditText) alertLayout.findViewById(R.id.request_talukaname_et); + request_Collegename_et=(EditText) alertLayout.findViewById(R.id.request_Collegename_et); + request_studentname_et=(EditText) alertLayout.findViewById(R.id.request_studentname_et); + + + edt_mailId_Query = (EditText) alertLayout.findViewById(R.id.edt_mailId); + edt_description_Query = (EditText) alertLayout.findViewById(R.id.edt_description); + + + + + AlertDialog.Builder alert = new AlertDialog.Builder(EditProfileActivity.this); + // this is set the view from XML inside AlertDialog + alert.setView(alertLayout); + // disallow cancel of AlertDialog on click of back button and outside touch + alert.setCancelable(true); + + /* alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + + @Override + public void onClick(DialogInterface dialog, int which) { + Toast.makeText(getBaseContext(), "Cancel clicked", Toast.LENGTH_SHORT).show(); + } + }); + + alert.setPositiveButton("Done", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + *//* String user = etUsername.getText().toString(); + String pass = etEmail.getText().toString();*//* + //Toast.makeText(getBaseContext(), "Username: " + user + " Email: " + pass, Toast.LENGTH_SHORT).show(); + } + });*/ + + dialog = alert.create(); + + btn_sendRequest.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + // Toast.makeText(context, "Request Has Been Sent", Toast.LENGTH_LONG).show(); + if(checkMandatoryQuery()){ + SubmitQuery submitQuery = new SubmitQuery(context); + submitQuery.execute(); + } + + + } + }); + + + dialog.show(); + + } + }); + } + + + + } //end of oncreate() + + private boolean checkMandatoryQuery() + { + + + boolean b_edtmailquery,b_vaildemail,b_description,b_request_statename,b_request_districtname; + boolean b_request_talukaname,b_request_Collegename,b_request_studentname; + + b_edtmailquery=b_vaildemail=b_description=b_request_statename=b_request_districtname=true; + b_request_talukaname=b_request_Collegename=b_request_studentname=true; + + + + + if(edt_mailId_Query.getText().toString().isEmpty() || edt_mailId_Query.getText().equals(null)) { + edt_mailId_Query.setError("Enter Email ID"); + b_edtmailquery=false; + //return false; + } + + + if(!isValidEmail(edt_mailId_Query.getText().toString().trim())) { + edt_mailId_Query.setError("Invalid Email ID"); + b_vaildemail=false; + //return false; + } + + + + if(edt_description_Query.getText().toString().isEmpty() || edt_description_Query.getText().equals(null)){ + edt_description_Query.setError("Enter Query Description"); + b_description=false; + } + + //request_statename_et,request_districtname_et,request_talukaname_et,request_Collegename_et,request_studentname_et; + if(request_statename_et.getText().toString().length()<3) + { + request_statename_et.setError("Minimum 3 character"); + b_request_statename=false; + } + + if(request_districtname_et.getText().toString().length()<3) + { + request_districtname_et.setError("Minimum 3 character"); + b_request_districtname=false; + } + + if(request_talukaname_et.getText().toString().length()<3) + { + request_talukaname_et.setError("Minimum 3 character"); + b_request_talukaname=false; + } + + if(request_Collegename_et.getText().toString().length()<5) + { + request_Collegename_et.setError("Minimum 5 character"); + b_request_Collegename=false; + } + + if(request_studentname_et.getText().toString().length()<4) + { + request_studentname_et.setError("Minimum 4 character"); + b_request_studentname=false; + } + + + return (b_edtmailquery&&b_vaildemail&&b_description&&b_request_statename&&b_request_districtname&& + b_request_talukaname&&b_request_Collegename&&b_request_studentname); + + } + + + + + + + private boolean isValidEmail(String email) { + String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{3,})$"; + + Pattern pattern = Pattern.compile(EMAIL_PATTERN); + Matcher matcher = pattern.matcher(email); + return matcher.matches(); + } + + + + + + /* private boolean checkMandatoryNew() { + + } +*/ + + public class SubmitQuery extends AsyncTask { + + Context context; + //AlertDialog alertDialog; + + //private ProgressBar progressBar; + + private ProgressDialog progressDialog; + + SubmitQuery(Context ctx) { + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapPrimitive doInBackground(String... params) { + + SoapPrimitive response = submitQuery(); + + //Log.d("ResponseCommitsss", response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressDialog.setMessage("Loading"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + + + + if(result.toString().equals("success")){ + dialog.dismiss(); + Toast.makeText(context,"Your Request sent to the manager",Toast.LENGTH_LONG).show(); + } + + progressDialog.dismiss(); + } + + } + + + private SoapPrimitive submitQuery() + { + + String METHOD_NAME = "SendStudentRequestforManager"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/SendStudentRequestforManager"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + + + /* + + + + + + + + */ + + request.addProperty("Lead_Id", str_LeadID);//string + //request.addProperty("StudentName",edt_studName.getText().toString()); + request.addProperty("Email_id",edt_mailId_Query.getText().toString());//string + request.addProperty("Student_MobileNo",mobileno_tv.getText().toString());//string + request.addProperty("Message",edt_description_Query.getText().toString());// string + + request.addProperty("StudentName",request_studentname_et.getText().toString());//string + request.addProperty("StateName",request_statename_et.getText().toString());//string + request.addProperty("DistrictName",request_districtname_et.getText().toString());//string + request.addProperty("TalukaName",request_talukaname_et.getText().toString());//string + request.addProperty("CollegeName",request_Collegename_et.getText().toString());//string + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Projects.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + // SendStudentRequestforManager{Lead_Id=MF00993; Email_id=testing; Student_MobileNo=9689240475; Message=testing; } + + Log.d("Requestisssss",request.toString()); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + // Log.d("soapResponseyyyyyyy",envelope.getResponse().toString()); + + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + Log.d("soapResponseyyyyyyy",response.toString()); + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.d("exception outside",t.getMessage().toString()); + } + return null; + + + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + private void selectAllMasterData() { + //getStateDetails(); + //setStateSpinner(); + //getDistrictDetails(); + // setDistrictSpinner(); + //setStateSpinner(); + } + + + + + + + + public void onRadioButtonGenderClicked(View view) { + boolean checked = ((RadioButton) view).isChecked(); + + switch (view.getId()) { + case R.id.rdb_male: + if (checked) { + str_gender="M"; + } + break; + case R.id.rdb_female: + if (checked) { + str_gender="F"; + } + break; + } + } + + public void onRadioButtonBankClicked(View view) { + boolean checked = ((RadioButton) view).isChecked(); + + switch (view.getId()) { + case R.id.rdb_passbook: + if (checked) { + str_bankDoc="1"; + } + break; + case R.id.rdb_check: + if (checked) { + str_bankDoc="2"; + } + break; + } + } + + + + @Override + public void onActivityResult(int requestCode, int resultCode, Intent data) + { + super.onActivityResult(requestCode, resultCode, data); + + if (resultCode == Activity.RESULT_OK) { + if (requestCode == SELECT_FILE) { + //onSelectFromGalleryResult(data); + + /*if (android.os.Build.VERSION.SDK_INT > Build.VERSION_CODES.M) + {*/ + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) + { + + Log.d("Insidexxxxxx","greater than M"); + + //if (android.os.Build.VERSION.SDK_INT > 24) { + + /*if(1>2) + {*/ + Uri selectedImage = data.getData(); + Log.e("uri", selectedImage.toString()); + + String[] filePathColumn = {MediaStore.Images.Media.DATA}; + + Cursor cursor = getContentResolver().query(selectedImage, + filePathColumn, null, null, null); + cursor.moveToFirst(); + + int columnIndex = cursor.getColumnIndex(filePathColumn[0]); + String picturePath = cursor.getString(columnIndex); + cursor.close(); + + + Bitmap bitmap = BitmapFactory.decodeFile(picturePath); + + + //studPickBase64 = Base64.encodeToString(imageinbytesArray, Base64.DEFAULT); + + /* ImageView imgProj = (ImageView) view2.findViewById(projImageId); + imgProj.setImageBitmap(bitmap);*/ + +//In marshmallow version camara image rotation code + + ExifInterface exif= null; + try { + exif = new ExifInterface(picturePath.toString()); + } catch (IOException e) { + e.printStackTrace(); + } + + Log.d("EXIF value1", exif.getAttribute(ExifInterface.TAG_ORIENTATION)); + if(exif.getAttribute(ExifInterface.TAG_ORIENTATION).equalsIgnoreCase("6")){ + bitmap= rotate(bitmap, 90); + } else if(exif.getAttribute(ExifInterface.TAG_ORIENTATION).equalsIgnoreCase("8")){ + bitmap= rotate(bitmap, 270); + } else if(exif.getAttribute(ExifInterface.TAG_ORIENTATION).equalsIgnoreCase("3")){ + bitmap= rotate(bitmap, 180); + }/* else if(exif.getAttribute(ExifInterface.TAG_ORIENTATION).equalsIgnoreCase("0")){ + bitmap= rotate(bitmap, 0); + }*/ +//----------------------------------- + img_profilePick.setImageBitmap(bitmap); + + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + bitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream); + byte[] byteArray = byteArrayOutputStream .toByteArray(); + studPickBase64 = Base64.encodeToString(byteArray, Base64.DEFAULT); + + Log.d("studPickBase64sssssss:",studPickBase64); + + + } else { + Log.d("Insidexxxxxx","elsexxxx"); + Bundle extras2 = data.getExtras(); + if (extras2 != null) + { + Log.d("Insidexxxxxx","extras2 not null"); + //vijay camera + + /* + Bitmap yourImage = extras2.getParcelable("data"); + // convert bitmap to byte + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + yourImage.compress(Bitmap.CompressFormat.PNG, 100, stream); + //imageInByte; + imageinbytesArray = stream.toByteArray(); + // Log.e("output before conversion", imageInByte.toString()); + // Log.d("Insert: ", "Inserting ..image"); + Bitmap bm = BitmapFactory.decodeByteArray(imageinbytesArray, 0, imageinbytesArray.length); + // Log.d("Insert image report: ",bm.toString() ); + studPickBase64 = Base64.encodeToString(imageinbytesArray, Base64.DEFAULT); + img_profilePick.setImageBitmap(bm); + */ + if (data == null) + { + Toast.makeText(getApplicationContext(),"Failed to read picture data!",Toast.LENGTH_SHORT).show(); + return; + } + + + try { + actualImage = Class_FileUtil_forImage.from(this, data.getData()); + img_profilePick.setImageBitmap(BitmapFactory.decodeFile(actualImage.getAbsolutePath())); + + } catch (IOException e) { + Toast.makeText(getApplicationContext(),"Failed to read picture data!",Toast.LENGTH_SHORT).show(); + e.printStackTrace(); + } + + + + } + } + + + } else if (requestCode == REQUEST_CAMERA) { + //onCaptureImageResult(data); + Bundle extras = data.getExtras(); + + if (extras != null) { + Bitmap yourImage = extras.getParcelable("data"); + // convert bitmap to byte + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + yourImage.compress(Bitmap.CompressFormat.JPEG, 100, stream); + // byte[] imageInByte; + imageinbytesArray = stream.toByteArray(); + + studPickBase64 = Base64.encodeToString(imageinbytesArray, Base64.DEFAULT); + // Log.e("output before conversion", imageInByte.toString()); + // Inserting Contacts + bmp_fromCamera = BitmapFactory.decodeByteArray(imageinbytesArray, 0, imageinbytesArray.length); + //report_photo.setImageBitmap(bm); + + /*Log.d("projectImageidxxxx",String.valueOf(projImageId)); + + ImageView imgProj = (ImageView) view2.findViewById(projImageId); + imgProj.setImageBitmap(bm);*/ + + + /* Bitmap circleBitmap = Bitmap.createBitmap(yourImage.getWidth(), yourImage.getHeight(), Bitmap.Config.ARGB_8888); + + BitmapShader shader = new BitmapShader (yourImage, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); + Paint paint = new Paint(); + paint.setShader(shader); + + Canvas c = new Canvas(circleBitmap); + c.drawCircle(yourImage.getWidth()/2, yourImage.getHeight()/2, yourImage.getWidth()/2, paint); + + img_profilePick.setImageBitmap(circleBitmap);*/ + + + img_profilePick.setImageBitmap(bmp_fromCamera); + + + } + } + else if (requestCode == SELECT_FILE_BANK) { + //onSelectFromGalleryResult(data); + + /*if (android.os.Build.VERSION.SDK_INT > Build.VERSION_CODES.M) + {*/ + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) + { + + Log.d("Insidexxxxxx","greater than M"); + + //if (android.os.Build.VERSION.SDK_INT > 24) { + + /*if(1>2) + {*/ + Uri selectedImage = data.getData(); + Log.e("uri", selectedImage.toString()); + + String[] filePathColumn = {MediaStore.Images.Media.DATA}; + + Cursor cursor = getContentResolver().query(selectedImage, + filePathColumn, null, null, null); + cursor.moveToFirst(); + + int columnIndex = cursor.getColumnIndex(filePathColumn[0]); + String picturePath = cursor.getString(columnIndex); + cursor.close(); + + + Bitmap bitmap = BitmapFactory.decodeFile(picturePath); + + + //studPickBase64 = Base64.encodeToString(imageinbytesArray, Base64.DEFAULT); + + /* ImageView imgProj = (ImageView) view2.findViewById(projImageId); + imgProj.setImageBitmap(bitmap);*/ + +//In marshmallow version camara image rotation code + + ExifInterface exif= null; + try { + exif = new ExifInterface(picturePath.toString()); + } catch (IOException e) { + e.printStackTrace(); + } + + Log.d("EXIF value1", exif.getAttribute(ExifInterface.TAG_ORIENTATION)); + if(exif.getAttribute(ExifInterface.TAG_ORIENTATION).equalsIgnoreCase("6")){ + bitmap= rotate(bitmap, 90); + } else if(exif.getAttribute(ExifInterface.TAG_ORIENTATION).equalsIgnoreCase("8")){ + bitmap= rotate(bitmap, 270); + } else if(exif.getAttribute(ExifInterface.TAG_ORIENTATION).equalsIgnoreCase("3")){ + bitmap= rotate(bitmap, 180); + }/* else if(exif.getAttribute(ExifInterface.TAG_ORIENTATION).equalsIgnoreCase("0")){ + bitmap= rotate(bitmap, 0); + }*/ +//----------------------------------- + img_bankPick.setImageBitmap(bitmap); + + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + bitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream); + byte[] byteArray = byteArrayOutputStream .toByteArray(); + bankPicBase64 = Base64.encodeToString(byteArray, Base64.DEFAULT); + + Log.d("bank pic:",bankPicBase64); + + + } else { + Log.d("Insidexxxxxx","elsexxxx"); + Bundle extras2 = data.getExtras(); + if (extras2 != null) + { + Log.d("Insidexxxxxx","extras2 not null"); + //vijay camera + + /* + Bitmap yourImage = extras2.getParcelable("data"); + // convert bitmap to byte + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + yourImage.compress(Bitmap.CompressFormat.PNG, 100, stream); + //imageInByte; + imageinbytesArray = stream.toByteArray(); + // Log.e("output before conversion", imageInByte.toString()); + // Log.d("Insert: ", "Inserting ..image"); + Bitmap bm = BitmapFactory.decodeByteArray(imageinbytesArray, 0, imageinbytesArray.length); + // Log.d("Insert image report: ",bm.toString() ); + studPickBase64 = Base64.encodeToString(imageinbytesArray, Base64.DEFAULT); + img_profilePick.setImageBitmap(bm); + */ + if (data == null) + { + Toast.makeText(getApplicationContext(),"Failed to read picture data!",Toast.LENGTH_SHORT).show(); + return; + } + + + try { + actualImage = Class_FileUtil_forImage.from(this, data.getData()); + img_bankPick.setImageBitmap(BitmapFactory.decodeFile(actualImage.getAbsolutePath())); + + } catch (IOException e) { + Toast.makeText(getApplicationContext(),"Failed to read picture data!",Toast.LENGTH_SHORT).show(); + e.printStackTrace(); + } + + + + } + } + + + } else if (requestCode == REQUEST_CAMERA_BANK) { + //onCaptureImageResult(data); + Bundle extras = data.getExtras(); + + if (extras != null) { + Bitmap yourImage = extras.getParcelable("data"); + // convert bitmap to byte + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + yourImage.compress(Bitmap.CompressFormat.JPEG, 100, stream); + // byte[] imageInByte; + imageinbytesArray = stream.toByteArray(); + + bankPicBase64 = Base64.encodeToString(imageinbytesArray, Base64.DEFAULT); + // Log.e("output before conversion", imageInByte.toString()); + // Inserting Contacts + bmp_fromCamera = BitmapFactory.decodeByteArray(imageinbytesArray, 0, imageinbytesArray.length); + + img_bankPick.setImageBitmap(bmp_fromCamera); + + + } + } + } + } + + public static Bitmap rotate(Bitmap bitmap, int degree) { + int w = bitmap.getWidth(); + int h = bitmap.getHeight(); + + Matrix mtx = new Matrix(); + // mtx.postRotate(degree); + mtx.setRotate(degree); + + return Bitmap.createBitmap(bitmap, 0, 0, w, h, mtx, true); + } + + private void selectImage() { + final CharSequence[] items = {"Take Photo", "Choose from Library", + "Cancel"}; + + AlertDialog.Builder builder = new AlertDialog.Builder(context); + builder.setTitle("Add Photo!"); + builder.setItems(items, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int item) { + if (items[item].equals("Take Photo")) { + //userChoosenTask ="Take Photo"; + cameraIntent(); + + } else if (items[item].equals("Choose from Library")) { + //userChoosenTask ="Choose from Library"; + galleryIntent(); + + } else if (items[item].equals("Cancel")) { + dialog.dismiss(); + } + } + }); + builder.show(); + } + private void selectImageBank() { + final CharSequence[] items = {"Take Photo", "Choose from Library", + "Cancel"}; + + AlertDialog.Builder builder = new AlertDialog.Builder(context); + builder.setTitle("Add Photo!"); + builder.setItems(items, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int item) { + if (items[item].equals("Take Photo")) { + //userChoosenTask ="Take Photo"; + cameraIntentBank(); + + } else if (items[item].equals("Choose from Library")) { + //userChoosenTask ="Choose from Library"; + galleryIntentBank(); + + } else if (items[item].equals("Cancel")) { + dialog.dismiss(); + } + } + }); + builder.show(); + } + + private void cameraIntent() { + Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); + startActivityForResult(intent, REQUEST_CAMERA); + } + + private void galleryIntent() { + Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI); + intent.setType("image/*"); + //intent.setAction(Intent.ACTION_GET_CONTENT); + startActivityForResult(Intent.createChooser(intent, "Select File"), SELECT_FILE); + } + private void cameraIntentBank() { + Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); + startActivityForResult(intent, REQUEST_CAMERA_BANK); + } + + private void galleryIntentBank() { + Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI); + intent.setType("image/*"); + //intent.setAction(Intent.ACTION_GET_CONTENT); + startActivityForResult(Intent.createChooser(intent, "Select File"), SELECT_FILE_BANK); + } + + + + + + + private void setDateOfBirth() { + + final Calendar c = Calendar.getInstance(); + + edt_dob.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + mYear = c.get(Calendar.YEAR)-15; + mMonth = c.get(Calendar.MONTH); + mDay = c.get(Calendar.DAY_OF_MONTH); + + DatePickerDialog datePickerDialog = new DatePickerDialog(context, R.style.DatePickerTheme, + new DatePickerDialog.OnDateSetListener() { + + @Override + public void onDateSet(DatePicker view, int year, + int monthOfYear, int dayOfMonth) { + + cDay = dayOfMonth; + cMonth = monthOfYear; + cYear = year; + + // String date =dayOfMonth + "/" + (monthOfYear + 1) + "/" + year; + String date =year + "-" + (monthOfYear + 1) + "-" + dayOfMonth; + + + // SimpleDateFormat dateFormat= new SimpleDateFormat("dd/MM/yyyy"); + SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd"); + + try { + Date d=dateFormat.parse(date); + System.out.println("Formated"+dateFormat.format(d)); + dobseterror_tv.setVisibility(View.GONE); + edt_dob.setText(dateFormat.format(d).toString()); + + } + catch(Exception e) { + //java.text.ParseException: Unparseable date: Geting error + System.out.println("Excep"+e); + } + //TextView txtExactDate = (TextView) findViewById(R.id.txt_exactDate); + + + //txtDate.edita + } + }, mYear, mMonth, mDay); + + datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()); + //datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()-(1000 * 60 * 60 * 24 * 365 * 14)); + // - (1000 * 60 * 60 * 24 * 365.25 * 14) +//------ + + datePickerDialog.show(); + } + }); + + + } + + @SuppressLint("RestrictedApi") + private void setGenderSpinner() { + final ArrayList listgender = new ArrayList(); + listgender.add("Male"); + listgender.add("Female"); + + //ArrayAdapter dataAdapterSem = new ArrayAdapter(context, R.layout.simple_spinner_semester, listsemester); + ArrayAdapter dataAdapterGender = new ArrayAdapter(context, R.layout.simple_spinner_items, listgender); + + // Drop down layout style - list view with radio button + dataAdapterGender.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + + // attaching data adapter to spinner + spin_gender.setAdapter(dataAdapterGender); + spin_gender.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + } + + @SuppressLint("RestrictedApi") + private void setBloodGroupSpinner() { + final ArrayList listBg = new ArrayList(); + listBg.add("A+"); + listBg.add("B+"); + listBg.add("A-"); + listBg.add("B-"); + listBg.add("AB+"); + listBg.add("AB-"); + listBg.add("O+"); + listBg.add("O-"); + listBg.add("Bombay"); + + //ArrayAdapter dataAdapterSem = new ArrayAdapter(context, R.layout.simple_spinner_semester, listsemester); + dataAdapter_bloodgroup = new ArrayAdapter(context, R.layout.simple_spinner_items, listBg); + + // Drop down layout style - list view with radio button + dataAdapter_bloodgroup.setDropDownViewResource(R.layout.spinnercustomstyle); + + // attaching data adapter to spinner + spin_bg.setAdapter(dataAdapter_bloodgroup); + spin_bg.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + + } + + @Override + public void onBackPressed() + { + if((str_isProfileEdited.equals("1"))) + { + AlertDialog.Builder dialog = new AlertDialog.Builder(EditProfileActivity.this); + dialog.setCancelable(false); + dialog.setTitle("LEADCampus"); + dialog.setMessage("Are you sure want to Exit from Edit Profile" ); + + dialog.setPositiveButton("Yes", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) + { + Intent i = new Intent(EditProfileActivity.this,HomeActivity.class); + startActivity(i); + finish(); + } + }) + .setNegativeButton("No", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + //Action for "Cancel". + dialog.dismiss(); + } + }); + + final AlertDialog alert = dialog.create(); + alert.setOnShowListener( new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface arg0) { + alert.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(Color.RED); + alert.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#004D40")); + } + }); + alert.show(); + + //alert.getWindow().setBackgroundDrawableResource(android.R.color.background_dark); + } + + if((str_isProfileEdited.equals("0"))||(str_isProfileEdited.equals("2"))) + { + AlertDialog.Builder dialog = new AlertDialog.Builder(EditProfileActivity.this); + dialog.setCancelable(false); + dialog.setTitle("LEADCampus"); + dialog.setMessage("Are you sure want to Exit from Edit Profile" ); + + dialog.setPositiveButton("Yes", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) + { + Intent i = new Intent(EditProfileActivity.this,LoginActivity.class); + startActivity(i); + finish(); + } + }) + .setNegativeButton("No", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + //Action for "Cancel". + dialog.dismiss(); + } + }); + + final AlertDialog alert = dialog.create(); + alert.setOnShowListener( new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface arg0) { + alert.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(Color.RED); + alert.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#004D40")); + } + }); + alert.show(); + } + + + + }// On back Press + + + + + + + +// set spinner + + + public void setSpinner() + { + spin_semester.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected (AdapterView < ? > parent, View view, + int position, long id){ + // TODO Auto-generated method stub + obj_Class_Sem = (Class_Sem) spin_semester.getSelectedItem(); + + /* String x=obj_Class_Centers.getcenter_name().toString(); + String y=obj_Class_Centers.getCenterCode().toString(); + Toast.makeText(getApplicationContext(),"name: "+x+"ID: "+y,Toast.LENGTH_SHORT).show(); +*/ + str_semid = obj_Class_Sem.getsem_id().toString(); //semID + str_semname = obj_Class_Sem.getsem_name().toString(); //1 + + // Toast.makeText(getApplicationContext(),"str_semid: "+str_semid+"str_semname: "+str_semname,Toast.LENGTH_SHORT).show(); + + //MentorID= obj_Class_Centers.getMem_id().toString(); + } + + @Override + public void onNothingSelected (AdapterView < ? > parent){ + // TODO Auto-generated method stub + + } + }); + + + + + + + + spin_course.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected (AdapterView < ? > parent, View view, + int position, long id){ + // TODO Auto-generated method stub + obj_Class_Course = (Class_Course) spin_course.getSelectedItem(); + + str_courseid = obj_Class_Course.getcourse_id().toString(); + str_coursename = obj_Class_Course.getcourse_name().toString(); + + + // Toast.makeText(getApplicationContext(),"str_courseid: "+str_courseid+ " " +"str_coursename: "+str_coursename,Toast.LENGTH_SHORT).show(); + + } + + @Override + public void onNothingSelected (AdapterView < ? > parent){ + // TODO Auto-generated method stub + + } + }); + + + spin_program.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected (AdapterView < ? > parent, View view, + int position, long id){ + // TODO Auto-generated method stub + obj_Class_Program = (Class_Program) spin_program.getSelectedItem(); + + str_programid = obj_Class_Program.getprogram_id().toString(); + str_programname = obj_Class_Program.getprog_name().toString(); + + + // Toast.makeText(getApplicationContext(),"str_programid: "+str_programid,Toast.LENGTH_SHORT).show(); + + } + + @Override + public void onNothingSelected (AdapterView < ? > parent){ + // TODO Auto-generated method stub + + } + }); + + + + + + + spin_bg.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected (AdapterView < ? > parent, View view, + int position, long id){ + // TODO Auto-generated method stub + str_bloodgroup = spin_bg.getSelectedItem().toString(); + + + + // Toast.makeText(getApplicationContext(),"Blood:"+str_bloodgroup,Toast.LENGTH_SHORT).show(); + + } + + @Override + public void onNothingSelected (AdapterView < ? > parent){ + // TODO Auto-generated method stub + + } + }); + + + } + +//set spinner + + + +// ============================All AsynTask Call + + public void getstatelist_AsynTask() + { + StatelistAsyncCallWS task = new StatelistAsyncCallWS(EditProfileActivity.this); + task.execute(); + } + + private class StatelistAsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + /*dialog.setMessage("Please wait,State Loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); +*/ + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetStatelist(); // get the state list + return null; + } + + public StatelistAsyncCallWS(EditProfileActivity activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + //dialog.dismiss(); + + //uploadfromDB_Statelist(); + + + if(str_StateStatus.equals("Success")) + { + + if(str_isProfileEdited.equals("1")||str_isProfileEdited.equals("2")) + { + dataAdapter = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_States); + dataAdapter.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_state.setAdapter(dataAdapter); + spin_state.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + int spinnerposition =1; + //spinnerposition = dataAdapter.getPosition(O_statecode); + spinnerposition= Integer.parseInt(O_statecode); + spin_state.setSelection(spinnerposition); + // spin_state.setSelection(spinnerposition-1); + } + else + { + dataAdapter = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_States); + dataAdapter.setDropDownViewResource(R.layout.spinnercustomstyle); + /*class_hintspinneradapter_obj = new Class_HintSpinnerAdapter(getApplicationContext(), R.layout.spinnercustomstyle); + class_hintspinneradapter_obj.addAll(state_stringArray); + */ + //class_hintspinneradapter_obj + //dataAdapter.add("Select State"); + //spin_state.setPrompt("Select State"); + + spin_state.setAdapter(dataAdapter); //working + + /*class_hintspinneradapter_obj.add("Select State"); + spin_state.setAdapter(class_hintspinneradapter_obj); + spin_state.setSelection(class_hintspinneradapter_obj.getCount());*/ + + spin_state.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + } + + } + + }//end of onPostExecute + }// end Async task + + + public void GetStatelist() + { + String URL =Class_URL.URL_Login.toString().trim(); + String METHOD_NAME = "GetstateList"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/GetstateList"; + + try { + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + request.addProperty("stateid", "0");//long + request.addProperty("Manager_Id", 0);//long + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + // Log.i(TAG, "GetAllLoginDetails is running"); + // result1 = (Vector) envelope.getResponse(); + + // response = (SoapPrimitive) envelope.getResponse(); + + // SoapPrimitive res =(SoapPrimitive)envelope.getResponse(); + + SoapObject response = (SoapObject ) envelope.getResponse(); + SoapObject o_stateresponse =(SoapObject)response.getProperty(0); + str_StateStatus = o_stateresponse.getProperty("Status").toString(); + + Log.e("response state list",response.toString()); + statelistcount = response.getPropertyCount(); + + Log.d("statecount", String.valueOf(response.getPropertyCount())); + + + /*1 + Andaman and Nicobar Islands + Success + + */ + if(str_StateStatus.equals("Success")) { + if (statelistcount > 0) { + // arrayObj_Class_States = new Class_States[statelistcount]; + + + arrayObj_Class_States = new Class_States[statelistcount]; + state_stringArray = new String[statelistcount]; + + /*Class_States innerObj_Class_states1 = new Class_States(); + innerObj_Class_states1.setstate_id("0"); //long + innerObj_Class_states1.setstate_name("Select State Name"); //Andaman and Nicobar Islands + innerObj_Class_states1.setstate_status("Success Status");// Success + arrayObj_Class_States[0]=innerObj_Class_states1;*/ + + for (int i = 0; i < statelistcount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + + Class_States innerObj_Class_states = new Class_States(); + innerObj_Class_states.setstate_id(response_soapobj.getProperty("code").toString()); //long + innerObj_Class_states.setstate_name(response_soapobj.getProperty("StateName").toString()); //Andaman and Nicobar Islands + innerObj_Class_states.setstate_status(response_soapobj.getProperty("Status").toString());// Success + + arrayObj_Class_States[i] = innerObj_Class_states; + + + String str_stateID = response_soapobj.getProperty("code").toString(); + String str_statename = response_soapobj.getProperty("StateName").toString(); + //String str_Status=response_soapobj.getProperty("Status").toString(); + + // DBCreate_Statedetails_insert_2SQLiteDB(str_stateID,str_statename); + + state_stringArray[i]=response_soapobj.getProperty("StateName").toString(); + + }//end for loop + + }//end of if + } + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + }//End of uploaddetails + + + + + public void getdistrictlist_AsynTask() + { + DistrictlistAsyncCallWS task = new DistrictlistAsyncCallWS(EditProfileActivity.this); + task.execute(); + } + + private class DistrictlistAsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + /* dialog.setMessage("Please wait,District Loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show();*/ + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetDistrictlist(); // get the District list + return null; + } + + public DistrictlistAsyncCallWS(EditProfileActivity activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + + //dialog.dismiss(); + + /*uploadfromDB_Statelist(); + uploadfromDB_Districtlist(); + setSpinner();*/ + // uploadfromDB_Districtlist(); + + + if(str_DistrictStatus.equals("Success")) + { + + if(str_isProfileEdited.equals("1")||str_isProfileEdited.equals("2")) + { + dataAdapter_district = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_District); + dataAdapter_district.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_district.setAdapter(dataAdapter_district); + spin_district.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + + if(O_districtname!="" || O_districtname!=null) { + for (int i = 0; i < spin_district.getCount(); i++) { + Log.e("spin District",spin_district.getItemAtPosition(i).toString()); + if (spin_district.getItemAtPosition(i).toString().equals(O_districtname)) + { + spin_district.setSelection(i); + break; + } + } + } + + + } + else + { + dataAdapter_district = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_District); + //dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_district.setDropDownViewResource(R.layout.spinnercustomstyle); + // districtsearch_ATV.setAdapter(dataAdapter_district); + spin_district.setAdapter(dataAdapter_district); + spin_district.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + } + } + + + }//end of onPostExecute + }// end Async task + + public void GetDistrictlist() + { + + + String URL = Class_URL.URL_Login.toString().trim(); + String METHOD_NAME = "GetDistricts"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/GetDistricts"; + + + + //for final + +//https://mis.leadcampus.org:8084/leadws/Login.asmx?op=GetDistricts + try { +//vijay district + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + + // request.addProperty("distid", Long.parseLong(str_Sids));//Long + + // request.addProperty("distid", 17);//Long + + request.addProperty("stateId", Long.parseLong(str_Sids));//Long + request.addProperty("Manager_Id", 0);//int + + //request.addProperty("stateId", 17);//Long + // long + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + // Log.i(TAG, "GetAllLoginDetails is running"); + // result1 = (Vector) envelope.getResponse(); + + // response = (SoapPrimitive) envelope.getResponse(); + + // SoapPrimitive res =(SoapPrimitive)envelope.getResponse(); + + SoapObject response = (SoapObject ) envelope.getResponse(); + Log.e("response districtlist",response.toString()); + districtlistcount = response.getPropertyCount(); + SoapObject districtresponse=(SoapObject)response.getProperty(0); + str_DistrictStatus=districtresponse.getProperty("status").toString(); + Log.d("districtcount", String.valueOf(response.getPropertyCount())); + + + + //anyType{vmdist=anyType{DistrictId=1; DistrictName=Nicobar; Stateid=1; status=Success; + + /* + 1 + Nicobar + Success + 1*/ + if(str_DistrictStatus.equals("Success")) { + if (districtlistcount > 0) { + arrayObj_Class_District = new Class_District[districtlistcount]; + for (int i = 0; i < districtlistcount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + + Class_District innerObj_Class_district = new Class_District(); + innerObj_Class_district.setdistrict_id(response_soapobj.getProperty("DistrictId").toString()); //1 + innerObj_Class_district.setdistrict_name(response_soapobj.getProperty("DistrictName").toString()); //Hubballi + innerObj_Class_district.setdistrict_status(response_soapobj.getProperty("status").toString());// HB + innerObj_Class_district.setdstateid_id(response_soapobj.getProperty("Stateid").toString());// <1 + + str_DistrictStatus = response_soapobj.getProperty("status").toString(); + + arrayObj_Class_District[i] = innerObj_Class_district; + + + String str_districtID = response_soapobj.getProperty("DistrictId").toString(); + String str_districtname = response_soapobj.getProperty("DistrictName").toString(); + String str_districtstateid = response_soapobj.getProperty("Stateid").toString(); + + //DBCreate_Districtdetails_insert_2SQLiteDB(str_districtID,str_districtname,str_districtstateid); + + + }//end for loop + + }//end of if + + } + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + }//End of uploaddetails + + + + public void getTaluklist_AsynTask() + { + TaluklistAsyncCallWS task = new TaluklistAsyncCallWS(EditProfileActivity.this); + task.execute(); + } + + private class TaluklistAsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + /*dialog.setMessage("Please wait,Taluk loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show();*/ + + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetTaluklist(); // get the District list + return null; + } + + public TaluklistAsyncCallWS(EditProfileActivity activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + + // dialog.dismiss(); + + /*uploadfromDB_Statelist(); + uploadfromDB_Districtlist();*/ + + // setSpinner(); + + + // uploadfromDB_Districtlist(); + + + //arrayObj_Class_Taluk + + + if(str_TalukStatus.equals("Success")) //status=Success; + { + if (str_isProfileEdited.equals("1")||str_isProfileEdited.equals("2")) + { + dataAdapter_city = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_Taluk); + dataAdapter_city.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_city.setAdapter(dataAdapter_city); + spin_city.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + + if(O_talukname!="" || O_talukname!=null) { + for (int i = 0; i < spin_city.getCount(); i++) { + if (spin_city.getItemAtPosition(i).toString().equals(O_talukname)) + { + spin_city.setSelection(i); + break; + } + } + } + } + else { + + + dataAdapter_city = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_Taluk); + // dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_city.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_city.setAdapter(dataAdapter_city); + spin_city.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + } + } + + }//end of onPostExecute + }// end Async task + + public void GetTaluklist() + { + + + + String URL = Class_URL.URL_Login.toString().trim(); + String METHOD_NAME = "GetCities"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/GetCities"; + + + + //for final + + + try { + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + //request.addProperty("cityid", "0");//short + + request.addProperty("district", Long.parseLong(str_Dids));//long + request.addProperty("Manager_Id", 0);//int + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + // Log.i(TAG, "GetAllLoginDetails is running"); + // result1 = (Vector) envelope.getResponse(); + + // response = (SoapPrimitive) envelope.getResponse(); + + // SoapPrimitive res =(SoapPrimitive)envelope.getResponse(); + + SoapObject response = (SoapObject ) envelope.getResponse(); + Log.e("response taluklist",response.toString()); + taluklistcount = response.getPropertyCount(); + // str_TalukStatus =(String)response.getProperty(0).toString(); + SoapObject TalukSoapresponse = (SoapObject)response.getProperty(0); + str_TalukStatus=TalukSoapresponse.getProperty("status").toString(); + Log.d("talukcount", String.valueOf(response.getPropertyCount())); + + /* anyType{vmcity=anyType{Id=0; District_Id=0; status=There are no cities; };*/ + /* + 70 + 266 + Hubli + Success + + */ + //status=Success; + if(str_TalukStatus.equals("Success")) { + + if (taluklistcount > 0) { + arrayObj_Class_Taluk = new Class_Taluk[taluklistcount]; + + + for (int i = 0; i < taluklistcount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + + Class_Taluk innerObj_Class_taluk = new Class_Taluk(); + innerObj_Class_taluk.settaluk_id(response_soapobj.getProperty("Id").toString()); //1 + innerObj_Class_taluk.settaluk_did(response_soapobj.getProperty("District_Id").toString()); //266 + innerObj_Class_taluk.settalukname(response_soapobj.getProperty("Taluk_Name").toString());// Hubli + innerObj_Class_taluk.settalukstatus(response_soapobj.getProperty("status").toString());// Success + + str_TalukStatus = response_soapobj.getProperty("status").toString(); + + arrayObj_Class_Taluk[i] = innerObj_Class_taluk; + + + String str_talukID = response_soapobj.getProperty("Id").toString(); + String str_taluk_did = response_soapobj.getProperty("District_Id").toString(); + String str_talukname = response_soapobj.getProperty("Taluk_Name").toString(); + + + // DBCreate_Talukdetails_insert_2SQLiteDB(str_talukID,str_taluk_did,str_talukname); + + + }//end for loop + + }//end of if + + } + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + }//End of uploaddetails + + + + + public void getCollegelist_AsynTask() + { + CollegelistAsyncCallWS task = new CollegelistAsyncCallWS(EditProfileActivity.this); + task.execute(); + } + private class CollegelistAsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + dialog.setMessage("Please wait,College loading..."); + + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetCollegelist(); // get the College list + return null; + } + + public CollegelistAsyncCallWS(EditProfileActivity activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + + dialog.dismiss(); + + + /* uploadfromDB_Statelist(); + uploadfromDB_Districtlist(); +*/ + /*uploadfromDB_Statelist(); + uploadfromDB_Districtlist(); + + uploadfromDB_collegeTypeSpinner();*/ //vijay + + if(str_CollegesStatus.equals("Success")) + { + if (str_isProfileEdited.equals("1")||str_isProfileEdited.equals("2")) + { + dataAdapter_college = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_Colleges); + dataAdapter_college.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_institution.setAdapter(dataAdapter_college); + spin_institution.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + + str_ColID="y"; + if(O_collegename!="" || O_collegename!=null) + { + for (int i = 0; i < spin_institution.getCount(); i++) { + if (spin_institution.getItemAtPosition(i).toString().equals(O_collegename)) + { + spin_institution.setSelection(i); + break; + } + } + } + + } + else { + + str_ColID="y"; + dataAdapter_college = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_Colleges); + // dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_college.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_institution.setAdapter(dataAdapter_college); + spin_institution.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + } + } + else { + //There are no colleges + if (str_CollegesStatus.equals("There are no colleges")) + { + /*List list = new ArrayList(); + list.add("No Colleges");*/ + dataAdapter_college = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_Colleges3); + // dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_college.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_institution.setAdapter(dataAdapter_college); + spin_institution.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + + } + else + { + List list = new ArrayList(); + list.add("WS Exception"); + dataAdapter_college = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, list); + // dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_college.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_institution.setAdapter(dataAdapter_college); + spin_institution.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + + } + + } + + }//end of onPostExecute + }// end Async task + + public void GetCollegelist() + { + + + + String URL = Class_URL.URL_Login.toString().trim(); + String METHOD_NAME = "GetCollegesOnCity"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/GetCollegesOnCity"; + + + + //for final + + + try { + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + // request.addProperty("clgid", 0);//string shubham.dsep@detedu.org str_loginemailid + + /* long + string + + + */ + request.addProperty("city", Long.parseLong(str_Cityids));// long + request.addProperty("type", str_programname);// stringint + request.addProperty("Fees_Category_Id", 0);// int + request.addProperty("User_Type", "student");//string + + + // + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + // Log.i(TAG, "GetAllLoginDetails is running"); + // result1 = (Vector) envelope.getResponse(); + + // response = (SoapPrimitive) envelope.getResponse(); + + // SoapPrimitive res =(SoapPrimitive)envelope.getResponse(); + + SoapObject response = (SoapObject ) envelope.getResponse(); + Log.e("resp collegelist",response.toString()); + collegeslistcount = response.getPropertyCount(); + SoapObject response_soapobj1 = (SoapObject) response.getProperty(0); + str_CollegesStatus=response_soapobj1.getProperty("Status").toString();//Status=There are no colleges; //Status=Success; + Log.d("Ccount", String.valueOf(response.getPropertyCount())); + + + + //anyType{CollegeId=0; TalukId=0; Status=There are no colleges; }; + + + /*SoapObject response_soapobj1 = (SoapObject) response.getProperty(0); + + nocollegestatus=response_soapobj1.getProperty("Status").toString();//Success + + Log.e("nocollege",nocollegestatus); + + + (str_CollegesStatus.equals("Success")) {*/ + if(str_CollegesStatus.equals("Success")) + { + if (collegeslistcount > 0) { + arrayObj_Class_Colleges = new Class_Colleges[collegeslistcount]; + + + for (int i = 0; i < collegeslistcount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + + /*long + long + string + string*/ + + Class_Colleges innerObj_Class_colleges = new Class_Colleges(); + innerObj_Class_colleges.setcollege_id(response_soapobj.getProperty("CollegeId").toString()); //long + innerObj_Class_colleges.setcollege_tid(response_soapobj.getProperty("TalukId").toString()); //long + innerObj_Class_colleges.setcollegename(response_soapobj.getProperty("College_Name").toString());// string + + + innerObj_Class_colleges.setcollegestatus(response_soapobj.getProperty("Status").toString());// Success + + + str_CollegesStatus = response_soapobj.getProperty("Status").toString(); + + arrayObj_Class_Colleges[i] = innerObj_Class_colleges; + + + String str_collegeID = response_soapobj.getProperty("CollegeId").toString(); + String str_college_tid = response_soapobj.getProperty("TalukId").toString(); + String str_collegename = response_soapobj.getProperty("College_Name").toString(); + + + // DBCreate_Collegedetails_insert_2SQLiteDB(str_collegeID,str_college_tid,str_collegename); + + // DBCreate_Collegedetails_insert_2SQLiteDB(str_collegeID, str_college_tid, str_collegename); + + + }//end for loop + + }//end of if + + + }// end of if + else + { + arrayObj_Class_Colleges3 = new Class_Colleges[1]; + Class_Colleges innerObj_Class_colleges = new Class_Colleges(); + innerObj_Class_colleges.setcollege_id("0"); //long + innerObj_Class_colleges.setcollege_tid("0"); //long + innerObj_Class_colleges.setcollegename("There are no colleges");// string + + str_CollegesStatus ="There are no colleges"; + arrayObj_Class_Colleges3[0] = innerObj_Class_colleges; + + } + + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("getCollege fail", "> " + t.getMessage()); + internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + }//End of uploaddetails + + + + + public void getSemlist_AsynTask() + { + getSemlist_AsynTask task = new getSemlist_AsynTask(EditProfileActivity.this); + task.execute(); + } + + private class getSemlist_AsynTask extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + /* dialog.setMessage("Please wait,SemList loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show();*/ + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetSemlist(); // get the Sem list + return null; + } + + public getSemlist_AsynTask(EditProfileActivity activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + + // dialog.dismiss(); + +// Update_Semlist_spinner(); + if(str_SemStatus.equals("Success")) + { + if(str_isProfileEdited.equals("1")||str_isProfileEdited.equals("2")) + { + + dataAdapter_semlist = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_Sem); + // dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_semlist.setDropDownViewResource(R.layout.spinnercustomstyle); + + spin_semester.setAdapter(dataAdapter_semlist); + spin_semester.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + + if(O_semname!="" || O_semname!=null) + { + for (int i = 0; i < spin_semester.getCount(); i++) { + if (spin_semester.getItemAtPosition(i).toString().equals(O_semname)) + { + spin_semester.setSelection(i); + break; + } + } + } + } + else + { + dataAdapter_semlist = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_Sem); + // dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_semlist.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_semester.setAdapter(dataAdapter_semlist); + spin_semester.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + + } + } + + }//end of onPostExecute + }// end Async task + + + public void GetSemlist() + { + String URL = Class_URL.URL_Login.toString().trim(); + String METHOD_NAME = "GetSemesteronCourse"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/GetSemesteronCourse"; + //for final + try { + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + //request.addProperty("courseId",Long.parseLong(str_programid));//long + + request.addProperty("courseId",Long.parseLong(str_courseid));//long + request.addProperty("stream",Long.parseLong(str_programid)); + + // + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + + + SoapObject response = (SoapObject ) envelope.getResponse(); + SoapObject semresponse = (SoapObject ) response.getProperty(0); + str_SemStatus=semresponse.getProperty("Status").toString(); + + Log.e("respsemlist",response.toString()); + semlistcount = response.getPropertyCount(); + + Log.d("Semcount", String.valueOf(response.getPropertyCount())); + + + + if(str_SemStatus.equals("Success")) + { + if (semlistcount > 0) { + arrayObj_Class_Sem = new Class_Sem[semlistcount]; + + + for (int i = 0; i < semlistcount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + /*long + string + string*/ + + + Class_Sem innerObj_Class_sem = new Class_Sem(); + innerObj_Class_sem.setsem_id(response_soapobj.getProperty("SemId").toString()); //long + innerObj_Class_sem.setsem_name(response_soapobj.getProperty("SemName").toString()); //string + innerObj_Class_sem.setsem_status(response_soapobj.getProperty("Status").toString());// string + + + + + + + + str_SemStatus = response_soapobj.getProperty("Status").toString(); + + arrayObj_Class_Sem[i] = innerObj_Class_sem; + + + String str_semID = response_soapobj.getProperty("SemId").toString(); + String str_semname = response_soapobj.getProperty("SemName").toString(); + + + + // DBCreate_semdetails_insert_2SQLiteDB(str_semID, str_semname); + + + }//end for loop + + }//end of if + + } + + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("getCollege fail", "> " + t.getMessage()); + internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + }//End of uploaddetails + + + + + public void getCourselist_AsynTask() + { + getCourselist_AsynTask task = new getCourselist_AsynTask(EditProfileActivity.this); + task.execute(); + } + + + + private class getCourselist_AsynTask extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + /* dialog.setMessage("Please wait,CourseList loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show();*/ + + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetCourselist(); // get the Course list + return null; + } + + public getCourselist_AsynTask(EditProfileActivity activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + + // dialog.dismiss(); + + // Update_Courselist_spinner(); + + + if(str_CourseStatus.equals("Success")) + { + + if(str_isProfileEdited.equals("1")||str_isProfileEdited.equals("2")) + { + + dataAdapter_course = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_Course); + // dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_course.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_course.setAdapter(dataAdapter_course); + spin_course.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + + + + Log.e("spin_course","spin_course:"+O_coursename.toString()); + + if(O_coursename!="" || O_coursename!=null) + { + + for (int i = 0; i < spin_course.getCount(); i++) { + if (spin_course.getItemAtPosition(i).toString().equals(O_coursename)) + { + + spin_course.setSelection(i); + break; + } + } + } + + } + else + { + + dataAdapter_course = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_Course); + // dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_course.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_course.setAdapter(dataAdapter_course); + spin_course.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + } + } + + }//end of onPostExecute + }// end Async task + + + + public void GetCourselist() + { + + String URL = Class_URL.URL_Login.toString().trim(); + String METHOD_NAME = "GetCoursesOnProgram"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/GetCoursesOnProgram"; + + +//"http://mis.leadcampus.org/GetCoursesOnProgram + //for final + + + try { + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + request.addProperty("program", Long.parseLong(str_programid));//long str_ColID str_programid + //long + // + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + + + SoapObject response = (SoapObject ) envelope.getResponse(); + SoapObject courseResponse =(SoapObject) response.getProperty(0); + str_CourseStatus =courseResponse.getProperty("Status").toString(); + Log.e("resp Courselist",response.toString()); + courselistcount = response.getPropertyCount(); + + Log.d("Coursecount", String.valueOf(response.getPropertyCount())); + + + //Status=Success; + if(str_CourseStatus.equals("Success")) + { + if (courselistcount > 0) { + arrayObj_Class_Course = new Class_Course[courselistcount]; + + + for (int i = 0; i < courselistcount; i++) + { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + /* *long + string + long + string*/ + + + Class_Course innerObj_Class_course = new Class_Course(); + innerObj_Class_course.setcourse_id(response_soapobj.getProperty("CourseId").toString()); //long + innerObj_Class_course.setcourse_name(response_soapobj.getProperty("CourseName").toString()); // string + innerObj_Class_course.setcourse_progcode(response_soapobj.getProperty("ProgrammeCode").toString()); // long + innerObj_Class_course.setcourse_status(response_soapobj.getProperty("Status").toString());// string + + + str_CourseStatus = response_soapobj.getProperty("Status").toString(); + + arrayObj_Class_Course[i] = innerObj_Class_course; + + + String str_coursID = response_soapobj.getProperty("CourseId").toString(); + String str_coursname = response_soapobj.getProperty("CourseName").toString(); + String str_courseProgCode= response_soapobj.getProperty("ProgrammeCode").toString(); + + + + //DBCreate_Coursedetails_insert_2SQLiteDB(str_coursID, str_coursname,str_courseProgCode); + + + }//end for loop + + }//end of if + + } + + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("getCollege fail", "> " + t.getMessage()); + internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + }//End of uploaddetails + + + + + + + + + public void getProgramlist_AsynTask() + { + getProgramlist_AsynTask task = new getProgramlist_AsynTask(EditProfileActivity.this); + task.execute(); + } + + + + private class getProgramlist_AsynTask extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + /* dialog.setMessage("Please wait,ProgramList loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show();*/ + + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetProgramlist(); // get the Course list + return null; + } + + public getProgramlist_AsynTask(EditProfileActivity activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @Override + protected void onPostExecute(Void result) { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + + // dialog.dismiss(); + + //Update_Programlist_spinner(); + + + if(str_ProgramStatus.equals("Success")) + { + if(str_isProfileEdited.equals("1")||str_isProfileEdited.equals("2")) + { + + + dataAdapter_program = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_Program); + // dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_program.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_program.setAdapter(dataAdapter_program); + spin_program.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + + if(O_programmename!="" || O_programmename!=null) + { + for (int i = 0; i < spin_program.getCount(); i++) { + if (spin_program.getItemAtPosition(i).toString().equals(O_programmename)) + { + spin_program.setSelection(i); + break; + } + } + } + + } + else + { + dataAdapter_program = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_Program); + // dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_program.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_program.setAdapter(dataAdapter_program); + spin_program.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + } + + } + + }//end of onPostExecute + }// end Async task + + + + public void GetProgramlist() + { + + + + String URL = Class_URL.URL_Login.toString().trim(); + String METHOD_NAME = "GetprogramList"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/GetprogramList"; + + + + //for final + + + try { + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + // request.addProperty("courseid", 0);//long + + request.addProperty("Manager_Id", 0);// int + // + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + + + SoapObject response = (SoapObject ) envelope.getResponse(); + SoapObject o_programresponse = (SoapObject ) response.getProperty(0); + str_ProgramStatus = o_programresponse.getProperty("status").toString(); + Log.e("resp Programlist",response.toString()); + programlistcount = response.getPropertyCount(); + + Log.d("Programcount", String.valueOf(response.getPropertyCount())); + + + + if(str_ProgramStatus.equals("Success")) + { + if (programlistcount > 0) { + arrayObj_Class_Program = new Class_Program[programlistcount]; + + + for (int i = 0; i < programlistcount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + /* long + string + string*/ + + + Class_Program innerObj_Class_program = new Class_Program(); + innerObj_Class_program.setprogram_id(response_soapobj.getProperty("programmeId").toString()); //long + innerObj_Class_program.setprog_name(response_soapobj.getProperty("programmeName").toString()); // string + innerObj_Class_program.setprog_status(response_soapobj.getProperty("status").toString()); // string + + + + + + + + + str_ProgramStatus = response_soapobj.getProperty("status").toString(); + + arrayObj_Class_Program[i] = innerObj_Class_program; + + + String str_progID = response_soapobj.getProperty("programmeId").toString(); + String str_progname = response_soapobj.getProperty("programmeName").toString(); + + + + + // DBCreate_Programdetails_insert_2SQLiteDB(str_progID, str_progname); + + + }//end for loop + + }//end of if + + } + + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("getCollege fail", "> " + t.getMessage()); + internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + }//End of uploaddetails + + + + + + + + public void SaveStudentDetails_AsynTask() + { + SaveStudentDetails_AsynTask task = new SaveStudentDetails_AsynTask(EditProfileActivity.this); + task.execute(); + } + + + + private class SaveStudentDetails_AsynTask extends AsyncTask { + ProgressDialog dialog; + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + dialog.setMessage("Please wait,Updating Details loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + SendStudentDetails(); // + return null; + } + + public SaveStudentDetails_AsynTask(EditProfileActivity activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @Override + protected void onPostExecute(Void result) { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + + dialog.dismiss(); + + + + if(internet_issue1.equals("Noerror")) { + + if (str_editprofile_response.equals("Profile Updated.")||str_editprofile_response.equals("Profile Updated but imaeg not saved.")) { + /* Toast.makeText(getApplicationContext(), "Profile Updated Successfully", Toast.LENGTH_LONG).show(); + + editor_S = shardpref_S_obj.edit(); + editor_S.putString(PrefID_S_isprofileEdited,"1"); + editor_S.putString(PrefId_S_Gender,str_gender.toString()); + Log.e("gender","gender"+str_gender.toString()); + editor_S.commit(); + + Intent i = new Intent(EditProfileActivity.this,HomeActivity.class); + i.putExtra("fromeditProfile","yes"); + startActivity(i);*/ + + + AlertDialog.Builder dialog = new AlertDialog.Builder(EditProfileActivity.this); + dialog.setCancelable(false); + dialog.setTitle("LEADCampus"); + dialog.setMessage("Thank you for updating the profile"); + + dialog.setPositiveButton("OK", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) + { + editor_S = shardpref_S_obj.edit(); + editor_S.putString(PrefID_S_isprofileEdited,"1"); + editor_S.putString(PrefId_S_Gender,str_gender.toString()); + Log.e("gender","gender"+str_gender.toString()); + editor_S.commit(); + + Intent i = new Intent(EditProfileActivity.this,HomeActivity.class); + i.putExtra("fromeditProfile","yes"); + startActivity(i); + } + }); + + final AlertDialog alert = dialog.create(); + alert.setOnShowListener( new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface arg0) + { + alert.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#004D40")); + } + }); + alert.show(); + + } else { + Toast.makeText(getApplicationContext(), "W:Error"+str_editprofile_response, Toast.LENGTH_LONG).show(); + } + + }else + { + Toast.makeText(getApplicationContext(), "Error:"+str_editprofile_response, Toast.LENGTH_LONG).show(); + } + + + }//end of onPostExecute + }// end Async task + + + + + + + public void SendStudentDetails() + { + + String URL = Class_URL.URL_Login.toString().trim(); + /*String METHOD_NAME = "UpdateStudentProfilewithstring"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/UpdateStudentProfilewithstring"; +*/ + + String METHOD_NAME = "UpdateStudentProfilewithCompress_Testbed"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/UpdateStudentProfilewithCompress_Testbed"; + + + //UpdateStudentProfilewithCompress + + + + try { + str_editprofile_response="x"; + + + /* DateFormat inputFormat = new SimpleDateFormat("dd/MM/yyyy"); + DateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd"); + String inputDateStr=edt_dob.getText().toString(); + Date date = inputFormat.parse(inputDateStr); + String str_DateddMMyyyy = outputFormat.format(date); + Log.e("dateformat",str_DateddMMyyyy.toString());*/ + + long long_aadhara =0; + //long long_account =0; + String str_iifscode = " "; + if(imageinbytesArray.length!=0){}else{ imageinbytesArray=null;} + + + if(aadhara_et.getText().toString().trim().length()==0) + { long_aadhara=Long.parseLong("0");} + else {long_aadhara=Long.parseLong(aadhara_et.getText().toString().trim()); } + + /* if(account_et.getText().toString().trim().length()==0) + { long_account=0; } + else + { long_account =Long.parseLong(account_et.getText().toString().trim()); } +*/ + if(iifscode_et.getText().toString().trim().length()==0) + { str_iifscode= " "; } + else { str_iifscode =iifscode_et.getText().toString().trim(); } + + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + request.addProperty("RegistrationId", Long.parseLong(str_RegID));//long + request.addProperty("Lead_Id", str_LeadID);//string + request.addProperty("StudentName", edt_studName.getText().toString().trim());//string + request.addProperty("DOB", edt_dob.getText().toString());//string + request.addProperty("StateCode", str_Sids);// int + request.addProperty("DistrictCode", Integer.parseInt(str_Dids));//int + request.addProperty("TalukaCode", Integer.parseInt(str_Cityids));//int + request.addProperty("CollegeCode", Integer.parseInt(str_ColID));//int + request.addProperty("StreamCode", Integer.parseInt(str_programid));//int + request.addProperty("CourseCode", Integer.parseInt(str_courseid));//int + request.addProperty("SemCode",Integer.parseInt(str_semid));//int + request.addProperty("AadharNo",long_aadhara);//long + request.addProperty("Address", " ");//
string
+ request.addProperty("MailId", emailid_et.getText().toString());//string + request.addProperty("AlternativeMobileNo", Long.parseLong(alernativecell_et.getText().toString()));//long + request.addProperty("AlternateMailId", " ");//string + request.addProperty("Gender",str_gender.toString() );//string + request.addProperty("BloodGroup", str_bloodgroup.toString());//string + request.addProperty("FacebookId", " ");//string + request.addProperty("LinkedInId", " ");//string + request.addProperty("AcademicCode", str_academiccode);//int + request.addProperty("Bank_Name", " ");//string + request.addProperty("Branch_Name", " ");//string + request.addProperty("Account_No", account_et.getText().toString().trim());// string + request.addProperty("IFSC_code", str_iifscode);//string + request.addProperty("MyTalent", mytalent_et.getText().toString().trim());//string + //request.addProperty("ProfileImage", null);/// base64Binary + request.addProperty("ProfileImage", studPickBase64); + request.addProperty("BankDocument", bankPicBase64); + request.addProperty("Document_Type", str_bankDoc); + + + +// + // + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + + + SoapPrimitive response = (SoapPrimitive ) envelope.getResponse(); + + str_editprofile_response = response.toString(); + Log.e("resp editprofile",response.toString()); + //E/resp editprofile: Profile Updated.ed + + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("editprofile fail", "> " + t.getMessage()); + internet_issue1 = "Editprofilerror"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + }//End of uploaddetails + + + private void getStudentDetails() { + GetStudentDetails getStudentDetails = new GetStudentDetails(EditProfileActivity.this); + getStudentDetails.execute(str_LeadID); + } + + + public class GetStudentDetails extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + // private ProgressBar progressBar; + + ProgressDialog dialog; + + GetStudentDetails(Context ctx) + { + context = ctx; + dialog = new ProgressDialog(ctx); + } + + + @Override + protected SoapObject doInBackground(String... params) { + String leadid = (String) params[0]; + //String versionCode = (String) params[2]; + + + SoapObject response = getStudDtls(leadid); + + //Log.d("Soap response is",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + /*pd_getstudentdetails.setMessage("Please wait,Downloading Details loading..."); + pd_getstudentdetails.setCanceledOnTouchOutside(false); + pd_getstudentdetails.show(); +*/ + + dialog.setMessage("Please wait,Updating Details loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + } + + @Override + protected void onPostExecute(SoapObject result) { + // progressBar.setVisibility(View.GONE); + + dialog.dismiss(); + // pd_getstudentdetails.dismiss(); + + + + + edt_studName.setText(O_StudentName.toString().trim()); + + if(O_AlternativeMobileNo.toString().length()==0) + {alernativecell_et.setText(" "); } + else { alernativecell_et.setText(O_AlternativeMobileNo.toString().trim()); } + + + emailid_et.setText(O_MailId.toString().trim()); + + if(O_AadharNo.equals("anyType{}")||O_AadharNo.equals("anytype{}")||O_AadharNo.equals("0")) + { aadhara_et.setText(""); } + else + { aadhara_et.setText(O_AadharNo.toString().trim()); } + + if(O_Account_No.equals("anyType{}")||O_Account_No.equals("anytype{}")||O_Account_No.equals("0")) + { account_et.setText(""); } + else + { account_et.setText(O_Account_No.toString().trim()); } + + + + if(O_IFSC_code.equals("anyType{}")||O_IFSC_code.equals("anytype{}")||O_IFSC_code.equals("0")) + { iifscode_et.setText("");} + else{ iifscode_et.setText(O_IFSC_code.toString().trim()); } + + + + if(O_mytalent.equalsIgnoreCase("anyType{}")||O_mytalent.isEmpty()) + { mytalent_et.setText(""); } + else{ mytalent_et.setText(O_mytalent.toString().trim()); } + + edt_dob.setText(O_DOB.toString().trim()); + leadid_tv.setText(O_leadID.toString().trim()); + mobileno_tv.setText(O_MobileNo.toString().trim()); + student_tv.setText(O_Student_Type.toString().trim()); + + if(O_Gender.equals("M")) + { + gender_radiogroup.check(R.id.rdb_male); } + else + { gender_radiogroup.check(R.id.rdb_female); } + + + if(O_BloodGroup!="" || O_BloodGroup!=null) + { + for (int i = 0; i < spin_bg.getCount(); i++) { + if (spin_bg.getItemAtPosition(i).toString().equals(O_BloodGroup)) + { + spin_bg.setSelection(i); + break; + } + } + } + + img_profilePick.setImageBitmap(Studentbmp); + + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapObject getStudDtls(String leadid) { + String METHOD_NAME = "GetStudentDetailss"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetStudentDetailss"; + + try { + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + /* Log.d("Mobile Number",mobilenum);*/ + Log.d("Lead Id", leadid); + + /*request.addProperty("Username", mobilenum); + request.addProperty("Password", leadid);*/ + + request.addProperty("leadId", leadid); + /* request.addProperty("Password", mobilenum);*/ + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Login.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapObject response = (SoapObject) envelope.getResponse(); + Log.e("GetStudent","soap response"+ response.toString()); + + + O_RegistrationId=response.getProperty("RegistrationId").toString(); + O_StudentName=response.getProperty("StudentName").toString(); + O_DOB=response.getProperty("DOB").toString(); + String RegistrationDate=response.getProperty("RegistrationDate").toString(); + String isProfileEdit=response.getProperty("isProfileEdit").toString(); + O_statecode=response.getProperty("StateCode").toString(); + O_districtcode=response.getProperty("DistrictCode").toString(); + O_talukacode=response.getProperty("TalukaCode").toString(); + O_collegenameCode=response.getProperty("CollegeCode").toString(); + O_coursecode=response.getProperty("CourseCode").toString(); + O_StreamprogramCode=response.getProperty("StreamCode").toString(); + String O_semcode=response.getProperty("SemName").toString(); + O_AadharNo=response.getProperty("AadharNo").toString(); + String O_Address=response.getProperty("Address").toString(); + O_MailId=response.getProperty("MailId").toString(); + O_AlternativeMobileNo=response.getProperty("AlternativeMobileNo").toString(); + O_Gender=response.getProperty("Gender").toString(); + O_BloodGroup=response.getProperty("BloodGroup").toString(); + String O_FacebookId=response.getProperty("FacebookId").toString(); + String O_LinkedInId=response.getProperty("LinkedInId").toString(); + String O_AcademicCode=response.getProperty("AcademicCode").toString(); + O_Student_Type=response.getProperty("Student_Type").toString(); + String O_Bank_Name=response.getProperty("Bank_Name").toString(); + String O_Branch_Name=response.getProperty("Branch_Name").toString(); + O_Account_No=response.getProperty("Account_No").toString(); + O_IFSC_code=response.getProperty("IFSC_code").toString(); + String O_Status=response.getProperty("Status").toString(); + O_Student_Image=response.getProperty("Student_Image").toString(); + String O_ManagerMobileNumber=response.getProperty("ManagerMobileNumber").toString(); + O_MobileNo=response.getProperty("MobileNo").toString(); + O_mytalent=response.getProperty("MyTalent").toString();// + Log.e("tag","RegistrationId="+O_RegistrationId+"StudentName="+O_StudentName+"DOB="+O_DOB); + Log.e("tag","RegistrationDate="+RegistrationDate+"isProfileEdit="+isProfileEdit+"StateCode="+O_statecode); + Log.e("tag","DistrictCode="+O_districtcode+"TalukaCode="+O_talukacode+"CollegeCode="+O_collegenameCode); + + O_leadID =response.getProperty("Lead_Id").toString(); + O_altermailid= response .getProperty("AlternateMailId").toString(); + O_collegename = response .getProperty("College_Name").toString(); + O_statename = response .getProperty("StateName").toString(); + O_districtname = response .getProperty("DistrictName").toString(); + O_talukname = response .getProperty("Taluk_Name").toString(); + O_programmename = response .getProperty("programmeName").toString(); + O_coursename = response .getProperty("CourseName").toString(); + O_semname = response .getProperty("SemName").toString(); + + + + + String arr[] = O_Student_Image.split("/", 2); + + String firstWord = arr[0]; //the + String secondWord = arr[1]; + + Str_studentImgUrl = serverPath + secondWord; + Log.i("tag", "firstWord=" + firstWord + " secondWord=" + secondWord); + + Log.e("student URL", ""+Str_studentImgUrl); + + URL url = new URL(Str_studentImgUrl.toString().trim()); + Studentbmp = BitmapFactory.decodeStream(url.openConnection().getInputStream()); + + // img_profilePick.setImageBitmap(Studentbmp); + + + + return response; + + } catch (Exception t) { + + Log.e("request fail", "> " + t.getMessage().toString()); + + + } + } catch (Exception t) { + Log.d("exception outside", t.getMessage().toString()); + } + return null; + } + + + + + + + + + + + + + +// Validation + + + public boolean validation() + { + boolean validationresult = true; + + boolean b_studenname,b_alernativecell,b_emailid,b_dob,b_aadhara1,b_aadhara2,b_account1,b_account2,b_iifscode1,b_iifscode2; + boolean b_state,b_district,b_city,b_college,b_course,b_sem,b_programid,b_mytalent; + + b_studenname=b_alernativecell=b_emailid=b_dob=b_aadhara1=b_aadhara2=b_account1=b_account2=b_iifscode1=b_iifscode2=true; + b_state=b_district=b_city=b_college=b_course=b_sem=b_programid=b_mytalent=true; + + if (edt_studName.getText().toString().length() == 0 || edt_studName.getText().toString().length() <= 2 || edt_studName.getText().toString().trim().length() == 0) { + edt_studName.setError("InValid Student name"); + edt_studName.requestFocus(); + b_studenname=false; + validationresult = false; + } + + if (alernativecell_et.getText().toString().length() == 0 || alernativecell_et.getText().toString().length() <= 9) { + alernativecell_et.setError("InValid Mobile number"); + //alernativecell_et.requestFocus(); + b_alernativecell=false; + validationresult = false; + } + + if (emailid_et.getText().toString().length() == 0 ||emailid_et.getText().toString().length()<=5) { + emailid_et.setError("Enter Valid EmailID!"); + //emailid_et.requestFocus(); + b_emailid=false; + validationresult = false; + } + + + if (edt_dob.getText().toString().length() == 0 ||edt_dob.getText().toString().length()<=5) + { + // edt_dob.setError("Enter the DOB!"); + //Toast.makeText(getApplicationContext(),"Enter the Date",Toast.LENGTH_SHORT).show(); + //edt_dob.requestFocus(); + dobseterror_tv.setVisibility(View.VISIBLE); + dobseterror_tv.setError("Enter the DOB!"); + b_dob=false; + validationresult = false; + } + + + if(aadhara_et.getText().toString().length() == 0) + { + b_aadhara1=true; + validationresult= true; + }else + { + if (aadhara_et.getText().toString().length() <= 11) { + aadhara_et.setError("12 digit required"); + //aadhara_et.requestFocus(); + b_aadhara2=false; + validationresult = false; + } + } + + + + if(account_et.getText().toString().length() == 0) + { b_account1=true; + validationresult = true; + } + else + { + if (account_et.getText().toString().length() < 10 && account_et.getText().toString().length() <21) + { + account_et.setError("Min 10,Max 20 digit required"); + // account_et.requestFocus(); + b_account2=false; + validationresult = false; + } + } + + + if (iifscode_et.getText().toString().length() == 0 ) + { + b_iifscode1=true; + validationresult = true; + } + else + { + if (iifscode_et.getText().toString().length() <=5) { + iifscode_et.setError("Enter Valid IFSC Code"); + // account_et.requestFocus(); + b_iifscode2=false; + validationresult = false; + } + } + + + + + + if(str_Sids.equals("x")||spin_state.getSelectedItem().toString().equals("Select State")) + { //Toast.makeText(getApplicationContext(),"select the state",Toast.LENGTH_SHORT).show(); + // ((TextView)spin_state.getSelectedView()).setError("Error message"); + stateerror_tv.setVisibility(View.VISIBLE); + stateerror_tv.setError("Select State"); + b_state=false; + validationresult = false; + } + if(str_Dids.equals("x")||spin_district.getSelectedItem().toString().equals("Select District")) + { districterror_tv.setVisibility(View.VISIBLE); + districterror_tv.setError("Select District"); + //Toast.makeText(getApplicationContext(),"select the District",Toast.LENGTH_SHORT).show(); + b_district=false; + validationresult = false;} + + if(str_Cityids.equals("x")||spin_city.getSelectedItem().toString().equals("Select City")) + { cityerror_tv.setVisibility(View.VISIBLE); + cityerror_tv.setError("Select City"); + // Toast.makeText(getApplicationContext(),"select the City",Toast.LENGTH_SHORT).show(); + b_city=false; + validationresult = false; + } + if(str_programid.equals("x")) + { b_programid=false; + //Toast.makeText(getApplicationContext(),"select the Program",Toast.LENGTH_SHORT).show(); + validationresult = false;} + + if(str_ColID.equals("x")||spin_institution.getSelectedItem().toString().equals("Select Institution")||spin_institution.getSelectedItem().toString().equals("There are no colleges")||spin_institution.getSelectedItem().toString().equals("WS Exception")) + // if(spin_institution.getSelectedItem().toString().equals("Select Institution")||spin_institution.getSelectedItem().toString().equals("There are no colleges")||spin_institution.getSelectedItem().toString().equals("WS Exception")) + { b_college=false; + collegeerror_tv.setVisibility(View.VISIBLE); + collegeerror_tv.setError("Select Institution"); + //Toast.makeText(getApplicationContext(),"select the College",Toast.LENGTH_SHORT).show(); + validationresult = false; + } + + if(str_courseid.equals("x")||spin_course.getSelectedItem().toString().equals("Select Stream")) + { courseerror_tv.setVisibility(View.VISIBLE); + courseerror_tv.setError("Select Stream"); + //Toast.makeText(getApplicationContext(),"select the Course",Toast.LENGTH_SHORT).show(); + b_college=false; + validationresult = false;} + + + if(str_semid.equals("x")||spin_semester.getSelectedItem().toString().equals("Select Semester")) + { semerror_tv.setVisibility(View.VISIBLE); + semerror_tv.setError("Select Semester"); + b_sem=false; + validationresult = false; + } + + + /* if(mytalent_et.getText().toString().trim().length()<5) + { + mytalent_et.setError("Minimum 5 character"); + b_mytalent=false; + + }*/ + // (iifscode_et.getText().toString().length() <=5 + + //return validationresult; + return (b_studenname&&b_alernativecell&&b_emailid&&b_dob&&b_aadhara1&&b_aadhara2&&b_account1&&b_account2&&b_iifscode1 + &&b_iifscode2&&b_state&&b_district&&b_city&&b_college&&b_course&&b_sem&&b_programid&&b_mytalent); + } + + + + + + + + + + + + + + +//validation + +//----- DB Create + + public void DBCreate_Statedetails_insert_2SQLiteDB(String str_stateID,String str_statename) + { + SQLiteDatabase db1 = this.openOrCreateDatabase("LeadEditProfileDB", Context.MODE_PRIVATE, null); + db1.execSQL("CREATE TABLE IF NOT EXISTS Statelist(SID VARCHAR,SName VARCHAR);"); + + + String SQLiteQuery = "INSERT INTO Statelist (SID, SName)" + + " VALUES ('"+str_stateID+"','"+str_statename+"');"; + db1.execSQL(SQLiteQuery); + + } + + public void DBCreate_Districtdetails_insert_2SQLiteDB(String str_districtID,String str_districtname,String str_districtstateid) + { + SQLiteDatabase db1 = this.openOrCreateDatabase("LeadEditProfileDB", Context.MODE_PRIVATE, null); + db1.execSQL("CREATE TABLE IF NOT EXISTS Districtlist(DID VARCHAR,DName VARCHAR,DStateID VARCHAR);"); + + + String SQLiteQuery = "INSERT INTO Districtlist (DID,DName,DStateID)" + + " VALUES ('"+str_districtID+"','"+str_districtname+"','"+str_districtstateid+"');"; + db1.execSQL(SQLiteQuery); + + db1.close(); + } + + + public void DBCreate_Talukdetails_insert_2SQLiteDB(String str_talukID,String str_taluk_did,String str_talukname) + { + SQLiteDatabase db1 = this.openOrCreateDatabase("LeadEditProfileDB", Context.MODE_PRIVATE, null); + db1.execSQL("CREATE TABLE IF NOT EXISTS Taluklist(TID VARCHAR,TName VARCHAR,TDistrictID VARCHAR);"); + + + String SQLiteQuery = "INSERT INTO Taluklist(TID,TName,TDistrictID)" + + " VALUES ('"+str_talukID+"','"+str_talukname+"','"+str_taluk_did+"');"; + db1.execSQL(SQLiteQuery); + db1.close(); + } + + + + + public void DBCreate_Collegedetails_insert_2SQLiteDB + (String str_collegeID,String str_college_tid,String str_collegename) + + { + SQLiteDatabase db1 = this.openOrCreateDatabase("LeadEditProfileDB", Context.MODE_PRIVATE, null); + db1.execSQL("CREATE TABLE IF NOT EXISTS Collegelist(CollegeID VARCHAR,CollegeName VARCHAR,CTalukID VARCHAR);"); + + // db1.execSQL("CREATE TABLE IF NOT EXISTS Taluklist(TID VARCHAR,TName VARCHAR,TDistrictID VARCHAR);"); + + /* db1.execSQL("CREATE TABLE IF NOT EXISTS Collegelist(CollegeID VARCHAR,CollegeName VARCHAR,CTalukID VARCHAR," + + "CurrentapplcountDB VARCHAR,CurrentadmissioncountDB VARCHAR,PreviousapplcountDB VARCHAR,PreviousadmissioncountDB VARCHAR);"); +*/ + + //Prev2prevapplcountDB + /*String SQLiteQuery = "INSERT INTO Taluklist(TID,TName,TDistrictID)" + + " VALUES ('"+str_talukID+"','"+str_talukname+"','"+str_taluk_did+"');";*/ + + String SQLiteQuery = "INSERT INTO Collegelist(CollegeID,CollegeName,CTalukID)" + + " VALUES ('"+str_collegeID+"','"+str_collegename+"','"+str_college_tid+"');"; + + + + /*String SQLiteQuery = "INSERT INTO Collegelist(CollegeID,CollegeName,CTalukID," + + "CurrentapplcountDB,CurrentadmissioncountDB,PreviousapplcountDB,PreviousadmissioncountDB)" + + " VALUES ('"+str_collegeID+"','"+str_collegename+"','"+str_college_tid+"'," + + "'"+str_currentapplcount+"','"+str_currentadmissioncount+"','"+str_previousapplcount+"','"+str_previousadmissioncount+"');"; +*/ + db1.execSQL(SQLiteQuery); + db1.close(); + } + + + + + + + + public void DBCreate_semdetails_insert_2SQLiteDB(String str_semID,String str_semname) + { + SQLiteDatabase db1 = this.openOrCreateDatabase("LeadEditProfileDB", Context.MODE_PRIVATE, null); + db1.execSQL("CREATE TABLE IF NOT EXISTS Semlist(SID VARCHAR,SName VARCHAR);"); + + + String SQLiteQuery = "INSERT INTO Semlist(SID,SName)" + + " VALUES ('"+str_semID+"','"+str_semname+"');"; + db1.execSQL(SQLiteQuery); + db1.close(); + } + + + + public void DBCreate_Coursedetails_insert_2SQLiteDB(String str_courseID, String str_coursename ,String str_courseProgCode) + { + SQLiteDatabase db1 = this.openOrCreateDatabase("LeadEditProfileDB", Context.MODE_PRIVATE, null); + db1.execSQL("CREATE TABLE IF NOT EXISTS Courselist(CID VARCHAR,CName VARCHAR,CPCode VARCHAR);"); + + + String SQLiteQuery = "INSERT INTO Courselist(CID,CName,CPCode)" + + " VALUES ('"+str_courseID+"','"+str_coursename+"','"+str_courseProgCode+"');"; + db1.execSQL(SQLiteQuery); + db1.close(); + } + + + + public void DBCreate_Programdetails_insert_2SQLiteDB(String str_progID, String str_progname) + { + SQLiteDatabase db1 = this.openOrCreateDatabase("LeadEditProfileDB", Context.MODE_PRIVATE, null); + db1.execSQL("CREATE TABLE IF NOT EXISTS Programlist(PID VARCHAR,PName VARCHAR);"); + + String SQLiteQuery = "INSERT INTO Programlist(PID,PName)" + + " VALUES ('"+str_progID+"','"+str_progname+"');"; + db1.execSQL(SQLiteQuery); + db1.close(); + + } + + + + + + + + + + + + + + + public void uploadfromDB_Statelist() + { + + SQLiteDatabase db1 = this.openOrCreateDatabase("LeadEditProfileDB", Context.MODE_PRIVATE, null); + db1.execSQL("CREATE TABLE IF NOT EXISTS Statelist(SID VARCHAR,SName VARCHAR);"); + Cursor cursor1 = db1.rawQuery("SELECT * FROM Statelist", null); + int x = cursor1.getCount(); + Log.d("cursor count", Integer.toString(x)); + + int i=0; + arrayObj_Class_States2 = new Class_States[x]; + if (cursor1.moveToFirst()) { + + do { + Class_States innerObj_Class_StatesList = new Class_States(); + innerObj_Class_StatesList.setstate_id(cursor1.getString(cursor1.getColumnIndex("SID"))); + innerObj_Class_StatesList.setstate_name(cursor1.getString(cursor1.getColumnIndex("SName"))); + // innerObj_Class_StatesList.setCenterCode(cursor1.getString(cursor1.getColumnIndex("CCode"))); + + arrayObj_Class_States2[i]=innerObj_Class_StatesList; + i++; + } while (cursor1.moveToNext()); + }//if ends + + + if(x>0) { + // ArrayAdapter dataAdapter = new ArrayAdapter(getApplicationContext(), android.R.layout.simple_spinner_item, arrayObj_Class_Centers2); + + dataAdapter = new ArrayAdapter(getApplicationContext(), android.R.layout.simple_spinner_item, arrayObj_Class_States2); + //dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + + + //spin_state.setAdapter(dataAdapter); + // Toast.makeText(getApplicationContext(),"In database",Toast.LENGTH_LONG).show(); + // txtSearch1.setAdapter(dataAdapter); + statesearch_ATV.setAdapter(dataAdapter); + + } + + } + + + + + + public void uploadfromDB_Districtlist() + { + + SQLiteDatabase db1 = this.openOrCreateDatabase("LeadEditProfileDB", Context.MODE_PRIVATE, null); + db1.execSQL("CREATE TABLE IF NOT EXISTS Districtlist(DID VARCHAR,DName VARCHAR,DStateID VARCHAR);"); + Cursor cursor1 = db1.rawQuery("SELECT * FROM Districtlist", null); + int x = cursor1.getCount(); + Log.d("cursor Dcount", Integer.toString(x)); + + int i=0; + arrayObj_Class_District2 = new Class_District[x]; + if (cursor1.moveToFirst()) { + + do { + Class_District innerObj_Class_DistrictList = new Class_District(); + innerObj_Class_DistrictList.setdistrict_id(cursor1.getString(cursor1.getColumnIndex("DID"))); + innerObj_Class_DistrictList.setdistrict_name(cursor1.getString(cursor1.getColumnIndex("DName"))); + innerObj_Class_DistrictList.setdstateid_id(cursor1.getString(cursor1.getColumnIndex("DStateID"))); + + arrayObj_Class_District2[i]=innerObj_Class_DistrictList; + i++; + } while (cursor1.moveToNext()); + }//if ends + + db1.close(); + if(x>0) { + // ArrayAdapter dataAdapter = new ArrayAdapter(getApplicationContext(), android.R.layout.simple_spinner_item, arrayObj_Class_Centers2); + + dataAdapter_district = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_District2); + //dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_district.setDropDownViewResource(R.layout.spinnercustomstyle); + districtsearch_ATV.setAdapter(dataAdapter_district); + } + + } + + + public void Update_taluk_spinner(String str_Dids) + { + + SQLiteDatabase db1 = this.openOrCreateDatabase("LeadEditProfileDB", Context.MODE_PRIVATE, null); + db1.execSQL("CREATE TABLE IF NOT EXISTS Taluklist(TID VARCHAR,TName VARCHAR,TDistrictID VARCHAR);"); + Cursor cursor1 = db1.rawQuery("SELECT * FROM Taluklist WHERE TDistrictID='" + str_Dids + "'", null); + int x = cursor1.getCount(); + Log.d("cursor Tcount", Integer.toString(x)); + + int i=0; + arrayObj_Class_Taluk2 = new Class_Taluk[x]; + if (cursor1.moveToFirst()) { + + do { + Class_Taluk innerObj_Class_TalukList = new Class_Taluk(); + innerObj_Class_TalukList.settaluk_id(cursor1.getString(cursor1.getColumnIndex("TID"))); + innerObj_Class_TalukList.settalukname(cursor1.getString(cursor1.getColumnIndex("TName"))); + innerObj_Class_TalukList.settaluk_did(cursor1.getString(cursor1.getColumnIndex("TDistrictID"))); + + + arrayObj_Class_Taluk2[i]=innerObj_Class_TalukList; + i++; + } while (cursor1.moveToNext()); + }//if ends + + + + db1.close(); + + if(x>0) { + // ArrayAdapter dataAdapter = new ArrayAdapter(getApplicationContext(), android.R.layout.simple_spinner_item, arrayObj_Class_Fellowship2); + + dataAdapter_city = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_Taluk2); + // dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_city.setDropDownViewResource(R.layout.spinnercustomstyle); + citysearch_ATV.setAdapter(dataAdapter_city); + } + + } + + + // public void Update_college_spinner(String str_Tids,String str_collegetype) + public void Update_college_spinner(String str_Tids) + { + + //SQLiteDatabase db1 = this.openOrCreateDatabase("LeadEditProfileDB", Context.MODE_PRIVATE, null); + // db1.execSQL("CREATE TABLE IF NOT EXISTS Collegelist(CollegeID VARCHAR,CollegeName VARCHAR,CTalukID VARCHAR);"); + + /*db1.execSQL("CREATE TABLE IF NOT EXISTS Collegelist(CollegeID VARCHAR,CollegeName VARCHAR,CTalukID VARCHAR," + + "CurrentapplcountDB VARCHAR,CurrentadmissioncountDB VARCHAR,PreviousapplcountDB VARCHAR,PreviousadmissioncountDB VARCHAR," + + "Prev2prevapplcountDB VARCHAR,Prev2prevadmissioncountDB VARCHAR,CollegeTypeDB VARCHAR);"); +*/ + + + SQLiteDatabase db1 = this.openOrCreateDatabase("LeadEditProfileDB", Context.MODE_PRIVATE, null); + db1.execSQL("CREATE TABLE IF NOT EXISTS Collegelist(CollegeID VARCHAR,CollegeName VARCHAR,CTalukID VARCHAR);"); + + + /* db1.execSQL("CREATE TABLE IF NOT EXISTS Collegelist(CollegeID VARCHAR,CollegeName VARCHAR,CTalukID VARCHAR," + + "CurrentapplcountDB VARCHAR,CurrentadmissioncountDB VARCHAR);"); +*/ + + /* db1.execSQL("CREATE TABLE IF NOT EXISTS Collegelist(CollegeID VARCHAR,CollegeName VARCHAR,CTalukID VARCHAR," + + "CurrentapplcountDB VARCHAR,CurrentadmissioncountDB VARCHAR,PreviousapplcountDB VARCHAR,PreviousadmissioncountDB VARCHAR);"); +*/ + + + // Cursor cursor1 = db1.rawQuery("SELECT * FROM Collegelist WHERE CTalukID='" + str_Tids + "'", null); + //Cursor cursor1 = db1.rawQuery("SELECT * FROM Collegelist WHERE CTalukID='"+str_Tids+"' AND CollegeTypeDB='"+str_collegetype+"'", null); + Cursor cursor1 = db1.rawQuery("SELECT * FROM Collegelist WHERE CTalukID='"+str_Tids+"'", null); + int x = cursor1.getCount(); + Log.e("College Ccount", Integer.toString(x)); + + int i=0; + arrayObj_Class_Colleges2 = new Class_Colleges[x]; + if (cursor1.moveToFirst()) { + + do { + Class_Colleges innerObj_Class_CollegeList = new Class_Colleges(); + innerObj_Class_CollegeList.setcollege_id(cursor1.getString(cursor1.getColumnIndex("CollegeID"))); + innerObj_Class_CollegeList.setcollegename(cursor1.getString(cursor1.getColumnIndex("CollegeName"))); + innerObj_Class_CollegeList.setcollege_tid(cursor1.getString(cursor1.getColumnIndex("CTalukID"))); + Log.e("college",(cursor1.getString(cursor1.getColumnIndex("CollegeID")))); + + arrayObj_Class_Colleges2[i]=innerObj_Class_CollegeList; + i++; + } while (cursor1.moveToNext()); + }//if ends + + + + db1.close(); + if(x>0) { + // ArrayAdapter dataAdapter = new ArrayAdapter(getApplicationContext(), android.R.layout.simple_spinner_item, arrayObj_Class_Fellowship2); + + dataAdapter_college = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_Colleges2); + // dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_college.setDropDownViewResource(R.layout.spinnercustomstyle); + collegesearch_ATV.setAdapter(dataAdapter_college); + } + + } + + + + + public void Update_Semlist_spinner() + { + + SQLiteDatabase db1 = this.openOrCreateDatabase("LeadEditProfileDB", Context.MODE_PRIVATE, null); + db1.execSQL("CREATE TABLE IF NOT EXISTS Semlist(SID VARCHAR,SName VARCHAR);"); + + Cursor cursor1 = db1.rawQuery("SELECT * FROM Semlist", null); + int x = cursor1.getCount(); + + + Log.e("Sem Ccount", Integer.toString(x)); + + int i=0; + arrayObj_Class_Sem2 = new Class_Sem[x]; + if (cursor1.moveToFirst()) { + + do { + Class_Sem innerObj_Class_SemList = new Class_Sem(); + innerObj_Class_SemList.setsem_id(cursor1.getString(cursor1.getColumnIndex("SID"))); + innerObj_Class_SemList.setsem_name(cursor1.getString(cursor1.getColumnIndex("SName"))); + Log.e("Semlis",(cursor1.getString(cursor1.getColumnIndex("SID")))); + + arrayObj_Class_Sem2[i]=innerObj_Class_SemList; + i++; + } while (cursor1.moveToNext()); + }//if ends + + + + db1.close(); + if(x>0) { + // ArrayAdapter dataAdapter = new ArrayAdapter(getApplicationContext(), android.R.layout.simple_spinner_item, arrayObj_Class_Fellowship2); + + dataAdapter_semlist = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_Sem2); + // dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_semlist.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_semester.setAdapter(dataAdapter_semlist); + spin_semester.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + } + + } + + + + + public void Update_Courselist_spinner() + { + + SQLiteDatabase db1 = this.openOrCreateDatabase("LeadEditProfileDB", Context.MODE_PRIVATE, null); + db1.execSQL("CREATE TABLE IF NOT EXISTS Courselist(CID VARCHAR,CName VARCHAR,CPCode VARCHAR);"); + + Cursor cursor1 = db1.rawQuery("SELECT * FROM Courselist", null); + int x = cursor1.getCount(); + + + Log.e("Course count", Integer.toString(x)); + + int i=0; + arrayObj_Class_Course2 = new Class_Course[x]; + if (cursor1.moveToFirst()) { + + do { + Class_Course innerObj_Class_CourseList = new Class_Course(); + innerObj_Class_CourseList.setcourse_id(cursor1.getString(cursor1.getColumnIndex("CID"))); + innerObj_Class_CourseList.setcourse_name(cursor1.getString(cursor1.getColumnIndex("CName"))); + Log.e("Courselist",(cursor1.getString(cursor1.getColumnIndex("CID")))); + + arrayObj_Class_Course2[i]=innerObj_Class_CourseList; + i++; + } while (cursor1.moveToNext()); + }//if ends + + + + db1.close(); + if(x>0) { + // ArrayAdapter dataAdapter = new ArrayAdapter(getApplicationContext(), android.R.layout.simple_spinner_item, arrayObj_Class_Fellowship2); + + dataAdapter_course = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_Course2); + // dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_course.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_course.setAdapter(dataAdapter_course); + } + + } + + + public void Update_Programlist_spinner() + { + + SQLiteDatabase db1 = this.openOrCreateDatabase("LeadEditProfileDB", Context.MODE_PRIVATE, null); + db1.execSQL("CREATE TABLE IF NOT EXISTS Programlist(PID VARCHAR,PName VARCHAR);"); + + Cursor cursor1 = db1.rawQuery("SELECT * FROM Programlist", null); + int x = cursor1.getCount(); + + + Log.e("Program count", Integer.toString(x)); + + int i=0; + arrayObj_Class_Program2 = new Class_Program[x]; + if (cursor1.moveToFirst()) { + + do { + Class_Program innerObj_Class_ProgramList = new Class_Program(); + innerObj_Class_ProgramList.setprogram_id(cursor1.getString(cursor1.getColumnIndex("PID"))); + innerObj_Class_ProgramList.setprog_name(cursor1.getString(cursor1.getColumnIndex("PName"))); + Log.e("Courselist",(cursor1.getString(cursor1.getColumnIndex("PID")))); + + arrayObj_Class_Program2[i]=innerObj_Class_ProgramList; + i++; + } while (cursor1.moveToNext()); + }//if ends + + + + db1.close(); + if(x>0) { + // ArrayAdapter dataAdapter = new ArrayAdapter(getApplicationContext(), android.R.layout.simple_spinner_item, arrayObj_Class_Fellowship2); + + dataAdapter_program = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_Program2); + // dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_program.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_program.setAdapter(dataAdapter_program); + } + + } + + + + +//-----DB Create + + + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_main, menu); + MenuItem action_editProfile = menu.findItem(R.id.action_editProfile); + action_editProfile.setVisible(false); + + + //action_editProfile. + + /*MenuItem action_editProfile = menu.findItem(R.id.action_editProfile); + action_editProfile*/ + + //View view = (View) getMenuInflater().inflate(R.menu.menu_main, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + /* if (id == R.id.action_settings) { + return true; + }*/ + + if (id == R.id.action_logout) + { + + editor_LoginTrack = shardprefLoginTrack_obj.edit(); + editor_LoginTrack.putString(PrefID_WhereToGo,config_obj.packagename+"LoginActivity"); + editor_LoginTrack.commit(); + + deleteCache(context); + + + Intent itthomeToLogin = new Intent(EditProfileActivity.this ,LoginActivity.class); + startActivity(itthomeToLogin); + return true; + } + + return super.onOptionsItemSelected(item); + } + + public static void deleteCache(Context context) { + try { + File dir = context.getCacheDir(); + deleteDir(dir); + } catch (Exception e) {} + } + + public static boolean deleteDir(File dir) { + if (dir != null && dir.isDirectory()) { + String[] children = dir.list(); + for (int i = 0; i < children.length; i++) { + boolean success = deleteDir(new File(dir, children[i])); + if (!success) { + return false; + } + } + return dir.delete(); + } else if(dir!= null && dir.isFile()) { + return dir.delete(); + } else { + return false; + } + } + + + + + + + + + + + + + + + + /*private void initProjectTypeSpinner(String projectTypeName) { + final ArrayList projType = new ArrayList(); + + Set projTypeList = hashProjTypeId.keySet(); + + + for(String key: projTypeList){ + projType.add(key); + } + +*//* projType.add("Education"); +projType.add("Health Care"); +projType.add("Sports");*//* + + ArrayAdapter dataAdapter2 = new ArrayAdapter(context, R.layout.simple_spinner_items, projType); +*//**/ + + +// Drop down layout style - list view with radio button + // dataAdapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + +// attaching data adapter to spinner + //spin_projectType.setAdapter(dataAdapter2); +//spin_projectType.getBackground().setColorFilter(getResources().getColor(R.color.colorAccent), PorterDuff.Mode.SRC_ATOP); + + // spin_projectType.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorWhite)); + + /* if(projectTypeName!="" || projectTypeName!=null) { + for (int i = 0; i < spin_projectType.getCount(); i++) { + if (spin_projectType.getItemAtPosition(i).equals(projectTypeName)) { + spin_projectType.setSelection(i); + break; + } + } + } + + } + + *//* + + */ + + + //Compress the image + + + + + + + + + + +}// end of Class diff --git a/app/src/main/java/com/leadcampusapp/EditProfileModel.java b/app/src/main/java/com/leadcampusapp/EditProfileModel.java new file mode 100644 index 0000000..22a8074 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/EditProfileModel.java @@ -0,0 +1,20 @@ +package com.leadcampusapp; + +import java.util.HashMap; + +/** + * Created by Shripad on 07-07-2018. + */ + +public class EditProfileModel { + private HashMap hashMapState; + + public HashMap getHashMapState() { + return hashMapState; + } + + public void setHashMapState(HashMap hashMapState) { + this.hashMapState = hashMapState; + } +} + diff --git a/app/src/main/java/com/leadcampusapp/EditProjectActivity.java b/app/src/main/java/com/leadcampusapp/EditProjectActivity.java new file mode 100644 index 0000000..a24cad5 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/EditProjectActivity.java @@ -0,0 +1,2353 @@ +package com.leadcampusapp; + +import android.annotation.SuppressLint; +import android.app.AlertDialog; +import android.app.DatePickerDialog; +import android.app.Dialog; +import android.app.DialogFragment; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.graphics.Color; +import android.graphics.Typeface; +import android.os.AsyncTask; +import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.AppCompatSpinner; +import android.text.Html; +import android.util.Log; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.MenuItem; +import android.view.View; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.DatePicker; +import android.widget.EditText; +import android.widget.ImageButton; +import android.widget.LinearLayout; +import android.widget.ListView; +import android.widget.ProgressBar; +import android.widget.TableLayout; +import android.widget.TableRow; +import android.widget.TextView; +import android.widget.Toast; + +import org.joda.time.Days; +import org.joda.time.LocalDate; +import org.json.JSONObject; +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.HashMap; +import java.util.List; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +//import com.android.sripad.leadnew_22_6_2018.R; + +public class EditProjectActivity extends AppCompatActivity implements ConnectivityReceiver.ConnectivityReceiverListener{ + + private Context context; + private AppCompatSpinner spin_projectType; + private EditText edt_projectType; + private EditText edt_title; + private EditText edt_noOfBeneficiaries; + private EditText edt_beneficiaries_name; + private EditText edt_objectives; + private EditText edt_currentSituation; + private EditText edt_actionPlan; + private TextView txt_PMComments; + private Button chat_txt; + private Button btn_submit; + + private LinearLayout lnrlyt_projectTypeSpin; + private LinearLayout lnrlyt_projectTypeEdit; + + private Button btn_addMaterial; + private LinearLayout parentLinearLayout; + /* String material[]={"Books","Digital camera","Pen","Mouse","xyz"}; + String cost[]={"100","200","300","400"};*/ + private ArrayList lstMaterialName = new ArrayList(); + private ArrayList lstMaterialCost = new ArrayList(); + + private ArrayList lstMemberName = new ArrayList(); + private ArrayList lstMemberMailId = new ArrayList(); + + private String projectId = null; + private String str_totalCost = null; + private HashMap hashProjTypeId = new HashMap(); + + private int flag=0; + private LinearLayout lnrlyt_edtProject; + + public static final String PREFBook_Stud= "prefbook_stud"; //sharedpreference Book + public static final String PrefID_RegID = "prefid_regid"; // + public static final String PrefID_SName = "prefid_sname"; // + public static final String PrefID_PM_SName = "prefid_pmsname"; // + public static final String PrefID_SLeadID = "prefid_sleadid"; // + public static final String PrefID_PM_SEmailID = "prefid_pm_semailid"; // + public static final String PrefID_SCellNo = "prefid_scellno"; // + + private SharedPreferences shardpref_S_obj; + private String str_leadId,str_RegistrationId; + private EditText edt_placeOfImpl; + private TextView pmcomments_txt; + + static TextView clickstartproject_editdate_tv; + static TextView clickendproject_editdate_tv; + static String yyyyMMdd_startdate = ""; + static String yyyyMMdd_enddate = ""; + + private static TextView editstudent_numberofdays_tv; + static LinearLayout editstudentdays_linearlayout; + + private ImageButton editproject_add_field_button; + private LinearLayout parent_linear_layout1; + List listEdMemberName = new ArrayList(); + List listEdMemberMailId = new ArrayList(); + private String memberMailId; + ArrayList listMemberName = new ArrayList(); + ArrayList listMemberMailId = new ArrayList(); + + String str_add,str_membername,str_membermailid; + + private LinearLayout parent_linearlayout_material; + private ImageButton editproject_addmaterial_ib; + List listEdMaterialCost = new ArrayList(); + List listEdMaterialName = new ArrayList(); + String str_material,str_eachmaterialname,str_eachmaterialcost; + ArrayList listMaterialName = new ArrayList(); + ArrayList listMaterialCost = new ArrayList(); + double grandSum=0; + + EditText mainEdt_Material; + LinearLayout editproject_date_linearlayout,editproject_datelabel_linearlayout; + + private EditText messageET; + private ListView messagesContainer; + private Button sendBtn; + private ChatAdapter adapter; + private ArrayList chatHistory; + String projectStatus; + + static Class_alert_msg obj_class_alert_msg; + static Context static_context1; + + @Override + protected void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_edit_project); + + context = EditProjectActivity.this; + static_context1= EditProjectActivity.this; + + obj_class_alert_msg = new Class_alert_msg(static_context1); + + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + //getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background)); + + + View actionBarView = getSupportActionBar().getCustomView(); + TextView actionBarTV = (TextView) actionBarView.findViewById(R.id.txt_actionBar); + //actionBarTV.setText("Edit Project"); + + + + + + + shardpref_S_obj=this.getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + str_leadId = shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + + Log.d("str_leadId:",str_leadId); + //Toast.makeText(context,"LeadId: "+str_leadId,Toast.LENGTH_LONG).show(); + + shardpref_S_obj.getString(PrefID_RegID, "").trim(); + str_RegistrationId = shardpref_S_obj.getString(PrefID_RegID, "").trim(); + Log.d("str_RegistrationId:",str_RegistrationId); + //Toast.makeText(context,"RegistrationId: "+str_RegistrationId,Toast.LENGTH_LONG).show(); + + + + + spin_projectType = (AppCompatSpinner) findViewById(R.id.spin_projectType); + edt_projectType = (EditText) findViewById(R.id.edt_projectType); + edt_noOfBeneficiaries = (EditText) findViewById(R.id.edt_noOfBeneficiaries); + edt_beneficiaries_name = (EditText) findViewById(R.id.edt_whoareBeneficiaries); + edt_objectives = (EditText) findViewById(R.id.edt_objective); + edt_actionPlan = (EditText) findViewById(R.id.edt_actionplan); + edt_title = (EditText) findViewById(R.id.edt_title); + txt_PMComments = (TextView) findViewById(R.id.txt_PMComments); + chat_txt=(Button) findViewById(R.id.chat_txt); + edt_currentSituation = (EditText) findViewById(R.id.edt_currentSituation); + + edt_placeOfImpl = (EditText) findViewById(R.id.edt_placeOfImpl); + + pmcomments_txt = (TextView) findViewById(R.id.pmcomments_txt); + + btn_submit = (Button) findViewById(R.id.btn_projsubmit); + + chat_txt.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent i=new Intent(EditProjectActivity.this,ChatActivity.class); + i.putExtra("projectStatus",projectStatus); + i.putExtra("projectId",projectId); + i.putExtra("userType","Student"); + startActivity(i); + } + }); + editproject_add_field_button=(ImageButton) findViewById(R.id.editproject_add_field_button); + parent_linear_layout1= (LinearLayout) findViewById(R.id.parent_linear_layout1); + str_add="false"; + + editproject_addmaterial_ib=(ImageButton) findViewById(R.id.editproject_addmaterial_ib); + parent_linearlayout_material= (LinearLayout) findViewById(R.id.parent_linearlayout_material); + str_material="false"; + + + + clickstartproject_editdate_tv = (TextView) findViewById(R.id.clickstartproject_editdate_TV); + clickendproject_editdate_tv = (TextView) findViewById(R.id.clickendproject_editdate_TV); + + editstudent_numberofdays_tv=(TextView)findViewById(R.id.editstudent_numberofdays_tv); + editstudentdays_linearlayout=(LinearLayout)findViewById(R.id.editstudentdays_linearlayout); + + editproject_date_linearlayout=(LinearLayout)findViewById(R.id.editproject_date_linearlayout); + editproject_datelabel_linearlayout=(LinearLayout)findViewById(R.id.editproject_datelabel_linearlayout); + + + lnrlyt_projectTypeSpin = (LinearLayout) findViewById(R.id.lnrlyt_projectTypeSpin); + lnrlyt_projectTypeEdit = (LinearLayout) findViewById(R.id.lnrlyt_projectTypeEdit); + + lnrlyt_edtProject = (LinearLayout) findViewById(R.id.lnrlyt_edtProject); + + + mainEdt_Material = (EditText) findViewById(R.id.edt_materialname); + listEdMaterialName.clear(); + listEdMaterialCost.clear(); + listEdMemberName.clear(); + listEdMemberMailId.clear(); + listMaterialName.clear(); + listMaterialCost.clear(); + listMemberName.clear(); + listMemberMailId.clear(); + + + editproject_add_field_button.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) + { + LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + final View rowView = inflater.inflate(R.layout.field, null); + // Add the new row before the add field button. + parent_linear_layout1.addView(rowView, parent_linear_layout1.getChildCount() - 1); + + + + EditText edt_memberName = (EditText) rowView.findViewById(R.id.edt_memberName); + listEdMemberName.add(edt_memberName); + + final EditText edt_memberMailId = (EditText) rowView.findViewById(R.id.edt_memberMailId); + listEdMemberMailId.add(edt_memberMailId); + + if(str_add.equalsIgnoreCase("true")) + { edt_memberName.setText(str_membername); + edt_memberMailId.setText(str_membermailid); + str_add="false"; + } + + + edt_memberMailId.setOnFocusChangeListener(new View.OnFocusChangeListener() { + @Override + public void onFocusChange(View v, boolean hasFocus) { + if (!hasFocus) { + memberMailId = edt_memberMailId.getText().toString().trim(); + if (memberMailId.length() > 0) { + if (!isValidEmail(memberMailId)) { + edt_memberMailId.setError("Enter correct mail id"); + } + } + } + } + }); + + + Button delete_button_member = (Button) rowView.findViewById(R.id.delete_button_member); + delete_button_member.setOnClickListener(new View.OnClickListener() + { + @Override + public void onClick(View v) { + Log.d("Insidexxx","delete button member"); +/* Log.d("Materialcostxxxxxxxx",edt_materialcost.getText().toString()); + Double removedCost = Double.parseDouble(edt_materialcost.getText().toString()); + grandSum = grandSum - removedCost;*/ + //Log.d("grandsumxxxxx", String.valueOf(grandSum)); + parent_linear_layout1.removeView((View) v.getParent()); + + View rowView = (View) v.getParent(); + final EditText edt_memberMailId = (EditText) rowView.findViewById(R.id.edt_memberMailId); + listEdMemberMailId.remove(edt_memberMailId); + + final EditText edt_memberName = (EditText) rowView.findViewById(R.id.edt_memberName); + listEdMemberName.remove(edt_memberName); + + } + }); + } + }); + + + + editproject_addmaterial_ib.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) + { + LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + final View rowView = inflater.inflate(R.layout.field_material, null); + // Add the new row before the add field button. + parent_linearlayout_material.addView(rowView, parent_linearlayout_material.getChildCount() - 1); + + + EditText edt_materialname = (EditText) rowView.findViewById(R.id.edt_materialname); + listEdMaterialName.add(edt_materialname); + + final EditText edt_materialcost = (EditText) rowView.findViewById(R.id.edt_materialcost); + listEdMaterialCost.add(edt_materialcost); + + + if(str_material.equalsIgnoreCase("true")) + { edt_materialname.setText(str_eachmaterialname); + edt_materialcost.setText(str_eachmaterialcost); + str_material="false"; + } + + + Button delete_button_material = (Button) rowView.findViewById(R.id.delete_button_material); + delete_button_material.setOnClickListener(new View.OnClickListener() + { + @Override + public void onClick(View v) { + Log.d("Insidexxx","delete button member"); +/* Log.d("Materialcostxxxxxxxx",edt_materialcost.getText().toString()); + Double removedCost = Double.parseDouble(edt_materialcost.getText().toString()); + grandSum = grandSum - removedCost;*/ + //Log.d("grandsumxxxxx", String.valueOf(grandSum)); + parent_linearlayout_material.removeView((View) v.getParent()); + + View rowView = (View) v.getParent(); + final EditText edt_materialname = (EditText) rowView.findViewById(R.id.edt_materialname); + listEdMaterialName.remove(edt_materialname); + + final EditText edt_materialcost = (EditText) rowView.findViewById(R.id.edt_materialcost); + listEdMaterialCost.remove(edt_materialcost); + + } + }); + + + + } + }); + + + + + + + + + + + + + + + + + projectStatus = getIntent().getStringExtra("projstatus"); + projectId = getIntent().getStringExtra("projectId"); + + if(projectStatus.equals("approved") || projectStatus.equals("completed") || projectStatus.equals("rejected") || projectStatus.equals("requested")){ + + actionBarTV.setText("View Project Details"); + lnrlyt_projectTypeSpin.setVisibility(View.GONE); + lnrlyt_projectTypeEdit.setVisibility(View.VISIBLE); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); + + btn_submit.setVisibility(View.GONE); + + flag = 0; + + ViewProject viewProject = new ViewProject(context); + viewProject.execute(); + + } + else //pending , reapply, + { + actionBarTV.setText("Edit Project"); + + lnrlyt_projectTypeSpin.setVisibility(View.VISIBLE); + lnrlyt_projectTypeEdit.setVisibility(View.GONE); + + btn_submit.setVisibility(View.VISIBLE); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); + + flag = 1; + + /* edt_projectType.setText("Health Care"); + edt_projectType.setTextSize(15); + edt_title.setText("This is title"); + edt_title.setTextSize(15); + edt_noOfBeneficiaries.setText("100"); + edt_noOfBeneficiaries.setTextSize(15); + edt_objectives.setText("This is objectives"); + edt_objectives.setTextSize(15); + edt_actionPlan.setText("This is Action Plan"); + edt_actionPlan.setTextSize(15);*/ + + getProjectType(); + + btn_submit.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + listMaterialName.clear(); + listMaterialCost.clear(); + for(int i = 0; i < listEdMaterialName.size(); i++){ + String materialName = listEdMaterialName.get(i).getText().toString(); + listMaterialName.add(materialName); + } + if(checkMandatoryFields()) { + + + if(!listEdMaterialCost.equals(null)) + { + + for (int i = 0; i < listEdMaterialCost.size(); i++) { + + if (!listEdMaterialCost.get(i).getText().toString().equals("") && !listEdMaterialCost.get(i).getText().toString().isEmpty() && !listEdMaterialName.get(i).getText().toString().equals("") && !listEdMaterialName.get(i).getText().toString().isEmpty()) { + String materialCost = listEdMaterialCost.get(i).getText().toString(); + listMaterialCost.add(materialCost); + + double sumval = Double.parseDouble(materialCost); + grandSum = grandSum + sumval; + Log.d("Value ", "Val " + materialCost); + } + } + } + + for(int i = 0; i < listEdMemberName.size(); i++) + { + String memberName = listEdMemberName.get(i).getText().toString(); + listMemberName.add(memberName); + } + + + if(!listEdMemberMailId.equals(null)) { + for (int i = 0; i < listEdMemberMailId.size(); i++) { + if (!listEdMemberMailId.get(i).getText().toString().equals("") && !listEdMemberMailId.get(i).getText().toString().isEmpty()) { + String memberMailId = listEdMemberMailId.get(i).getText().toString(); + listMemberMailId.add(memberMailId); + } + } + } + + + + + SubmitProject submitProject = new SubmitProject(context); + submitProject.execute(); + } + } + }); + + /*ViewProject viewProject = new ViewProject(context); + viewProject.execute();*/ + + //initProjectTypeSpinner("Health Care"); + + + } + + + + + + + /* parentLinearLayout = (LinearLayout) findViewById(R.id.parent_linear_layout); + btn_addMaterial = (Button) findViewById(R.id.btn_addMaterial); + btn_addMaterial.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Log.d("insidepppp","onclick"); + LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + final View rowView = inflater.inflate(R.layout.add_material_layout, null); + // Add the new row before the add add_material_layout button. + parentLinearLayout.addView(rowView, parentLinearLayout.getChildCount() - 1); + + } + });*/ + +/* material.add("Books"); + material.add("Digital camera"); + material.add("Pen"); + material.add("Mouse"); + + cost.add("100"); + cost.add("200"); + cost.add("300"); + cost.add("400");*/ + + + + + /* getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true);*/ + + + + + + + clickstartproject_editdate_tv.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + DialogFragment fromdateFragment = new DatePickerFragmentFromDate(); + fromdateFragment.show(getFragmentManager(), "Date Picker"); + + } + }); + + + clickendproject_editdate_tv.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + // settodate(); + DialogFragment dFragment = new DatePickerFragmentEndDate(); + // Show the date picker dialog fragment + dFragment.show(getFragmentManager(), "Date Picker"); + + + } + }); + + + + + + + }// end o Oncreate() + + private void initControls() { + + + } + + private void loadDummyHistory(){ + + chatHistory = new ArrayList(); + + ChatMessage msg = new ChatMessage(); + msg.setId(1); + msg.setMe(false); + msg.setMessage("Hi"); + msg.setDate(DateFormat.getDateTimeInstance().format(new Date())); + chatHistory.add(msg); + ChatMessage msg1 = new ChatMessage(); + msg1.setId(2); + msg1.setMe(false); + msg1.setMessage("How r u doing???"); + msg1.setDate(DateFormat.getDateTimeInstance().format(new Date())); + chatHistory.add(msg1); + + adapter = new ChatAdapter(EditProjectActivity.this, new ArrayList()); + messagesContainer.setAdapter(adapter); + + for(int i=0; i 0) { + if (!isValidEmail(memberMailId)) { + listEdMemberMailId.get(i).setError("Enter correct mail id"); + listEdMemberMailId.get(i).requestFocus(); + bool_membermailid=false; + } + } + } + } + + + + + + if(bool_title&&bool_beneficiaries&&bool_beneficiaryname&&bool_objectives&&bool_actionPlan + &&bool_placeofimplement&&bool_implement&&datevalidationresult1&&datevalidationresult2 + &&bool_actionPlan&&bool_membermailid&&b_materialName ) + { + return true; + } + else{ + return false; + } + + + } + + + + public class SubmitProject extends AsyncTask { + + AlertDialog alertDialog; + //private ProgressBar progressBar; + private ProgressDialog progressDialog; + + SubmitProject (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapPrimitive response = updateProjectDetails(); + + Log.d("Soap response issssss",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + + progressDialog.setMessage("Submitting"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + progressDialog.dismiss(); + + if(result!=null) { + if (result.toString().equals("Error")) { + Toast.makeText(context, "Error occured while saving to database", Toast.LENGTH_LONG).show(); + } else { + Toast.makeText(context, "Project Updated Successfully", Toast.LENGTH_LONG).show(); + Intent ittEditProjToProjStatus = new Intent(EditProjectActivity.this, ProjectDetails.class); + startActivity(ittEditProjToProjStatus); + } + } + //progressBar.setVisibility(View.GONE); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapPrimitive updateProjectDetails() { + String METHOD_NAME = "PSUpdateprojectDetails1"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/PSUpdateprojectDetails1"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + + long projectIds = (long) Integer.valueOf(projectId); + request.addProperty("PDId",projectIds); + Log.d("PDIdssssssxxxx", String.valueOf(projectIds)); + request.addProperty("Lead_Id",str_leadId); + request.addProperty("Title",edt_title.getText().toString()); + Log.d("Titlesssssxxxx",edt_title.getText().toString()); + int themeId = hashProjTypeId.get(spin_projectType.getSelectedItem().toString()); + Log.d("themeidsssssxxxx", String.valueOf(themeId)); + request.addProperty("Theme",String.valueOf(themeId)); + long beneficiaryNo = (long) Integer.valueOf(edt_noOfBeneficiaries.getText().toString()); + Log.d("beneficiaryNosssxxxx", String.valueOf(beneficiaryNo)); + request.addProperty("BeneficiaryNo",beneficiaryNo); + + Log.d("beneficiaryName",edt_beneficiaries_name.getText().toString()); + request.addProperty("Beneficiaries",edt_beneficiaries_name.getText().toString()); + + + Log.d("objectivesxxxxxx",edt_objectives.getText().toString()); + request.addProperty("Objectives",edt_objectives.getText().toString()); + Log.d("actionplansxxxxxx",edt_actionPlan.getText().toString()); + request.addProperty("ActionPlan",edt_actionPlan.getText().toString()); + + request.addProperty("placeofimplimentation",edt_placeOfImpl.getText().toString()); + + request.addProperty("CurrentSituation",edt_currentSituation.getText().toString()); + + + + /* request.addProperty("StartDate",yyyyMMdd_startdate.toString());//string + request.addProperty("EndDate",yyyyMMdd_enddate.toString());//string +*/ + + request.addProperty("StartDate",clickstartproject_editdate_tv.getText().toString());//string + request.addProperty("EndDate",clickendproject_editdate_tv.getText().toString());//string + + + + JSONObject jsonObject = new JSONObject(); + for(int k=0;kstring + + JSONObject jsonObjectMember = new JSONObject(); + + for(int k=0;kstring + + + request.addProperty("Student_Id",str_RegistrationId); // string + + + float float_grandsum= (float) grandSum; + int int_grandSum= (int) grandSum; + request.addProperty("Budget",int_grandSum); + //float but even though we are sending int but its accepting the result + //6july2019 12:36pm + + + + + + Log.d("Requestisxxxxx",request.toString()); + + + //users.ad + //request.add + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Projects.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + // Log.d("soap response1xxxx",envelope.getResponse().toString()); + + + //SoapObject response = (SoapObject) envelope.getResponse(); + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + Log.e("soapupdateProjectDtlsss",envelope.getResponse().toString()); + + //return null; + + return response; + + }catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + + } + + + public class ViewProject extends AsyncTask { + + AlertDialog alertDialog; + private ProgressBar progressBar; + private ProgressDialog progressDialog; + + ViewProject (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapObject response = getProjectDetails(); + + Log.d("Soap response is",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + progressDialog.setMessage("Loading"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapObject result) + { + SoapPrimitive S_ProjectTitle, S_ThemeName, S_BeneficiaryNo, S_Objective, S_actionPlan, S_ManagerComments, S_MaterialName, S_MaterialCost, S_MemberName , S_MemberMailId ,S_TotalCost, S_Status, S_Beneficiarieslist,S_PlaceOfImplement,S_CurrentSituation; + Object O_ProjectTitle, O_ThemeName, O_BeneficiaryNo, O_Objective, O_actionPlan, O_ManagerComments, O_MaterialName, O_MaterialCost, O_MemberName, O_MemberMailId,O_TotalCost, O_Status,O_BeneficiariesList,O_PlaceOfImplement,O_CurrentSituation; + String str_ProjectTitle = null, str_ThemeName = null, str_BeneficiaryNo = null, str_Objective = null, str_actionPlan = null, str_ManagerComments = null, str_materialName = null, str_materialCost = null, str_memberName=null, str_memberMailId = null, str_status = null, str_beneficiariesList = null, str_placeOfImpl = null, str_currentSituation = null; + + SoapPrimitive S_startdate,S_enddate; + Object O_startdate,O_enddate = null; + String str_startdate,str_enddate; + + Log.d("Resultissssss",result.toString()); + + + + O_Status = result.getProperty("status"); + if (!O_Status.toString().equals("anyType") && !O_Status.toString().equals(null) && !O_Status.toString().equals("anyType{}")) { + S_Status = (SoapPrimitive) result.getProperty("status"); + Log.d("Statusssssssss", S_Status.toString()); + str_status = S_Status.toString(); + } + + if (str_status.equalsIgnoreCase("success")) + { + if (flag == 0) // for approved completed rejected requested + { + O_ProjectTitle = result.getProperty("Title"); + if (!O_ProjectTitle.toString().equals("anyType") && !O_ProjectTitle.toString().equals(null) && !O_ProjectTitle.toString().equals("anyType{}")) { + S_ProjectTitle = (SoapPrimitive) result.getProperty("Title"); + Log.d("Titlesssssss", S_ProjectTitle.toString()); + str_ProjectTitle = S_ProjectTitle.toString(); + } + + O_ThemeName = result.getProperty("ThemeName"); + if (!O_ThemeName.toString().equals("anyType") && !O_ThemeName.toString().equals(null) && !O_ThemeName.toString().equals("anyType{}")) { + S_ThemeName = (SoapPrimitive) result.getProperty("ThemeName"); + Log.d("ThemeNamessss", S_ThemeName.toString()); + str_ThemeName = S_ThemeName.toString(); + } + + O_BeneficiaryNo = result.getProperty("BeneficiaryNo"); + if (!O_BeneficiaryNo.toString().equals("anyType") && !O_BeneficiaryNo.toString().equals(null) && !O_BeneficiaryNo.toString().equals("anyType{}")) { + S_BeneficiaryNo = (SoapPrimitive) result.getProperty("BeneficiaryNo"); + Log.d("BeneficiaryNo", S_BeneficiaryNo.toString()); + str_BeneficiaryNo = S_BeneficiaryNo.toString(); + } + + if(result.toString().contains("BeneficiariesList")) { + O_BeneficiariesList = result.getProperty("BeneficiariesList"); + if (!O_BeneficiariesList.toString().equals("anyType") && !O_BeneficiariesList.toString().equals(null) && !O_BeneficiariesList.toString().equals("anyType{}")) { + S_Beneficiarieslist = (SoapPrimitive) result.getProperty("BeneficiariesList"); + Log.d("Beneficiarieslist", S_Beneficiarieslist.toString()); + str_beneficiariesList = S_Beneficiarieslist.toString(); + } + } + + + if(result.toString().contains("Placeofimplement")) { + + O_PlaceOfImplement = result.getProperty("Placeofimplement"); + if (!O_PlaceOfImplement.toString().equals("anyType") && !O_PlaceOfImplement.toString().equals(null) && !O_PlaceOfImplement.toString().equals("anyType{}")) { + S_PlaceOfImplement = (SoapPrimitive) result.getProperty("Placeofimplement"); + Log.d("PlaceOfImplementation", S_PlaceOfImplement.toString()); + str_placeOfImpl = S_PlaceOfImplement.toString(); + } + } + + + + + O_Objective = result.getProperty("Objectives"); + if (!O_Objective.toString().equals("anyType") && !O_Objective.toString().equals(null) && !O_Objective.toString().equals("anyType{}")) { + S_Objective = (SoapPrimitive) result.getProperty("Objectives"); + Log.d("Objectivess", S_Objective.toString()); + str_Objective = S_Objective.toString(); + } + + O_actionPlan = result.getProperty("ActionPlan"); + if (!O_actionPlan.toString().equals("anyType") && !O_actionPlan.toString().equals(null) && !O_actionPlan.toString().equals("anyType{}")) { + S_actionPlan = (SoapPrimitive) result.getProperty("ActionPlan"); + Log.d("ActionPlansss", S_actionPlan.toString()); + str_actionPlan = S_actionPlan.toString(); + } + + O_ManagerComments = result.getProperty("ManagerComments"); + if (!O_ManagerComments.toString().equals("anyType") && !O_ManagerComments.toString().equals(null) && !O_ManagerComments.toString().equals("anyType{}")) { + S_ManagerComments = (SoapPrimitive) result.getProperty("ManagerComments"); + Log.d("Manager Comments", S_ManagerComments.toString()); + str_ManagerComments = S_ManagerComments.toString(); + }else{ + Log.d("Insideelse","EditProjectActivity"); + pmcomments_txt.setVisibility(View.GONE); + txt_PMComments.setVisibility(View.GONE); + } + + O_TotalCost = result.getProperty("Amount"); + if (!O_TotalCost.toString().equals("anyType") && !O_TotalCost.toString().equals(null) && !O_TotalCost.toString().equals("anyType{}")) { + S_TotalCost = (SoapPrimitive) result.getProperty("Amount"); + Log.d("Total Cost", S_TotalCost.toString()); + str_totalCost = S_TotalCost.toString(); + } + + O_CurrentSituation = result.getProperty("CurrentSituation"); + if (!O_CurrentSituation.toString().equals("anyType") && !O_CurrentSituation.toString().equals(null) && !O_CurrentSituation.toString().equals("anyType{}")) { + S_CurrentSituation = (SoapPrimitive) result.getProperty("CurrentSituation"); + Log.d("CurrentSituation", S_CurrentSituation.toString()); + str_currentSituation = S_CurrentSituation.toString(); + }else{ + str_currentSituation = " "; + } + + + + + + + O_startdate= result.getProperty("ProjectStartDate"); + Log.e("startDate",O_startdate.toString()); + if (O_startdate.toString().equals("anyType{}")||O_startdate.toString().equals("0000-00-00")) { + // S_startdate = O_startdate; + + // Log.e("startDate",S_startdate.toString()); + + str_startdate = "Click for Calendar"; + }else{ + + + str_startdate = O_startdate.toString(); + } + + // Toast.makeText(context,""+O_startdate.toString(),Toast.LENGTH_LONG).show(); + clickstartproject_editdate_tv.setText(str_startdate.toString()); + + + O_enddate= result.getProperty("ProjectEndDate"); + if (O_enddate.toString().equals("anyType{}")||O_enddate.toString().equals("0000-00-00")) { + /* S_enddate = (SoapPrimitive) result.getProperty("ProjectEndDate"); + + Log.e("endDate",S_enddate.toString());*/ + str_enddate = "Click for Calendar"; + }else{ + str_enddate = O_enddate.toString(); + } + clickendproject_editdate_tv.setText(str_enddate.toString()); + + + if(str_startdate.toString().equals("anyType{}") + || str_startdate.toString().equals(null) + ||str_startdate.toString().equals("0000-00-00") + ||str_startdate.toString().equalsIgnoreCase("Click for Calendar") + ||str_enddate.toString().equals("anyType{}") + ||str_enddate.toString().equals(null) + ||str_enddate.toString().equals("0000-00-00") + ||str_enddate.toString().equalsIgnoreCase("Click for Calendar")) + { + editstudentdays_linearlayout.setVisibility(View.GONE); + editproject_date_linearlayout.setVisibility(View.GONE); + editproject_datelabel_linearlayout.setVisibility(View.GONE); + + + }else + { + + + try{ + int days_count = Days.daysBetween(new LocalDate(str_startdate), new LocalDate(str_enddate)).getDays(); + int int_days=days_count+1; + Log.e("days",String.valueOf(int_days)); + editstudent_numberofdays_tv.setText("Number of Days: "+String.valueOf(int_days)); + }catch(Throwable t) + { + editstudent_numberofdays_tv.setText(" "); + } + } + + + + + + + + + + + + edt_projectType.setText(str_ThemeName); + edt_projectType.setFocusable(false); + edt_projectType.setInputType(0); + edt_projectType.setTextSize(15); + + edt_title.setText(str_ProjectTitle); + edt_title.setFocusable(false); + edt_title.setInputType(0); + edt_title.setTextSize(15); + + edt_noOfBeneficiaries.setText(str_BeneficiaryNo); + edt_noOfBeneficiaries.setFocusable(false); + edt_noOfBeneficiaries.setInputType(0); + edt_noOfBeneficiaries.setTextSize(15); + + + edt_beneficiaries_name.setText(str_beneficiariesList); + edt_beneficiaries_name.setFocusable(false); + edt_beneficiaries_name.setInputType(0); + edt_beneficiaries_name.setTextSize(15); + + edt_placeOfImpl.setText(str_placeOfImpl); + edt_placeOfImpl.setFocusable(false); + edt_placeOfImpl.setInputType(0); + edt_placeOfImpl.setTextSize(15); + + + + edt_objectives.setText(str_Objective); + edt_objectives.setFocusable(false); + edt_objectives.setInputType(0); + edt_objectives.setTextSize(15); + + edt_actionPlan.setText(str_actionPlan); + edt_actionPlan.setFocusable(false); + edt_actionPlan.setInputType(0); + edt_actionPlan.setTextSize(15); + + edt_currentSituation.setText(str_currentSituation); + edt_currentSituation.setFocusable(false); + edt_currentSituation.setInputType(0); + edt_currentSituation.setTextSize(15); + + txt_PMComments.setText(str_ManagerComments); + + if(result.toString().contains("Members")) + { + SoapObject memberList = (SoapObject) result.getProperty("Members"); + for (int i = 0; i < memberList.getPropertyCount(); i++) + { + SoapObject vmMemberlist = (SoapObject) memberList.getProperty(i); + + O_MemberName = vmMemberlist.getProperty("MemberName"); + if (!O_MemberName.toString().equals("anyType{}") && !O_MemberName.toString().equals(null) && !O_MemberName.toString().equals("anyType")) { + S_MemberName = (SoapPrimitive) vmMemberlist.getProperty("MemberName"); + Log.d("MemberNamess", S_MemberName.toString()); + str_memberName = S_MemberName.toString(); + + lstMemberName.add(str_memberName); + } + + O_MemberMailId = vmMemberlist.getProperty("MemberEmail"); + if (!O_MemberMailId.toString().equals("anyType") && !O_MemberMailId.toString().equals(null) && !O_MemberMailId.toString().equals("anyType{}")) { + S_MemberMailId = (SoapPrimitive) vmMemberlist.getProperty("MemberEmail"); + Log.d("MemberMailId", S_MemberMailId.toString()); + str_memberMailId = S_MemberMailId.toString(); + + lstMemberMailId.add(str_memberMailId); + } + } + initMembers(); + + } + + SoapObject materialList = (SoapObject) result.getProperty("materials"); + for (int i = 0; i < materialList.getPropertyCount(); i++) { + SoapObject vmmateriallist = (SoapObject) materialList.getProperty(i); + + O_MaterialName = vmmateriallist.getProperty("MeterialName"); + if (!O_MaterialName.toString().equals("anyType{}") && !O_MaterialName.toString().equals(null)) { + S_MaterialName = (SoapPrimitive) vmmateriallist.getProperty("MeterialName"); + Log.d("MaterialNamesssss", S_MaterialName.toString()); + str_materialName = S_MaterialName.toString(); + + lstMaterialName.add(str_materialName); + } + + O_MaterialCost = vmmateriallist.getProperty("MeterialCost"); + if (!O_MaterialCost.toString().equals("anyType") && !O_MaterialCost.toString().equals(null) && !O_MaterialCost.toString().equals("anyType{}")) { + S_MaterialCost = (SoapPrimitive) vmmateriallist.getProperty("MeterialCost"); + Log.d("MaterialCostsssss", S_MaterialCost.toString()); + str_materialCost = S_MaterialCost.toString(); + + lstMaterialCost.add(str_materialCost); + } + } + initMaterials(); + + + + + } else + + { + + Log.d("Inside", "elsexxxxxx"); + + Log.d("Resultssssss", result.toString()); + + O_ProjectTitle = result.getProperty("Title"); + if (!O_ProjectTitle.toString().equals("anyType{}") && !O_ProjectTitle.toString().equals(null)) { + S_ProjectTitle = (SoapPrimitive) result.getProperty("Title"); + Log.d("Titlesssssss", S_ProjectTitle.toString()); + str_ProjectTitle = S_ProjectTitle.toString(); + } + + O_ThemeName = result.getProperty("ThemeName"); + if (!O_ThemeName.toString().equals("anyType{}") && !O_ThemeName.toString().equals(null)) { + S_ThemeName = (SoapPrimitive) result.getProperty("ThemeName"); + Log.d("ThemeNamessss", S_ThemeName.toString()); + str_ThemeName = S_ThemeName.toString(); + } + + O_BeneficiaryNo = result.getProperty("BeneficiaryNo"); + if (!O_BeneficiaryNo.toString().equals("anyType{}") && !O_BeneficiaryNo.toString().equals(null)) { + S_BeneficiaryNo = (SoapPrimitive) result.getProperty("BeneficiaryNo"); + Log.d("BeneficiaryNo", S_BeneficiaryNo.toString()); + str_BeneficiaryNo = S_BeneficiaryNo.toString(); + } + + if(result.toString().contains("BeneficiariesList")) { + O_BeneficiariesList = result.getProperty("BeneficiariesList"); + if (!O_BeneficiariesList.toString().equals("anyType") && !O_BeneficiariesList.toString().equals(null) && !O_BeneficiariesList.toString().equals("anyType{}")) { + S_Beneficiarieslist = (SoapPrimitive) result.getProperty("BeneficiariesList"); + Log.d("Beneficiarieslist", S_Beneficiarieslist.toString()); + str_beneficiariesList = S_Beneficiarieslist.toString(); + } + } + + if(result.toString().contains("Placeofimplement")) { + O_PlaceOfImplement = result.getProperty("Placeofimplement"); + if (!O_PlaceOfImplement.toString().equals("anyType") && !O_PlaceOfImplement.toString().equals(null) && !O_PlaceOfImplement.toString().equals("anyType{}")) { + S_PlaceOfImplement = (SoapPrimitive) result.getProperty("Placeofimplement"); + Log.d("PlaceOfImplementation", S_PlaceOfImplement.toString()); + str_placeOfImpl = S_PlaceOfImplement.toString(); + } + } + + + + + + O_Objective = result.getProperty("Objectives"); + if (!O_Objective.toString().equals("anyType{}") && !O_Objective.toString().equals(null)) { + S_Objective = (SoapPrimitive) result.getProperty("Objectives"); + Log.d("Objectivess", S_Objective.toString()); + str_Objective = S_Objective.toString(); + } + + O_actionPlan = result.getProperty("ActionPlan"); + if (!O_actionPlan.toString().equals("anyType{}") && !O_actionPlan.toString().equals(null)) { + S_actionPlan = (SoapPrimitive) result.getProperty("ActionPlan"); + Log.d("ActionPlansss", S_actionPlan.toString()); + str_actionPlan = S_actionPlan.toString(); + } + + O_ManagerComments = result.getProperty("ManagerComments"); + if (!O_ManagerComments.toString().equals("anyType{}") && !O_ManagerComments.toString().equals(null)) { + S_ManagerComments = (SoapPrimitive) result.getProperty("ManagerComments"); + Log.d("Manager Comments", S_ManagerComments.toString()); + str_ManagerComments = S_ManagerComments.toString(); + }else{ + Log.d("Insideelse","EditProjectActivity"); + pmcomments_txt.setVisibility(View.GONE); + txt_PMComments.setVisibility(View.GONE); + } + + O_TotalCost = result.getProperty("Amount"); + if (!O_TotalCost.toString().equals("anyType{}") && !O_TotalCost.toString().equals(null)) { + S_TotalCost = (SoapPrimitive) result.getProperty("Amount"); + Log.d("Total Cost", S_TotalCost.toString()); + str_totalCost = S_TotalCost.toString(); + } + + O_CurrentSituation = result.getProperty("CurrentSituation"); + if (!O_CurrentSituation.toString().equals("anyType") && !O_CurrentSituation.toString().equals(null) && !O_CurrentSituation.toString().equals("anyType{}")) { + S_CurrentSituation = (SoapPrimitive) result.getProperty("CurrentSituation"); + Log.d("CurrentSituationxxxx", S_CurrentSituation.toString()); + str_currentSituation = S_CurrentSituation.toString(); + }else{ + str_currentSituation = " "; + } + + + + O_startdate= result.getProperty("ProjectStartDate"); + Log.e("startDate",O_startdate.toString()); + if (O_startdate.toString().equals("anyType{}")||O_startdate.toString().equals("0000-00-00")) { + + // S_startdate = (SoapPrimitive) result.getProperty("ProjectStartDate"); + //Log.e("startDate",S_startdate.toString()); + + + str_startdate = "Click for Calendar"; + + }else{ + + str_startdate = O_startdate.toString(); + } + + // Toast.makeText(context,""+O_startdate.toString(),Toast.LENGTH_LONG).show(); + clickstartproject_editdate_tv.setText(str_startdate.toString()); + + + O_enddate= result.getProperty("ProjectEndDate"); + if (O_enddate.toString().equals("anyType{}")||O_enddate.toString().equals("0000-00-00")) + { + /*S_enddate = (SoapPrimitive) result.getProperty("ProjectEndDate"); + Log.e("endDate",S_enddate.toString());*/ + + str_enddate = "Click for Calendar"; + editproject_date_linearlayout.setVisibility(View.GONE); + }else{ + str_enddate = O_enddate.toString(); + yyyyMMdd_enddate=O_enddate.toString(); + + } + clickendproject_editdate_tv.setText(str_enddate.toString()); + + + + + //vijay + + + + if(!str_startdate.toString().equals("anyType{}") + && !str_startdate.toString().equals(null) && + !str_startdate.toString().equals("0000-00-00") + && !str_startdate.toString().equals("Click for Calendar") + &&!str_enddate.toString().equals("anyType{}") + && !str_enddate.toString().equals(null) && + !str_enddate.toString().equals("0000-00-00") + && !str_enddate.toString().equals("Click for Calendar")) + { + try{ + int days_count = Days.daysBetween(new LocalDate(str_startdate), new LocalDate(str_enddate)).getDays(); + int int_days=days_count+1; + Log.e("days",String.valueOf(int_days)); + editstudent_numberofdays_tv.setText("Number of Days: "+String.valueOf(int_days)); + }catch(Throwable t) + { + editstudent_numberofdays_tv.setText(" "); + } + + }else + { editstudentdays_linearlayout.setVisibility(View.GONE); + + } + + + + + + + //vijay + + edt_currentSituation.setText(str_currentSituation); + edt_currentSituation.setTextSize(15); + + + /* edt_projectType.setText(str_ThemeName); + edt_projectType.setFocusable(false); + edt_projectType.setInputType(0); + edt_projectType.setTextSize(15);*/ + + + edt_title.setText(str_ProjectTitle); + edt_title.setTextSize(15); + + edt_noOfBeneficiaries.setText(str_BeneficiaryNo); + edt_noOfBeneficiaries.setTextSize(15); + + edt_beneficiaries_name.setText(str_beneficiariesList); + edt_beneficiaries_name.setTextSize(15); + + edt_placeOfImpl.setText(str_placeOfImpl); + edt_placeOfImpl.setTextSize(15); + + edt_objectives.setText(str_Objective); + edt_objectives.setTextSize(15); + + edt_actionPlan.setText(str_actionPlan); + edt_actionPlan.setTextSize(15); + + txt_PMComments.setText(str_ManagerComments); + + if(result.toString().contains("Members")) + { + SoapObject memberList = (SoapObject) result.getProperty("Members"); + for (int i = 0; i < memberList.getPropertyCount(); i++) + { + SoapObject vmMemberlist = (SoapObject) memberList.getProperty(i); + + O_MemberName = vmMemberlist.getProperty("MemberName"); + if (!O_MemberName.toString().equals("anyType{}") && !O_MemberName.toString().equals(null)) { + S_MemberName = (SoapPrimitive) vmMemberlist.getProperty("MemberName"); + Log.d("MemberNamess", S_MemberName.toString()); + str_memberName = S_MemberName.toString(); + + lstMemberName.add(str_memberName); + } + + O_MemberMailId = vmMemberlist.getProperty("MemberEmail"); + if (!O_MemberMailId.toString().equals("anyType") && !O_MemberMailId.toString().equals(null) && !O_MemberMailId.toString().equals("anyType{}")) { + S_MemberMailId = (SoapPrimitive) vmMemberlist.getProperty("MemberEmail"); + Log.d("MemberMailId", S_MemberMailId.toString()); + str_memberMailId = S_MemberMailId.toString(); + + lstMemberMailId.add(str_memberMailId); + } + } + initMembers(); + + + }// + + SoapObject materialList = (SoapObject) result.getProperty("materials"); + for (int i = 0; i < materialList.getPropertyCount(); i++) { + SoapObject vmmateriallist = (SoapObject) materialList.getProperty(i); + + O_MaterialName = vmmateriallist.getProperty("MeterialName"); + if (!O_MaterialName.toString().equals("anyType{}") && !O_MaterialName.toString().equals(null)) { + S_MaterialName = (SoapPrimitive) vmmateriallist.getProperty("MeterialName"); + Log.d("MaterialNamesssss", S_MaterialName.toString()); + str_materialName = S_MaterialName.toString(); + + lstMaterialName.add(str_materialName); + } + + O_MaterialCost = vmmateriallist.getProperty("MeterialCost"); + if (!O_MaterialCost.toString().equals("anyType") && !O_MaterialCost.toString().equals(null) && !O_MaterialCost.toString().equals("anyType{}")) { + S_MaterialCost = (SoapPrimitive) vmmateriallist.getProperty("MeterialCost"); + Log.d("MaterialCostsssss", S_MaterialCost.toString()); + str_materialCost = S_MaterialCost.toString(); + + lstMaterialCost.add(str_materialCost); + } + } + + + initProjectTypeSpinner(str_ThemeName); + + + initMaterials(); + } + + } + else{ + Toast.makeText(context,str_status,Toast.LENGTH_LONG).show(); + lnrlyt_edtProject.setVisibility(View.GONE); + } + + //progressBar.setVisibility(View.GONE); + progressDialog.dismiss(); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapObject getProjectDetails() + { + String METHOD_NAME = "PSGetProjectDetails"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/PSGetProjectDetails"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + Log.e("leadID pdid:",""+str_leadId+","+projectId); + request.addProperty("leadId",str_leadId); + request.addProperty("PDId",projectId); + + Log.d("projectIdsssss",projectId); + Log.d("LeadIDsss",str_leadId); + //users.ad + //request.add + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Projects.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + // Log.d("soap response1xxxx",envelope.getResponse().toString()); + + + SoapObject response = (SoapObject) envelope.getResponse(); + Log.e("soap responseyyyyyyy",response.toString()); + + //return null; + + return response; + + } + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + }catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + } + return null; + + } + + + + + private void initProjectTypeSpinner(String projectTypeName) { + final ArrayList projType = new ArrayList(); + + Set projTypeList = hashProjTypeId.keySet(); + + + for(String key: projTypeList){ + projType.add(key); + } + +/* projType.add("Education"); + projType.add("Health Care"); + projType.add("Sports");*/ + + ArrayAdapter dataAdapter2 = new ArrayAdapter(context, R.layout.simple_spinner_items, projType); + + + + // Drop down layout style - list view with radio button + //dataAdapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter2.setDropDownViewResource(R.layout.spinnercustomstyle); + + // attaching data adapter to spinner + spin_projectType.setAdapter(dataAdapter2); + //spin_projectType.getBackground().setColorFilter(getResources().getColor(R.color.colorAccent), PorterDuff.Mode.SRC_ATOP); + + //spin_projectType.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorWhite)); + + if(projectTypeName!="" || projectTypeName!=null) { + for (int i = 0; i < spin_projectType.getCount(); i++) { + if (spin_projectType.getItemAtPosition(i).equals(projectTypeName)) { + spin_projectType.setSelection(i); + break; + } + } + } + + } + + + public void initMaterials() + { + TableLayout stk = (TableLayout) findViewById(R.id.table_material); + TableRow tbrow0 = new TableRow(this); + TextView tv0 = new TextView(this); + String matrl_name = " Material Name "; + tv0.setText(Html.fromHtml(matrl_name)); + tv0.setTextColor(Color.BLACK); + tv0.setGravity(Gravity.CENTER); + tv0.setTypeface(null, Typeface.BOLD); + tv0.setPadding(5, 10, 5, 5); + tbrow0.addView(tv0); + TextView tv1 = new TextView(this); + String matrl_cost = " Cost "; + tv1.setText(Html.fromHtml(matrl_cost)); + tv1.setTextColor(Color.BLACK); + tv1.setGravity(Gravity.CENTER); + tv1.setTypeface(null, Typeface.BOLD); + tv1.setPadding(50, 10, 0, 5); + tbrow0.addView(tv1); + stk.addView(tbrow0); + for (int i = 0; i < lstMaterialName.size() && i < lstMaterialCost.size(); i++) + { + //cost + str_material="true"; + str_eachmaterialname=lstMaterialName.get(i).toString(); + str_eachmaterialcost=lstMaterialCost.get(i).toString(); + + editproject_addmaterial_ib.performClick(); + + + + TableRow tbrow = new TableRow(this); + TextView t1v = new TextView(this); + t1v.setText(lstMaterialName.get(i)); + t1v.setTextColor(Color.BLACK); + t1v.setGravity(Gravity.LEFT); + t1v.setPadding(5, 5, 5, 5); + tbrow.addView(t1v); + + TextView t2v = new TextView(this); + t2v.setText(lstMaterialCost.get(i)); + t2v.setTextColor(Color.BLACK); + t2v.setGravity(Gravity.CENTER); + t2v.setPadding(50, 5, 0, 5); + tbrow.addView(t2v); + + stk.addView(tbrow); + } + + TableRow tbrow = new TableRow(this); + TextView t1v = new TextView(this); + t1v.setText("Total"); + t1v.setTypeface(null, Typeface.BOLD); + t1v.setTextColor(Color.BLACK); + t1v.setGravity(Gravity.LEFT); + t1v.setPadding(5, 5, 5, 5); + tbrow.addView(t1v); + + TextView t2v = new TextView(this); + t2v.setText(str_totalCost); + t2v.setTypeface(null, Typeface.BOLD); + t2v.setTextColor(Color.BLACK); + t2v.setGravity(Gravity.CENTER); + t2v.setPadding(50, 5, 0, 5); + tbrow.addView(t2v); + + stk.addView(tbrow); + } + + + public void initMembers() { + TableLayout stk = (TableLayout) findViewById(R.id.table_teamMember); + TableRow tbrow0 = new TableRow(this); + TextView tv0 = new TextView(this); + String member_name = " Member Name "; + tv0.setText(Html.fromHtml(member_name)); + tv0.setTextColor(Color.BLACK); + tv0.setGravity(Gravity.CENTER); + tv0.setTypeface(null, Typeface.BOLD); + tv0.setPadding(5, 10, 5, 5); + tbrow0.addView(tv0); + TextView tv1 = new TextView(this); + String member_MailId = " Mail Id "; + tv1.setText(Html.fromHtml(member_MailId)); + tv1.setTextColor(Color.BLACK); + tv1.setGravity(Gravity.CENTER); + tv1.setTypeface(null, Typeface.BOLD); + tv1.setPadding(50, 10, 0, 5); + tbrow0.addView(tv1); + stk.addView(tbrow0); + for (int i = 0; i < lstMemberName.size() && i < lstMemberMailId.size(); i++) + { + str_add="true"; + str_membername=lstMemberName.get(i).toString(); + str_membermailid=lstMemberMailId.get(i).toString(); + //vijay + editproject_add_field_button.performClick(); + + + TableRow tbrow = new TableRow(this); + TextView t1v = new TextView(this); + t1v.setText(lstMemberName.get(i)); + t1v.setTextColor(Color.BLACK); + t1v.setGravity(Gravity.LEFT); + t1v.setPadding(5, 5, 5, 5); + tbrow.addView(t1v); + + TextView t2v = new TextView(this); + t2v.setText(lstMemberMailId.get(i)); + t2v.setTextColor(Color.BLACK); + t2v.setGravity(Gravity.CENTER); + t2v.setPadding(50, 5, 0, 5); + tbrow.addView(t2v); + + stk.addView(tbrow); + + + } + + } + + + + private void getProjectType() + { + ProjectType projType = new ProjectType(context); + projType.execute(); + } + + public class ProjectType extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + private ProgressBar progressBar; + private ProgressDialog progressDialog; + + ProjectType (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(Void... params) + { + //String versionCode = (String) params[2]; + String METHOD_NAME = "GetThemeList"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetThemeList"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Login.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapObject response = (SoapObject) envelope.getResponse(); + Log.d("soap responseyyyyyyy",response.toString()); + + return response; + + }catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.d("exception outside",t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + + return null; + + + //Log.d("Soap response is",response.toString()); + + //return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + + progressDialog.setMessage("Loading"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapObject result) { + //progressBar.setVisibility(View.GONE); + + progressDialog.dismiss(); + + + String finalResult = result.toString(); + String finals = finalResult.replace("anyType",""); + Log.d("Finals is",finals); + + ArrayList projectTypeList = new ArrayList(); + + Log.d("finalResultsssss",finalResult); + + for(int i=0;i < result.getPropertyCount();i++) + { + SoapObject list = (SoapObject) result.getProperty(i); + SoapPrimitive S_ThemeId,S_ThemeName,S_Status; + Object O_ThemeId,O_ThemeName,O_Status; + + int projectTypeId=0; + + String str_ProjectTypeId=null,str_ProjectType=null,str_status=null; + + O_ThemeId = list.getProperty("ThemeId"); + if(!O_ThemeId.toString().equals("anyType") && !O_ThemeId.toString().equals(null) && !O_ThemeId.toString().equals("anyType{}")){ + S_ThemeId = (SoapPrimitive) list.getProperty("ThemeId"); + Log.d("ProjectId",S_ThemeId.toString()); + str_ProjectTypeId = O_ThemeId.toString(); + projectTypeId = Integer.valueOf(str_ProjectTypeId); + } + + O_ThemeName = list.getProperty("ThemeName"); + if(!O_ThemeName.toString().equals("anyType") && !O_ThemeName.toString().equals(null) && !O_ThemeName.toString().equals("anyType{}")) + { + S_ThemeName = (SoapPrimitive) list.getProperty("ThemeName"); + Log.d("ProjectType Name",S_ThemeName.toString()); + str_ProjectType = O_ThemeName.toString(); + + projectTypeList.add(str_ProjectType); + + hashProjTypeId.put(str_ProjectType,projectTypeId); + } + + } + + ViewProject viewProject = new ViewProject(context); + viewProject.execute(); + + //setProjectTypeSpinner(projectTypeList); + + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + + +/* @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_main, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + + if (id == R.id.action_editProfile) { + Intent ittProjDtlsToEditProfile = new Intent(ProjectDetails.this ,EditProfileActivity.class); + startActivity(ittProjDtlsToEditProfile); + return true; + } + + if (id == R.id.action_logout) { + Intent ittProjDtlsToLogin = new Intent(ProjectDetails.this ,LoginActivity.class); + startActivity(ittProjDtlsToLogin); + return true; + } + + if (id == android.R.id.home) { + Intent ittProjDtlsToHome = new Intent(ProjectDetails.this ,HomeActivity.class); + startActivity(ittProjDtlsToHome); + return true; + } + + + + return super.onOptionsItemSelected(item); + }*/ + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + if (id == android.R.id.home) { + Intent ittEditProjToProjDtls = new Intent(EditProjectActivity.this ,ProjectDetails.class); + startActivity(ittEditProjToProjDtls); + return true; + } + + + + return super.onOptionsItemSelected(item); + } + + +//-------------------------------date-------------------------------- + + // start of from date + @SuppressLint("ValidFragment") + public static class DatePickerFragmentFromDate extends DialogFragment + implements DatePickerDialog.OnDateSetListener{ + + @Override + public Dialog onCreateDialog(Bundle savedInstanceState) { + final Calendar c = Calendar.getInstance(); + int year = c.get(Calendar.YEAR); + int month = c.get(Calendar.MONTH); + int day = c.get(Calendar.DAY_OF_MONTH); + + + /*return new DatePickerDialog(getActivity(),(DatePickerDialog.OnDateSetListener) + getActivity(), year, month, day);*/ + + + + + + DatePickerDialog dialog = new DatePickerDialog(getActivity(), + this, year, month, day); + + + /* dialog.getDatePicker().setMinDate(c.getTimeInMillis()); + dialog.getDatePicker().setMaxDate(c.getTimeInMillis()); +*/ + + /* dialog.getDatePicker().setMinDate(c.getTimeInMillis()); + c.add(Calendar.DAY_OF_MONTH,150); + dialog.getDatePicker().setMaxDate(c.getTimeInMillis()); +*/ + return dialog; + + + } + public void onDateSet(DatePicker view, int year, int month, int day) { + Calendar cal = new GregorianCalendar(year, month, day); + setDate(cal); + } + + public void setDate(final Calendar calendar) { + final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM); + //((TextView) findViewById(R.id.showDate)).setText(dateFormat.format(calendar.getTime())); + + + // clickstartproject_editdate_tv.setText(dateFormat.format(calendar.getTime())); + + // SimpleDateFormat mdyFormat = new SimpleDateFormat("MM/dd/yyyy");//2017-06-22 + + SimpleDateFormat mdyFormat = new SimpleDateFormat("yyyy-MM-dd"); + yyyyMMdd_startdate = mdyFormat.format(calendar.getTime()); + + clickstartproject_editdate_tv.setText(yyyyMMdd_startdate); + clickendproject_editdate_tv.setVisibility(View.VISIBLE); + // System.out.println("From date:"+ yyyyMMdd_fromdate); + } + + } + + + + + public static boolean bruteforce(ArrayList input) { + for (int i = 0; i < input.size(); i++) { + for (int j = 0; j < input.size(); j++) { + if (input.get(i).equals(input.get(j)) && i != j) { + return false; + } + } + } + return true; + } + public static class DatePickerFragmentEndDate extends DialogFragment + implements DatePickerDialog.OnDateSetListener{ + + @Override + public Dialog onCreateDialog(Bundle savedInstanceState) { + final Calendar c = Calendar.getInstance(); + int year = c.get(Calendar.YEAR); + int month = c.get(Calendar.MONTH); + int day = c.get(Calendar.DAY_OF_MONTH); + + + /*return new DatePickerDialog(getActivity(),(DatePickerDialog.OnDateSetListener) + getActivity(), year, month, day);*/ + + + + + + DatePickerDialog dialog = new DatePickerDialog(getActivity(), + this, year, month, day); + + // dialog.getDatePicker().setMaxDate(c.getTimeInMillis()); // this will set maximum date validation + //dialog.getDatePicker().setMinDate(System.currentTimeMillis() - 1000); + //dialog.getDatePicker().setMaxDate(c.getTimeInMillis()); + + // dialog.getDatePicker().setMaxDate(c.getTimeInMillis()+((1000*60*60*24*90)));//Error:fromDate: Sun Jun 18 12:50:44 GMT+05:30 2017 does not precede toDate: Fri Jun 09 02:45:11 GMT+05:30 2017 + + + /* dialog.getDatePicker().setMinDate(c.getTimeInMillis()); + c.add(Calendar.DAY_OF_MONTH,150); + dialog.getDatePicker().setMaxDate(c.getTimeInMillis());*/ + + return dialog; + + + } + public void onDateSet(DatePicker view, int year, int month, int day) { + Calendar cal = new GregorianCalendar(year, month, day); + setDate(cal); + } + + public void setDate(final Calendar calendar) + { + final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM); + //((TextView) findViewById(R.id.showDate)).setText(dateFormat.format(calendar.getTime())); + + // clickendproject_editdate_tv.setText(dateFormat.format(calendar.getTime())); + + SimpleDateFormat mdyFormat = new SimpleDateFormat("yyyy-MM-dd"); //2017-06-22 + + yyyyMMdd_enddate = mdyFormat.format(calendar.getTime()); + clickendproject_editdate_tv.setText(yyyyMMdd_enddate); + + // System.out.println("To Date:"+ yyyyMMdd_todate); + + + + + + + if(clickstartproject_editdate_tv.getText().toString().equals("anyType{}") + || clickstartproject_editdate_tv.getText().toString().equals(null) + ||clickstartproject_editdate_tv.getText().toString().equals("0000-00-00") + ||clickstartproject_editdate_tv.getText().toString().equalsIgnoreCase("Click for Calendar") + ) + { + + } + else { + + editstudentdays_linearlayout.setVisibility(View.VISIBLE); + yyyyMMdd_startdate = clickstartproject_editdate_tv.getText().toString(); + + + int days_count = Days.daysBetween(new LocalDate(yyyyMMdd_startdate), new LocalDate(yyyyMMdd_enddate)).getDays(); + int int_days = days_count + 1; + + + editstudent_numberofdays_tv.setText("Number of Days: " + String.valueOf(int_days)); + //System.out.println("Days: " + int_days); + + if((int_days<0)) + { + // obj_class_alert_msg.alerts_dialog("pass","End Date must be after Start Date",static_context1); + + // alerts_dialog("pass","End Date must be after Start Date",static_context1); + + clickendproject_editdate_tv.setText("Click for Calendar"); + editstudent_numberofdays_tv.setText("Number of Days: "); + + + + AlertDialog.Builder dialog; + dialog = new AlertDialog.Builder(static_context1); + dialog.setCancelable(false); + dialog.setTitle("LeadCampus"); + dialog.setMessage("End Date should be after Start Date"); + + + + dialog.setPositiveButton("OK", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) + { + + + dialog.dismiss(); + + } + }); + + + + + final AlertDialog alert = dialog.create(); + alert.setOnShowListener(new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface arg0) { + alert.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#004D40")); + } + }); + alert.show(); + + + } + else{ + //alerts_dialog_fortodate(); + } + + + + + + + + + + + + + + + + + + } + + + + + /* int days_count = Days.daysBetween(new LocalDate(yyyyMMdd_startdate), new LocalDate(yyyyMMdd_enddate)).getDays(); + int int_days=days_count+1; + System.out.println ("Days: "+int_days); + + if((int_days<=6)) + { + + } + else{ + //alerts_dialog_fortodate(); + }*/ + + + + } + + } + + +//----------------------------date------------------------------------ + + +} diff --git a/app/src/main/java/com/leadcampusapp/EventsActivity.java b/app/src/main/java/com/leadcampusapp/EventsActivity.java new file mode 100644 index 0000000..fde9e09 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/EventsActivity.java @@ -0,0 +1,253 @@ +package com.leadcampusapp; + +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.graphics.Color; +//import android.support.design.widget.TabLayout; +import androidx.viewpager.widget.ViewPager; +import androidx.appcompat.app.AppCompatActivity; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.ImageButton; +import android.widget.TextView; + +//import com.android.sripad.leadnew_22_6_2018.R; + +import com.google.android.material.tabs.TabLayout; + +import java.io.File; + +public class EventsActivity extends AppCompatActivity implements ConnectivityReceiver.ConnectivityReceiverListener{ + + ImageButton img_eventsBack; + + public static final String PREFBook_Stud= "prefbook_stud"; + private SharedPreferences shardpref_S_obj; + public static final String PrefID_Role = "prefid_role"; + public String str_role = null; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_events); + + shardpref_S_obj=EventsActivity.this.getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + shardpref_S_obj.getString(PrefID_Role, "").trim(); + str_role = shardpref_S_obj.getString(PrefID_Role, "").trim(); + + + /* img_eventsBack = (ImageButton) findViewById(R.id.img_eventsBack);*/ + + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + //getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background)); + + View actionBarView = getSupportActionBar().getCustomView(); + TextView actionBarTV = (TextView) actionBarView.findViewById(R.id.txt_actionBar); + actionBarTV.setText("Events"); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); + + + View view1; + LayoutInflater inflater1 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view1 = inflater1.inflate(R.layout.currenteventtablayout, null); + + View view2; + LayoutInflater inflater2 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view2 = inflater2.inflate(R.layout.pasteventtablayout, null); + + TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); + tabLayout.addTab(tabLayout.newTab().setCustomView(view1)); + tabLayout.addTab(tabLayout.newTab().setCustomView(view2)); + + TabLayout.Tab selectedTab = tabLayout.getTabAt(0); + View view = selectedTab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.txt_eventtabtitle); + selectedText.setTextColor(Color.parseColor("#000000")); + + + //tabLayout.addTab(tabLayout.newTab().setText("Tab 3")); + //tabLayout.setTabGravity(TabLayout.GRAVITY_FILL); + + final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); + final EventsAdapter adapter = new EventsAdapter(getSupportFragmentManager(), tabLayout.getTabCount()); + viewPager.setAdapter(adapter); + viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); + tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { + @Override + public void onTabSelected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.txt_eventtabtitle); + selectedText.setTextColor(Color.parseColor("#000000")); + viewPager.setCurrentItem(tab.getPosition()); + } + + @Override + public void onTabUnselected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.txt_eventtabtitle); + selectedText.setTextColor(Color.parseColor("#000000")); + } + + @Override + public void onTabReselected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.txt_eventtabtitle); + selectedText.setTextColor(Color.parseColor("#000000")); + } + }); + + /*img_eventsBack.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + finish(); + } + });*/ + } + + @Override + protected void onResume() { + super.onResume(); + + // register connection status listener + MyApplication.getInstance().setConnectivityListener(this); + } + + @Override + public void onNetworkConnectionChanged(boolean isConnected) { + showSnack(isConnected); + } + + private void showSnack(boolean isConnected) { + + if (!isConnected) { + + AlertDialog.Builder adb = new AlertDialog.Builder(EventsActivity.this); + //adb.setView(alertDialogView); + + adb.setTitle("Sorry! Not connected to the internet"); + + adb.setIcon(android.R.drawable.ic_dialog_alert); + + adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + + adb.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + adb.setCancelable(true); + adb.show(); + } + +/* String message; + int color; + if (isConnected) { + message = "Good! Connected to Internet"; + color = Color.WHITE; + } else { + message = "Sorry! Not connected to internet"; + color = Color.RED; + } + + Snackbar snackbar = Snackbar + .make(findViewById(R.id.coordinator_layout), message, Snackbar.LENGTH_LONG); + + View sbView = snackbar.getView(); + TextView textView = (TextView) sbView.findViewById(android.support.design.R.id.snackbar_text); + textView.setTextColor(color); + snackbar.show();*/ + } + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_main, menu); + MenuItem action_editProfile = menu.findItem(R.id.action_editProfile); + action_editProfile.setVisible(false); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + + /* if (id == R.id.action_editProfile) { + Intent ittEventsToEditProfile = new Intent(EventsActivity.this ,EditProfileActivity.class); + startActivity(ittEventsToEditProfile); + return true; + }*/ + + if (id == R.id.action_logout) { + + //deleteCache(EventsActivity.this); + Intent ittEventsToLogin = new Intent(EventsActivity.this ,LoginActivity.class); + startActivity(ittEventsToLogin); + return true; + } + + if (id == android.R.id.home) { + + /*if(str_role.equals("Student")) { + Intent ittEventsToStudHome = new Intent(EventsActivity.this, HomeActivity.class); + startActivity(ittEventsToStudHome); + }else{ + Intent ittEventsToPMHome = new Intent(EventsActivity.this, PMHomeActivity.class); + startActivity(ittEventsToPMHome); + }*/ + if(str_role.equals("Student")) { + Intent ittEventsToStudHome = new Intent(EventsActivity.this, HomeActivity.class); + startActivity(ittEventsToStudHome); + }else if(str_role.equalsIgnoreCase("Principal")){ + Intent ittEventsToStudHome = new Intent(EventsActivity.this, PrincipleHomeActivity.class); + startActivity(ittEventsToStudHome); + } + else{ + Intent ittEventsToPMHome = new Intent(EventsActivity.this, PMHomeActivity.class); + startActivity(ittEventsToPMHome); + } + return true; + } + return super.onOptionsItemSelected(item); + } + + public static void deleteCache(Context context) { + try { + File dir = context.getCacheDir(); + deleteDir(dir); + } catch (Exception e) {} + } + + public static boolean deleteDir(File dir) { + if (dir != null && dir.isDirectory()) { + String[] children = dir.list(); + for (int i = 0; i < children.length; i++) { + boolean success = deleteDir(new File(dir, children[i])); + if (!success) { + return false; + } + } + return dir.delete(); + } else if(dir!= null && dir.isFile()) { + return dir.delete(); + } else { + return false; + } + } + +} diff --git a/app/src/main/java/com/leadcampusapp/EventsAdapter.java b/app/src/main/java/com/leadcampusapp/EventsAdapter.java new file mode 100644 index 0000000..894014d --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/EventsAdapter.java @@ -0,0 +1,37 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 22-06-2018. + */ +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentStatePagerAdapter; + +public class EventsAdapter extends FragmentStatePagerAdapter { + int mNumOfTabs; + + public EventsAdapter(FragmentManager fm, int NumOfTabs) { + super(fm); + this.mNumOfTabs = NumOfTabs; + } + + @Override + public Fragment getItem(int position) { + + switch (position) { + case 0: + CurrentEventsFragment tab1 = new CurrentEventsFragment(); + return tab1; + case 1: + PastEventsFragment tab2 = new PastEventsFragment(); + return tab2; + default: + return null; + } + } + + @Override + public int getCount() { + return mNumOfTabs; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/ExpandableListDataPump.java b/app/src/main/java/com/leadcampusapp/ExpandableListDataPump.java new file mode 100644 index 0000000..dd41661 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ExpandableListDataPump.java @@ -0,0 +1,42 @@ +package com.leadcampusapp; + +import android.content.Context; + +//import com.android.sripad.leadnew_22_6_2018.R; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; + +public class ExpandableListDataPump { + public static HashMap> getData(Context context) { + LinkedHashMap> expandableListDetail = new LinkedHashMap>(); + + List leadProgram = new ArrayList(); + leadProgram.add(context.getResources().getString(R.string.leadProgram)); + + List leadPrayana = new ArrayList(); + leadPrayana.add(context.getResources().getString(R.string.leadPrayana)); + + List leadSummit = new ArrayList(); + leadSummit.add(context.getResources().getString(R.string.leadYuvaSummit)); + + List leadValedictory = new ArrayList(); + leadValedictory.add(context.getResources().getString(R.string.leadValedictory)); + + //List leadTalaash = new ArrayList(); + //leadTalaash.add(context.getResources().getString(R.string.leadTalaash)); + + + expandableListDetail.put("LEAD LEADERSHIP PROGRAM", leadProgram); + expandableListDetail.put("LEAD PRAYANA", leadPrayana); + expandableListDetail.put("YUVA SUMMIT", leadSummit); + expandableListDetail.put("LEAD VALEDICTORY", leadValedictory); + // expandableListDetail.put("LEAD TALAASH", leadTalaash); + + + + return expandableListDetail; + } +} diff --git a/app/src/main/java/com/leadcampusapp/FeedbackActivity.java b/app/src/main/java/com/leadcampusapp/FeedbackActivity.java new file mode 100644 index 0000000..cee5de6 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/FeedbackActivity.java @@ -0,0 +1,514 @@ +package com.leadcampusapp; + +import android.app.AlertDialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.graphics.Color; +import android.os.AsyncTask; +import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; +import android.util.Log; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.EditText; +import android.widget.ProgressBar; +import android.widget.Spinner; +import android.widget.TextView; +import android.widget.Toast; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.util.ArrayList; +import java.util.HashMap; + +public class FeedbackActivity extends AppCompatActivity { + + Spinner sp_feedback; + EditText et_feedback,et_suggestion; + Button btn_submit; + private HashMap hashProjTypeId = new HashMap(); + ProgressBar progressBar; + private ProgressDialog progressDialog; + private SharedPreferences shardpref_S_obj; + private String str_leadId,str_RegistrationId,str_academicCode; + + public static final String PREFBook_Stud= "prefbook_stud"; //sharedpreference Book + public static final String PrefID_SLeadID = "prefid_sleadid"; + public static final String PrefId_S_AcademicId = "prefid_sacademicid"; + + SharedPreferences shardprefPM_obj; + public static final String PREFBook_PM= "prefbook_pm"; //sharedpreference Book + + public static final String PrefID_PMID = "prefid_pmid"; // + private String str_PMId; + + String str_feedback; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_feedback); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); + + sp_feedback = (Spinner) findViewById(R.id.feedback_sp); + progressBar = (ProgressBar) findViewById(R.id.progressBar); + et_feedback = (EditText) findViewById(R.id.et_feedback); + et_suggestion = (EditText) findViewById(R.id.et_suggestion); + btn_submit = (Button) findViewById(R.id.submit); + // Spinner click listener + // sp_feedback.setOnItemSelectedListener(this); + + // Spinner Drop down elements + GetFeedbackList getFeedbackList = new GetFeedbackList(this); + getFeedbackList.execute(); + + shardpref_S_obj=getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + shardprefPM_obj=getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + shardpref_S_obj.getString(PrefId_S_AcademicId, "").trim(); + str_academicCode = shardpref_S_obj.getString(PrefId_S_AcademicId, "").trim(); + Log.d("str_academicCode:",str_academicCode); + + shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + str_leadId = shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + Log.d("str_leadId:",str_leadId); + + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_PMId = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + Log.d("str_PMId:", str_PMId); + + btn_submit.setOnClickListener(new View.OnClickListener() { + + @Override + public void onClick(View v) { + if(checkValidation()) { + SubmitFeedbackAsynck submitFeedbackAsynck = new SubmitFeedbackAsynck(FeedbackActivity.this); + submitFeedbackAsynck.execute(); + } + } + }); + + } + + public boolean checkValidation() + { + boolean validationresult = true; + + boolean b_studenname,b_alernativecell,b_emailid,b_dob,b_aadhara1,b_aadhara2,b_account1,b_account2,b_iifscode1,b_iifscode2; + boolean b_state,b_district,b_city,b_college,b_course,b_sem,b_programid,b_mytalent; + + b_studenname=b_alernativecell=b_emailid=b_dob=b_aadhara1=b_aadhara2=b_account1=b_account2=b_iifscode1=b_iifscode2=true; + b_state=b_district=b_city=b_college=b_course=b_sem=b_programid=b_mytalent=true; + + if (et_feedback.getText().toString().length() == 0 || et_feedback.getText().toString().trim().length() == 0) { + et_feedback.setError("Empty not allowed"); + et_feedback.requestFocus(); + b_studenname=false; + validationresult = false; + } + + if (et_suggestion.getText().toString().length() == 0 ) { + et_suggestion.setError("Empty not allowed"); + b_alernativecell=false; + validationresult = false; + } + if(sp_feedback.getSelectedItem().equals("Select Feedback")||sp_feedback.getSelectedItemPosition()==0) { + TextView errorText = (TextView) sp_feedback.getSelectedView(); + errorText.setError(""); + errorText.setTextColor(Color.RED);//just to highlight that this is an error + errorText.setText("Select Feedback"); + b_emailid = false; + validationresult = false; + } + return (b_studenname&&b_alernativecell&&b_emailid); + } + + public class GetFeedbackList extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + //private ProgressBar progressBar; + + GetFeedbackList (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + String METHOD_NAME = "SuggestionFeedbackHeadsMaster"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/SuggestionFeedbackHeadsMaster"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Login.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapObject response = (SoapObject) envelope.getResponse(); + Log.d("Feedback list:",response.toString()); + + return response; + + } + + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(FeedbackActivity.this,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + + t.printStackTrace(); + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(FeedbackActivity.this,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(FeedbackActivity.this,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + catch (Exception t) { + Log.d("exception outside",t.getMessage().toString()); + + t.printStackTrace(); + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(FeedbackActivity.this,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + + return null; + + + //Log.d("Soap response is",response.toString()); + + //return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + + progressDialog.setMessage("Loading"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapObject result) { + /* progressBar.setVisibility(View.GONE);*/ + progressDialog.dismiss(); + + if(result!=null) { + String finalResult = result.toString(); + String finals = finalResult.replace("anyType", ""); + Log.d("Finals is", finals); + + ArrayList feedbackList = new ArrayList(); + feedbackList.add("Select Feedback"); + + Log.d("finalResultsssss", finalResult); + + for (int i = 0; i < result.getPropertyCount(); i++) { + SoapObject list = (SoapObject) result.getProperty(i); + SoapPrimitive S_Slno, S_Head_Name, S_Status; + Object O_Slno, O_Head_Name, O_Status; + + int int_Slno = 0; + + String str_Slno = null, str_Head_Name = null, str_status = null; + + O_Slno = list.getProperty("Slno"); + if (!O_Slno.toString().equals("anyType") && !O_Slno.toString().equals(null) && !O_Slno.toString().equals("anyType{}")) { + S_Slno = (SoapPrimitive) list.getProperty("Slno"); + Log.d("Slno", S_Slno.toString()); + str_Slno = O_Slno.toString(); + int_Slno = Integer.valueOf(str_Slno); + } + + O_Head_Name = list.getProperty("Head_Name"); + if (!O_Head_Name.toString().equals("anyType") && !O_Head_Name.toString().equals(null) && !O_Head_Name.toString().equals("anyType{}")) { + S_Head_Name = (SoapPrimitive) list.getProperty("Head_Name"); + Log.d("Head_Name", S_Head_Name.toString()); + str_Head_Name = O_Head_Name.toString(); + + feedbackList.add(str_Head_Name); + + hashProjTypeId.put(str_Head_Name, int_Slno); + } + setFeedbackListSpinner(feedbackList); + + } + + } + + + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + private void setFeedbackListSpinner(ArrayList feedbackList) { + + + ArrayAdapter dataAdapter2 = new ArrayAdapter(this, R.layout.simple_spinner_items, feedbackList); + + // Drop down layout style - list view with radio button + //dataAdapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter2.setDropDownViewResource(R.layout.spinnercustomstyle); + + // attaching data adapter to spinner + sp_feedback.setAdapter(dataAdapter2); + //spin_projectType.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorWhite)); + + } + + + public class SubmitFeedbackAsynck extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + /* private ProgressBar progressBar;*/ + + SubmitFeedbackAsynck (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapPrimitive response = feedbackDetails(); + + //Log.d("Soap response is",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { +/* progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + + progressDialog.setMessage("Submitting"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + /*progressBar.setVisibility(View.GONE);*/ + + progressDialog.dismiss(); + + if(result!=null) { + if (result.toString().equalsIgnoreCase("success")) { + Toast.makeText(FeedbackActivity.this, "Feedback sent Successfully", Toast.LENGTH_LONG).show(); + // clearAllFields(); + finish(); + Intent ittEditProjToProjDtls = new Intent(FeedbackActivity.this, HomeActivity.class); + startActivity(ittEditProjToProjDtls); + } else { + Toast.makeText(FeedbackActivity.this, result.toString(), Toast.LENGTH_LONG).show(); + } + }else{ + + } + + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + private SoapPrimitive feedbackDetails() + { + + String METHOD_NAME = "SaveSuggestionFeedback"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/SaveSuggestionFeedback"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + + ArrayList matModel = new ArrayList(); + + /* vmmaterial material = new vmmaterial(); + material.setSlno(1); + material.setMeterialCost(50); + material.setMeterialName("Material 1"); + matModel.add(material);*/ + str_feedback = sp_feedback.getSelectedItem().toString(); + + Integer HeadId = (Integer) hashProjTypeId.get(str_feedback); + + request.addProperty("Lead_Id",str_leadId); + request.addProperty("ManagerId",str_PMId); + request.addProperty("HeadId",String.valueOf(HeadId)); + request.addProperty("Feedback", et_feedback.getText().toString()); + request.addProperty("Suggestion", et_suggestion.getText().toString()); + request.addProperty("AcademicCode",str_academicCode); + + + Log.d("Requestisss",request.toString()); + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + ///envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Login.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + // Log.d("soap response1xxxx",envelope.getResponse().toString()); + + + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + Log.e("soap responseyyyyyyy",response.toString()); + + return response; + + //return response; + + } + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(FeedbackActivity.this,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + t.printStackTrace(); + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(FeedbackActivity.this,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + }catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(FeedbackActivity.this,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + + t.printStackTrace(); + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(FeedbackActivity.this,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_main, menu); + MenuItem action_editProfile = menu.findItem(R.id.action_editProfile); + action_editProfile.setVisible(false); + MenuItem action_logout = menu.findItem(R.id.action_logout); + action_logout.setVisible(false); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + + /* if (id == R.id.action_editProfile) { + Intent ittProjDtlsToEditProfile = new Intent(FeedbackActivity.this ,EditProfileActivity.class); + startActivity(ittProjDtlsToEditProfile); + return true; + } + + if (id == R.id.action_logout) { + + Intent ittProjDtlsToLogin = new Intent(FeedbackActivity.this ,LoginActivity.class); + startActivity(ittProjDtlsToLogin); + return true; + } +*/ + if (id == android.R.id.home) { + Intent ittProjDtlsToHome = new Intent(FeedbackActivity.this ,HomeActivity.class); + startActivity(ittProjDtlsToHome); + finish(); + return true; + } + + + return super.onOptionsItemSelected(item); + } + +} diff --git a/app/src/main/java/com/leadcampusapp/FeesAdapter.java b/app/src/main/java/com/leadcampusapp/FeesAdapter.java new file mode 100644 index 0000000..753d058 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/FeesAdapter.java @@ -0,0 +1,46 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 22-06-2018. + */ +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentStatePagerAdapter; + +public class FeesAdapter extends FragmentStatePagerAdapter { + int mNumOfTabs; + + public FeesAdapter(FragmentManager fm, int NumOfTabs) { + super(fm); + this.mNumOfTabs = NumOfTabs; + } + + @Override + public Fragment getItem(int position) { + + switch (position) { + case 0: + FeesSubmitFragment tab = new FeesSubmitFragment(); + return tab; + case 1: + FeesUnpaidFragment tab1 = new FeesUnpaidFragment(); + return tab1; + /* case 1: + ChartStud_CollgCountFragment tab2 = new ChartStud_CollgCountFragment(); + return tab2;*/ + case 2: + FeesPaidFragment tab3 = new FeesPaidFragment(); + return tab3; + /* case 2: + ChartFundAmtCountFragment tab4 = new ChartFundAmtCountFragment(); + return tab4;*/ + default: + return null; + } + } + + @Override + public int getCount() { + return mNumOfTabs; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/FeesPaidAcknowledgedAdapter.java b/app/src/main/java/com/leadcampusapp/FeesPaidAcknowledgedAdapter.java new file mode 100644 index 0000000..dfefccc --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/FeesPaidAcknowledgedAdapter.java @@ -0,0 +1,174 @@ +package com.leadcampusapp; + +import android.app.Activity; +import android.content.Intent; +import android.net.Uri; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.CheckBox; +import android.widget.TextView; + +import java.util.ArrayList; + +//import com.android.sripad.leadnew_22_6_2018.R; + +/** + * Created by Admin on 28-05-2018. + */ + +public class FeesPaidAcknowledgedAdapter extends BaseAdapter{ + + public ArrayList feesPaidList; + Activity activity; + + public FeesPaidAcknowledgedAdapter(Activity activity, ArrayList feesPaidList) { + super(); + this.activity = activity; + this.feesPaidList = feesPaidList; + } + + @Override + public int getCount() { + //return projList.size(); + return feesPaidList.size(); + } + + @Override + public Class_PaidStudList getItem(int position) { + + //return projList.get(position); + return feesPaidList.get(position); + } + + @Override + public long getItemId(int position) { + return position; + } + + class ViewHolder { + TextView mstudName; + TextView mleadId; + TextView mRegistrationDate; + TextView txt_feesCat; + TextView txt_recptNo; + TextView txt_Fees; + TextView Created_User_Type; + TextView OnlineorCash; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + + final ViewHolder holder; + LayoutInflater inflater = activity.getLayoutInflater(); + + if (convertView == null) { + convertView = inflater.inflate(R.layout.fees_paid_listrow, null); + holder = new ViewHolder(); + + holder.mstudName = (TextView) convertView.findViewById(R.id.txt_studName); + holder.mleadId = (TextView) convertView.findViewById(R.id.txt_leadId); + holder.mRegistrationDate = (TextView) convertView.findViewById(R.id.txt_registeredDateTxt); + holder.txt_feesCat = (TextView) convertView.findViewById(R.id.txt_feesCat); + holder.txt_recptNo = (TextView) convertView.findViewById(R.id.txt_recptNo); + holder.txt_Fees = (TextView) convertView.findViewById(R.id.txt_Fees); + holder.Created_User_Type = (TextView) convertView.findViewById(R.id.Created_User_Type); + holder.OnlineorCash = (TextView) convertView.findViewById(R.id.OnlineorCash); + + convertView.setTag(holder); + } else { + holder = (ViewHolder) convertView.getTag(); + } + + Class_PaidStudList item = feesPaidList.get(position); + + if(item.getStudentName()!=null) { + holder.mstudName.setText(item.getStudentName().toString()); + } + /*if(item.getPhone_number()!=null) { + holder.mPhoneNumber.setText(item.getPhone_number().toString()); + }*/ + /* if(!item.getCollege_name().equals(null)) { + holder.mCollegeName.setText(item.getCollege_name().toString()); + }*/ + if(item.getLead_Id()!=null) { + holder.mleadId.setText(item.getLead_Id().toString()); + } + if(item.getCreated_Date()!=null) { + holder.mRegistrationDate.setText(item.getCreated_Date().toString()); + } + if(item.getCreated_User_Type()!=null) { + holder.Created_User_Type.setText(item.getCreated_User_Type().toString()); + } + if(item.getPaid_Fees()!=null) { + holder.txt_Fees.setText(item.getPaid_Fees().toString()); + } + if(item.getPayment_Mode()!=null) { + holder.OnlineorCash.setText(item.getPayment_Mode().toString()); + } + if(item.getFees_Category_description()!=null) { + holder.txt_feesCat.setText(item.getFees_Category_description().toString()); + } + if(item.getAuto_Receipt_No()!=null) { + holder.txt_recptNo.setText(item.getAuto_Receipt_No().toString()); + } + + /* if(item.getPhone_number()!=null) { + holder.mPhoneNumber.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(Intent.ACTION_DIAL); + intent.setData(Uri.parse("tel:" + holder.mPhoneNumber.getText().toString())); + v.getContext().startActivity(intent); + } + }); + } +*/ + return convertView; + } + + + public void filter(String charText,ArrayList feesList) { + //charText = charText.toLowerCase(Locale.getDefault()); + //Log.d("charTextissss",charText); + this.feesPaidList.clear(); + + /* for(FeesUnpaidModel feesUnpaidModel : feesList){ + String stdName = feesUnpaidModel.getStudent_name().toString(); + //Log.d("StudeNameissssss",stdName); + }*/ + + if(charText!=null) { + if(feesList!=null) { + if (charText.isEmpty() || charText.length() == 0) { + this.feesPaidList.addAll(feesList); + } else { + for (Class_PaidStudList wp : feesList) { + //Log.d("GetCollegeNameissss",wp.getCollege_name().toLowerCase((Locale.getDefault()))); + /* if (wp.getCollege_name().toLowerCase(Locale.getDefault()).contains(charText) || wp.getLead_id().toLowerCase(Locale.getDefault()).contains(charText) || wp.getPhone_number().toLowerCase(Locale.getDefault()).contains(charText) || wp.getStudent_name().toLowerCase(Locale.getDefault()).contains(charText) || wp.getPhone_number().toLowerCase(Locale.getDefault()).contains(charText)) { + this.feesUnPaidList.add(wp); + }*/ + if ((wp.getStudentName()!=null && wp.getStudentName().toLowerCase().contains(charText.toLowerCase())) || ( wp.getLead_Id()!=null && wp.getLead_Id().toLowerCase().contains(charText.toLowerCase())) || ( wp.getCreated_User_Type()!=null && wp.getCreated_User_Type().toLowerCase().contains(charText.toLowerCase())) || ( wp.getPayment_Mode()!=null && wp.getPayment_Mode().toLowerCase().contains(charText.toLowerCase()) ) || ( wp.getAuto_Receipt_No()!=null && wp.getAuto_Receipt_No().toLowerCase().contains(charText.toLowerCase()))) { + this.feesPaidList.add(wp); + } + + /* if(selectedCollegeName == null) { + if (wp.getCollege_name().contains(charText) || wp.getLead_id().contains(charText) || wp.getPhone_number().contains(charText) || wp.getStudent_name().contains(charText) || wp.getPhone_number().contains(charText)) { + this.feesPaidList.add(wp); + } + }else{ + if (wp.getCollege_name().equals(selectedCollegeName) && (wp.getCollege_name().contains(charText) || wp.getLead_id().contains(charText) || wp.getPhone_number().contains(charText) || wp.getStudent_name().contains(charText) || wp.getPhone_number().contains(charText))) { + this.feesPaidList.add(wp); + } + }*/ + + + } + } + notifyDataSetChanged(); + } + } + } +} diff --git a/app/src/main/java/com/leadcampusapp/FeesPaidActivity.java b/app/src/main/java/com/leadcampusapp/FeesPaidActivity.java new file mode 100644 index 0000000..b06cf8a --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/FeesPaidActivity.java @@ -0,0 +1,216 @@ +package com.leadcampusapp; + +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.graphics.Color; +//import android.support.design.widget.TabLayout; +import androidx.viewpager.widget.ViewPager; +import androidx.appcompat.app.AppCompatActivity; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.ImageButton; +import android.widget.TextView; + +import com.google.android.material.tabs.TabLayout; + +public class FeesPaidActivity extends AppCompatActivity implements ConnectivityReceiver.ConnectivityReceiverListener{ + ImageButton img_eventsBack; + + public static final String PREFBook_Stud= "prefbook_stud"; + private SharedPreferences shardpref_S_obj; + public static final String PrefID_Role = "prefid_role"; + public String str_role = null; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_fees_paid); + + + shardpref_S_obj=FeesPaidActivity.this.getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + shardpref_S_obj.getString(PrefID_Role, "").trim(); + str_role = shardpref_S_obj.getString(PrefID_Role, "").trim(); + + + /* img_eventsBack = (ImageButton) findViewById(R.id.img_eventsBack);*/ + + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + //getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background)); + + View actionBarView = getSupportActionBar().getCustomView(); + TextView actionBarTV = (TextView) actionBarView.findViewById(R.id.txt_actionBar); + actionBarTV.setText("Fees Details"); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); + + View view3; + LayoutInflater inflater3 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view3 = inflater3.inflate(R.layout.pm_feessubmit_tablayout, null); + + View view1; + LayoutInflater inflater1 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view1 = inflater1.inflate(R.layout.pm_feespaid_tablayout, null); + + View view2; + LayoutInflater inflater2 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view2 = inflater2.inflate(R.layout.pm_feespaid_acknowledged_tablayout, null); + +/* View view3; + LayoutInflater inflater3 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view3 = inflater3.inflate(R.layout.pm_themeproject_tablayout, null); + + View view4; + LayoutInflater inflater4 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view4 = inflater4.inflate(R.layout.pm_fundamt_tablayout, null);*/ + + + TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); + tabLayout.addTab(tabLayout.newTab().setCustomView(view3)); + tabLayout.addTab(tabLayout.newTab().setCustomView(view1)); + tabLayout.addTab(tabLayout.newTab().setCustomView(view2)); + + TabLayout.Tab selectedTab = tabLayout.getTabAt(0); + View view = selectedTab.getCustomView(); + + TextView selectedText = (TextView) view.findViewById(R.id.txt_pmfeesPaid); + selectedText.setTextColor(Color.parseColor("#000000")); + + + //tabLayout.addTab(tabLayout.newTab().setText("Tab 3")); + //tabLayout.setTabGravity(TabLayout.GRAVITY_FILL); + + final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); + final FeesAdapter adapter = new FeesAdapter(getSupportFragmentManager(), tabLayout.getTabCount()); + viewPager.setAdapter(adapter); + viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); + tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { + @Override + public void onTabSelected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.txt_pmfeesPaid); + selectedText.setTextColor(Color.parseColor("#000000")); + viewPager.setCurrentItem(tab.getPosition()); + } + + @Override + public void onTabUnselected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.txt_pmfeesPaid); + selectedText.setTextColor(Color.parseColor("#000000")); + } + + @Override + public void onTabReselected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.txt_pmfeesPaid); + selectedText.setTextColor(Color.parseColor("#000000")); + } + }); + + } + + + @Override + protected void onResume() { + super.onResume(); + + // register connection status listener + MyApplication.getInstance().setConnectivityListener(this); + } + + @Override + public void onNetworkConnectionChanged(boolean isConnected) { + showSnack(isConnected); + } + + private void showSnack(boolean isConnected) { + + if (!isConnected) { + + AlertDialog.Builder adb = new AlertDialog.Builder(FeesPaidActivity.this); + //adb.setView(alertDialogView); + + adb.setTitle("Sorry! Not connected to the internet"); + + adb.setIcon(android.R.drawable.ic_dialog_alert); + + adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + + adb.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + adb.setCancelable(true); + adb.show(); + } + +/* String message; + int color; + if (isConnected) { + message = "Good! Connected to Internet"; + color = Color.WHITE; + } else { + message = "Sorry! Not connected to internet"; + color = Color.RED; + } + + Snackbar snackbar = Snackbar + .make(findViewById(R.id.coordinator_layout), message, Snackbar.LENGTH_LONG); + + View sbView = snackbar.getView(); + TextView textView = (TextView) sbView.findViewById(android.support.design.R.id.snackbar_text); + textView.setTextColor(color); + snackbar.show();*/ + } + + + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_fees, menu); + MenuItem action_editProfile = menu.findItem(R.id.action_editProfile); + action_editProfile.setVisible(false); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + if(id == R.id.action_feesCollect){ + Intent ittFeesPaidToHome = new Intent(FeesPaidActivity.this ,ManagerFeesCollectionActivity.class); + startActivity(ittFeesPaidToHome); + return true; + } + if (id == android.R.id.home) { + Intent ittFeesPaidToHome = new Intent(FeesPaidActivity.this ,PMHomeActivity.class); + startActivity(ittFeesPaidToHome); + return true; + } + + + if (id == R.id.action_logout) { + Intent ittFeesToLogin = new Intent(FeesPaidActivity.this ,LoginActivity.class); + startActivity(ittFeesToLogin); + return true; + } + + return super.onOptionsItemSelected(item); + } +} diff --git a/app/src/main/java/com/leadcampusapp/FeesPaidAdapter.java b/app/src/main/java/com/leadcampusapp/FeesPaidAdapter.java new file mode 100644 index 0000000..2ee2289 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/FeesPaidAdapter.java @@ -0,0 +1,35 @@ +package com.leadcampusapp; + +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentStatePagerAdapter; +import androidx.appcompat.app.AppCompatActivity; + +public class FeesPaidAdapter extends FragmentStatePagerAdapter { + int mNumOfTabs; + + public FeesPaidAdapter(FragmentManager fm, int NumOfTabs) { + super(fm); + this.mNumOfTabs = NumOfTabs; + } + + @Override + public Fragment getItem(int position) { + + switch (position) { + case 0: + FeesUnpaidFragment tab1 = new FeesUnpaidFragment(); + return tab1; + case 1: + ChartThemeProjCountFragment tab3 = new ChartThemeProjCountFragment(); + return tab3; + default: + return null; + } + } + + @Override + public int getCount() { + return mNumOfTabs; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/FeesPaidFragment.java b/app/src/main/java/com/leadcampusapp/FeesPaidFragment.java new file mode 100644 index 0000000..1343e69 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/FeesPaidFragment.java @@ -0,0 +1,1530 @@ +package com.leadcampusapp; /** + * Created by Admin on 20-07-2018. + */ + +import android.annotation.SuppressLint; +import android.app.AlertDialog; +import android.app.DatePickerDialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.SharedPreferences; +import android.os.AsyncTask; +import android.os.Bundle; +import androidx.fragment.app.Fragment; +import androidx.core.content.ContextCompat; +import androidx.appcompat.widget.AppCompatSpinner; +import android.text.Editable; +import android.text.TextWatcher; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.DatePicker; +import android.widget.EditText; +import android.widget.ListView; +import android.widget.TextView; +import android.widget.Toast; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Locale; + +//import com.android.sripad.leadnew_22_6_2018.R; + +public class FeesPaidFragment extends Fragment +{ + private ListView lview; + private ArrayList feesList; + private FeesPaidAcknowledgedAdapter adapter; + private SharedPreferences shardprefPM_obj; + private String str_MangerID; + private static final String PREFBook_PM= "prefbook_pm"; + private static final String PrefID_PMID = "prefid_pmid"; + private LinkedHashSet collegeNameLst; + private ArrayList collegeNameArrLst; + private AppCompatSpinner spin_college; + private ArrayList originalList = null; + private ProgressDialog progressDialog; + private EditText etSearch; + private TextView txt_studRegistered,txt_feesPaidStudents; + private int counter=0; + + Class_Colleges[] arrayObj_Class_Colleges, arrayObj_Class_Colleges2,arrayObj_Class_Colleges3; + Class_Colleges obj_Class_Colleges; + int collegeslistcount,MDId,studentlistcount; + String str_CollegesStatus,str_ColID="x"; + String str_studListStatus; + ArrayAdapter dataAdapter_yearList,dataAdapter_feesCatg,dataAdapter_college; + Class_FeesCatg[] arrayObj_Class_FeesCatg; + Class_FeesCatg obj_Class_FeesCatg; + int YearListCount,feesCatglistcount,From_ToDateCount; + String str_YearListStatus,yearID,str_FeesCatgStatus,str_feesCatSlno,str_feesCatName,str_yearID,str_yearCode; + AppCompatSpinner spin_year,spin_feesCategory; + private TextView txt_actualTotalCounts; + + + EditText edt_fromdate,edt_todate,fromdateseterror_TV,todateseterror_TV; + private int mYear, mMonth, mDay; + private int cYear, cMonth, cDay; + Class_FromToDate[] arrayObj_Class_FromToDate; + String FromDate,ToDate; + String str_FromToDateStatus; + Class_PaidStudList[] arrayObj_Class_studList; + Class_PaidStudList obj_Class_studList; + + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + + View view=inflater.inflate(R.layout.frag_fees_paid_acknowledged, container, false); + + lview = (NonScrollListView) view.findViewById(R.id.listview_fees_paid_acknowledged); + + feesList = new ArrayList(); + adapter = new FeesPaidAcknowledgedAdapter(getActivity(),feesList); + lview.setAdapter(adapter); + + + + shardprefPM_obj = getActivity().getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MangerID = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + Log.d("str_MangerID:",str_MangerID); + MDId=Integer.parseInt(str_MangerID); + + collegeNameLst = new LinkedHashSet(); + collegeNameLst.add("Select Institution"); + collegeNameArrLst = new ArrayList(); + + spin_college = (AppCompatSpinner) view.findViewById(R.id.spin_college); + + txt_studRegistered = (TextView) view.findViewById(R.id.txt_studRegistered); + txt_feesPaidStudents = (TextView) view.findViewById(R.id.txt_feesPaidStudents); + edt_fromdate = (EditText) view.findViewById(R.id.edt_fromdate); + fromdateseterror_TV = (EditText) view.findViewById(R.id.fromdateseterror_TV); + edt_todate = (EditText) view.findViewById(R.id.edt_todate); + todateseterror_TV = (EditText) view.findViewById(R.id.todateseterror_TV); + spin_feesCategory = (AppCompatSpinner) view.findViewById(R.id.spin_feesCategory); + txt_actualTotalCounts = (TextView) view.findViewById(R.id.txt_actualTotalCount); + + //populateGetFeesRegistered(); + + + GetFromToDateAsyncCallWS getFromToDateAsyncCallWS=new GetFromToDateAsyncCallWS(getActivity()); + getFromToDateAsyncCallWS.execute(); + FeesCatglistAsyncCallWS feesCatglistAsyncCallWS=new FeesCatglistAsyncCallWS(getActivity()); + feesCatglistAsyncCallWS.execute(); + //populateList(); + + etSearch = (EditText) view.findViewById(R.id.etSearch); + etSearch.addTextChangedListener(new TextWatcher() { + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { +// Call back the Adapter with current character to Filter + } + + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + } + + @Override + public void afterTextChanged(Editable s) { + + String text = etSearch.getText().toString().toLowerCase(Locale.getDefault()); + adapter.filter(text, originalList); + + } + }); + edt_fromdate.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + final Calendar c = Calendar.getInstance(); + + mYear = c.get(Calendar.YEAR); + mMonth = c.get(Calendar.MONTH); + mDay = c.get(Calendar.DAY_OF_MONTH); + + DatePickerDialog datePickerDialog = new DatePickerDialog(getActivity(), R.style.DatePickerTheme, + new DatePickerDialog.OnDateSetListener() { + + @Override + public void onDateSet(DatePicker view, int year, + int monthOfYear, int dayOfMonth) { + + cDay = dayOfMonth; + cMonth = monthOfYear; + cYear = year; + + // String date =dayOfMonth + "/" + (monthOfYear + 1) + "/" + year; + // String date =year + "-" + (monthOfYear + 1) + "-" + dayOfMonth; + String date =dayOfMonth + "-" + (monthOfYear + 1) + "-" + year; + + + SimpleDateFormat dateFormat= new SimpleDateFormat("dd-MM-yyyy"); + // SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd"); + + try { + Date d=dateFormat.parse(date); + System.out.println("Formated from"+dateFormat.format(d)); + fromdateseterror_TV.setVisibility(View.GONE); + edt_fromdate.setText(dateFormat.format(d).toString()); + + } + catch(Exception e) { + //java.text.ParseException: Unparseable date: Geting error + System.out.println("Excep"+e); + } + //TextView txtExactDate = (TextView) findViewById(R.id.txt_exactDate); + + + //txtDate.edita + } + }, mYear, mMonth, mDay); + + datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()); + //datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()-(1000 * 60 * 60 * 24 * 365 * 14)); + // - (1000 * 60 * 60 * 24 * 365.25 * 14) +//------ + + datePickerDialog.show(); + originalList.clear(); + spin_college.setSelection(0); + adapter.notifyDataSetChanged(); + } + }); + edt_todate.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + final Calendar c = Calendar.getInstance(); + + mYear = c.get(Calendar.YEAR); + mMonth = c.get(Calendar.MONTH); + mDay = c.get(Calendar.DAY_OF_MONTH); + + DatePickerDialog datePickerDialog = new DatePickerDialog(getActivity(), R.style.DatePickerTheme, + new DatePickerDialog.OnDateSetListener() { + + @Override + public void onDateSet(DatePicker view, int year, + int monthOfYear, int dayOfMonth) { + + cDay = dayOfMonth; + cMonth = monthOfYear; + cYear = year; + + // String date =dayOfMonth + "/" + (monthOfYear + 1) + "/" + year; + // String date =year + "-" + (monthOfYear + 1) + "-" + dayOfMonth; + String date =dayOfMonth + "-" + (monthOfYear + 1) + "-" + year; + + + SimpleDateFormat dateFormat= new SimpleDateFormat("dd-MM-yyyy"); + // SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd"); + + try { + Date d=dateFormat.parse(date); + System.out.println("Formated to"+dateFormat.format(d)); + todateseterror_TV.setVisibility(View.GONE); + edt_todate.setText(dateFormat.format(d).toString()); + + } + catch(Exception e) { + //java.text.ParseException: Unparseable date: Geting error + System.out.println("Excep"+e); + } + //TextView txtExactDate = (TextView) findViewById(R.id.txt_exactDate); + + + //txtDate.edita + } + }, mYear, mMonth, mDay); + + datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()); + //datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()-(1000 * 60 * 60 * 24 * 365 * 14)); + // - (1000 * 60 * 60 * 24 * 365.25 * 14) +//------ + + datePickerDialog.show(); + originalList.clear(); + spin_college.setSelection(0); + adapter.notifyDataSetChanged(); + } + }); + + spin_feesCategory.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected (AdapterView < ? > parent, View view, + int position, long id){ + // TODO Auto-generated method stub + obj_Class_FeesCatg = (Class_FeesCatg) spin_feesCategory.getSelectedItem(); + + str_feesCatSlno = obj_Class_FeesCatg.getFees_Category_Slno().toString(); + str_feesCatName = obj_Class_FeesCatg.getFees_category_description().toString(); + + Log.e("tag","str_feesCatName="+str_feesCatName); + + CollegelistAsyncCallWS collegelistAsyncCallWS=new CollegelistAsyncCallWS(getContext()); + collegelistAsyncCallWS.execute(); + // Toast.makeText(getApplicationContext(),"str_Programsid: "+str_programid,Toast.LENGTH_SHORT).show(); + } + + @Override + public void onNothingSelected (AdapterView < ? > parent){ + // TODO Auto-generated method stub + } + }); + + + spin_college.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView parent, View view, int position, long id) { + /* String collegeName = spin_college.getSelectedItem().toString(); + adapter.filter(collegeName,originalList);*/ + + String collegeName = spin_college.getSelectedItem().toString(); + + //adapter.filter(collegeName, originalList); + if(spin_college.getSelectedItem().toString().equals("Select Institution")||str_ColID.equals("x")||str_CollegesStatus.equals("Fail")||str_CollegesStatus.equals("There are no colleges")) + { + Log.e("In strCollegesStatus","In str_CollegesStatus"); + // amount_ET.setText("0"); + } + else { + obj_Class_Colleges = (Class_Colleges) spin_college.getSelectedItem(); + str_ColID = obj_Class_Colleges.getcollege_id().toString(); + + GetFeespaid getFeesUnpaid = new GetFeespaid(getActivity()); + getFeesUnpaid.execute(); + } + + if(!collegeName.equals("Select Institution")) { + adapter.filter(collegeName, originalList); + }else{ + counter++; + collegeName = ""; + adapter.filter(collegeName, originalList); + + /* if(counter!=1){ + collegeName = ""; + adapter.filter(collegeName, originalList); + }*/ + } + + Log.d("Totalcountselectchange:", String.valueOf(lview.getCount())); + txt_actualTotalCounts.setText(String.valueOf(lview.getCount())); + } + + @Override + public void onNothingSelected(AdapterView parent) { + + } + }); + + + + // showActivity(); + return view; + } + + private void populateGetFeesRegistered() { + GetFeesRegistered getFeesRegistered = new GetFeesRegistered(getActivity()); + getFeesRegistered.execute(); + } + + /* private void populateList() { + + GetFeesPaid getFeesPaid = new GetFeesPaid(getActivity()); + getFeesPaid.execute(); + + }*/ + + /*public class GetFeesPaid extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + //private ProgressBar progressBar; + + GetFeesPaid (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapObject response = getFeesPaid(); + + //Log.d("Soap response is",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + *//* progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*//* + progressDialog.setMessage("Loading"); + progressDialog.setProgressStyle(android.R.attr.progressBarStyleSmall); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapObject result) { + + if(result != null){ + SoapPrimitive S_LeadId, S_StudentName, S_RegistrationDate, S_CollegeName, S_MobileNo, S_IsFeesPaid, S_Status; + Object O_LeadId, O_StudentName, O_RegistrationDate, O_CollegeName, O_MobileNo, O_IsFeesPaid, O_Status; + String str_leadid = null, str_studentName = null, str_registrationDate = null, str_collegeName = null, str_MobileNo = null, str_IsFeesPaid = null, str_Status = null; + + for (int i = 0; i < result.getPropertyCount(); i++) { + SoapObject list = (SoapObject) result.getProperty(i); + + //Log.d("DistrictResult", list.toString()); + + O_Status = list.getProperty("Status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) list.getProperty("Status"); + Log.d("Status:", S_Status.toString()); + str_Status = S_Status.toString(); + } + + if (str_Status.equalsIgnoreCase("Success")) { + + O_StudentName = list.getProperty("StudentName"); + if (!O_StudentName.toString().equals("anyType{}") && !O_StudentName.toString().equals(null)) { + S_StudentName = (SoapPrimitive) list.getProperty("StudentName"); + str_studentName = S_StudentName.toString(); + Log.d("StudentNameissss", str_studentName); + } + + O_LeadId = list.getProperty("Lead_id"); + if (!O_LeadId.toString().equals("anyType{}") && !O_LeadId.toString().equals(null)) { + S_LeadId = (SoapPrimitive) list.getProperty("Lead_id"); + str_leadid = S_LeadId.toString(); + Log.d("str_leadidisss", str_leadid); + } + + O_RegistrationDate = list.getProperty("RegistrationDate"); + if (!O_RegistrationDate.toString().equals("anyType{}") && !O_RegistrationDate.toString().equals(null)) { + S_RegistrationDate = (SoapPrimitive) list.getProperty("RegistrationDate"); + Log.d("S_RegistrationDate", S_RegistrationDate.toString()); + str_registrationDate = S_RegistrationDate.toString(); + Log.d("str_registrationDate", str_registrationDate); + } + + O_CollegeName = list.getProperty("CollegeName"); + if (!O_CollegeName.toString().equals("anyType{}") && !O_CollegeName.toString().equals(null)) { + S_CollegeName = (SoapPrimitive) list.getProperty("CollegeName"); + Log.d("S_CollegeName", S_CollegeName.toString()); + str_collegeName = S_CollegeName.toString(); + Log.d("str_collegeName", str_collegeName); + + collegeNameLst.add(str_collegeName); + + } + if (O_CollegeName.toString().equals("anyType{}") || O_CollegeName.toString().equals(null)) { + str_collegeName = ""; + //collegeNameLst.add(str_collegeName); + } + + O_MobileNo = list.getProperty("MobileNo"); + if (!O_MobileNo.toString().equals("anyType{}") && !O_MobileNo.toString().equals(null)) { + S_MobileNo = (SoapPrimitive) list.getProperty("MobileNo"); + Log.d("S_MobileNo", S_MobileNo.toString()); + str_MobileNo = S_MobileNo.toString(); + } + + O_IsFeesPaid = list.getProperty("isFeePaid"); + if (!O_IsFeesPaid.toString().equals("anyType{}") && !O_IsFeesPaid.toString().equals(null)) { + S_IsFeesPaid = (SoapPrimitive) list.getProperty("isFeePaid"); + Log.d("S_IsFeesPaid", S_IsFeesPaid.toString()); + str_IsFeesPaid = S_IsFeesPaid.toString(); + } + + FeesUnpaidModel item = null; + if (!str_collegeName.isEmpty()) { + item = new FeesUnpaidModel(str_studentName, str_leadid, str_registrationDate, str_collegeName, str_MobileNo, str_IsFeesPaid); + feesList.add(item); + } + + + } + + } + + originalList = new ArrayList(); + originalList.addAll(feesList); + + adapter.notifyDataSetChanged(); + //initCollegeSpinner(); + } + progressDialog.dismiss(); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapObject getFeesPaid() { + String METHOD_NAME = "GetStudentFeepaid"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetStudentFeepaid"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + request.addProperty("ManagerId",str_MangerID); + //users.ad + //request.add + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + Log.d("soapresponse1xxxxFees",envelope.getResponse().toString()); + + + SoapObject response = (SoapObject) envelope.getResponse(); + Log.e("soapresponseyyyyyyyFees",response.toString()); + + //return null; + + return response; + + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + + }*/ + + + private void initCollegeSpinner() { + collegeNameArrLst.addAll(collegeNameLst); + ArrayAdapter dataAdapter2 = new ArrayAdapter(getActivity(), R.layout.simple_spinner_items, collegeNameArrLst); + dataAdapter2.setDropDownViewResource(R.layout.spinnercustomstyle); + // attaching data adapter to spinner + spin_college.setAdapter(dataAdapter2); + //spin_college.setSupportBackgroundTintList(ContextCompat.getColorStateList(getActivity(), R.color.colorWhite)); + + } + + public class GetFeesRegistered extends AsyncTask { + + Context context; + AlertDialog alertDialog; + ProgressDialog progressDialgs; + + //private ProgressBar progressBar; + + GetFeesRegistered (Context ctx){ + context = ctx; + progressDialgs = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapObject response = getFeesRegistered(); + + //Log.d("Soap response is",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + progressDialgs.setMessage("Loading"); + progressDialgs.setProgressStyle(android.R.attr.progressBarStyleSmall); + progressDialgs.setCanceledOnTouchOutside(false); + progressDialgs.show(); + } + + @Override + protected void onPostExecute(SoapObject result) { + + if(result!=null){ + + SoapPrimitive S_TotalRegistrn, S_FeePaiedStudent, S_Status; + Object O_TotalRegistrn, O_FeePaiedStudent, O_Status; + String str_TotalRegistrn = null, str_FeePaiedStudent = null, str_Status = null; + + Log.d("Resultssssiss", result.toString()); + + + for (int i = 0; i < result.getPropertyCount(); i++) { + SoapObject list = (SoapObject) result.getProperty(i); + + //Log.d("DistrictResult", list.toString()); + + O_Status = list.getProperty("Status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) list.getProperty("Status"); + Log.d("Status:", S_Status.toString()); + str_Status = S_Status.toString(); + } + + if (str_Status.equalsIgnoreCase("Success")) { + O_TotalRegistrn = list.getProperty("TotalRegistration"); + if (!O_TotalRegistrn.toString().equals("anyType{}") && !O_TotalRegistrn.toString().equals(null)) { + S_TotalRegistrn = (SoapPrimitive) list.getProperty("TotalRegistration"); + Log.d("TotalRegistration:", S_TotalRegistrn.toString()); + str_TotalRegistrn = S_TotalRegistrn.toString(); + txt_studRegistered.setText(str_TotalRegistrn); + } + + O_FeePaiedStudent = list.getProperty("FeePaiedStudent"); + if (!O_FeePaiedStudent.toString().equals("anyType{}") && !O_FeePaiedStudent.toString().equals(null)) { + S_FeePaiedStudent = (SoapPrimitive) list.getProperty("FeePaiedStudent"); + Log.d("SFeePaiedStudent:", S_FeePaiedStudent.toString()); + str_FeePaiedStudent = S_FeePaiedStudent.toString(); + txt_feesPaidStudents.setText(str_FeePaiedStudent); + } + + + } + } + } + + progressDialgs.dismiss(); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapObject getFeesRegistered() { + String METHOD_NAME = "GetStudntRegAndPaiedStudentconts"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetStudntRegAndPaiedStudentconts"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + request.addProperty("ManagerId",str_MangerID); + //users.ad + //request.add + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + //Log.d("soapresponse1xxxxFees",envelope.getResponse().toString()); + + + SoapObject response = (SoapObject) envelope.getResponse(); + //Log.e("soapresponseyyyyyyyFees",response.toString()); + + //return null; + + return response; + + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + + } + + private class FeesCatglistAsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + /* dialog.setMessage("Please wait,District Loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show();*/ + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetFeesCatglist(); // get the District list + return null; + } + + public FeesCatglistAsyncCallWS(Context activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + + //dialog.dismiss(); + + /*uploadfromDB_Statelist(); + uploadfromDB_Districtlist(); + setSpinner();*/ + // uploadfromDB_Districtlist(); + + + if(str_FeesCatgStatus.equals("Success")) + { + + + dataAdapter_feesCatg = new ArrayAdapter(getContext(), R.layout.spinnercustomstyle, arrayObj_Class_FeesCatg); + //dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_feesCatg.setDropDownViewResource(R.layout.spinnercustomstyle); + // districtsearch_ATV.setAdapter(dataAdapter_district); + spin_feesCategory.setAdapter(dataAdapter_feesCatg); + spin_feesCategory.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + // } + } + + + }//end of onPostExecute + }// end Async task + + public void GetFeesCatglist() + { + + String URL = Class_URL.URL_Manager.toString().trim(); + String METHOD_NAME = "Get_Fees_Category_Master"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/Get_Fees_Category_Master"; + + + + //for final + + + try { +//vijay district + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + + // request.addProperty("distid", Long.parseLong(str_Sids));//Long + + // request.addProperty("distid", 17);//Long + + request.addProperty("Academic_Id", str_yearID);//Long + request.addProperty("Registration_Id", 0);//Long + request.addProperty("College_ID", 0);//Long + + //request.addProperty("stateId", 17);//Long + // long + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + // Log.i(TAG, "GetAllLoginDetails is running"); + // result1 = (Vector) envelope.getResponse(); + + // response = (SoapPrimitive) envelope.getResponse(); + + // SoapPrimitive res =(SoapPrimitive)envelope.getResponse(); + + SoapObject response = (SoapObject ) envelope.getResponse(); + Log.e("response feesCatglist",response.toString()); + feesCatglistcount = response.getPropertyCount(); + SoapObject districtresponse=(SoapObject)response.getProperty(0); + str_FeesCatgStatus=districtresponse.getProperty("Status").toString(); + Log.d("feesCatgcount", String.valueOf(response.getPropertyCount())); + + + if(str_FeesCatgStatus.equals("Success")) { + if (feesCatglistcount > 0) { + arrayObj_Class_FeesCatg = new Class_FeesCatg[feesCatglistcount]; + for (int i = 0; i < feesCatglistcount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + + Class_FeesCatg innerObj_Class_FeesCatg = new Class_FeesCatg(); + innerObj_Class_FeesCatg.setFees_category_code(response_soapobj.getProperty("fees_category_code").toString()); //1 + innerObj_Class_FeesCatg.setFees_category_description(response_soapobj.getProperty("Fees_category_description").toString()); //Hubballi + innerObj_Class_FeesCatg.setFees_Category_Slno(response_soapobj.getProperty("Fees_Category_Slno").toString());// HB + innerObj_Class_FeesCatg.setAcademic_year(response_soapobj.getProperty("academic_year").toString());// <1 + innerObj_Class_FeesCatg.setStatus(response_soapobj.getProperty("Status").toString());// <1 + innerObj_Class_FeesCatg.setFees(response_soapobj.getProperty("Fees").toString());// <1 + innerObj_Class_FeesCatg.setFees_ID(response_soapobj.getProperty("Fees_ID").toString());// <1 + + str_FeesCatgStatus = response_soapobj.getProperty("Status").toString(); + + arrayObj_Class_FeesCatg[i] = innerObj_Class_FeesCatg; + + }//end for loop + + }//end of if + + } + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + // internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + } + + private class CollegelistAsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + dialog.setMessage("Please wait,College loading..."); + + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetCollegelist(); // get the College list + return null; + } + + public CollegelistAsyncCallWS(Context activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + + dialog.dismiss(); + + + /* uploadfromDB_Statelist(); + uploadfromDB_Districtlist(); +*/ + /*uploadfromDB_Statelist(); + uploadfromDB_Districtlist(); + + uploadfromDB_collegeTypeSpinner();*/ //vijay + + if(str_CollegesStatus.equals("Success")) + { + /*if (str_isProfileEdited.equals("1")) + { + dataAdapter_college = new ArrayAdapter(getContext(), R.layout.spinnercustomstyle, arrayObj_Class_Colleges); + dataAdapter_college.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_college.setAdapter(dataAdapter_college); + spin_college.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + + str_ColID="y"; + if(O_collegename!="" || O_collegename!=null) + { + for (int i = 0; i < spin_institution.getCount(); i++) { + if (spin_college.getItemAtPosition(i).toString().equals(O_collegename)) + { + spin_college.setSelection(i); + break; + } + } + } + + } + else {*/ + + str_ColID="y"; + dataAdapter_college = new ArrayAdapter(getContext(), R.layout.spinnercustomstyle, arrayObj_Class_Colleges); + // dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_college.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_college.setAdapter(dataAdapter_college); + spin_college.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + //} + } + else { + //There are no colleges + if (str_CollegesStatus.equals("There are no colleges")) + { + /*List list = new ArrayList(); + list.add("No Colleges");*/ + dataAdapter_college = new ArrayAdapter(getContext(), R.layout.spinnercustomstyle, arrayObj_Class_Colleges3); + // dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_college.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_college.setAdapter(dataAdapter_college); + spin_college.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + + } + else + { + List list = new ArrayList(); + list.add("WS Exception"); + dataAdapter_college = new ArrayAdapter(getContext(), R.layout.spinnercustomstyle, list); + // dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_college.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_college.setAdapter(dataAdapter_college); + spin_college.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + + } + + } + + }//end of onPostExecute + }// end Async task + + public void GetCollegelist() + { + + String URL = Class_URL.URL_Login.toString().trim(); + String METHOD_NAME = "GetCollegesOnCity"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/GetCollegesOnCity"; + + + + //for final + + + try { + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + // request.addProperty("clgid", 0);//string shubham.dsep@detedu.org str_loginemailid + + + // int feesid =spin_feesCategory.getSelectedItemPosition(); + // Log.e("tag","feesID="+feesid); + // str_feesCatSlno= arrayObj_Class_FeesCatg[feesid].getFees_Category_Slno(); + Log.e("tag","Manager_Id="+MDId+"Fees_Category_Id="+str_feesCatSlno); + request.addProperty("city", 0);// long + request.addProperty("type", "");// string + request.addProperty("Manager_Id",MDId); + request.addProperty("Fees_Category_Id",str_feesCatSlno); + request.addProperty("User_Type","Manager"); + + // + Log.e("request collegelist",request.toString()); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + // Log.i(TAG, "GetAllLoginDetails is running"); + // result1 = (Vector) envelope.getResponse(); + + // response = (SoapPrimitive) envelope.getResponse(); + + // SoapPrimitive res =(SoapPrimitive)envelope.getResponse(); + + SoapObject response = (SoapObject ) envelope.getResponse(); + Log.e("resp collegelist",response.toString()); + collegeslistcount = response.getPropertyCount(); + SoapObject response_soapobj1 = (SoapObject) response.getProperty(0); + str_CollegesStatus=response_soapobj1.getProperty("Status").toString();//Status=There are no colleges; //Status=Success; + Log.d("Ccount", String.valueOf(response.getPropertyCount())); + + + + //anyType{CollegeId=0; TalukId=0; Status=There are no colleges; }; + + + /*SoapObject response_soapobj1 = (SoapObject) response.getProperty(0); + + nocollegestatus=response_soapobj1.getProperty("Status").toString();//Success + + Log.e("nocollege",nocollegestatus); + + + (str_CollegesStatus.equals("Success")) {*/ + if(str_CollegesStatus.equals("Success")) + { + if (collegeslistcount > 0) { + arrayObj_Class_Colleges = new Class_Colleges[collegeslistcount]; + + + for (int i = 0; i < collegeslistcount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + + /*long + long + string + string*/ + + Class_Colleges innerObj_Class_colleges = new Class_Colleges(); + innerObj_Class_colleges.setcollege_id(response_soapobj.getProperty("CollegeId").toString()); //long + innerObj_Class_colleges.setcollege_tid(response_soapobj.getProperty("TalukId").toString()); //long + innerObj_Class_colleges.setcollegename(response_soapobj.getProperty("College_Name").toString());// string + innerObj_Class_colleges.setFees(response_soapobj.getProperty("Fees").toString()); + innerObj_Class_colleges.setFees_Id(response_soapobj.getProperty("Fees_Id").toString()); + + innerObj_Class_colleges.setcollegestatus(response_soapobj.getProperty("Status").toString());// Success + + + str_CollegesStatus = response_soapobj.getProperty("Status").toString(); + + arrayObj_Class_Colleges[i] = innerObj_Class_colleges; + + + String str_collegeID = response_soapobj.getProperty("CollegeId").toString(); + String str_college_tid = response_soapobj.getProperty("TalukId").toString(); + String str_collegename = response_soapobj.getProperty("College_Name").toString(); + + + // DBCreate_Collegedetails_insert_2SQLiteDB(str_collegeID,str_college_tid,str_collegename); + + // DBCreate_Collegedetails_insert_2SQLiteDB(str_collegeID, str_college_tid, str_collegename); + + + }//end for loop + + }//end of if + + + }// end of if + else + { + arrayObj_Class_Colleges3 = new Class_Colleges[1]; + Class_Colleges innerObj_Class_colleges = new Class_Colleges(); + innerObj_Class_colleges.setcollege_id("0"); //long + innerObj_Class_colleges.setcollege_tid("0"); //long + innerObj_Class_colleges.setcollegename("There are no colleges");// string + + str_CollegesStatus ="There are no colleges"; + arrayObj_Class_Colleges3[0] = innerObj_Class_colleges; + + } + + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("getCollege fail", "> " + t.getMessage()); + // internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + } + + private class GetFromToDateAsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + /* dialog.setMessage("Please wait,District Loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show();*/ + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetFromToDate(); // get the District list + return null; + } + + public GetFromToDateAsyncCallWS(Context activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) { + + + if(str_FromToDateStatus.equals("Success")) { + Log.e("tag","arrayObj_Class_FromToDate="+arrayObj_Class_FromToDate.length); + for (int j=0;jlong + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + + SoapObject response = (SoapObject ) envelope.getResponse(); + Log.e("response datelist",response.toString()); + From_ToDateCount = response.getPropertyCount(); + SoapObject summaryresponse=(SoapObject)response.getProperty(0); + str_FromToDateStatus=summaryresponse.getProperty("Status").toString(); + Log.d("datelistcount", String.valueOf(response.getPropertyCount())); + + + if(str_FromToDateStatus.equals("Success")) { + if (From_ToDateCount > 0) { + arrayObj_Class_FromToDate = new Class_FromToDate[From_ToDateCount]; + for (int i = 0; i < From_ToDateCount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + + Class_FromToDate innerObj_Class_fromtodate = new Class_FromToDate(); + innerObj_Class_fromtodate.setAcademic_Code(response_soapobj.getProperty("Academic_Code").toString()); //1 + innerObj_Class_fromtodate.setAcademic_Id(response_soapobj.getProperty("Academic_Id").toString()); //Hubballi + innerObj_Class_fromtodate.setFrom_Date(response_soapobj.getProperty("From_Date").toString());// HB + innerObj_Class_fromtodate.setTo_Date(response_soapobj.getProperty("To_Date").toString());// <1 + innerObj_Class_fromtodate.setStatus(response_soapobj.getProperty("Status").toString());// <1 + innerObj_Class_fromtodate.setYear_Code(response_soapobj.getProperty("Year_Code").toString());// <1 + + str_FromToDateStatus = response_soapobj.getProperty("Status").toString(); + + arrayObj_Class_FromToDate[i] = innerObj_Class_fromtodate; + + }//end for loop + + }//end of if + + } + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + // internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + } + + public class GetFeespaid extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + //private ProgressBar progressBar; + + GetFeespaid (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapObject response = getFeespaid(); + + //Log.d("Soap response is",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + progressDialog.setMessage("Loading"); + progressDialog.setProgressStyle(android.R.attr.progressBarStyleSmall); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapObject result) { + + + if(str_studListStatus.equalsIgnoreCase("Success")){ + originalList = new ArrayList(); + originalList.addAll(feesList); + + adapter.notifyDataSetChanged(); + //progressBar.setVisibility(View.GONE); + + Log.d("Totalcountssss:", String.valueOf(lview.getCount())); + txt_actualTotalCounts.setText(String.valueOf(lview.getCount())); + + }else{ + Toast.makeText(getActivity(),str_studListStatus, Toast.LENGTH_LONG).show(); + + } + + progressDialog.dismiss(); + + + + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapObject getFeespaid() { + String METHOD_NAME = "Get_Manager_Payment_History"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/Get_Manager_Payment_History"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + FromDate=edt_fromdate.getText().toString(); + ToDate=edt_todate.getText().toString(); + Log.e("tag","FromDate="+FromDate); + Log.e("tag","Todate="+ToDate); + String outputPattern = "yyyy-MM-dd"; + String inputPattern = "dd-MM-yyyy"; + SimpleDateFormat inputFormat = new SimpleDateFormat(inputPattern); + SimpleDateFormat outputFormat = new SimpleDateFormat(outputPattern); + + Date date1 = null,date2=null; + String strFrom = null,strTo=null; + try { + date1 = inputFormat.parse(FromDate); + strFrom = outputFormat.format(date1); + date2 = inputFormat.parse(ToDate); + strTo = outputFormat.format(date2); + } catch (ParseException e) { + e.printStackTrace(); + } + Log.e("tag","DFormated FromDate="+strFrom); + Log.e("tag","DFormated Todate="+strTo); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + request.addProperty("Manager_Id",MDId); + request.addProperty("Fees_Category_Id",str_feesCatSlno); + request.addProperty("From_Date",strFrom); + request.addProperty("To_Date",strTo); + request.addProperty("College_Id",str_ColID); + //users.ad + //request.add + + Log.e("tag","request studpaidlist="+request.toString()); + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + Log.d("tag","soapresponse studPaid"+envelope.getResponse().toString()); + + + SoapObject response = (SoapObject) envelope.getResponse(); + Log.e("tag","soapresponse studPaid"+response.toString()); + + studentlistcount = response.getPropertyCount(); + SoapObject summaryresponse=(SoapObject)response.getProperty(0); + str_studListStatus=summaryresponse.getProperty("Status").toString(); + Log.d("summarylistcount", String.valueOf(response.getPropertyCount())); + + if(str_studListStatus.equalsIgnoreCase("Success")) { + if (studentlistcount > 0) { + arrayObj_Class_studList = new Class_PaidStudList[studentlistcount]; + // ViewSummaryList_arraylist.clear(); + for (int i = 0; i < studentlistcount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + Class_PaidStudList innerObj_Class_manager = new Class_PaidStudList(); + innerObj_Class_manager.setPayment_Id(response_soapobj.getProperty("Payment_Id").toString()); //1 + innerObj_Class_manager.setLead_Id(response_soapobj.getProperty("Lead_Id").toString()); //Hubballi + innerObj_Class_manager.setStudentName(response_soapobj.getProperty("StudentName").toString());// HB + innerObj_Class_manager.setRegistration_Id(response_soapobj.getProperty("Registration_Id").toString());// <1 + innerObj_Class_manager.setPaid_Fees(response_soapobj.getProperty("Paid_Fees").toString());// <1 + innerObj_Class_manager.setPaid_date(response_soapobj.getProperty("paid_date").toString());// <1 + innerObj_Class_manager.setCreated_Date(response_soapobj.getProperty("Created_Date").toString());// <1 + innerObj_Class_manager.setAuto_Receipt_No(response_soapobj.getProperty("Auto_Receipt_No").toString());// <1 + innerObj_Class_manager.setTransanction_Id(response_soapobj.getProperty("transanction_Id").toString());// <1 + innerObj_Class_manager.setReference_id(response_soapobj.getProperty("reference_id").toString());// <1 + innerObj_Class_manager.setFees_Category_description(response_soapobj.getProperty("Fees_Category_description").toString());// <1 + innerObj_Class_manager.setTransactionStatus(response_soapobj.getProperty("transactionStatus").toString());// <1 + innerObj_Class_manager.setYearCode(response_soapobj.getProperty("YearCode").toString());// <1 + innerObj_Class_manager.setPayment_Type(response_soapobj.getProperty("Payment_Type").toString());// <1 + innerObj_Class_manager.setPayeer_Id(response_soapobj.getProperty("Payeer_Id").toString());// <1 + innerObj_Class_manager.setCreated_User_Type(response_soapobj.getProperty("Created_User_Type").toString());// <1 + innerObj_Class_manager.setPayment_Mode(response_soapobj.getProperty("Payment_Mode").toString());// <1 + innerObj_Class_manager.setPayment_Remark(response_soapobj.getProperty("Payment_Remark").toString());// <1 + innerObj_Class_manager.setManager_Submission_Status(response_soapobj.getProperty("Manager_Submission_Status").toString());// <1 + innerObj_Class_manager.setPayment_Receipt_Path(response_soapobj.getProperty("Payment_Receipt_Path").toString());// <1 + innerObj_Class_manager.setRec_Date(response_soapobj.getProperty("Rec_Date").toString());// <1 + innerObj_Class_manager.setRec_Remark(response_soapobj.getProperty("Rec_Remark").toString());// <1 + innerObj_Class_manager.setRec_By(response_soapobj.getProperty("Rec_By").toString());// <1 + innerObj_Class_manager.setRec_Status(response_soapobj.getProperty("Rec_Status").toString());// <1 + innerObj_Class_manager.setStatus(response_soapobj.getProperty("Status").toString());// <1 + + str_studListStatus = response_soapobj.getProperty("Status").toString(); + + arrayObj_Class_studList[i] = innerObj_Class_manager; + + feesList.add(arrayObj_Class_studList[i]); + + // ViewSummaryList_arraylist.add(innerObj_Class_manager); + /* String str_districtID = response_soapobj.getProperty("DistrictId").toString(); + String str_districtname = response_soapobj.getProperty("DistrictName").toString(); + String str_districtstateid = response_soapobj.getProperty("Stateid").toString(); +*/ + //DBCreate_Districtdetails_insert_2SQLiteDB(str_districtID,str_districtname,str_districtstateid); + + + }//end for loop + + }//end of if + + } + //return null; + + return response; + + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String str_exceptionerror = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),str_exceptionerror, Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String str_exceptionerror = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),str_exceptionerror, Toast.LENGTH_LONG).show(); + } + }); + } + return null; + + } + +}//end of fragment class diff --git a/app/src/main/java/com/leadcampusapp/FeesSubmitFragment.java b/app/src/main/java/com/leadcampusapp/FeesSubmitFragment.java new file mode 100644 index 0000000..f7148ba --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/FeesSubmitFragment.java @@ -0,0 +1,1535 @@ +package com.leadcampusapp; /** + * Created by Admin on 20-07-2018. + */ + +import android.annotation.SuppressLint; +import android.app.Activity; +import android.app.AlertDialog; +import android.app.DatePickerDialog; +import android.app.Dialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.AsyncTask; +import android.os.Bundle; +import android.text.Editable; +import android.text.InputFilter; +import android.text.TextWatcher; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.Window; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.BaseAdapter; +import android.widget.Button; +import android.widget.DatePicker; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.ListView; +import android.widget.RadioGroup; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.appcompat.widget.AppCompatSpinner; +import androidx.core.content.ContextCompat; +import androidx.fragment.app.Fragment; +import androidx.recyclerview.widget.RecyclerView; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.LinkedHashSet; +import java.util.Locale; + +import static androidx.recyclerview.widget.RecyclerView.*; + +//import com.android.sripad.leadnew_22_6_2018.R; + +public class FeesSubmitFragment extends Fragment +{ + private ListView lview; + private ArrayList feesList; + private FeesPaidAcknowledgedAdapter adapter; + private SharedPreferences shardprefPM_obj; + private String str_MangerID; + private static final String PREFBook_PM= "prefbook_pm"; + private static final String PrefID_PMID = "prefid_pmid"; + private LinkedHashSet collegeNameLst; + private ArrayList collegeNameArrLst; + private AppCompatSpinner spin_college; + private ArrayList originalList = null; + private ProgressDialog progressDialog; + private EditText etSearch; + private TextView txt_studRegistered,txt_feesPaidStudents; + private int counter=0; + Integer MDId; + int summarylistcount,From_ToDateCount,summaryDetailslistcount,summaryDetailsCount; + String str_SummaryStatus,str_FromToDateStatus,str_SummaryDetailsStatus="null",getStr_SummaryDetailsStatus; + Class_ManagerSummary[] arrayObj_Class_Summary, arrayObj_Class_Summary2; + Class_ManagerSummary obj_Class_Summary; + Class_ManagerSummaryDetails[] arrayObj_Class_SummaryDetails; + Class_FromToDate[] arrayObj_Class_FromToDate; + String FromDate,ToDate; + Class_FromToDate obj_Class_FromToDate; + + ImageView FromToDate_btn; + ListView lv_summary,lv_paidlist; + EditText edt_fromdate,edt_todate,fromdateseterror_TV,todateseterror_TV; + private int mYear, mMonth, mDay; + private int cYear, cMonth, cDay; + SummaryListViewAdapter summaryListViewAdapter; + SummaryDetailsViewAdapter summaryDetailsViewAdapter; + private ArrayList ViewSummaryList_arraylist; + private ArrayList ViewSummaryDetailsList_arraylist; + + EditText stfonlinetrans_no_tv,stfonlinetransAmount_tv,stfamountbycash_tv,stfonline_receiptno_tv,stfamountbycash_receiptno_tv; + Class_InternetDectector internetDectector; + Boolean isInternetPresent = false; + + Boolean bo_onlinechecked=false,bo_foronline=false,bo_cashchecked=true; + Boolean bo_dialogdismiss=false; + Button submitfeesstf_bt; + String forOnline="No"; + + String str_categoryID,str_Amount,str_remarks,str_paymentMode="1",str_categoryName; + String str_response_onlinefeesNEFT="fail"; + String str_response_cash="fail"; + + Class_FeesCatg[] arrayObj_Class_FeesCatg; + Class_FeesCatg obj_Class_FeesCatg; + int feesCatglistcount; + String str_FeesCatgStatus="x"; + ArrayAdapter dataAdapter_feesCatg; + AppCompatSpinner spin_feesCategory; + SharedPreferences shardpref_S_obj; + SharedPreferences.Editor editor_S; + + public static final String PREFBook_Stud= "prefbook_stud"; + public static final String PrefId_S_AcademicId = "prefid_sacademicid"; + String str_academicId,str_feesCatSlno,str_feesCatName; + + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + + View view=inflater.inflate(R.layout.frag_fees_submit, container, false); + + + + shardprefPM_obj = getActivity().getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MangerID = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + Log.d("str_MangerID:",str_MangerID); + MDId=Integer.parseInt(str_MangerID); + + shardpref_S_obj=getActivity().getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + + str_academicId = shardpref_S_obj.getString(PrefId_S_AcademicId, "").trim(); + Log.d("str_academicId:",str_academicId); + + ViewSummaryList_arraylist = new ArrayList(); + ViewSummaryDetailsList_arraylist = new ArrayList(); + edt_fromdate = (EditText) view.findViewById(R.id.edt_fromdate); + fromdateseterror_TV = (EditText) view.findViewById(R.id.fromdateseterror_TV); + edt_todate = (EditText) view.findViewById(R.id.edt_todate); + todateseterror_TV = (EditText) view.findViewById(R.id.todateseterror_TV); + FromToDate_btn = (ImageView) view.findViewById(R.id.FromToDate_btn); + lv_summary = (ListView) view.findViewById(R.id.lv_summary); + lv_paidlist = (ListView) view.findViewById(R.id.lv_paidlist); + spin_feesCategory = (AppCompatSpinner) view.findViewById(R.id.spin_feesCategory); + + summaryListViewAdapter = new SummaryListViewAdapter(getActivity(), ViewSummaryList_arraylist); + summaryDetailsViewAdapter = new SummaryDetailsViewAdapter(getActivity(), ViewSummaryDetailsList_arraylist); + + GetFromToDateAsyncCallWS getFromToDateAsyncCallWS=new GetFromToDateAsyncCallWS(getActivity()); + getFromToDateAsyncCallWS.execute(); + + FeesCatglistAsyncCallWS feesCatglistAsyncCallWS=new FeesCatglistAsyncCallWS(getActivity()); + feesCatglistAsyncCallWS.execute(); + + FromToDate_btn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + GetSummarylistAsyncCallWS getSummarylistAsyncCallWS=new GetSummarylistAsyncCallWS(getActivity()); + getSummarylistAsyncCallWS.execute(); + + GetSummaryDetailslistAsyncCallWS getSummaryDetailslistAsyncCallWS=new GetSummaryDetailslistAsyncCallWS(getActivity()); + getSummaryDetailslistAsyncCallWS.execute(); + } + }); + + spin_feesCategory.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected (AdapterView < ? > parent, View view, + int position, long id){ + // TODO Auto-generated method stub + obj_Class_FeesCatg = (Class_FeesCatg) spin_feesCategory.getSelectedItem(); + + str_feesCatSlno = obj_Class_FeesCatg.getFees_Category_Slno().toString(); + str_feesCatName = obj_Class_FeesCatg.getFees_category_description().toString(); + + Log.e("tag","str_feesCatName="+str_feesCatName); + + // Toast.makeText(getApplicationContext(),"str_Programsid: "+str_programid,Toast.LENGTH_SHORT).show(); + } + + @Override + public void onNothingSelected (AdapterView < ? > parent){ + // TODO Auto-generated method stub + } + }); + + edt_fromdate.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + final Calendar c = Calendar.getInstance(); + + mYear = c.get(Calendar.YEAR); + mMonth = c.get(Calendar.MONTH); + mDay = c.get(Calendar.DAY_OF_MONTH); + + DatePickerDialog datePickerDialog = new DatePickerDialog(getActivity(), R.style.DatePickerTheme, + new DatePickerDialog.OnDateSetListener() { + + @Override + public void onDateSet(DatePicker view, int year, + int monthOfYear, int dayOfMonth) { + + cDay = dayOfMonth; + cMonth = monthOfYear; + cYear = year; + + // String date =dayOfMonth + "/" + (monthOfYear + 1) + "/" + year; + // String date =year + "-" + (monthOfYear + 1) + "-" + dayOfMonth; + String date =dayOfMonth + "-" + (monthOfYear + 1) + "-" + year; + + + SimpleDateFormat dateFormat= new SimpleDateFormat("dd-MM-yyyy"); + // SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd"); + + try { + Date d=dateFormat.parse(date); + System.out.println("Formated from"+dateFormat.format(d)); + fromdateseterror_TV.setVisibility(View.GONE); + edt_fromdate.setText(dateFormat.format(d).toString()); + + } + catch(Exception e) { + //java.text.ParseException: Unparseable date: Geting error + System.out.println("Excep"+e); + } + //TextView txtExactDate = (TextView) findViewById(R.id.txt_exactDate); + + + //txtDate.edita + } + }, mYear, mMonth, mDay); + + datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()); + //datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()-(1000 * 60 * 60 * 24 * 365 * 14)); + // - (1000 * 60 * 60 * 24 * 365.25 * 14) +//------ + + datePickerDialog.show(); + summaryDetailsViewAdapter.notifyDataSetChanged(); + lv_paidlist.setAdapter(summaryDetailsViewAdapter); + } + }); + edt_todate.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + final Calendar c = Calendar.getInstance(); + + mYear = c.get(Calendar.YEAR); + mMonth = c.get(Calendar.MONTH); + mDay = c.get(Calendar.DAY_OF_MONTH); + + DatePickerDialog datePickerDialog = new DatePickerDialog(getActivity(), R.style.DatePickerTheme, + new DatePickerDialog.OnDateSetListener() { + + @Override + public void onDateSet(DatePicker view, int year, + int monthOfYear, int dayOfMonth) { + + cDay = dayOfMonth; + cMonth = monthOfYear; + cYear = year; + + // String date =dayOfMonth + "/" + (monthOfYear + 1) + "/" + year; + // String date =year + "-" + (monthOfYear + 1) + "-" + dayOfMonth; + String date =dayOfMonth + "-" + (monthOfYear + 1) + "-" + year; + + + + SimpleDateFormat dateFormat= new SimpleDateFormat("dd-MM-yyyy"); + // SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd"); + + try { + Date d=dateFormat.parse(date); + System.out.println("Formated to"+dateFormat.format(d)); + todateseterror_TV.setVisibility(View.GONE); + edt_todate.setText(dateFormat.format(d).toString()); + + } + catch(Exception e) { + //java.text.ParseException: Unparseable date: Geting error + System.out.println("Excep"+e); + } + //TextView txtExactDate = (TextView) findViewById(R.id.txt_exactDate); + + + //txtDate.edita + } + }, mYear, mMonth, mDay); + + datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()); + //datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()-(1000 * 60 * 60 * 24 * 365 * 14)); + // - (1000 * 60 * 60 * 24 * 365.25 * 14) +//------ + + datePickerDialog.show(); + summaryDetailsViewAdapter.notifyDataSetChanged(); + lv_paidlist.setAdapter(summaryDetailsViewAdapter); + } + + }); + + // showActivity(); + return view; + } + + private class GetFromToDateAsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + /* dialog.setMessage("Please wait,District Loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show();*/ + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetFromToDate(); // get the District list + return null; + } + + public GetFromToDateAsyncCallWS(Context activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) { + + + if(str_FromToDateStatus.equals("Success")) { + Log.e("tag","arrayObj_Class_FromToDate="+arrayObj_Class_FromToDate.length); + for (int j=0;jlong + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + + SoapObject response = (SoapObject ) envelope.getResponse(); + Log.e("response datelist",response.toString()); + From_ToDateCount = response.getPropertyCount(); + SoapObject summaryresponse=(SoapObject)response.getProperty(0); + str_FromToDateStatus=summaryresponse.getProperty("Status").toString(); + Log.d("datelistcount", String.valueOf(response.getPropertyCount())); + + + if(str_FromToDateStatus.equals("Success")) { + if (From_ToDateCount > 0) { + arrayObj_Class_FromToDate = new Class_FromToDate[From_ToDateCount]; + for (int i = 0; i < From_ToDateCount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + + Class_FromToDate innerObj_Class_fromtodate = new Class_FromToDate(); + innerObj_Class_fromtodate.setAcademic_Code(response_soapobj.getProperty("Academic_Code").toString()); //1 + innerObj_Class_fromtodate.setAcademic_Id(response_soapobj.getProperty("Academic_Id").toString()); //Hubballi + innerObj_Class_fromtodate.setFrom_Date(response_soapobj.getProperty("From_Date").toString());// HB + innerObj_Class_fromtodate.setTo_Date(response_soapobj.getProperty("To_Date").toString());// <1 + innerObj_Class_fromtodate.setStatus(response_soapobj.getProperty("Status").toString());// <1 + innerObj_Class_fromtodate.setYear_Code(response_soapobj.getProperty("Year_Code").toString());// <1 + + str_FromToDateStatus = response_soapobj.getProperty("Status").toString(); + + arrayObj_Class_FromToDate[i] = innerObj_Class_fromtodate; + + }//end for loop + + }//end of if + + } + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + // internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + } + + private class GetSummarylistAsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + dialog.setMessage("Please wait Loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetSummarylist(); // get the District list + return null; + } + + public GetSummarylistAsyncCallWS(Context activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) { + + Log.e("tag","arrayObj_Class_Summary[j].length=="+arrayObj_Class_Summary.length); + + dialog.dismiss(); + if(str_SummaryStatus.equals("Success")) { + for (int j=0;jlong + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + // Log.i(TAG, "GetAllLoginDetails is running"); + // result1 = (Vector) envelope.getResponse(); + + // response = (SoapPrimitive) envelope.getResponse(); + + // SoapPrimitive res =(SoapPrimitive)envelope.getResponse(); + + SoapObject response = (SoapObject ) envelope.getResponse(); + Log.e("response summarylist",response.toString()); + summarylistcount = response.getPropertyCount(); + SoapObject summaryresponse=(SoapObject)response.getProperty(0); + str_SummaryStatus=summaryresponse.getProperty("Status").toString(); + Log.d("summarylistcount", String.valueOf(response.getPropertyCount())); + + + if(str_SummaryStatus.equals("Success")) { + if (summarylistcount > 0) { + arrayObj_Class_Summary = new Class_ManagerSummary[summarylistcount]; + ViewSummaryList_arraylist.clear(); + for (int i = 0; i < summarylistcount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + + Class_ManagerSummary innerObj_Class_manager = new Class_ManagerSummary(); + innerObj_Class_manager.setFees_Category_Id(response_soapobj.getProperty("Fees_Category_Id").toString()); //1 + innerObj_Class_manager.setFees_Category_Name(response_soapobj.getProperty("Fees_Category_Name").toString()); //Hubballi + innerObj_Class_manager.setSubmitted(response_soapobj.getProperty("Submitted").toString());// HB + innerObj_Class_manager.setCollected(response_soapobj.getProperty("Collected").toString());// <1 + innerObj_Class_manager.setStatus(response_soapobj.getProperty("Status").toString());// <1 + innerObj_Class_manager.setBalance(response_soapobj.getProperty("Balance").toString());// <1 + + str_SummaryStatus = response_soapobj.getProperty("Status").toString(); + + arrayObj_Class_Summary[i] = innerObj_Class_manager; + + + ViewSummaryList_arraylist.add(innerObj_Class_manager); + /* String str_districtID = response_soapobj.getProperty("DistrictId").toString(); + String str_districtname = response_soapobj.getProperty("DistrictName").toString(); + String str_districtstateid = response_soapobj.getProperty("Stateid").toString(); +*/ + //DBCreate_Districtdetails_insert_2SQLiteDB(str_districtID,str_districtname,str_districtstateid); + + + }//end for loop + + }//end of if + + } + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + // internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + } + + private class GetSummaryDetailslistAsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + dialog.setMessage("Please wait Loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetSummaryDetailslist(); // get the District list + return null; + } + + public GetSummaryDetailslistAsyncCallWS(Context activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) { + + Log.e("tag","arrayObj_Class_Summary[j].length=="+arrayObj_Class_Summary.length); + + dialog.dismiss(); + if(str_SummaryDetailsStatus.equals("Success")) { + for (int j=0;jlong + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + Log.e("tag","request summDetails="+request); + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + // Log.i(TAG, "GetAllLoginDetails is running"); + // result1 = (Vector) envelope.getResponse(); + + // response = (SoapPrimitive) envelope.getResponse(); + + // SoapPrimitive res =(SoapPrimitive)envelope.getResponse(); + + SoapObject response = (SoapObject ) envelope.getResponse(); + Log.e("response summaryDetails",response.toString()); + summaryDetailslistcount = response.getPropertyCount(); + SoapObject summaryresponse=(SoapObject)response.getProperty(0); + str_SummaryDetailsStatus=summaryresponse.getProperty("Status").toString(); + Log.d("summarylistcount", String.valueOf(response.getPropertyCount())); + + + if(str_SummaryDetailsStatus.equals("Success")) { + if (summaryDetailslistcount > 0) { + arrayObj_Class_SummaryDetails = new Class_ManagerSummaryDetails[summaryDetailslistcount]; + ViewSummaryDetailsList_arraylist.clear(); + for (int i = 0; i < summaryDetailslistcount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + Class_ManagerSummaryDetails innerObj_Class_manager = new Class_ManagerSummaryDetails(); + innerObj_Class_manager.setSubmission_slno(response_soapobj.getProperty("Submission_slno").toString()); //1 + innerObj_Class_manager.setFees_Category_Id(response_soapobj.getProperty("Fees_Category_Id").toString()); //Hubballi + innerObj_Class_manager.setFees_Category_description(response_soapobj.getProperty("Fees_Category_description").toString());// HB + innerObj_Class_manager.setSubmission_Amount(response_soapobj.getProperty("Submission_Amount").toString());// <1 + innerObj_Class_manager.setSubmitted_Date(response_soapobj.getProperty("Submitted_Date").toString());// <1 + innerObj_Class_manager.setSubmitted_Mode(response_soapobj.getProperty("Submitted_Mode").toString());// <1 + innerObj_Class_manager.setSubmitted_Remark(response_soapobj.getProperty("Submitted_Remark").toString());// <1 + innerObj_Class_manager.setSubmitted_By(response_soapobj.getProperty("Submitted_By").toString());// <1 + innerObj_Class_manager.setRec_Status(response_soapobj.getProperty("Rec_Status").toString());// <1 + innerObj_Class_manager.setSubmitter_Name(response_soapobj.getProperty("Submitter_Name").toString());// <1 + innerObj_Class_manager.setRec_Date(response_soapobj.getProperty("Rec_Date").toString());// <1 + innerObj_Class_manager.setRec_By(response_soapobj.getProperty("Rec_By").toString());// <1 + innerObj_Class_manager.setRec_Mail_id(response_soapobj.getProperty("Rec_Mail_id").toString());// <1 + innerObj_Class_manager.setRec_Remark(response_soapobj.getProperty("Rec_Remark").toString());// <1 + innerObj_Class_manager.setStatus(response_soapobj.getProperty("Status").toString());// <1 + + str_SummaryDetailsStatus = response_soapobj.getProperty("Status").toString(); + + arrayObj_Class_SummaryDetails[i] = innerObj_Class_manager; + + + ViewSummaryDetailsList_arraylist.add(innerObj_Class_manager); + /* String str_districtID = response_soapobj.getProperty("DistrictId").toString(); + String str_districtname = response_soapobj.getProperty("DistrictName").toString(); + String str_districtstateid = response_soapobj.getProperty("Stateid").toString(); +*/ + //DBCreate_Districtdetails_insert_2SQLiteDB(str_districtID,str_districtname,str_districtstateid); + + + }//end for loop + + }//end of if + + } + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + // internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + } + + public class SummaryListViewAdapter extends BaseAdapter { + + + public ArrayList projList; + Activity activity; + private ArrayList mDisplayedValues = null; + + public SummaryListViewAdapter(Activity activity, ArrayList projList) { + super(); + this.activity = activity; + this.projList = projList; + this.mDisplayedValues = projList; + } + + @Override + public int getCount() { + //return projList.size(); + Log.e("size", String.valueOf(mDisplayedValues.size())); + return mDisplayedValues.size(); + + } + + @Override + public Class_ManagerSummary getItem(int position) { + + //return projList.get(position); + return mDisplayedValues.get(position); + } + + @Override + public long getItemId(int position) { + return position; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + + ViewHolder holder; + LayoutInflater inflater = activity.getLayoutInflater(); + + if (convertView == null) { + convertView = inflater.inflate(R.layout.child_summarylist_item, null); + holder = new ViewHolder(); + + holder.category_tv = (TextView) convertView.findViewById(R.id.category_tv); + // holder.total_tv = (TextView) convertView.findViewById(R.id.total_tv); + holder.recevied_tv = (TextView) convertView.findViewById(R.id.recevied_tv); + holder.submit_tv = (TextView) convertView.findViewById(R.id.submit_tv); + holder.balance_tv = (TextView) convertView.findViewById(R.id.balance_tv); + holder.pay_iv = (ImageView) convertView.findViewById(R.id.pay_iv); + holder.categoryID_tv = (TextView) convertView.findViewById(R.id.categoryID_tv); + + // holder.status_tv=(TextView)convertView.findViewById(R.id.status_tv); + convertView.setTag(holder); + } else { + holder = (ViewHolder) convertView.getTag(); + } + Class_ManagerSummary Obj_Class_farmerlistdetails = (Class_ManagerSummary) getItem(position); + + + if (Obj_Class_farmerlistdetails != null) { + { + // String FullName = Obj_Class_farmerlistdetails.getStudentName(); + holder.category_tv.setText(Obj_Class_farmerlistdetails.getFees_Category_Name()); + holder.categoryID_tv.setText(Obj_Class_farmerlistdetails.getFees_Category_Id()); + holder.recevied_tv.setText(Obj_Class_farmerlistdetails.getCollected()); + holder.submit_tv.setText(Obj_Class_farmerlistdetails.getSubmitted()); + holder.balance_tv.setText(Obj_Class_farmerlistdetails.getBalance()); + // holder.total_tv.setText(Obj_Class_farmerlistdetails.getCollected()); + + } + + } + + if(holder.balance_tv.getText().toString().equalsIgnoreCase("0")){ + holder.pay_iv.setVisibility(GONE); + }else{ + holder.pay_iv.setVisibility(VISIBLE); + } + holder.pay_iv.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + final Dialog dialog = new Dialog(getActivity()); + + dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); + dialog.setContentView(R.layout.dialog_tuitionfeessubmission); + dialog.setCancelable(false); + TextView header_tv = (TextView) dialog.findViewById(R.id.header_tv); + Button dialogcancelbutton = (Button) dialog.findViewById(R.id.stfeescanceldialog_BT); + Button dialogsubmitbutton = (Button) dialog.findViewById(R.id.stfeessubmitdialog_BT); + stfonlinetrans_no_tv = (EditText) dialog.findViewById(R.id.Stfonlinetrans_no_TV); + stfonlinetransAmount_tv=(EditText)dialog.findViewById(R.id.StfonlinetransAmount_TV); + stfamountbycash_tv=(EditText)dialog.findViewById(R.id.StfAmountbycash_TV); + stfonline_receiptno_tv=(EditText)dialog.findViewById(R.id.Stfonline_receiptno_TV); + stfamountbycash_receiptno_tv=(EditText)dialog.findViewById(R.id.StfAmountbycash_receiptno_TV); + + stfonlinetransAmount_tv.setText(holder.balance_tv.getText().toString()); + header_tv.setText("Submit to Account"); + + + dialogcancelbutton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + dialog.dismiss(); + bo_cashchecked=true; + bo_onlinechecked=false; + } + }); + + dialogsubmitbutton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + internetDectector = new Class_InternetDectector(getActivity()); + isInternetPresent = internetDectector.isConnectingToInternet(); + + if (bo_onlinechecked ||bo_cashchecked) { + if (isInternetPresent) + { + + + Log.e("tag","str_categoryName="+str_categoryName+"str_Amount="+str_Amount); + + // Toast.makeText(getApplicationContext(),"Outside value:"+forOnline,Toast.LENGTH_LONG).show(); + if(validationfor_dialog()) + { + + if(forOnline.equals("yes")) + { + // Toast.makeText(getActivity(), "Online", Toast.LENGTH_SHORT).show(); + str_paymentMode="2"; + bo_dialogdismiss = true; + } + else + { + // Toast.makeText(getActivity(), "Cash", Toast.LENGTH_SHORT).show(); + str_paymentMode="1"; + bo_dialogdismiss = true; + } + String balanceAmt=holder.balance_tv.getText().toString(); + int balanceAmtInt=Integer.valueOf(balanceAmt); + + stfonlinetransAmount_tv.setFilters(new InputFilter[]{new InputFilterMinMax("1", balanceAmt)}); + str_categoryID= holder.categoryID_tv.getText().toString(); + str_Amount=stfonlinetransAmount_tv.getText().toString(); + str_categoryName=holder.category_tv.getText().toString(); + str_remarks=stfonline_receiptno_tv.getText().toString(); + int enterdAmtInt=Integer.valueOf(str_Amount); + if(balanceAmtInt7) + { + stfonline_receiptno_tv.setError("Maximum 6 digit"); + stfonlinereceipt_no_tv_VR7=false; + }*/ + + // } + + /*if(bo_cashchecked) { + if (stfamountbycash_tv.getText().toString().trim().length() == 0) { + stfamountbycash_tv.setError("Empty Not Allowed"); + stfamountbycash_tv.requestFocus(); + stfamountbycash_tv_VR5 = false; + } else if (stfamountbycash_tv.getText().toString().trim().length() < 2) { + stfamountbycash_tv.setError("Minimum Rs100"); + stfamountbycash_tv.requestFocus(); + stfamountbycash_tv_VR6 = false; + } + + + + + if(stfamountbycash_receiptno_tv.getText().toString().trim().length()==0||stfamountbycash_receiptno_tv.getText().toString().trim().length()<1) + { + stfamountbycash_receiptno_tv.setError("Empty is not allowed"); + stfamountbycash_receipt_no_tv_VR7=false; + } + + if(stfamountbycash_receiptno_tv.getText().toString().trim().length()<7||stfamountbycash_receiptno_tv.getText().toString().trim().length()==1) + { + if(stfamountbycash_receiptno_tv.getText().toString().trim().equals("0")||stfamountbycash_receiptno_tv.getText().toString().trim().equals("00")|| + stfamountbycash_receiptno_tv.getText().toString().trim().equals("000")||stfamountbycash_receiptno_tv.getText().toString().trim().equals("0000")|| + stfamountbycash_receiptno_tv.getText().toString().trim().equals("00000")||stfamountbycash_receiptno_tv.getText().toString().trim().equals("000000")) + { + stfamountbycash_receiptno_tv.setError("Zero not allowed"); + stfamountbycash_receipt_no_tv_VR8=false; + } + + } + + if(stfamountbycash_receiptno_tv.getText().toString().trim().length()>7) + { + stfamountbycash_receiptno_tv.setError("Maximum 6 digit"); + stfamountbycash_receipt_no_tv_VR9=false; + } + + + + + }*/ + + + // if(bo_onlinechecked) + //{ + if(stfonlinetransAmount_tv_VR3&&stfonlinetransAmount_tv_VR4 + &&stfonlinereceipt_no_tv_VR5) + { bo_return=true; } + else { bo_return=false; } + /* } + if(bo_cashchecked) + { + if(stfamountbycash_tv_VR5&&stfamountbycash_tv_VR6&&stfamountbycash_receipt_no_tv_VR7&&stfamountbycash_receipt_no_tv_VR8 + &&stfamountbycash_receipt_no_tv_VR9) + { bo_return=true;} + else {bo_return=false;} + + }*/ + + /* if(stfonlinetrans_no_tv_VR1&&stfonlinetrans_no_tv_VR2&&stfonlinetransAmount_tv_VR3&&stfonlinetransAmount_tv_VR4&&stfamountbycash_tv_VR5&&stfamountbycash_tv_VR6) + { return true;}else{return false;} +*/ + + if(bo_onlinechecked||bo_onlinechecked){return bo_return; } + else { return bo_return; } + + } + + public static class ViewHolder { + TextView category_tv,total_tv,recevied_tv,submit_tv,balance_tv,categoryID_tv; + ImageView pay_iv; + } + + + + public class SubmitAmountDetails extends AsyncTask { + + AlertDialog alertDialog; + // private ProgressBar progressBar; + ProgressDialog dialog; + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapPrimitive response = SubmitAmount(); + + // SoapObject response = ReApplyProjectDetails(); + Log.d("Soap response issssss",response.toString()); + + return response; + } + + public SubmitAmountDetails(Context activity) { + // context = activity; + dialog = new ProgressDialog(activity); + } + @Override + protected void onPreExecute() { + dialog.setMessage("Please wait Loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + if(result!=null) { + if (result.toString().equals("Error")) { + Toast.makeText(getContext(), "Error occured while saving to database", Toast.LENGTH_LONG).show(); + } else { + Toast.makeText(getContext(), "Sucessfully Updated", Toast.LENGTH_LONG).show(); + GetSummarylistAsyncCallWS getSummarylistAsyncCallWS=new GetSummarylistAsyncCallWS(getActivity()); + getSummarylistAsyncCallWS.execute(); + + GetSummaryDetailslistAsyncCallWS getSummaryDetailslistAsyncCallWS=new GetSummaryDetailslistAsyncCallWS(getActivity()); + getSummaryDetailslistAsyncCallWS.execute(); } + } + dialog.dismiss(); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + private SoapPrimitive SubmitAmount() { + String METHOD_NAME = "Manager_Submit_Fees"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/Manager_Submit_Fees"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + request.addProperty("Fees_Category_Id",Integer.valueOf(str_categoryID)); + request.addProperty("Fees_Category_Name",str_categoryName); + request.addProperty("Submission_Amount",Integer.valueOf(str_Amount)); + request.addProperty("Payment_Mode",Integer.valueOf(str_paymentMode)); + request.addProperty("Remark",str_remarks); + request.addProperty("Submitted_By",MDId); + + Log.d("PDIdssssssxxxx","hi"); + + Log.d("Request submit fees=",request.toString()); + Log.e("tag","2 str_categoryName="+str_categoryName+"2 str_Amount="+str_Amount); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + Log.e("tag","soap masterrequest update"+envelope.getResponse().toString()); + + //return null; + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + } + return null; + + } + + public static class ViewHolderDetails { + + TextView amount,paidDate,payMode,paymentStatus,recBy,remark,feesCategory,subName; + } + public class SummaryDetailsViewAdapter extends BaseAdapter { + + + public ArrayList projList; + Activity activity; + private ArrayList mDisplayedValues = null; + + public SummaryDetailsViewAdapter(Activity activity, ArrayList projList) { + super(); + this.activity = activity; + this.projList = projList; + this.mDisplayedValues = projList; + } + + @Override + public int getCount() { + //return projList.size(); + Log.e("size", String.valueOf(mDisplayedValues.size())); + return mDisplayedValues.size(); + + } + + @Override + public Class_ManagerSummaryDetails getItem(int position) { + + //return projList.get(position); + return mDisplayedValues.get(position); + } + + @Override + public long getItemId(int position) { + return position; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + + ViewHolderDetails holder; + LayoutInflater inflater = activity.getLayoutInflater(); + + if (convertView == null) { + convertView = inflater.inflate(R.layout.manager_submitted_feeslist, null); + holder = new ViewHolderDetails(); + + holder.amount = (TextView) convertView.findViewById(R.id.amount); + holder.paidDate = (TextView) convertView.findViewById(R.id.paidDate); + holder.payMode = (TextView) convertView.findViewById(R.id.payMode); + holder.paymentStatus = (TextView) convertView.findViewById(R.id.paymentStatus); + holder.recBy = (TextView) convertView.findViewById(R.id.recBy); + holder.remark = (TextView) convertView.findViewById(R.id.remark); + holder.subName = (TextView) convertView.findViewById(R.id.subName); + holder.feesCategory = (TextView) convertView.findViewById(R.id.feesCategory); + +// holder.categoryID_tv = (TextView) convertView.findViewById(R.id.categoryID_tv); + + // holder.status_tv=(TextView)convertView.findViewById(R.id.status_tv); + convertView.setTag(holder); + } else { + holder = (ViewHolderDetails) convertView.getTag(); + } + Class_ManagerSummaryDetails Obj_Class_farmerlistdetails = (Class_ManagerSummaryDetails) getItem(position); + + + if (Obj_Class_farmerlistdetails != null) { + { + // String FullName = Obj_Class_farmerlistdetails.getStudentName(); + holder.amount.setText(Obj_Class_farmerlistdetails.getSubmission_Amount()); + holder.paidDate.setText(Obj_Class_farmerlistdetails.getSubmitted_Date()); + holder.payMode.setText(Obj_Class_farmerlistdetails.getSubmitted_Mode()); + holder.paymentStatus.setText(Obj_Class_farmerlistdetails.getRec_Status()); + holder.recBy.setText(Obj_Class_farmerlistdetails.getRec_By()); + holder.remark.setText(Obj_Class_farmerlistdetails.getRec_Remark()); + holder.subName.setText(Obj_Class_farmerlistdetails.getSubmitter_Name()); + holder.feesCategory.setText(Obj_Class_farmerlistdetails.getFees_Category_description()); + + } + + } + + return convertView; + } + + } + + private class FeesCatglistAsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + /* dialog.setMessage("Please wait,District Loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show();*/ + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetFeesCatglist(); // get the District list + return null; + } + + public FeesCatglistAsyncCallWS(Context activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + + //dialog.dismiss(); + + /*uploadfromDB_Statelist(); + uploadfromDB_Districtlist(); + setSpinner();*/ + // uploadfromDB_Districtlist(); + + + if(str_FeesCatgStatus.equals("Success")) + { + + + dataAdapter_feesCatg = new ArrayAdapter(getContext(), R.layout.spinnercustomstyle, arrayObj_Class_FeesCatg); + //dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_feesCatg.setDropDownViewResource(R.layout.spinnercustomstyle); + // districtsearch_ATV.setAdapter(dataAdapter_district); + spin_feesCategory.setAdapter(dataAdapter_feesCatg); + spin_feesCategory.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + // } + } + + + }//end of onPostExecute + }// end Async task + + public void GetFeesCatglist() + { + + String URL = Class_URL.URL_Manager.toString().trim(); + String METHOD_NAME = "Get_Fees_Category_Master"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/Get_Fees_Category_Master"; + + + + //for final + + + try { +//vijay district + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + + // request.addProperty("distid", Long.parseLong(str_Sids));//Long + + // request.addProperty("distid", 17);//Long + + request.addProperty("Academic_Id", str_academicId);//Long + request.addProperty("Registration_Id", 0);//Long + request.addProperty("College_ID", 0);//Long + + //request.addProperty("stateId", 17);//Long + // long + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + // Log.i(TAG, "GetAllLoginDetails is running"); + // result1 = (Vector) envelope.getResponse(); + + // response = (SoapPrimitive) envelope.getResponse(); + + // SoapPrimitive res =(SoapPrimitive)envelope.getResponse(); + + SoapObject response = (SoapObject ) envelope.getResponse(); + Log.e("response feesCatglist",response.toString()); + feesCatglistcount = response.getPropertyCount(); + SoapObject districtresponse=(SoapObject)response.getProperty(0); + str_FeesCatgStatus=districtresponse.getProperty("Status").toString(); + Log.d("feesCatgcount", String.valueOf(response.getPropertyCount())); + + + if(str_FeesCatgStatus.equals("Success")) { + if (feesCatglistcount > 0) { + arrayObj_Class_FeesCatg = new Class_FeesCatg[feesCatglistcount]; + for (int i = 0; i < feesCatglistcount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + + Class_FeesCatg innerObj_Class_FeesCatg = new Class_FeesCatg(); + innerObj_Class_FeesCatg.setFees_category_code(response_soapobj.getProperty("fees_category_code").toString()); //1 + innerObj_Class_FeesCatg.setFees_category_description(response_soapobj.getProperty("Fees_category_description").toString()); //Hubballi + innerObj_Class_FeesCatg.setFees_Category_Slno(response_soapobj.getProperty("Fees_Category_Slno").toString());// HB + innerObj_Class_FeesCatg.setAcademic_year(response_soapobj.getProperty("academic_year").toString());// <1 + innerObj_Class_FeesCatg.setStatus(response_soapobj.getProperty("Status").toString());// <1 + innerObj_Class_FeesCatg.setFees(response_soapobj.getProperty("Fees").toString());// <1 + innerObj_Class_FeesCatg.setFees_ID(response_soapobj.getProperty("Fees_ID").toString());// <1 + + str_FeesCatgStatus = response_soapobj.getProperty("Status").toString(); + + arrayObj_Class_FeesCatg[i] = innerObj_Class_FeesCatg; + + }//end for loop + + }//end of if + + } + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + // internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + } + +}//end of fragment class diff --git a/app/src/main/java/com/leadcampusapp/FeesUnpaidAdapter.java b/app/src/main/java/com/leadcampusapp/FeesUnpaidAdapter.java new file mode 100644 index 0000000..490c649 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/FeesUnpaidAdapter.java @@ -0,0 +1,299 @@ +package com.leadcampusapp; + +import android.app.Activity; +import android.content.Intent; +import android.graphics.Color; +import android.graphics.PorterDuff; +import android.graphics.drawable.Drawable; +import android.net.Uri; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.CompoundButton; +import android.widget.ImageView; +import android.widget.RadioButton; +import android.widget.RadioGroup; +import android.widget.RatingBar; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.appcompat.widget.SwitchCompat; + +import java.util.ArrayList; +import java.util.Locale; + +//import com.android.sripad.leadnew_22_6_2018.R; + +/** + * Created by Admin on 28-05-2018. + */ + +public class FeesUnpaidAdapter extends BaseAdapter{ + + public ArrayList feesUnPaidList; + Activity activity; + private ArrayList mDisplayedValues = null; + + public FeesUnpaidAdapter(Activity activity, ArrayList feesUnPaidList) { + super(); + this.activity = activity; + this.feesUnPaidList = feesUnPaidList; + } + + @Override + public int getCount() { + //return projList.size(); + return feesUnPaidList.size(); + } + + @Override + public Class_UnpaidStudList getItem(int position) { + + //return projList.get(position); + return feesUnPaidList.get(position); + } + + @Override + public long getItemId(int position) { + return position; + } + + class ViewHolder { + TextView mstudName; + TextView mleadId; + TextView mRegistrationDate; + TextView mCollegeName; + TextView mPhoneNumber; + TextView mMailId; + TextView regId; + TextView stateId; + TextView districtId; + TextView cityId; + TextView streamId; + TextView mcollgId; + TextView txt_Fees; + TextView paymentMode; + CheckBox mStatus; + SwitchCompat simpleSwitch; + RadioGroup paymentMode_radiogroup; + RadioButton rdb_Online,rdb_Cash; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + + final ViewHolder holder; + LayoutInflater inflater = activity.getLayoutInflater(); + + if (convertView == null) { + convertView = inflater.inflate(R.layout.fees_unpaid_listrow, null); + holder = new ViewHolder(); + + holder.mstudName = (TextView) convertView.findViewById(R.id.txt_studName); + holder.mleadId = (TextView) convertView.findViewById(R.id.txt_leadId); + holder.mRegistrationDate = (TextView) convertView.findViewById(R.id.txt_registeredDateTxt); + holder.mCollegeName = (TextView) convertView.findViewById(R.id.txt_collegeName); + holder.mPhoneNumber = (TextView) convertView.findViewById(R.id.txt_phoneNumber); + holder.mMailId = (TextView)convertView.findViewById(R.id.txt_mailId); + holder.regId = (TextView) convertView.findViewById(R.id.regId); + holder.stateId = (TextView) convertView.findViewById(R.id.stateId); + holder.districtId = (TextView) convertView.findViewById(R.id.districtId); + holder.cityId = (TextView) convertView.findViewById(R.id.cityId); + holder.streamId = (TextView) convertView.findViewById(R.id.streamId); + holder.mcollgId = (TextView) convertView.findViewById(R.id.collgId); + holder.txt_Fees = (TextView) convertView.findViewById(R.id.txt_Fees); + + holder.mStatus = (CheckBox) convertView.findViewById(R.id.check_status); + holder.simpleSwitch = (SwitchCompat) convertView.findViewById(R.id.SwitchPaymentMode); // initiate Switch + holder.paymentMode =(TextView) convertView.findViewById(R.id.paymentModenew); + holder.paymentMode_radiogroup=(RadioGroup) convertView.findViewById(R.id.paymentMode_radiogroup); + holder.rdb_Cash=(RadioButton) convertView.findViewById(R.id.rdb_Cash); + holder.rdb_Online=(RadioButton)convertView.findViewById(R.id.rdb_Online); + + convertView.setTag(holder); + } else { + holder = (ViewHolder) convertView.getTag(); + } + + Class_UnpaidStudList item = feesUnPaidList.get(position); + + if(item.getStudentName()!=null) { + holder.mstudName.setText(item.getStudentName().toString()); + } + if(item.getMobileNo()!=null) { + holder.mPhoneNumber.setText(item.getMobileNo().toString()); + } + if(item.getCollegeName()!=null) { + holder.mCollegeName.setText(item.getCollegeName().toString()); + } + if(item.getLead_id()!=null) { + holder.mleadId.setText(item.getLead_id().toString()); + } + if(item.getRegistrationDate()!=null) { + holder.mRegistrationDate.setText(item.getRegistrationDate().toString()); + } + if(item.getMaidId()!=null) { + holder.mMailId.setText(item.getMaidId().toString()); + } + if(item.getRegistration_Id()!=null) { + holder.regId.setText(item.getRegistration_Id().toString()); + } + if(item.getStateCode()!=null) { + holder.stateId.setText(item.getStateCode().toString()); + } + if(item.getDistrictCode()!=null) { + holder.districtId.setText(item.getDistrictCode().toString()); + } + if(item.getTalukaCode()!=null) { + holder.cityId.setText(item.getTalukaCode().toString()); + } + if(item.getStreamId()!=null) { + holder.streamId.setText(item.getStreamId().toString()); + } + if(item.getCollegeCode()!=null) { + holder.mcollgId.setText(item.getCollegeCode().toString()); + } + if(item.getFees()!=null) { + holder.txt_Fees.setText(item.getFees().toString()); + } + /*else{ + holder.mRegistrationDate.setText(""); + }*/ + + if(item.getStatus().toString().equals("1")) { + holder.mStatus.setChecked(true); + //holder.mStatus.setSelected(true); + } + if(item.getStatus().toString().equals("0")) { + holder.mStatus.setChecked(false); + //holder.mStatus.setSelected(false); + } + + holder.mPhoneNumber.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(Intent.ACTION_DIAL); + intent.setData(Uri.parse("tel:"+holder.mPhoneNumber.getText().toString())); + v.getContext().startActivity(intent); + } + }); + /* holder.mStatus.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Log.d("insidelistview","listview clicked"); + notifyDataSetChanged(); + } + });*/ + holder.rdb_Online.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { +// set Yes values in ArrayList if RadioButton is checked + if (isChecked) + //selectedAnswers.set(position, "2"); + feesUnPaidList.get(position).setPayment_Mode("2"); + + } + }); +// perform setOnCheckedChangeListener event on no button + holder.rdb_Cash.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { +// set No values in ArrayList if RadioButton is checked + if (isChecked) + // selectedAnswers.set(position, "1"); + feesUnPaidList.get(position).setPayment_Mode("1"); + // holder.paymentMode.setText(selectedAnswers.get(position).toString()); + } + }); + //final CheckBox checkboxSelected = holder.mStatus; + final int pos = position; + if(holder.rdb_Cash.isChecked()) + { holder.paymentMode.setText("1"); + feesUnPaidList.get(pos).setPayment_Mode("1"); + }else if(holder.rdb_Online.isChecked()){ + holder.paymentMode.setText("2"); + feesUnPaidList.get(pos).setPayment_Mode("2"); + } + holder.mStatus.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + Log.d("insidelistview","listview clicked"); + + if(isChecked) { + Log.d("ischhecked","true"); + holder.mStatus.setChecked(true); + //holder.mStatus.setEnabled(true); + feesUnPaidList.get(pos).setStatus("1"); + }else{ + Log.d("ischhecked","false"); + holder.mStatus.setChecked(false); + feesUnPaidList.get(pos).setStatus("0"); + } + //notifyDataSetChanged(); + //holder.mStatus.setChecked(true); + //holder.mStatus.setSelected(true); + + } + }); + + + + + /* Button btn_selectAll; + btn_selectAll = (Button) + btn_selectAll.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Log.d("lview.getCount()iss", String.valueOf(lview.getCount())); + for (int i = 0; i < lview.getCount(); i++) { + View vw = lview.getAdapter().getView(i,null,null); + CheckBox checkBox = (CheckBox) vw.findViewById(R.id.check_status); + Log.d("checkboxstatusissss", String.valueOf(checkBox.isChecked())); + checkBox.setChecked(true); + Log.d("checkboxstatusissss2", String.valueOf(checkBox.isChecked())); + lview.setAdapter(adapter); + adapter.notifyDataSetChanged(); + } + } + });*/ + + + return convertView; + } + + + public void filter(String charText,ArrayList feesList) { + //charText = charText.toLowerCase(Locale.getDefault()); + //Log.d("charTextissss",charText); + this.feesUnPaidList.clear(); + + /* for(FeesUnpaidModel feesUnpaidModel : feesList){ + String stdName = feesUnpaidModel.getStudent_name().toString(); + //Log.d("StudeNameissssss",stdName); + }*/ + + if(charText!=null) { + if(feesList!=null) { + if (charText.isEmpty() || charText.length() == 0) { + this.feesUnPaidList.addAll(feesList); + } else { + for (Class_UnpaidStudList wp : feesList) { + //Log.d("GetCollegeNameissss",wp.getCollege_name().toLowerCase((Locale.getDefault()))); + /* if (wp.getCollege_name().toLowerCase(Locale.getDefault()).contains(charText) || wp.getLead_id().toLowerCase(Locale.getDefault()).contains(charText) || wp.getPhone_number().toLowerCase(Locale.getDefault()).contains(charText) || wp.getStudent_name().toLowerCase(Locale.getDefault()).contains(charText) || wp.getPhone_number().toLowerCase(Locale.getDefault()).contains(charText)) { + this.feesUnPaidList.add(wp); + }*/ + if ((wp.getCollegeName()!=null && wp.getCollegeName().toLowerCase().contains(charText.toLowerCase())) || ( wp.getLead_id()!=null && wp.getLead_id().toLowerCase().contains(charText.toLowerCase())) || ( wp.getMobileNo()!=null && wp.getMobileNo().toLowerCase().contains(charText.toLowerCase())) || ( wp.getStudentName()!=null && wp.getStudentName().toLowerCase().contains(charText.toLowerCase()) ) || ( wp.getMobileNo()!=null && wp.getMobileNo().toLowerCase().contains(charText.toLowerCase()))) { + this.feesUnPaidList.add(wp); + } + + } + } + notifyDataSetChanged(); + } + } + } +} diff --git a/app/src/main/java/com/leadcampusapp/FeesUnpaidAdapterModified.java b/app/src/main/java/com/leadcampusapp/FeesUnpaidAdapterModified.java new file mode 100644 index 0000000..ed5c70c --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/FeesUnpaidAdapterModified.java @@ -0,0 +1,448 @@ +package com.leadcampusapp; + +import android.app.Activity; +import android.content.Context; +import android.content.Intent; +import android.graphics.Color; +import android.graphics.PorterDuff; +import android.graphics.drawable.Drawable; +import android.net.Uri; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.CompoundButton; +import android.widget.ImageView; +import android.widget.RadioButton; +import android.widget.RadioGroup; +import android.widget.RatingBar; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.appcompat.widget.SwitchCompat; + +import java.util.ArrayList; +import java.util.Locale; + +//import com.android.sripad.leadnew_22_6_2018.R; + +/** + * Created by Admin on 28-05-2018. + */ + +public class FeesUnpaidAdapterModified extends BaseAdapter{ + + public ArrayList feesUnPaidList; + Activity activity; + private ArrayList mDisplayedValues = null; + String str_paymentMode; + ViewHolder holder; + public static ArrayList selectedAnswers; + + + public FeesUnpaidAdapterModified(Activity activity, ArrayList feesUnPaidList) { + super(); + this.activity = activity; + this.feesUnPaidList = feesUnPaidList; + selectedAnswers = new ArrayList<>(); + + } + + @Override + public int getCount() { + //return projList.size(); + return feesUnPaidList.size(); + } + + @Override + public Class_UnpaidStudList getItem(int position) { + + //return projList.get(position); + return feesUnPaidList.get(position); + } + + @Override + public long getItemId(int position) { + return position; + } + + class ViewHolder { + TextView mstudName; + TextView mleadId; + TextView mRegistrationDate; + TextView mCollegeName; + TextView mPhoneNumber; + TextView mMailId; + TextView regId; + TextView stateId; + TextView districtId; + TextView cityId; + TextView streamId; + TextView mcollgId; + TextView txt_Fees; + TextView paymentMode; + CheckBox mStatus; + SwitchCompat simpleSwitch; + RadioGroup paymentMode_radiogroup; + RadioButton rdb_Online,rdb_Cash; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) + { + + + LayoutInflater inflater = activity.getLayoutInflater(); + + if (convertView == null) { + convertView = inflater.inflate(R.layout.fees_unpaid_listrow, null); + holder = new ViewHolder(); + + holder.mstudName = (TextView) convertView.findViewById(R.id.txt_studName); + holder.mleadId = (TextView) convertView.findViewById(R.id.txt_leadId); + holder.mRegistrationDate = (TextView) convertView.findViewById(R.id.txt_registeredDateTxt); + holder.mCollegeName = (TextView) convertView.findViewById(R.id.txt_collegeName); + holder.mPhoneNumber = (TextView) convertView.findViewById(R.id.txt_phoneNumber); + holder.mMailId = (TextView)convertView.findViewById(R.id.txt_mailId); + holder.regId = (TextView) convertView.findViewById(R.id.regId); + holder.stateId = (TextView) convertView.findViewById(R.id.stateId); + holder.districtId = (TextView) convertView.findViewById(R.id.districtId); + holder.cityId = (TextView) convertView.findViewById(R.id.cityId); + holder.streamId = (TextView) convertView.findViewById(R.id.streamId); + holder.mcollgId = (TextView) convertView.findViewById(R.id.collgId); + holder.txt_Fees = (TextView) convertView.findViewById(R.id.txt_Fees); + + holder.mStatus = (CheckBox) convertView.findViewById(R.id.check_status); + holder.simpleSwitch = (SwitchCompat) convertView.findViewById(R.id.SwitchPaymentMode); // initiate Switch + holder.paymentMode =(TextView) convertView.findViewById(R.id.paymentModenew); + holder.paymentMode_radiogroup=(RadioGroup) convertView.findViewById(R.id.paymentMode_radiogroup); + holder.rdb_Cash=(RadioButton) convertView.findViewById(R.id.rdb_Cash); + holder.rdb_Online=(RadioButton)convertView.findViewById(R.id.rdb_Online); + + + convertView.setTag(holder); + } else { + holder = (ViewHolder) convertView.getTag(); + } + + + selectedAnswers = new ArrayList<>(); + Class_UnpaidStudList item = feesUnPaidList.get(position); + + if(item.getStudentName()!=null) { + holder.mstudName.setText(item.getStudentName().toString()); + } + if(item.getMobileNo()!=null) { + holder.mPhoneNumber.setText(item.getMobileNo().toString()); + } + if(item.getCollegeName()!=null) { + holder.mCollegeName.setText(item.getCollegeName().toString()); + } + if(item.getLead_id()!=null) { + holder.mleadId.setText(item.getLead_id().toString()); + } + if(item.getRegistrationDate()!=null) { + holder.mRegistrationDate.setText(item.getRegistrationDate().toString()); + } + if(item.getMaidId()!=null) { + holder.mMailId.setText(item.getMaidId().toString()); + } + if(item.getRegistration_Id()!=null) { + holder.regId.setText(item.getRegistration_Id().toString()); + } + if(item.getStateCode()!=null) { + holder.stateId.setText(item.getStateCode().toString()); + } + if(item.getDistrictCode()!=null) { + holder.districtId.setText(item.getDistrictCode().toString()); + } + if(item.getTalukaCode()!=null) { + holder.cityId.setText(item.getTalukaCode().toString()); + } + if(item.getStreamId()!=null) { + holder.streamId.setText(item.getStreamId().toString()); + } + if(item.getCollegeCode()!=null) { + holder.mcollgId.setText(item.getCollegeCode().toString()); + } + if(item.getFees()!=null) { + holder.txt_Fees.setText(item.getFees().toString()); + } + /*else{ + holder.mRegistrationDate.setText(""); + }*/ + + if(item.getStatus().toString().equals("1")) { + holder.mStatus.setChecked(true); + //holder.mStatus.setSelected(true); + } + if(item.getStatus().toString().equals("0")) { + holder.mStatus.setChecked(false); + //holder.mStatus.setSelected(false); + } + + /* if(item.getPayment_Mode().toString().equals("1")){ + holder.rdb_Cash.setChecked(true); + holder.rdb_Online.setChecked(false); + } + if(item.getPayment_Mode().toString().equals("2")){ + holder.rdb_Cash.setChecked(false); + holder.rdb_Online.setChecked(true); + }*/ + // holder.paymentMode.setText("1"); + + //final boolean[] paycashonline = {true}; + + holder.rdb_Online.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { +// set Yes values in ArrayList if RadioButton is checked + if (isChecked) + //selectedAnswers.set(position, "2"); + feesUnPaidList.get(position).setPayment_Mode("2"); + + } + }); +// perform setOnCheckedChangeListener event on no button + holder.rdb_Cash.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { +// set No values in ArrayList if RadioButton is checked + if (isChecked) + // selectedAnswers.set(position, "1"); + feesUnPaidList.get(position).setPayment_Mode("1"); + // holder.paymentMode.setText(selectedAnswers.get(position).toString()); + } + }); + holder.paymentMode.setText(feesUnPaidList.get(position).getPayment_Mode()); + + + /* holder.simpleSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + // boolean checked = ((RadioButton) buttonView).isChecked(); + + if (isChecked) + { + Log.e("tag","sw_PaymentMode.getTextOn().toString() ada="+holder.simpleSwitch.getTextOn().toString()); + paycashonline[0] =true; + holder.paymentMode.setText("1"); + // The toggle is enabled + } else { + paycashonline[0] =false; + holder.paymentMode.setText("2"); + Log.e("tag","sw_PaymentMode.getTextOff().toString() ada="+holder.simpleSwitch.getTextOff().toString()); + // The toggle is disabled + } + } }); +*/ + + /*if(paycashonline[0]){ + holder.paymentMode.setText("1"); + }else{ + holder.paymentMode.setText("2"); + }*/ + Log.e("tag","paymentMode ada="+holder.paymentMode.getText().toString()); + /* if(holder.simpleSwitch.isChecked()){ + // paymentMode="1"; + Log.e("tag","sw_PaymentMode.getTextOn().toString() ada="+holder.simpleSwitch.getTextOn().toString()); + // Log.e("tag","paymentMode1="+paymentMode); + }else{ + //paymentMode="2"; + Log.e("tag","sw_PaymentMode.getTextOff().toString() ada="+holder.simpleSwitch.getTextOff().toString()); + + //Log.e("tag","paymentMode2="+paymentMode); + }*/ + holder.mPhoneNumber.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(Intent.ACTION_DIAL); + intent.setData(Uri.parse("tel:"+holder.mPhoneNumber.getText().toString())); + v.getContext().startActivity(intent); + } + }); + /* holder.mStatus.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Log.d("insidelistview","listview clicked"); + notifyDataSetChanged(); + } + });*/ + + //final CheckBox checkboxSelected = holder.mStatus; + final int pos = position; + if(holder.rdb_Cash.isChecked()) + { holder.paymentMode.setText("1"); + feesUnPaidList.get(pos).setPayment_Mode("1"); + }else if(holder.rdb_Online.isChecked()){ + holder.paymentMode.setText("2"); + feesUnPaidList.get(pos).setPayment_Mode("2"); + } + + + + // holder.rdb_Cash.setOnCheckedChangeListener(); + + + + + + + + + + + + + + holder.mStatus.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + Log.d("insidelistview","listview clicked"); + + if(isChecked) { + Log.d("ischhecked","true"); + holder.mStatus.setChecked(true); + //holder.mStatus.setEnabled(true); + feesUnPaidList.get(pos).setStatus("1"); + }else{ + Log.d("ischhecked","false"); + holder.mStatus.setChecked(false); + feesUnPaidList.get(pos).setStatus("0"); + } + notifyDataSetChanged(); + //holder.mStatus.setChecked(true); + //holder.mStatus.setSelected(true); + + } + }); + + // + /* holder.paymentMode_radiogroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(RadioGroup group, int checkedId) { + switch(checkedId) { + case R.id.rdb_Cash: + // switch to fragment 1 + str_paymentMode="1"; + holder.paymentMode.setText("1"); + feesUnPaidList.get(pos).setPayment_Mode("1"); + break; + case R.id.rdb_Online: + // Fragment 2 + str_paymentMode="2"; + holder.paymentMode.setText("2"); + feesUnPaidList.get(pos).setPayment_Mode("2"); + break; + } + notifyDataSetChanged(); + } + });*/ + /*public void onRadioButtonPaymentClicked(View view) + { + boolean checked = ((RadioButton) view).isChecked(); + + switch (view.getId()) { + case R.id.rdb_Cash: + if (checked) { + str_paymentMode="1"; + } + break; + case R.id.rdb_Online: + if (checked) { + str_paymentMode="2"; + } + break; + } + }*/ + + + /* Button btn_selectAll; + btn_selectAll = (Button) + btn_selectAll.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Log.d("lview.getCount()iss", String.valueOf(lview.getCount())); + for (int i = 0; i < lview.getCount(); i++) { + View vw = lview.getAdapter().getView(i,null,null); + CheckBox checkBox = (CheckBox) vw.findViewById(R.id.check_status); + Log.d("checkboxstatusissss", String.valueOf(checkBox.isChecked())); + checkBox.setChecked(true); + Log.d("checkboxstatusissss2", String.valueOf(checkBox.isChecked())); + lview.setAdapter(adapter); + adapter.notifyDataSetChanged(); + } + } + });*/ + + + + + + return convertView; + } + + + + /*public void paymentModeOnclick(View convertView) + { + boolean checked = ((RadioButton) view).isChecked(); + + switch (view.getId()) { + case R.id.rdb_male: + if (checked) { + holder.paymentMode.setText("1"); + } + break; + case R.id.rdb_female: + if (checked) { + holder.paymentMode.setText("2"); + } + break; + } + }*/ + + + + + + public void filter(String charText,ArrayList feesList) { + //charText = charText.toLowerCase(Locale.getDefault()); + //Log.d("charTextissss",charText); + this.feesUnPaidList.clear(); + + /* for(FeesUnpaidModel feesUnpaidModel : feesList){ + String stdName = feesUnpaidModel.getStudent_name().toString(); + //Log.d("StudeNameissssss",stdName); + }*/ + + if(charText!=null) { + if(feesList!=null) { + if (charText.isEmpty() || charText.length() == 0) { + this.feesUnPaidList.addAll(feesList); + } else { + for (Class_UnpaidStudList wp : feesList) { + //Log.d("GetCollegeNameissss",wp.getCollege_name().toLowerCase((Locale.getDefault()))); + // if (wp.getCollege_name().toLowerCase(Locale.getDefault()).contains(charText) || wp.getLead_id().toLowerCase(Locale.getDefault()).contains(charText) || wp.getPhone_number().toLowerCase(Locale.getDefault()).contains(charText) || wp.getStudent_name().toLowerCase(Locale.getDefault()).contains(charText) || wp.getPhone_number().toLowerCase(Locale.getDefault()).contains(charText)) { + if ((wp.getCollegeName()!=null && wp.getCollegeName().toLowerCase().contains(charText.toLowerCase())) || ( wp.getLead_id()!=null && wp.getLead_id().toLowerCase().contains(charText.toLowerCase())) || ( wp.getMobileNo()!=null && wp.getMobileNo().toLowerCase().contains(charText.toLowerCase())) || ( wp.getStudentName()!=null && wp.getStudentName().toLowerCase().contains(charText.toLowerCase()) ) || ( wp.getMobileNo()!=null && wp.getMobileNo().toLowerCase().contains(charText.toLowerCase()))) { + this.feesUnPaidList.add(wp); + } + /*if(selectedCollegeName == null) { + if ((wp.getCollegeName()!=null && wp.getCollegeName().toLowerCase().contains(charText.toLowerCase())) || ( wp.getLead_id()!=null && wp.getLead_id().toLowerCase().contains(charText.toLowerCase())) || ( wp.getMobileNo()!=null && wp.getMobileNo().toLowerCase().contains(charText.toLowerCase())) || ( wp.getStudentName()!=null && wp.getStudentName().toLowerCase().contains(charText.toLowerCase()) ) || ( wp.getMobileNo()!=null && wp.getMobileNo().toLowerCase().contains(charText.toLowerCase()))) { + this.feesUnPaidList.add(wp); + } + }else{ + if ((wp.getCollegeName()!=null && wp.getCollegeName().equals(selectedCollegeName)) && ((wp.getCollegeName()!=null && wp.getCollegeName().toLowerCase().contains(charText.toLowerCase())) || (wp.getLead_id()!=null && wp.getLead_id().toLowerCase().contains(charText.toLowerCase())) || (wp.getMobileNo()!=null && wp.getMobileNo().toLowerCase().contains(charText.toLowerCase())) || (wp.getStudentName()!=null && wp.getStudentName().toLowerCase().contains(charText.toLowerCase())) || (wp.getMobileNo()!=null && wp.getMobileNo().toLowerCase().contains(charText.toLowerCase())))) { + this.feesUnPaidList.add(wp); + } + }*/ + + } + } + notifyDataSetChanged(); + } + } + } +} diff --git a/app/src/main/java/com/leadcampusapp/FeesUnpaidFragment.java b/app/src/main/java/com/leadcampusapp/FeesUnpaidFragment.java new file mode 100644 index 0000000..0f6295d --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/FeesUnpaidFragment.java @@ -0,0 +1,2357 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 20-07-2018. + */ + +import android.annotation.SuppressLint; +import android.app.AlertDialog; +import android.app.Dialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.SharedPreferences; +import android.os.AsyncTask; +import android.os.Bundle; + +import androidx.appcompat.widget.SwitchCompat; +import androidx.fragment.app.Fragment; +import androidx.core.content.ContextCompat; +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; +import androidx.appcompat.widget.AppCompatSpinner; +import android.text.Editable; +import android.text.TextWatcher; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.Window; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.CompoundButton; +import android.widget.EditText; +import android.widget.ListView; +import android.widget.RadioButton; +import android.widget.RadioGroup; +import android.widget.Switch; +import android.widget.TextView; +import android.widget.Toast; +import android.widget.ToggleButton; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Locale; + +//import com.android.sripad.leadnew_22_6_2018.R; + +public class FeesUnpaidFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener +{ + int count=0; + + private ArrayList feesList; + private View view; + private boolean isCompletedflag=false; + private int projectStatusIcon; + private FeesUnpaidAdapter adapter; + + public static final String PREFBook_Stud= "prefbook_stud"; //sharedpreference Book + public static final String PrefID_RegID = "prefid_regid"; // + public static final String PrefID_SName = "prefid_sname"; // + public static final String PrefID_PM_SName = "prefid_pmsname"; // + public static final String PrefID_SLeadID = "prefid_sleadid"; // + public static final String PrefID_PM_SEmailID = "prefid_pm_semailid"; // + public static final String PrefID_SCellNo = "prefid_scellno"; // + + private SharedPreferences shardpref_S_obj; + private String str_leadId,str_RegistrationId; + private ProgressDialog progressDialog; + + private EditText etSearch; + + private ListView lview; + private ArrayList originalList = null; + + private int countProposed=0; + private int countReapply=0; + private int countRequestForCompletion=0; + private int countApproved=0; + private int countRejected=0; + private int countCompleted=0; + + private Button btn_generateReport; + public static final String PrefID_PMID = "prefid_pmid"; // + public static final String PREFBook_PM= "prefbook_pm"; + SharedPreferences shardprefPM_obj; + public String str_MangerID; + private AppCompatSpinner spin_college; + private TextView txt_selectAll; + private LinkedHashSet collegeNameLst; + private ArrayList collegeNameArrLst; + + private Button btn_selectAll,btn_selectNone,btn_submit,btn_submitnew; + private CheckBox chk_selectAll; + private Context context; + private ArrayList arrLstLeadIds; + private ArrayList arrLstMobileNo; + private ArrayList arrLststudName; + private ArrayList arrLstregisteredDate; + private ArrayList arrLstmailId; + private ArrayList arrLstFees; + private ArrayList arrLstPaymentMode; + private ArrayList arrLstregId; + private ArrayList arrLststateId; + private ArrayList arrLstdistrictId; + private ArrayList arrLstcityId; + private ArrayList arrLststreamId; + private ArrayList arrLstcollgId; + // private ArrayList arrLstcityId; + + private String str_leadIdOverall=""; + + //private String + private int counts=0; + private int counter=0; + private ArrayList arrayLeadId; + private SwipeRefreshLayout swipeLayout; + private TextView txt_actualTotalCounts; + AppCompatSpinner spin_year,spin_feesCategory; + + int YearListCount,feesCatglistcount; + String str_YearListStatus,yearID,str_FeesCatgStatus,str_feesCatSlno,str_feesCatName,str_yearID,str_yearCode,str_feesID; + Class_YearList[] arrayObj_Class_YearList; + Class_YearList obj_Class_YearList; + ArrayAdapter dataAdapter_yearList,dataAdapter_feesCatg,dataAdapter_college; + Class_FeesCatg[] arrayObj_Class_FeesCatg; + Class_FeesCatg obj_Class_FeesCatg; + + Class_Colleges[] arrayObj_Class_Colleges, arrayObj_Class_Colleges2,arrayObj_Class_Colleges3; + Class_Colleges obj_Class_Colleges; + int collegeslistcount,MDId,studentlistcount; + String str_CollegesStatus,str_ColID="x"; + String str_studListStatus; + Class_UnpaidStudList[] arrayObj_Class_studList; + Class_UnpaidStudList obj_Class_studList; + String str_remark; + JSONArray jsonArray_submit = new JSONArray(); + String str_paymentMode; + Class_InternetDectector internetDectector; + Boolean isInternetPresent = false; + EditText stfonlinetrans_no_tv,stfonlinetransAmount_tv,stfamountbycash_tv,stfonline_receiptno_tv,stfamountbycash_receiptno_tv; + + // EditText userInput; + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + + view=inflater.inflate(R.layout.frag_fees_newunpaid, container, false); + + swipeLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipe_container); + swipeLayout.setOnRefreshListener(this); + swipeLayout.setColorScheme(android.R.color.holo_blue_bright, + android.R.color.holo_green_light, + android.R.color.holo_orange_light, + android.R.color.holo_red_light); + + + + txt_actualTotalCounts = (TextView) view.findViewById(R.id.txt_actualTotalCount); + + initializeviews(); + + return view; + } + + private void initializeviews() { + lview = (NonScrollListView) view.findViewById(R.id.listview_feesUnpaid); + + + + arrLstLeadIds = new ArrayList(); + arrLststreamId = new ArrayList(); + arrLstregId = new ArrayList(); + arrLstcityId = new ArrayList(); + arrLstcollgId = new ArrayList(); + arrLstdistrictId = new ArrayList(); + arrLstFees = new ArrayList(); + arrLstmailId = new ArrayList(); + arrLstMobileNo = new ArrayList(); + arrLstPaymentMode = new ArrayList(); + arrLstregisteredDate = new ArrayList(); + arrLststateId = new ArrayList(); + arrLststudName = new ArrayList(); + + + feesList = new ArrayList(); + adapter = new FeesUnpaidAdapter(getActivity(),feesList); + lview.setAdapter(adapter); + + arrayLeadId = new ArrayList(); + + + shardprefPM_obj= getActivity().getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MangerID = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + Log.d("str_MangerID:",str_MangerID); + MDId=Integer.parseInt(str_MangerID); + + collegeNameLst = new LinkedHashSet(); + collegeNameLst.add("Select College"); + collegeNameArrLst = new ArrayList(); + + spin_college = (AppCompatSpinner) view.findViewById(R.id.spin_college); + + /* btn_selectAll = (Button) view.findViewById(R.id.btn_selectAll); + + btn_selectNone = (Button) view.findViewById(R.id.btn_selectNone);*/ + + btn_submit = (Button) view.findViewById(R.id.btn_submit); + btn_submitnew = (Button) view.findViewById(R.id.btn_submitnew); + + // chk_selectAll = (CheckBox) view.findViewById(R.id.chk_selectAll); + + txt_selectAll = (TextView) view.findViewById(R.id.txt_selectAll); + spin_feesCategory = (AppCompatSpinner) view.findViewById(R.id.spin_feesCategory); + spin_year = (AppCompatSpinner) view.findViewById(R.id.spin_year); + + //initCollegeSpinner(); + + // populateList(); + + GetFromToDateAsyncCallWS getFromToDateAsyncCallWS=new GetFromToDateAsyncCallWS(getContext()); + getFromToDateAsyncCallWS.execute(); + + + etSearch = (EditText) view.findViewById(R.id.etSearch); + + etSearch.addTextChangedListener(new TextWatcher() { + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { +// Call back the Adapter with current character to Filter + } + + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + } + + @Override + public void afterTextChanged(Editable s) { + + String text = etSearch.getText().toString().toLowerCase(Locale.getDefault()); + adapter.filter(text, originalList); + + } + }); + + spin_college.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView parent, View view, int position, long id) { + String collegeName = spin_college.getSelectedItem().toString(); + //adapter.filter(collegeName, originalList); + + if(spin_college.getSelectedItem().toString().equals("Select Institution")||str_ColID.equals("x")||str_CollegesStatus.equals("Fail")||str_CollegesStatus.equals("There are no colleges")) + { + Log.e("In strCollegesStatus","In str_CollegesStatus"); + // amount_ET.setText("0"); + } + else { + obj_Class_Colleges = (Class_Colleges) spin_college.getSelectedItem(); + str_ColID = obj_Class_Colleges.getcollege_id().toString(); + str_feesID = obj_Class_Colleges.getFees_Id().toString(); + + GetFeesUnpaid getFeesUnpaid = new GetFeesUnpaid(getActivity()); + getFeesUnpaid.execute(); + } + // chk_selectAll.setChecked(false); + int size = feesList.size(); + for(int i=0;i parent) { + + } + }); + + /* chk_selectAll.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + + if(isChecked){ + Log.d("Checkedtruesssss","truesssss"); + int size = feesList.size(); + for(int i=0;i parent, View view, + int position, long id){ + // TODO Auto-generated method stub + obj_Class_YearList = (Class_YearList) spin_year.getSelectedItem(); + + str_yearID = obj_Class_YearList.getSlno().toString(); + str_yearCode = obj_Class_YearList.getAcademicCode().toString(); + FeesCatglistAsyncCallWS feesCatglistAsyncCallWS = new FeesCatglistAsyncCallWS(getContext()); + feesCatglistAsyncCallWS.execute(); + } + + @Override + public void onNothingSelected (AdapterView < ? > parent){ + // TODO Auto-generated method stub + } + }); + + + spin_feesCategory.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected (AdapterView < ? > parent, View view, + int position, long id){ + // TODO Auto-generated method stub + obj_Class_FeesCatg = (Class_FeesCatg) spin_feesCategory.getSelectedItem(); + + str_feesCatSlno = obj_Class_FeesCatg.getFees_Category_Slno().toString(); + str_feesCatName = obj_Class_FeesCatg.getFees_category_description().toString(); + + + Log.e("tag","str_feesCatSlno="+str_feesCatSlno); + Log.e("tag","str_feesCatName="+str_feesCatName); + + CollegelistAsyncCallWS collegelistAsyncCallWS =new CollegelistAsyncCallWS(getContext()); + collegelistAsyncCallWS.execute(); + } + + @Override + public void onNothingSelected (AdapterView < ? > parent){ + // TODO Auto-generated method stub + } + }); + btn_submitnew.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + // if(isChecked){ + counter=0; + arrLstLeadIds = new ArrayList(); + arrLststreamId = new ArrayList(); + arrLstregId = new ArrayList(); + arrLstcityId = new ArrayList(); + arrLstcollgId = new ArrayList(); + arrLstdistrictId = new ArrayList(); + arrLstFees = new ArrayList(); + arrLstmailId = new ArrayList(); + arrLstMobileNo = new ArrayList(); + arrLstPaymentMode = new ArrayList(); + arrLstregisteredDate = new ArrayList(); + arrLststateId = new ArrayList(); + arrLststudName = new ArrayList(); + + int size = feesList.size(); + Log.e("size", "size=" + String.valueOf(size)); + for (int i = 0; i < size; i++) { + Class_UnpaidStudList feesUnpaidModel = feesList.get(i); + if (feesUnpaidModel.getStatus().equals("1")) { + Log.e("tag", "check box true"); + Log.e("tag", "arrLstLeadIds="+arrLstLeadIds.size()); + arrLstLeadIds.add(feesUnpaidModel.getLead_id().toString()); + arrLstMobileNo.add(feesUnpaidModel.getMobileNo().toString()); + arrLststudName.add(feesUnpaidModel.getStudentName().toString()); + arrLstregisteredDate.add(feesUnpaidModel.getRegistrationDate().toString()); + arrLstmailId.add(feesUnpaidModel.getMaidId().toString()); + if (feesUnpaidModel.getFees().toString().equalsIgnoreCase("") || feesUnpaidModel.getFees().toString() == null) { + arrLstFees.add("0"); + } else { + arrLstFees.add(feesUnpaidModel.getFees().toString()); + } + arrLstPaymentMode.add(feesUnpaidModel.getPayment_Mode().toString()); + arrLstregId.add(feesUnpaidModel.getRegistration_Id().toString()); + arrLststateId.add(feesUnpaidModel.getStateCode().toString()); + arrLstdistrictId.add(feesUnpaidModel.getDistrictCode().toString()); + arrLstcityId.add(feesUnpaidModel.getTalukaCode().toString()); + arrLststreamId.add(feesUnpaidModel.getStreamId().toString()); + arrLstcollgId.add(feesUnpaidModel.getCollegeCode().toString()); + counter++; + } + /* Log.e("tag","arrLstLeadIds="+arrLstLeadIds.get(i).toString()); + Log.e("tag","arrLstPaymentMode="+arrLstPaymentMode.get(i).toString());*/ + + } + Log.e("tag", "counter=" + String.valueOf(counter)); + if (counter > 0) { + final Dialog dialog = new Dialog(getActivity()); + + dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); + dialog.setContentView(R.layout.dialog_tuitionfeessubmission); + dialog.setCancelable(false); + TextView header_tv = (TextView) dialog.findViewById(R.id.header_tv); + Button dialogcancelbutton = (Button) dialog.findViewById(R.id.stfeescanceldialog_BT); + Button dialogsubmitbutton = (Button) dialog.findViewById(R.id.stfeessubmitdialog_BT); + stfonlinetrans_no_tv = (EditText) dialog.findViewById(R.id.Stfonlinetrans_no_TV); + stfonlinetransAmount_tv = (EditText) dialog.findViewById(R.id.StfonlinetransAmount_TV); + stfamountbycash_tv = (EditText) dialog.findViewById(R.id.StfAmountbycash_TV); + stfonline_receiptno_tv = (EditText) dialog.findViewById(R.id.Stfonline_receiptno_TV); + stfamountbycash_receiptno_tv = (EditText) dialog.findViewById(R.id.StfAmountbycash_receiptno_TV); + RadioGroup submitfees_radiogroup; + submitfees_radiogroup = (RadioGroup) dialog.findViewById(R.id.submit_stfeesradiogroup); + + header_tv.setText("Student Amount Collection"); + submitfees_radiogroup.setVisibility(View.GONE); + stfonlinetransAmount_tv.setVisibility(View.GONE); + + dialogcancelbutton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + dialog.dismiss(); + + } + }); + + dialogsubmitbutton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + internetDectector = new Class_InternetDectector(getActivity()); + isInternetPresent = internetDectector.isConnectingToInternet(); + + if (isInternetPresent) { + + // Toast.makeText(getApplicationContext(),"Outside value:"+forOnline,Toast.LENGTH_LONG).show(); + if (validationfor_dialog()) { + // Toast.makeText(getContext(), "true1 : "+stfonline_receiptno_tv.getText().toString(), Toast.LENGTH_LONG).show(); + SubmitAcknowledgements submitAcknowledgements = new SubmitAcknowledgements(getActivity()); + submitAcknowledgements.execute(); + } + } + } + }); + dialog.show(); + } else { + Toast.makeText(getActivity(), "You have not selected any student", Toast.LENGTH_LONG).show(); + } + + } + }); + + + btn_submit.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Log.d("lview.getCount()iss", String.valueOf(lview.getCount())); + + // adapter.notifyDataSetChanged(); + + for ( ; counts < lview.getCount() ; counts++) + { + View vw = lview.getAdapter().getView(counts,null,null); + CheckBox checkBox = (CheckBox) vw.findViewById(R.id.check_status); + SwitchCompat sw_PaymentMode = (SwitchCompat) vw.findViewById(R.id.SwitchPaymentMode); + TextView paymentMode = (TextView) vw.findViewById(R.id.paymentModenew); + + Log.e("tag","checkbox="+checkBox.isChecked()); + + TextView txt_leadId = (TextView) vw.findViewById(R.id.txt_leadId); + TextView txt_MobileNo = (TextView) vw.findViewById(R.id.txt_phoneNumber); + TextView txt_studName = (TextView) vw.findViewById(R.id.txt_studName); + TextView txt_registeredDate = (TextView) vw.findViewById(R.id.txt_registeredDateTxt); + TextView txt_mailId = (TextView) vw.findViewById(R.id.txt_mailId); + TextView txt_Fees = (TextView) vw.findViewById(R.id.txt_Fees); + + TextView txt_regId = (TextView) vw.findViewById(R.id.regId); + TextView txt_stateId = (TextView) vw.findViewById(R.id.stateId); + TextView txt_districtId = (TextView) vw.findViewById(R.id.districtId); + TextView txt_cityId = (TextView) vw.findViewById(R.id.cityId); + TextView txt_streamId = (TextView) vw.findViewById(R.id.streamId); + TextView txt_collgId = (TextView) vw.findViewById(R.id.collgId); + + RadioGroup paymentMode_radiogroup=(RadioGroup) vw.findViewById(R.id.paymentMode_radiogroup); + /* if(paymentMode_radiogroup.getCheckedRadioButtonId()==R.id.rdb_Cash) + { + txt_MobileNo.setText("1"); + str_paymentMode="1"; + }else{ + txt_MobileNo.setText("2"); + str_paymentMode="2"; + } +*/ + + RadioButton rdb_Cash=(RadioButton) vw.findViewById(R.id.rdb_Cash); + RadioButton rdb_Online=(RadioButton)vw.findViewById(R.id.rdb_Online); + + Log.e("TextLeadIdissss", txt_leadId.getText().toString()); + Log.e("txt_MobileNo=", txt_MobileNo.getText().toString()); + + + /* if(rdb_Cash.isChecked()){ + paymentMode.setText("1"); + str_paymentMode="1"; + }else if(rdb_Online.isChecked()){ + paymentMode.setText("2"); + str_paymentMode="2"; + } +*/ + rdb_Online.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { +// set Yes values in ArrayList if RadioButton is checked + if (isChecked) + //selectedAnswers.set(position, "2"); + // feesUnPaidList.get(position).setPayment_Mode("2"); + paymentMode.setText("2"); + } + }); +// perform setOnCheckedChangeListener event on no button + rdb_Cash.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { +// set No values in ArrayList if RadioButton is checked + if (isChecked) + // selectedAnswers.set(position, "1"); + // feesUnPaidList.get(position).setPayment_Mode("1"); + // holder.paymentMode.setText(selectedAnswers.get(position).toString()); + paymentMode.setText("1"); + } + }); + // paymentMode.setText(feesUnPaidList.get(position).getPayment_Mode()); + + + + if(checkBox.isChecked()) { + + arrLstLeadIds.add(txt_leadId.getText().toString()); + arrLstMobileNo.add(txt_MobileNo.getText().toString()); + arrLststudName.add(txt_studName.getText().toString()); + arrLstregisteredDate.add(txt_registeredDate.getText().toString()); + arrLstmailId.add(txt_mailId.getText().toString()); + if(txt_Fees.getText().toString().equalsIgnoreCase("")||txt_Fees.getText().toString()==null){ + arrLstFees.add("0"); + }else { + arrLstFees.add(txt_Fees.getText().toString()); + } + + /* if(sw_PaymentMode.isChecked()) + { paymentMode.setText("1"); + Toast.makeText(getContext(),"clicked",Toast.LENGTH_SHORT).show(); + + }else{ + paymentMode.setText("2"); + Toast.makeText(getContext(),"unclicked",Toast.LENGTH_SHORT).show(); + }*/ + + +/* + + + + if(sw_PaymentMode.isChecked()){ + // paymentMode="1"; + Log.e("tag","sw_PaymentMode.getTextOn().toString()="+sw_PaymentMode.getTextOn().toString()); + Log.e("tag","paymentMode1="+paymentMode); + }else{ + // paymentMode="2"; + Log.e("tag","sw_PaymentMode.getTextOff().toString()="+sw_PaymentMode.getTextOff().toString()); + + Log.e("tag","paymentMode2="+paymentMode); + }*/ + + // ToggleButton toggle = (ToggleButton) vw.findViewById(R.id.togglebutton); + /* sw_PaymentMode.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + if (isChecked) { + paymentMode="1"; + Log.e("tag","sw_PaymentMode.getTextOn().toString()="+sw_PaymentMode.getTextOn().toString()); + Log.e("tag","paymentMode1="+paymentMode); + // The toggle is enabled + } else { + paymentMode="2"; + Log.e("tag","sw_PaymentMode.getTextOff().toString()="+sw_PaymentMode.getTextOff().toString()); + + Log.e("tag","paymentMode2="+paymentMode); + // The toggle is disabled + } + } });*/ + + Log.e("tag","paymentMode ="+paymentMode.getText().toString()); +// Log.e("tag","str_paymentMode ="+str_paymentMode.toString()); + arrLstPaymentMode.add(paymentMode.getText().toString()); + arrLstregId.add(txt_regId.getText().toString()); + arrLststateId.add(txt_stateId.getText().toString()); + arrLstdistrictId.add(txt_districtId.getText().toString()); + arrLstcityId.add(txt_cityId.getText().toString()); + arrLststreamId.add(txt_streamId.getText().toString()); + arrLstcollgId.add(txt_collgId.getText().toString()); + + //str_leadIdOverall = "'" + txt_leadId.getText().toString() + "'"; + + //arrayLeadId.add(str_leadIdOverall); + + Log.d("str_leadIdOverallis",str_leadIdOverall); + + // + + counter++; + + } + + } + + /*if(counter!=0){ + str_leadIdOverall = ""; + for(int i=0;i { + + AlertDialog alertDialog; + //private ProgressBar progressBar; + private ProgressDialog progressDialog; + + SubmitAcknowledgements (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapPrimitive response = submitArrLystLeadIds(); + + //Log.d("Soap response issssss",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + + progressDialog.setMessage("Submitting"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + progressDialog.dismiss(); + if(result!=null) { + if (result.toString().equalsIgnoreCase("success")) { + Toast.makeText(context, "Student data saved successfully", Toast.LENGTH_LONG).show(); + //counter = 0; + getActivity().finish(); + startActivity(getActivity().getIntent()); + } else if(result.toString().equalsIgnoreCase("EXISTS")){ + Toast.makeText(context, "Student mobile number already exists in LEAD", Toast.LENGTH_LONG).show(); + //counter = 0; + //finish(); + // startActivity(getIntent()); + } else { + Toast.makeText(context, result.toString(), Toast.LENGTH_LONG).show(); + } + } + //progressBar.setVisibility(View.GONE); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + /* private SoapPrimitive submitArrLystLeadIds() { + String METHOD_NAME = "Save_Manager_PaymentDetails"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/Save_Manager_PaymentDetails"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + JSONObject jsonObject = new JSONObject(); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + request.addProperty("Fees_Category_ID",Integer.valueOf(str_feesCatSlno)); + request.addProperty("Fees_Category_Name",str_feesCatName); + request.addProperty("Fees_ID",Integer.valueOf(str_feesID)); + request.addProperty("isNewRegistration",0); + request.addProperty("Payment_Remark","testing"); + request.addProperty("Manager_Id",MDId); +//[{"Registration_Id":38267,"Student_Name":"Madhu","MobileNo":"8904674048","State_Id":17,"District_Id":266,"City_Id":68,"stream_Id":3,"College_ID":178,"Email_Id":"madhushree.kubsad@dfmail.org","Paid_date":"0","Paid_fees":100,"Payment_Mode":1,"Payment_Remark":"fees paid"}] + *//* jsonObject.put("Registration_Id",38267); + Log.e("tag","str_RegistrationId="+str_RegistrationId); + jsonObject.put("Student_Name",etName.getText().toString()); + jsonObject.put("MobileNo","8904674048"); + jsonObject.put("State_Id",17); + jsonObject.put("District_Id",266); + jsonObject.put("City_Id",68); + jsonObject.put("stream_Id",3); + jsonObject.put("College_ID",178); + jsonObject.put("Email_Id","madhushree.kubsad@dfmail.org"); + jsonObject.put("Paid_date","2021-02-22"); + Log.e("tag","paid Date="+edt_paymentDate.getText().toString()); + jsonObject.put("Paid_fees",1); + jsonObject.put("Payment_Mode",1); + jsonObject.put("Payment_Remark","test test");*//* + // [{"Registration_Id":0,"Student_Name":"test a","MobileNo":"8904674048","State_Id":"17","District_Id":"256","City_Id":"14","stream":"5","College_ID":"37","Email_Id":"madhushree.kubsad@dfmail.org","Paid_date":"2021-02-22","Paid_fees":"1","Payment_Mode":"1","Payment_Remark":"test test"}] + + Log.e("tag","arrLstregId="+arrLstregId.size()); + *//*for(int k1=0;k1"); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + // Log.d("soap response1xxxx",envelope.getResponse().toString()); + + + //SoapObject response = (SoapObject) envelope.getResponse(); + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + Log.e("Responseissss",envelope.getResponse().toString()); + + //return null; + + return response; + + }catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + + } +*/ + private SoapPrimitive submitArrLystLeadIds() { + String METHOD_NAME = "Save_Manager_PaymentDetails"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/Save_Manager_PaymentDetails"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + JSONObject jsonObject = new JSONObject(); + JSONArray jsonArray = new JSONArray(); + + // Log.e("tag","isNewRegistration="+isNewRegistration); + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + request.addProperty("Fees_Category_ID",Integer.valueOf(str_feesCatSlno)); + request.addProperty("Fees_Category_Name",str_feesCatName); + request.addProperty("Fees_ID",Integer.valueOf(str_feesID)); + request.addProperty("isNewRegistration",0); + request.addProperty("Payment_Remark",str_remark); + request.addProperty("Manager_Id",MDId); + +//[{"Registration_Id":38267,"Student_Name":"Madhu","MobileNo":"8904674048","State_Id":17,"District_Id":266,"City_Id":68,"stream_Id":3,"College_ID":178,"Email_Id":"madhushree.kubsad@dfmail.org","Paid_date":"0","Paid_fees":100,"Payment_Mode":1,"Payment_Remark":"fees paid"}] + + // [{"Registration_Id":0,"Student_Name":"test a","MobileNo":"8904674048","State_Id":"17","District_Id":"256","City_Id":"14","stream":"5","College_ID":"37","Email_Id":"madhushree.kubsad@dfmail.org","Paid_date":"2021-02-22","Paid_fees":"1","Payment_Mode":"1","Payment_Remark":"test test"}] + /* jsonObject.put("Registration_Id",Integer.valueOf(O_RegistrationId)); + Log.e("tag","str_RegistrationId="+O_RegistrationId); + jsonObject.put("Student_Name",etName.getText().toString()); + jsonObject.put("MobileNo",etMobile.getText().toString()); + jsonObject.put("State_Id",Integer.valueOf(str_Sids)); + jsonObject.put("District_Id",Integer.valueOf(str_Dids)); + jsonObject.put("City_Id",Integer.valueOf(str_Cityids)); + jsonObject.put("stream_Id",Integer.valueOf(str_programid)); + jsonObject.put("College_ID",Integer.valueOf(str_ColID)); + jsonObject.put("Email_Id",emailid_ET.getText().toString()); + // jsonObject.put("Paid_date",edt_paymentDate.getText().toString()); + // Log.e("tag","paid Date="+edt_paymentDate.getText().toString()); + jsonObject.put("Paid_fees",Integer.valueOf(str_feesAmount)); + jsonObject.put("Payment_Mode",Integer.valueOf(str_PaymentModeID)); + // jsonObject.put("Payment_Remark",remark_ET.getText().toString()); + + request.addProperty("PaymentDetails","["+jsonObject+"]");*/ + ArrayList jsonObjectList=new ArrayList(); + + try{ + for(int k=0;k"); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + // Log.d("soap response1xxxx",envelope.getResponse().toString()); + + + // SoapObject response = (SoapObject) envelope.getResponse(); + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + Log.e("Responseissss",envelope.getResponse().toString()); + + //return null; + + return response; + + }catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + + } + + +void funjson(String jsonObject){ + // JSONArray jsonArray=new JSONArray(); + jsonObject.replace("\\",""); + + // JSONObject jsonObj=new JSONObject(); + // jsonObj.put(jsonObject); + Log.e("tag","removed jsonObject:"+jsonObject); + jsonArray_submit.put(jsonObject); + // return jsonArray; +} + + + /* public class GetFeesUnpaid extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + //private ProgressBar progressBar; + + GetFeesUnpaid (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapObject response = getFeesUnpaid(); + + //Log.d("Soap response is",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + *//* progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*//* + progressDialog.setMessage("Loading"); + progressDialog.setProgressStyle(android.R.attr.progressBarStyleSmall); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapObject result) { + + + + if(result != null) { + + SoapPrimitive S_LeadId, S_StudentName, S_RegistrationDate, S_CollegeName, S_MobileNo, S_IsFeesPaid, S_Status; + Object O_LeadId, O_StudentName, O_RegistrationDate, O_CollegeName, O_MobileNo, O_IsFeesPaid, O_Status; + String str_leadid = null, str_studentName = null, str_registrationDate = null, str_collegeName = null, str_MobileNo = null, str_IsFeesPaid = null, str_Status = null; + + for (int i = 0; i < result.getPropertyCount(); i++) { + SoapObject list = (SoapObject) result.getProperty(i); + + //Log.d("DistrictResult", list.toString()); + + O_Status = list.getProperty("Status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) list.getProperty("Status"); + Log.d("Status:", S_Status.toString()); + str_Status = S_Status.toString(); + } + + if (str_Status.equalsIgnoreCase("Success")) { + + O_StudentName = list.getProperty("StudentName"); + if (!O_StudentName.toString().equals("anyType{}") && !O_StudentName.toString().equals(null)) { + S_StudentName = (SoapPrimitive) list.getProperty("StudentName"); + str_studentName = S_StudentName.toString(); + Log.d("StudentNameissss", str_studentName); + } + + O_LeadId = list.getProperty("Lead_id"); + if (!O_LeadId.toString().equals("anyType{}") && !O_LeadId.toString().equals(null)) { + S_LeadId = (SoapPrimitive) list.getProperty("Lead_id"); + str_leadid = S_LeadId.toString(); + Log.d("str_leadidisss", str_leadid); + } + + O_RegistrationDate = list.getProperty("RegistrationDate"); + if (!O_RegistrationDate.toString().equals("anyType{}") && !O_RegistrationDate.toString().equals(null)) { + S_RegistrationDate = (SoapPrimitive) list.getProperty("RegistrationDate"); + Log.d("S_RegistrationDate", S_RegistrationDate.toString()); + str_registrationDate = S_RegistrationDate.toString(); + Log.d("str_registrationDate", str_registrationDate); + } + + O_CollegeName = list.getProperty("CollegeName"); + if (!O_CollegeName.toString().equals("anyType{}") && !O_CollegeName.toString().equals(null)) { + S_CollegeName = (SoapPrimitive) list.getProperty("CollegeName"); + Log.d("S_CollegeName", S_CollegeName.toString()); + str_collegeName = S_CollegeName.toString(); + Log.d("str_collegeName", str_collegeName); + + collegeNameLst.add(str_collegeName); + + } + + O_MobileNo = list.getProperty("MobileNo"); + if (!O_MobileNo.toString().equals("anyType{}") && !O_MobileNo.toString().equals(null)) { + S_MobileNo = (SoapPrimitive) list.getProperty("MobileNo"); + Log.d("S_MobileNo", S_MobileNo.toString()); + str_MobileNo = S_MobileNo.toString(); + } + + O_IsFeesPaid = list.getProperty("isFeePaid"); + if (!O_IsFeesPaid.toString().equals("anyType{}") && !O_IsFeesPaid.toString().equals(null)) { + S_IsFeesPaid = (SoapPrimitive) list.getProperty("isFeePaid"); + Log.d("S_IsFeesPaid", S_IsFeesPaid.toString()); + str_IsFeesPaid = S_IsFeesPaid.toString(); + } + + FeesUnpaidModel item; + + item = new FeesUnpaidModel(str_studentName, str_leadid, str_registrationDate, str_collegeName, str_MobileNo, str_IsFeesPaid); + feesList.add(item); + } + + } + + originalList = new ArrayList(); + originalList.addAll(feesList); + + adapter.notifyDataSetChanged(); + //progressBar.setVisibility(View.GONE); + + Log.d("Totalcountssss:", String.valueOf(lview.getCount())); + txt_actualTotalCounts.setText(String.valueOf(lview.getCount())); + + initCollegeSpinner(); + } + + progressDialog.dismiss(); + + + + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapObject getFeesUnpaid() { + String METHOD_NAME = "GetStudentRegistration"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetStudentRegistration"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + request.addProperty("ManagerId",str_MangerID); + //users.ad + //request.add + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + Log.d("soapresponse1xxxxFees",envelope.getResponse().toString()); + + + SoapObject response = (SoapObject) envelope.getResponse(); + Log.e("soapresponseyyyyyyyFees",response.toString()); + + //return null; + + return response; + + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String str_exceptionerror = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),str_exceptionerror, Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String str_exceptionerror = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),str_exceptionerror, Toast.LENGTH_LONG).show(); + } + }); + } + return null; + + }*/ + + public class GetFeesUnpaid extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + //private ProgressBar progressBar; + + GetFeesUnpaid (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapObject response = getFeesUnpaid(); + + //Log.d("Soap response is",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + progressDialog.setMessage("Loading"); + progressDialog.setProgressStyle(android.R.attr.progressBarStyleSmall); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapObject result) { + + + if(str_studListStatus.equalsIgnoreCase("Success")){ + originalList = new ArrayList(); + originalList.addAll(feesList); + + adapter.notifyDataSetChanged(); + //progressBar.setVisibility(View.GONE); + + Log.d("Totalcountssss:", String.valueOf(lview.getCount())); + txt_actualTotalCounts.setText(String.valueOf(lview.getCount())); + + }else{ + Toast.makeText(getActivity(),str_studListStatus, Toast.LENGTH_LONG).show(); + originalList = new ArrayList(); + originalList.addAll(feesList); + + adapter.notifyDataSetChanged(); + } + + progressDialog.dismiss(); + + + + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapObject getFeesUnpaid() { + String METHOD_NAME = "GetStudentRegistration"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetStudentRegistration"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + request.addProperty("ManagerId",MDId); + request.addProperty("College_Id",str_ColID); + request.addProperty("Fees_Category_Id",str_feesCatSlno); + request.addProperty("Academic_Id",str_yearID); + //users.ad + //request.add + + Log.e("tag","request studentlist="+request.toString()); + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + Log.d("soapresponseFees",envelope.getResponse().toString()); + + + SoapObject response = (SoapObject) envelope.getResponse(); + Log.e("soapresponseyyyyyyyFees",response.toString()); + + studentlistcount = response.getPropertyCount(); + SoapObject summaryresponse=(SoapObject)response.getProperty(0); + str_studListStatus=summaryresponse.getProperty("Status").toString(); + Log.d("summarylistcount", String.valueOf(response.getPropertyCount())); + feesList.clear(); + + if(str_studListStatus.equalsIgnoreCase("Success")) { + if (studentlistcount > 0) { + arrayObj_Class_studList = new Class_UnpaidStudList[studentlistcount]; + + // ViewSummaryList_arraylist.clear(); + for (int i = 0; i < studentlistcount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + + Class_UnpaidStudList innerObj_Class_manager = new Class_UnpaidStudList(); + innerObj_Class_manager.setRegistration_Id(response_soapobj.getProperty("Registration_Id").toString()); //1 + innerObj_Class_manager.setStudentName(response_soapobj.getProperty("StudentName").toString()); //Hubballi + innerObj_Class_manager.setMobileNo(response_soapobj.getProperty("MobileNo").toString());// HB + innerObj_Class_manager.setMaidId(response_soapobj.getProperty("MaidId").toString());// <1 + innerObj_Class_manager.setLead_id(response_soapobj.getProperty("Lead_id").toString());// <1 + innerObj_Class_manager.setStateCode(response_soapobj.getProperty("StateCode").toString());// <1 + innerObj_Class_manager.setDistrictCode(response_soapobj.getProperty("DistrictCode").toString());// <1 + innerObj_Class_manager.setTalukaCode(response_soapobj.getProperty("TalukaCode").toString());// <1 + innerObj_Class_manager.setCollegeCode(response_soapobj.getProperty("CollegeCode").toString());// <1 + innerObj_Class_manager.setCollegeName(response_soapobj.getProperty("CollegeName").toString());// <1 + innerObj_Class_manager.setStreamId(response_soapobj.getProperty("StreamId").toString());// <1 + innerObj_Class_manager.setRegistrationDate(response_soapobj.getProperty("RegistrationDate").toString());// <1 + innerObj_Class_manager.setFees(response_soapobj.getProperty("Fees").toString());// <1 + innerObj_Class_manager.setIsFeePaid(response_soapobj.getProperty("isFeePaid").toString());// <1 + innerObj_Class_manager.setProjectcount(response_soapobj.getProperty("projectcount").toString());// <1 + innerObj_Class_manager.setRequestedId(response_soapobj.getProperty("RequestedId").toString());// <1 + innerObj_Class_manager.setStatus(response_soapobj.getProperty("Status").toString());// <1 + + // innerObj_Class_manager.setPayment_Mode("1"); + str_studListStatus = response_soapobj.getProperty("Status").toString(); + + arrayObj_Class_studList[i] = innerObj_Class_manager; + + feesList.add(arrayObj_Class_studList[i]); + + // ViewSummaryList_arraylist.add(innerObj_Class_manager); + /* String str_districtID = response_soapobj.getProperty("DistrictId").toString(); + String str_districtname = response_soapobj.getProperty("DistrictName").toString(); + String str_districtstateid = response_soapobj.getProperty("Stateid").toString(); +*/ + //DBCreate_Districtdetails_insert_2SQLiteDB(str_districtID,str_districtname,str_districtstateid); + + + }//end for loop + + }//end of if + + } + //return null; + + return response; + + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String str_exceptionerror = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),str_exceptionerror, Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String str_exceptionerror = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),str_exceptionerror, Toast.LENGTH_LONG).show(); + } + }); + } + return null; + + } + + private class GetFromToDateAsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + /* dialog.setMessage("Please wait,District Loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show();*/ + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetFromToDate(); // get the District list + return null; + } + + public GetFromToDateAsyncCallWS(Context activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) { + + + if(str_YearListStatus.equalsIgnoreCase("Success")) + { + + + dataAdapter_yearList = new ArrayAdapter(getContext(), R.layout.spinnercustomstyle, arrayObj_Class_YearList); + //dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_yearList.setDropDownViewResource(R.layout.spinnercustomstyle); + // districtsearch_ATV.setAdapter(dataAdapter_district); + spin_year.setAdapter(dataAdapter_yearList); + spin_year.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + // } + } + + + }//end of onPostExecute + }// end Async task + + public void GetFromToDate() + { + + String URL = Class_URL.URL_Login.toString().trim(); + String METHOD_NAME = "GetAcademicYearList"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/GetAcademicYearList"; + + //for final + + try { + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + + + // long + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + + SoapObject response = (SoapObject ) envelope.getResponse(); + Log.e("response acdamiclist",response.toString()); + YearListCount = response.getPropertyCount(); + SoapObject summaryresponse=(SoapObject)response.getProperty(0); + str_YearListStatus=summaryresponse.getProperty("Status").toString(); + Log.d("YearListcount", String.valueOf(response.getPropertyCount())); + + + if(str_YearListStatus.equals("Success")) { + if (YearListCount > 0) { + arrayObj_Class_YearList = new Class_YearList[YearListCount]; + for (int i = 0; i < YearListCount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + + Class_YearList innerObj_Class_YearList = new Class_YearList(); + innerObj_Class_YearList.setAcademicCode(response_soapobj.getProperty("AcademicCode").toString()); //1 + innerObj_Class_YearList.setSlno(response_soapobj.getProperty("slno").toString()); //Hubballi + innerObj_Class_YearList.setStatus(response_soapobj.getProperty("Status").toString());// HB + + str_YearListStatus = response_soapobj.getProperty("Status").toString(); + + arrayObj_Class_YearList[i] = innerObj_Class_YearList; + + }//end for loop + + }//end of if + + } + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + // internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + } + + private class FeesCatglistAsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + /* dialog.setMessage("Please wait,District Loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show();*/ + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetFeesCatglist(); // get the District list + return null; + } + + public FeesCatglistAsyncCallWS(Context activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + + //dialog.dismiss(); + + /*uploadfromDB_Statelist(); + uploadfromDB_Districtlist(); + setSpinner();*/ + // uploadfromDB_Districtlist(); + + + if(str_FeesCatgStatus.equals("Success")) + { + + + dataAdapter_feesCatg = new ArrayAdapter(getContext(), R.layout.spinnercustomstyle, arrayObj_Class_FeesCatg); + //dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_feesCatg.setDropDownViewResource(R.layout.spinnercustomstyle); + // districtsearch_ATV.setAdapter(dataAdapter_district); + spin_feesCategory.setAdapter(dataAdapter_feesCatg); + spin_feesCategory.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + // } + } + + + }//end of onPostExecute + }// end Async task + + public void GetFeesCatglist() + { + + String URL = Class_URL.URL_Manager.toString().trim(); + String METHOD_NAME = "Get_Fees_Category_Master"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/Get_Fees_Category_Master"; + + + + //for final + + + try { +//vijay district + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + + // request.addProperty("distid", Long.parseLong(str_Sids));//Long + + // request.addProperty("distid", 17);//Long + + request.addProperty("Academic_Id", str_yearID);//Long + request.addProperty("Registration_Id", 0);//Long + request.addProperty("College_ID", 0);//Long + + //request.addProperty("stateId", 17);//Long + // long + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + // Log.i(TAG, "GetAllLoginDetails is running"); + // result1 = (Vector) envelope.getResponse(); + + // response = (SoapPrimitive) envelope.getResponse(); + + // SoapPrimitive res =(SoapPrimitive)envelope.getResponse(); + + SoapObject response = (SoapObject ) envelope.getResponse(); + Log.e("response feesCatglist",response.toString()); + feesCatglistcount = response.getPropertyCount(); + SoapObject districtresponse=(SoapObject)response.getProperty(0); + str_FeesCatgStatus=districtresponse.getProperty("Status").toString(); + Log.d("feesCatgcount", String.valueOf(response.getPropertyCount())); + + + if(str_FeesCatgStatus.equals("Success")) { + if (feesCatglistcount > 0) { + arrayObj_Class_FeesCatg = new Class_FeesCatg[feesCatglistcount]; + for (int i = 0; i < feesCatglistcount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + + Class_FeesCatg innerObj_Class_FeesCatg = new Class_FeesCatg(); + innerObj_Class_FeesCatg.setFees_category_code(response_soapobj.getProperty("fees_category_code").toString()); //1 + innerObj_Class_FeesCatg.setFees_category_description(response_soapobj.getProperty("Fees_category_description").toString()); //Hubballi + innerObj_Class_FeesCatg.setFees_Category_Slno(response_soapobj.getProperty("Fees_Category_Slno").toString());// HB + innerObj_Class_FeesCatg.setAcademic_year(response_soapobj.getProperty("academic_year").toString());// <1 + innerObj_Class_FeesCatg.setStatus(response_soapobj.getProperty("Status").toString());// <1 + innerObj_Class_FeesCatg.setFees(response_soapobj.getProperty("Fees").toString());// <1 + innerObj_Class_FeesCatg.setFees_ID(response_soapobj.getProperty("Fees_ID").toString());// <1 + + str_FeesCatgStatus = response_soapobj.getProperty("Status").toString(); + + arrayObj_Class_FeesCatg[i] = innerObj_Class_FeesCatg; + + }//end for loop + + }//end of if + + } + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + // internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + } + + private void initCollegeSpinner() { + //final ArrayList projType = new ArrayList(); + /* Log.d("collegeNameLstisss",collegeNameLst.toString()); + + for(String collegeName : collegeNameLst){ + Log.d("collegeNameissss",collegeName); + }*/ + + collegeNameArrLst.addAll(collegeNameLst); + + ArrayAdapter dataAdapter2 = new ArrayAdapter(getActivity(), R.layout.simple_spinner_items, collegeNameArrLst); + + // Drop down layout style - list view with radio button + //dataAdapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter2.setDropDownViewResource(R.layout.spinnercustomstyle); + + // attaching data adapter to spinner + spin_college.setAdapter(dataAdapter2); + //spin_projectType.getBackground().setColorFilter(getResources().getColor(R.color.colorAccent), PorterDuff.Mode.SRC_ATOP); + + //spin_college.setSupportBackgroundTintList(ContextCompat.getColorStateList(getActivity(), R.color.colorWhite)); + + Log.d("countisssss", String.valueOf(lview.getCount())); + + /* if(lview.getCount()==0){ + txt_selectAll.setVisibility(View.GONE); + chk_selectAll.setVisibility(View.GONE); + }else{ + txt_selectAll.setVisibility(View.VISIBLE); + chk_selectAll.setVisibility(View.VISIBLE); + }*/ + + } + + private class CollegelistAsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + dialog.setMessage("Please wait,College loading..."); + + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetCollegelist(); // get the College list + return null; + } + + public CollegelistAsyncCallWS(Context activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + + dialog.dismiss(); + + + /* uploadfromDB_Statelist(); + uploadfromDB_Districtlist(); +*/ + /*uploadfromDB_Statelist(); + uploadfromDB_Districtlist(); + + uploadfromDB_collegeTypeSpinner();*/ //vijay + + if(str_CollegesStatus.equals("Success")) + { + /*if (str_isProfileEdited.equals("1")) + { + dataAdapter_college = new ArrayAdapter(getContext(), R.layout.spinnercustomstyle, arrayObj_Class_Colleges); + dataAdapter_college.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_college.setAdapter(dataAdapter_college); + spin_college.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + + str_ColID="y"; + if(O_collegename!="" || O_collegename!=null) + { + for (int i = 0; i < spin_institution.getCount(); i++) { + if (spin_college.getItemAtPosition(i).toString().equals(O_collegename)) + { + spin_college.setSelection(i); + break; + } + } + } + + } + else {*/ + + str_ColID="y"; + dataAdapter_college = new ArrayAdapter(getContext(), R.layout.spinnercustomstyle, arrayObj_Class_Colleges); + // dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_college.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_college.setAdapter(dataAdapter_college); + spin_college.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + //} + } + else { + //There are no colleges + if (str_CollegesStatus.equals("There are no colleges")) + { + /*List list = new ArrayList(); + list.add("No Colleges");*/ + dataAdapter_college = new ArrayAdapter(getContext(), R.layout.spinnercustomstyle, arrayObj_Class_Colleges3); + // dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_college.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_college.setAdapter(dataAdapter_college); + spin_college.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + + } + else + { + List list = new ArrayList(); + list.add("WS Exception"); + dataAdapter_college = new ArrayAdapter(getContext(), R.layout.spinnercustomstyle, list); + // dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_college.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_college.setAdapter(dataAdapter_college); + spin_college.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + + } + + } + + }//end of onPostExecute + }// end Async task + + public void GetCollegelist() + { + + String URL = Class_URL.URL_Login.toString().trim(); + String METHOD_NAME = "GetCollegesOnCity"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/GetCollegesOnCity"; + + + + //for final + + + try { + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + // request.addProperty("clgid", 0);//string shubham.dsep@detedu.org str_loginemailid + + + // int feesid =spin_feesCategory.getSelectedItemPosition(); + // Log.e("tag","feesID="+feesid); + // str_feesCatSlno= arrayObj_Class_FeesCatg[feesid].getFees_Category_Slno(); + Log.e("tag","Manager_Id="+MDId+"Fees_Category_Id="+str_feesCatSlno); + request.addProperty("city", 0);// long + request.addProperty("type", "");// string + request.addProperty("Manager_Id",MDId); + request.addProperty("Fees_Category_Id",str_feesCatSlno); + request.addProperty("User_Type","Manager"); + + // + Log.e("request collegelist",request.toString()); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + // Log.i(TAG, "GetAllLoginDetails is running"); + // result1 = (Vector) envelope.getResponse(); + + // response = (SoapPrimitive) envelope.getResponse(); + + // SoapPrimitive res =(SoapPrimitive)envelope.getResponse(); + + SoapObject response = (SoapObject ) envelope.getResponse(); + Log.e("resp collegelist",response.toString()); + collegeslistcount = response.getPropertyCount(); + SoapObject response_soapobj1 = (SoapObject) response.getProperty(0); + str_CollegesStatus=response_soapobj1.getProperty("Status").toString();//Status=There are no colleges; //Status=Success; + Log.d("Ccount", String.valueOf(response.getPropertyCount())); + + + + //anyType{CollegeId=0; TalukId=0; Status=There are no colleges; }; + + + /*SoapObject response_soapobj1 = (SoapObject) response.getProperty(0); + + nocollegestatus=response_soapobj1.getProperty("Status").toString();//Success + + Log.e("nocollege",nocollegestatus); + + + (str_CollegesStatus.equals("Success")) {*/ + if(str_CollegesStatus.equals("Success")) + { + if (collegeslistcount > 0) { + arrayObj_Class_Colleges = new Class_Colleges[collegeslistcount]; + + + for (int i = 0; i < collegeslistcount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + + /*long + long + string + string*/ + + Class_Colleges innerObj_Class_colleges = new Class_Colleges(); + innerObj_Class_colleges.setcollege_id(response_soapobj.getProperty("CollegeId").toString()); //long + innerObj_Class_colleges.setcollege_tid(response_soapobj.getProperty("TalukId").toString()); //long + innerObj_Class_colleges.setcollegename(response_soapobj.getProperty("College_Name").toString());// string + innerObj_Class_colleges.setFees(response_soapobj.getProperty("Fees").toString()); + innerObj_Class_colleges.setFees_Id(response_soapobj.getProperty("Fees_Id").toString()); + + innerObj_Class_colleges.setcollegestatus(response_soapobj.getProperty("Status").toString());// Success + + + str_CollegesStatus = response_soapobj.getProperty("Status").toString(); + + arrayObj_Class_Colleges[i] = innerObj_Class_colleges; + + + String str_collegeID = response_soapobj.getProperty("CollegeId").toString(); + String str_college_tid = response_soapobj.getProperty("TalukId").toString(); + String str_collegename = response_soapobj.getProperty("College_Name").toString(); + + + // DBCreate_Collegedetails_insert_2SQLiteDB(str_collegeID,str_college_tid,str_collegename); + + // DBCreate_Collegedetails_insert_2SQLiteDB(str_collegeID, str_college_tid, str_collegename); + + + }//end for loop + + }//end of if + + + }// end of if + else + { + arrayObj_Class_Colleges3 = new Class_Colleges[1]; + Class_Colleges innerObj_Class_colleges = new Class_Colleges(); + innerObj_Class_colleges.setcollege_id("0"); //long + innerObj_Class_colleges.setcollege_tid("0"); //long + innerObj_Class_colleges.setcollegename("There are no colleges");// string + + str_CollegesStatus ="There are no colleges"; + arrayObj_Class_Colleges3[0] = innerObj_Class_colleges; + + } + + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("getCollege fail", "> " + t.getMessage()); + // internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + } +}//end of fragment classxx diff --git a/app/src/main/java/com/leadcampusapp/FeesUnpaidModel.java b/app/src/main/java/com/leadcampusapp/FeesUnpaidModel.java new file mode 100644 index 0000000..525687d --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/FeesUnpaidModel.java @@ -0,0 +1,71 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 28-05-2018. + */ + +public class FeesUnpaidModel { + private String student_name; + private String lead_id; + private String registration_date; + private String college_name; + private String phone_number; + private String status; + + public String getStudent_name() { + return student_name; + } + + public void setStudent_name(String student_name) { + this.student_name = student_name; + } + + public String getLead_id() { + return lead_id; + } + + public void setLead_id(String lead_id) { + this.lead_id = lead_id; + } + + public String getRegistration_date() { + return registration_date; + } + + public void setRegistration_date(String registration_date) { + this.registration_date = registration_date; + } + + public String getCollege_name() { + return college_name; + } + + public void setCollege_name(String college_name) { + this.college_name = college_name; + } + + public String getPhone_number() { + return phone_number; + } + + public void setPhone_number(String phone_number) { + this.phone_number = phone_number; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public FeesUnpaidModel(String student_name, String lead_id, String registration_date, String college_name, String phone_number, String status) { + this.student_name = student_name; + this.lead_id = lead_id; + this.registration_date = registration_date; + this.college_name = college_name; + this.phone_number = phone_number; + this.status = status; + } +} diff --git a/app/src/main/java/com/leadcampusapp/FileUtil.java b/app/src/main/java/com/leadcampusapp/FileUtil.java new file mode 100644 index 0000000..0231730 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/FileUtil.java @@ -0,0 +1,153 @@ +package com.leadcampusapp; + +import android.content.Context; +import android.database.Cursor; +import android.net.Uri; +import android.provider.MediaStore; +import android.provider.OpenableColumns; +import android.util.Log; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +/** + * Created on : June 18, 2016 + * Author : zetbaitsu + * Name : Zetra + * Email : zetra@mail.ugm.ac.id + * GitHub : https://github.com/zetbaitsu + * LinkedIn : https://id.linkedin.com/in/zetbaitsu + */ +public class FileUtil { + static final String FILES_PATH = "Compressor"; + private static final int EOF = -1; + private static final int DEFAULT_BUFFER_SIZE = 1024 * 4; + + private FileUtil() { + + } + + public static File from(Context context, Uri uri) throws IOException { + InputStream inputStream = context.getContentResolver().openInputStream(uri); + String fileName = getFileName(context, uri); + Log.d("fileNameissss",fileName); + String[] splitName = splitFileName(fileName); + for(int i=0;i Integer.MAX_VALUE) { + return -1; + } + return (int) count; + } + + static long copyLarge(InputStream input, OutputStream output) + throws IOException { + return copyLarge(input, output, new byte[DEFAULT_BUFFER_SIZE]); + } + + static long copyLarge(InputStream input, OutputStream output, byte[] buffer) + throws IOException { + long count = 0; + int n; + while (EOF != (n = input.read(buffer))) { + output.write(buffer, 0, n); + count += n; + } + return count; + } +} diff --git a/app/src/main/java/com/leadcampusapp/FinalProjectCompletion_Activity.java b/app/src/main/java/com/leadcampusapp/FinalProjectCompletion_Activity.java new file mode 100644 index 0000000..ff8df09 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/FinalProjectCompletion_Activity.java @@ -0,0 +1,6433 @@ +package com.leadcampusapp; + +import android.annotation.SuppressLint; +import android.app.AlertDialog; +import android.app.DatePickerDialog; +import android.app.Dialog; +import android.app.DialogFragment; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.Color; +import android.graphics.drawable.ColorDrawable; +import android.net.Uri; +import android.os.AsyncTask; +import android.os.Environment; +import android.os.Handler; +import android.os.Message; +import android.provider.MediaStore; +import androidx.core.content.ContextCompat; +import androidx.core.content.FileProvider; +import androidx.appcompat.app.AppCompatActivity; +import android.os.Bundle; +//import androidx.appcompat.widget.DefaultItemAnimator; +//import androidx.appcompat.widget.GridLayoutManager; +import androidx.recyclerview.widget.DefaultItemAnimator; +import androidx.recyclerview.widget.GridLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import android.text.Editable; +import android.text.TextWatcher; +import android.util.Log; +import android.view.KeyEvent; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.DatePicker; +import android.widget.EditText; +import android.widget.ImageButton; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.ProgressBar; +import android.widget.RadioButton; +import android.widget.RadioGroup; +import android.widget.RelativeLayout; +import android.widget.Spinner; +import android.widget.TextView; +import android.widget.Toast; + +import org.joda.time.Days; +import org.joda.time.LocalDate; +import org.json.JSONException; +import org.json.JSONObject; +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.MarshalBase64; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.ProtocolException; +import java.net.URL; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; + +import static android.view.View.GONE; +import static com.leadcampusapp.CompletionGalleryFolderSelectActivity.imageFilePath; + +public class FinalProjectCompletion_Activity extends AppCompatActivity implements ConnectivityReceiver.ConnectivityReceiverListener{ + + + public static final String PREFBook_Stud= "prefbook_stud"; //sharedpreference Book + public static final String PrefID_RegID = "prefid_regid"; // + public static final String PrefID_SLeadID = "prefid_sleadid"; // + private SharedPreferences shardpref_S_obj; + + private String str_leadId,str_RegistrationId; + private static ProgressDialog pd; + + String str_projectid,str_projectstatus,str_impactproject_status; + String str_projectdraft_Status,str_response_approvedproject_status; + private ArrayList arrlstUploadImageByteArray = null; + + TextView projectname_tv; + + TextView projectname_fpc_tv,projectype_fpc_tv,beneficiaries_fpc_tv,objectives_fpc_tv,placeofimpl_fpc_tv,approvedAmt_fpc_tv,challanges_fpc_et,learning_fpc_et,story_fpc_et; + + EditText resourcesUtilised_amount_fpc_et,resourcesUtilised_fpc_et; + EditText placeofimpl_fpc_et,edt_hoursspent; + + String str_response_approved_title,str_response_approved_themetypename,str_response_approved_beneficinary,str_response_approved_objective,str_response_approved_approvedAmt,str_response_approved_placeofimplmnt; + + String str_response_SanctionAmount,str_response_Fund_Received,str_response_fundraised,str_response_challenge,str_response_learning,str_response_story,str_response_utilised,str_hoursspent,str_resource_amount_response; + private ImageButton btn_add_image; + + + int CompletionProgress,CompletionProgress1; + private String userChoosenTask; + private int REQUEST_CAMERA = 0, SELECT_FILE = 1; + File file_img; + File file_imageFile; + private static Uri uri_fileUri; + private HashMap cameraImgMap; + private ImageAdapter imageAdapter; + private ArrayList imageUrls; + private ArrayList imgurlss; + ArrayList mImageInByte; + private static final int PICKFILE_RESULT_CODE = 45; + private byte[] docbyteArray = null; + private String extensions = null; + private List imagesEncodedList; + private TextView fileSelected_fpc_tv,txt_leadFunded; + + private ArrayList arrlstUploadedImageBitmap = null; + private Button btn_submitCompletion,btn_saveDraft; + + private static TextView txt_numOfImages; + // private TextView txt_noOfImg; + private static ImageView img_mainGallery; + private ImageView uploadReport_fpc_iv,btn_doc; + private EditText edt_fundRaised; + private int count1; + private int count2; + ArrayList urllist = new ArrayList(); + private URL url; + private String wordDocPath="null"; + private ArrayList imagePathList; + private URL downloadUrl; + private String docName; + File outputFile = null; + TextView txt_doc; + static ArrayList bitmapLst=new ArrayList(); + RelativeLayout rl_gallery_images; + LinearLayout ll_gallery_images; + Dialog dialog = null; + RadioGroup rg; + RadioButton rb; + + + Class_alert_msg obj_class_alert_msg; + private Context contextpresentActivity; + + + static TextView studentcomp_clickstartprojectdate_tv; + static TextView studentcomp_clickendprojectdate_tv; + static String yyyyMMdd_studentcomp_startdate = ""; + static String yyyyMMdd_studentcomp_enddate = ""; + private static TextView studentcomp_numberofdays_tv; + + String str_finalcomp_projectstartdate,str_finalcomp_projectenddate,str_is_impactproject; + LinearLayout datelabel_linearlayout,date_linearlayout,days_linearlayout; + + + Spinner sdgs_sp; + TextView sdgs_dropdownvalue_tv,sdgs_display_tv; + + + + CheckBox goal_1_nopoverty_cb,goal_2_zerohunger_cb,goal_3_goodhealth_cb,goal_4_quality_cb,goal_5_gender_cb,goal_6_clean_cb, + goal_7_affordable_cb,goal_8_decent_cb,goal_9_industry_cb,goal_10_reduce_cb,goal_11_sustain_cb,goal_12_responsible_cb, + goal_13_climate_cb,goal_14_lifewater_cb,goal_15_lifeland_cb,goal_16_peace_cb,goal_17_partnerships_cb,goal_18_none_cb; + + + JSONObject goals_jsonobject; + + String str_selected_goals_response=""; + + String str_alertshowhide; + + String str_collaboration_resp,str_permissionactivities_resp,str_exp_initiative_resp,str_lacking_initiative_resp + ,str_againtstide_resp,str_cross_hurdles_resp,str_venture_resp,str_govern_award_resp,str_leadership_role_resp,str_sdgs_goals_resp; + + private ArrayList arraylist_goalsln = new ArrayList(); + + private ArrayList arraylist_goalsln_forcheckbox = new ArrayList(); + + + + //impactproject + + CheckBox impactproject_collabaration_cb,impactproject_againtstide_cb,impactproject_crosshurdles_cb,impactproject_venture_cb, + impactproject_governaward_cb,impactproject_leadershiprole_cb; + + EditText impactproject_collabaration_et,impactproject_againtstide_et,impactproject_crosshurdles_et, + impactproject_venture_et,impactproject_governaward_et,impactproject_leadershiprole_et,permissionactivities_et, + exp_initiative_et,lacking_initiative_et; + + TextView permissionactivities_wordscount_tv; + + String str_validation_leadershiprole,str_validation_governaward,str_validation_venture,str_validation_crosshurdles,str_validation_againtstide, + str_validation_collabaration; + LinearLayout impactproject_linearlayout,goalslist_linearlayout; + + + + // added by madhu for server img delete + private static ProgressDialog pd1; + SQLiteDatabase db1; + Cursor cursor1; + String status; + static ArrayList TempUrlList = new ArrayList<>(); + ArrayList documentlist_slno = new ArrayList(); + ArrayList documentlist_path = new ArrayList<>(); + ArrayList Delete_doclist_slno = new ArrayList(); + ArrayList Delete_doclist_path = new ArrayList<>(); + + + @Override + protected void onCreate(final Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_final_project_completion); + + + + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + //getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background)); + + contextpresentActivity = FinalProjectCompletion_Activity.this; + + projectname_fpc_tv = (TextView) findViewById(R.id.projectname_fpc_tv); + projectype_fpc_tv = (TextView) findViewById(R.id.projectype_fpc_tv); + beneficiaries_fpc_tv = (TextView) findViewById(R.id.beneficiaries_fpc_tv); + objectives_fpc_tv = (TextView) findViewById(R.id.objectives_fpc_tv); + placeofimpl_fpc_et = (EditText) findViewById(R.id.placeofimpl_fpc_et); + approvedAmt_fpc_tv = (TextView) findViewById(R.id.approvedAmt_fpc_tv); + challanges_fpc_et = (TextView) findViewById(R.id.challanges_fpc_et); + learning_fpc_et = (TextView) findViewById(R.id.learning_fpc_et); + story_fpc_et = (TextView) findViewById(R.id.story_fpc_et); + resourcesUtilised_fpc_et = (EditText) findViewById(R.id.resourcesUtilised_fpc_et); + resourcesUtilised_amount_fpc_et= (EditText) findViewById(R.id.resourcesUtilised_amount_fpc_et); + fileSelected_fpc_tv = (TextView) findViewById(R.id.fileSelected_fpc_TV); + txt_leadFunded = (TextView) findViewById(R.id.txt_leadFunded); + edt_hoursspent=(EditText) findViewById(R.id.edt_hoursspent); + + img_mainGallery = (ImageView) findViewById(R.id.img_mainGallery); + txt_numOfImages = (TextView) findViewById(R.id.txt_numOfImages); + rl_gallery_images=(RelativeLayout)findViewById(R.id.rl_gallery_images); + + // txt_noOfImg = (TextView) findViewById(R.id.txt_noOfImg); + + arrlstUploadedImageBitmap = new ArrayList(); + btn_add_image = (ImageButton)findViewById(R.id.btn_add_image); + btn_submitCompletion = (Button) findViewById(R.id.btn_submitCompletion); + btn_saveDraft = (Button) findViewById(R.id.btn_saveDraft); + uploadReport_fpc_iv=(ImageView)findViewById(R.id.uploadReport_fpc_iv); + edt_fundRaised = (EditText) findViewById(R.id.edt_fundRaised); + btn_doc =(ImageView) findViewById(R.id.btn_doc); + // txt_doc = (TextView) findViewById(R.id.txt_doc); + ll_gallery_images = (LinearLayout) findViewById(R.id.ll_gallery_images); + + + studentcomp_clickstartprojectdate_tv = (TextView)findViewById(R.id.studentcomp_clickstartprojectdate_tv); + studentcomp_clickendprojectdate_tv = (TextView) findViewById(R.id.studentcomp_clickendprojectdate_tv); + studentcomp_numberofdays_tv=(TextView)findViewById(R.id.studentcomp_numberofdays_tv); + + + datelabel_linearlayout=(LinearLayout)findViewById(R.id.datelabel_linearlayout); + date_linearlayout=(LinearLayout)findViewById(R.id.date_linearlayout); + days_linearlayout=(LinearLayout)findViewById(R.id.days_linearlayout); + + sdgs_sp =(Spinner)findViewById(R.id.sdgs_sp); + sdgs_dropdownvalue_tv=(TextView)findViewById(R.id.sdgs_dropdownvalue_tv); + sdgs_display_tv=(TextView)findViewById(R.id.sdgs_display_tv); + + + + impactproject_linearlayout =(LinearLayout)findViewById(R.id.impactproject_linearlayout); + impactproject_collabaration_cb=(CheckBox)findViewById(R.id.impactproject_collabaration_cb); + impactproject_againtstide_cb=(CheckBox)findViewById(R.id.impactproject_againtstide_cb); + impactproject_crosshurdles_cb=(CheckBox)findViewById(R.id.impactproject_crosshurdles_cb); + impactproject_venture_cb=(CheckBox)findViewById(R.id.impactproject_venture_cb); + impactproject_governaward_cb=(CheckBox)findViewById(R.id.impactproject_governaward_cb); + impactproject_leadershiprole_cb=(CheckBox)findViewById(R.id.impactproject_leadershiprole_cb); + + impactproject_collabaration_et=(EditText) findViewById(R.id.impactproject_collabaration_et); + impactproject_againtstide_et=(EditText) findViewById(R.id.impactproject_againtstide_et); + impactproject_crosshurdles_et=(EditText) findViewById(R.id.impactproject_crosshurdles_et); + impactproject_venture_et=(EditText) findViewById(R.id.impactproject_venture_et); + impactproject_governaward_et=(EditText) findViewById(R.id.impactproject_governaward_et); + impactproject_leadershiprole_et=(EditText) findViewById(R.id.impactproject_leadershiprole_et); + permissionactivities_et=(EditText) findViewById(R.id.permissionactivities_et); + exp_initiative_et=(EditText) findViewById(R.id.exp_initiative_et); + lacking_initiative_et=(EditText) findViewById(R.id.lacking_initiative_et); + + + permissionactivities_wordscount_tv=(TextView) findViewById(R.id.permissionactivities_wordscount_tv); + + str_validation_leadershiprole=str_validation_governaward=str_validation_venture=str_validation_crosshurdles + =str_validation_againtstide=str_validation_collabaration="yes"; + + Log.e("str_collabaration",str_validation_collabaration.toString()); + + imageUrls = new ArrayList(); + imgurlss = new ArrayList(); + mImageInByte=new ArrayList(); + cameraImgMap = new HashMap(); + imagePathList = new ArrayList(); + + + arrlstUploadImageByteArray = new ArrayList<>(); + + pd1 = new ProgressDialog(FinalProjectCompletion_Activity.this); + + //Log.e("tag","madhu urllist=="+urllist); + GalleryImageBitmap.setAllImgURL(urllist); + TempUrlList.clear(); + + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + + View actionBarView = getSupportActionBar().getCustomView(); + TextView actionBarTV = (TextView) actionBarView.findViewById(R.id.txt_actionBar); + actionBarTV.setText("Completion Details"); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); + + shardpref_S_obj=getApplicationContext().getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + str_leadId = shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + + shardpref_S_obj.getString(PrefID_RegID, "").trim(); + str_RegistrationId = shardpref_S_obj.getString(PrefID_RegID, "").trim(); + Log.d("str_RegistrationId:",str_RegistrationId); + + final Intent intent = getIntent(); + if(intent!=null) { + str_projectid = intent.getExtras().getString("projectid_ValueKey"); + str_projectstatus= intent.getExtras().getString("projectstatus_ValueKey"); + str_impactproject_status=intent.getExtras().getString("impact_projectstatus_ValueKey"); + + + Log.e("projectid",str_projectid); + Log.e("leadID",str_leadId); + Log.e("projectstatus",str_projectstatus); + + } + + /* if(str_GalleryIntent.equals("1")) { + // TempUrlList = GalleryImageBitmap.getAllImgURL(); + LoadGalleryImage loadGalleryImg = new LoadGalleryImage(FinalProjectCompletion_Activity.this); + loadGalleryImg.execute(); + }*/ + + + ll_gallery_images.setVisibility(View.GONE); + + + if(str_impactproject_status.equals("0")) + { + impactproject_linearlayout.setVisibility(View.GONE); + } + + + /*studentcomp_clickstartprojectdate_tv.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + DialogFragment fromdateFragment = new DatePickerFragmentFromDate(); + fromdateFragment.show(getFragmentManager(), "Date Picker"); + } + }); + + + studentcomp_clickendprojectdate_tv.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + // settodate(); + DialogFragment dFragment = new DatePickerFragmentEndDate(); + // Show the date picker dialog fragment + + dFragment.show(getFragmentManager(), "Date Picker"); + + + } + }); +*/ + + + + + + + //goals_jsonobject = new JSONObject(); + + if(str_projectstatus.equals("Draft")) + { + ll_gallery_images.setVisibility(View.VISIBLE); + GetProjectDraftDetails_AsyncCallWS task = new GetProjectDraftDetails_AsyncCallWS(FinalProjectCompletion_Activity.this); + task.execute(); + } + else if(str_projectstatus.equals("Approved")) + { + ll_gallery_images.setVisibility(View.GONE); + // CompletionGetApprovedProjectDetails + CompletionGetApprovedProjectDetails_AsyncCallWS task = new CompletionGetApprovedProjectDetails_AsyncCallWS(FinalProjectCompletion_Activity.this); + task.execute(); + } + + else if(str_projectstatus.equals("RequestForCompletion")) + { + ll_gallery_images.setVisibility(View.VISIBLE); + btn_saveDraft.setVisibility(View.GONE); + GetProjectDraftDetails_AsyncCallWS task = new GetProjectDraftDetails_AsyncCallWS(FinalProjectCompletion_Activity.this); + task.execute(); + + + /*CompletionGetApprovedProjectDetails_AsyncCallWS task = new CompletionGetApprovedProjectDetails_AsyncCallWS(FinalProjectCompletion_Activity.this); + task.execute(); +*/ + + } + + /* int size=0; + size= GalleryImageBitmap.getAllImgURL().size(); + Log.e("tag","size=="+size); + for(int k=0;k stringList=new ArrayList<>(); // here is list + stringList.clear(); + for(int i=0;i",String.valueOf(childCount)); + ArrayList btn_count=new ArrayList<>(); + btn_count.clear(); + for(int j=1;j<=childCount;j++) { + btn_count.add(j); + Log.e("tag","btn_count="+btn_count); + } + for (int x = 0; x < childCount; x++) { + RadioButton btn = (RadioButton) group.getChildAt(x); + if (btn.getId() == checkedId) { + Log.e("selected RadioButton->",btn.getText().toString()); + Toast.makeText(FinalProjectCompletion_Activity.this, btn.getText().toString(), Toast.LENGTH_LONG).show(); + Log.e("tag","urllist.size()="+urllist.size()+"checkedId="+checkedId); + int k = 0; + for(int i=1;i<=urllist.size();i++){ +// Log.e("tag","I="+i+"checkedId="+checkedId+","+btn.getId()+btn_count.get(i)); + k=btn_count.get(i-1); + Log.e("tag","I="+i+"k="+k); + if (btn.getText().equals("Image : 1")) { + String ImgUrl = urllist.get(0).toString(); + Log.i("tag","ImgUrl="+urllist.get(0)); + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(ImgUrl)); + startActivity(browserIntent); + Toast.makeText(FinalProjectCompletion_Activity.this, checkedId + "," + btn.getId(), Toast.LENGTH_LONG).show(); + } + else if (btn.getText().equals("Image : 2")) { + String ImgUrl = urllist.get(1).toString(); + Log.i("tag","ImgUrl="+urllist.get(1)); + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(ImgUrl)); + startActivity(browserIntent); + Toast.makeText(FinalProjectCompletion_Activity.this, checkedId + "," + btn.getId(), Toast.LENGTH_LONG).show(); + } + else if (btn.getText().equals("Image : 3")) { + String ImgUrl = urllist.get(2).toString(); + Log.i("tag","ImgUrl="+urllist.get(2)); + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(ImgUrl)); + startActivity(browserIntent); + Toast.makeText(FinalProjectCompletion_Activity.this, checkedId + "," + btn.getId(), Toast.LENGTH_LONG).show(); + } + else if (btn.getText().equals("Image : 4")) { + String ImgUrl = urllist.get(3).toString(); + Log.i("tag","ImgUrl="+urllist.get(3)); + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(ImgUrl)); + startActivity(browserIntent); + Toast.makeText(FinalProjectCompletion_Activity.this, checkedId + "," + btn.getId(), Toast.LENGTH_LONG).show(); + } + else if (btn.getText().equals("Image : 5")) { + String ImgUrl = urllist.get(4).toString(); + Log.i("tag","ImgUrl="+urllist.get(4)); + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(ImgUrl)); + startActivity(browserIntent); + Toast.makeText(FinalProjectCompletion_Activity.this, checkedId + "," + btn.getId(), Toast.LENGTH_LONG).show(); + } + else if (btn.getText().equals("Image : 6")) { + String ImgUrl = urllist.get(5).toString(); + Log.i("tag","ImgUrl="+urllist.get(5)); + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(ImgUrl)); + startActivity(browserIntent); + Toast.makeText(FinalProjectCompletion_Activity.this, checkedId + "," + btn.getId(), Toast.LENGTH_LONG).show(); + } + else if (btn.getText().equals("Image : 7")) { + String ImgUrl = urllist.get(6).toString(); + Log.i("tag","ImgUrl="+urllist.get(6)); + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(ImgUrl)); + startActivity(browserIntent); + Toast.makeText(FinalProjectCompletion_Activity.this, checkedId + "," + btn.getId(), Toast.LENGTH_LONG).show(); + } + else if (btn.getText().equals("Image : 8")) { + String ImgUrl = urllist.get(7).toString(); + Log.i("tag","ImgUrl="+urllist.get(7)); + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(ImgUrl)); + startActivity(browserIntent); + Toast.makeText(FinalProjectCompletion_Activity.this, checkedId + "," + btn.getId(), Toast.LENGTH_LONG).show(); + } + else if (btn.getText().equals("Image : 9")) { + String ImgUrl = urllist.get(8).toString(); + Log.i("tag","ImgUrl="+urllist.get(8)); + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(ImgUrl)); + startActivity(browserIntent); + Toast.makeText(FinalProjectCompletion_Activity.this, checkedId + "," + btn.getId(), Toast.LENGTH_LONG).show(); + } + else if (btn.getText().equals("Image : 10")) { + String ImgUrl = urllist.get(9).toString(); + Log.i("tag","ImgUrl="+urllist.get(9)); + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(ImgUrl)); + startActivity(browserIntent); + Toast.makeText(FinalProjectCompletion_Activity.this, checkedId + "," + btn.getId(), Toast.LENGTH_LONG).show(); + } + + *//* String ImgUrl = urllist.get(0).toString(); + Log.i("tag", "ImgUrl=" + urllist.get(0)); + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(ImgUrl)); + startActivity(browserIntent); + Toast.makeText(FinalProjectCompletion_Activity.this, checkedId + "," + btn.getId(), Toast.LENGTH_LONG).show(); + dialog.dismiss(); + rg.clearCheck(); + rg.removeAllViews(); + rg.removeAllViewsInLayout();*//* + // } + + } + + } + } + } + }); + + } + });*/ + + + + uploadReport_fpc_iv.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + Intent documentIntent = new Intent(getApplication(),CompletionDocumentFolderSelectActivity.class); + startActivityForResult(documentIntent,SELECT_FILE); + + } + }); + + btn_doc.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + if(wordDocPath.equals("null")){ + Toast.makeText(FinalProjectCompletion_Activity.this, "File Not Exist", + Toast.LENGTH_SHORT).show(); + }else{ + LoadDocument loadDocument = new LoadDocument(getApplication()); + loadDocument.execute(); + } + } + }); + + + btn_saveDraft.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + if (checkSaveDraftFields()) + { + int count= getDeleted_ImgData_count(); + if(count>0){ + getDeleted_ImgData(count); + Async_DeleteImage async_deleteImage= new Async_DeleteImage(FinalProjectCompletion_Activity.this); + async_deleteImage.execute(); + } + + + + ArrayList byteArrayImage; + byteArrayImage = new ArrayList(); + byteArrayImage.clear(); + + byte[] byteImage=null; + + Log.e("tag","byteImage1="+byteImage); + byteImage = CompletionProjectStaticClass.getBytesImage(); + Log.e("tag","byteImage2="+byteImage); + + /* if(byteArrayImage!=null){ + for(int i=0;i=4){ + // CompletionProgress1=CompletionProgress1+40; + comproress=40; + } + + CompletionProgress1=CompletionProgress+comproress; + + Log.e("tag", "CompletionProgress1==" + CompletionProgress1); + //arrlstUploadImageByteArray.addAll(byteArrayImage); + Log.e("tag", "byteArrayImage=" + byteArrayImage.size()); + Log.e("tag", "arrlstUploadImageByteArray=" + arrlstUploadImageByteArray.size()); + Log.e("tag", "arrlstUploadImageByteArray.toString=" + arrlstUploadImageByteArray.toString()); + + if (totalImgCount > 10) + { + btn_submitCompletion.setVisibility(View.VISIBLE); + Toast.makeText(getApplicationContext(), "You can upload maximum of 10 images", Toast.LENGTH_LONG).show(); + } else { + // if (imgurlss.size() >= 0) { + + pd = new ProgressDialog(FinalProjectCompletion_Activity.this); + pd.setMax(100); + pd.setMessage("Loading..."); + /// pd.setTitle("ProgressDialog bar example"); + pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); + pd.setCanceledOnTouchOutside(false); + pd.show(); + + final Handler handle = new Handler() { + @Override + public void handleMessage(Message msg) { + super.handleMessage(msg); + pd.incrementProgressBy(1); + } + }; + Log.d("insidesizessssss", "CompletionProgress img="+CompletionProgress1); + btn_submitCompletion.setVisibility(View.VISIBLE); + + Log.d("insidesizessssss", "greater than 1"); + //Toast.makeText(getActivity(),"Inside size greater than 4",Toast.LENGTH_SHORT).show(); + //pd.dismiss(); + new Thread(new Runnable() { + @Override + public void run() { + try { + while (pd.getProgress() <= pd.getMax()) { + Thread.sleep(200); + handle.sendMessage(handle.obtainMessage()); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + }).start(); + + if (arrlstUploadImageByteArray != null) + { + UploadProjectImages_SaveDraft uploadProjectImages_saveDraft = new UploadProjectImages_SaveDraft(FinalProjectCompletion_Activity.this); + uploadProjectImages_saveDraft.execute(); + } + if (docbyteArray != null) { + UploadProjectDocument_SaveDraft uploadProjectDocument_saveDraft = new UploadProjectDocument_SaveDraft(getApplication()); + uploadProjectDocument_saveDraft.execute(); + } else { + SubmitForCompletion_SaveDraft submitForCompletion_saveDraft = new SubmitForCompletion_SaveDraft(getApplicationContext()); + submitForCompletion_saveDraft.execute(); + } + /* } else { + //pd.dismiss(); + Toast.makeText(getApplicationContext(), "Please Upload atleast 1 images", Toast.LENGTH_LONG).show(); + //btn_submitCompletion.setVisibility(View.VISIBLE); + }*/ + } + } + } + }); + + rl_gallery_images.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + //Log.d("lengthoflistsss", String.valueOf(bitmapList.size())); + Log.d("lengthoflistsss", String.valueOf(bitmapLst.size())); + + // Toast.makeText(getApplicationContext(),"On Click of relative layout submit",Toast.LENGTH_LONG).show(); + + /* progressDialog.setMessage("Submitting"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show();*/ + + try { + if (bitmapLst.size() > 0) + { + + try { + + Delete_AllImglistTable_B4Insertion(); + + GalleryImageBitmap.setBitmapGalleryImage(bitmapLst); + + GalleryImageBitmap.setDocument_path(documentlist_path); + GalleryImageBitmap.setDocument_slno(documentlist_slno); + + Intent i = new Intent(FinalProjectCompletion_Activity.this, ComplitionGallaryActivity.class); + i.putExtra("projectid_ValueKey", str_projectid); + i.putExtra("projectstatus_ValueKey", str_projectstatus); + i.putExtra("impact_projectstatus_ValueKey", str_impactproject_status.toString()); + startActivity(i); + + //progressDialog.dismiss(); + }catch(final OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + //progressDialog.dismiss(); + Toast.makeText(getApplication(),"Slow Internet or Internet Dropped"+ex.toString(), Toast.LENGTH_LONG).show(); + } + }); + } + } else { + + } + }catch(final OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + //progressDialog.dismiss(); + Toast.makeText(getApplication(),"Slow Internet or Internet Dropped"+ex.toString(), Toast.LENGTH_LONG).show(); + } + }); + } + } + }); + + btn_submitCompletion.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + //Toast.makeText(context,"You clicked on submit please wait",Toast.LENGTH_SHORT).show(); + + /* pd = new ProgressDialog(context); + pd.setMessage("Submitting please wait"); + pd.show();*/ + + + if (checkMandatory()) + { + + /*if(1>2) + {*/ + btn_submitCompletion.setVisibility(View.GONE); + btn_saveDraft.setVisibility(View.GONE); + + /* imgurlss.clear(); + imgurlss.addAll(imageAdapter.getImageList());*/ + + //Log.d("imgurlsssizeisss", String.valueOf(imageAdapter.getImageList().size())); + + /* for(String imgUrl : imgurlss) + { + Log.d("imgUrlissssss",imgUrl); + Bitmap bitmap; + BitmapFactory.Options bmOptions = new BitmapFactory.Options(); + + if(imgUrl.startsWith("content")){ + bitmap = cameraImgMap.get(imgUrl); + }else { + bitmap = BitmapFactory.decodeFile(imgUrl, bmOptions); + } + + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); + byte[] imageInByte; + imageInByte = stream.toByteArray(); +*/ + //String encodedImageString = Base64.encodeToString(imageInByte, Base64.DEFAULT); + //Log.d("encodeImageStringssssss",encodedImageString); + + /* if(!imgUrl.startsWith("content")) { + String where = MediaStore.MediaColumns.DATA + "=?"; + String[] selectionArgs = new String[]{imgUrl}; + ContentResolver contentResolver = context.getContentResolver(); + Uri filesUri = MediaStore.Files.getContentUri("external"); + + int deleted = contentResolver.delete(filesUri, where, selectionArgs); + Log.d("deltedCountcontentissss", String.valueOf(deleted)); + }else{ + ContentResolver contentResolver = context.getContentResolver(); + Uri filesUri = Uri.parse(imgUrl); + int deleted = contentResolver.delete(filesUri, null, null); + Log.d("deletedCountCameraissss", String.valueOf(deleted)); + }*/ + + //arrlstUploadedImageBitmap.add(encodedImageString); + + /* arrlstUploadImageByteArray.add(imageInByte); + }*/ + + //bitmap = Bitmap.createScaledBitmap(bitmap,parent.getWidth(),parent.getHeight(),true); + //imageView.setImageBitmap(bitmap); + + // ArrayList byteArrayImage = CompletionProjectStaticClass.getByteArrayImage(); + + //--------server img delete added by madhu 7/9/19 + /* int count= getDeleted_ImgData_count(); + if(count>0){ + getDeleted_ImgData(count); + Async_DeleteImage async_deleteImage= new Async_DeleteImage(FinalProjectCompletion_Activity.this); + async_deleteImage.execute(); + }*/ + //---------------------------------------------------- + + ArrayList byteArrayImage; + byteArrayImage = new ArrayList<>(); + + byte[] byteImage = CompletionProjectStaticClass.getBytesImage(); + + + /* if(byteArrayImage!=null){ + for(int i=0;i=4){ + totalImgCount=uploadImgs; + }else if(uploadImgs==0){ + Toast.makeText(getApplicationContext(), "Please Upload atleast 4 images", Toast.LENGTH_LONG).show(); + }/*else{ + totalImgCount = deletedCount + uploadImgs; + Log.e("tag", "totalImgCount = deletedCount + uploadImgs==" + String.valueOf(totalImgCount) + "=" + String.valueOf(deletedCount) + "+" + String.valueOf(uploadImgs)); + + }*/ + /* if(count>4) { + if (saveDraftImgCount > count) { + deletedCount = saveDraftImgCount - count; + Log.e("tag", " deletedCount =saveDraftImgCount-count==" + String.valueOf(deletedCount) + "=" + String.valueOf(saveDraftImgCount) + "-" + String.valueOf(count)); + } else { + deletedCount = count - saveDraftImgCount; + Log.e("tag", " deletedCount =count-saveDraftImgCount==" + String.valueOf(deletedCount) + "=" + String.valueOf(count) + "-" + String.valueOf(saveDraftImgCount)); + + } + } + + + + int totalImgCount = 0; + if(saveDraftImgCount>=4){ + totalImgCount = saveDraftImgCount + complitionImgCount; + Log.e("tag", "saveDraftImgCount gr8 totalImgCount = saveDraftImgCount + complitionImgCount==" + String.valueOf(totalImgCount) +"="+String.valueOf(saveDraftImgCount)+"-"+String.valueOf(complitionImgCount)); + + }else { + if(saveDraftImgCount==0&&complitionImgCount==0){ + Toast.makeText(getApplicationContext(), "Please Upload atleast 4 images", Toast.LENGTH_LONG).show(); + }else if(saveDraftImgCount==0&&complitionImgCount>=4) { + totalImgCount = saveDraftImgCount + complitionImgCount; + Log.e("tag", "complitionImgCount gr4 totalImgCount = saveDraftImgCount + complitionImgCount==" + String.valueOf(totalImgCount) + "=" + String.valueOf(saveDraftImgCount) + "-" + String.valueOf(complitionImgCount)); + }else{ + totalImgCount = deletedCount + complitionImgCount; + Log.e("tag", "totalImgCount = deletedCount + complitionImgCount==" + String.valueOf(totalImgCount) + "=" + String.valueOf(deletedCount) + "+" + String.valueOf(complitionImgCount)); + } + }*/ + Log.e("tag", "Deleted_ImgData_count=" + String.valueOf(count)); + Log.e("tag", "saveDraftImgCount=" + String.valueOf(saveDraftImgCount)); + Log.e("tag", "deletedCount=" + String.valueOf(deletedCount)); + Log.e("tag", "complitionImgCount=" + String.valueOf(complitionImgCount)); + Log.e("tag", "totalImgCount=" + String.valueOf(totalImgCount)); + + /*if(totalImgCount>4){ + getDeleted_ImgData(count); + Async_DeleteImage async_deleteImage= new Async_DeleteImage(FinalProjectCompletion_Activity.this); + async_deleteImage.execute(); + }*/ + + if (totalImgCount > 10) { + /*btn_submitCompletion.setVisibility(View.VISIBLE); + btn_saveDraft.setVisibility(View.VISIBLE);*/ + + if(str_projectstatus.equals("RequestForCompletion")) // changes by 7/9/19 + { + btn_submitCompletion.setVisibility(View.VISIBLE); + btn_saveDraft.setVisibility(View.GONE); + }else{ + btn_submitCompletion.setVisibility(View.VISIBLE); + btn_saveDraft.setVisibility(View.VISIBLE); + } + + + + + Toast.makeText(getApplicationContext(), "You can upload maximum of 10 images", Toast.LENGTH_LONG).show(); + arrlstUploadImageByteArray.clear(); + } else { + if (totalImgCount >= 4) { + if(count>0) { + getDeleted_ImgData(count); + Async_DeleteImage async_deleteImage = new Async_DeleteImage(FinalProjectCompletion_Activity.this); + async_deleteImage.execute(); + } + pd = new ProgressDialog(FinalProjectCompletion_Activity.this); + pd.setMax(100); + pd.setMessage("Loading..."); + /// pd.setTitle("ProgressDialog bar example"); + pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); + pd.setCanceledOnTouchOutside(false); + pd.show(); + + final Handler handle = new Handler() { + @Override + public void handleMessage(Message msg) { + super.handleMessage(msg); + pd.incrementProgressBy(1); + } + }; + // if (urllist.size() >= 4) { + // btn_submitCompletion.setVisibility(View.VISIBLE); + Log.d("insidesizessssss", "greater than 4"); + //Toast.makeText(getActivity(),"Inside size greater than 4",Toast.LENGTH_SHORT).show(); + //pd.dismiss(); + new Thread(new Runnable() { + @Override + public void run() { + try { + while (pd.getProgress() <= pd.getMax()) { + Thread.sleep(200); + handle.sendMessage(handle.obtainMessage()); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + }).start(); + + if (arrlstUploadImageByteArray.size() == 0) + { + if (docbyteArray != null) + { + UploadProjectDocument uploadProjectDocument = new UploadProjectDocument(getApplication()); + uploadProjectDocument.execute(); + } else + { + /*pd.setProgress(100); + if (pd.getProgress() == pd.getMax()) { + pd.dismiss(); + }*/ + SubmitForCompletion submitForCompletion = new SubmitForCompletion(getApplicationContext()); + submitForCompletion.execute(); + } + } else { + + UploadProjectImages uploadProjectImages = new UploadProjectImages(FinalProjectCompletion_Activity.this); + uploadProjectImages.execute(); + + + } + + + + /* } else { + //pd.dismiss(); + Toast.makeText(getApplicationContext(), "Please Upload atleast 4 images", Toast.LENGTH_LONG).show(); + //btn_submitCompletion.setVisibility(View.VISIBLE); + }*/ + } else { + //pd.dismiss(); + Toast.makeText(getApplicationContext(), "Please Upload atleast 4 images", Toast.LENGTH_LONG).show(); + /*btn_submitCompletion.setVisibility(View.VISIBLE); + btn_saveDraft.setVisibility(View.VISIBLE);*/ + + if(str_projectstatus.equals("RequestForCompletion")) + { + btn_submitCompletion.setVisibility(View.VISIBLE); + btn_saveDraft.setVisibility(View.GONE); + } + else{ + btn_submitCompletion.setVisibility(View.VISIBLE); + btn_saveDraft.setVisibility(View.VISIBLE); + } + + } + } + //} + + } + + } + }); + + + + + + + + + + + updatespinner(); + sdgs_sp.setVisibility(View.GONE); + sdgs_sp.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView adapterView, View view, int i, long l) + { + + } + + @Override + public void onNothingSelected(AdapterView adapterView) { + + } + }); + + + + + + + sdgs_dropdownvalue_tv.setOnClickListener(new View.OnClickListener() + { + @Override + public void onClick(View view) + { + + LayoutInflater inflater = getLayoutInflater(); + View alertLayout = inflater.inflate(R.layout.sdgs_alert_layout, null); + + + goalslist_linearlayout=(LinearLayout)alertLayout.findViewById(R.id.goalslist_linearlayout); + Button addgoals_bt = (Button) alertLayout.findViewById(R.id.addgoals_bt); + + Button cancel_goals_bt= (Button) alertLayout.findViewById(R.id.cancel_goals_bt); + //goal_1_nopoverty_cb,goal_2_zerohunger_cb,goal_3_goodhealth_cb,goal_4_quality_cb + //goal_5_gender_cb,goal_6_clean_cb,goal_7_affordable_cb,goal_8_decent_cb,goal_9_industry_cb + //goal_10_reduce_cb,goal_11_sustain_cb,goal_12_responsible_cb,goal_13_climate_cb + //goal_14_lifewater_cb,goal_15_lifeland_cb,goal_16_peace_cb,goal_17_partnerships_cb + //goal_18_none_cb + goal_1_nopoverty_cb = (CheckBox) alertLayout.findViewById(R.id.goal_1_nopoverty); + + goal_2_zerohunger_cb = (CheckBox) alertLayout.findViewById(R.id.goal_2_zerohunger); + goal_3_goodhealth_cb=(CheckBox) alertLayout.findViewById(R.id.goal_3_goodhealth); + goal_4_quality_cb=(CheckBox) alertLayout.findViewById(R.id.goal_4_quality); + goal_5_gender_cb=(CheckBox) alertLayout.findViewById(R.id.goal_5_gender); + + goal_6_clean_cb=(CheckBox) alertLayout.findViewById(R.id.goal_6_clean); + + goal_7_affordable_cb=(CheckBox) alertLayout.findViewById(R.id.goal_7_affordable); + goal_8_decent_cb=(CheckBox) alertLayout.findViewById(R.id.goal_8_decent); + goal_9_industry_cb=(CheckBox) alertLayout.findViewById(R.id.goal_9_industry); + goal_10_reduce_cb=(CheckBox) alertLayout.findViewById(R.id.goal_10_reduce); + goal_11_sustain_cb=(CheckBox) alertLayout.findViewById(R.id.goal_11_sustain); + goal_12_responsible_cb=(CheckBox) alertLayout.findViewById(R.id.goal_12_responsible); + goal_13_climate_cb =(CheckBox) alertLayout.findViewById(R.id.goal_13_climate); + goal_14_lifewater_cb=(CheckBox) alertLayout.findViewById(R.id.goal_14_lifewater); + goal_15_lifeland_cb=(CheckBox) alertLayout.findViewById(R.id.goal_15_lifeland); + goal_16_peace_cb=(CheckBox) alertLayout.findViewById(R.id.goal_16_peace); + goal_17_partnerships_cb=(CheckBox) alertLayout.findViewById(R.id.goal_17_partnerships); + goal_18_none_cb=(CheckBox) alertLayout.findViewById(R.id.goal_18_none); + + + + + + AlertDialog.Builder alert = new AlertDialog.Builder(FinalProjectCompletion_Activity.this); + // this is set the view from XML inside AlertDialog + alert.setView(alertLayout); + // disallow cancel of AlertDialog on click of back button and outside touch + alert.setCancelable(false); + + dialog = alert.create(); + + + // vijay goals + + + // for none count is zero + if(sdgs_display_tv.getText().toString().trim().length()>0) + { + check_box_enable2(); + }else + { + } + + + goal_18_none_cb.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) + { + if(goal_18_none_cb.isChecked()) + { + + + goal_1_nopoverty_cb.setChecked(false); + goal_2_zerohunger_cb.setChecked(false); + goal_3_goodhealth_cb.setChecked(false); + goal_4_quality_cb.setChecked(false); + goal_5_gender_cb.setChecked(false); + goal_6_clean_cb.setChecked(false); + goal_7_affordable_cb.setChecked(false); + goal_8_decent_cb.setChecked(false); + goal_9_industry_cb.setChecked(false); + goal_10_reduce_cb.setChecked(false); + goal_11_sustain_cb.setChecked(false); + goal_12_responsible_cb.setChecked(false); + goal_13_climate_cb.setChecked(false); + goal_14_lifewater_cb.setChecked(false); + goal_15_lifeland_cb.setChecked(false); + goal_16_peace_cb.setChecked(false); + goal_17_partnerships_cb.setChecked(false); + + goal_1_nopoverty_cb.setEnabled(false); + goal_2_zerohunger_cb.setEnabled(false); + goal_3_goodhealth_cb.setEnabled(false); + goal_4_quality_cb.setEnabled(false); + goal_5_gender_cb.setEnabled(false); + goal_6_clean_cb.setEnabled(false); + goal_7_affordable_cb.setEnabled(false); + goal_8_decent_cb.setEnabled(false); + goal_9_industry_cb.setEnabled(false); + goal_10_reduce_cb.setEnabled(false); + goal_11_sustain_cb.setEnabled(false); + goal_12_responsible_cb.setEnabled(false); + goal_13_climate_cb.setEnabled(false); + goal_14_lifewater_cb.setEnabled(false); + goal_15_lifeland_cb.setEnabled(false); + goal_16_peace_cb.setEnabled(false); + goal_17_partnerships_cb.setEnabled(false); + //goalslist_linearlayout.setVisibility(View.INVISIBLE); + + }else + { + + goal_1_nopoverty_cb.setEnabled(true); + goal_2_zerohunger_cb.setEnabled(true); + goal_3_goodhealth_cb.setEnabled(true); + goal_4_quality_cb.setEnabled(true); + goal_5_gender_cb.setEnabled(true); + goal_6_clean_cb.setEnabled(true); + goal_7_affordable_cb.setEnabled(true); + goal_8_decent_cb.setEnabled(true); + goal_9_industry_cb.setEnabled(true); + goal_10_reduce_cb.setEnabled(true); + goal_11_sustain_cb.setEnabled(true); + goal_12_responsible_cb.setEnabled(true); + goal_13_climate_cb.setEnabled(true); + goal_14_lifewater_cb.setEnabled(true); + goal_15_lifeland_cb.setEnabled(true); + goal_16_peace_cb.setEnabled(true); + goal_17_partnerships_cb.setEnabled(true); + + //goalslist_linearlayout.setVisibility(View.VISIBLE); + + } + + } + }); + + + + + + + addgoals_bt.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) + { + // Toast.makeText(context, "Request Has Been Sent", Toast.LENGTH_LONG).show(); + //if(validation_forgoals()) + + + // goal_1_nopoverty_cb,goal_2_zerohunger_cb,goal_3_goodhealth_cb,goal_4_quality_cb + //goal_5_gender_cb,goal_6_clean_cb,goal_7_affordable_cb,goal_8_decent_cb,goal_9_industry_cb + //goal_10_reduce_cb,goal_11_sustain_cb,goal_12_responsible_cb,goal_13_climate_cb + //goal_14_lifewater_cb,goal_15_lifeland_cb,goal_16_peace_cb,goal_17_partnerships_cb + //goal_18_none_cb + + + +//last end goals + if(goal_1_nopoverty_cb.isChecked()||goal_2_zerohunger_cb.isChecked()||goal_3_goodhealth_cb.isChecked() + ||goal_4_quality_cb.isChecked()||goal_5_gender_cb.isChecked()||goal_6_clean_cb.isChecked() + ||goal_7_affordable_cb.isChecked()||goal_8_decent_cb.isChecked()||goal_9_industry_cb.isChecked() + ||goal_10_reduce_cb.isChecked()||goal_11_sustain_cb.isChecked()||goal_12_responsible_cb.isChecked() + ||goal_13_climate_cb.isChecked()||goal_14_lifewater_cb.isChecked()||goal_15_lifeland_cb.isChecked()|| + goal_16_peace_cb.isChecked()||goal_17_partnerships_cb.isChecked()||goal_18_none_cb.isChecked()) + { + str_alertshowhide="yes"; + check_box_selected(); + } + else + { + + str_alertshowhide="no"; + Toast.makeText(getApplicationContext(),"Select atleast one option",Toast.LENGTH_SHORT).show(); + } + + + + /*EditProfileActivity.SubmitQuery submitQuery = new EditProfileActivity.SubmitQuery(context); + submitQuery.execute();*/ + + if(str_alertshowhide.equals("no")) + { + + } + else + { + + + dialog.dismiss(); + } + + + } + }); + + cancel_goals_bt.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) + { + + goals_jsonobject = new JSONObject(); + try { + goals_jsonobject.put("", ""); + } catch (JSONException e) { + e.printStackTrace(); + } + + sdgs_display_tv.setText(""); + + dialog.dismiss(); + } + }); + + + dialog.show(); + + + } + }); + + + + + impactproject_collabaration_cb.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) + { + if(impactproject_collabaration_cb.isChecked()) + { + impactproject_collabaration_et.setVisibility(View.VISIBLE); + str_validation_collabaration="yes"; + }else{ + impactproject_collabaration_et.setVisibility(View.GONE); + impactproject_collabaration_et.setText(""); + str_validation_collabaration="no"; + } + + } + }); + + + + + impactproject_againtstide_cb.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) + { + if(impactproject_againtstide_cb.isChecked()) + { + impactproject_againtstide_et.setVisibility(View.VISIBLE); + str_validation_againtstide="yes"; + }else{ + impactproject_againtstide_et.setVisibility(View.GONE); + impactproject_againtstide_et.setText(""); + str_validation_againtstide="no"; + } + + } + }); + + + + + + impactproject_crosshurdles_cb.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) + { + if(impactproject_crosshurdles_cb.isChecked()) + { + impactproject_crosshurdles_et.setVisibility(View.VISIBLE); + str_validation_crosshurdles="yes"; + }else{ + impactproject_crosshurdles_et.setVisibility(View.GONE); + impactproject_crosshurdles_et.setText(""); + str_validation_crosshurdles="no"; + } + + } + }); + + + + impactproject_venture_cb.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) + { + if(impactproject_venture_cb.isChecked()) + { + impactproject_venture_et.setVisibility(View.VISIBLE); + str_validation_venture="yes"; + }else{ + impactproject_venture_et.setVisibility(View.GONE); + impactproject_venture_et.setText(""); + str_validation_venture="no"; + } + + } + }); + + + + + + + impactproject_governaward_cb.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) + { + if(impactproject_governaward_cb.isChecked()) + { + + impactproject_governaward_et.setVisibility(View.VISIBLE); + str_validation_governaward="yes"; + }else{ + impactproject_governaward_et.setVisibility(View.GONE); + impactproject_governaward_et.setText(""); + str_validation_governaward="no"; + } + + } + }); + + + + + impactproject_leadershiprole_cb.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) + { + if(impactproject_leadershiprole_cb.isChecked()) + { + impactproject_leadershiprole_et.setVisibility(View.VISIBLE); + str_validation_leadershiprole="yes"; + }else{ + impactproject_leadershiprole_et.setVisibility(View.GONE); + impactproject_leadershiprole_et.setText(""); + str_validation_leadershiprole="no"; + } + + } + }); + + + + permissionactivities_et.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + + } + + @Override + public void afterTextChanged(Editable s) { + // permissionactivities_wordscount_tv.setText(80 - s.toString().length() + "/80"); + permissionactivities_wordscount_tv.setText("Min 100 Words: "+(100 - s.toString().trim().length()) + "/100"); + //Min 100 Words + + } + }); + + + + + + + }// end of oncreate(); + + @Override + protected void onResume() { + super.onResume(); + + // register connection status listener + MyApplication.getInstance().setConnectivityListener(this); + } + + @Override + public void onNetworkConnectionChanged(boolean isConnected) { + showSnack(isConnected); + } + + private void showSnack(boolean isConnected) { + + if (!isConnected) { + + AlertDialog.Builder adb = new AlertDialog.Builder(FinalProjectCompletion_Activity.this); + //adb.setView(alertDialogView); + + adb.setTitle("Sorry! Not connected to the internet"); + + adb.setIcon(android.R.drawable.ic_dialog_alert); + + adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + + adb.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + adb.setCancelable(true); + adb.show(); + } + } + + + // start of from date + @SuppressLint("ValidFragment") + public static class DatePickerFragmentFromDate extends DialogFragment + implements DatePickerDialog.OnDateSetListener{ + + @Override + public Dialog onCreateDialog(Bundle savedInstanceState) { + final Calendar c = Calendar.getInstance(); + int year = c.get(Calendar.YEAR); + int month = c.get(Calendar.MONTH); + int day = c.get(Calendar.DAY_OF_MONTH); + + + + DatePickerDialog dialog = new DatePickerDialog(getActivity(), + this, year, month, day); + + + /* dialog.getDatePicker().setMinDate(c.getTimeInMillis()); + dialog.getDatePicker().setMaxDate(c.getTimeInMillis()); +*/ + + /* dialog.getDatePicker().setMinDate(c.getTimeInMillis()); + c.add(Calendar.DAY_OF_MONTH,150); + dialog.getDatePicker().setMaxDate(c.getTimeInMillis()); +*/ + return dialog; + + + } + public void onDateSet(DatePicker view, int year, int month, int day) { + Calendar cal = new GregorianCalendar(year, month, day); + setDate(cal); + } + + public void setDate(final Calendar calendar) { + final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM); + //((TextView) findViewById(R.id.showDate)).setText(dateFormat.format(calendar.getTime())); + + + + + // SimpleDateFormat mdyFormat = new SimpleDateFormat("MM/dd/yyyy");//2017-06-22 + + SimpleDateFormat mdyFormat = new SimpleDateFormat("yyyy-MM-dd"); + yyyyMMdd_studentcomp_startdate = mdyFormat.format(calendar.getTime()); + + + studentcomp_clickstartprojectdate_tv.setText(mdyFormat.format(calendar.getTime())); + // System.out.println("From date:"+ yyyyMMdd_fromdate); + } + + } + + + + + + public static class DatePickerFragmentEndDate extends DialogFragment + implements DatePickerDialog.OnDateSetListener{ + + @Override + public Dialog onCreateDialog(Bundle savedInstanceState) { + final Calendar c = Calendar.getInstance(); + int year = c.get(Calendar.YEAR); + int month = c.get(Calendar.MONTH); + int day = c.get(Calendar.DAY_OF_MONTH); + + + DatePickerDialog dialog = new DatePickerDialog(getActivity(), + this, year, month, day); + + // dialog.getDatePicker().setMaxDate(c.getTimeInMillis()); // this will set maximum date validation + //dialog.getDatePicker().setMinDate(System.currentTimeMillis() - 1000); + //dialog.getDatePicker().setMaxDate(c.getTimeInMillis()); + + // dialog.getDatePicker().setMaxDate(c.getTimeInMillis()+((1000*60*60*24*90)));//Error:fromDate: Sun Jun 18 12:50:44 GMT+05:30 2017 does not precede toDate: Fri Jun 09 02:45:11 GMT+05:30 2017 + + + /* dialog.getDatePicker().setMinDate(c.getTimeInMillis()); + c.add(Calendar.DAY_OF_MONTH,150); + dialog.getDatePicker().setMaxDate(c.getTimeInMillis());*/ + + return dialog; + + + } + public void onDateSet(DatePicker view, int year, int month, int day) { + Calendar cal = new GregorianCalendar(year, month, day); + setDate(cal); + } + + public void setDate(final Calendar calendar) { + final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM); + //((TextView) findViewById(R.id.showDate)).setText(dateFormat.format(calendar.getTime())); + + + + SimpleDateFormat mdyFormat = new SimpleDateFormat("yyyy-MM-dd"); //2017-06-22 + + yyyyMMdd_studentcomp_enddate = mdyFormat.format(calendar.getTime()); + + + studentcomp_clickendprojectdate_tv.setText(mdyFormat.format(calendar.getTime())); + + // System.out.println("To Date:"+ yyyyMMdd_todate); + + /*int days_count = Days.daysBetween(new LocalDate(yyyyMMdd_pmstartdate), new LocalDate(yyyyMMdd_pmenddate)).getDays(); + int int_days=days_count+1; + System.out.println ("Days: "+int_days); + + if((int_days<=6)) + { + } + else{ + //alerts_dialog_fortodate(); + } +*/ + + + } + + } + + +//----------------------------date------------------------------------ + + + + + + //----------------------------------Delete image in sarver added by madhu 7/9/19------------------------ + //for server image, delete image list + public int getDeleted_ImgData_count() { + + db1 = this.openOrCreateDatabase("Leaddb", Context.MODE_PRIVATE, null); + db1.execSQL("CREATE TABLE IF NOT EXISTS AllImageList(img BLOB NOT NULL,documentlist_path VARCHAR,documentlist_slno VARCHAR,position VARCHAR);"); + + cursor1 = db1.rawQuery("SELECT * FROM AllImageList", null); + // db1.close(); + int x = cursor1.getCount(); + Log.d("tag","cursor count delete img="+ Integer.toString(x)); + return x; + + } + public void getDeleted_ImgData(int x){ + int i=0; + Delete_doclist_slno.clear(); + Delete_doclist_path.clear(); + if(x>0) { + if (cursor1.moveToFirst()) { + do { + + Delete_doclist_path.add(cursor1.getString(cursor1.getColumnIndex("documentlist_path"))); + Delete_doclist_slno.add(cursor1.getString(cursor1.getColumnIndex("documentlist_slno"))); + + } while (cursor1.moveToNext()); + }//if ends + + } + + db1.close(); + + } + public void Delete_AllImglistTable_B4Insertion() { + + SQLiteDatabase db6 = openOrCreateDatabase("Leaddb", Context.MODE_PRIVATE, null); + + db6.execSQL("CREATE TABLE IF NOT EXISTS AllImageList(img BLOB NOT NULL,documentlist_path VARCHAR,documentlist_slno VARCHAR,position VARCHAR);"); + Cursor cursor1 = db6.rawQuery("SELECT * FROM AllImageList", null); + int x = cursor1.getCount(); + if (x > 0) { + db6.delete("AllImageList", null, null); + } + db6.close(); + } + //------------------------------------------------------------------------------------------------ + + + + + + + + + + + + + + + +//database for image + public void deleteimage_byposition(ArrayList mImageInByte) + { + + SQLiteDatabase db1 = this.openOrCreateDatabase("Leaddb", Context.MODE_PRIVATE, null); + db1.execSQL("CREATE TABLE IF NOT EXISTS ImageDeletedlist(PID VARCHAR);"); + + Cursor cursor1 = db1.rawQuery("SELECT * FROM ImageDeletedlist", null); + int x = cursor1.getCount(); + Log.d("cursor count", Integer.toString(x)); + + int i=0; + + if(x>0) + { + try { + if (cursor1.moveToFirst()) { + do { + + i = Integer.parseInt(cursor1.getString(cursor1.getColumnIndex("PID"))); + mImageInByte.remove(i); + + } while (cursor1.moveToNext()); + }//if ends + + } + catch(Exception ex) + { + db1.close(); + } + + } + + db1.close(); + + } + + + public void deletestatelistTable_B4insertion() { + + SQLiteDatabase db6 = openOrCreateDatabase("Leaddb", Context.MODE_PRIVATE, null); + + db6.execSQL("CREATE TABLE IF NOT EXISTS ImageDeletedlist(PID VARCHAR);"); + Cursor cursor1 = db6.rawQuery("SELECT * FROM ImageDeletedlist", null); + int x = cursor1.getCount(); + if (x > 0) { + db6.delete("ImageDeletedlist", null, null); + } + db6.close(); + } + + +//database for image + + + + + private boolean checkSaveDraftFields() + { + + String str_challanges = challanges_fpc_et.getText().toString(); + String str_learning = learning_fpc_et.getText().toString(); + String str_story = story_fpc_et.getText().toString(); + String str_place = placeofimpl_fpc_et.getText().toString(); + String str_fundRaised = edt_fundRaised.getText().toString(); + String str_Resource = resourcesUtilised_fpc_et.getText().toString(); + String str_hoursspent = edt_hoursspent.getText().toString(); + String str_resource_amount= resourcesUtilised_amount_fpc_et.getText().toString(); + + if(str_place.isEmpty() && str_challanges.isEmpty() && str_learning.isEmpty() && str_story.isEmpty() && str_fundRaised.isEmpty() &&str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 0; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + + if(!str_place.isEmpty() && !str_challanges.isEmpty() && !str_learning.isEmpty() && !str_story.isEmpty() && !str_fundRaised.isEmpty() &&!str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 60; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + + if(!str_place.isEmpty() && str_challanges.isEmpty() && str_learning.isEmpty() && str_story.isEmpty() && str_fundRaised.isEmpty() && str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 10; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(str_place.isEmpty() && !str_challanges.isEmpty() && str_learning.isEmpty() && str_story.isEmpty() && str_fundRaised.isEmpty() && str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 10; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(str_place.isEmpty() && str_challanges.isEmpty() && !str_learning.isEmpty() && str_story.isEmpty() && str_fundRaised.isEmpty() && str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 10; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(str_place.isEmpty() && str_challanges.isEmpty() && str_learning.isEmpty() && !str_story.isEmpty() && str_fundRaised.isEmpty() && str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 10; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(str_place.isEmpty() && str_challanges.isEmpty() && str_learning.isEmpty() && str_story.isEmpty() && !str_fundRaised.isEmpty() && str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 10; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(str_place.isEmpty() && str_challanges.isEmpty() && str_learning.isEmpty() && str_story.isEmpty() && str_fundRaised.isEmpty() && !str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 10; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + + if(!str_place.isEmpty() && !str_challanges.isEmpty() && str_learning.isEmpty() && str_story.isEmpty() && str_fundRaised.isEmpty() && str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 20; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(!str_place.isEmpty() && str_challanges.isEmpty() && !str_learning.isEmpty() && str_story.isEmpty() && str_fundRaised.isEmpty() && str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 20; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(!str_place.isEmpty() && str_challanges.isEmpty() && str_learning.isEmpty() && !str_story.isEmpty() && str_fundRaised.isEmpty() && str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 20; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(!str_place.isEmpty() && str_challanges.isEmpty() && str_learning.isEmpty() && str_story.isEmpty() && !str_fundRaised.isEmpty() && str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 20; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(!str_place.isEmpty() && str_challanges.isEmpty() && str_learning.isEmpty() && str_story.isEmpty() && str_fundRaised.isEmpty() && !str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 20; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(str_place.isEmpty() && !str_challanges.isEmpty() && !str_learning.isEmpty() && str_story.isEmpty() && str_fundRaised.isEmpty() && str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 20; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(str_place.isEmpty() && !str_challanges.isEmpty() && str_learning.isEmpty() && !str_story.isEmpty() && str_fundRaised.isEmpty() && str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 20; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(str_place.isEmpty() && !str_challanges.isEmpty() && str_learning.isEmpty() && str_story.isEmpty() && !str_fundRaised.isEmpty() && str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 20; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(str_place.isEmpty() && !str_challanges.isEmpty() && str_learning.isEmpty() && str_story.isEmpty() && str_fundRaised.isEmpty() && !str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 20; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(str_place.isEmpty() && str_challanges.isEmpty() && !str_learning.isEmpty() && !str_story.isEmpty() && str_fundRaised.isEmpty() && str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 20; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(str_place.isEmpty() && str_challanges.isEmpty() && str_learning.isEmpty() && !str_story.isEmpty() && !str_fundRaised.isEmpty() && str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 20; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(str_place.isEmpty() && str_challanges.isEmpty() && str_learning.isEmpty() && !str_story.isEmpty() && str_fundRaised.isEmpty() && !str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 20; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(str_place.isEmpty() && str_challanges.isEmpty() && str_learning.isEmpty() && str_story.isEmpty() && !str_fundRaised.isEmpty() && !str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 20; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + + if(!str_place.isEmpty() && !str_challanges.isEmpty() && !str_learning.isEmpty() && str_story.isEmpty() && str_fundRaised.isEmpty() && str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 30; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(!str_place.isEmpty() && !str_challanges.isEmpty() && str_learning.isEmpty() && !str_story.isEmpty() && str_fundRaised.isEmpty() && str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 30; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(!str_place.isEmpty() && !str_challanges.isEmpty() && str_learning.isEmpty() && str_story.isEmpty() && !str_fundRaised.isEmpty() && str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 30; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(!str_place.isEmpty() && !str_challanges.isEmpty() && str_learning.isEmpty() && str_story.isEmpty() && str_fundRaised.isEmpty() && !str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 30; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(!str_place.isEmpty() && str_challanges.isEmpty() && !str_learning.isEmpty() && !str_story.isEmpty() && str_fundRaised.isEmpty() && str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 30; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(!str_place.isEmpty() && str_challanges.isEmpty() && !str_learning.isEmpty() && str_story.isEmpty() && !str_fundRaised.isEmpty() && str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 30; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(!str_place.isEmpty() && str_challanges.isEmpty() && !str_learning.isEmpty() && str_story.isEmpty() && str_fundRaised.isEmpty() && !str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 30; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(str_place.isEmpty() && !str_challanges.isEmpty() && !str_learning.isEmpty() && !str_story.isEmpty() && str_fundRaised.isEmpty() && str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 30; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(str_place.isEmpty() && !str_challanges.isEmpty() && !str_learning.isEmpty() && str_story.isEmpty() && !str_fundRaised.isEmpty() && str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 30; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(str_place.isEmpty() && !str_challanges.isEmpty() && !str_learning.isEmpty() && str_story.isEmpty() && str_fundRaised.isEmpty() && !str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 30; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(str_place.isEmpty() && str_challanges.isEmpty() && !str_learning.isEmpty() && !str_story.isEmpty() && !str_fundRaised.isEmpty() && str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 30; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(str_place.isEmpty() && str_challanges.isEmpty() && !str_learning.isEmpty() && str_story.isEmpty() && !str_fundRaised.isEmpty() && !str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 30; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(str_place.isEmpty() && str_challanges.isEmpty() && str_learning.isEmpty() && !str_story.isEmpty() && !str_fundRaised.isEmpty() && !str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 30; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(!str_place.isEmpty() && !str_challanges.isEmpty() && !str_learning.isEmpty() && !str_story.isEmpty() && str_fundRaised.isEmpty() && str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 40; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(!str_place.isEmpty() && !str_challanges.isEmpty() && !str_learning.isEmpty() && str_story.isEmpty() && !str_fundRaised.isEmpty() && str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 40; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(!str_place.isEmpty() && !str_challanges.isEmpty() && !str_learning.isEmpty() && str_story.isEmpty() && str_fundRaised.isEmpty() && !str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 40; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(!str_place.isEmpty() && !str_challanges.isEmpty() && str_learning.isEmpty() && !str_story.isEmpty() && !str_fundRaised.isEmpty() && str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 40; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(!str_place.isEmpty() && !str_challanges.isEmpty() && str_learning.isEmpty() && str_story.isEmpty() && !str_fundRaised.isEmpty() && !str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 40; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(!str_place.isEmpty() && str_challanges.isEmpty() && !str_learning.isEmpty() && !str_story.isEmpty() && str_fundRaised.isEmpty() && !str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 40; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(str_place.isEmpty() && !str_challanges.isEmpty() && !str_learning.isEmpty() && !str_story.isEmpty() && str_fundRaised.isEmpty() && !str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 40; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(str_place.isEmpty() && str_challanges.isEmpty() && !str_learning.isEmpty() && str_story.isEmpty() && !str_fundRaised.isEmpty() && !str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 40; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(str_place.isEmpty() && !str_challanges.isEmpty() && !str_learning.isEmpty() && !str_story.isEmpty() && !str_fundRaised.isEmpty() && str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 40; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(!str_place.isEmpty() && !str_challanges.isEmpty() && !str_learning.isEmpty() && !str_story.isEmpty() && !str_fundRaised.isEmpty() && str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 50; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(!str_place.isEmpty() && !str_challanges.isEmpty() && !str_learning.isEmpty() && !str_story.isEmpty() && str_fundRaised.isEmpty() && !str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 50; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(!str_place.isEmpty() && !str_challanges.isEmpty() && !str_learning.isEmpty() && str_story.isEmpty() && !str_fundRaised.isEmpty() && !str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 50; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(!str_place.isEmpty() && !str_challanges.isEmpty() && str_learning.isEmpty() && !str_story.isEmpty() && !str_fundRaised.isEmpty() && !str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 50; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(!str_place.isEmpty() && str_challanges.isEmpty() && !str_learning.isEmpty() && !str_story.isEmpty() && !str_fundRaised.isEmpty() && !str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 50; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + if(str_place.isEmpty() && !str_challanges.isEmpty() && !str_learning.isEmpty() && !str_story.isEmpty() && !str_fundRaised.isEmpty() && !str_Resource.isEmpty()){ + //pd.dismiss(); + CompletionProgress = 50; + Log.e("tag","CompletionProgress="+CompletionProgress); + } + return true; + } + private boolean checkMandatory() { + + String str_challanges = challanges_fpc_et.getText().toString().trim(); + String str_learning = learning_fpc_et.getText().toString(); + String str_story = story_fpc_et.getText().toString(); + String str_place = placeofimpl_fpc_et.getText().toString(); + String str_hoursSpent = edt_hoursspent.getText().toString().trim(); + String str_sdgs_validation=sdgs_display_tv.getText().toString().trim(); + String str_resource_amount=resourcesUtilised_amount_fpc_et.getText().toString().trim(); + String str_resouce_utilized=resourcesUtilised_fpc_et.getText().toString().trim(); + + + if(str_place.isEmpty()) + { + //pd.dismiss(); + placeofimpl_fpc_et.setError("Enter the place of implementation"); + placeofimpl_fpc_et.requestFocus(); + return false; + } + + if(str_challanges.isEmpty()){ + //pd.dismiss(); + challanges_fpc_et.setError("Enter the challenges"); + challanges_fpc_et.requestFocus(); + return false; + } + + if(str_challanges.length()<9){ + + challanges_fpc_et.setError("Minimum 10 characters"); + challanges_fpc_et.requestFocus(); + return false; + } + + if(str_learning.isEmpty()){ + //pd.dismiss(); + learning_fpc_et.setError("Enter the learnings"); + learning_fpc_et.requestFocus(); + return false; + } + if(str_learning.length()<20){ + learning_fpc_et.setError("Minimum 20 characters"); + learning_fpc_et.requestFocus(); + return false; + } + + if(str_story.isEmpty()){ + + story_fpc_et.setError("Enter the story"); + story_fpc_et.requestFocus(); + return false; + } + + + + if(resourcesUtilised_fpc_et.getText().toString().trim().length()==0) + { + resourcesUtilised_fpc_et.setError("minimum 5 character"); + resourcesUtilised_fpc_et.requestFocus(); + return false; + } + + + + if(str_resource_amount.isEmpty()){ + + resourcesUtilised_amount_fpc_et.setError("Enter the Amount"); + resourcesUtilised_amount_fpc_et.requestFocus(); + return false; + } + + if(resourcesUtilised_amount_fpc_et.getText().toString().trim().length()==0){ + + resourcesUtilised_amount_fpc_et.setError("Enter the Amount"); + resourcesUtilised_amount_fpc_et.requestFocus(); + return false; + } + + /* if(str_resource_amount.equalsIgnoreCase("0")) + { + resourcesUtilised_amount_fpc_et.setError("Enter the Amount"); + resourcesUtilised_amount_fpc_et.requestFocus(); + return false; + }*/ + + + if(str_hoursSpent.isEmpty()){ + + edt_hoursspent.setError("Enter the SpentHours"); + edt_hoursspent.requestFocus(); + return false; + } + + + if(edt_hoursspent.getText().toString().trim().length()==0){ + + edt_hoursspent.setError("Enter the SpentHours"); + edt_hoursspent.requestFocus(); + return false; + } + + + + + if(str_hoursSpent.equalsIgnoreCase("0")) + { + edt_hoursspent.setError("Enter the SpentHours"); + edt_hoursspent.requestFocus(); + return false; + } + + + if(sdgs_display_tv.getText().toString().trim().length()==0) + { + sdgs_display_tv.setError("Select the goals"); + Toast.makeText(getApplicationContext(),"Select the goals",Toast.LENGTH_SHORT).show(); + sdgs_display_tv.requestFocus(); + return false; + } + + + + + if(str_impactproject_status.equals("1")) + { + + + if(str_validation_collabaration.equalsIgnoreCase("yes")) + { + + if(impactproject_collabaration_et.getText().toString().trim().length()==0) + { + impactproject_collabaration_et.setError("Enter collabaration"); + impactproject_collabaration_et.requestFocus(); + return false; + } + if(impactproject_collabaration_et.getText().toString().trim().length()<19) + { + impactproject_collabaration_et.setError("Minimum 20 character"); + impactproject_collabaration_et.requestFocus(); + return false; + } + } + + + + if(str_validation_againtstide.equalsIgnoreCase("yes")) + { + if(impactproject_againtstide_et.getText().toString().trim().length()==0) + { + impactproject_againtstide_et.setError("Empty not allowed"); + impactproject_againtstide_et.requestFocus(); + return false; + } + if(impactproject_againtstide_et.getText().toString().trim().length()<19) + { + impactproject_againtstide_et.setError("Minimum 20 character"); + impactproject_againtstide_et.requestFocus(); + return false; + } + } + + + if(str_validation_crosshurdles.equalsIgnoreCase("yes")) + { + if(impactproject_crosshurdles_et.getText().toString().trim().length()==0) + { + impactproject_crosshurdles_et.setError("Empty not allowed"); + impactproject_crosshurdles_et.requestFocus(); + return false; + } + if(impactproject_crosshurdles_et.getText().toString().trim().length()<19) + { + impactproject_crosshurdles_et.setError("Minimum 20 character"); + impactproject_crosshurdles_et.requestFocus(); + return false; + } + } + + + if(str_validation_venture.equalsIgnoreCase("yes")) + { + if(impactproject_venture_et.getText().toString().trim().length()==0) + { + impactproject_venture_et.setError("Empty not allowed"); + impactproject_venture_et.requestFocus(); + return false; + } + if(impactproject_venture_et.getText().toString().trim().length()<19) + { + impactproject_venture_et.setError("Minimum 20 character"); + impactproject_venture_et.requestFocus(); + return false; + } + } + + + if(str_validation_governaward.equalsIgnoreCase("yes")) + { + if(impactproject_governaward_et.getText().toString().trim().length()==0) + { + impactproject_governaward_et.setError("Empty not allowed"); + impactproject_governaward_et.requestFocus(); + return false; + } + if(impactproject_governaward_et.getText().toString().trim().length()<19) + { + impactproject_governaward_et.setError("Minimum 20 character"); + impactproject_governaward_et.requestFocus(); + return false; + } + } + + + + + if(str_validation_leadershiprole.equalsIgnoreCase("yes")) + { + if(impactproject_leadershiprole_et.getText().toString().trim().length()==0) + { + impactproject_leadershiprole_et.setError("Empty not allowed"); + impactproject_leadershiprole_et.requestFocus(); + return false; + } + if(impactproject_leadershiprole_et.getText().toString().trim().length()<19) + { + impactproject_leadershiprole_et.setError("Minimum 20 character"); + impactproject_leadershiprole_et.requestFocus(); + return false; + } + } + + + + if(permissionactivities_et.getText().toString().trim().length()==0) + { + permissionactivities_et.setError("Empty not allowed"); + permissionactivities_et.requestFocus(); + return false; + } + if(permissionactivities_et.getText().toString().trim().length()<100) + { + permissionactivities_et.setError("Minimum 100 character"); + permissionactivities_et.requestFocus(); + return false; + } + + + + if(exp_initiative_et.getText().toString().trim().length()==0) + { + exp_initiative_et.setError("Empty not allowed"); + exp_initiative_et.requestFocus(); + return false; + } + if(exp_initiative_et.getText().toString().trim().length()<19) + { + exp_initiative_et.setError("Minimum 20 character"); + exp_initiative_et.requestFocus(); + return false; + } + + + if(lacking_initiative_et.getText().toString().trim().length()==0) + { + lacking_initiative_et.setError("Empty not allowed"); + lacking_initiative_et.requestFocus(); + return false; + } + if(lacking_initiative_et.getText().toString().trim().length()<19) + { + lacking_initiative_et.setError("Minimum 20 character"); + lacking_initiative_et.requestFocus(); + return false; + } + + } + + + if(str_story.length()<100){ + story_fpc_et.setError("Minimum 100 characters"); + story_fpc_et.requestFocus(); + return false; + } + else{ + return true; + } + + + } + + public class UploadProjectImages_SaveDraft extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + /*private ProgressBar progressBar;*/ + + UploadProjectImages_SaveDraft (FinalProjectCompletion_Activity activity) + { + context = activity; + /* pd = new ProgressDialog(activity); + // pd = new ProgressDialog(getApplication()); + pd.setMessage("Submitting your request please wait. If you press back button your request will be uploaded in the backend"); + pd.setCanceledOnTouchOutside(false); + pd.show();*/ + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + SoapPrimitive response =null; + + /* for(int k=0;k " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getApplicationContext(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + //getActivity().finish(); + } + } + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getApplicationContext(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getApplicationContext(),"Web Service Error", Toast.LENGTH_LONG).show(); + + } + }); + /* getActivity().finish();*/ + } + return null; + } + + public class LoadDocument extends AsyncTask { + // private ProgressDialog progressDialog; + private Context context; + + private ProgressBar progressBar; + + private String downloadFileName = ""; + private static final String TAG = "Download Task"; + File apkStorage = null; + + + + LoadDocument (Context context){ + this.context = context; + // progressDialog = new ProgressDialog(context); + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); +// progressDialog=new ProgressDialog(context); + + /* progressDialog.setMessage("Downloading..."); + progressDialog.show();*/ + + /* progressDialog.setMessage("Loading"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show();*/ + } + + @Override + protected Void doInBackground(Void... params) { + /* ArrayList bitmapLst=null; + Bitmap bitmaplogo=null; + try { + Log.d("Urlssssssssssss",url.toString()); + bitmaplogo = BitmapFactory.decodeStream(url.openStream()); + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + }*/ + + HttpURLConnection c = null;//Open Url Connection + try { + c = (HttpURLConnection) downloadUrl.openConnection(); + } catch (IOException e) { + e.printStackTrace(); + } + try { + c.setRequestMethod("GET");//Set Request Method to "GET" since we are grtting data + } catch (ProtocolException e) { + e.printStackTrace(); + } + try { + c.connect();//connect the URL Connection + } catch (IOException e) { + e.printStackTrace(); + } + + //If Connection response is not OK then show Logs + try { + if (c.getResponseCode() != HttpURLConnection.HTTP_OK) { + Log.e(TAG, "Server returned HTTP " + c.getResponseCode() + + " " + c.getResponseMessage()); + + } + } catch (IOException e) { + e.printStackTrace(); + } + + + //Get File if SD card is present + if (new CheckForSDCard().isSDCardPresent()) { + + apkStorage = new File( + Environment.getExternalStorageDirectory() + "/" + + "ProjectDocumentFiles"); + } else + Toast.makeText(context, "Oops!! There is no SD Card.", Toast.LENGTH_SHORT).show(); + + //If File is not present create directory + if (!apkStorage.exists()) { + apkStorage.mkdir(); + Log.e(TAG, "Directory Created."); + } + + docName = docName.replace("%20",""); + outputFile = new File(apkStorage, docName);//Create Output file in Main File + + //Create New File if not present + if (!outputFile.exists()) { + try { + outputFile.createNewFile(); + } catch (IOException e) { + e.printStackTrace(); + } + Log.e(TAG, "File Created"); + } + + FileOutputStream fos = null;//Get OutputStream for NewFile Location + try { + fos = new FileOutputStream(outputFile); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + + InputStream is = null;//Get InputStream for connection + try { + is = c.getInputStream(); + } catch (IOException e) { + e.printStackTrace(); + } + + byte[] buffer = new byte[1024];//Set buffer type + int len1 = 0;//init length + try { + while ((len1 = is.read(buffer)) != -1) { + fos.write(buffer, 0, len1);//Write new file + } + } catch (IOException e) { + e.printStackTrace(); + } + + //Close all connection after doing task + try { + fos.close(); + + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + + + + return null; + + //return bitmaplogo; + } + + @Override + protected void onPostExecute(Void string) { + /* bitmapList.add(bitmap); + + Log.d("count1iss", String.valueOf(count1)); + Log.d("count2iss", String.valueOf(count2)); + Log.d("Bitmapsizess", String.valueOf(bitmapList.size())); + if(bitmapList.size()==count2){ + img_mainGallery.setImageBitmap(bitmapList.get(0)); + txt_numOfImages.setText("Images: "+bitmapList.size()); + }*/ + + try { + if (outputFile != null) { + // progressDialog.dismiss(); + progressBar.setVisibility(GONE); + Toast.makeText(context, "Downloaded Successfully", Toast.LENGTH_SHORT).show(); + + try { + //FileOpen.openFile(mContext, myFile); + PMComplitionProjectActivity.FileOpen.openFile(getApplicationContext(), outputFile); + } catch (IOException e) { + e.printStackTrace(); + } + } else { + + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + + } + }, 3000); + + Log.e(TAG, "Download Failed"); + + } + } catch (Exception e) { + e.printStackTrace(); + + //Change button text if exception occurs + + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + + } + }, 3000); + Log.e(TAG, "Download Failed with Exception - " + e.getLocalizedMessage()); + + } + + // progressDialog.dismiss(); + + progressBar.setVisibility(GONE); + } + } + + public class UploadProjectDocument_SaveDraft extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + UploadProjectDocument_SaveDraft (Context ctx){ + context = ctx; + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + SoapPrimitive response =null; + + response = UploadProjectDocument_SaveDraft(); + + //Log.d("Soap response is",response.toString()); + return response; + + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) view4.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + /* Toast.makeText(getActivity(),result.toString(),Toast.LENGTH_LONG).show(); + progressDialog.dismiss();*/ + + + if(result != null) { + if (result.toString().equalsIgnoreCase("success")) { + //Log.d("FinalSoapResult",result.toString()); +/* LoadApprovedProject loadApprovedProject = new LoadApprovedProject(getActivity()); + loadApprovedProject.execute();*/ + + SubmitForCompletion_SaveDraft submitForCompletion_saveDraft = new SubmitForCompletion_SaveDraft(getApplication()); + submitForCompletion_saveDraft.execute(); + } else { + Toast.makeText(getApplicationContext(), result.toString(), Toast.LENGTH_LONG).show(); + // progressDialog.dismiss(); + } + + Log.d("Resultisssss", result.toString()); + }else{ + //progressDialog.dismiss(); + } + + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapPrimitive UploadProjectDocument_SaveDraft() { + String METHOD_NAME = "UpdateProjectCompletionDocumentDraft"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/UpdateProjectCompletionDocumentDraft"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + Log.d("Insidexxxxx","UpdateProjectCompletionDocumentDraft"); + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + request.addProperty("leadId",str_leadId); + request.addProperty("RegistrationId",str_RegistrationId); + + // Log.d("Projectssssssss", String.valueOf(mapProjectIdProject.get(selectedProject))); + request.addProperty("ProjectId",str_projectid); + + request.addProperty("docFile",docbyteArray); + request.addProperty("extension",extensions); + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + new MarshalBase64().register(envelope); + + envelope.dotNet = true; + envelope.setOutputSoapObject(request); + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Projects.toString().trim()); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //Log.d("soaprespUpldPrjctDoc",envelope.getResponse().toString()); + + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + //Log.e("soaprespUpldPrjctDoc",response.toString()); + return response; + + } + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getApplicationContext(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getApplicationContext(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + //getActivity().finish(); + } + } + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getApplicationContext(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getApplicationContext(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + } + + public class SubmitForCompletion_SaveDraft extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + SubmitForCompletion_SaveDraft (Context ctx){ + context = ctx; + } + + @Override + protected SoapPrimitive doInBackground(Void... params) { + SoapPrimitive response = SubmitForCompletion_SaveDraft(); + return response; + } + + @Override + protected void onPreExecute() { + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + // pd.dismiss(); + //progressDialog.dismiss(); + if(result!=null) { + if (result.toString().equalsIgnoreCase("success")) //success + { + //pd.dismiss(); + pd.setProgress(100); + if (pd.getProgress() == pd.getMax()) { + pd.dismiss(); + } + Toast.makeText(getApplicationContext(),"Data saved successfully",Toast.LENGTH_LONG).show(); + + Intent ittEditProjToProjStatus = new Intent(FinalProjectCompletion_Activity.this, ProjectDetails.class); + startActivity(ittEditProjToProjStatus); + finish(); + /*FragmentTransaction fragmenttransaction = getSupportFragmentManager().beginTransaction(); + HomeFragment regcomplainfragment = new HomeFragment(); + fragmenttransaction.replace(R.id.content_frame, regcomplainfragment).addToBackStack("HomeFragment"); + fragmenttransaction.commit();*/ + } + }else{ + //getActivity().finish(); + Toast.makeText(getApplicationContext(),"Error occured while saving to database",Toast.LENGTH_LONG).show(); + } + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapPrimitive SubmitForCompletion_SaveDraft() { + String METHOD_NAME = "UpdateProjectCompletionsDraft"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/UpdateProjectCompletionsDraft"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + Log.d("Insidexxxxx","UpdateProjectCompletionsDraft"); + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + request.addProperty("leadId",str_leadId); + + if(projectname_fpc_tv.getText()!=null) { + String str_projectname = projectname_fpc_tv.getText().toString(); + if (!str_projectname.isEmpty() && !str_projectname.equals("") && !str_projectname.equals(null)) { + request.addProperty("Title", str_projectname); + } else { + request.addProperty("Title", ""); + } + }else{ + request.addProperty("Title", ""); + } + + // request.addProperty("RegistrationId",str_RegistrationId); + request.addProperty("ProjectId",str_projectid); + + if(edt_fundRaised != null){ + int length = edt_fundRaised.getText().length(); + Log.d("Lengthisss", String.valueOf(length)); + if(length > 0) { + Log.d("beforelengthgreaterthan","zero"); + String str_fundRaised = edt_fundRaised.getText().toString(); + Log.d("str_fundraisedafter", str_fundRaised); + + if (!str_fundRaised.equals(null) && !str_fundRaised.isEmpty() && !str_fundRaised.equals("")) { + request.addProperty("FundsRaised", str_fundRaised); + } else { + request.addProperty("FundsRaised", "0"); + } + }else{ + request.addProperty("FundsRaised", "0"); + } + }else{ + request.addProperty("FundsRaised", "0"); + } + + + if(challanges_fpc_et.getText()!=null) { + String str_Challanges = challanges_fpc_et.getText().toString(); + if (!str_Challanges.isEmpty() && !str_Challanges.equals("") && !str_Challanges.equals(null)) { + request.addProperty("Challenge", str_Challanges); + } else { + request.addProperty("Challenge", ""); + } + }else{ + request.addProperty("Challenge", ""); + } + + if(learning_fpc_et.getText()!=null) { + String str_learning = learning_fpc_et.getText().toString(); + if (!str_learning.isEmpty() && !str_learning.equals("") && !str_learning.equals(null)) { + request.addProperty("Learning", str_learning); + } else { + request.addProperty("Learning", ""); + } + }else{ + request.addProperty("Learning", ""); + } + + if(story_fpc_et.getText()!=null) { + String str_story = story_fpc_et.getText().toString(); + if (!str_story.isEmpty() && !str_story.equals("") && !str_story.equals(null)) { + request.addProperty("AsAStory", str_story); + } else { + request.addProperty("AsAStory", ""); + } + }else{ + request.addProperty("AsAStory", ""); + } + + if(resourcesUtilised_fpc_et.getText() != null){ + String str_resourceUtilised = resourcesUtilised_fpc_et.getText().toString(); + Log.d("StringResourcesUtilised",str_resourceUtilised); + + if (!str_resourceUtilised.isEmpty() && !str_resourceUtilised.equals("") && !str_resourceUtilised.equals(null)) { + request.addProperty("Resource", str_resourceUtilised); + } else { + request.addProperty("Resource", ""); + } + } + + request.addProperty("CompletionProgress",CompletionProgress1); + + if(placeofimpl_fpc_et.getText()!=null) { + String str_placeofImp = placeofimpl_fpc_et.getText().toString(); + if (!str_placeofImp.isEmpty() && !str_placeofImp.equals("") && !str_placeofImp.equals(null)) { + request.addProperty("Placeofimplement", str_placeofImp); + } else { + request.addProperty("Placeofimplement", ""); + } + }else{ + request.addProperty("Placeofimplement", ""); + } + + + String str_resource_amount= resourcesUtilised_amount_fpc_et.getText().toString(); + if(str_resource_amount.isEmpty()||str_resource_amount.equals("")||str_resource_amount.equals(null) + ||str_resource_amount.equals("0")) + { + request.addProperty("TotalResources",0);//long + } + else{ + int int_resource_amt= Integer.parseInt(resourcesUtilised_amount_fpc_et.getText().toString()); + if(int_resource_amt>0) { + long long_resource_amount = Long.parseLong(str_resource_amount); + request.addProperty("TotalResources", long_resource_amount);//long + } + else{ + request.addProperty("TotalResources",0);//long + } + } + + + String str_hoursspent = edt_hoursspent.getText().toString(); + + if(!str_hoursspent.isEmpty() && !str_hoursspent.equals("") && !str_hoursspent.equals(null)){ + request.addProperty("HoursSpend",str_hoursspent); + Log.d("str_hoursspent", str_hoursspent); + }else{ + request.addProperty("HoursSpend",0); + //Zero added + + } + + + request.addProperty("SDG_Goal",goals_jsonobject.toString());// string + + + + request.addProperty("Collaboration_Supported",impactproject_collabaration_et.getText().toString());// string + request.addProperty("Permission_And_Activities",permissionactivities_et.getText().toString());//string + request.addProperty("Experience_Of_Initiative",exp_initiative_et.getText().toString());//string + request.addProperty("Lacking_initiative",lacking_initiative_et.getText().toString());//string + request.addProperty("Against_Tide",impactproject_againtstide_et.getText().toString());//string + request.addProperty("Cross_Hurdles",impactproject_crosshurdles_et.getText().toString());//string + request.addProperty("Entrepreneurial_Venture",impactproject_venture_et.getText().toString());//string + request.addProperty("Government_Awarded",impactproject_governaward_et.getText().toString());//string + request.addProperty("Leadership_Roles",impactproject_leadershiprole_et.getText().toString());//string + + Log.e("tag","CompletionProgress="+CompletionProgress1); + Log.e("Request savedraft",request.toString()); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //new MarshalBase64().register(envelope); + //new Marshal.register(envelope); + + envelope.dotNet = true; + + + + + //Set output SOAP object + envelope.setOutputSoapObject(request); + + + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Projects.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + Log.e("savedraft request",envelope.getResponse().toString()); + + //Log.d("Requestsssss",request.toString()); + + + //SoapObject response = (SoapObject) envelope.getResponse(); + + //return null; + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + //Log.e("soaprespsubmitComplnPrj",response.toString()); + //Log.e("savedraft response",response.toString()); + return response; + + } + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getApplication(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getApplication(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + //getActivity().finish(); + } + } + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getApplication(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getApplication(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + + } + + public class UploadProjectImages extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + /*private ProgressBar progressBar;*/ + + UploadProjectImages (FinalProjectCompletion_Activity activity) + { + context = activity; + // pd = new ProgressDialog(activity); + // pd = new ProgressDialog(getApplication()); + /* pd.setMessage("Submitting your request please wait. If you press back button your request will be uploaded in the backend"); + pd.setCanceledOnTouchOutside(false); + pd.show();*/ + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + SoapPrimitive response =null; + + /* for(int k=0;k " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getApplicationContext(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + //getActivity().finish(); + } + } + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getApplicationContext(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getApplicationContext(),"Web Service Error", Toast.LENGTH_LONG).show(); + + } + }); + /* getActivity().finish();*/ + } + return null; + } + + public class UploadProjectDocument extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + UploadProjectDocument (Context ctx){ + context = ctx; + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + SoapPrimitive response =null; + + response = uploadProjectDocument(); + + //Log.d("Soap response is",response.toString()); + return response; + + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) view4.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + /* Toast.makeText(getActivity(),result.toString(),Toast.LENGTH_LONG).show(); + progressDialog.dismiss();*/ + + + if(result != null) { + if (result.toString().equalsIgnoreCase("success")) + { + //Log.d("FinalSoapResult",result.toString()); +/* LoadApprovedProject loadApprovedProject = new LoadApprovedProject(getActivity()); + loadApprovedProject.execute();*/ + + SubmitForCompletion submitForCompletion = new SubmitForCompletion(getApplication()); + submitForCompletion.execute(); + } else { + Toast.makeText(getApplicationContext(), result.toString(), Toast.LENGTH_LONG).show(); + // progressDialog.dismiss(); + } + + Log.d("Resultisssss", result.toString()); + }else{ + //progressDialog.dismiss(); + } + + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapPrimitive uploadProjectDocument() { + String METHOD_NAME = "UpdateProjectCompletionDocument"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/UpdateProjectCompletionDocument"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + Log.d("Insidexxxxx","uploadProjectDocumentssss"); + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + request.addProperty("leadId",str_leadId); + request.addProperty("RegistrationId",str_RegistrationId); + + // Log.d("Projectssssssss", String.valueOf(mapProjectIdProject.get(selectedProject))); + request.addProperty("ProjectId",str_projectid); + + request.addProperty("docFile",docbyteArray); + request.addProperty("extension",extensions); + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + new MarshalBase64().register(envelope); + + envelope.dotNet = true; + envelope.setOutputSoapObject(request); + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Projects.toString().trim()); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //Log.d("soaprespUpldPrjctDoc",envelope.getResponse().toString()); + + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + //Log.e("soaprespUpldPrjctDoc",response.toString()); + return response; + + } + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getApplicationContext(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getApplicationContext(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + //getActivity().finish(); + } + } + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getApplicationContext(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getApplicationContext(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + } + + public class SubmitForCompletion extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + SubmitForCompletion (Context ctx){ + context = ctx; + } + + @Override + protected SoapPrimitive doInBackground(Void... params) { + SoapPrimitive response = submitCompletionProject(); + return response; + } + + @Override + protected void onPreExecute() { + /* if (pd != null && pd.isShowing()){ + pd = new ProgressDialog(context); + // pd = new ProgressDialog(getApplication()); + pd.setMessage("Submitting your request please wait. If you press back button your request will be uploaded in the backend"); + pd.setCanceledOnTouchOutside(false); + pd.show();}*/ + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + + // pd.dismiss(); + //progressDialog.dismiss(); + if(result!=null) { + if (result.toString().equalsIgnoreCase("success")) { + Toast.makeText(getApplicationContext(),"Project Completed Successfully",Toast.LENGTH_LONG).show(); + //pd.dismiss(); + finish(); + Intent ittEditProjToProjStatus = new Intent(FinalProjectCompletion_Activity.this, ProjectDetails.class); + startActivity(ittEditProjToProjStatus); + pd.setProgress(100); + if (pd.getProgress() == pd.getMax()) { + pd.dismiss(); + } + } + }else{ + //getActivity().finish(); + Toast.makeText(context,"Error occured while saving to database",Toast.LENGTH_LONG).show(); + } + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapPrimitive submitCompletionProject() + { + String METHOD_NAME = "UpdateProjectCompletions"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/UpdateProjectCompletions"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + Log.d("Insidexxxxx","submitCompletionProject"); + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + request.addProperty("leadId",str_leadId); + //request.addProperty("RegistrationId",str_RegistrationId); + + // Log.d("Projectssssssss", String.valueOf(mapProjectIdProject.get(selectedProject))); + + request.addProperty("ProjectId",str_projectid); + + if(edt_fundRaised != null){ + int length = edt_fundRaised.getText().length(); + Log.d("Lengthisss", String.valueOf(length)); + if(length > 0) { + Log.d("beforelengthgreaterthan","zero"); + String str_fundRaised = edt_fundRaised.getText().toString(); + Log.d("str_fundraisedafter", str_fundRaised); + if (!str_fundRaised.equals(null) && !str_fundRaised.isEmpty() && !str_fundRaised.equals("")) { + request.addProperty("FundsRaised", str_fundRaised); + } else { + request.addProperty("FundsRaised", "0"); + } + }else{ + request.addProperty("FundsRaised", "0"); + } + }else{ + request.addProperty("FundsRaised", "0"); + } + + if(placeofimpl_fpc_et.getText()!=null) { + String str_placeofImp = placeofimpl_fpc_et.getText().toString(); + if (!str_placeofImp.isEmpty() && !str_placeofImp.equals("") && !str_placeofImp.equals(null)) { + request.addProperty("Placeofimplement", str_placeofImp); + } else { + request.addProperty("Placeofimplement", ""); + } + }else{ + request.addProperty("Placeofimplement", ""); + } + + if(challanges_fpc_et.getText()!=null) { + String str_Challanges = challanges_fpc_et.getText().toString(); + if (!str_Challanges.isEmpty() && !str_Challanges.equals("") && !str_Challanges.equals(null)) { + request.addProperty("Challenge", str_Challanges); + } else { + request.addProperty("Challenge", ""); + } + }else{ + request.addProperty("Challenge", ""); + } + + if(learning_fpc_et.getText()!=null) { + String str_learning = learning_fpc_et.getText().toString(); + if (!str_learning.isEmpty() && !str_learning.equals("") && !str_learning.equals(null)) { + request.addProperty("Learning", str_learning); + } else { + request.addProperty("Learning", ""); + } + }else{ + request.addProperty("Learning", ""); + } + + if(story_fpc_et.getText()!=null) { + String str_story = story_fpc_et.getText().toString(); + if (!str_story.isEmpty() && !str_story.equals("") && !str_story.equals(null)) { + request.addProperty("AsAStory", str_story); + } else { + request.addProperty("AsAStory", ""); + } + }else{ + request.addProperty("AsAStory", ""); + } + + if(resourcesUtilised_fpc_et.getText() != null){ + String str_resourceUtilised = resourcesUtilised_fpc_et.getText().toString(); + Log.d("StringResourcesUtilised",str_resourceUtilised); + + if (!str_resourceUtilised.isEmpty() && !str_resourceUtilised.equals("") && !str_resourceUtilised.equals(null)) { + request.addProperty("Resource", str_resourceUtilised); + } else { + request.addProperty("Resource", ""); + } + } + + + String str_resource_amount=resourcesUtilised_amount_fpc_et.getText().toString(); + if(!str_resource_amount.isEmpty() && !str_resource_amount.equals("") && !str_resource_amount.equals(null)){ + + long long_resource_amount= Long.parseLong(str_resource_amount); + request.addProperty("TotalResources",long_resource_amount);//long + Log.d("str_totalresource", String.valueOf(long_resource_amount)); + }else{ + request.addProperty("TotalResources",0); + //zero has been added on 7Sept2019 + } + + + + String str_hoursspent = edt_hoursspent.getText().toString(); + + if(!str_hoursspent.isEmpty() && !str_hoursspent.equals("") && !str_hoursspent.equals(null)){ + request.addProperty("HoursSpend",str_hoursspent); + Log.d("str_HoursSpend", str_hoursspent); + }else{ + request.addProperty("HoursSpend",0); + //zero has been added on 7Sept2019 + } + + + + request.addProperty("SDG_Goal",goals_jsonobject.toString());// string + + + + request.addProperty("Collaboration_Supported",impactproject_collabaration_et.getText().toString());// string + request.addProperty("Permission_And_Activities",permissionactivities_et.getText().toString());//string + request.addProperty("Experience_Of_Initiative",exp_initiative_et.getText().toString());//string + request.addProperty("Lacking_initiative",lacking_initiative_et.getText().toString());//string + request.addProperty("Against_Tide",impactproject_againtstide_et.getText().toString());//string + request.addProperty("Cross_Hurdles",impactproject_crosshurdles_et.getText().toString());//string + request.addProperty("Entrepreneurial_Venture",impactproject_venture_et.getText().toString());//string + request.addProperty("Government_Awarded",impactproject_governaward_et.getText().toString());//string + request.addProperty("Leadership_Roles",impactproject_leadershiprole_et.getText().toString());//string + + + + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //new MarshalBase64().register(envelope); + //new Marshal.register(envelope); + + envelope.dotNet = true; + + + + + //Set output SOAP object + envelope.setOutputSoapObject(request); + + + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Projects.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + Log.d("soaprespsubmitComplnPrj",envelope.getResponse().toString()); + + //Log.d("Requestsssss",request.toString()); + + + //SoapObject response = (SoapObject) envelope.getResponse(); + + //return null; + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + //Log.e("soaprespsubmitComplnPrj",response.toString()); + return response; + + } + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getApplication(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getApplication(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + //getActivity().finish(); + } + } + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getApplication(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getApplication(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + + } + + private class GetProjectDraftDetails_AsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + /*dialog.setMessage("Please wait,State Loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); +*/ + + pd = new ProgressDialog(FinalProjectCompletion_Activity.this); + pd.setMax(100); + pd.setMessage("Loading..."); + /// pd.setTitle("ProgressDialog bar example"); + pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); + pd.setCanceledOnTouchOutside(false); + pd.show(); + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + new Thread(new Runnable() + { + @Override + public void run() { + try { + while (pd.getProgress() <= pd.getMax()) { + Thread.sleep(200); + + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + + }).start(); + + Get_ProjectDraftdetails(); + + return null; + } + + public GetProjectDraftDetails_AsyncCallWS(FinalProjectCompletion_Activity activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @Override + protected void onPostExecute(Void result) { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + //dialog.dismiss(); + + //uploadfromDB_Statelist(); + + + if(str_projectdraft_Status.toString().trim().equals("Success")) + { + projectname_fpc_tv.setText(str_response_approved_title); + projectype_fpc_tv.setText(str_response_approved_themetypename); + beneficiaries_fpc_tv.setText(str_response_approved_beneficinary); + objectives_fpc_tv.setText(str_response_approved_objective); + if(str_response_approved_placeofimplmnt.equals("anyType{}")) + { placeofimpl_fpc_et.setText(""); } + + else + { placeofimpl_fpc_et.setText(str_response_approved_placeofimplmnt); } + + if(str_response_approved_approvedAmt.equals("anyType{}")){ + approvedAmt_fpc_tv.setText(""); + }else { + approvedAmt_fpc_tv.setText(str_response_approved_approvedAmt); } + + + + if(str_resource_amount_response.equals("anyType{}")|| + str_resource_amount_response.equals(null)|| + str_resource_amount_response.isEmpty()) + { + resourcesUtilised_amount_fpc_et.setText(""); + }else + { + resourcesUtilised_amount_fpc_et.setText(str_resource_amount_response); + } + + if(str_hoursspent.equals("anyType{}")){ + edt_hoursspent.setText(""); + }else { + edt_hoursspent.setText(str_hoursspent); + } + + if(str_response_fundraised.equals("anyType{}")){ + edt_fundRaised.setText(""); + }else{ + edt_fundRaised.setText(str_response_fundraised); + } + if(str_response_challenge.equals("anyType{}")){ + challanges_fpc_et.setText(""); + }else{ + challanges_fpc_et.setText(str_response_challenge); + } + if(str_response_learning.equals("anyType{}")){ + learning_fpc_et.setText(""); + }else { + learning_fpc_et.setText(str_response_learning); + } + if(str_response_story.equals("anyType{}")){ + story_fpc_et.setText(""); + }else{ + story_fpc_et.setText(str_response_story); } + + if(str_response_utilised.equals("anyType{}")){ + resourcesUtilised_fpc_et.setText(""); + }else{ + resourcesUtilised_fpc_et.setText(str_response_utilised); } + + if(str_response_Fund_Received.equals("anyType{}")){ + txt_leadFunded.setText(""); + }else{ + txt_leadFunded.setText(str_response_Fund_Received); } + + + + + + if(str_finalcomp_projectstartdate.toString().equals("anyType{}") + ||str_finalcomp_projectstartdate.toString().equals(null) + ||str_finalcomp_projectstartdate.toString().equals("0000-00-00")) + { + datelabel_linearlayout.setVisibility(View.GONE); + date_linearlayout.setVisibility(View.GONE); + + } + else{ + studentcomp_clickstartprojectdate_tv.setText(str_finalcomp_projectstartdate); + } + + + + + + if(str_finalcomp_projectenddate.toString().equals("anyType{}") + ||str_finalcomp_projectenddate.toString().equals(null) + ||str_finalcomp_projectenddate.toString().equals("0000-00-00")) + { + datelabel_linearlayout.setVisibility(View.GONE); + date_linearlayout.setVisibility(View.GONE); + + }else + { + studentcomp_clickendprojectdate_tv.setText(str_finalcomp_projectenddate); + } + + + + if(!str_finalcomp_projectstartdate.toString().equals("anyType{}") + && !str_finalcomp_projectstartdate.toString().equals(null) && + !str_finalcomp_projectstartdate.toString().equals("0000-00-00") + &&!str_finalcomp_projectenddate.toString().equals("anyType{}") + && !str_finalcomp_projectenddate.toString().equals(null) && + !str_finalcomp_projectenddate.toString().equals("0000-00-00")) + { + try{ + int days_count = Days.daysBetween(new LocalDate(str_finalcomp_projectstartdate), new LocalDate(str_finalcomp_projectenddate)).getDays(); + int int_days=days_count+1; + Log.e("days count", String.valueOf(int_days)); + studentcomp_numberofdays_tv.setText("Number of Days: "+String.valueOf(int_days)); + }catch(Throwable t) + { + studentcomp_numberofdays_tv.setText("Date Format not in YYYY_MM_DD"); + } + + }else + { days_linearlayout.setVisibility(View.GONE); + + } + + + + + sdgs_display_tv.setText(str_sdgs_goals_resp); + + + + + + if(str_collaboration_resp.equals("anyType{}")) + { + impactproject_collabaration_et.setText(""); + }else + { impactproject_collabaration_et.setText(str_collaboration_resp.toString()); + if(str_collaboration_resp.trim().length()>0) + { impactproject_collabaration_cb.setChecked(true);} + else{impactproject_collabaration_cb.setChecked(false); + impactproject_collabaration_et.setVisibility(View.GONE); + } + } + + + if(str_permissionactivities_resp.equals("anyType{}")) + { + permissionactivities_et.setText(""); + }else + { permissionactivities_et.setText(str_permissionactivities_resp.toString()); + + } + + if(str_exp_initiative_resp.equals("anyType{}")) + { + exp_initiative_et.setText(""); + }else + { exp_initiative_et.setText(str_exp_initiative_resp.toString());} + + + + + + + if(str_lacking_initiative_resp.equals("anyType{}")) + { + lacking_initiative_et.setText(""); + }else + { lacking_initiative_et.setText(str_lacking_initiative_resp.toString());} + + if(str_againtstide_resp.equals("anyType{}")) + { + impactproject_againtstide_et.setText(""); + }else + { impactproject_againtstide_et.setText(str_againtstide_resp.toString()); + if(str_againtstide_resp.toString().trim().length()>0) + { impactproject_againtstide_cb.setChecked(true); } + else{impactproject_againtstide_cb.setChecked(false); + impactproject_againtstide_et.setVisibility(View.GONE);} + + } + + if(str_cross_hurdles_resp.equals("anyType{}")) + { + impactproject_crosshurdles_et.setText(""); + }else + { impactproject_crosshurdles_et.setText(str_cross_hurdles_resp.toString()); + if(str_cross_hurdles_resp.toString().trim().length()>0) + { impactproject_crosshurdles_cb.setChecked(true); } + else{impactproject_crosshurdles_cb.setChecked(false); + impactproject_crosshurdles_et.setVisibility(View.GONE); + } + // + } + + + + + if(str_venture_resp.equals("anyType{}")) + { + impactproject_venture_et.setText(""); + }else + { impactproject_venture_et.setText(str_venture_resp.toString()); + if(str_venture_resp.toString().length()>0) + { impactproject_venture_cb.setChecked(true); } + else{impactproject_venture_cb.setChecked(false); + impactproject_venture_et.setVisibility(View.GONE); + } + + } + + if(str_govern_award_resp.equals("anyType{}")) + { + impactproject_governaward_et.setText(""); + }else + { impactproject_governaward_et.setText(str_govern_award_resp.toString()); + if(str_govern_award_resp.trim().length()>0) + { + impactproject_governaward_cb.setChecked(true); + }else{ + impactproject_governaward_cb.setChecked(false); + impactproject_governaward_et.setVisibility(View.GONE); + } + } + + if(str_leadership_role_resp.equals("anyType{}")) + { + impactproject_leadershiprole_et.setText(""); + + }else + { impactproject_leadershiprole_et.setText(str_leadership_role_resp.toString()); + if(str_leadership_role_resp.trim().length()>0) + { impactproject_leadershiprole_cb.setChecked(true);} + else{ + impactproject_leadershiprole_cb.setChecked(false); + impactproject_leadershiprole_et.setVisibility(View.GONE); + } + + // + } + + // TempUrlList.clear(); + // for(int k=0;klong + string*/ + + Long projectid_long= Long.valueOf(str_projectid); + + try { + + + //vijay check + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + + // Log.e("") + request.addProperty("projectId", projectid_long);//long + request.addProperty("Lead_Id", str_leadId);//string*/ + + + // request.addProperty("projectId", 40910);//long + // request.addProperty("Lead_Id", "MH08103");//string*/ + + /*40910 + Save as draft test + Awareness + 10 + save as draft test + test + 0 + 0 + 0 + save as draft test + save as draft test + save as draft test + + + 0 + 23795 + 1 + ~/Documents/MH08103_40910_33a96c6a-59a0-4ea6-8685-c9633ee1e998.jpg + + 0 + 23835 + 2 + ~/Documents/MH08103_40910_3d80fb0a-d7d6-4257-b148-656f61350573.pdf + + 0 + 23836 + 2 + ~/Documents/MH08103_40910_be5acfd7-241d-4ffc-9a31-d24ec35a603f.pdf + + Success + save as draft test + save as draft test + 70 + Draft + */ + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + // Log.i(TAG, "GetAllLoginDetails is running"); + // result1 = (Vector) envelope.getResponse(); + + // response = (SoapPrimitive) envelope.getResponse(); + + // SoapPrimitive res =(SoapPrimitive)envelope.getResponse(); + + SoapObject response = (SoapObject) envelope.getResponse(); + // SoapObject o_stateresponse = (SoapObject) response.getProperty(0); + str_projectdraft_Status = response.getProperty("Status").toString(); + + Log.e("requestsavedraft",response.toString()); + + //response_str_projectid= + + // str_response_approvedproject_status = response.getProperty("status").toString();// Success + + if(str_projectdraft_Status.toString().trim().equals("Success")) + { + str_response_approved_title = response.getProperty("Title").toString();// Independence Day with soilders, police ,Forest officer & orphanage childrens + str_response_approved_themetypename = response.getProperty("Theme").toString();//Social + str_response_approved_beneficinary = response.getProperty("BeneficiaryNo").toString();//1000 + str_response_approved_objective = response.getProperty("Objectives").toString();//to appreciate the soilders and police for there wonderful work + str_response_approved_approvedAmt = response.getProperty("SanctionAmount").toString();//320 + str_response_approved_placeofimplmnt = response.getProperty("Placeofimplement").toString();//bealgum + str_response_fundraised = response.getProperty("FundsRaised").toString(); + str_response_SanctionAmount = response.getProperty("SanctionAmount").toString(); + str_response_Fund_Received = response.getProperty("Fund_Received").toString(); + str_response_challenge = response.getProperty("Challenge").toString(); + str_response_learning = response.getProperty("Learning").toString(); + str_response_story = response.getProperty("AsAStory").toString(); + str_response_utilised = response.getProperty("Resource").toString(); + str_hoursspent = response.getProperty("HoursSpend").toString(); + str_finalcomp_projectstartdate = response.getProperty("ProjectStartDate").toString();// + str_finalcomp_projectenddate = response.getProperty("ProjectEndDate").toString();// + + + str_collaboration_resp = response.getProperty("Collaboration_Supported").toString();// + str_permissionactivities_resp = response.getProperty("Permission_And_Activities").toString();// + str_exp_initiative_resp = response.getProperty("Experience_Of_Initiative").toString();// + str_lacking_initiative_resp = response.getProperty("Lacking_initiative").toString();// + str_againtstide_resp = response.getProperty("Against_Tide").toString();// + str_cross_hurdles_resp = response.getProperty("Cross_Hurdles").toString();// + str_venture_resp = response.getProperty("Entrepreneurial_Venture").toString();// + str_govern_award_resp = response.getProperty("Government_Awarded").toString();// + str_leadership_role_resp = response.getProperty("Leadership_Roles").toString();// + + str_resource_amount_response=response.getProperty("TotalResourses").toString();// //0 + + + /*str_is_impactproject=response.getProperty("isImpact_Project").toString();//1 + + Log.e("str_impact",response.getProperty("isImpact_Project").toString());//isImpact_Project +*/ + + /* if(response.toString().contains("IsImpactProject")) + { + str_is_impactproject=response.getProperty("isImpact_Project").toString();//1 + } + else{ str_is_impactproject="0"; + }*/ + + + //No Goals //when goals has not been selected + // // when goals list has been selected + + + if (response.toString().contains("SDG_Status"))//No Goals + { + + goals_jsonobject = new JSONObject(); + goals_jsonobject.put("", ""); + str_sdgs_goals_resp=""; + // sdgs_display_tv.setText(""); + } else + { + + + + + SoapObject sdgsList = (SoapObject) response.getProperty("SDG_List"); + Object O_goalsln; + SoapPrimitive primitive_slno; + String str_slno = null; + arraylist_goalsln.clear(); + + for (int i = 0; i < sdgsList.getPropertyCount(); i++) + { + SoapObject goal_sln = (SoapObject) sdgsList.getProperty(i); + + O_goalsln = goal_sln.getProperty("Slno"); + + { + primitive_slno = (SoapPrimitive) goal_sln.getProperty("Slno");//Slno + Log.e("goalslnname", primitive_slno.toString()); + str_slno = primitive_slno.toString(); + + arraylist_goalsln.add(str_slno); + } + + } + // ArrayList al2 = (ArrayList)arraylist_goalsln.clone(); + + arraylist_goalsln_forcheckbox=arraylist_goalsln; + set_sdgs_display_tv(); + + } + + //Log.e("sdgsList", String.valueOf(sdgsList.getPropertyCount())); + + + SoapObject soapObj = (SoapObject) response.getProperty("docs"); + + if (!soapObj.toString().equals("anyType{}") && !soapObj.toString().equals(null)) { + + SoapPrimitive S_DocumentPath,S_DocumentSlno,S_DocumentPathImg; + Object O_DocumentPath,O_DocumentSlno;; + String str_DocumentPath, str_actualdocPath,str_DocumentSlno; + int count_img; + //count2 = soapObj.getPropertyCount(); + + for (count1 = 0; count1 < soapObj.getPropertyCount(); count1++) { + SoapObject doclist = (SoapObject) soapObj.getProperty(count1); + Log.d("doclist", doclist.toString()); + + O_DocumentPath = doclist.getProperty("Document_Path"); + if (!O_DocumentPath.toString().equals("anyType{}") && !O_DocumentPath.toString().equals(null)) { + S_DocumentPath = (SoapPrimitive) doclist.getProperty("Document_Path"); + str_DocumentPath = S_DocumentPath.toString(); + Log.e("tag","count_img1="+count1); + + + + + //Log.d("F") + + str_actualdocPath = Class_URL.ServerPath.toString().trim() + str_DocumentPath.substring(2); + //Log.d("Documentsssssss",str_actualdocPath); + + + // if(str_actualdocPath.endsWith("jpg") || str_actualdocPath.endsWith("jpeg") || str_actualdocPath.endsWith("png")){ + + if (str_actualdocPath.endsWith("jpg") || str_actualdocPath.endsWith("jpeg") || str_actualdocPath.endsWith("png") || str_actualdocPath.endsWith("gif") || str_actualdocPath.endsWith("psd")) { + count2++; + + count_img=count1; + S_DocumentSlno = (SoapPrimitive) doclist.getProperty("SlNo"); + S_DocumentPathImg = (SoapPrimitive) doclist.getProperty("Document_Path"); + Log.e("tag","count_img2="+count_img+"S_DocumentSlno="+S_DocumentSlno); + Log.e("tag","S_DocumentPathImg="+S_DocumentPathImg); + + str_actualdocPath = str_actualdocPath.replace(" ", "%20"); + //Log.d("str_actualdocPath", str_actualdocPath); + + //if(!str_actualdocPath.contains("(1)")) { + try { + url = new URL(str_actualdocPath); + urllist.add(url); + + + //TempUrlList.add(url); + + //added by madhu on 7/9/19 + documentlist_path.add(S_DocumentPathImg.toString().trim()); + documentlist_slno.add(S_DocumentSlno.toString().trim()); + + Log.d("Urlsssss", url.toString()); + } catch (MalformedURLException e) { + e.printStackTrace(); + } + + imagePathList.add(str_actualdocPath); + + /*LoadGalleryImage loadGalleryImg = new LoadGalleryImage(FinalProjectCompletion_Activity.this); + loadGalleryImg.execute();*/ + } + + GalleryImageBitmap.setAllImgURL(urllist); // added by madhu on 7/9/19 + + if (str_actualdocPath.endsWith("docx") || str_actualdocPath.endsWith("doc") || str_actualdocPath.endsWith("pdf")) { + wordDocPath = str_actualdocPath; + wordDocPath = wordDocPath.replace(" ", "%20"); + + Log.d("wordDocPath", wordDocPath); + Log.d("downloadUrl", String.valueOf(downloadUrl)); + String[] docNameArray = wordDocPath.split("/"); + docName = docNameArray[4]; + Log.d("doclengthisss", String.valueOf(docNameArray.length)); + Log.d("Docnameesssss", docName); + + + try { + downloadUrl = new URL(wordDocPath); + } catch (MalformedURLException e) { + e.printStackTrace(); + } + /* LoadDocument loadDocument = new LoadDocument(context); + loadDocument.execute();*/ + } + + } + } + /* for(int k=0;k<=urllist.size();k++) { + String imgurl= String.valueOf(urllist.get(0)); + try { + Glide.with(getApplicationContext()) + .load(imgurl) + .asBitmap() + .into(img_mainGallery); + } catch (Exception ex) { + ex.printStackTrace(); + } + }*/ + + + } + + + + } + + //Log.e("response projectdraft", str_projectdraft_Status.toString()); + + } catch (Throwable t) + { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + // internet_issue = "slow internet"; + } + } catch (Throwable t) + { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + + }//End of uploaddetails + + + + + + + + private class CompletionGetApprovedProjectDetails_AsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + dialog.setMessage("Please wait,Loading"); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + Get_ApprovedProjectdetails(); + return null; + } + + public CompletionGetApprovedProjectDetails_AsyncCallWS(FinalProjectCompletion_Activity activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @Override + protected void onPostExecute(Void result) { + + + + dialog.dismiss(); + + if(str_response_approvedproject_status.toString().trim().equals("Success")) + { + projectname_fpc_tv.setText(str_response_approved_title); + projectype_fpc_tv.setText(str_response_approved_themetypename); + beneficiaries_fpc_tv.setText(str_response_approved_beneficinary); + objectives_fpc_tv.setText(str_response_approved_objective); + + if(str_response_approved_placeofimplmnt.equals("anyType{}")) + { placeofimpl_fpc_et.setText(""); } + + else + { placeofimpl_fpc_et.setText(str_response_approved_placeofimplmnt); } + + + + approvedAmt_fpc_tv.setText(str_response_approved_approvedAmt); + + txt_leadFunded.setText(str_response_Fund_Received); + + + + if((str_hoursspent.equals("anyType{}"))||(str_hoursspent.equals(" ")) + ||(str_hoursspent.equals(null)) ) + { + edt_hoursspent.setText(""); + }else { + edt_hoursspent.setText(str_hoursspent); + } + + + + + if(str_finalcomp_projectstartdate.toString().equals("anyType{}") + || str_finalcomp_projectstartdate.toString().equals(null) + || str_finalcomp_projectstartdate.toString().equals("0000-00-00")) + { + + datelabel_linearlayout.setVisibility(View.GONE); + date_linearlayout.setVisibility(View.GONE); + + } + else{ + + studentcomp_clickstartprojectdate_tv.setText(str_finalcomp_projectstartdate); + } + + + + + + if(str_finalcomp_projectenddate.toString().equals("anyType{}") + ||str_finalcomp_projectenddate.toString().equals(null) + ||str_finalcomp_projectenddate.toString().equals("0000-00-00")) + { + datelabel_linearlayout.setVisibility(View.GONE); + date_linearlayout.setVisibility(View.GONE); + }else + { studentcomp_clickendprojectdate_tv.setText(str_finalcomp_projectenddate); + } + + + + if(!str_finalcomp_projectstartdate.toString().equals("anyType{}") + && !str_finalcomp_projectstartdate.toString().equals(null) && + !str_finalcomp_projectstartdate.toString().equals("0000-00-00") + &&!str_finalcomp_projectenddate.toString().equals("anyType{}") + && !str_finalcomp_projectenddate.toString().equals(null) && + !str_finalcomp_projectenddate.toString().equals("0000-00-00")) + { + try{ + int days_count = Days.daysBetween(new LocalDate(str_finalcomp_projectstartdate), new LocalDate(str_finalcomp_projectenddate)).getDays(); + int int_days=days_count+1; + studentcomp_numberofdays_tv.setText("Number of Days: "+String.valueOf(int_days)); + }catch(Throwable t) + { + studentcomp_numberofdays_tv.setText("Date Format not in YYYY_MM_DD"); + } + + }else + { days_linearlayout.setVisibility(View.GONE); + + } + + /* if(str_is_impactproject.equals(null)||str_is_impactproject.equalsIgnoreCase("anyType{}")|| + str_is_impactproject.equals("0")) + { + + }*/ + + + if(str_collaboration_resp.equals("anyType{}")) + { + impactproject_collabaration_et.setText(""); + }else + { impactproject_collabaration_et.setText(str_collaboration_resp.toString());} + + + if(str_permissionactivities_resp.equals("anyType{}")) + { + permissionactivities_et.setText(""); + }else + { permissionactivities_et.setText(str_permissionactivities_resp.toString());} + + if(str_exp_initiative_resp.equals("anyType{}")) + { + exp_initiative_et.setText(""); + }else + { exp_initiative_et.setText(str_exp_initiative_resp.toString());} + + + + sdgs_display_tv.setText(str_sdgs_goals_resp); + + + if(str_lacking_initiative_resp.equals("anyType{}")) + { + lacking_initiative_et.setText(""); + }else + { lacking_initiative_et.setText(str_lacking_initiative_resp.toString());} + + if(str_againtstide_resp.equals("anyType{}")) + { + impactproject_againtstide_et.setText(""); + }else + { impactproject_againtstide_et.setText(str_againtstide_resp.toString());} + + if(str_cross_hurdles_resp.equals("anyType{}")) + { + impactproject_crosshurdles_et.setText(""); + }else + { impactproject_crosshurdles_et.setText(str_cross_hurdles_resp.toString());} + + + + + if(str_venture_resp.equals("anyType{}")) + { + impactproject_venture_et.setText(""); + }else + { impactproject_venture_et.setText(str_venture_resp.toString());} + + if(str_govern_award_resp.equals("anyType{}")) + { + impactproject_governaward_et.setText(""); + }else + { impactproject_governaward_et.setText(str_govern_award_resp.toString());} + + if(str_leadership_role_resp.equals("anyType{}")) + { + impactproject_leadershiprole_et.setText(""); + }else + { impactproject_leadershiprole_et.setText(str_leadership_role_resp.toString());} + + + + + } + + + }//end of onPostExecute + }// end Async task + + + + public void Get_ApprovedProjectdetails() + { + String URL =Class_URL.URL_Projects.toString().trim(); + String METHOD_NAME = "CompletionGetApprovedProjectDetails"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/CompletionGetApprovedProjectDetails"; + + + + /* string + int*/ + + int projectid_in= Integer.parseInt(str_projectid); + + try { + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + + request.addProperty("leadId", str_leadId);//string + request.addProperty("PDId", projectid_in);//int*/ + + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + + + /* Independence Day with soilders, police ,Forest officer & orphanage childrens + Social + 1000 + to appreciate the soilders and police for there wonderful work + 320 + 320 + 0 + bealgum + + + + + + Success*/ + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + // Log.i(TAG, "GetAllLoginDetails is running"); + // result1 = (Vector) envelope.getResponse(); + + // response = (SoapPrimitive) envelope.getResponse(); + + // SoapPrimitive res =(SoapPrimitive)envelope.getResponse(); + + SoapObject response = (SoapObject) envelope.getResponse(); + // SoapObject o_stateresponse = (SoapObject) response.getProperty(0); + + Log.e("responseApproved",response.toString()); + + + str_response_approvedproject_status = response.getProperty("status").toString();// Success + + if(str_response_approvedproject_status.toString().trim().equals("Success")) + { + str_response_approved_title=response.getProperty("Title").toString();// Independence Day with soilders, police ,Forest officer & orphanage childrens + str_response_approved_themetypename=response.getProperty("ThemeName").toString();//Social + str_response_approved_beneficinary=response.getProperty("BeneficiaryNo").toString();//1000 + str_response_approved_objective=response.getProperty("Objectives").toString();//to appreciate the soilders and police for there wonderful work + str_response_approved_approvedAmt=response.getProperty("SanctionAmount").toString();//320 + str_response_approved_placeofimplmnt=response.getProperty("Placeofimplement").toString();//bealgum + str_response_Fund_Received=response.getProperty("giventotal").toString(); + str_hoursspent=response.getProperty("HoursSpend").toString(); + str_finalcomp_projectstartdate=response.getProperty("ProjectStartDate").toString();// + str_finalcomp_projectenddate=response.getProperty("ProjectEndDate").toString();// + + // str_is_impactproject=response.getProperty("IsImpactProject").toString();//1 + + str_collaboration_resp=response.getProperty("Collaboration_Supported").toString();// + str_permissionactivities_resp=response.getProperty("Permission_And_Activities").toString();// + str_exp_initiative_resp=response.getProperty("Experience_Of_Initiative").toString();// + str_lacking_initiative_resp=response.getProperty("Lacking_initiative").toString();// + str_againtstide_resp=response.getProperty("Against_Tide").toString();// + str_cross_hurdles_resp=response.getProperty("Cross_Hurdles").toString();// + str_venture_resp=response.getProperty("Entrepreneurial_Venture").toString();// + str_govern_award_resp=response.getProperty("Government_Awarded").toString();// + str_leadership_role_resp=response.getProperty("Leadership_Roles").toString();// + + //approved details + + if (response.toString().contains("SDG_Status"))//No Goals + { + + + goals_jsonobject = new JSONObject(); + goals_jsonobject.put("", "0"); + str_sdgs_goals_resp=""; + } + + } + + + + + Log.e("res_approvedstatus ", str_response_approvedproject_status.toString()); + + } catch (Throwable t) + { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + // internet_issue = "slow internet"; + } + } catch (Throwable t) + { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + + }//End of uploaddetails + + + + + + +//camera features + + private void selectImage() + { + final CharSequence[] items = { "Take Photo", "Choose From Library", + "Cancel" }; + + AlertDialog.Builder builder; + builder = new AlertDialog.Builder(this); + + builder.setTitle("Add Photo!"); + builder.setItems(items, new DialogInterface.OnClickListener() + { + @Override + public void onClick(DialogInterface dialog, int item) { + if (items[item].equals("Take Photo")) { + userChoosenTask ="Take Photo"; + cameraIntent(); + } else if (items[item].equals("Choose From Library")) { + userChoosenTask ="Choose from Library"; + galleryIntent(); + } else if (items[item].equals("Cancel")) { + /*int id1 = getResources().getIdentifier(String.valueOf(rowviewId), "id", getActivity().getPackageName()); + rowLinearLayout = (RelativeLayout) view4.findViewById(id1); + parentLinearLayout.removeView(rowLinearLayout);*/ + + dialog.dismiss(); + } + } + }); + + + builder.setOnKeyListener(new DialogInterface.OnKeyListener() { + @Override + public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { + if (keyCode == KeyEvent.KEYCODE_BACK) { + dialog.dismiss(); + } + return true; + } + }); + builder.show(); + } + + + private void cameraIntent() + { + file_img=getOutputFromCamera(); + imageFilePath = CommonUtils.getFilename(); + File imageFile = new File(imageFilePath); + // Uri imageFileUri = Uri.fromFile(imageFile); // convert path to Uri + Uri imageFileUri = FileProvider.getUriForFile(this, "com.mydomain.fileprovider", imageFile); + Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); + intent.putExtra(MediaStore.EXTRA_OUTPUT, imageFileUri); // set the image file name + startActivityForResult(intent, REQUEST_CAMERA); + /* + file_img=getOutputFromCamera(); + uri_fileUri= null; + + if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + String filePath = file_img.getAbsolutePath(); + + ContentValues values = new ContentValues(); + values.put(MediaStore.Images.Media.DATA, filePath); + uri_fileUri = getApplicationContext().getContentResolver().insert( + MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values); + } + + else{ + uri_fileUri = Uri.fromFile(file_img); + } + + Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); + intent.putExtra(MediaStore.EXTRA_OUTPUT, uri_fileUri); + startActivityForResult(intent, REQUEST_CAMERA);*/ + } + + + private void galleryIntent() + { +/* Intent intent = new Intent(); + intent.setType("image/*"); + intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); + intent.setAction(Intent.ACTION_GET_CONTENT); + startActivityForResult(Intent.createChooser(intent,"Select Picture"), SELECT_FILE);*/ + + Intent photoSelectActivity = new Intent(this,CompletionGallerySelectActivity.class); + //photoSelectActivity.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + //photoSelectActivity.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY ); + //startActivity(photoSelectActivity); + startActivityForResult(photoSelectActivity,SELECT_FILE); + + } + + + + + private File getOutputFromCamera() { + String timeStamp = new SimpleDateFormat(getString(R.string.txtdateformat), Locale.getDefault()).format(new Date()); + file_imageFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + getString(R.string.txtFileDocumentUploadImg) + timeStamp + getString(R.string.txtFileExtension)); + try { + file_imageFile.createNewFile(); + } catch (IOException e) { + e.printStackTrace(); + } + + //Log.d("absolute path is",imageFile.getAbsolutePath()); + return file_imageFile; + } + + +//camera features + + + + + @Override + public void onActivityResult(int requestCode, int resultCode, Intent data) + { + super.onActivityResult(requestCode, resultCode, data); + + if (resultCode == RESULT_OK) + { + if (requestCode == SELECT_FILE) + { + //onSelectFromGalleryResult(data); + + + /* String[] filePathColumn = { MediaStore.Images.Media.DATA }; + imagesEncodedList = new ArrayList(); + if(data.getData()!=null){ + + Uri mImageUri=data.getData(); + + // Get the cursor + Cursor cursor = getActivity().getBaseContext().getContentResolver().query(mImageUri, + filePathColumn, null, null, null); + // Move to first row + cursor.moveToFirst(); + + int columnIndex = cursor.getColumnIndex(filePathColumn[0]); + imageEncoded = cursor.getString(columnIndex); + cursor.close(); + + ArrayList mArrayUri = new ArrayList(); + mArrayUri.add(mImageUri); + + Log.d("ImageEncodedissssssssif",imageEncoded); + + + + *//* galleryAdapter = new GalleryAdapter(getApplicationContext(),mArrayUri); + gvGallery.setAdapter(galleryAdapter); + gvGallery.setVerticalSpacing(gvGallery.getHorizontalSpacing()); + ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) gvGallery + .getLayoutParams(); + mlp.setMargins(0, gvGallery.getHorizontalSpacing(), 0, 0);*//* + + } else { + if (data.getClipData() != null) { + ClipData mClipData = data.getClipData(); + ArrayList mArrayUri = new ArrayList(); + for (int i = 0; i < mClipData.getItemCount(); i++) { + + ClipData.Item item = mClipData.getItemAt(i); + Uri uri = item.getUri(); + mArrayUri.add(uri); + // Get the cursor + Cursor cursor = getActivity().getBaseContext().getContentResolver().query(uri, filePathColumn, null, null, null); + // Move to first row + cursor.moveToFirst(); + + int columnIndex = cursor.getColumnIndex(filePathColumn[0]); + imageEncoded = cursor.getString(columnIndex); + imagesEncodedList.add(imageEncoded); + + Log.d("ImageEncodedisssssssselse",imageEncoded); + + cursor.close(); + + *//* galleryAdapter = new GalleryAdapter(getApplicationContext(),mArrayUri); + gvGallery.setAdapter(galleryAdapter); + gvGallery.setVerticalSpacing(gvGallery.getHorizontalSpacing()); + ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) gvGallery + .getLayoutParams(); + mlp.setMargins(0, gvGallery.getHorizontalSpacing(), 0, 0);*//* + + } + Log.v("LOG_TAG", "Selected Images" + mArrayUri.size()); + } + }*/ + + + Log.d("InsideActivity","Resultsssssssssssss"); + + + } + + else if (requestCode == REQUEST_CAMERA) + { + + // if (requestCode == REQUEST_CAMERA) { + String path1= CommonUtils.compressImage(imageFilePath); + Log.e("tag","path1"+path1); + /* GetImageThumbnail getImageThumbnail = new GetImageThumbnail(); + + Bitmap bitmap = null; + try { + bitmap = getImageThumbnail.getThumbnail(fileUri, getActivity()); + } catch (IOException e) { + e.printStackTrace(); + } +*/ + Bitmap bitmap=BitmapFactory.decodeFile(new File(imageFilePath).getAbsolutePath()); + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream); + byte[] imageInByte=null; + imageInByte = stream.toByteArray(); + CompletionProjectStaticClass.setBytesImage(imageInByte); + Bitmap bm = BitmapFactory.decodeByteArray(imageInByte, 0, imageInByte.length); + // String path = MediaStore.Images.Media.insertImage(getActivity().getContentResolver(), bm, "Titledddd", null); + + cameraImgMap.put(path1,bm); + + CompletionProjectStaticClass.setBytesImage(imageInByte); ///Image(imageInByte); + + /* GetImageThumbnail getImageThumbnail = new GetImageThumbnail(); + + Bitmap bitmap = null; + try { + bitmap = getImageThumbnail.getThumbnail(uri_fileUri,this); + } catch (IOException e) { + e.printStackTrace(); + } + + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream); + byte[] imageInByte; + imageInByte = stream.toByteArray(); + Bitmap bm = BitmapFactory.decodeByteArray(imageInByte, 0, imageInByte.length); + String path = MediaStore.Images.Media.insertImage(this.getContentResolver(), bm, "Titledddd", null); + + cameraImgMap.put(path,bm);*/ + + //imageUrls.add(path); + /* if(imageAdapter!=null) { + //imageUrls.clear(); + imageUrls.addAll(imageAdapter.getImageList()); + imageUrls.add(path); + }else{ + imageUrls.add(path); + }*/ + + + + + /* if(imageAdapter!=null) { + + Log.d("imageAdapterStringsss1",imageAdapter.getImageList().toString()); + Log.d("imageUrlsStringsss1",imageUrls.toString()); + + ArrayList sample = new ArrayList(); + for(String imgUrl : imageUrls){ + for (int j = 0; j < imageAdapter.getImageList().size(); j++) { + if ((imgUrl.equals(imageAdapter.getImageList().get(j)))){ + Log.d("ImageURLtobedeletedisss",imgUrl); + String imgiss = imgUrl; + //imageUrls.remove(imgiss); + + sample.add(imgiss); + } + } + } + imageUrls.removeAll(sample); + + Log.d("imageAdapterStringsss2",imageAdapter.getImageList().toString()); + Log.d("imageUrlsStringsss2",imageUrls.toString()); + + }*/ + + /* ArrayList dummyimageUrls = new ArrayList(); + dummyimageUrls.addAll(imageUrls); + + if(imageAdapter!=null){ + ArrayList currentList = imageAdapter.getImageList(); + + Iterator it = dummyimageUrls.iterator(); + + ArrayList sample = new ArrayList(); + while(it.hasNext()){ + String simple = it.next(); + System.out.println(simple); + if(!currentList.contains(simple)){ + //dummyimageUrls.remove(simple); + sample.add(simple); + } + } + dummyimageUrls.removeAll(sample); + } + + imageUrls.clear(); + imageUrls.addAll(dummyimageUrls);*/ + + + if(imageAdapter!=null) + { + imageUrls.clear(); + Log.d("imageAdapterss",imageAdapter.getImageList().toString()); + imageUrls.addAll(imageAdapter.getImageList()); + } + + imageUrls.add(path1); + + /*ArrayList mArrayUri = new ArrayList(); + + LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + final View rowView = inflater.inflate(R.layout.upload_project_image, null); + + ImageView img_proj = (ImageView) rowView.findViewById(R.id.img_projImage); + + Log.d("Childcountisss", String.valueOf(parentLinearLayout.getChildCount())); + + btnUploadId = (parentLinearLayout.getChildCount()+1)*1000; + + projImageId = btnUploadId + 1; + + Log.d("btnUploadId", String.valueOf(btnUploadId)); + + Log.d("projImageId", String.valueOf(projImageId)); + + //btnUploadImage.setId(btnUploadId); + //img_proj.setId(projImageId); + + hashMapBtnImg.put(btnUploadId,projImageId); + + if(parentLinearLayout.getChildCount()<=9) { + parentLinearLayout.addView(rowView, parentLinearLayout.getChildCount()); + rowView.setId(projImageId+1); + rowviewId = rowView.getId(); + + rowView.setVisibility(View.GONE); + } + + if((parentLinearLayout.getChildCount() % 2) == 0){ + rowView.setPadding(160,0,0,0); + }else{ + rowView.setPadding(0,0,0,0); + } + + imageidis = projImageId; + flag = 1; + + Log.d("LOG_TAG", "Selected Images" + mArrayUri.size()); + + int id1 = getResources().getIdentifier(String.valueOf(rowviewId), "id", getActivity().getPackageName()); + rowLinearLayout = (RelativeLayout) view4.findViewById(id1); + rowLinearLayout.setVisibility(View.VISIBLE); + + */ + + /* try { + actualImage = FileUtil.from(getActivity(), Uri.parse(path)); + + Log.d("ActualImageSize", "ActualImageSizeissss " + getReadableFileSize(actualImage.length())); + String fileSize = getReadableFileSize(actualImage.length()); + String fileSizeArray[] = fileSize.split("\\s"); + + if(fileSizeArray[1].equals("GB") || fileSizeArray[1].equals("TB") || (fileSizeArray[1].equals("MB") && (Double.valueOf(fileSizeArray[0]) > 5.0))) { + compressedImage = new Compressor.Builder(getActivity()) + .setMaxWidth(740) + .setMaxHeight(480) + .setQuality(100) + .setCompressFormat(Bitmap.CompressFormat.JPEG) + .setDestinationDirectoryPath(Environment.getExternalStoragePublicDirectory( + Environment.DIRECTORY_PICTURES).getAbsolutePath()) + .build() + .compressToFile(actualImage); + //img_proj.setImageBitmap(BitmapFactory.decodeFile(compressedImage.getAbsolutePath())); + } + + else{ + //imgProj.setImageBitmap(BitmapFactory.decodeFile(actualImage.getAbsolutePath())); + //img_proj.setImageBitmap(BitmapFactory.decodeFile(actualImage.getAbsolutePath())); + } + } catch (IOException e) { + e.printStackTrace(); + }*/ + + //imgurlss.clear(); + //imgurlss.addAll(imageUrls); + initializeRecyclerView(); + //imgurlss.removeAll(imageUrls); + //imgurlss.addAll(imageAdapter.getImageList()); + + } + + else if(requestCode == PICKFILE_RESULT_CODE){ + Uri selectedUri = data.getData(); + + String filePath; + + Log.e("uri",selectedUri.toString()); + + if (selectedUri.toString().startsWith("file:")) { + filePath = selectedUri.getPath(); + } + + else { + String[] filePathColumn = {MediaStore.Images.Media.DATA}; + + Cursor cursor = this.getContentResolver().query(selectedUri, + filePathColumn, null, null, null); + cursor.moveToFirst(); + + int columnIndex = cursor.getColumnIndex(filePathColumn[0]); + filePath = cursor.getString(columnIndex); + cursor.close(); + } + + Log.d("filePathissssss",filePath); + + //if(selectedImage.toString("")) + + File file = new File(filePath); + + docbyteArray = new byte[(int) file.length()]; + try { + FileInputStream fileInputStream = new FileInputStream(file); + + int offset = 0; + int numRead = 0; + while (offset < docbyteArray.length && (numRead=fileInputStream.read(docbyteArray, offset, docbyteArray.length-offset)) >= 0) { + offset += numRead; + } + + // Ensure all the bytes have been read in + if (offset < docbyteArray.length) { + throw new IOException("Could not completely read file " + file.getName()); + } + + + Log.d("bytearrayisss",docbyteArray.toString()); + + String[] fileArray = filePath.split("/"); + for(int k=0;k fileArrayString; + ArrayList fileDocumentString; + + if( CompletionProjectStaticClass.getCountCompletion() == 1 ){ + Log.d("Inside","RESULT_CancelleddddddfromPhotosActivityIntent"); + CompletionProjectStaticClass.setCountCompletion(0); + + fileArrayString = CompletionProjectStaticClass.getFileArrayString(); + imagesEncodedList = new ArrayList(); + + for(int i=0;i= 0) { + offset += numRead; + } + + // Ensure all the bytes have been read in + if (offset < docbyteArray.length) { + throw new IOException("Could not completely read file " + file.getName()); + } + + Log.d("bytearrayisss", docbyteArray.toString()); + + String[] fileArray = filePath.split("/"); + for (int k = 0; k < fileArray.length; k++) { + String filePart = fileArray[k]; + Log.d("Kvalueis", String.valueOf(k)); + Log.d("filePartisss", filePart); + } + + //String extArray = fil + extensions = fileArray[fileArray.length - 1].split("\\.")[1]; + + Log.d("extensionisss", extensions); + + + // Close the input stream and return bytes + fileInputStream.close(); + + Toast.makeText(this, "File is Selected", Toast.LENGTH_LONG).show(); + + fileSelected_fpc_tv.setText(filePath); + fileSelected_fpc_tv.setVisibility(View.VISIBLE); + + } catch (Exception e) { + + } + } + + + + + } + + + + /* int id1 = getResources().getIdentifier(String.valueOf(rowviewId), "id", getActivity().getPackageName()); + rowLinearLayout = (RelativeLayout) view4.findViewById(id1); + parentLinearLayout.removeView(rowLinearLayout);*/ + } + }// end of onActivityResult + + + + + + + + private void initializeRecyclerView() + { + + imgurlss = new ArrayList(); + + Log.d("ImageUrlsizeissss", String.valueOf(imageUrls.size())); + // + imgurlss.addAll(imageUrls); + + Log.d("imgurlss==", String.valueOf(imgurlss.size())); + mImageInByte.clear(); + /* for(String imgUrl : imgurlss) { + + Bitmap bitmap; + BitmapFactory.Options bmOptions = new BitmapFactory.Options(); + + bitmap = BitmapFactory.decodeFile(imgUrl, bmOptions); + + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); + byte[] imageInByte; + // imageInByte = stream.toByteArray(); + + imageInByte = stream.toByteArray(); + mImageInByte.add(imageInByte); + }*/ + for(int p=0;p> { + + private Context context; + // private ProgressBar progressBar; + private ArrayList bitmapList = new ArrayList(); + // private ProgressDialog progressDialog; + + LoadGalleryImage(Context context) { + this.context = context; + TempUrlList = GalleryImageBitmap.getAllImgURL(); + // progressDialog = new ProgressDialog(context); + } + + @Override + protected void onPreExecute() { + // progressBar = (ProgressBar) findViewById(R.id.progressBar); + // progressBar.setVisibility(View.VISIBLE); +// progressDialog.setMessage("Loading"); +// progressDialog.setCanceledOnTouchOutside(false); +// progressDialog.show(); + + + + if(!pd.isShowing()){ + + /* if (pd1.getProgress() == pd + .getMax()) { + pd.setProgress(0); + }*/ + pd1.setMax(100); + pd1.setMessage("Loading..."); + /// pd.setTitle("ProgressDialog bar example"); + pd1.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); + pd1.setCanceledOnTouchOutside(false); + pd1.show(); + + } + + } + + @Override + protected ArrayList doInBackground(Void... params) { + // pd.setProgress(50); + + + Bitmap bitmaplogo = null; + bitmapLst.clear(); + + // for (int k = 0; k < urllist.size(); k++) + for (int k = 0; k < TempUrlList.size(); k++) + { + + handle.sendMessage(handle.obtainMessage()); + try { + //Log.d("Urlssssssssssss",url.toString()); + //bitmaplogo = BitmapFactory.decodeStream(url.openStream()); + // bitmaplogo = BitmapFactory.decodeStream(urllist.get(k).openStream()); + bitmaplogo = BitmapFactory.decodeStream(TempUrlList.get(k).openStream()); + bitmapLst.add(bitmaplogo); + Log.e("tag","activity bitmapList=="+bitmapList); + + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } catch (OutOfMemoryError ex) { + /*runOnUiThread(new Runnable() { + public void run() {*/ + Toast.makeText(context, "Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + /* } + });*/ + } + } + + + return bitmapLst; + } + + @Override + protected void onPostExecute(ArrayList bitmap) { + /* bitmapList.add(bitmap); + + Log.d("count1iss", String.valueOf(count1)); + Log.d("count2iss", String.valueOf(count2)); + Log.d("Bitmapsizess", String.valueOf(bitmapList.size())); + if(bitmapList.size()==count2){ + img_mainGallery.setImageBitmap(bitmapList.get(0)); + txt_numOfImages.setText("Images: "+bitmapList.size()); + }*/ + + try { + + /*if (bitmap != null) + { + if (bitmap.size() > 0) { + img_mainGallery.setImageBitmap(bitmap.get(0)); + txt_numOfImages.setText("Images: " + bitmap.size()); + } + }*/ + + if (TempUrlList != null) { + if (TempUrlList.size() > 0) { + + img_mainGallery.setImageBitmap(bitmap.get(0)); + // txt_numOfImages.setText("Images: " + bitmap.size()); + txt_numOfImages.setText("Images: " + TempUrlList.size()); + } else { + img_mainGallery.setImageResource(0);//bitmap.get(0)); + txt_numOfImages.setText("No Images"); + } + } + } catch (OutOfMemoryError ex) { + /*runOnUiThread(new Runnable() { + public void run() {*/ + Toast.makeText(context, "Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + /* } + });*/ + } + //} + if(pd.isShowing()) { + pd.setProgress(100); + if (pd.getProgress() == pd + .getMax()) { + pd.dismiss(); + } + } + + else if(pd1.isShowing()) { + pd1.setProgress(100); + if (pd1.getProgress() == pd1 + .getMax()) { + pd1.dismiss(); + + } + } + + } + + + Handler handle = new Handler() { + @Override + public void handleMessage(Message msg) { + super.handleMessage(msg); + // pd.incrementProgressBy(1); + if(pd.isShowing()) { + pd.incrementProgressBy(1); + } + else if(pd1.isShowing()){ + pd1.incrementProgressBy(1); + } + + } + }; + + // progressBar.setProgress(100); + // progressBar.setVisibility(GONE); + // progressDialog.dismiss(); + + } + + + + + + + //-------------------------- server img delete added by madhu 7/9/19 ------------------------------------------ + private class Async_DeleteImage extends AsyncTask + { + ProgressDialog dialog; + + Context context; + + @Override + protected void onPreExecute() + { + Log.i("TAG", "onPreExecute---tab2"); + dialog.setMessage("Please wait.."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + + } + + @Override + protected void onProgressUpdate(Void... values) + { + Log.i("TAG", "onProgressUpdate---tab2"); + } + + public Async_DeleteImage(FinalProjectCompletion_Activity activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + @Override + protected Void doInBackground(String... params) + { + Log.i("TAG", "doInBackground"); + //submit_PMProfile(ManagerId); + DeleteImage(); + return null; + } + + @Override + protected void onPostExecute(Void result) + { + Log.i("TAG", "onPostExecute"); + + Log.d("ServiceResponseisss: ",status.toString()); + + dialog.dismiss(); + + if(status.equalsIgnoreCase("Image Deleted")) { + // Toast.makeText(FinalProjectCompletion_Activity.this, "Image Deleted Successfully " , + // Toast.LENGTH_LONG).show(); + Delete_AllImglistTable_B4Insertion(); + + } + else{ + Toast.makeText(FinalProjectCompletion_Activity.this, status , + Toast.LENGTH_LONG).show(); + } + } + } + + public void DeleteImage() { + + String URL = Class_URL.URL_Projects.toString().trim(); + String METHOD_NAME = "Delete_ProjectImg"; + String Namespace = "http://mis.leadcampus.org/", SOAPACTION = "http://mis.leadcampus.org/Delete_ProjectImg"; + + try { + + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + + /* request.addProperty("Img_Slno", Delete_doclist_slno.get()); + request.addProperty("img_Path", doc_path.get(position_value));*/ + JSONObject jsonObject = new JSONObject(); + for(int k=0;k " + t.getMessage()); + + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + } + + + + + + + + + + + + + + + + + + + + + + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_main_project, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + + if (id == R.id.action_editProfile) { + Intent ittProjDtlsToEditProfile = new Intent(FinalProjectCompletion_Activity.this ,EditProfileActivity.class); + startActivity(ittProjDtlsToEditProfile); + return true; + } + + if (id == R.id.action_logout) { + + //deleteCache(ProjectDetails.this); + + Intent ittProjDtlsToLogin = new Intent(FinalProjectCompletion_Activity.this ,LoginActivity.class); + startActivity(ittProjDtlsToLogin); + return true; + } + + /*if (id == android.R.id.home) { + Intent ittProjDtlsToHome = new Intent(FinalProjectCompletion_Activity.this ,ProjectDetails.class); + startActivity(ittProjDtlsToHome); + finish(); + return true; + }*/ + if (id == android.R.id.home) + { + AlertDialog.Builder dialog = new AlertDialog.Builder(FinalProjectCompletion_Activity.this); + dialog.setCancelable(false); + dialog.setTitle("LEADCampus"); + dialog.setMessage("Are you sure want to Exit from Completion Details" ); + + dialog.setPositiveButton("Yes", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) + { + Intent i = new Intent(FinalProjectCompletion_Activity.this,ProjectDetails.class); + startActivity(i); + finish(); + } + }) + .setNegativeButton("No", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + //Action for "Cancel". + dialog.dismiss(); + } + }); + + final AlertDialog alert = dialog.create(); + alert.setOnShowListener( new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface arg0) { + alert.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(Color.RED); + alert.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#004D40")); + } + }); + alert.show(); + + /* Intent ittProjDtlsToHome = new Intent(FinalProjectCompletion_Activity.this ,ProjectDetails.class); + startActivity(ittProjDtlsToHome); + finish();*/ + // obj_class_alert_msg.alerts_dialog2(contextpresentActivity,ProjectDetails.class); + + // return true; + } + + if(id == R.id.action_information){ + TextView txtclose; + Button btnFollow; + final Dialog myDialog = new Dialog(this); + myDialog.setContentView(R.layout.custompopup); + txtclose =(TextView) myDialog.findViewById(R.id.txtclose); + //txtclose.setText("M"); + // btnFollow = (Button) myDialog.findViewById(R.id.btnfollow); + txtclose.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + myDialog.dismiss(); + } + }); + myDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); + myDialog.show(); + } + + + return super.onOptionsItemSelected(item); + + } + + + + + + void updatespinner() + { + + + final ArrayList strDeviceArr = new ArrayList<>(); + strDeviceArr.add("Select device"); + + ArrayAdapter default_sdgs_goal = new ArrayAdapter(getApplicationContext(), R.layout.leavetypespinneritems, strDeviceArr); + default_sdgs_goal.setDropDownViewResource(R.layout.spinnercustomstyle); + sdgs_sp.setAdapter(default_sdgs_goal); + } + + + + + //sdgs_goals + + + + + // goal_1_nopoverty_cb,goal_2_zerohunger_cb,goal_3_goodhealth_cb,goal_4_quality_cb + //goal_5_gender_cb,goal_6_clean_cb,goal_7_affordable_cb,goal_8_decent_cb,goal_9_industry_cb + //goal_10_reduce_cb,goal_11_sustain_cb,goal_12_responsible_cb,goal_13_climate_cb + //goal_14_lifewater_cb,goal_15_lifeland_cb,goal_16_peace_cb,goal_17_partnerships_cb + //goal_18_none_cb + + + public void check_box_selected() + { + String str_selected_goals=""; + String str_selected_goals_array=""; + + if(goal_1_nopoverty_cb.isChecked()) + { + str_selected_goals=str_selected_goals+goal_1_nopoverty_cb.getText().toString()+" ,"; + + str_selected_goals_array = str_selected_goals_array+goal_1_nopoverty_cb.getText().toString()+","+"1"+","; + + } + if(goal_2_zerohunger_cb.isChecked()) + { + str_selected_goals=str_selected_goals+goal_2_zerohunger_cb.getText().toString()+" ,"; + + str_selected_goals_array = str_selected_goals_array+goal_2_zerohunger_cb.getText().toString()+","+"2"+","; + + + } + if(goal_3_goodhealth_cb.isChecked()) + { + str_selected_goals=str_selected_goals+goal_3_goodhealth_cb.getText().toString()+" ,"; + + str_selected_goals_array = str_selected_goals_array+goal_3_goodhealth_cb.getText().toString()+","+"3"+","; + } + if(goal_4_quality_cb.isChecked()) + { + str_selected_goals=str_selected_goals+goal_4_quality_cb .getText().toString()+" ,"; + + str_selected_goals_array = str_selected_goals_array+goal_4_quality_cb .getText().toString()+","+"4"+","; + } + if(goal_5_gender_cb.isChecked()) + { + str_selected_goals= str_selected_goals+goal_5_gender_cb.getText().toString()+" ,"; + + str_selected_goals_array = str_selected_goals_array+goal_5_gender_cb.getText().toString()+","+"5"+","; + } + if(goal_6_clean_cb.isChecked()) + { + str_selected_goals= str_selected_goals+goal_6_clean_cb.getText().toString()+" ,"; + + str_selected_goals_array = str_selected_goals_array+goal_6_clean_cb.getText().toString()+","+"6"+","; + } + + + + if(goal_7_affordable_cb.isChecked()) + { + str_selected_goals= str_selected_goals+goal_7_affordable_cb.getText().toString()+" ,"; + + str_selected_goals_array = str_selected_goals_array+goal_7_affordable_cb.getText().toString()+","+"7"+","; + } + if(goal_8_decent_cb.isChecked()) + { + str_selected_goals= str_selected_goals+goal_8_decent_cb.getText().toString()+" ,"; + + str_selected_goals_array = str_selected_goals_array+goal_8_decent_cb.getText().toString()+","+"8"+","; + } + if(goal_9_industry_cb.isChecked()) + { + str_selected_goals= str_selected_goals+goal_9_industry_cb.getText().toString()+" ,"; + + str_selected_goals_array = str_selected_goals_array+goal_9_industry_cb.getText().toString()+","+"9"+","; + } + if(goal_10_reduce_cb.isChecked()) + { + str_selected_goals= str_selected_goals+goal_10_reduce_cb.getText().toString()+","; + + str_selected_goals_array = str_selected_goals_array+goal_10_reduce_cb.getText().toString()+","+"10"+","; + } + if(goal_11_sustain_cb.isChecked()) + { + str_selected_goals= str_selected_goals+goal_11_sustain_cb.getText().toString()+" ,"; + + str_selected_goals_array = str_selected_goals_array+goal_11_sustain_cb.getText().toString()+","+"11"+","; + } + if(goal_12_responsible_cb.isChecked()) + { + str_selected_goals= str_selected_goals+goal_12_responsible_cb.getText().toString()+" ,"; + str_selected_goals_array = str_selected_goals_array+goal_12_responsible_cb.getText().toString()+","+"12"+","; + } + if(goal_13_climate_cb.isChecked()) + { + str_selected_goals= str_selected_goals+goal_13_climate_cb.getText().toString()+" ,"; + + str_selected_goals_array = str_selected_goals_array+goal_13_climate_cb.getText().toString()+","+"13"+","; + } + + if(goal_14_lifewater_cb.isChecked()) + { + str_selected_goals= str_selected_goals+goal_14_lifewater_cb.getText().toString()+" ,"; + str_selected_goals_array = str_selected_goals_array+goal_14_lifewater_cb.getText().toString()+","+"14"+","; + } + if(goal_15_lifeland_cb.isChecked()) + { + str_selected_goals= str_selected_goals+goal_15_lifeland_cb.getText().toString()+" ,"; + + str_selected_goals_array = str_selected_goals_array+goal_15_lifeland_cb.getText().toString()+","+"15"+","; + } + if(goal_16_peace_cb.isChecked()) + { + str_selected_goals= str_selected_goals+goal_16_peace_cb.getText().toString()+" ,"; + + str_selected_goals_array = str_selected_goals_array+goal_16_peace_cb.getText().toString()+","+"16"+","; + } + if(goal_17_partnerships_cb.isChecked()) + { + str_selected_goals= str_selected_goals+goal_17_partnerships_cb.getText().toString(); + str_selected_goals_array = str_selected_goals_array+goal_17_partnerships_cb.getText().toString()+","+"17"+","; + } + + if(goal_18_none_cb.isChecked()) + { + /* goalslist_linearlayout.setVisibility(View.GONE); + goal_1_nopoverty_cb.setVisibility(View.GONE);*/ + + str_selected_goals=""; + str_selected_goals_array=""; + str_selected_goals= str_selected_goals+goal_18_none_cb.getText().toString(); + str_selected_goals_array = str_selected_goals_array+goal_18_none_cb.getText().toString()+","+"18"+","; + } + + /* goal_18_none_cb.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Toast.makeText(getApplicationContext(),"hi",Toast.LENGTH_LONG).show(); + } + });*/ + + + str_selected_goals_array = str_selected_goals_array.substring(0, str_selected_goals_array.length() - 1); + + Log.e("str",str_selected_goals_array); + + + //String x="No Poverty ,1,No Poverty ,Zero Hunger ,2"; + + String [] stringArray=str_selected_goals_array.split(","); + + Log.e("str",stringArray.toString()); + + Log.e("length", String.valueOf(stringArray.length)); + + //Log.e("str1",stringArray[3].toString()); + + + // Create JSONObject + goals_jsonobject = new JSONObject(); + + + + + + for(int i=0;i expandableListTitle; + HashMap> expandableListDetail; + ScrollView scrollView; + + Context context; + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) + { + + + View view = inflater.inflate(R.layout.activity_about_us, container, false); + scrollView = (ScrollView) view.findViewById(R.id.scrollViewDrawer); + + expandableListView = (ExpandableListView) view.findViewById(R.id.expandableListView); + // Getting application context + context = getActivity(); + + expandableListDetail = ExpandableListDataPump.getData(getActivity()); + expandableListTitle = new ArrayList(expandableListDetail.keySet()); + expandableListAdapter = new CustomExpandableListAdapter(getActivity(), expandableListTitle, expandableListDetail); + expandableListView.setAdapter(expandableListAdapter); + + setListViewHeight(expandableListView); + + + expandableListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() { + + @Override + public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) { + setListViewHeight(parent, groupPosition); + return false; + } + }); + + + expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() { + int previousGroup = -1; + + @Override + public void onGroupExpand(int groupPosition) { + if(groupPosition != previousGroup) + expandableListView.collapseGroup(previousGroup); + previousGroup = groupPosition; + } + }); + + + + + + + + expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() { + + @Override + public void onGroupCollapse(int groupPosition) { + /* LinearLayout.LayoutParams param = (LinearLayout.LayoutParams) expandableListView.getLayoutParams(); + param.height = LinearLayout.LayoutParams.WRAP_CONTENT; + expandableListView.setLayoutParams(param); + expandableListView.refreshDrawableState(); + scrollView.refreshDrawableState();*/ + + } + }); + + + + + + return view; + } + + + + + + + + private void setListViewHeight(ExpandableListView listView) { + ListAdapter listAdapter = listView.getAdapter(); + int totalHeight = 0; + for (int i = 0; i < listAdapter.getCount(); i++) { + View listItem = listAdapter.getView(i, null, listView); + listItem.measure(0, 0); + totalHeight += listItem.getMeasuredHeight(); + } + + ViewGroup.LayoutParams params = listView.getLayoutParams(); + params.height = totalHeight + + (listView.getDividerHeight() * (listAdapter.getCount() - 1)); + listView.setLayoutParams(params); + listView.requestLayout(); + } + + + private void setListViewHeight(ExpandableListView listView, + int group) { + ExpandableListAdapter listAdapter = listView.getExpandableListAdapter(); + int totalHeight = 0; + int desiredWidth = View.MeasureSpec.makeMeasureSpec(listView.getWidth(), + View.MeasureSpec.AT_MOST); + for (int i = 0; i < listAdapter.getGroupCount(); i++) { + View groupItem = listAdapter.getGroupView(i, false, null, listView); + groupItem.measure(desiredWidth, View.MeasureSpec.UNSPECIFIED); + totalHeight += groupItem.getMeasuredHeight(); + + if (((listView.isGroupExpanded(i)) && (i != group)) + || ((!listView.isGroupExpanded(i)) && (i == group))) { + for (int j = 0; j < listAdapter.getChildrenCount(i); j++) { + View listItem = listAdapter.getChildView(i, j, false, null, + listView); + listItem.measure(desiredWidth, View.MeasureSpec.UNSPECIFIED); + + totalHeight += listItem.getMeasuredHeight(); + } + } + } + + ViewGroup.LayoutParams params = listView.getLayoutParams(); + int height = totalHeight + + (listView.getDividerHeight() * (listAdapter.getGroupCount() - 1)); + if (height < 10) + height = 200; + params.height = height; + listView.setLayoutParams(params); + listView.requestLayout(); + + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/Fragment_GuestNewsFeeds.java b/app/src/main/java/com/leadcampusapp/Fragment_GuestNewsFeeds.java new file mode 100644 index 0000000..a82c46b --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Fragment_GuestNewsFeeds.java @@ -0,0 +1,213 @@ +package com.leadcampusapp; + +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.SharedPreferences; +import android.os.Bundle; +//import android.support.design.widget.TabLayout; +import androidx.fragment.app.Fragment; +import androidx.viewpager.widget.ViewPager; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageButton; +import android.widget.ImageView; + +import com.google.android.material.tabs.TabLayout; + +public class Fragment_GuestNewsFeeds extends Fragment implements ConnectivityReceiver.ConnectivityReceiverListener{ + + ImageButton img_newsfeedsBack; + + public static final String PREFBook_Stud= "prefbook_stud"; + private SharedPreferences shardpref_S_obj; + public static final String PrefID_Role = "prefid_role"; + public String str_role = null; + + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) + { + + + View view1 = inflater.inflate(R.layout.activity_news_feeds, container, false); + shardpref_S_obj= getActivity().getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + shardpref_S_obj.getString(PrefID_Role, "").trim(); + str_role = shardpref_S_obj.getString(PrefID_Role, "").trim(); + + /*getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout);*/ + //getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background)); + + /* View actionBarView = getSupportActionBar().getCustomView(); + TextView actionBarTV = (TextView) actionBarView.findViewById(R.id.txt_actionBar); + actionBarTV.setText("News Feeds"); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); +*/ + + + + + + /* View view1; + LayoutInflater inflater1 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view1 = inflater1.inflate(R.layout.leadstorytablayout, null);*/ + + View view2; + LayoutInflater inflater2 = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view2 = inflater2.inflate(R.layout.leadfbtablayout, null); + + View view3; + LayoutInflater inflater3 = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view3 = inflater3.inflate(R.layout.leadintablayout, null); + + View view4; + LayoutInflater inflater4 = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view4 = inflater4.inflate(R.layout.leadtwtablayout, null); + + + + + TabLayout tabLayout = (TabLayout) view1.findViewById(R.id.tab_layout); + // tabLayout.addTab(tabLayout.newTab().setCustomView(view1)); + tabLayout.addTab(tabLayout.newTab().setCustomView(view2)); + tabLayout.addTab(tabLayout.newTab().setCustomView(view3)); + tabLayout.addTab(tabLayout.newTab().setCustomView(view4)); + + + TabLayout.Tab selectedTab = tabLayout.getTabAt(0); + View view = selectedTab.getCustomView(); + ImageView img1=(ImageView) view1.findViewById(R.id.img_newsfeedstabtitle); + //img1.setImageResource(R.drawable.story_wht); + // img1.setImageResource(R.drawable.fb_001); + + // TextView selectedText = (TextView) view.findViewById(R.id.txt_newsfeedstabtitle); + //selectedText.setTextColor(Color.parseColor("#FFFFFF")); + + + //tabLayout.addTab(tabLayout.newTab().setText("Tab 3")); + //tabLayout.setTabGravity(TabLayout.GRAVITY_FILL); + + final ViewPager viewPager = (ViewPager) view1.findViewById(R.id.pager); + final NewsFeedsAdapter adapter = new NewsFeedsAdapter(getActivity().getSupportFragmentManager(), tabLayout.getTabCount()); + viewPager.setAdapter(adapter); + viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); + tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { + @Override + public void onTabSelected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + /* if(tab.getPosition()==0) { + ImageView img1 = (ImageView) view.findViewById(R.id.img_newsfeedstabtitle); + //img1.setImageResource(R.drawable.story_wht); + img1.setImageResource(R.drawable.story); + }else */ + if(tab.getPosition()==0){ + ImageView img1 = (ImageView) view.findViewById(R.id.img_fbfeedstabtitle); + //img1.setImageResource(R.drawable.fb_whit_001); + img1.setImageResource(R.drawable.fb_001); + }else if(tab.getPosition()==1){ + ImageView img1 = (ImageView) view.findViewById(R.id.img_infeedstabtitle); + //img1.setImageResource(R.drawable.instwht_001); + img1.setImageResource(R.drawable.inst_001); + }else if(tab.getPosition()==2){ + ImageView img1 = (ImageView) view.findViewById(R.id.img_twfeedstabtitle); + //img1.setImageResource(R.drawable.tw_wht001); + img1.setImageResource(R.drawable.tw_001); + } + // TextView selectedText = (TextView) view.findViewById(R.id.txt_newsfeedstabtitle); + // selectedText.setTextColor(Color.parseColor("#FFFFFF")); + + viewPager.setCurrentItem(tab.getPosition()); + } + + @Override + public void onTabUnselected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + /* if(tab.getPosition()==0) { + ImageView img1 = (ImageView) view.findViewById(R.id.img_newsfeedstabtitle); + img1.setImageResource(R.drawable.story); + }else*/ + if(tab.getPosition()==0){ + ImageView img1 = (ImageView) view.findViewById(R.id.img_fbfeedstabtitle); + img1.setImageResource(R.drawable.fb_001); + }else if(tab.getPosition()==1){ + ImageView img1 = (ImageView) view.findViewById(R.id.img_infeedstabtitle); + img1.setImageResource(R.drawable.inst_001); + }else if(tab.getPosition()==2){ + ImageView img1 = (ImageView) view.findViewById(R.id.img_twfeedstabtitle); + img1.setImageResource(R.drawable.tw_001); + } + // TextView selectedText = (TextView) view.findViewById(R.id.txt_newsfeedstabtitle); + // selectedText.setTextColor(Color.parseColor("#000000")); + } + + @Override + public void onTabReselected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + /* if(tab.getPosition()==0) { + ImageView img1 = (ImageView) view.findViewById(R.id.img_newsfeedstabtitle); + //img1.setImageResource(R.drawable.story_wht); + img1.setImageResource(R.drawable.story); + }else */ + if(tab.getPosition()==0){ + ImageView img1 = (ImageView) view.findViewById(R.id.img_fbfeedstabtitle); + //img1.setImageResource(R.drawable.fb_whit_001); + img1.setImageResource(R.drawable.fb_001); + }else if(tab.getPosition()==1){ + ImageView img1 = (ImageView) view.findViewById(R.id.img_infeedstabtitle); + //img1.setImageResource(R.drawable.instwht_001); + img1.setImageResource(R.drawable.inst_001); + }else if(tab.getPosition()==2){ + ImageView img1 = (ImageView) view.findViewById(R.id.img_twfeedstabtitle); + //img1.setImageResource(R.drawable.tw_wht001); + img1.setImageResource(R.drawable.tw_001); + } + // TextView selectedText = (TextView) view.findViewById(R.id.txt_newsfeedstabtitle); + //selectedText.setTextColor(Color.parseColor("#FFFFFF")); + } + }); + + return view1; + } + + + + @Override + public void onNetworkConnectionChanged(boolean isConnected) { + showSnack(isConnected); + } + + private void showSnack(boolean isConnected) { + + if (!isConnected) { + + AlertDialog.Builder adb = new AlertDialog.Builder(getActivity()); + //adb.setView(alertDialogView); + + adb.setTitle("Sorry! Not connected to the internet"); + + adb.setIcon(android.R.drawable.ic_dialog_alert); + + adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + + adb.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + adb.setCancelable(true); + adb.show(); + } + + } + + + +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/FundAdapter.java b/app/src/main/java/com/leadcampusapp/FundAdapter.java new file mode 100644 index 0000000..f89426e --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/FundAdapter.java @@ -0,0 +1,38 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 22-06-2018. + */ +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentStatePagerAdapter; + +public class FundAdapter extends FragmentStatePagerAdapter { + int mNumOfTabs; + + public FundAdapter(FragmentManager fm, int NumOfTabs) { + super(fm); + this.mNumOfTabs = NumOfTabs; + } + + @Override + public Fragment getItem(int position) { + + switch (position) { + case 0: + Funding_Fragment tab = new Funding_Fragment(); + return tab; + case 1: + Fund_TicketStatus_Fragment tab1 = new Fund_TicketStatus_Fragment(); + return tab1; + + default: + return null; + } + } + + @Override + public int getCount() { + return mNumOfTabs; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/FundMainActivity.java b/app/src/main/java/com/leadcampusapp/FundMainActivity.java new file mode 100644 index 0000000..88dc0bc --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/FundMainActivity.java @@ -0,0 +1,210 @@ +package com.leadcampusapp; + +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.graphics.Color; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.ImageButton; +import android.widget.TextView; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.viewpager.widget.ViewPager; + +import com.google.android.material.tabs.TabLayout; + +//import android.support.design.widget.TabLayout; + +public class FundMainActivity extends AppCompatActivity implements ConnectivityReceiver.ConnectivityReceiverListener{ + ImageButton img_eventsBack; + + public static final String PREFBook_Stud= "prefbook_stud"; + private SharedPreferences shardpref_S_obj; + public static final String PrefID_Role = "prefid_role"; + public String str_role = null; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_fees_paid); + + + shardpref_S_obj= FundMainActivity.this.getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + shardpref_S_obj.getString(PrefID_Role, "").trim(); + str_role = shardpref_S_obj.getString(PrefID_Role, "").trim(); + + + /* img_eventsBack = (ImageButton) findViewById(R.id.img_eventsBack);*/ + + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + //getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background)); + + View actionBarView = getSupportActionBar().getCustomView(); + TextView actionBarTV = (TextView) actionBarView.findViewById(R.id.txt_actionBar); + actionBarTV.setText("Fees Details"); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); + + /* View view3; + LayoutInflater inflater3 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view3 = inflater3.inflate(R.layout.pm_feessubmit_tablayout, null);*/ + + View view1; + LayoutInflater inflater1 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view1 = inflater1.inflate(R.layout.funding_tablelayout, null); + + View view2; + LayoutInflater inflater2 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view2 = inflater2.inflate(R.layout.fund_ticketstatus_tablayout, null); + + + TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); + // tabLayout.addTab(tabLayout.newTab().setCustomView(view3)); + tabLayout.addTab(tabLayout.newTab().setCustomView(view1)); + tabLayout.addTab(tabLayout.newTab().setCustomView(view2)); + + TabLayout.Tab selectedTab = tabLayout.getTabAt(0); + View view = selectedTab.getCustomView(); + + TextView selectedText = (TextView) view.findViewById(R.id.txt_fund); + selectedText.setTextColor(Color.parseColor("#000000")); + + + //tabLayout.addTab(tabLayout.newTab().setText("Tab 3")); + //tabLayout.setTabGravity(TabLayout.GRAVITY_FILL); + + final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); + final FundAdapter adapter = new FundAdapter(getSupportFragmentManager(), tabLayout.getTabCount()); + viewPager.setAdapter(adapter); + viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); + tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { + @Override + public void onTabSelected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.txt_fund); + selectedText.setTextColor(Color.parseColor("#000000")); + viewPager.setCurrentItem(tab.getPosition()); + } + + @Override + public void onTabUnselected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.txt_fund); + selectedText.setTextColor(Color.parseColor("#000000")); + } + + @Override + public void onTabReselected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.txt_fund); + selectedText.setTextColor(Color.parseColor("#000000")); + } + }); + + } + + + @Override + protected void onResume() { + super.onResume(); + + // register connection status listener + MyApplication.getInstance().setConnectivityListener(this); + } + + @Override + public void onNetworkConnectionChanged(boolean isConnected) { + showSnack(isConnected); + } + + private void showSnack(boolean isConnected) { + + if (!isConnected) { + + AlertDialog.Builder adb = new AlertDialog.Builder(FundMainActivity.this); + //adb.setView(alertDialogView); + + adb.setTitle("Sorry! Not connected to the internet"); + + adb.setIcon(android.R.drawable.ic_dialog_alert); + + adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + + adb.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + adb.setCancelable(true); + adb.show(); + } + +/* String message; + int color; + if (isConnected) { + message = "Good! Connected to Internet"; + color = Color.WHITE; + } else { + message = "Sorry! Not connected to internet"; + color = Color.RED; + } + + Snackbar snackbar = Snackbar + .make(findViewById(R.id.coordinator_layout), message, Snackbar.LENGTH_LONG); + + View sbView = snackbar.getView(); + TextView textView = (TextView) sbView.findViewById(android.support.design.R.id.snackbar_text); + textView.setTextColor(color); + snackbar.show();*/ + } + + + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_fees, menu); + MenuItem action_editProfile = menu.findItem(R.id.action_editProfile); + action_editProfile.setVisible(false); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + if(id == R.id.action_feesCollect){ + Intent ittFeesPaidToHome = new Intent(FundMainActivity.this ,ManagerFeesCollectionActivity.class); + startActivity(ittFeesPaidToHome); + return true; + } + if (id == android.R.id.home) { + Intent ittFeesPaidToHome = new Intent(FundMainActivity.this ,PMHomeActivity.class); + startActivity(ittFeesPaidToHome); + return true; + } + + + if (id == R.id.action_logout) { + Intent ittFeesToLogin = new Intent(FundMainActivity.this ,LoginActivity.class); + startActivity(ittFeesToLogin); + return true; + } + + return super.onOptionsItemSelected(item); + } +} diff --git a/app/src/main/java/com/leadcampusapp/FundStudListAdapter.java b/app/src/main/java/com/leadcampusapp/FundStudListAdapter.java new file mode 100644 index 0000000..cae0c28 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/FundStudListAdapter.java @@ -0,0 +1,354 @@ +package com.leadcampusapp; + +import android.app.Activity; +import android.content.Intent; +import android.net.Uri; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.CheckBox; +import android.widget.ListAdapter; +import android.widget.ListView; +import android.widget.RadioButton; +import android.widget.RadioGroup; +import android.widget.SimpleAdapter; +import android.widget.TextView; + +import androidx.appcompat.widget.SwitchCompat; + +import java.util.ArrayList; +import java.util.HashMap; + +//import com.android.sripad.leadnew_22_6_2018.R; + +/** + * Created by Admin on 28-05-2018. + */ + +public class FundStudListAdapter extends BaseAdapter{ + + public ArrayList feesUnPaidList; + Activity activity; + private ArrayList mDisplayedValues = null; + TicketCheckBoxAdapter adapter; + HashMap map1, map2; + ArrayList> mylist, mylist_title; + + public Class_Fund_Details[] classFundDetails; + public FundStudListAdapter(Activity activity, ArrayList feesUnPaidList) { + super(); + this.activity = activity; + this.feesUnPaidList = feesUnPaidList; + } + + @Override + public int getCount() { + //return projList.size(); + return feesUnPaidList.size(); + } + + @Override + public Class_FundStudList getItem(int position) { + + //return projList.get(position); + return feesUnPaidList.get(position); + } + + @Override + public long getItemId(int position) { + return position; + } + + class ViewHolder { + TextView mstudName; + TextView mleadId; + TextView mprojTitle; + TextView mCollegeName; + TextView mPhoneNumber; + TextView mMailId; + TextView regId; + NonScrollListView mStud_detailList; + TextView districtId; + TextView cityId; + TextView streamId; + TextView mcollgId; + TextView txt_Fees; + TextView paymentMode; + CheckBox mStatus; + SwitchCompat simpleSwitch; + RadioGroup paymentMode_radiogroup; + RadioButton rdb_Online,rdb_Cash; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + + final ViewHolder holder; + LayoutInflater inflater = activity.getLayoutInflater(); + + if (convertView == null) { + convertView = inflater.inflate(R.layout.fundlist_activity, null); + holder = new ViewHolder(); + + holder.mstudName = (TextView) convertView.findViewById(R.id.txt_studName); + holder.mleadId = (TextView) convertView.findViewById(R.id.txt_leadId); + holder.mprojTitle = (TextView) convertView.findViewById(R.id.txt_projTitle); + holder.mCollegeName = (TextView) convertView.findViewById(R.id.txt_collegeName); + holder.mPhoneNumber = (TextView) convertView.findViewById(R.id.txt_phoneNumber); + holder.mMailId = (TextView)convertView.findViewById(R.id.txt_mailId); + holder.mStud_detailList = (NonScrollListView) convertView.findViewById(R.id.stud_detailList); + + /* holder.regId = (TextView) convertView.findViewById(R.id.regId); + holder.stateId = (TextView) convertView.findViewById(R.id.stateId); + holder.districtId = (TextView) convertView.findViewById(R.id.districtId); + holder.cityId = (TextView) convertView.findViewById(R.id.cityId); + holder.streamId = (TextView) convertView.findViewById(R.id.streamId); + holder.mcollgId = (TextView) convertView.findViewById(R.id.collgId); + holder.txt_Fees = (TextView) convertView.findViewById(R.id.txt_Fees); + + holder.mStatus = (CheckBox) convertView.findViewById(R.id.check_status); + holder.simpleSwitch = (SwitchCompat) convertView.findViewById(R.id.SwitchPaymentMode); // initiate Switch + holder.paymentMode =(TextView) convertView.findViewById(R.id.paymentModenew); + holder.paymentMode_radiogroup=(RadioGroup) convertView.findViewById(R.id.paymentMode_radiogroup); + holder.rdb_Cash=(RadioButton) convertView.findViewById(R.id.rdb_Cash); + holder.rdb_Online=(RadioButton)convertView.findViewById(R.id.rdb_Online);*/ + + convertView.setTag(holder); + } else { + holder = (ViewHolder) convertView.getTag(); + } + + Class_FundStudList item = feesUnPaidList.get(position); + + if(item.getStudent_Name()!=null) { + holder.mstudName.setText(item.getStudent_Name().toString()); + } + if(item.getMobile_No()!=null) { + holder.mPhoneNumber.setText(item.getMobile_No().toString()); + } + if(item.getCollege_Name()!=null) { + holder.mCollegeName.setText(item.getCollege_Name().toString()); + } + if(item.getLead_Id()!=null) { + holder.mleadId.setText(item.getLead_Id().toString()); + } + if(item.getEmail_Id()!=null) { + holder.mMailId.setText(item.getEmail_Id().toString()); + } + feesUnPaidList.get(position).getFund_details(); + classFundDetails=feesUnPaidList.get(position).getFund_details(); + ArrayList classFundDetailshh=new ArrayList<>(); + for (int i = 0; i < classFundDetails.length; i++) { + classFundDetailshh.add(classFundDetails[i]); + } + + + Log.e("tag","fund details classFundDetails="+String.valueOf(classFundDetails.length)); + Log.e("tag","fund details classFundDetailshh="+String.valueOf(classFundDetailshh.size())); + + int count=classFundDetails.length; + /* mylist = new ArrayList>(); + + for (int i = 0; i < classFundDetails.length; i++) { + + map2 = new HashMap(); + Log.e("tag","fund details="+String.valueOf(classFundDetails[i].getProject_Title())); + + map2.put("one", classFundDetails[i].getProject_Title()); + map2.put("two", classFundDetails[i].getRequested_Amount()); + map2.put("three", classFundDetails[i].getSantioned_Amount()); + map2.put("four", classFundDetails[i].getReleased_Amount()); + map2.put("six", classFundDetails[i].getBalance_Amount()); + *//* if(FundProjectList.listview_arr.get(i).getSanctionAmount().equals("0")){ + map2.put("five", String.valueOf(R.drawable.no_cash_bag)); + } + else { + map2.put("five", String.valueOf(R.drawable.cash_bag)); + }*//* + + *//* map2.put("seven", FundProjectList.listview_arr.get(i).getLead_id()); + map2.put("eight", FundProjectList.listview_arr.get(i).getProject_id());*//* + //map2.put("nine", FundProjectList.listview_arr.get(i).getBalanceAmount()); + map2.put("five", ""); + mylist.add(map2); + } + + try { + adapter = new SimpleAdapter(parent.getContext(), mylist, R.layout.pmticket_fund_list, + new String[]{"one", "two","three","four","six","five"}, new int[]{ + R.id.ProjectTittle, R.id.tv_Requested, R.id.tv_Sanctioned, R.id.tv_Released, R.id.tv_Balance,R.id.check_status}); + holder.mStud_detailList.setAdapter(adapter); + } catch (Exception e) { + + }*/ + /* holder.mStud_detailList.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + } + });*/ + adapter = new TicketCheckBoxAdapter((Activity) parent.getContext(),classFundDetailshh); + holder.mStud_detailList.setAdapter(adapter); + // adapter=new TicketCheckBoxAdapter(parent.getContext(),R.layout.pmti,MainActivity.OptiesArray); + //holder.editText.setAdapter(adapter); + /* if(item.getRegistration_Id()!=null) { + holder.regId.setText(item.getRegistration_Id().toString()); + }*/ + /* if(item.getStateCode()!=null) { + holder.stateId.setText(item.getStateCode().toString()); + } + if(item.getDistrictCode()!=null) { + holder.districtId.setText(item.getDistrictCode().toString()); + } + if(item.getTalukaCode()!=null) { + holder.cityId.setText(item.getTalukaCode().toString()); + } + if(item.getStreamId()!=null) { + holder.streamId.setText(item.getStreamId().toString()); + } + if(item.getCollegeCode()!=null) { + holder.mcollgId.setText(item.getCollegeCode().toString()); + } + if(item.getFees()!=null) { + holder.txt_Fees.setText(item.getFees().toString()); + }*/ + /*else{ + holder.mRegistrationDate.setText(""); + }*/ + + if(item.getStatus().toString().equals("1")) { + holder.mStatus.setChecked(true); + //holder.mStatus.setSelected(true); + } + if(item.getStatus().toString().equals("0")) { + holder.mStatus.setChecked(false); + //holder.mStatus.setSelected(false); + } + + holder.mPhoneNumber.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(Intent.ACTION_DIAL); + intent.setData(Uri.parse("tel:"+holder.mPhoneNumber.getText().toString())); + v.getContext().startActivity(intent); + } + }); + /* holder.mStatus.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Log.d("insidelistview","listview clicked"); + notifyDataSetChanged(); + } + });*/ + /* holder.rdb_Online.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { +// set Yes values in ArrayList if RadioButton is checked + if (isChecked) + //selectedAnswers.set(position, "2"); + feesUnPaidList.get(position).setPayment_Mode("2"); + + } + });*/ +// perform setOnCheckedChangeListener event on no button + /* holder.rdb_Cash.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { +// set No values in ArrayList if RadioButton is checked + if (isChecked) + // selectedAnswers.set(position, "1"); + feesUnPaidList.get(position).setPayment_Mode("1"); + // holder.paymentMode.setText(selectedAnswers.get(position).toString()); + } + }); + //final CheckBox checkboxSelected = holder.mStatus; + final int pos = position; + if(holder.rdb_Cash.isChecked()) + { holder.paymentMode.setText("1"); + feesUnPaidList.get(pos).setPayment_Mode("1"); + }else if(holder.rdb_Online.isChecked()){ + holder.paymentMode.setText("2"); + feesUnPaidList.get(pos).setPayment_Mode("2"); + }*/ + final int pos = position; + /* holder.mStatus.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + Log.d("insidelistview","listview clicked"); + + if(isChecked) { + Log.d("ischhecked","true"); + holder.mStatus.setChecked(true); + //holder.mStatus.setEnabled(true); + feesUnPaidList.get(pos).setStatus("1"); + }else{ + Log.d("ischhecked","false"); + holder.mStatus.setChecked(false); + feesUnPaidList.get(pos).setStatus("0"); + } + //notifyDataSetChanged(); + //holder.mStatus.setChecked(true); + //holder.mStatus.setSelected(true); + + } + }); +*/ + + + + /* Button btn_selectAll; + btn_selectAll = (Button) + btn_selectAll.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Log.d("lview.getCount()iss", String.valueOf(lview.getCount())); + for (int i = 0; i < lview.getCount(); i++) { + View vw = lview.getAdapter().getView(i,null,null); + CheckBox checkBox = (CheckBox) vw.findViewById(R.id.check_status); + Log.d("checkboxstatusissss", String.valueOf(checkBox.isChecked())); + checkBox.setChecked(true); + Log.d("checkboxstatusissss2", String.valueOf(checkBox.isChecked())); + lview.setAdapter(adapter); + adapter.notifyDataSetChanged(); + } + } + });*/ + + + return convertView; + } + + + public void filter(String charText,ArrayList feesList) { + //charText = charText.toLowerCase(Locale.getDefault()); + //Log.d("charTextissss",charText); + this.feesUnPaidList.clear(); + + /* for(FeesUnpaidModel feesUnpaidModel : feesList){ + String stdName = feesUnpaidModel.getStudent_name().toString(); + //Log.d("StudeNameissssss",stdName); + }*/ + + if(charText!=null) { + if(feesList!=null) { + if (charText.isEmpty() || charText.length() == 0) { + this.feesUnPaidList.addAll(feesList); + } else { + for (Class_FundStudList wp : feesList) { + //Log.d("GetCollegeNameissss",wp.getCollege_name().toLowerCase((Locale.getDefault()))); + /* if (wp.getCollege_name().toLowerCase(Locale.getDefault()).contains(charText) || wp.getLead_id().toLowerCase(Locale.getDefault()).contains(charText) || wp.getPhone_number().toLowerCase(Locale.getDefault()).contains(charText) || wp.getStudent_name().toLowerCase(Locale.getDefault()).contains(charText) || wp.getPhone_number().toLowerCase(Locale.getDefault()).contains(charText)) { + this.feesUnPaidList.add(wp); + }*/ + if ((wp.getCollege_Name()!=null && wp.getCollege_Name().toLowerCase().contains(charText.toLowerCase())) || ( wp.getLead_Id()!=null && wp.getLead_Id().toLowerCase().contains(charText.toLowerCase())) || ( wp.getMobile_No()!=null && wp.getMobile_No().toLowerCase().contains(charText.toLowerCase())) || ( wp.getStudent_Name()!=null && wp.getStudent_Name().toLowerCase().contains(charText.toLowerCase()) ) || ( wp.getMobile_No()!=null && wp.getMobile_No().toLowerCase().contains(charText.toLowerCase()))) { + this.feesUnPaidList.add(wp); + } + + } + } + notifyDataSetChanged(); + } + } + } +} diff --git a/app/src/main/java/com/leadcampusapp/Fund_TicketStatus_Fragment.java b/app/src/main/java/com/leadcampusapp/Fund_TicketStatus_Fragment.java new file mode 100644 index 0000000..4c6620b --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Fund_TicketStatus_Fragment.java @@ -0,0 +1,1246 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 20-07-2018. + */ + +import android.annotation.SuppressLint; +import android.app.AlertDialog; +import android.app.DatePickerDialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.Color; +import android.os.AsyncTask; +import android.os.Bundle; +import android.text.Editable; +import android.text.TextWatcher; +import android.util.Base64; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.BaseAdapter; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.DatePicker; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.ListView; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.appcompat.widget.AppCompatSpinner; +import androidx.core.content.ContextCompat; +import androidx.fragment.app.Fragment; +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; + +import org.json.JSONArray; +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.LinkedHashSet; +import java.util.Locale; + +//import com.android.sripad.leadnew_22_6_2018.R; + +public class Fund_TicketStatus_Fragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener +{ + int count=0; + + private ArrayList feesList; + private View view; + private boolean isCompletedflag=false; + private int projectStatusIcon; + // private FeesUnpaidAdapter adapter; + + public static final String PREFBook_Stud= "prefbook_stud"; //sharedpreference Book + public static final String PrefID_RegID = "prefid_regid"; // + public static final String PrefID_SName = "prefid_sname"; // + public static final String PrefID_PM_SName = "prefid_pmsname"; // + public static final String PrefID_SLeadID = "prefid_sleadid"; // + public static final String PrefID_PM_SEmailID = "prefid_pm_semailid"; // + public static final String PrefID_SCellNo = "prefid_scellno"; // + + private SharedPreferences shardpref_S_obj; + private String str_leadId,str_RegistrationId; + private ProgressDialog progressDialog; + + private EditText etSearch; + + private ListView lview_fundticketstatus; + private ArrayList originalList = null; + + private int countProposed=0; + private int countReapply=0; + private int countRequestForCompletion=0; + private int countApproved=0; + private int countRejected=0; + private int countCompleted=0; + + private Button btn_generateReport; + public static final String PrefID_PMID = "prefid_pmid"; // + public static final String PREFBook_PM= "prefbook_pm"; + SharedPreferences shardprefPM_obj; + public String str_MangerID; + private AppCompatSpinner spin_college; + private TextView txt_selectAll; + private LinkedHashSet collegeNameLst; + private ArrayList collegeNameArrLst; + + private Button btn_selectAll,btn_selectNone,btn_submit,btn_submitnew; + private CheckBox chk_selectAll; + private Context context; + + private String str_leadIdOverall=""; + + //private String + private int counts=0; + private int counter=0; + private ArrayList arrayLeadId; + private SwipeRefreshLayout swipeLayout; + private TextView txt_actualTotalCounts; + AppCompatSpinner spin_year,spin_feesCategory; + + int YearListCount,feesCatglistcount; + String str_YearListStatus,yearID,str_FeesCatgStatus,str_feesCatSlno,str_feesCatName,str_yearID,str_yearCode,str_feesID; + Class_YearList[] arrayObj_Class_YearList; + Class_YearList obj_Class_YearList; + ArrayAdapter dataAdapter_yearList,dataAdapter_feesCatg,dataAdapter_college; + Class_FeesCatg[] arrayObj_Class_FeesCatg; + Class_FeesCatg obj_Class_FeesCatg; + + Class_Colleges[] arrayObj_Class_Colleges, arrayObj_Class_Colleges2,arrayObj_Class_Colleges3; + Class_Colleges obj_Class_Colleges; + int collegeslistcount,MDId,studentlistcount; + String str_CollegesStatus,str_ColID="x"; + String str_studListStatus; + Class_UnpaidStudList[] arrayObj_Class_studList; + Class_UnpaidStudList obj_Class_studList; + String str_remark; + JSONArray jsonArray_submit = new JSONArray(); + String str_paymentMode; + Class_InternetDectector internetDectector; + Boolean isInternetPresent = false; + EditText stfonlinetrans_no_tv,stfonlinetransAmount_tv,stfamountbycash_tv,stfonline_receiptno_tv,stfamountbycash_receiptno_tv; + + AppCompatSpinner spin_ticketStatus; + Class_Project_FundMain obj_Class_Project_FundMain; + String str_ticketSlno,str_ticketStatus,str_Status; + int ticketStatusCount; + Class_Project_FundMain[] arrayObj_Class_TicketStatus; + + ArrayAdapter adapter_ticketStatus; + + EditText edt_fromdate,edt_todate_ticket,fromdateseterror_TV,todateseterror_TV; + private int mYear, mMonth, mDay; + private int cYear, cMonth, cDay; + Class_FromToDate[] arrayObj_Class_FromToDate; + String FromDate,ToDate; + String str_FromToDateStatus; + int From_ToDateCount; + // String yearID,str_yearID; + ListView lv_summary; + ImageView FromToDate_btn; + + Class_fundticket_resp[] class_fundticketresp_arrayobj; + Class_fundticket_resp class_fundticketresp_obj; + String str_fundticketstatus; + + // EditText userInput; + @SuppressLint("RestrictedApi") + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + + view=inflater.inflate(R.layout.activity_project_fundticket_main, container, false); + + /*swipeLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipe_container); + swipeLayout.setOnRefreshListener(this); + swipeLayout.setColorScheme(android.R.color.holo_blue_bright, + android.R.color.holo_green_light, + android.R.color.holo_orange_light, + android.R.color.holo_red_light); + + +*/ + txt_actualTotalCounts = (TextView) view.findViewById(R.id.txt_actualTotalCount); + + initializeviews(); + + ArrayList arrayList = new ArrayList<>(); + arrayList.add("Pending"); + arrayList.add("Manager Reject"); + arrayList.add("Accontent Reject"); + + + FromToDate_btn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + AsyncCall_GetFundStatus getfundstatus=new AsyncCall_GetFundStatus(getContext()); + getfundstatus.execute(); + } + }); + + adapter_ticketStatus = new ArrayAdapter(getContext(), R.layout.spinnercustomstyle, arrayList); + //dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + adapter_ticketStatus.setDropDownViewResource(R.layout.spinnercustomstyle); + // districtsearch_ATV.setAdapter(dataAdapter_district); + spin_ticketStatus.setAdapter(adapter_ticketStatus); + spin_ticketStatus.setSupportBackgroundTintList(ContextCompat.getColorStateList(getContext(), R.color.colorBlack)); + + spin_ticketStatus.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected (AdapterView < ? > parent, View view, + int position, long id){ + // TODO Auto-generated method stub + // obj_Class_Project_FundMain = (Class_Project_FundMain) spin_ticketStatus.getSelectedItem(); + + String ticketStatus = parent.getItemAtPosition(position).toString(); + + if(ticketStatus.equalsIgnoreCase("Manager Reject")){ + str_ticketStatus="MR"; + }else if(ticketStatus.equalsIgnoreCase("Accontent Reject")){ + str_ticketStatus="AR"; + }else if(ticketStatus.equalsIgnoreCase("Pending")){ + str_ticketStatus="Pending"; + } +// str_ticketSlno = obj_Class_Project_FundMain.getSlno().toString(); + // str_ticketStatus = obj_Class_Project_FundMain.getTicket_Status().toString(); + + Log.e("tag","str_ticketStatus="+str_ticketStatus); + + // Toast.makeText(getApplicationContext(),"str_Programsid: "+str_programid,Toast.LENGTH_SHORT).show(); + } + + @Override + public void onNothingSelected (AdapterView < ? > parent){ + // TODO Auto-generated method stub + } + }); + + /*edt_fromdate.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + final Calendar c = Calendar.getInstance(); + + mYear = c.get(Calendar.YEAR); + mMonth = c.get(Calendar.MONTH); + mDay = c.get(Calendar.DAY_OF_MONTH); + + DatePickerDialog datePickerDialog = new DatePickerDialog(getContext(), R.style.DatePickerTheme, + new DatePickerDialog.OnDateSetListener() { + + @Override + public void onDateSet(DatePicker view, int year, + int monthOfYear, int dayOfMonth) { + + cDay = dayOfMonth; + cMonth = monthOfYear; + cYear = year; + + // String date =dayOfMonth + "/" + (monthOfYear + 1) + "/" + year; + // String date =year + "-" + (monthOfYear + 1) + "-" + dayOfMonth; + String date =dayOfMonth + "-" + (monthOfYear + 1) + "-" + year; + + + SimpleDateFormat dateFormat= new SimpleDateFormat("dd-MM-yyyy"); + // SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd"); + + try { + Date d=dateFormat.parse(date); + System.out.println("Formated from"+dateFormat.format(d)); + fromdateseterror_TV.setVisibility(View.GONE); + edt_fromdate.setText(dateFormat.format(d).toString()); + + } + catch(Exception e) { + //java.text.ParseException: Unparseable date: Geting error + System.out.println("Excep"+e); + } + //TextView txtExactDate = (TextView) findViewById(R.id.txt_exactDate); + + + //txtDate.edita + } + }, mYear, mMonth, mDay); + + datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()); + //datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()-(1000 * 60 * 60 * 24 * 365 * 14)); + // - (1000 * 60 * 60 * 24 * 365.25 * 14) +//------ + + datePickerDialog.show(); + // originalList.clear(); + spin_ticketStatus.setSelection(0); + //adapter.notifyDataSetChanged(); + } + }); + edt_todate_ticket.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + final Calendar c = Calendar.getInstance(); + + mYear = c.get(Calendar.YEAR); + mMonth = c.get(Calendar.MONTH); + mDay = c.get(Calendar.DAY_OF_MONTH); + + DatePickerDialog datePickerDialog = new DatePickerDialog(getContext(), R.style.DatePickerTheme, + new DatePickerDialog.OnDateSetListener() { + + @Override + public void onDateSet(DatePicker view, int year, + int monthOfYear, int dayOfMonth) { + + cDay = dayOfMonth; + cMonth = monthOfYear; + cYear = year; + + // String date =dayOfMonth + "/" + (monthOfYear + 1) + "/" + year; + // String date =year + "-" + (monthOfYear + 1) + "-" + dayOfMonth; + String date =dayOfMonth + "-" + (monthOfYear + 1) + "-" + year; + + + SimpleDateFormat dateFormat= new SimpleDateFormat("dd-MM-yyyy"); + // SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd"); + + try { + Date d=dateFormat.parse(date); + System.out.println("Formated to"+dateFormat.format(d)); + todateseterror_TV.setVisibility(View.GONE); + edt_todate_ticket.setText(dateFormat.format(d).toString()); + + } + catch(Exception e) { + //java.text.ParseException: Unparseable date: Geting error + System.out.println("Excep"+e); + } + //TextView txtExactDate = (TextView) findViewById(R.id.txt_exactDate); + + + //txtDate.edita + } + }, mYear, mMonth, mDay); + + datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()); + //datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()-(1000 * 60 * 60 * 24 * 365 * 14)); + // - (1000 * 60 * 60 * 24 * 365.25 * 14) +//------ + + datePickerDialog.show(); + //originalList.clear(); + spin_ticketStatus.setSelection(0); + //adapter.notifyDataSetChanged(); + } + });*/ + edt_fromdate.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + final Calendar c = Calendar.getInstance(); + + mYear = c.get(Calendar.YEAR); + mMonth = c.get(Calendar.MONTH); + mDay = c.get(Calendar.DAY_OF_MONTH); + + DatePickerDialog datePickerDialog = new DatePickerDialog(getActivity(), R.style.DatePickerTheme, + new DatePickerDialog.OnDateSetListener() { + + @Override + public void onDateSet(DatePicker view, int year, + int monthOfYear, int dayOfMonth) { + + cDay = dayOfMonth; + cMonth = monthOfYear; + cYear = year; + + // String date =dayOfMonth + "/" + (monthOfYear + 1) + "/" + year; + // String date =year + "-" + (monthOfYear + 1) + "-" + dayOfMonth; + String date =dayOfMonth + "-" + (monthOfYear + 1) + "-" + year; + + + SimpleDateFormat dateFormat= new SimpleDateFormat("dd-MM-yyyy"); + // SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd"); + + try { + Date d=dateFormat.parse(date); + System.out.println("Formated from"+dateFormat.format(d)); + fromdateseterror_TV.setVisibility(View.GONE); + edt_fromdate.setText(dateFormat.format(d).toString()); + + } + catch(Exception e) { + //java.text.ParseException: Unparseable date: Geting error + System.out.println("Excep"+e); + } + //TextView txtExactDate = (TextView) findViewById(R.id.txt_exactDate); + + + //txtDate.edita + } + }, mYear, mMonth, mDay); + + datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()); + //datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()-(1000 * 60 * 60 * 24 * 365 * 14)); + // - (1000 * 60 * 60 * 24 * 365.25 * 14) +//------ + + datePickerDialog.show(); +// originalList.clear(); +// spin_college.setSelection(0); +// adapter.notifyDataSetChanged(); + } + }); + + + + + + edt_todate_ticket.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + final Calendar c = Calendar.getInstance(); + + mYear = c.get(Calendar.YEAR); + mMonth = c.get(Calendar.MONTH); + mDay = c.get(Calendar.DAY_OF_MONTH); + + DatePickerDialog datePickerDialog = new DatePickerDialog(getActivity(), R.style.DatePickerTheme, + new DatePickerDialog.OnDateSetListener() { + + @Override + public void onDateSet(DatePicker view, int year, + int monthOfYear, int dayOfMonth) { + + cDay = dayOfMonth; + cMonth = monthOfYear; + cYear = year; + + // String date =dayOfMonth + "/" + (monthOfYear + 1) + "/" + year; + // String date =year + "-" + (monthOfYear + 1) + "-" + dayOfMonth; + String date =dayOfMonth + "-" + (monthOfYear + 1) + "-" + year; + + + SimpleDateFormat dateFormat= new SimpleDateFormat("dd-MM-yyyy"); + // SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd"); + + try { + Date d=dateFormat.parse(date); + System.out.println("Formated from"+dateFormat.format(d)); + // todateseterror_TV.setVisibility(View.GONE); + edt_todate_ticket.setText(dateFormat.format(d).toString()); + + } + catch(Exception e) { + //java.text.ParseException: Unparseable date: Geting error + System.out.println("Excep"+e); + } + //TextView txtExactDate = (TextView) findViewById(R.id.txt_exactDate); + + + //txtDate.edita + } + }, mYear, mMonth, mDay); + + datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()); + //datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()-(1000 * 60 * 60 * 24 * 365 * 14)); + // - (1000 * 60 * 60 * 24 * 365.25 * 14) +//------ + + datePickerDialog.show(); +// originalList.clear(); +// spin_college.setSelection(0); +// adapter.notifyDataSetChanged(); + } + }); + +// edt_todate_ticket.setOnClickListener(new View.OnClickListener() { +// @Override +// public void onClick(View v) { +// final Calendar c = Calendar.getInstance(); +// +// mYear = c.get(Calendar.YEAR); +// mMonth = c.get(Calendar.MONTH); +// mDay = c.get(Calendar.DAY_OF_MONTH); +// +// DatePickerDialog datePickerDialog = new DatePickerDialog(getActivity(), R.style.DatePickerTheme, +// new DatePickerDialog.OnDateSetListener() { +// +// @Override +// public void onDateSet(DatePicker view, int year, +// int monthOfYear, int dayOfMonth) { +// +// cDay = dayOfMonth; +// cMonth = monthOfYear; +// cYear = year; +// +// // String date =dayOfMonth + "/" + (monthOfYear + 1) + "/" + year; +// // String date =year + "-" + (monthOfYear + 1) + "-" + dayOfMonth; +// String date =dayOfMonth + "-" + (monthOfYear + 1) + "-" + year; +// +// +// SimpleDateFormat dateFormat= new SimpleDateFormat("dd-MM-yyyy"); +// // SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd"); +// +// try { +// Date d=dateFormat.parse(date); +// System.out.println("Formated to"+dateFormat.format(d)); +// Log.e("tag","todate==="+dateFormat.format(d).toString()); +// todateseterror_TV.setVisibility(View.GONE); +// edt_fromdate.setText(dateFormat.format(d).toString()); +// +// } +// catch(Exception e) { +// //java.text.ParseException: Unparseable date: Geting error +// System.out.println("Excep"+e); +// } +// //TextView txtExactDate = (TextView) findViewById(R.id.txt_exactDate); +// +// +// //txtDate.edita +// } +// }, mYear, mMonth, mDay); +// +// datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()); +// //datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()-(1000 * 60 * 60 * 24 * 365 * 14)); +// // - (1000 * 60 * 60 * 24 * 365.25 * 14) +////------ +// +// datePickerDialog.show(); +// // originalList.clear(); +// // spin_college.setSelection(0); +// // adapter.notifyDataSetChanged(); +// // originalList.clear(); +// // spin_college.setSelection(0); +// // adapter.notifyDataSetChanged(); +// } +// }); + + return view; + } + + public void initializeviews() + { + lview_fundticketstatus = (ListView) view.findViewById(R.id.lv_summary); + + + feesList = new ArrayList(); + // adapter = new FeesUnpaidAdapter(getActivity(),feesList); + //lview_fundticketstatus.setAdapter(adapter); + + arrayLeadId = new ArrayList(); + + + shardprefPM_obj= getActivity().getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MangerID = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + Log.d("str_MangerID:",str_MangerID); + MDId=Integer.parseInt(str_MangerID); + + collegeNameLst = new LinkedHashSet(); + collegeNameLst.add("Select College"); + collegeNameArrLst = new ArrayList(); + + spin_college = (AppCompatSpinner) view.findViewById(R.id.spin_college); + + spin_ticketStatus= (AppCompatSpinner) view.findViewById(R.id.spin_ticketStatus); + edt_fromdate = (EditText) view.findViewById(R.id.edt_fromdate); + fromdateseterror_TV = (EditText) view.findViewById(R.id.fromdateseterror_TV); + edt_todate_ticket = (EditText) view.findViewById(R.id.edt_todate_ticket); + FromToDate_btn = (ImageView) view.findViewById(R.id.FromToDate_btn); + + //initCollegeSpinner(); + + // populateList(); + + str_fundticketstatus="false"; + GetFromToDateAsyncCallWS getFromToDateAsyncCallWS=new GetFromToDateAsyncCallWS(getContext()); + getFromToDateAsyncCallWS.execute(); + + + etSearch = (EditText) view.findViewById(R.id.etSearch); + + etSearch.addTextChangedListener(new TextWatcher() { + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { +// Call back the Adapter with current character to Filter + } + + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + } + + @Override + public void afterTextChanged(Editable s) { + + String text = etSearch.getText().toString().toLowerCase(Locale.getDefault()); + // adapter.filter(text, originalList); + + } + }); + + // Log.d("countisssss", String.valueOf(lview_fundticketstatus.getCount())); + + + + Log.d("ListviewCountissssss", String.valueOf(lview_fundticketstatus.getCount())); + //txt_actualTotalCount.setText(lview.getCount()); + + + } + + @Override + public void onRefresh() { + initializeviews(); + swipeLayout.setRefreshing(false); + } + + private class GetFromToDateAsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + /* dialog.setMessage("Please wait,District Loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show();*/ + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetFromToDate(); // get the District list + return null; + } + + public GetFromToDateAsyncCallWS(Context activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) { + + + if(str_FromToDateStatus.equals("Success")) + { + Log.e("tag","arrayObj_Class_FromToDate="+arrayObj_Class_FromToDate.length); + for (int j=0;jlong + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + + SoapObject response = (SoapObject ) envelope.getResponse(); + Log.e("response datelist",response.toString()); + From_ToDateCount = response.getPropertyCount(); + SoapObject summaryresponse=(SoapObject)response.getProperty(0); + str_FromToDateStatus=summaryresponse.getProperty("Status").toString(); + Log.d("datelistcount", String.valueOf(response.getPropertyCount())); + + + if(str_FromToDateStatus.equals("Success")) + { + if (From_ToDateCount > 0) { + arrayObj_Class_FromToDate = new Class_FromToDate[From_ToDateCount]; + for (int i = 0; i < From_ToDateCount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + + Class_FromToDate innerObj_Class_fromtodate = new Class_FromToDate(); + innerObj_Class_fromtodate.setAcademic_Code(response_soapobj.getProperty("Academic_Code").toString()); //1 + innerObj_Class_fromtodate.setAcademic_Id(response_soapobj.getProperty("Academic_Id").toString()); //Hubballi + innerObj_Class_fromtodate.setFrom_Date(response_soapobj.getProperty("From_Date").toString());// HB + innerObj_Class_fromtodate.setTo_Date(response_soapobj.getProperty("To_Date").toString());// <1 + innerObj_Class_fromtodate.setStatus(response_soapobj.getProperty("Status").toString());// <1 + innerObj_Class_fromtodate.setYear_Code(response_soapobj.getProperty("Year_Code").toString());// <1 + + str_FromToDateStatus = response_soapobj.getProperty("Status").toString(); + + arrayObj_Class_FromToDate[i] = innerObj_Class_fromtodate; + + }//end for loop + + }//end of if + + } + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + // internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + } + + + + //https://mis.leadcampus.org:8084/leadws/Managerws.asmx/Get_Fund_Status?Manager_Id=1&From_Date=2021-04-01&To_Date=2022-04-31 + private class TicketStatusAsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + /* dialog.setMessage("Please wait,District Loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show();*/ + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetFeesCatglist(); // get the District list + return null; + } + + public TicketStatusAsyncCallWS(Context activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + + //dialog.dismiss(); + + /*uploadfromDB_Statelist(); + uploadfromDB_Districtlist(); + setSpinner();*/ + // uploadfromDB_Districtlist(); + + + if(str_Status.equals("Success")) + { + + + adapter_ticketStatus = new ArrayAdapter(getContext(), R.layout.spinnercustomstyle, arrayObj_Class_TicketStatus); + //dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + adapter_ticketStatus.setDropDownViewResource(R.layout.spinnercustomstyle); + // districtsearch_ATV.setAdapter(dataAdapter_district); + spin_ticketStatus.setAdapter(adapter_ticketStatus); + spin_ticketStatus.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + // } + } + + + }//end of onPostExecute + }// end Async task + + public void GetFeesCatglist() + { + + String URL = Class_URL.URL_Manager.toString().trim(); + String METHOD_NAME = "Get_Master_Ticket_Status"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/Get_Master_Ticket_Status"; + + + + //for final + + + try { +//vijay district + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + + // request.addProperty("distid", Long.parseLong(str_Sids));//Long + + // request.addProperty("distid", 17);//Long + + //request.addProperty("stateId", 17);//Long + // long + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + // Log.i(TAG, "GetAllLoginDetails is running"); + // result1 = (Vector) envelope.getResponse(); + + // response = (SoapPrimitive) envelope.getResponse(); + + // SoapPrimitive res =(SoapPrimitive)envelope.getResponse(); + + SoapObject response = (SoapObject ) envelope.getResponse(); + Log.e("response TicketStatus",response.toString()); + ticketStatusCount = response.getPropertyCount(); + SoapObject districtresponse=(SoapObject)response.getProperty(0); + str_Status=districtresponse.getProperty("Status").toString(); + Log.d("ticketStatusCount", String.valueOf(response.getPropertyCount())); + + + if(str_Status.equals("Success")) { + if (ticketStatusCount > 0) { + arrayObj_Class_TicketStatus = new Class_Project_FundMain[ticketStatusCount]; + for (int i = 0; i < ticketStatusCount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + + Class_Project_FundMain innerObj_Class_Project_FundMain = new Class_Project_FundMain(); + innerObj_Class_Project_FundMain.setSlno(response_soapobj.getProperty("Slno").toString()); //1 + innerObj_Class_Project_FundMain.setTicket_Status(response_soapobj.getProperty("Ticket_Status").toString()); //Hubballi + innerObj_Class_Project_FundMain.setAccount_Alert_Days(response_soapobj.getProperty("Manager_Alert_Days").toString());// HB + innerObj_Class_Project_FundMain.setManager_Alert_Days(response_soapobj.getProperty("Account_Alert_Days").toString());// <1 + innerObj_Class_Project_FundMain.setStatus(response_soapobj.getProperty("Status").toString());// <1 + + str_Status = response_soapobj.getProperty("Status").toString(); + + arrayObj_Class_TicketStatus[i] = innerObj_Class_Project_FundMain; + + }//end for loop + + }//end of if + + } + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + // internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + } + + + + + private class AsyncCall_GetFundStatus extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + dialog.setMessage("Please wait,Fund status loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + getfundstatus(); // + return null; + } + + public AsyncCall_GetFundStatus(Context activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) + { + + dialog.dismiss(); + if (class_fundticketresp_arrayobj != null) + { + CustomAdapter_fundticketstatus adapter = new CustomAdapter_fundticketstatus(); + lview_fundticketstatus.setAdapter(adapter); + + int y = class_fundticketresp_arrayobj.length; + + Log.e("tag","lview_fundticketstatus=="+lview_fundticketstatus.getCount()); + // txt_actualTotalCounts.setText(lview_fundticketstatus.getCount()); + Log.e("length adapter", "" + y); + } else { + Log.d("length adapter", "zero"); + } + + + + + }//end of onPostExecute + }// end Async task + + + + + + public void getfundstatus() + { +//https://mis.leadcampus.org:8084/leadws/Managerws.asmx/Get_Fund_Status?Manager_Id=1&From_Date=2021-04-01&To_Date=2022-04-31 + String URL = Class_URL.URL_Manager.toString().trim(); + String METHOD_NAME = "Get_Fund_Status"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/Get_Fund_Status"; + + + + + + + try { + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + + + + + + request.addProperty("Manager_Id", 1);//int + request.addProperty("From_Date", "2021-04-01");//string + request.addProperty("To_Date", "2022-04-31");//string + // long + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + // Log.i(TAG, "GetAllLoginDetails is running"); + // result1 = (Vector) envelope.getResponse(); + + // response = (SoapPrimitive) envelope.getResponse(); + + // SoapPrimitive res =(SoapPrimitive)envelope.getResponse(); + + /*E/resp_getticket: anyType{vmGet_Funding_Status=anyType{Ticket_Id=1; Requeted_By=Abhinandan; + Requested_Date=04-05-2021; Approved_By=Pending; Approved_Date= ; + Approved_Remark= ; Approval_Status=Pending; Requested_Project=2; + Manager_Approved_Project=0; Account_Approved_Project=0; Requested_Amount=200; + Manager_Approved_Amount=0; Account_Approved_Amount=0; status=success; }; + + vmGet_Funding_Status=anyType{Ticket_Id=2; Requeted_By=Abhinandan; + Requested_Date=05-05-2021; Approved_By=Pending; Approved_Date= ; Approved_Remark= ; + Approval_Status=Pending; Requested_Project=3; Manager_Approved_Project=0; + Account_Approved_Project=0; Requested_Amount=203; Manager_Approved_Amount=0; + Account_Approved_Amount=0; status=success; }; + vmGet_Funding_Status=anyType{Ticket_Id=3; Requeted_By=Abhinandan; Requested_Date=06-05-2021; + Approved_By=Pending; Approved_Date= ; Approved_Remark= ; Approval_Status=Pending; + Requested_Project=7; Manager_Approved_Project=0; Account_Approved_Project=0; + Requested_Amount=11; Manager_Approved_Amount=0; Account_Approved_Amount=0; status=success; }; } + + 2021-05-17 10:09:07.100 18299-18655/com.leadcampusapp E/ticketStatusCount1: 3*/ + + SoapObject response = (SoapObject ) envelope.getResponse(); + Log.e("resp_getfundticket",response.toString()); + int fundticketStatusCount1 = response.getPropertyCount(); + + Log.e("fundticketStatusCount1", String.valueOf(fundticketStatusCount1)); + + if(fundticketStatusCount1>0) { + + SoapObject fundticketresponse = (SoapObject) response.getProperty(0); + str_fundticketstatus = fundticketresponse.getProperty("status").toString(); + Log.d("fundticketStatusCount", String.valueOf(response.getPropertyCount())); + + + + class_fundticketresp_arrayobj = new Class_fundticket_resp[fundticketStatusCount1]; + + for (int i = 0; i < fundticketStatusCount1; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + + Class_fundticket_resp innerObj_class_fundtickekresp = new Class_fundticket_resp(); + innerObj_class_fundtickekresp.setStr_ticketid(response_soapobj.getProperty("Ticket_Id").toString()); //1 + innerObj_class_fundtickekresp.setStr_requestedby(response_soapobj.getProperty("Requeted_By").toString());//Requeted_By + innerObj_class_fundtickekresp.setStr_requesteddate(response_soapobj.getProperty("Requested_Date").toString());//Requested_Date + innerObj_class_fundtickekresp.setStr_approvedby(response_soapobj.getProperty("Approved_By").toString());//Approved_By + innerObj_class_fundtickekresp.setStr_approveddate(response_soapobj.getProperty("Approved_Date").toString());//Approved_Date + innerObj_class_fundtickekresp.setStr_approvedremarks(response_soapobj.getProperty("Approved_Remark").toString());//Approved_Remark + innerObj_class_fundtickekresp.setStr_approvalstatus(response_soapobj.getProperty("Approval_Status").toString());//Approval_Status + innerObj_class_fundtickekresp.setStr_requestedproject(response_soapobj.getProperty("Requested_Project").toString());//Requested_Project + innerObj_class_fundtickekresp.setStr_managerapprovedproject(response_soapobj.getProperty("Manager_Approved_Project").toString());//Manager_Approved_Project + innerObj_class_fundtickekresp.setStr_accountapprovedprojects(response_soapobj.getProperty("Account_Approved_Project").toString());//Account_Approved_Project + innerObj_class_fundtickekresp.setStr_requestedamount(response_soapobj.getProperty("Requested_Amount").toString());//Requested_Amount + innerObj_class_fundtickekresp.setStr_managerapprovedamount(response_soapobj.getProperty("Manager_Approved_Amount").toString());//Manager_Approved_Amount + innerObj_class_fundtickekresp.setStr_accountapprovedamount(response_soapobj.getProperty("Account_Approved_Amount").toString());// + innerObj_class_fundtickekresp.setStr_status(response_soapobj.getProperty("status").toString());//status + + + str_Status = response_soapobj.getProperty("status").toString(); + + class_fundticketresp_arrayobj[i] = innerObj_class_fundtickekresp; + class_fundticketresp_arrayobj[i].getStr_ticketid().toString(); + + + } + + } + + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + // internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + } + + + private class Holder_offline { + + TextView holder_ticketid_tv; + TextView holder_reqesteddate_tv; + TextView holder_approveddate_tv; + TextView holder_approvedby_tv; + TextView holder_approvedstatus_tv; + TextView holder_reqestedamount_tv; + TextView holder_approvedamount_tv; + TextView holder_openclose_tv; + ImageView holder_fund_ticketstatusinfo_iv; + LinearLayout holder_listview_ll; + LinearLayout holder_listview_noitems_ll; + } + + + + public class CustomAdapter_fundticketstatus extends BaseAdapter + { + + + public CustomAdapter_fundticketstatus() { + + super(); + Log.d("Inside CustomAdapter()", "Inside CustomAdapter()"); + } + + @Override + public int getCount() { + + String x = Integer.toString(class_fundticketresp_arrayobj.length); + System.out.println("class_fundticketresp_arrayobj.length" + x); + return class_fundticketresp_arrayobj.length; + } + + @Override + public Object getItem(int position) { + String x = Integer.toString(position); + Log.d("getItem position", "x"); + return class_fundticketresp_arrayobj[position]; + } + + + @Override + public long getItemId(int position) { + String x = Integer.toString(position); + + Log.d("getItemId position", x); + return position; + } + + @Override + public View getView(int position, View convertView1, ViewGroup parent) { + + final Holder_offline holder; + + Log.d("CustomAdapter", "position: " + position); + + if (convertView1 == null) + { + holder = new Holder_offline(); + convertView1 = LayoutInflater.from(getActivity()).inflate(R.layout.listview_rowitem_fundticketstatus, parent, false); + + + holder.holder_listview_ll= (LinearLayout) convertView1.findViewById(R.id.listview_ll); + holder.holder_listview_noitems_ll= (LinearLayout) convertView1.findViewById(R.id.listview_noitems_ll); + holder.holder_ticketid_tv= (TextView) convertView1.findViewById(R.id.ticketid_tv); + holder.holder_openclose_tv= (TextView) convertView1.findViewById(R.id.openclose_tv); + holder.holder_fund_ticketstatusinfo_iv= (ImageView) convertView1.findViewById(R.id.fund_ticketstatusinfo_iv); + + holder.holder_reqesteddate_tv = (TextView) convertView1.findViewById(R.id.reqesteddate_tv); + holder.holder_approveddate_tv = (TextView) convertView1.findViewById(R.id.approveddate_tv); + holder.holder_approvedstatus_tv = (TextView) convertView1.findViewById(R.id.approvedby_tv); + + holder.holder_approvedby_tv = (TextView) convertView1.findViewById(R.id.approvedstatus_tv); + holder.holder_reqestedamount_tv = (TextView) convertView1.findViewById(R.id.reqestedamount_tv); + holder.holder_approvedamount_tv = (TextView) convertView1.findViewById(R.id.approvedamount_tv); + + + Log.d("Inside If convertView1", "Inside If convertView1"); + + convertView1.setTag(holder); + + } else { + holder = (Holder_offline) convertView1.getTag(); + Log.d("else convertView1", "else convertView1"); + } + + // Class_farmponddetails_offline farmponddetails_obj; + class_fundticketresp_obj = (Class_fundticket_resp) getItem(position); + + + if (class_fundticketresp_obj != null) + { + holder.holder_ticketid_tv.setText(class_fundticketresp_obj.getStr_ticketid()); + holder.holder_reqesteddate_tv.setText(class_fundticketresp_obj.getStr_requesteddate()); + holder.holder_approveddate_tv.setText(class_fundticketresp_obj.getStr_approveddate()); + holder.holder_approvedby_tv.setText(class_fundticketresp_obj.getStr_approvedby()); + holder.holder_approvedstatus_tv.setText(class_fundticketresp_obj.getStr_approvalstatus()); + holder.holder_reqestedamount_tv.setText(class_fundticketresp_obj.getStr_requestedamount()); + holder.holder_approvedamount_tv.setText(class_fundticketresp_obj.getStr_accountapprovedamount()); + + }else{ + holder.holder_listview_ll.setVisibility(View.GONE); + holder.holder_listview_noitems_ll.setVisibility(View.VISIBLE); + } + + holder.holder_fund_ticketstatusinfo_iv.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + LayoutInflater li = LayoutInflater.from(getContext()); + View promptsView = li.inflate(R.layout.alert_dialog_fundticketdetails, null); + + AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder( + getContext()); + + // set alert_dialog.xml to alertdialog builder + alertDialogBuilder.setView(promptsView); + + final TextView ReqBy_tv = (TextView) promptsView.findViewById(R.id.ReqBy_tv); + final TextView approvedremark_tv = (TextView) promptsView.findViewById(R.id.approvedremark_tv); + final TextView reqProject_tv = (TextView) promptsView.findViewById(R.id.reqProject_tv); + final TextView approvedProject_tv = (TextView) promptsView.findViewById(R.id.approvedProject_tv); + final TextView accStatus_tv = (TextView) promptsView.findViewById(R.id.accStatus_tv); + final TextView accRemark_tv = (TextView) promptsView.findViewById(R.id.accRemark_tv); + final TextView accAppProj_tv = (TextView) promptsView.findViewById(R.id.accAppProj_tv); + + // set dialog message + + // create alert dialog + AlertDialog alertDialog = alertDialogBuilder.create(); + + ReqBy_tv.setText(class_fundticketresp_obj.getStr_requestedby()); + approvedremark_tv.setText(class_fundticketresp_obj.getStr_approvedremarks()); + reqProject_tv.setText(class_fundticketresp_obj.getStr_requestedproject()); + approvedProject_tv.setText(class_fundticketresp_obj.getStr_managerapprovedproject()); + accAppProj_tv.setText(class_fundticketresp_obj.getStr_accountapprovedprojects()); + accStatus_tv.setText(class_fundticketresp_obj.getStr_approvalstatus()); + accRemark_tv.setText(class_fundticketresp_obj.getStr_approvedremarks()); + // show it + alertDialog.show(); + } + }); + + return convertView1; + + }//End of custom getView + }//End of CustomAdapter + + + + +}//end of fragment classxx diff --git a/app/src/main/java/com/leadcampusapp/Funding_Fragment.java b/app/src/main/java/com/leadcampusapp/Funding_Fragment.java new file mode 100644 index 0000000..30af778 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Funding_Fragment.java @@ -0,0 +1,1509 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 20-07-2018. + */ + +import android.annotation.SuppressLint; +import android.app.AlertDialog; +import android.app.DatePickerDialog; +import android.app.Dialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.SharedPreferences; +import android.os.AsyncTask; +import android.os.Bundle; +import android.text.Editable; +import android.text.TextWatcher; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.Window; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.CompoundButton; +import android.widget.DatePicker; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.ListView; +import android.widget.RadioButton; +import android.widget.RadioGroup; +import android.widget.TextView; +import android.widget.Toast; + +import androidx.appcompat.widget.AppCompatSpinner; +import androidx.appcompat.widget.SwitchCompat; +import androidx.core.content.ContextCompat; +import androidx.fragment.app.Fragment; +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Locale; + +//import com.android.sripad.leadnew_22_6_2018.R; + +public class Funding_Fragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener +{ + int count=0; + + private ArrayList feesList; + private View view; + private boolean isCompletedflag=false; + private int projectStatusIcon; + private FundStudListAdapter adapter; + + public static final String PREFBook_Stud= "prefbook_stud"; //sharedpreference Book + public static final String PrefID_RegID = "prefid_regid"; // + public static final String PrefID_SName = "prefid_sname"; // + public static final String PrefID_PM_SName = "prefid_pmsname"; // + public static final String PrefID_SLeadID = "prefid_sleadid"; // + public static final String PrefID_PM_SEmailID = "prefid_pm_semailid"; // + public static final String PrefID_SCellNo = "prefid_scellno"; // + + private SharedPreferences shardpref_S_obj; + private String str_leadId,str_RegistrationId; + private ProgressDialog progressDialog; + + private EditText etSearch; + + private ListView lview; + private ArrayList originalList = null; + + private int countProposed=0; + private int countReapply=0; + private int countRequestForCompletion=0; + private int countApproved=0; + private int countRejected=0; + private int countCompleted=0; + + private Button btn_generateReport; + public static final String PrefID_PMID = "prefid_pmid"; // + public static final String PREFBook_PM= "prefbook_pm"; + public static final String PrefID_PMEMailID = "prefid_pmemailid"; // + + SharedPreferences shardprefPM_obj; + public String str_MangerID,str_MangerEmailID; + private AppCompatSpinner spin_college; + private TextView txt_selectAll; + private LinkedHashSet collegeNameLst; + private ArrayList collegeNameArrLst; + + private Button btn_selectAll,btn_selectNone,btn_submit,btn_submitnew; + private CheckBox chk_selectAll; + private Context context; + + private String str_leadIdOverall=""; + + //private String + private int counts=0; + private int counter=0; + private ArrayList arrayLeadId; + private SwipeRefreshLayout swipeLayout; + private TextView txt_actualTotalCounts; + AppCompatSpinner spin_year,spin_feesCategory; + + int YearListCount,feesCatglistcount; + String str_YearListStatus,yearID,str_FeesCatgStatus,str_feesCatSlno,str_feesCatName,str_yearID,str_yearCode,str_feesID; + Class_YearList[] arrayObj_Class_YearList; + Class_YearList obj_Class_YearList; + ArrayAdapter dataAdapter_yearList,dataAdapter_feesCatg,dataAdapter_college; + Class_FeesCatg[] arrayObj_Class_FeesCatg; + Class_FeesCatg obj_Class_FeesCatg; + + Class_Colleges[] arrayObj_Class_Colleges, arrayObj_Class_Colleges2,arrayObj_Class_Colleges3; + Class_Colleges obj_Class_Colleges; + int collegeslistcount,MDId,studentlistcount=0; + String str_CollegesStatus,str_ColID="x"; + String str_studFundListStatus; + Class_FundStudList[] arrayObj_Class_studList; + Class_UnpaidStudList obj_Class_studList; + String str_remark; + JSONArray jsonArray_submit = new JSONArray(); + String str_paymentMode; + Class_InternetDectector internetDectector; + Boolean isInternetPresent = false; + EditText stfonlinetrans_no_tv,stfonlinetransAmount_tv,stfamountbycash_tv,stfonline_receiptno_tv,stfamountbycash_receiptno_tv; + + AppCompatSpinner spin_ticketStatus,priority_SP; + Class_Project_FundMain obj_Class_Project_FundMain; + String str_ticketSlno,str_ticketStatus,str_Status; + int ticketStatusCount; + Class_Project_FundMain[] arrayObj_Class_TicketStatus; + ArrayAdapter adapter_ticketStatus; + + EditText edt_fromdate,edt_todate_fund,fromdateseterror_TV,todateseterror_TV; + TextView txt_actualTotalCount; + private int mYear, mMonth, mDay; + private int cYear, cMonth, cDay; + Class_FromToDate[] arrayObj_Class_FromToDate; + String FromDate,ToDate; + String str_FromToDateStatus; + int From_ToDateCount; + // String yearID,str_yearID; + ListView lv_summary; + + Class_Fund_Details[] class_fund_details; + Class_Fund_Details classFundDetails; + + private ArrayList arrLstLead_Id; + private ArrayList arrLstMobile_No; + private ArrayList arrLstStudent_Name; + private ArrayList arrLstRegistration_Id; + private ArrayList arrLstEmail_Id; + private ArrayList arrLstSem_Name; + private ArrayList arrLstCollege_Name; + private ArrayList arrLstPDID; + private ArrayList arrLstProject_Title; + private ArrayList arrLstRequested_Amount; + private ArrayList arrLstSantioned_Amount; + private ArrayList arrLstReleased_Amount; + private ArrayList arrLstTotal_Released_Amount; + private ArrayList arrLstBalance_Amount; + private ArrayList arrLstStatus; + String ticketPriority="MEDIUM"; + ImageView FromToDate_btn; + + // EditText userInput; + @SuppressLint("RestrictedApi") + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + + view=inflater.inflate(R.layout.activity_project_fund_main, container, false); + + /* swipeLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipe_container); + swipeLayout.setOnRefreshListener(this); + swipeLayout.setColorScheme(android.R.color.holo_blue_bright, + android.R.color.holo_green_light, + android.R.color.holo_orange_light, + android.R.color.holo_red_light);*/ + + + + // txt_actualTotalCounts = (TextView) view.findViewById(R.id.txt_actualTotalCount); + + initializeviews(); + + ArrayList arrayList = new ArrayList<>(); + arrayList.add("Pending"); + arrayList.add("Manager Reject"); + arrayList.add("Accontent Reject"); + + + adapter_ticketStatus = new ArrayAdapter(getContext(), R.layout.spinnercustomstyle, arrayList); + //dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + adapter_ticketStatus.setDropDownViewResource(R.layout.spinnercustomstyle); + // districtsearch_ATV.setAdapter(dataAdapter_district); + spin_ticketStatus.setAdapter(adapter_ticketStatus); + spin_ticketStatus.setSupportBackgroundTintList(ContextCompat.getColorStateList(getContext(), R.color.colorBlack)); + + spin_ticketStatus.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected (AdapterView < ? > parent, View view, + int position, long id){ + // TODO Auto-generated method stub + // obj_Class_Project_FundMain = (Class_Project_FundMain) spin_ticketStatus.getSelectedItem(); + + String ticketStatus = parent.getItemAtPosition(position).toString(); + + if(ticketStatus.equalsIgnoreCase("Manager Reject")){ + str_ticketStatus="MR"; + }else if(ticketStatus.equalsIgnoreCase("Accontent Reject")){ + str_ticketStatus="AR"; + }else if(ticketStatus.equalsIgnoreCase("Pending")){ + str_ticketStatus="Pending"; + } +// str_ticketSlno = obj_Class_Project_FundMain.getSlno().toString(); + // str_ticketStatus = obj_Class_Project_FundMain.getTicket_Status().toString(); + + Log.e("tag","str_ticketStatus="+str_ticketStatus); + + // Toast.makeText(getApplicationContext(),"str_Programsid: "+str_programid,Toast.LENGTH_SHORT).show(); + } + + @Override + public void onNothingSelected (AdapterView < ? > parent){ + // TODO Auto-generated method stub + } + }); + + + + return view; + } + + private void initializeviews() { + lview = (ListView) view.findViewById(R.id.lv_summary); + + + feesList = new ArrayList(); + adapter = new FundStudListAdapter(getActivity(),feesList); + lview.setAdapter(adapter); + + arrayLeadId = new ArrayList(); + + + shardprefPM_obj= getActivity().getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MangerID = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + Log.d("str_MangerID:",str_MangerID); + MDId=Integer.parseInt(str_MangerID); + + shardprefPM_obj= getActivity().getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + shardprefPM_obj.getString(PrefID_PMEMailID, "").trim(); + str_MangerEmailID= shardprefPM_obj.getString(PrefID_PMEMailID, "").trim(); + Log.d("str_MangerEmailID:",str_MangerEmailID); + spin_ticketStatus= (AppCompatSpinner) view.findViewById(R.id.spin_ticketStatus); + edt_fromdate = (EditText) view.findViewById(R.id.edt_fromdate); + fromdateseterror_TV = (EditText) view.findViewById(R.id.fromdateseterror_TV); + edt_todate_fund = (EditText) view.findViewById(R.id.edt_todate_fund); + txt_actualTotalCount = (TextView) view.findViewById(R.id.txt_actualTotalCount); + btn_submit = (Button) view.findViewById(R.id.btn_submit); + FromToDate_btn = (ImageView) view.findViewById(R.id.FromToDate_btn); + + //initCollegeSpinner(); + + // populateList(); + GetFromToDateAsyncCallWS getFromToDateAsyncCallWS=new GetFromToDateAsyncCallWS(getContext()); + getFromToDateAsyncCallWS.execute(); + + FromToDate_btn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + GetStudentFundReleased getStudentFundReleased=new GetStudentFundReleased(getContext()); + getStudentFundReleased.execute(); + } + }); + edt_fromdate.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + final Calendar c = Calendar.getInstance(); + + mYear = c.get(Calendar.YEAR); + mMonth = c.get(Calendar.MONTH); + mDay = c.get(Calendar.DAY_OF_MONTH); + + DatePickerDialog datePickerDialog = new DatePickerDialog(getContext(), R.style.DatePickerTheme, + new DatePickerDialog.OnDateSetListener() { + + @Override + public void onDateSet(DatePicker view, int year, + int monthOfYear, int dayOfMonth) { + + cDay = dayOfMonth; + cMonth = monthOfYear; + cYear = year; + + // String date =dayOfMonth + "/" + (monthOfYear + 1) + "/" + year; + // String date =year + "-" + (monthOfYear + 1) + "-" + dayOfMonth; + String date =dayOfMonth + "-" + (monthOfYear + 1) + "-" + year; + + + SimpleDateFormat dateFormat= new SimpleDateFormat("dd-MM-yyyy"); + // SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd"); + + try { + Date d=dateFormat.parse(date); + System.out.println("Formated from"+dateFormat.format(d)); + fromdateseterror_TV.setVisibility(View.GONE); + edt_fromdate.setText(dateFormat.format(d).toString()); + + } + catch(Exception e) { + //java.text.ParseException: Unparseable date: Geting error + System.out.println("Excep"+e); + } + //TextView txtExactDate = (TextView) findViewById(R.id.txt_exactDate); + + + //txtDate.edita + } + }, mYear, mMonth, mDay); + + datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()); + //datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()-(1000 * 60 * 60 * 24 * 365 * 14)); + // - (1000 * 60 * 60 * 24 * 365.25 * 14) +//------ + + datePickerDialog.show(); + // originalList.clear(); + spin_ticketStatus.setSelection(0); + //adapter.notifyDataSetChanged(); + } + }); + /*edt_todate.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + final Calendar c = Calendar.getInstance(); + + mYear = c.get(Calendar.YEAR); + mMonth = c.get(Calendar.MONTH); + mDay = c.get(Calendar.DAY_OF_MONTH); + + DatePickerDialog datePickerDialog = new DatePickerDialog(getContext(), R.style.DatePickerTheme, + new DatePickerDialog.OnDateSetListener() { + + @Override + public void onDateSet(DatePicker view, int year, + int monthOfYear, int dayOfMonth) { + + cDay = dayOfMonth; + cMonth = monthOfYear; + cYear = year; + + // String date =dayOfMonth + "/" + (monthOfYear + 1) + "/" + year; + // String date =year + "-" + (monthOfYear + 1) + "-" + dayOfMonth; + String date =dayOfMonth + "-" + (monthOfYear + 1) + "-" + year; + + + SimpleDateFormat dateFormat= new SimpleDateFormat("dd-MM-yyyy"); + // SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd"); + + try { + Date d=dateFormat.parse(date); + System.out.println("Formated to"+dateFormat.format(d)); + todateseterror_TV.setVisibility(View.GONE); + edt_todate.setText(dateFormat.format(d).toString()); + + } + catch(Exception e) { + //java.text.ParseException: Unparseable date: Geting error + System.out.println("Excep"+e); + } + //TextView txtExactDate = (TextView) findViewById(R.id.txt_exactDate); + + + //txtDate.edita + } + }, mYear, mMonth, mDay); + + datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()); + //datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()-(1000 * 60 * 60 * 24 * 365 * 14)); + // - (1000 * 60 * 60 * 24 * 365.25 * 14) +//------ + + datePickerDialog.show(); + //originalList.clear(); + spin_ticketStatus.setSelection(0); + //adapter.notifyDataSetChanged(); + } + });*/ +// edt_todate.setOnClickListener(new View.OnClickListener() { +// @Override +// public void onClick(View v) { +// final Calendar c = Calendar.getInstance(); +// +// mYear = c.get(Calendar.YEAR); +// mMonth = c.get(Calendar.MONTH); +// mDay = c.get(Calendar.DAY_OF_MONTH); +// +// DatePickerDialog datePickerDialog = new DatePickerDialog(getContext(), R.style.DatePickerTheme, +// new DatePickerDialog.OnDateSetListener() { +// +// @Override +// public void onDateSet(DatePicker view, int year, +// int monthOfYear, int dayOfMonth) { +// +// cDay = dayOfMonth; +// cMonth = monthOfYear; +// cYear = year; +// +// // String date =dayOfMonth + "/" + (monthOfYear + 1) + "/" + year; +// // String date =year + "-" + (monthOfYear + 1) + "-" + dayOfMonth; +// String date =dayOfMonth + "-" + (monthOfYear + 1) + "-" + year; +// +// +// SimpleDateFormat dateFormat= new SimpleDateFormat("dd-MM-yyyy"); +// // SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd"); +// +// try { +// Date d=dateFormat.parse(date); +// System.out.println("Formated To"+dateFormat.format(d)); +// todateseterror_TV.setVisibility(View.GONE); +// edt_todate.setText(dateFormat.format(d).toString()); +// +// } +// catch(Exception e) { +// //java.text.ParseException: Unparseable date: Geting error +// System.out.println("Excep"+e); +// } +// //TextView txtExactDate = (TextView) findViewById(R.id.txt_exactDate); +// +// +// //txtDate.edita +// } +// }, mYear, mMonth, mDay); +// +// datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()); +// //datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()-(1000 * 60 * 60 * 24 * 365 * 14)); +// // - (1000 * 60 * 60 * 24 * 365.25 * 14) +////------ +// +// datePickerDialog.show(); +// // originalList.clear(); +// spin_ticketStatus.setSelection(0); +// //adapter.notifyDataSetChanged(); +// } +// }); + + + edt_todate_fund.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + final Calendar c = Calendar.getInstance(); + + mYear = c.get(Calendar.YEAR); + mMonth = c.get(Calendar.MONTH); + mDay = c.get(Calendar.DAY_OF_MONTH); + + DatePickerDialog datePickerDialog = new DatePickerDialog(getContext(), R.style.DatePickerTheme, + new DatePickerDialog.OnDateSetListener() { + + @Override + public void onDateSet(DatePicker view, int year, + int monthOfYear, int dayOfMonth) { + + cDay = dayOfMonth; + cMonth = monthOfYear; + cYear = year; + + // String date =dayOfMonth + "/" + (monthOfYear + 1) + "/" + year; + // String date =year + "-" + (monthOfYear + 1) + "-" + dayOfMonth; + String date =dayOfMonth + "-" + (monthOfYear + 1) + "-" + year; + + + SimpleDateFormat dateFormat= new SimpleDateFormat("dd-MM-yyyy"); + // SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd"); + + try { + Date d=dateFormat.parse(date); + System.out.println("Formated from"+dateFormat.format(d)); + // todateseterror_TV.setVisibility(View.GONE); + edt_todate_fund.setText(dateFormat.format(d).toString()); + + } + catch(Exception e) { + //java.text.ParseException: Unparseable date: Geting error + System.out.println("Excep"+e); + } + //TextView txtExactDate = (TextView) findViewById(R.id.txt_exactDate); + + + //txtDate.edita + } + }, mYear, mMonth, mDay); + + datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()); + //datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()-(1000 * 60 * 60 * 24 * 365 * 14)); + // - (1000 * 60 * 60 * 24 * 365.25 * 14) +//------ + + datePickerDialog.show(); + // originalList.clear(); + // spin_ticketStatus.setSelection(0); + //adapter.notifyDataSetChanged(); + } + }); + + + + etSearch = (EditText) view.findViewById(R.id.etSearch); + + etSearch.addTextChangedListener(new TextWatcher() { + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { +// Call back the Adapter with current character to Filter + } + + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + } + + @Override + public void afterTextChanged(Editable s) { + + String text = etSearch.getText().toString().toLowerCase(Locale.getDefault()); + adapter.filter(text, originalList); + + } + }); + + Log.d("countisssss", String.valueOf(lview.getCount())); + + + + Log.d("ListviewCountissssss", String.valueOf(lview.getCount())); + // txt_actualTotalCount.setText(lview.getCount()); + + btn_submit.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + + // if(isChecked){ + counter=0; + arrLstPDID = new ArrayList(); + arrLstProject_Title = new ArrayList(); + arrLstRequested_Amount = new ArrayList(); + arrLstSantioned_Amount = new ArrayList(); + arrLstReleased_Amount = new ArrayList(); + arrLstTotal_Released_Amount = new ArrayList(); + arrLstBalance_Amount = new ArrayList(); + arrLstStatus = new ArrayList(); + + arrLstRegistration_Id = new ArrayList(); + arrLstLead_Id = new ArrayList(); + arrLstMobile_No = new ArrayList(); + arrLstStudent_Name= new ArrayList(); + arrLstEmail_Id = new ArrayList(); + arrLstCollege_Name= new ArrayList(); + arrLstSem_Name = new ArrayList(); + + int size = feesList.size(); + Log.e("size", "size=" + String.valueOf(size)); + for (int i = 0; i < size; i++) { + Class_FundStudList feesUnpaidModel = feesList.get(i); + Class_Fund_Details[] classFundDetails; + classFundDetails=feesList.get(i).getFund_details(); + + Log.e("tag", "arrLstLeadIds="+arrLstLead_Id.size()); + arrLstLead_Id.add(feesUnpaidModel.getLead_Id().toString()); + arrLstMobile_No.add(feesUnpaidModel.getMobile_No().toString()); + arrLstStudent_Name.add(feesUnpaidModel.getStudent_Name().toString()); + // arrLstRegistration_Id.add(feesUnpaidModel.getRegistration_Id().toString()); + arrLstEmail_Id.add(feesUnpaidModel.getEmail_Id().toString()); + arrLstCollege_Name.add(feesUnpaidModel.getCollege_Name().toString()); + arrLstSem_Name.add(feesUnpaidModel.getSem_Name().toString()); + /*if (feesUnpaidModel.getFees().toString().equalsIgnoreCase("") || feesUnpaidModel.getFees().toString() == null) { + arrLstFees.add("0"); + } else { + arrLstFees.add(feesUnpaidModel.getFees().toString()); + }*/ + + for(int j=0;j parent){ + // TODO Auto-generated method stub + } + }); + + dialogcancelbutton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + dialog.dismiss(); + + } + }); + + dialogsubmitbutton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + internetDectector = new Class_InternetDectector(getActivity()); + isInternetPresent = internetDectector.isConnectingToInternet(); + + if (isInternetPresent) { + + + // Toast.makeText(getApplicationContext(),"Outside value:"+forOnline,Toast.LENGTH_LONG).show(); + // if (validationfor_dialog()) { + // Toast.makeText(getContext(), "true1 : "+stfonline_receiptno_tv.getText().toString(), Toast.LENGTH_LONG).show(); + SubmitTicketDetails submitTicketDetails = new SubmitTicketDetails(getActivity()); + submitTicketDetails.execute(); + // } + } + } + }); + dialog.show(); + } else { + Toast.makeText(getActivity(), "You have not selected any student", Toast.LENGTH_LONG).show(); + } + + } + }); + + + + } + + @Override + public void onRefresh() { + initializeviews(); + swipeLayout.setRefreshing(false); + } + + private class GetFromToDateAsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + /* dialog.setMessage("Please wait,District Loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show();*/ + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetFromToDate(); // get the District list + return null; + } + + public GetFromToDateAsyncCallWS(Context activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) { + + + if(str_FromToDateStatus.equals("Success")) { + Log.e("tag","arrayObj_Class_FromToDate="+arrayObj_Class_FromToDate.length); + for (int j=0;jlong + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + + SoapObject response = (SoapObject ) envelope.getResponse(); + Log.e("response datelist",response.toString()); + From_ToDateCount = response.getPropertyCount(); + SoapObject summaryresponse=(SoapObject)response.getProperty(0); + str_FromToDateStatus=summaryresponse.getProperty("Status").toString(); + Log.d("datelistcount", String.valueOf(response.getPropertyCount())); + + + if(str_FromToDateStatus.equals("Success")) { + if (From_ToDateCount > 0) { + arrayObj_Class_FromToDate = new Class_FromToDate[From_ToDateCount]; + for (int i = 0; i < From_ToDateCount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + + Class_FromToDate innerObj_Class_fromtodate = new Class_FromToDate(); + innerObj_Class_fromtodate.setAcademic_Code(response_soapobj.getProperty("Academic_Code").toString()); //1 + innerObj_Class_fromtodate.setAcademic_Id(response_soapobj.getProperty("Academic_Id").toString()); //Hubballi + innerObj_Class_fromtodate.setFrom_Date(response_soapobj.getProperty("From_Date").toString());// HB + innerObj_Class_fromtodate.setTo_Date(response_soapobj.getProperty("To_Date").toString());// <1 + innerObj_Class_fromtodate.setStatus(response_soapobj.getProperty("Status").toString());// <1 + innerObj_Class_fromtodate.setYear_Code(response_soapobj.getProperty("Year_Code").toString());// <1 + + str_FromToDateStatus = response_soapobj.getProperty("Status").toString(); + + arrayObj_Class_FromToDate[i] = innerObj_Class_fromtodate; + + }//end for loop + + }//end of if + + } + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + // internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + } + + private class TicketStatusAsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + /* dialog.setMessage("Please wait,District Loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show();*/ + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetFeesCatglist(); // get the District list + return null; + } + + public TicketStatusAsyncCallWS(Context activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + + //dialog.dismiss(); + + /*uploadfromDB_Statelist(); + uploadfromDB_Districtlist(); + setSpinner();*/ + // uploadfromDB_Districtlist(); + + + if(str_Status.equals("Success")) + { + + + adapter_ticketStatus = new ArrayAdapter(getContext(), R.layout.spinnercustomstyle, arrayObj_Class_TicketStatus); + //dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + adapter_ticketStatus.setDropDownViewResource(R.layout.spinnercustomstyle); + // districtsearch_ATV.setAdapter(dataAdapter_district); + priority_SP.setAdapter(adapter_ticketStatus); + priority_SP.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + // } + } + + + }//end of onPostExecute + }// end Async task + + public void GetFeesCatglist() + { + + String URL = Class_URL.URL_Manager.toString().trim(); + String METHOD_NAME = "Get_Master_Ticket_Status"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/Get_Master_Ticket_Status"; + + + + //for final + + + try { +//vijay district + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + + // request.addProperty("distid", Long.parseLong(str_Sids));//Long + + // request.addProperty("distid", 17);//Long + + //request.addProperty("stateId", 17);//Long + // long + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + // Log.i(TAG, "GetAllLoginDetails is running"); + // result1 = (Vector) envelope.getResponse(); + + // response = (SoapPrimitive) envelope.getResponse(); + + // SoapPrimitive res =(SoapPrimitive)envelope.getResponse(); + + SoapObject response = (SoapObject ) envelope.getResponse(); + Log.e("response TicketStatus",response.toString()); + ticketStatusCount = response.getPropertyCount(); + SoapObject districtresponse=(SoapObject)response.getProperty(0); + str_Status=districtresponse.getProperty("Status").toString(); + Log.d("ticketStatusCount", String.valueOf(response.getPropertyCount())); + + + if(str_Status.equals("Success")) { + if (ticketStatusCount > 0) { + arrayObj_Class_TicketStatus = new Class_Project_FundMain[ticketStatusCount]; + for (int i = 0; i < ticketStatusCount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + + Class_Project_FundMain innerObj_Class_Project_FundMain = new Class_Project_FundMain(); + innerObj_Class_Project_FundMain.setSlno(response_soapobj.getProperty("Slno").toString()); //1 + innerObj_Class_Project_FundMain.setTicket_Status(response_soapobj.getProperty("Ticket_Status").toString()); //Hubballi + innerObj_Class_Project_FundMain.setAccount_Alert_Days(response_soapobj.getProperty("Manager_Alert_Days").toString());// HB + innerObj_Class_Project_FundMain.setManager_Alert_Days(response_soapobj.getProperty("Account_Alert_Days").toString());// <1 + innerObj_Class_Project_FundMain.setStatus(response_soapobj.getProperty("Status").toString());// <1 + + str_Status = response_soapobj.getProperty("Status").toString(); + + arrayObj_Class_TicketStatus[i] = innerObj_Class_Project_FundMain; + + }//end for loop + + }//end of if + + } + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + // internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + } + + public class GetStudentFundReleased extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + //private ProgressBar progressBar; + + GetStudentFundReleased (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapObject response = getStudentFundReleased(); + + //Log.d("Soap response is",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + progressDialog.setMessage("Loading"); + progressDialog.setProgressStyle(android.R.attr.progressBarStyleSmall); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapObject result) { + + + if(str_studFundListStatus.equalsIgnoreCase("Success")){ + if(feesList.size()==0||feesList.isEmpty()){ + Toast.makeText(getActivity(),str_studFundListStatus, Toast.LENGTH_LONG).show(); + originalList = new ArrayList(); + originalList.addAll(feesList); + + adapter.notifyDataSetChanged(); + }else { + originalList = new ArrayList(); + originalList.addAll(feesList); + + adapter.notifyDataSetChanged(); + //progressBar.setVisibility(View.GONE); + + + // Log.d("Totalcountssss:", String.valueOf(lview.getCount())); +// txt_actualTotalCounts.setText(String.valueOf(lview.getCount())); + } + }else{ + Toast.makeText(getActivity(),str_studFundListStatus, Toast.LENGTH_LONG).show(); + originalList = new ArrayList(); + originalList.addAll(feesList); + + adapter.notifyDataSetChanged(); + } + + progressDialog.dismiss(); + + + + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapObject getStudentFundReleased() { + String METHOD_NAME = "Get_Release_Fund_List"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/Get_Release_Fund_List"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + + FromDate=edt_fromdate.getText().toString(); + ToDate=edt_todate_fund.getText().toString(); + Log.e("tag","FromDate="+FromDate); + Log.e("tag","Todate="+ToDate); + String outputPattern = "yyyy-MM-dd"; + String inputPattern = "dd-MM-yyyy"; + SimpleDateFormat inputFormat = new SimpleDateFormat(inputPattern); + SimpleDateFormat outputFormat = new SimpleDateFormat(outputPattern); + + Date date1 = null,date2=null; + String strFrom = null,strTo=null; + try { + date1 = inputFormat.parse(FromDate); + strFrom = outputFormat.format(date1); + date2 = inputFormat.parse(ToDate); + strTo = outputFormat.format(date2); + } catch (ParseException e) { + e.printStackTrace(); + } + Log.e("tag","DFormated FromDate="+strFrom); + Log.e("tag","DFormated Todate="+strTo); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + request.addProperty("Manager_Id",MDId); + request.addProperty("From_Date",strFrom); + request.addProperty("To_Date",strTo); + request.addProperty("Ticket_Status","Pending"); + //users.ad + //request.add + + Log.e("tag","request studentlist="+request.toString()); + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + Log.d("soapresponseFund",envelope.getResponse().toString()); + + + SoapObject response = (SoapObject) envelope.getResponse(); + Log.e("soapresponseyyyyyyyFund",response.toString()); + + /*if(response.getProperty("Status").toString().equalsIgnoreCase("No Record")){ + str_studFundListStatus="No Record"; + }else {*/ + SoapObject Fundlistresponse = (SoapObject) response.getProperty("Student_Details"); + studentlistcount = 0; + SoapObject vmGet_Student_List = (SoapObject) Fundlistresponse.getProperty("vmGet_Student_List"); + studentlistcount = Fundlistresponse.getPropertyCount(); + + Log.d("studentlistcount", String.valueOf(Fundlistresponse.getPropertyCount())); + + str_studFundListStatus = vmGet_Student_List.getProperty("Status").toString(); + feesList.clear(); + + if (str_studFundListStatus.equalsIgnoreCase("Success")) { + if (studentlistcount > 0) { + arrayObj_Class_studList = new Class_FundStudList[studentlistcount]; + + // ViewSummaryList_arraylist.clear(); + for (int i = 0; i < studentlistcount; i++) { + + SoapObject response_soapobj = (SoapObject) Fundlistresponse.getProperty(i); //resp starts from zero + +//Log.e("tag","response_soapobj="+response_soapobj.getProperty("Registration_Id")); + Class_FundStudList innerObj_Class_manager = new Class_FundStudList(); + innerObj_Class_manager.setRegistration_Id(response_soapobj.getProperty("Registration_Id").toString()); //1 + innerObj_Class_manager.setStudent_Name(response_soapobj.getProperty("Student_Name").toString()); //Hubballi + innerObj_Class_manager.setCollege_Name(response_soapobj.getProperty("College_Name").toString());// HB + innerObj_Class_manager.setEmail_Id(response_soapobj.getProperty("Email_Id").toString());// <1 + innerObj_Class_manager.setLead_Id(response_soapobj.getProperty("Lead_Id").toString());// <1 + innerObj_Class_manager.setSem_Name(response_soapobj.getProperty("Sem_Name").toString());// <1 + innerObj_Class_manager.setMobile_No(response_soapobj.getProperty("Mobile_No").toString());// <1 + innerObj_Class_manager.setStatus(response_soapobj.getProperty("Status").toString());// <1 + + + SoapObject Fund_Details = (SoapObject) response_soapobj.getProperty("Fund_Details"); + Log.e("tag", "Fund_Details==" + Fund_Details.getPropertyCount()); + class_fund_details = new Class_Fund_Details[Fund_Details.getPropertyCount()]; + + for (int j = 0; j < Fund_Details.getPropertyCount(); j++) { + SoapObject response_Fund_Details = (SoapObject) Fund_Details.getProperty(j); //resp starts from zero + + Log.e("tag", "response_Fund_Details.getPropertyCount()==" + response_Fund_Details.getPropertyCount()); + + Log.e("tag", "Fund_Details==" + response_Fund_Details.getProperty("PDID").toString()); +// str_studFundListStatus = response_Fund_Details.getProperty("Status").toString(); + // classFundDetails=new Class_Fund_Details(); + + /*classFundDetails.setPDID(response_Fund_Details.getProperty("PDID").toString()); + classFundDetails.setProject_Title(response_Fund_Details.getProperty("Project_Title").toString()); + classFundDetails.setRequested_Amount(response_Fund_Details.getProperty("Requested_Amount").toString()); + classFundDetails.setSantioned_Amount(response_Fund_Details.getProperty("Santioned_Amount").toString()); + classFundDetails.setReleased_Amount(response_Fund_Details.getProperty("Released_Amount").toString()); + classFundDetails.setTotal_Released_Amount(response_Fund_Details.getProperty("Total_Released_Amount").toString()); + classFundDetails.setBalance_Amount(response_Fund_Details.getProperty("Balance_Amount").toString()); + classFundDetails.setStatus(response_Fund_Details.getProperty("Status").toString());*/ + String PDID = response_Fund_Details.getProperty("PDID").toString(); + String Project_Title = response_Fund_Details.getProperty("Project_Title").toString(); + String Requested_Amount = response_Fund_Details.getProperty("Requested_Amount").toString(); + String Santioned_Amount = response_Fund_Details.getProperty("Santioned_Amount").toString(); + String Released_Amount = response_Fund_Details.getProperty("Released_Amount").toString(); + String Total_Released_Amount = response_Fund_Details.getProperty("Total_Released_Amount").toString(); + String Balance_Amount = response_Fund_Details.getProperty("Balance_Amount").toString(); + String regID = response_soapobj.getProperty("Registration_Id").toString(); + String Status = "0"; + class_fund_details[j] = new Class_Fund_Details(PDID, Project_Title, Requested_Amount, Santioned_Amount, Released_Amount, Total_Released_Amount, Balance_Amount, Status, regID); + } + innerObj_Class_manager.setFund_details(class_fund_details); + + + // innerObj_Class_manager.setPayment_Mode("1"); + + arrayObj_Class_studList[i] = innerObj_Class_manager; + + feesList.add(arrayObj_Class_studList[i]); + + // ViewSummaryList_arraylist.add(innerObj_Class_manager); + /* String str_districtID = response_soapobj.getProperty("DistrictId").toString(); + String str_districtname = response_soapobj.getProperty("DistrictName").toString(); + String str_districtstateid = response_soapobj.getProperty("Stateid").toString(); +*/ + //DBCreate_Districtdetails_insert_2SQLiteDB(str_districtID,str_districtname,str_districtstateid); + + + }//end for loop + + }//end of if + + } + //return null; + // } + return response; + + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String str_exceptionerror = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),str_exceptionerror, Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String str_exceptionerror = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),str_exceptionerror, Toast.LENGTH_LONG).show(); + } + }); + } + return null; + + } + + public class SubmitTicketDetails extends AsyncTask { + + AlertDialog alertDialog; + //private ProgressBar progressBar; + private ProgressDialog progressDialog; + + SubmitTicketDetails (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapPrimitive response = submitArrLystLeadIds(); + + //Log.d("Soap response issssss",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + + progressDialog.setMessage("Submitting"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + progressDialog.dismiss(); + if(result!=null) { + if (result.toString().equalsIgnoreCase("success")) { + Toast.makeText(context, "Student data saved successfully", Toast.LENGTH_LONG).show(); + //counter = 0; + getActivity().finish(); + startActivity(getActivity().getIntent()); + } else if(result.toString().equalsIgnoreCase("EXISTS")){ + Toast.makeText(context, "Student mobile number already exists in LEAD", Toast.LENGTH_LONG).show(); + //counter = 0; + //finish(); + // startActivity(getIntent()); + } else { + Toast.makeText(context, result.toString(), Toast.LENGTH_LONG).show(); + } + } + //progressBar.setVisibility(View.GONE); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapPrimitive submitArrLystLeadIds() { + String METHOD_NAME = "Create_Ticketing_System"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/Create_Ticketing_System"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + JSONObject jsonObject = new JSONObject(); + JSONArray jsonArray = new JSONArray(); + + // Log.e("tag","isNewRegistration="+isNewRegistration); + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + + request.addProperty("Ticket_Priority",ticketPriority); + request.addProperty("Manager_MailId",str_MangerEmailID); + request.addProperty("Manager_Id",MDId); + +//[{"Registration_Id":38267,"Student_Name":"Madhu","MobileNo":"8904674048","State_Id":17,"District_Id":266,"City_Id":68,"stream_Id":3,"College_ID":178,"Email_Id":"madhushree.kubsad@dfmail.org","Paid_date":"0","Paid_fees":100,"Payment_Mode":1,"Payment_Remark":"fees paid"}] + + // [{"Registration_Id":0,"Student_Name":"test a","MobileNo":"8904674048","State_Id":"17","District_Id":"256","City_Id":"14","stream":"5","College_ID":"37","Email_Id":"madhushree.kubsad@dfmail.org","Paid_date":"2021-02-22","Paid_fees":"1","Payment_Mode":"1","Payment_Remark":"test test"}] + /* jsonObject.put("Registration_Id",Integer.valueOf(O_RegistrationId)); + Log.e("tag","str_RegistrationId="+O_RegistrationId); + jsonObject.put("Student_Name",etName.getText().toString()); + jsonObject.put("MobileNo",etMobile.getText().toString()); + jsonObject.put("State_Id",Integer.valueOf(str_Sids)); + jsonObject.put("District_Id",Integer.valueOf(str_Dids)); + jsonObject.put("City_Id",Integer.valueOf(str_Cityids)); + jsonObject.put("stream_Id",Integer.valueOf(str_programid)); + jsonObject.put("College_ID",Integer.valueOf(str_ColID)); + jsonObject.put("Email_Id",emailid_ET.getText().toString()); + // jsonObject.put("Paid_date",edt_paymentDate.getText().toString()); + // Log.e("tag","paid Date="+edt_paymentDate.getText().toString()); + jsonObject.put("Paid_fees",Integer.valueOf(str_feesAmount)); + jsonObject.put("Payment_Mode",Integer.valueOf(str_PaymentModeID)); + // jsonObject.put("Payment_Remark",remark_ET.getText().toString()); + + request.addProperty("PaymentDetails","["+jsonObject+"]");*/ + ArrayList jsonObjectList=new ArrayList(); + + try{ + for(int k=0;k"); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + // Log.d("soap response1xxxx",envelope.getResponse().toString()); + + + // SoapObject response = (SoapObject) envelope.getResponse(); + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + Log.e("Responseissss",envelope.getResponse().toString()); + + //return null; + + return response; + + }catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + + } + +}//end of fragment classxx diff --git a/app/src/main/java/com/leadcampusapp/GalleryImageAdapter.java b/app/src/main/java/com/leadcampusapp/GalleryImageAdapter.java new file mode 100644 index 0000000..98eb82e --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/GalleryImageAdapter.java @@ -0,0 +1,79 @@ +package com.leadcampusapp; + +import android.content.Context; +import android.graphics.Bitmap; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.Gallery; +import android.widget.ImageView; + +//import com.android.sripad.leadnew_22_6_2018.R; + +import java.util.ArrayList; + +/** + * Created by anupamchugh on 24/10/15. + */ +public class GalleryImageAdapter extends BaseAdapter +{ + private Context mContext; + /*public Integer[] mImageIds = { + R.drawable.n1, + R.drawable.n2, + R.drawable.n3, + R.drawable.n4, + R.drawable.n5, + };*/ + + public ArrayList mBitmapList; + + + + public GalleryImageAdapter(Context context,ArrayList bitmapList) + { + mContext = context; + mBitmapList = bitmapList; + } + + /* public int getCount() { + return mImageIds.length; + }*/ + + public int getCount() { + return mBitmapList.size(); + } + + + public Object getItem(int position) { + return position; + } + + public long getItemId(int position) { + return position; + } + + + // Override this method according to your need + public View getView(int index, View view, ViewGroup viewGroup) + { + // TODO Auto-generated method stub + ImageView i = new ImageView(mContext); + + //i.setImageResource(mImageIds[index]); + + i.setImageBitmap(mBitmapList.get(index)); + + i.setLayoutParams(new Gallery.LayoutParams(300, 300)); + + i.setScaleType(ImageView.ScaleType.FIT_XY); + // i.setScaleType(ImageView.ScaleType.FIT_START); + + + return i; + } + + + +} + diff --git a/app/src/main/java/com/leadcampusapp/GalleryImageBitmap.java b/app/src/main/java/com/leadcampusapp/GalleryImageBitmap.java new file mode 100644 index 0000000..56da196 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/GalleryImageBitmap.java @@ -0,0 +1,58 @@ +package com.leadcampusapp; + +import android.graphics.Bitmap; + +import java.net.URL; +import java.util.ArrayList; + +/** + * Created by Shripad on 12-07-2018. + */ + +public class GalleryImageBitmap { + private static ArrayList bitmapGalleryImage; + private static ArrayList document_slno; + private static ArrayList document_path; + + private static ArrayList allImgURL; + + public static ArrayList getAllImgURL() { + return allImgURL; + } + + public static void setAllImgURL(ArrayList allImgURL) { + GalleryImageBitmap.allImgURL = allImgURL; + } + + public static ArrayList getBitmapGalleryImage() { + return bitmapGalleryImage; + } + + public static void setBitmapGalleryImage(ArrayList bitmapGalleryImage) { + GalleryImageBitmap.bitmapGalleryImage = bitmapGalleryImage; + } + + public static ArrayList getDocument_slno() { + return document_slno; + } + + public static void setDocument_slno(ArrayList document_slno) { + GalleryImageBitmap.document_slno = document_slno; + } + + public static ArrayList getDocument_path() { + return document_path; + } + + public static void setDocument_path(ArrayList document_path) { + GalleryImageBitmap.document_path = document_path; + } + + /* public ArrayList getBitmapGalleryImage() { + return bitmapGalleryImage; + } + + public void setBitmapGalleryImage(ArrayList bitmapGalleryImage) { + this.bitmapGalleryImage = bitmapGalleryImage; + }*/ +} diff --git a/app/src/main/java/com/leadcampusapp/GetImageThumbnail.java b/app/src/main/java/com/leadcampusapp/GetImageThumbnail.java new file mode 100644 index 0000000..d5c49cc --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/GetImageThumbnail.java @@ -0,0 +1,53 @@ +package com.leadcampusapp; + +import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.net.Uri; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; + +public class GetImageThumbnail { + + private static int getPowerOfTwoForSampleRatio(double ratio) { + int k = Integer.highestOneBit((int) Math.floor(ratio)); + if (k == 0) + return 1; + else + return k; + } + + public Bitmap getThumbnail(Uri uri, Context context) + throws FileNotFoundException, IOException { + InputStream input = context.getContentResolver().openInputStream(uri); + + BitmapFactory.Options onlyBoundsOptions = new BitmapFactory.Options(); + onlyBoundsOptions.inJustDecodeBounds = true; + onlyBoundsOptions.inDither = true;// optional + onlyBoundsOptions.inPreferredConfig = Bitmap.Config.ARGB_8888;// optional + BitmapFactory.decodeStream(input, null, onlyBoundsOptions); + input.close(); + if ((onlyBoundsOptions.outWidth == -1) + || (onlyBoundsOptions.outHeight == -1)) + return null; + + int originalSize = (onlyBoundsOptions.outHeight > onlyBoundsOptions.outWidth) ? onlyBoundsOptions.outHeight + : onlyBoundsOptions.outWidth; + + //double ratio = (originalSize > 400) ? (originalSize / 550) : 1.0; + //double ratio = (originalSize > 7400) ? (originalSize / 7550) : 1.0; + double ratio = (originalSize > 600) ? (originalSize / 750) : 1.0; + + BitmapFactory.Options bitmapOptions = new BitmapFactory.Options(); + bitmapOptions.inSampleSize = getPowerOfTwoForSampleRatio(ratio); + bitmapOptions.inDither = true;// optional + bitmapOptions.inPreferredConfig = Bitmap.Config.ARGB_8888;// optional + input = context.getContentResolver().openInputStream(uri); + Bitmap bitmap = BitmapFactory.decodeStream(input, null, bitmapOptions); + + input.close(); + return bitmap; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/GridAdapter.java b/app/src/main/java/com/leadcampusapp/GridAdapter.java new file mode 100644 index 0000000..2468bfd --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/GridAdapter.java @@ -0,0 +1,131 @@ +package com.leadcampusapp; + +import android.content.Context; +import android.content.Intent; +import android.graphics.Color; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.ImageView; +import android.widget.RelativeLayout; +import android.widget.TextView; +import android.widget.Toast; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by User on 8/25/2018. + */ + +public class GridAdapter extends BaseAdapter { + private final List mItems = new ArrayList(); + private final LayoutInflater mInflater; + private String str_isFeesPaid = null; + + public String getStr_isFeesPaid() { + return str_isFeesPaid; + } + + public void setStr_isFeesPaid(String str_isFeesPaid) { + this.str_isFeesPaid = str_isFeesPaid; + } + + public GridAdapter(Context context) { + + mInflater = LayoutInflater.from(context); + //str_isFeesPaids = str_isFeesPaid; + + mItems.add(new Item("About LEAD", R.drawable.about_new,"#f58d00")); + mItems.add(new Item("Projects", R.drawable.project_new,"#97c024")); + mItems.add(new Item("Stories", R.drawable.story_nw,"#4285f4")); + } + + @Override + public int getCount() { + return mItems.size(); + } + + @Override + public Item getItem(int i) { + return mItems.get(i); + } + + @Override + public long getItemId(int i) { + return mItems.get(i).drawableId; + } + + @Override + public View getView(int i, final View view, ViewGroup viewGroup) { + View v = view; + ImageView imageView; + final TextView name; + RelativeLayout relativeLayout; + + if (v == null) { + v = mInflater.inflate(R.layout.grid_item, viewGroup, false); + v.setTag(R.id.imageView, v.findViewById(R.id.imageView)); + v.setTag(R.id.text, v.findViewById(R.id.text)); + v.setTag(R.id.relativeLayout, v.findViewById(R.id.relativeLayout)); + } + + imageView = (ImageView) v.getTag(R.id.imageView); + name = (TextView) v.getTag(R.id.text); + relativeLayout = (RelativeLayout) v.findViewById(R.id.relativeLayout); + + Item item = getItem(i); + + imageView.setImageResource(item.drawableId); + name.setText(item.name); + relativeLayout.setBackgroundColor(Color.parseColor(item.color)); + + relativeLayout.setOnClickListener(new View.OnClickListener() { + + @Override + public void onClick(View v) { + // Toast.makeText(v.getContext(), name.getText(), Toast.LENGTH_SHORT).show(); + String itemName=name.getText().toString(); + if(itemName.equals("About LEAD")){ + Intent itthomeToAboutUs = new Intent(v.getContext(), AboutUsActivity.class); + itthomeToAboutUs.putExtra("From","Student"); + v.getContext().startActivity(itthomeToAboutUs); + } + if(itemName.equals("Projects")){ +/* Intent itthomeToProject = new Intent(v.getContext(), ProjectDetails.class); + // itthomeToProject.putExtra("From","Student"); + v.getContext().startActivity(itthomeToProject);*/ + + if(getStr_isFeesPaid().equals("1")) { + Intent itthomeToProject = new Intent(v.getContext(), ProjectDetails.class); + // itthomeToProject.putExtra("From","Student"); + v.getContext().startActivity(itthomeToProject); + }else{ + Toast.makeText(v.getContext(),"You have not paid the fees. Please contact Project Manager",Toast.LENGTH_LONG).show(); + } + } + if(itemName.equals("Stories")){ + Intent itthomeTostory = new Intent(v.getContext(),LeadStoryActivity.class); + itthomeTostory.putExtra("stroy_position", "0"); + v.getContext().startActivity(itthomeTostory); + } + } + } + ); + return v; + } + + + private static class Item { + public final String name; + public final int drawableId; + public final String color; + + Item(String name, int drawableId, String c) { + this.name = name; + this.drawableId = drawableId; + this.color=c; + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/GridAdapterPMFirst.java b/app/src/main/java/com/leadcampusapp/GridAdapterPMFirst.java new file mode 100644 index 0000000..f44075e --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/GridAdapterPMFirst.java @@ -0,0 +1,114 @@ +package com.leadcampusapp; + +import android.content.Context; +import android.content.Intent; +import android.graphics.Color; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.ImageView; +import android.widget.RelativeLayout; +import android.widget.TextView; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by User on 8/25/2018. + */ + +public class GridAdapterPMFirst extends BaseAdapter { + private final List mItems = new ArrayList(); + private final LayoutInflater mInflater; + + public GridAdapterPMFirst(Context context) { + mInflater = LayoutInflater.from(context); + + /* mItems.add(new Item("About LEAD", R.drawable.about_new,"#97c024")); + mItems.add(new Item("Projects", R.drawable.project_new,"#f58d00"));*/ + mItems.add(new Item("About LEAD", R.drawable.about_new,"#f58d00")); + mItems.add(new Item("Projects", R.drawable.project_new,"#97c024")); + // mItems.add(new Item("Stories", R.drawable.story_wht,"#4285f4")); + } + + @Override + public int getCount() { + return mItems.size(); + } + + @Override + public Item getItem(int i) { + return mItems.get(i); + } + + @Override + public long getItemId(int i) { + return mItems.get(i).drawableId; + } + + @Override + public View getView(int i, final View view, ViewGroup viewGroup) + { + View v = view; + ImageView imageView; + final TextView name; + RelativeLayout relativeLayout; + + if (v == null) { + v = mInflater.inflate(R.layout.grid_item_pm, viewGroup, false); + v.setTag(R.id.imageView, v.findViewById(R.id.imageView)); + v.setTag(R.id.text, v.findViewById(R.id.text)); + v.setTag(R.id.relativeLayout, v.findViewById(R.id.relativeLayout)); + } + + imageView = (ImageView) v.getTag(R.id.imageView); + name = (TextView) v.getTag(R.id.text); + relativeLayout = (RelativeLayout) v.findViewById(R.id.relativeLayout); + + Item item = getItem(i); + +//No changes only for commit + imageView.setImageResource(item.drawableId); + name.setText(item.name.toString()); + relativeLayout.setBackgroundColor(Color.parseColor(item.color)); + + relativeLayout.setOnClickListener(new View.OnClickListener() { + + @Override + public void onClick(View v) { + // Toast.makeText(v.getContext(), name.getText(), Toast.LENGTH_SHORT).show(); + String itemName=name.getText().toString(); + if(itemName.equals("About LEAD")){ + Intent itthomeToAboutUs = new Intent(v.getContext(),AboutUsActivity.class); + itthomeToAboutUs.putExtra("From","Manager"); + v.getContext().startActivity(itthomeToAboutUs); + } + if(itemName.equals("Projects")){ + Intent itthomeToProject = new Intent(v.getContext(),PMProjectDetailActivity.class); + itthomeToProject.putExtra("pageCount",0); + v.getContext().startActivity(itthomeToProject); + } + /* if(itemName.equals("Stories")){ + Intent itthomeTostory = new Intent(v.getContext(),LeadStoryActivity.class); + v.getContext().startActivity(itthomeTostory); + }*/ + } + } + ); + return v; + } + + + private static class Item { + public final String name; + public final int drawableId; + public final String color; + + Item(String name, int drawableId, String c) { + this.name = name; + this.drawableId = drawableId; + this.color=c; + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/GridAdapterPMFour.java b/app/src/main/java/com/leadcampusapp/GridAdapterPMFour.java new file mode 100644 index 0000000..db80fd7 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/GridAdapterPMFour.java @@ -0,0 +1,180 @@ +package com.leadcampusapp; + +import android.content.Context; +import android.content.Intent; +import android.graphics.Color; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.ImageView; +import android.widget.RelativeLayout; +import android.widget.TextView; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by User on 8/25/2018. + */ + +public class GridAdapterPMFour extends BaseAdapter { + private final List mItems = new ArrayList(); + private final LayoutInflater mInflater; + + /* String UnapprovedCount; + String ComplitedCount; + String ApprovedCount; + String RequestForCompletion; + String RequestForModification; + String Rejected; + String str_studentcount; + String str_collegecount;*/ + + /* public GridAdapterPMSecond(LayoutInflater mInflater, String unapprovedCount, String complitedCount, String approvedCount, String requestForCompletion, String requestForModification, String rejected, String str_studentcount, String str_collegecount) { + this.mInflater = mInflater; + UnapprovedCount = unapprovedCount; + ComplitedCount = complitedCount; + ApprovedCount = approvedCount; + RequestForCompletion = requestForCompletion; + RequestForModification = requestForModification; + Rejected = rejected; + this.str_studentcount = str_studentcount; + this.str_collegecount = str_collegecount; + }*/ + + public GridAdapterPMFour(Context context){//, String unapprovedCount, String complitedCount, String approvedCount, String requestForCompletion, String requestForModification, String rejected, String str_studentcount, String str_collegecount) { + mInflater = LayoutInflater.from(context); + + // mItems.add(new Item("Fees", R.drawable.fees_new, "#ffbc00")); + mItems.add(new Item("ML & LA", R.drawable.mlal_new, "#ffbc00")); + mItems.add(new Item("Reports", R.drawable.report_new, "#f42a2a")); + mItems.add(new Item("Contact Us",R.drawable.contact_new,"#1e7145")); + + /* mItems.add(new Item("News Feeds", R.drawable.newsfeeds_new, "#0a64c5")); + mItems.add(new Item("Events", R.drawable.events_new, "#84795d")); + mItems.add(new Item("Contact Us",R.drawable.contact_new,"#f42a2a"));*/ + + /* mItems.add(new Item("News Feeds", R.drawable.newsfeeds_new,"#ffbc00")); + mItems.add(new Item("Events", R.drawable.events_new,"#d94343")); + mItems.add(new Item("Contact Us", R.drawable.contact_new,"#1e7145"));*/ + + /* UnapprovedCount = unapprovedCount; + ComplitedCount = complitedCount; + ApprovedCount = approvedCount; + RequestForCompletion = requestForCompletion; + RequestForModification = requestForModification; + Rejected = rejected; + this.str_studentcount = str_studentcount; + this.str_collegecount = str_collegecount;*/ + } + + @Override + public int getCount() { + return mItems.size(); + } + + @Override + public Item getItem(int i) { + return mItems.get(i); + } + + @Override + public long getItemId(int i) { + return mItems.get(i).drawableId; + } + + @Override + public View getView(int i, final View view, ViewGroup viewGroup) { + View v = view; + ImageView imageView; + final TextView name; + RelativeLayout relativeLayout; + + if (v == null) { + v = mInflater.inflate(R.layout.grid_item_pm, viewGroup, false); + v.setTag(R.id.imageView, v.findViewById(R.id.imageView)); + v.setTag(R.id.text, v.findViewById(R.id.text)); + v.setTag(R.id.relativeLayout, v.findViewById(R.id.relativeLayout)); + } + + imageView = (ImageView) v.getTag(R.id.imageView); + name = (TextView) v.getTag(R.id.text); + relativeLayout = (RelativeLayout) v.findViewById(R.id.relativeLayout); + + Item item = getItem(i); + + imageView.setImageResource(item.drawableId); + name.setText(item.name); + relativeLayout.setBackgroundColor(Color.parseColor(item.color)); + + relativeLayout.setOnClickListener(new View.OnClickListener() { + + @Override + public void onClick(View v) { + // Toast.makeText(v.getContext(), name.getText(), Toast.LENGTH_SHORT).show(); + String itemName=name.getText().toString(); + + // Toast.makeText(getApplicationContext(), item.text + " is clicked", Toast.LENGTH_SHORT).show(); + + /* if(itemName.equals("Fees")){ + Intent itthomeToFeesPaid = new Intent(v.getContext(),TShirtPaidActivity.class); + itthomeToFeesPaid.putExtra("From","Manager"); + v.getContext().startActivity(itthomeToFeesPaid); + } + if(itemName.equals("ML & LA")){ + Intent itthomeToAboutUs = new Intent(v.getContext(),RequestActivity.class); + itthomeToAboutUs.putExtra("From","Manager"); + v.getContext().startActivity(itthomeToAboutUs); + }*/ + if(itemName.equals("ML & LA")){ + Intent itthomeToAboutUs = new Intent(v.getContext(),RequestActivity.class); + itthomeToAboutUs.putExtra("From","Manager"); + v.getContext().startActivity(itthomeToAboutUs); + } + if(itemName.equals("Reports")){ + //Log.i("tag","UnapprovedCount"+UnapprovedCount); + Intent i = new Intent(v.getContext(),AnalyticChartActivity.class); + /* i.putExtra("UnapprovedCount",UnapprovedCount); + i.putExtra("ComplitedCount",ComplitedCount); + i.putExtra("ApprovedCount",ApprovedCount); + i.putExtra("RequestForCompletion",RequestForCompletion); + i.putExtra("RequestForModification",RequestForModification); + i.putExtra("Rejected",Rejected); + i.putExtra("str_studentcount",str_studentcount); + i.putExtra("str_collegecount",str_collegecount);*/ + v.getContext().startActivity(i); + } + /*if(itemName.equals("News Feeds")){ + Intent itthomeToNewsFeeds = new Intent(v.getContext(),NewsFeedsActivity.class); + v.getContext().startActivity(itthomeToNewsFeeds); + } + if(itemName.equals("Events")){ + Intent itthomeToEvent = new Intent(v.getContext(),EventsActivity.class); + v.getContext().startActivity(itthomeToEvent); + }*/ + if(itemName.equals("Contact Us")){ + Intent itthomeToAboutUs = new Intent(v.getContext(),ContactUsActivity.class); + itthomeToAboutUs.putExtra("From","Manager"); + v.getContext().startActivity(itthomeToAboutUs); + } + + } + } + ); + return v; + } + + + private static class Item { + public final String name; + public final int drawableId; + public final String color; + + Item(String name, int drawableId, String c) { + this.name = name; + this.drawableId = drawableId; + this.color=c; + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/GridAdapterPMSecond.java b/app/src/main/java/com/leadcampusapp/GridAdapterPMSecond.java new file mode 100644 index 0000000..fa1c596 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/GridAdapterPMSecond.java @@ -0,0 +1,182 @@ +package com.leadcampusapp; + +import android.content.Context; +import android.content.Intent; +import android.graphics.Color; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.ImageView; +import android.widget.RelativeLayout; +import android.widget.TextView; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by User on 8/25/2018. + */ + +public class GridAdapterPMSecond extends BaseAdapter { + private final List mItems = new ArrayList(); + private final LayoutInflater mInflater; + + /* String UnapprovedCount; + String ComplitedCount; + String ApprovedCount; + String RequestForCompletion; + String RequestForModification; + String Rejected; + String str_studentcount; + String str_collegecount;*/ + + /* public GridAdapterPMSecond(LayoutInflater mInflater, String unapprovedCount, String complitedCount, String approvedCount, String requestForCompletion, String requestForModification, String rejected, String str_studentcount, String str_collegecount) { + this.mInflater = mInflater; + UnapprovedCount = unapprovedCount; + ComplitedCount = complitedCount; + ApprovedCount = approvedCount; + RequestForCompletion = requestForCompletion; + RequestForModification = requestForModification; + Rejected = rejected; + this.str_studentcount = str_studentcount; + this.str_collegecount = str_collegecount; + }*/ + + public GridAdapterPMSecond(Context context){//, String unapprovedCount, String complitedCount, String approvedCount, String requestForCompletion, String requestForModification, String rejected, String str_studentcount, String str_collegecount) { + mInflater = LayoutInflater.from(context); + + mItems.add(new Item("Fees", R.drawable.fees_new, "#df59a0")); + mItems.add(new Item("Ticket", R.drawable.fees_new, "#df59a0")); + mItems.add(new Item("T-Shirt", R.drawable.tshirt, "#0a64c5")); + + // mItems.add(new Item("Reports", R.drawable.report_new, "#1e7145")); + /* mItems.add(new Item("News Feeds", R.drawable.newsfeeds_new, "#0a64c5")); + mItems.add(new Item("Events", R.drawable.events_new, "#84795d")); + mItems.add(new Item("Contact Us",R.drawable.contact_new,"#f42a2a"));*/ + + /* mItems.add(new Item("News Feeds", R.drawable.newsfeeds_new,"#ffbc00")); + mItems.add(new Item("Events", R.drawable.events_new,"#d94343")); + mItems.add(new Item("Contact Us", R.drawable.contact_new,"#1e7145"));*/ + + /* UnapprovedCount = unapprovedCount; + ComplitedCount = complitedCount; + ApprovedCount = approvedCount; + RequestForCompletion = requestForCompletion; + RequestForModification = requestForModification; + Rejected = rejected; + this.str_studentcount = str_studentcount; + this.str_collegecount = str_collegecount;*/ + } + + @Override + public int getCount() { + return mItems.size(); + } + + @Override + public Item getItem(int i) { + return mItems.get(i); + } + + @Override + public long getItemId(int i) { + return mItems.get(i).drawableId; + } + + @Override + public View getView(int i, final View view, ViewGroup viewGroup) { + View v = view; + ImageView imageView; + final TextView name; + RelativeLayout relativeLayout; + + if (v == null) { + v = mInflater.inflate(R.layout.grid_item_pm, viewGroup, false); + v.setTag(R.id.imageView, v.findViewById(R.id.imageView)); + v.setTag(R.id.text, v.findViewById(R.id.text)); + v.setTag(R.id.relativeLayout, v.findViewById(R.id.relativeLayout)); + } + + imageView = (ImageView) v.getTag(R.id.imageView); + name = (TextView) v.getTag(R.id.text); + relativeLayout = (RelativeLayout) v.findViewById(R.id.relativeLayout); + + Item item = getItem(i); + + imageView.setImageResource(item.drawableId); + name.setText(item.name); + relativeLayout.setBackgroundColor(Color.parseColor(item.color)); + + relativeLayout.setOnClickListener(new View.OnClickListener() { + + @Override + public void onClick(View v) { + // Toast.makeText(v.getContext(), name.getText(), Toast.LENGTH_SHORT).show(); + String itemName=name.getText().toString(); + + // Toast.makeText(getApplicationContext(), item.text + " is clicked", Toast.LENGTH_SHORT).show(); + + if(itemName.equals("Fees")){ + Intent itthomeToFeesPaid = new Intent(v.getContext(),FeesPaidActivity.class); + itthomeToFeesPaid.putExtra("From","Manager"); + v.getContext().startActivity(itthomeToFeesPaid); + } + if(itemName.equals("T-Shirt")){ + Intent itthomeToFeesPaid = new Intent(v.getContext(),TShirtPaidActivity.class); + itthomeToFeesPaid.putExtra("From","Manager"); + v.getContext().startActivity(itthomeToFeesPaid); + } + if(itemName.equals("Ticket")){ + Intent itthomeToFeesPaid = new Intent(v.getContext(),FundMainActivity.class); + itthomeToFeesPaid.putExtra("From","Manager"); + v.getContext().startActivity(itthomeToFeesPaid); + } + + /* if(itemName.equals("Reports")){ + //Log.i("tag","UnapprovedCount"+UnapprovedCount); + Intent i = new Intent(v.getContext(),AnalyticChartActivity.class); + *//* i.putExtra("UnapprovedCount",UnapprovedCount); + i.putExtra("ComplitedCount",ComplitedCount); + i.putExtra("ApprovedCount",ApprovedCount); + i.putExtra("RequestForCompletion",RequestForCompletion); + i.putExtra("RequestForModification",RequestForModification); + i.putExtra("Rejected",Rejected); + i.putExtra("str_studentcount",str_studentcount); + i.putExtra("str_collegecount",str_collegecount);*//* + v.getContext().startActivity(i); + }*/ + /*if(itemName.equals("News Feeds")){ + Intent itthomeToNewsFeeds = new Intent(v.getContext(),NewsFeedsActivity.class); + v.getContext().startActivity(itthomeToNewsFeeds); + } + if(itemName.equals("Events")){ + Intent itthomeToEvent = new Intent(v.getContext(),EventsActivity.class); + v.getContext().startActivity(itthomeToEvent); + } + if(itemName.equals("Contact Us")){ + Intent itthomeToAboutUs = new Intent(v.getContext(),ContactUsActivity.class); + itthomeToAboutUs.putExtra("From","Manager"); + v.getContext().startActivity(itthomeToAboutUs); + }*/ + + } + } + ); + return v; + } + + + private static class Item { + public final String name; + public final int drawableId; + public final String color; + + Item(String name, int drawableId, String c) { + this.name = name; + this.drawableId = drawableId; + this.color=c; + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/GridAdapterPMThrid.java b/app/src/main/java/com/leadcampusapp/GridAdapterPMThrid.java new file mode 100644 index 0000000..800cb8c --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/GridAdapterPMThrid.java @@ -0,0 +1,169 @@ +package com.leadcampusapp; + +import android.content.Context; +import android.content.Intent; +import android.graphics.Color; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.ImageView; +import android.widget.RelativeLayout; +import android.widget.TextView; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by User on 8/25/2018. + */ + +public class GridAdapterPMThrid extends BaseAdapter { + private final List mItems = new ArrayList(); + private final LayoutInflater mInflater; + + String UnapprovedCount; + String ComplitedCount; + String ApprovedCount; + String RequestForCompletion; + String RequestForModification; + String Rejected; + String str_studentcount; + String str_collegecount; + + public GridAdapterPMThrid(LayoutInflater mInflater, String unapprovedCount, String complitedCount, String approvedCount, String requestForCompletion, String requestForModification, String rejected, String str_studentcount, String str_collegecount) { + this.mInflater = mInflater; + UnapprovedCount = unapprovedCount; + ComplitedCount = complitedCount; + ApprovedCount = approvedCount; + RequestForCompletion = requestForCompletion; + RequestForModification = requestForModification; + Rejected = rejected; + this.str_studentcount = str_studentcount; + this.str_collegecount = str_collegecount; + } + + public GridAdapterPMThrid(Context context) { + mInflater = LayoutInflater.from(context); + + /* mItems.add(new Item("Fees", R.drawable.fees_new, "#ffbc00")); + mItems.add(new Item("ML & LA", R.drawable.mlal_new, "#d94343")); + mItems.add(new Item("Reports", R.drawable.report_new, "#1e7145"));*/ + mItems.add(new Item("Stories", R.drawable.story_wht,"#4285f4")); + mItems.add(new Item("News Feeds", R.drawable.newsfeeds_new, "#800080")); + mItems.add(new Item("Events", R.drawable.events_new, "#BF5FFF")); //#84795d + // mItems.add(new Item("Contact Us",R.drawable.contact_new,"#f42a2a")); + + /* mItems.add(new Item("News Feeds", R.drawable.newsfeeds_new,"#ffbc00")); + mItems.add(new Item("Events", R.drawable.events_new,"#d94343")); + mItems.add(new Item("Contact Us", R.drawable.contact_new,"#1e7145"));*/ + } + + @Override + public int getCount() { + return mItems.size(); + } + + @Override + public Item getItem(int i) { + return mItems.get(i); + } + + @Override + public long getItemId(int i) { + return mItems.get(i).drawableId; + } + + @Override + public View getView(int i, final View view, ViewGroup viewGroup) { + View v = view; + ImageView imageView; + final TextView name; + RelativeLayout relativeLayout; + + if (v == null) { + v = mInflater.inflate(R.layout.grid_item_pm, viewGroup, false); + v.setTag(R.id.imageView, v.findViewById(R.id.imageView)); + v.setTag(R.id.text, v.findViewById(R.id.text)); + v.setTag(R.id.relativeLayout, v.findViewById(R.id.relativeLayout)); + } + + imageView = (ImageView) v.getTag(R.id.imageView); + name = (TextView) v.getTag(R.id.text); + relativeLayout = (RelativeLayout) v.findViewById(R.id.relativeLayout); + + Item item = getItem(i); + + imageView.setImageResource(item.drawableId); + name.setText(item.name); + relativeLayout.setBackgroundColor(Color.parseColor(item.color)); + + relativeLayout.setOnClickListener(new View.OnClickListener() { + + @Override + public void onClick(View v) { + // Toast.makeText(v.getContext(), name.getText(), Toast.LENGTH_SHORT).show(); + String itemName=name.getText().toString(); + + // Toast.makeText(getApplicationContext(), item.text + " is clicked", Toast.LENGTH_SHORT).show(); + + /* if(itemName.equals("Fees")){ + Intent itthomeToFeesPaid = new Intent(v.getContext(),FeesPaidActivity.class); + itthomeToFeesPaid.putExtra("From","Manager"); + v.getContext().startActivity(itthomeToFeesPaid); + } + if(itemName.equals("ML & LA")){ + Intent itthomeToAboutUs = new Intent(v.getContext(),RequestActivity.class); + itthomeToAboutUs.putExtra("From","Manager"); + v.getContext().startActivity(itthomeToAboutUs); + } + if(itemName.equals("Reports")){ + Intent i = new Intent(v.getContext(),AnalyticChartActivity.class); + i.putExtra("UnapprovedCount",UnapprovedCount); + i.putExtra("ComplitedCount",ComplitedCount); + i.putExtra("ApprovedCount",ApprovedCount); + i.putExtra("RequestForCompletion",RequestForCompletion); + i.putExtra("RequestForModification",RequestForModification); + i.putExtra("Rejected",Rejected); + i.putExtra("str_studentcount",str_studentcount); + i.putExtra("str_collegecount",str_collegecount); + v.getContext().startActivity(i); + }*/ + if(itemName.equals("News Feeds")){ + Intent itthomeToNewsFeeds = new Intent(v.getContext(),NewsFeedsActivity.class); + v.getContext().startActivity(itthomeToNewsFeeds); + } + if(itemName.equals("Events")){ + Intent itthomeToEvent = new Intent(v.getContext(),EventsActivity.class); + v.getContext().startActivity(itthomeToEvent); + } + if(itemName.equals("Stories")){ + Intent itthomeTostory = new Intent(v.getContext(),LeadStoryActivity.class); + itthomeTostory.putExtra("stroy_position", "0"); + v.getContext().startActivity(itthomeTostory); + } + /* if(itemName.equals("Contact Us")){ + Intent itthomeToAboutUs = new Intent(v.getContext(),ContactUsActivity.class); + itthomeToAboutUs.putExtra("From","Manager"); + v.getContext().startActivity(itthomeToAboutUs); + }*/ + + } + } + ); + return v; + } + + + private static class Item { + public final String name; + public final int drawableId; + public final String color; + + Item(String name, int drawableId, String c) { + this.name = name; + this.drawableId = drawableId; + this.color=c; + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/GridAdapterPrinciple.java b/app/src/main/java/com/leadcampusapp/GridAdapterPrinciple.java new file mode 100644 index 0000000..517748b --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/GridAdapterPrinciple.java @@ -0,0 +1,129 @@ +package com.leadcampusapp; + +import android.content.Context; +import android.content.Intent; +import android.graphics.Color; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.ImageView; +import android.widget.RelativeLayout; +import android.widget.TextView; +import android.widget.Toast; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by User on 8/25/2018. + */ + +public class GridAdapterPrinciple extends BaseAdapter { + private final List mItems = new ArrayList(); + private final LayoutInflater mInflater; + private String str_isFeesPaid = null; + + public String getStr_isFeesPaid() { + return str_isFeesPaid; + } + + public void setStr_isFeesPaid(String str_isFeesPaid) { + this.str_isFeesPaid = str_isFeesPaid; + } + + public GridAdapterPrinciple(Context context) { + + mInflater = LayoutInflater.from(context); + //str_isFeesPaids = str_isFeesPaid; + + mItems.add(new Item("About LEAD", R.drawable.about_new,"#f58d00")); + mItems.add(new Item("Projects", R.drawable.project_new,"#97c024")); + mItems.add(new Item("Stories", R.drawable.story_nw,"#4285f4")); + } + + @Override + public int getCount() { + return mItems.size(); + } + + @Override + public Item getItem(int i) { + return mItems.get(i); + } + + @Override + public long getItemId(int i) { + return mItems.get(i).drawableId; + } + + @Override + public View getView(int i, final View view, ViewGroup viewGroup) { + View v = view; + ImageView imageView; + final TextView name; + RelativeLayout relativeLayout; + + if (v == null) { + v = mInflater.inflate(R.layout.grid_item, viewGroup, false); + v.setTag(R.id.imageView, v.findViewById(R.id.imageView)); + v.setTag(R.id.text, v.findViewById(R.id.text)); + v.setTag(R.id.relativeLayout, v.findViewById(R.id.relativeLayout)); + } + + imageView = (ImageView) v.getTag(R.id.imageView); + name = (TextView) v.getTag(R.id.text); + relativeLayout = (RelativeLayout) v.findViewById(R.id.relativeLayout); + + Item item = getItem(i); + + imageView.setImageResource(item.drawableId); + name.setText(item.name); + relativeLayout.setBackgroundColor(Color.parseColor(item.color)); + + relativeLayout.setOnClickListener(new View.OnClickListener() { + + @Override + public void onClick(View v) { + // Toast.makeText(v.getContext(), name.getText(), Toast.LENGTH_SHORT).show(); + String itemName=name.getText().toString(); + if(itemName.equals("About LEAD")){ + Intent itthomeToAboutUs = new Intent(v.getContext(), AboutUsActivity.class); + itthomeToAboutUs.putExtra("From","Principle"); + v.getContext().startActivity(itthomeToAboutUs); + } + if(itemName.equals("Projects")){ +/* Intent itthomeToProject = new Intent(v.getContext(), ProjectDetails.class); + // itthomeToProject.putExtra("From","Student"); + v.getContext().startActivity(itthomeToProject);*/ + + + Intent itthomeToProject = new Intent(v.getContext(), PrincipleLoginActivity.class); + // itthomeToProject.putExtra("From","Student"); + v.getContext().startActivity(itthomeToProject); + + } + if(itemName.equals("Stories")){ + Intent itthomeTostory = new Intent(v.getContext(),LeadStoryActivity.class); + itthomeTostory.putExtra("stroy_position", "0"); + v.getContext().startActivity(itthomeTostory); + } + } + } + ); + return v; + } + + + private static class Item { + public final String name; + public final int drawableId; + public final String color; + + Item(String name, int drawableId, String c) { + this.name = name; + this.drawableId = drawableId; + this.color=c; + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/GridAdapterSecond.java b/app/src/main/java/com/leadcampusapp/GridAdapterSecond.java new file mode 100644 index 0000000..d9651ed --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/GridAdapterSecond.java @@ -0,0 +1,113 @@ +package com.leadcampusapp; + +import android.content.Context; +import android.content.Intent; +import android.graphics.Color; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.ImageView; +import android.widget.RelativeLayout; +import android.widget.TextView; +import android.widget.Toast; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by User on 8/25/2018. + */ + +public class GridAdapterSecond extends BaseAdapter { + private final List mItems = new ArrayList(); + private final LayoutInflater mInflater; + + public GridAdapterSecond(Context context) { + mInflater = LayoutInflater.from(context); + + mItems.add(new Item("News Feeds", R.drawable.newsfeeds_new,"#ffbc00")); + mItems.add(new Item("Events", R.drawable.events_new,"#d94343")); + mItems.add(new Item("Contact Us", R.drawable.contact_new,"#1e7145")); + } + + @Override + public int getCount() { + return mItems.size(); + } + + @Override + public Item getItem(int i) { + return mItems.get(i); + } + + @Override + public long getItemId(int i) { + return mItems.get(i).drawableId; + } + + @Override + public View getView(int i, View view, ViewGroup viewGroup) { + View v = view; + ImageView imageView; + final TextView name; + RelativeLayout relativeLayout; + + if (v == null) { + v = mInflater.inflate(R.layout.grid_item, viewGroup, false); + v.setTag(R.id.imageView, v.findViewById(R.id.imageView)); + v.setTag(R.id.text, v.findViewById(R.id.text)); + v.setTag(R.id.relativeLayout, v.findViewById(R.id.relativeLayout)); + } + + imageView = (ImageView) v.getTag(R.id.imageView); + name = (TextView) v.getTag(R.id.text); + relativeLayout = (RelativeLayout) v.findViewById(R.id.relativeLayout); + + Item item = getItem(i); + + imageView.setImageResource(item.drawableId); + name.setText(item.name); + relativeLayout.setBackgroundColor(Color.parseColor(item.color)); + + relativeLayout.setOnClickListener(new View.OnClickListener() { + + @Override + public void onClick(View v) { + // Toast.makeText(v.getContext(), name.getText(), Toast.LENGTH_SHORT).show(); + String itemName=name.getText().toString(); + if(itemName.equals("News Feeds")){ + Intent itthomeToNewsFeeds = new Intent(v.getContext(), NewsFeedsActivity.class); + // itthomeToNewsFeeds.putExtra("From","Student"); + v.getContext().startActivity(itthomeToNewsFeeds); + } + if(itemName.equals("Events")){ + Intent itthomeToEvent = new Intent(v.getContext(), EventsActivity.class); + // itthomeToEvent.putExtra("From","Student"); + //Intent itthomeToEvent = new Intent(getActivity().getBaseContext(), TestActivity2.class); + v.getContext().startActivity(itthomeToEvent); + } + if(itemName.equals("Contact Us")){ + Intent itthomeToAboutUs = new Intent(v.getContext(), ContactUsActivity.class); + itthomeToAboutUs.putExtra("From","Student"); + v.getContext().startActivity(itthomeToAboutUs); + } + } + } + ); + return v; + } + + + private static class Item { + public final String name; + public final int drawableId; + public final String color; + + Item(String name, int drawableId, String c) { + this.name = name; + this.drawableId = drawableId; + this.color=c; + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/GridAdapterStudentThird.java b/app/src/main/java/com/leadcampusapp/GridAdapterStudentThird.java new file mode 100644 index 0000000..81158f7 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/GridAdapterStudentThird.java @@ -0,0 +1,105 @@ +package com.leadcampusapp; + +import android.content.Context; +import android.content.Intent; +import android.graphics.Color; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.ImageView; +import android.widget.RelativeLayout; +import android.widget.TextView; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by User on 8/25/2018. + */ + +public class GridAdapterStudentThird extends BaseAdapter +{ + private final List mItems = new ArrayList(); + private final LayoutInflater mInflater; + + public GridAdapterStudentThird(Context context) { + mInflater = LayoutInflater.from(context); + + + mItems.add(new Item("Payment", R.drawable.contact_new,"#1e7145")); + } + + @Override + public int getCount() { + return mItems.size(); + } + + @Override + public Item getItem(int i) { + return mItems.get(i); + } + + @Override + public long getItemId(int i) { + return mItems.get(i).drawableId; + } + + @Override + public View getView(int i, View view, ViewGroup viewGroup) { + View v = view; + ImageView imageView; + final TextView name; + RelativeLayout relativeLayout; + + if (v == null) { + v = mInflater.inflate(R.layout.grid_item, viewGroup, false); + v.setTag(R.id.imageView, v.findViewById(R.id.imageView)); + v.setTag(R.id.text, v.findViewById(R.id.text)); + v.setTag(R.id.relativeLayout, v.findViewById(R.id.relativeLayout)); + } + + imageView = (ImageView) v.getTag(R.id.imageView); + name = (TextView) v.getTag(R.id.text); + relativeLayout = (RelativeLayout) v.findViewById(R.id.relativeLayout); + + Item item = getItem(i); + + imageView.setImageResource(item.drawableId); + name.setText(item.name); + relativeLayout.setBackgroundColor(Color.parseColor(item.color)); + + relativeLayout.setOnClickListener(new View.OnClickListener() { + + @Override + public void onClick(View v) + { + // Toast.makeText(v.getContext(), name.getText(), Toast.LENGTH_SHORT).show(); + String itemName=name.getText().toString(); + if(itemName.equals("Payment")) + { + + Intent intent_payment = new Intent(v.getContext(), Activity_studentUPI.class); + // itthomeToAboutUs.putExtra("From","Student"); + v.getContext().startActivity(intent_payment); + + } + } + } + ); + return v; + } + + + private static class Item { + public final String name; + public final int drawableId; + public final String color; + + Item(String name, int drawableId, String c) { + this.name = name; + this.drawableId = drawableId; + this.color=c; + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/GuestActivity.java b/app/src/main/java/com/leadcampusapp/GuestActivity.java new file mode 100644 index 0000000..379ba96 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/GuestActivity.java @@ -0,0 +1,113 @@ +package com.leadcampusapp; + +import androidx.legacy.app.ActionBarDrawerToggle; +import androidx.drawerlayout.widget.DrawerLayout; +//import android.support.v7.app.ActionBarDrawerToggle; +import androidx.appcompat.app.AppCompatActivity; +import android.os.Bundle; +import android.view.View; +import android.widget.ArrayAdapter; +import android.widget.ListView; + +public class GuestActivity extends AppCompatActivity +{ + + DrawerLayout mDrawerLayout; + // ListView represents Navigation Drawer + ListView mDrawerList; + + // ActionBarDrawerToggle indicates the presence of Navigation Drawer in the action bar + ActionBarDrawerToggle mDrawerToggle; + // Title of the action bar + String mTitle=""; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_guest); + + + /*getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + //getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background)); + + View actionBarView = getSupportActionBar().getCustomView(); + TextView actionBarTV = (TextView) actionBarView.findViewById(R.id.txt_actionBar); + actionBarTV.setText("Stories"); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true);*/ + mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); + mDrawerList = (ListView) findViewById(R.id.drawer_list); + + mTitle = (String) getTitle(); + + // Getting reference to the ActionBarDrawerToggle + mDrawerToggle = new ActionBarDrawerToggle( this, + mDrawerLayout, + R.drawable.ic_drawer, + R.string.drawer_open, + R.string.drawer_close){ + + /** Called when drawer is closed */ + public void onDrawerClosed(View view) { + getActionBar().setTitle(mTitle); + invalidateOptionsMenu(); + } + + /** Called when a drawer is opened */ + public void onDrawerOpened(View drawerView) { + getActionBar().setTitle("Guest Login"); + invalidateOptionsMenu(); + } + }; + + // Setting DrawerToggle on DrawerLayout + mDrawerLayout.setDrawerListener(mDrawerToggle); + +// Creating an ArrayAdapter to add items to the listview mDrawerList + ArrayAdapter adapter = new ArrayAdapter( + getBaseContext(), + R.layout.sidebardrawer_list_item , + getResources().getStringArray(R.array.guestsidebar) + ); + + + // Setting the adapter on mDrawerList + mDrawerList.setAdapter(adapter); + + // Enabling Home button + // getActionBar().setHomeButtonEnabled(true); + + // Enabling Up navigation + // getActionBar().setDisplayHomeAsUpEnabled(true); + + + + + + if (findViewById(R.id.fragment_container) != null) { + + // However, if we're being restored from a previous state, + // then we don't need to do anything and should return or else + // we could end up with overlapping fragments. + if (savedInstanceState != null) { + return; + } + + + // Create a new Fragment to be placed in the activity layout + LeadStoryFragment firstFragment = new LeadStoryFragment(); + + Bundle bundle = new Bundle(); + bundle.putString("story_possion" , "0"); + firstFragment.setArguments(bundle); + // In case this activity was started with special instructions from an + // Intent, pass the Intent's extras to the fragment as arguments + // firstFragment.setArguments(getIntent().getExtras()); + + // Add the fragment to the 'fragment_container' FrameLayout + getSupportFragmentManager().beginTransaction() + .add(R.id.fragment_container, firstFragment).commit(); + } + } +} diff --git a/app/src/main/java/com/leadcampusapp/GuestLoginActivity.java b/app/src/main/java/com/leadcampusapp/GuestLoginActivity.java new file mode 100644 index 0000000..9bb5e82 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/GuestLoginActivity.java @@ -0,0 +1,206 @@ +package com.leadcampusapp; + +import android.content.Intent; +import android.os.Bundle; +//import android.support.design.widget.NavigationView; +import androidx.core.view.GravityCompat; +import androidx.drawerlayout.widget.DrawerLayout; +import androidx.appcompat.app.ActionBarDrawerToggle; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; + +import android.view.MenuItem; + +import com.google.android.material.navigation.NavigationView; + +public class GuestLoginActivity extends AppCompatActivity + implements NavigationView.OnNavigationItemSelectedListener { + + + + + + @Override + protected void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_guest_login); + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + /*FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);//app_bar_guest_login.xml + fab.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) + .setAction("Action", null).show(); + } + });*/ + + + /*getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + //getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background)); + + View actionBarView = getSupportActionBar().getCustomView(); + TextView actionBarTV = (TextView) actionBarView.findViewById(R.id.txt_actionBar); + actionBarTV.setText("Stories"); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true);*/ + + if (findViewById(R.id.fragment_container) != null) { + + // However, if we're being restored from a previous state, + // then we don't need to do anything and should return or else + // we could end up with overlapping fragments. + if (savedInstanceState != null) { + return; + } + + // Create a new Fragment to be placed in the activity layout + LeadStoryFragment firstFragment = new LeadStoryFragment(); + + Bundle bundle = new Bundle(); + bundle.putString("story_possion" , "0"); + firstFragment.setArguments(bundle); + // In case this activity was started with special instructions from an + // Intent, pass the Intent's extras to the fragment as arguments + // firstFragment.setArguments(getIntent().getExtras()); + + // Add the fragment to the 'fragment_container' FrameLayout + /*getSupportFragmentManager().beginTransaction() + .add(R.id.fragment_container, firstFragment).commit();*/ + + setTitle("Stories"); + getSupportFragmentManager().beginTransaction() + .replace(R.id.fragment_container, firstFragment).commit(); + } + + + + + + + + + + DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); + ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( + this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); + drawer.addDrawerListener(toggle); + toggle.syncState(); + + NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); + navigationView.setNavigationItemSelectedListener(this); + } + + @Override + public void onBackPressed() { + /* DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); + if (drawer.isDrawerOpen(GravityCompat.START)) { + drawer.closeDrawer(GravityCompat.START); + } else { + super.onBackPressed(); + }*/ + DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); + if (drawer.isDrawerOpen(GravityCompat.START)) { + drawer.closeDrawer(GravityCompat.START); + } else { + Intent i = new Intent(GuestLoginActivity.this, LoginActivity.class); + startActivity(i); + finish(); + } + } + + /*@Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.guest_login, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); + + //noinspection SimplifiableIfStatement + if (id == R.id.action_settings) { + return true; + } + + return super.onOptionsItemSelected(item); + }*/ + + + + + @SuppressWarnings("StatementWithEmptyBody") + @Override + public boolean onNavigationItemSelected(MenuItem item) { + // Handle navigation view item clicks here. + int id = item.getItemId(); + + if (id == R.id.nav_sidebar_story) + { + // Handle the camera action + + // Create a new Fragment to be placed in the activity layout + LeadStoryFragment firstFragment = new LeadStoryFragment(); + + Bundle bundle = new Bundle(); + bundle.putString("story_possion" , "0"); + firstFragment.setArguments(bundle); + // In case this activity was started with special instructions from an + // Intent, pass the Intent's extras to the fragment as arguments + //firstFragment.setArguments(getIntent().getExtras()); + + setTitle("Stories"); + // Add the fragment to the 'fragment_container' FrameLayout + getSupportFragmentManager().beginTransaction() + .replace(R.id.fragment_container, firstFragment).commit(); + + + } else if (id == R.id.nav_events) + { + CurrentEventsFragment currenteventsFragment_Obj = new CurrentEventsFragment(); + + setTitle("Current Events"); + getSupportFragmentManager().beginTransaction() + .replace(R.id.fragment_container, currenteventsFragment_Obj).commit(); + } + else if (id == R.id.nav_newsfeeds) + { + Fragment_GuestNewsFeeds fragment_guestNewsFeeds = new Fragment_GuestNewsFeeds(); + + setTitle("News Feeds"); + getSupportFragmentManager().beginTransaction() + .replace(R.id.fragment_container, fragment_guestNewsFeeds).commit(); + } + else if (id == R.id.nav_contact_us) + { + Fragment_ContactUs fragment_contactus_obj = new Fragment_ContactUs(); + + setTitle("Contact Us"); + getSupportFragmentManager().beginTransaction() + .replace(R.id.fragment_container, fragment_contactus_obj).commit(); + + } + else if (id == R.id.nav_about_us) + { + Fragment_GuestAboutUs fragment_guestAboutUs_Obj = new Fragment_GuestAboutUs(); + setTitle("About Us"); + getSupportFragmentManager().beginTransaction() + .replace(R.id.fragment_container, fragment_guestAboutUs_Obj).commit(); + + + + } + + DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); + drawer.closeDrawer(GravityCompat.START); + return true; + } +} diff --git a/app/src/main/java/com/leadcampusapp/HomeActivity.java b/app/src/main/java/com/leadcampusapp/HomeActivity.java new file mode 100644 index 0000000..371dd91 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/HomeActivity.java @@ -0,0 +1,1666 @@ +package com.leadcampusapp; + +import android.annotation.SuppressLint; +import android.app.AlertDialog; +import android.app.Dialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.pm.PackageManager; +import android.graphics.Color; +import android.graphics.Point; +import android.os.AsyncTask; +import android.os.Build; +//import android.support.design.widget.TabLayout; +import androidx.core.app.ActivityCompat; +import androidx.core.content.ContextCompat; +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; +import androidx.appcompat.app.AppCompatActivity; + +import androidx.viewpager.widget.ViewPager; + +import android.os.Bundle; + +import androidx.appcompat.widget.AppCompatSpinner; + +import android.provider.Settings; +import android.telephony.TelephonyManager; +import android.util.DisplayMetrics; +import android.util.Log; +import android.view.Display; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.EditText; +import android.widget.RadioButton; +import android.widget.RadioGroup; +import android.widget.TextView; +import android.os.Handler; +import android.widget.Toast; + +//import com.android.sripad.leadnew_22_6_2018.R; + +import com.google.android.material.tabs.TabLayout; +import com.google.firebase.iid.FirebaseInstanceId; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.io.File; +import java.util.ArrayList; +import java.util.UUID; + +public class HomeActivity extends AppCompatActivity implements ConnectivityReceiver.ConnectivityReceiverListener { + + Context context; + + private boolean doubleBackToExitPressedOnce = false; + + + Class_URL config_obj = new Class_URL(); + public static final String PREFBook_LoginTrack = "prefbook_logintrack"; + public static final String PrefID_WhereToGo = "prefid_wheretogo"; // + SharedPreferences shardprefLoginTrack_obj; + SharedPreferences.Editor editor_LoginTrack; + + SwipeRefreshLayout swipeRefreshLayout; + + + public static final String PREFBook_Stud = "prefbook_stud"; //sharedpreference Book + public static final String PrefID_RegID = "prefid_regid"; // + public static final String PrefID_SName = "prefid_sname"; // + public static final String PrefID_PM_SName = "prefid_pmsname"; // + public static final String PrefID_PM_S_MID = "prefid_pm_s_mid"; // + public static final String PrefID_SLeadID = "prefid_sleadid"; // + public static final String PrefID_PM_SEmailID = "prefid_pm_semailid"; // + public static final String PrefID_SCellNo = "prefid_scellno"; // + public static final String PrefID_SCollegeName = "prefid_scollegename"; // + public static final String PrefID_SImageUrl = "prefid_simgUrl"; // + public static final String PrefId_S_Password = "prefid_spassword"; + public static final String PrefId_S_Username = "prefid_susername"; + + public static final String PrefId_S_Gender = "prefid_sgender"; + public static final String PrefId_S_StarCount = "prefid_sstarCount"; + + public static final String PrefId_S_FB = "prefid_sfb"; + public static final String PrefId_S_TW = "prefid_stw"; + public static final String PrefId_S_IN = "prefid_sin"; + public static final String PrefId_S_Whatsapp = "prefid_swhatsapp"; + public static final String PrefId_S_IsFeesPaid = "prefid_sfeesPaid"; + + public static final String PrefId_S_TshirtStatus = "prefid_s_tshirtstatus"; + + public static final String PrefId_S_AcademicId = "prefid_sacademicid"; + + public static final String PrefID_SStudentType = "prefid_sstudentType"; // + public static final String PrefID_SSisStudentLEADer = "prefid_ssisStudentLEADer"; + + public static final String PrefID_PM_S_ImagePath = "prefid_pm_imageUrl"; // + public static final String PrefID_PM_S_CellNo = "prefid_pm_cellno";// + + + public static final String PrefID_S_ImgBase64 = "prefid_s_imgBase64"; // + public static final String PrefID_PM_ImgBase64 = "prefid_pm_imgBase64"; + + public static final String PrefID_Role = "prefid_role"; + public static final String PrefID_S_isprofileEdited = "prefid_isprofileEdited"; + + public static final String PrefID_SLLP = "prefID_SLLP"; + public static final String PrefID_SPrayana = "prefID_SPrayana"; + public static final String PrefID_SYuva = "prefID_SYuva"; + public static final String PrefID_SValedicotry = "prefID_SValedicotry"; + + SharedPreferences shardpref_S_obj; + SharedPreferences.Editor editor_S; + + + String str_regid, str_sname,str_role, str_s_pmname, str_s_leadid, str_s_emailID, str_s_cellno, str_s_collegeName, str_studImgUrl, str_s_studentType, str_s_isStudentLEADer, str_s_gender, str_s_starCount, str_fb, str_tw, str_whatsapp, str_in, str_s_pmMobileNo; + String str_isFeesPaid, Str_s_PMImageURL, str_tshirt_status; + String str_s_LLP, str_s_Prayana, str_s_Yuva, str_s_Valedicotry; + + + String Str_PM_S_Full_ImgUrl = null; + String Str_fullStudImgUrl = null; + + private String serverPath = Class_URL.ServerPath.toString().trim(); + private ProgressDialog progressDialog_refreshSwipe; + Class_InternetDectector internetDectector; + Boolean isInternetPresent = false; + + + private Menu thismenu; + + + ArrayAdapter dataAdapter_tshrit_reapply; + private AppCompatSpinner spin_tshirtreapply_reason; + String str_tshirt_reapply_reason; + + RadioGroup rg_tshirt_reapply_radiogroup; + private RadioButton rb_tshirt_reapply_radiobutton; + String str_tshir_reapply_tsize; + String Str_tshirt_reapply_error1, Str_tshirt_reapply_error2, str_tshirt_reapply_response, str_regId_reapplytshirt, str_s_pm_mid, Str_tshirterror4, Str_tshirterror3; + + + String str_getTshirtstatus_is_approved; + + String str_gettshirtlistresponse1, str_getTshirtStatus1, str_getTshirt_requestedID1, str_getTshirt_tshirtSize1; + + + TelephonyManager tm1 = null; + String myVersion, deviceBRAND, deviceHARDWARE, devicePRODUCT, deviceUSER, deviceModelName, deviceId, tmDevice, tmSerial, androidId, simOperatorName, sdkver, mobileNumber; + int sdkVersion, Measuredwidth = 0, Measuredheight = 0, update_flage = 0; + AsyncTask mRegisterTask; + String regId = "leadxz", Str_FCMName; + private String versioncode; + EditText username_et,password_et, dialognewpwd_et,dialogconfpwd_et; + String str_newPwd; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_home); + + context = HomeActivity.this; + + + Str_tshirt_reapply_error1 = Str_tshirt_reapply_error2 = Str_tshirterror4 = Str_tshirterror3 = str_getTshirtstatus_is_approved = "no"; + + //Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + + + //getSupportActionBar().setTitle("LeadMIS"); + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + // getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background)); + + /* toolbar.setTitle("LeadMIS"); + setSupportActionBar(toolbar);*/ + + shardprefLoginTrack_obj = this.getSharedPreferences(PREFBook_LoginTrack, Context.MODE_PRIVATE); + editor_LoginTrack = shardprefLoginTrack_obj.edit(); + editor_LoginTrack.putString(PrefID_WhereToGo, config_obj.packagename + "HomeActivity"); + editor_LoginTrack.commit(); + + + shardpref_S_obj = getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + + str_s_leadid = shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + str_s_cellno = shardpref_S_obj.getString(PrefID_SCellNo, "").trim(); + Str_FCMName = str_s_leadid.toString(); + + str_tshirt_status = shardpref_S_obj.getString(PrefId_S_TshirtStatus, "").trim(); + + str_regId_reapplytshirt = shardpref_S_obj.getString(PrefID_RegID, "").trim(); + str_s_pm_mid = shardpref_S_obj.getString(PrefID_PM_S_MID, "").trim(); + str_sname = shardpref_S_obj.getString(PrefID_SName, "").trim(); + str_role = shardpref_S_obj.getString(PrefID_Role, "").trim(); + Log.e("str_role:", str_role); + + Log.e("leadID ", str_s_leadid.toString()); + Log.e("Cellnumber", str_s_cellno.toString()); + + try { + versioncode = this.getPackageManager().getPackageInfo(this.getPackageName(), 0).versionName; + } catch (PackageManager.NameNotFoundException e) { + e.printStackTrace(); + } + + + View view1; + LayoutInflater inflater1 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view1 = inflater1.inflate(R.layout.myprofiletablayout, null); + + TextView txt_personProfile = (TextView) view1.findViewById(R.id.txt_personProfile); + txt_personProfile.setTextColor(ContextCompat.getColor(context, R.color.colorBlack)); + + View view2; + LayoutInflater inflater2 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view2 = inflater2.inflate(R.layout.leaderprofiletablayout, null); + + TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); + tabLayout.addTab(tabLayout.newTab().setCustomView(view1)); + tabLayout.addTab(tabLayout.newTab().setCustomView(view2)); + //tabLayout.addTab(tabLayout.newTab().setText("Tab 3")); + //tabLayout.setTabGravity(TabLayout.GRAVITY_FILL); + + + swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeToRefresh); + + + final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); + final ProfileAdapter adapter = new ProfileAdapter(getSupportFragmentManager(), tabLayout.getTabCount()); + viewPager.setAdapter(adapter); + viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); + + + tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { + @Override + public void onTabSelected(TabLayout.Tab tab) { + viewPager.setCurrentItem(tab.getPosition()); + + View view = tab.getCustomView(); + TextView txt_personProfile = (TextView) view.findViewById(R.id.txt_personProfile); + txt_personProfile.setTextColor(ContextCompat.getColor(context, R.color.colorBlack)); + } + + @Override + public void onTabUnselected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + TextView txt_personProfile = (TextView) view.findViewById(R.id.txt_personProfile);//MyprofileFragment.java + //MyprofileFragmentNew.java + txt_personProfile.setTextColor(ContextCompat.getColor(context, R.color.colorBlack)); + } + + @Override + public void onTabReselected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + TextView txt_personProfile = (TextView) view.findViewById(R.id.txt_personProfile);//LeaderProfileFragment.java + txt_personProfile.setTextColor(ContextCompat.getColor(context, R.color.colorBlack)); + } + }); + + /* getSupportActionBar().setDisplayShowHomeEnabled(true); + getSupportActionBar().setHomeButtonEnabled(true); + getSupportActionBar().setDisplayHomeAsUpEnabled(true);*/ + + + swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { + @Override + public void onRefresh() { + + internetDectector = new Class_InternetDectector(getApplicationContext()); + isInternetPresent = internetDectector.isConnectingToInternet(); + + if (isInternetPresent) { + + // implement Handler to wait for 2 seconds and then update UI + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + // cancle the Visual indication of a refresh + /*try { + wait(300); + } catch (InterruptedException e) { + e.printStackTrace(); + }*/ + swipeRefreshLayout.setRefreshing(false); + + + Log.e("leadID ", str_s_leadid.toString()); + Log.e("Cellnumber", str_s_cellno.toString()); + + GetLoginDetails getloginDetails = new GetLoginDetails(HomeActivity.this); + getloginDetails.execute(str_s_cellno.toString(), str_s_leadid.toString()); + //Toast.makeText(getApplicationContext(),"net"+isInternetPresent.toString(),Toast.LENGTH_SHORT).show(); + + + AsyncCallFCM task = new AsyncCallFCM(HomeActivity.this); + task.execute(); + + + } + }, 500); + + } else { + Toast.makeText(getApplicationContext(), "No Internet", Toast.LENGTH_LONG).show(); + } + + } + + + }); + + + + + + /* if (str_tshirt_status.equals("3")) + { + // Toast.makeText(getApplicationContext(),) + if(thismenu != null) + { + thismenu.findItem(R.id.action_tshirtreapply).setVisible(true); + + }else + { + thismenu.findItem(R.id.action_tshirtreapply).setVisible(false); + } + }*/ + + + if (str_tshirt_status.equals("3")) { + + + internetDectector = new Class_InternetDectector(getApplicationContext()); + isInternetPresent = internetDectector.isConnectingToInternet(); + + if (isInternetPresent) { + GetTshirtlist_AsyncCallWS task = new GetTshirtlist_AsyncCallWS(HomeActivity.this); + task.execute(); + } + + } + + + }// end of Oncreate() + + + @Override + protected void onResume() { + super.onResume(); + + // register connection status listener + MyApplication.getInstance().setConnectivityListener(this); + } + + @Override + public void onNetworkConnectionChanged(boolean isConnected) { + showSnack(isConnected); + } + + private void showSnack(boolean isConnected) { + + if (!isConnected) { + + AlertDialog.Builder adb = new AlertDialog.Builder(HomeActivity.this); + //adb.setView(alertDialogView); + + adb.setTitle("Sorry! Not connected to the internet"); + + adb.setIcon(android.R.drawable.ic_dialog_alert); + + adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + + adb.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + adb.setCancelable(true); + adb.show(); + + //finish(); + } + + } + + + @Override + public boolean onCreateOptionsMenu(Menu menu) + // + //public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { + { + + + getMenuInflater().inflate(R.menu.menu, menu); + + + if (str_tshirt_status.equals("3")) { + + + MenuItem shareItem = menu.findItem(R.id.action_tshirtreapply); + shareItem.setVisible(true); + } + return true; + + // return super.onCreateOptionsMenu(menu); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + + //action_tshirtreapply + + if (id == R.id.action_editProfile) { + Intent itthomeToEditProfile = new Intent(HomeActivity.this, EditProfileActivity.class); + startActivity(itthomeToEditProfile); + return true; + } + + + if( id == R.id.changepwd){ + final Dialog dialog = new Dialog(HomeActivity.this); + + + dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); + dialog.setContentView(R.layout.change_pwd); + dialog.setCancelable(false); + + + Button forgotpasswordcancel_bt = (Button) dialog.findViewById(R.id.forgotpasswordcancel_bt); + Button forgotpasswordsubmit_bt = (Button) dialog.findViewById(R.id.forgotpasswordsubmit_bt); + dialognewpwd_et=(EditText) dialog.findViewById(R.id.dialognewpwd_et); + dialogconfpwd_et=(EditText)dialog.findViewById(R.id.dialogconfpwd_et); + + forgotpasswordcancel_bt.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) + { + dialog.dismiss(); + + } + }); + + forgotpasswordsubmit_bt.setOnClickListener(new View.OnClickListener() { + + @Override + public void onClick(View arg0) + { + + internetDectector = new Class_InternetDectector(getApplicationContext()); + isInternetPresent = internetDectector.isConnectingToInternet(); + + if (isInternetPresent) + { + + str_newPwd=dialognewpwd_et.getText().toString(); + String str_confPwd=dialogconfpwd_et.getText().toString(); + if(str_newPwd.equalsIgnoreCase(str_confPwd)){ + ChangePassword changePassword=new ChangePassword(HomeActivity.this); + changePassword.execute(); + } + + dialog.dismiss(); + + } + else{ + Toast.makeText(HomeActivity.this, "Kindly connect to internet", Toast.LENGTH_SHORT).show(); + } + + + + + } + }); + + + dialog.show(); + } + if (id == R.id.action_logout) { + + editor_LoginTrack = shardprefLoginTrack_obj.edit(); + editor_LoginTrack.putString(PrefID_WhereToGo, config_obj.packagename + "LoginActivity"); + editor_LoginTrack.commit(); + + //deleteCache(context); + + Intent itthomeToLogin = new Intent(HomeActivity.this, LoginActivity.class); + startActivity(itthomeToLogin); + return true; + } + if (id == R.id.action_feedback) { + Intent itthomeTofeeedback = new Intent(HomeActivity.this, FeedbackActivity.class); + startActivity(itthomeTofeeedback); + return true; + } + if (id == R.id.action_request) { + Intent itthomeTorequest = new Intent(HomeActivity.this, StudentRequest.class); + startActivity(itthomeTorequest); + return true; + } + if (id == R.id.action_tshirtreapply) { + + /*TextView txtclose; + Button btnFollow; + final Dialog myDialog = new Dialog(this); + myDialog.setContentView(R.layout.custompopup); + txtclose =(TextView) myDialog.findViewById(R.id.txtclose); + //txtclose.setText("M"); + // btnFollow = (Button) myDialog.findViewById(R.id.btnfollow); + txtclose.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + myDialog.dismiss(); + } + }); + myDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); + myDialog.show();*/ + + + final Dialog myDialog = new Dialog(this); + myDialog.setContentView(R.layout.tshirt_reapply_customdialog); + myDialog.setCancelable(false); + + + // rg_tshirtradiogroup =(RadioGroup)myDialog.findViewById(R.id. tshirtradiogroup_RG); + + + spin_tshirtreapply_reason = (AppCompatSpinner) myDialog.findViewById(R.id.spin_tshirtreapply_reason); + + rg_tshirt_reapply_radiogroup = (RadioGroup) myDialog.findViewById(R.id.tshirt_reapply_radiogroup_RG); + Button dialog_bt_tshirt_reapply = (Button) myDialog.findViewById(R.id.tshirt_reapply_BT); + Button dialog_bt_tshirtcancel = (Button) myDialog.findViewById(R.id.tshirt_reapply_cancel_BT); + // TextView previous_request_tv =(TextView)myDialog.findViewById(R.id.previous_request_tv); + + settshirt_reapply_spinner(); + + + spin_tshirtreapply_reason.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected(AdapterView parent, View view, + int position, long id) { + // TODO Auto-generated method stub + str_tshirt_reapply_reason = spin_tshirtreapply_reason.getSelectedItem().toString(); + //Toast.makeText(getApplicationContext(),"Reason: "+str_tshirt_reapply_reason,Toast.LENGTH_SHORT).show(); + } + + @Override + public void onNothingSelected(AdapterView parent) { + // TODO Auto-generated method stub + + } + }); + + + dialog_bt_tshirt_reapply.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + int selectedId = rg_tshirt_reapply_radiogroup.getCheckedRadioButtonId(); + + rb_tshirt_reapply_radiobutton = (RadioButton) myDialog.findViewById(selectedId); + + String string = rb_tshirt_reapply_radiobutton.getText().toString().trim(); + String[] vals = string.split(" "); + if (vals.length > 1) { + str_tshir_reapply_tsize = vals[0]; + } + + + internetDectector = new Class_InternetDectector(getApplicationContext()); + isInternetPresent = internetDectector.isConnectingToInternet(); + + if (isInternetPresent) { + Tshirt_reapply_AsyncCallWS task = new Tshirt_reapply_AsyncCallWS(HomeActivity.this); + task.execute(); + myDialog.cancel(); + } else { + Toast.makeText(getApplicationContext(), "No Internet", Toast.LENGTH_LONG).show(); + } + + } + }); + + + dialog_bt_tshirtcancel.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + myDialog.cancel(); + } + }); + + + myDialog.show(); + + + return true; + } + + + if (id == R.id.notification) { + Intent itthomeToNotification = new Intent(HomeActivity.this, NotificationHistoryActivity.class); + startActivity(itthomeToNotification); + return true; + } + + return super.onOptionsItemSelected(item); + } + + public static void deleteCache(Context context) { + try { + File dir = context.getCacheDir(); + deleteDir(dir); + } catch (Exception e) { + } + } + + public static boolean deleteDir(File dir) { + if (dir != null && dir.isDirectory()) { + String[] children = dir.list(); + for (int i = 0; i < children.length; i++) { + boolean success = deleteDir(new File(dir, children[i])); + if (!success) { + return false; + } + } + return dir.delete(); + } else if (dir != null && dir.isFile()) { + return dir.delete(); + } else { + return false; + } + } + + + @Override + public void onBackPressed() { + // Do Here what ever you want do on back press; + //finish(); + /* if (doubleBackToExitPressedOnce) { + //super.onBackPressed(); + //return; + finishAffinity(); + System.exit(0); + } + + this.doubleBackToExitPressedOnce = true; + Toast.makeText(this, "Please press back again to exit", Toast.LENGTH_SHORT).show(); + + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + doubleBackToExitPressedOnce=false; + } + }, 2000);*/ + + + Intent startMain = new Intent(Intent.ACTION_MAIN); + startMain.addCategory(Intent.CATEGORY_HOME); + startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(startMain); + } + + +//------------------------------------------------------------------------------------------------------------ + + public class ChangePassword extends AsyncTask { + + Context context; + //AlertDialog alertDialog; + + //private ProgressBar progressBar; + + private ProgressDialog progressDialog; + + ChangePassword(Context ctx) { + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapPrimitive doInBackground(String... params) { + + SoapPrimitive response = ChangePassword(); + + //Log.d("ResponseCommitsss", response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressDialog.setMessage("Loading"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + + + + // String str_result=result.getProperty("Status").toString(); + if(result.toString().equalsIgnoreCase("Success")){ + // dialog.dismiss(); + progressDialog.dismiss(); + + AlertDialog.Builder dialog = new AlertDialog.Builder(HomeActivity.this); + dialog.setCancelable(false); + dialog.setTitle(R.string.alert); + + + dialog.setMessage(" Password is updated \n Thank you."); + + dialog.setPositiveButton("Ok", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) { + dialog.dismiss(); + } + }); + + + final AlertDialog alert = dialog.create(); + alert.setOnShowListener(new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface arg0) { + alert.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#004D40")); + } + }); + alert.show(); + + } + else{ + + progressDialog.dismiss(); + Toast toast = Toast.makeText(getApplicationContext(), "Unable to change password", Toast.LENGTH_LONG); + TextView toastMessage = (TextView) toast.getView().findViewById(android.R.id.message); + toastMessage.setTextColor(Color.RED); + toast.show(); + } + + } + + } + private SoapPrimitive ChangePassword() + { + + String METHOD_NAME = "Change_Password"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/Change_Password"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + request.addProperty("User_Id", str_regId_reapplytshirt);//string + request.addProperty("User_Type",str_role); + request.addProperty("New_Password",str_newPwd);//string + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Login.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + // SendStudentRequestforManager{Lead_Id=MF00993; Email_id=testing; Student_MobileNo=9689240475; Message=testing; } + + Log.e("tag","Request Change_Password="+request.toString()); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + // Log.d("soapResponseyyyyyyy",envelope.getResponse().toString()); + + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + Log.d("tag","soapRespons Change_Password="+response.toString()); + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.d("exception outside",t.getMessage().toString()); + } + return null; + + + } + + public class GetLoginDetails extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + //private ProgressBar progressBar; + + + GetLoginDetails(Context ctx) { + context = ctx; + progressDialog_refreshSwipe = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(String... params) { + String mobilenum = (String) params[0]; + String leadid = (String) params[1]; + //String versionCode = (String) params[2]; + + SoapObject response = getLoginDetails(mobilenum, leadid); + + + return response; + } + + @Override + protected void onPreExecute() { +/* progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + + progressDialog_refreshSwipe.setMessage("Loading"); + progressDialog_refreshSwipe.setCanceledOnTouchOutside(false); + progressDialog_refreshSwipe.show(); + + } + + @Override + protected void onPostExecute(SoapObject result) { + //progressBar.setVisibility(View.GONE); + progressDialog_refreshSwipe.dismiss(); + + if (result != null) { + String finalResult = result.toString(); + String finals = finalResult.replace("anyType{}", ""); + Log.d("Finals is", finals); + + + SoapPrimitive status = (SoapPrimitive) result.getProperty("Status"); + + + if (status.toString().equals("Success")) { + SoapPrimitive role = (SoapPrimitive) result.getProperty("Role"); + Log.d("Role is:", role.toString()); + + SoapPrimitive isProfileEdited = (SoapPrimitive) result.getProperty("isProfileEdit"); + + SoapPrimitive S_academicId = (SoapPrimitive) result.getProperty("AcademicId"); + String str_academicCode = S_academicId.toString(); + + + editor_S = shardpref_S_obj.edit(); + editor_S.putString(PrefId_S_Username, str_s_leadid); + editor_S.putString(PrefId_S_Password, str_s_cellno); + editor_S.putString(PrefID_SLeadID, str_s_leadid); + + if (!str_academicCode.equals(null) && !str_academicCode.equals("anyType{}") && !str_academicCode.equals("{}") && !str_academicCode.isEmpty()) { + Log.d("Academic_code:", str_academicCode); + editor_S.putString(PrefId_S_AcademicId, str_academicCode); + } + + editor_S.commit(); + + + if (role.toString().equals("Student")) { + + str_regid = result.getProperty("RegistrationId").toString(); //1 + str_sname = result.getProperty("Name").toString().toString();//name + str_s_pmname = result.getProperty("ManagerName").toString();//Abbhinandan + str_s_pm_mid = result.getProperty("ManagerId").toString();//1 + str_s_leadid = result.getProperty("Lead_Id").toString();//MHOO + str_s_emailID = result.getProperty("MailId").toString();// mailid@ + str_s_cellno = result.getProperty("Student_Mobile_No").toString();// long + + str_s_pmMobileNo = result.getProperty("MobileNo").toString(); + //mobile change + + str_s_studentType = result.getProperty("Student_Type").toString(); + str_s_isStudentLEADer = result.getProperty("isStudentLEADer").toString(); + str_s_collegeName = result.getProperty("College_Name").toString(); + + // Str_PMImageURL = result.getProperty("Manager_Image_Path").toString(); + + + Str_s_PMImageURL = result.getProperty("Manager_Image_Path").toString();////Str_s_PMImageURL; + + str_s_gender = result.getProperty("Gender").toString(); + + str_s_starCount = result.getProperty("StartCount").toString(); + + str_fb = result.getProperty("Facebook").toString(); + str_tw = result.getProperty("Twitter").toString(); + str_in = result.getProperty("InstaGram").toString(); + str_whatsapp = result.getProperty("WhatsApp").toString(); + + str_isFeesPaid = result.getProperty("isFeePaid").toString(); + str_tshirt_status = result.getProperty("isRequestForTShirt").toString(); + + str_s_LLP = result.getProperty("LLP_Badges").toString(); + str_s_Prayana = result.getProperty("Prayana_Badges").toString(); + str_s_Yuva = result.getProperty("Yuva_Badges").toString(); + str_s_Valedicotry = result.getProperty("Valedicotry_Badges").toString(); + + Log.d("str_isFeesPaidissssss", str_isFeesPaid); + + + editor_S = shardpref_S_obj.edit(); + editor_S.putString(PrefID_RegID, str_regid); + editor_S.putString(PrefID_SName, str_sname); + editor_S.putString(PrefID_SLeadID, str_s_leadid); + editor_S.putString(PrefID_SCollegeName, str_s_collegeName); + editor_S.putString(PrefID_Role, role.toString()); + editor_S.putString(PrefID_PM_SName, str_s_pmname); + editor_S.putString(PrefID_PM_S_MID, str_s_pm_mid); + editor_S.putString(PrefID_PM_SEmailID, str_s_emailID); + editor_S.putString(PrefID_SCellNo, str_s_cellno); + editor_S.putString(PrefID_SStudentType, str_s_studentType); + editor_S.putString(PrefID_SSisStudentLEADer, str_s_isStudentLEADer); + + editor_S.putString(PrefID_SLLP, str_s_LLP); + editor_S.putString(PrefID_SPrayana, str_s_Prayana); + editor_S.putString(PrefID_SYuva, str_s_Yuva); + editor_S.putString(PrefID_SValedicotry, str_s_Valedicotry); + + // editor_S.putString(PrefID_PMMobile,str_s_pmMobileNo); + + editor_S.putString(PrefID_PM_S_CellNo, str_s_pmMobileNo); //PrefID_PM_S_CellNo + editor_S.putString(PrefId_S_Gender, str_s_gender); + editor_S.putString(PrefId_S_StarCount, str_s_starCount); + + editor_S.putString(PrefId_S_FB, str_fb); + editor_S.putString(PrefId_S_TW, str_tw); + editor_S.putString(PrefId_S_IN, str_in); + editor_S.putString(PrefId_S_Whatsapp, str_whatsapp); + + editor_S.putString(PrefId_S_IsFeesPaid, str_isFeesPaid); + editor_S.putString(PrefId_S_TshirtStatus, str_tshirt_status); //0 not eligible, 1 eligible, 2 already sent request + + // String Imagestrings = Str_PMImageURL; + + String Imagestrings = Str_s_PMImageURL; + + //Str_PMImgUrl = null; + + Str_PM_S_Full_ImgUrl = null; + + if (Imagestrings == null || Imagestrings.equals("null") || Imagestrings.equals("anyType{}")) { + //Str_PMImgUrl="null"; + Str_PM_S_Full_ImgUrl = "null"; + + } else { + String arr[] = Imagestrings.split("/", 2); + + String firstWord = arr[0]; //the + String secondWord = arr[1]; + + //Str_PMImgUrl = serverPath + secondWord; + + Str_PM_S_Full_ImgUrl = serverPath + secondWord; + + Log.i("tag", "firstWord=" + firstWord + " secondWord=" + secondWord); + + Log.i("tag", "PMImage1=" + Str_s_PMImageURL); + Log.i("tag", "PMImgUrl=" + Str_PM_S_Full_ImgUrl); + } + + editor_S.putString(PrefID_PM_S_ImagePath, Str_PM_S_Full_ImgUrl); + + + if (isProfileEdited.toString().equals("0"))// first time user + { + /*Intent ittLoginToEditProfile = new Intent(LoginActivity.this,EditProfileActivity.class); + ittLoginToEditProfile.putExtra("leadid",leadid); + // ittLoginToEditProfile.putExtra("isProfileEdit","0"); + startActivity(ittLoginToEditProfile); + editor_S.putString(PrefID_S_isprofileEdited,"0");*/ + + } else { + + str_studImgUrl = result.getProperty("UserImage").toString(); + + String Imagestring = str_studImgUrl; + Str_fullStudImgUrl = null;// Str_fullStudImgUrl + if (Imagestring.equals("null") || Imagestring.equals("anyType{}")) { + Str_fullStudImgUrl = "null"; //Str_fullStudImgUrl + } else { + String arr[] = Imagestring.split("/", 2); + + String firstWord = arr[0]; //the + String secondWord = arr[1]; + + Str_fullStudImgUrl = serverPath + secondWord; //Str_fullStudImgUrl + Log.i("tag", "firstWord=" + firstWord + " secondWord=" + secondWord); + + Log.i("tag", "StudentImage1=" + str_studImgUrl); + Log.i("tag", "StudentImage2=" + Str_fullStudImgUrl);//Str_fullStudImgUrl + } + + editor_S.putString(PrefID_S_isprofileEdited, "1"); + + + editor_S.putString(PrefID_SImageUrl, Str_fullStudImgUrl);//Str_fullStudImgUrl + + /* LoadStudentProfilePick loadStudentProfilePick = new LoadStudentProfilePick(context); + loadStudentProfilePick.execute();*/ + Intent i = new Intent(HomeActivity.this, HomeActivity.class); + startActivity(i); + } + editor_S.commit(); + + } + + } else { + Log.d("Status is: ", status.toString()); + } + } + + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + +//---------------------------------------------------------------------- + + private SoapObject getLoginDetails(String mobilenum, String leadid) { + + String METHOD_NAME = "ValidateLogin1"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/ValidateLogin1"; + + try { + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + Log.d("Mobile Number", mobilenum); + Log.d("Lead Id", leadid); + + /*request.addProperty("Username", mobilenum); + request.addProperty("Password", leadid);*/ + + /*request.addProperty("Username", leadid); + request.addProperty("Password", mobilenum);*/ + + + String username = str_s_leadid.toString(); + String password = str_s_cellno.toString(); + + Log.e("LeadID", str_s_leadid.toString()); + Log.e("password", str_s_cellno.toString()); + + request.addProperty("Username", username); + request.addProperty("Password", password); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Login.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapObject response = (SoapObject) envelope.getResponse(); + // str_loginresponse = (String)response.getProperty("Status"); + Log.d("soap responseyyyyyyy", response.toString()); + + return response; + + } catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + } catch (Exception t) { + Log.d("exception outside", t.getMessage().toString()); + } + return null; + } + + + private void settshirt_reapply_spinner() { + final ArrayList list_reason = new ArrayList(); + list_reason.add("Damage"); + list_reason.add("Lost"); + list_reason.add("Size Mismatch"); + list_reason.add("Emergency T-shirt"); + + + //ArrayAdapter dataAdapterSem = new ArrayAdapter(context, R.layout.simple_spinner_semester, listsemester); + dataAdapter_tshrit_reapply = new ArrayAdapter(context, R.layout.simple_spinner_items_white, list_reason); + + // Drop down layout style - list view with radio button + dataAdapter_tshrit_reapply.setDropDownViewResource(R.layout.spinnerdropdownstylewhite); + + // attaching data adapter to spinner + spin_tshirtreapply_reason.setAdapter(dataAdapter_tshrit_reapply); + // spin_tshirtreapply_reason.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorWhite)); + + } + + + private class Tshirt_reapply_AsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + dialog.setMessage("Please wait.."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("LeadMIS", "doInBackground"); + // GetAllEvents(); + + Tshirt_reapply(); //apply T-shirt request + + + return null; + } + + public Tshirt_reapply_AsyncCallWS(HomeActivity activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @Override + protected void onPostExecute(Void result) { + dialog.dismiss(); + + + if (Str_tshirt_reapply_error1.equals("no") || Str_tshirt_reapply_error2.equals("no")) { + if (str_tshirt_reapply_response.equals("Success") || str_tshirt_reapply_response.equals("success")) { + + /*editor_S = shardpref_S_obj.edit(); + editor_S.putString(PrefId_S_TshirtStatus,"1"); + editor_S.commit();*/ + Toast.makeText(getApplicationContext(), "T-Shirt request sent Successfully", Toast.LENGTH_SHORT).show(); + + Intent i = new Intent(getApplicationContext(), HomeActivity.class); + startActivity(i); + } else { + Toast.makeText(getApplicationContext(), "Error: WS" + str_tshirt_reapply_response, Toast.LENGTH_SHORT).show(); + } + } else { + Toast.makeText(getApplicationContext(), "Error: WS" + str_tshirt_reapply_response, Toast.LENGTH_SHORT).show(); + } + + }//end of OnPostExecute + + }// end Async task + + + public void Tshirt_reapply() { + + //URL + String URL = Class_URL.URL_Projects.toString().trim(); + String METHOD_NAME = "ApplyTshirtRequested"; + String Namespace = "http://mis.leadcampus.org/", SOAPACTION = "http://mis.leadcampus.org/ApplyTshirtRequested"; + //URL + + + Integer int_registrationId = Integer.parseInt(str_regId_reapplytshirt.toString().trim()); + Integer int_managerid = Integer.parseInt(str_s_pm_mid.toString().trim()); + + + try { + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + + //for re-request of t-shirt + request.addProperty("RequestedId", str_getTshirt_requestedID1);//string + request.addProperty("TshirtModSize", str_tshir_reapply_tsize.trim());//string + + //for re-request of t-shirt + + request.addProperty("RegistrationId", int_registrationId);//int + request.addProperty("Lead_Id", str_s_leadid.toString().trim());//string + request.addProperty("ManagerId", int_managerid);//int + request.addProperty("MemberName", str_sname);//string + request.addProperty("TshirtSize", str_tshir_reapply_tsize.trim());//string + request.addProperty("RequestedCount", 1);//int + request.addProperty("ReapplyReson", str_tshirt_reapply_reason);//string + + +/*int + string + int + string + string + int*/ + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + Log.e("requested", request.toString()); + + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + androidHttpTransport.call(SOAPACTION, envelope); + + SoapPrimitive tshirt_response = (SoapPrimitive) envelope.getResponse(); + + // SoapObject tshirt_response = (SoapObject) envelope.getResponse(); + + Log.e("tshirtreapply response", tshirt_response.toString()); + + str_tshirt_reapply_response = tshirt_response.toString().trim(); + + } catch (Throwable t) { + //Toast.makeText(MainActivity.this, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Str_tshirt_reapply_error1 = "yes"; + Log.e("request fail", "> " + t.getMessage()); + } + } catch (Throwable t) { + Str_tshirt_reapply_error2 = "yes"; + Log.e("UnRegister Error", "> " + t.getMessage()); + + } + + + }//end of TshirtApply + + + private class GetTshirtlist_AsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + + /*dialog.setMessage("Please wait.."); + dialog.setCanceledOnTouchOutside(false); + dialog.show();*/ + + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("LeadMIS", "doInBackground"); + // GetAllEvents(); + + GetTshirtlist_list(); // call of GetTshirtlist + + + return null; + } + + public GetTshirtlist_AsyncCallWS(HomeActivity activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @Override + protected void onPostExecute(Void result) { + // dialog.dismiss(); + + if (str_getTshirtStatus1.equals("Success")) { + + } + + + }//end of OnPostExecute + + }// end Async task + + + public void GetTshirtlist_list() { + + //URL + String URL = Class_URL.URL_Projects.toString().trim(); + String METHOD_NAME = "GetTshirtlist"; + String Namespace = "http://mis.leadcampus.org/", SOAPACTION = "http://mis.leadcampus.org/GetTshirtlist"; + //URL + + /*16 + S + 10/13/2018 1:41:44 PM + 10/13/2018 1:43:46 PM + Exchange + Success*/ + + /* + 0 + There is no Tshirt request here + */ + + try { + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + + + request.addProperty("Lead_id", str_s_leadid.toString().trim());//string + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + androidHttpTransport.call(SOAPACTION, envelope); + SoapObject gettshirtlist_response = (SoapObject) envelope.getResponse(); + + Log.e("gettshirt list", gettshirtlist_response.toString()); + + gettshirtlist_response = (SoapObject) gettshirtlist_response.getProperty(0); + + + str_gettshirtlistresponse1 = gettshirtlist_response.getProperty("Status").toString(); + + str_getTshirtStatus1 = gettshirtlist_response.getProperty("Status").toString(); + str_getTshirtstatus_is_approved = gettshirtlist_response.getProperty("TshirtStatus").toString();//Requested + + + if (str_getTshirtStatus1.equalsIgnoreCase("Success") && + (str_getTshirtstatus_is_approved.equalsIgnoreCase("Requested") + || str_getTshirtstatus_is_approved.equalsIgnoreCase("Reapply") || str_getTshirtstatus_is_approved.equalsIgnoreCase("ApproveRollBacked"))) { + + str_getTshirt_requestedID1 = (String) gettshirtlist_response.getProperty("RequestedId").toString();//16 + str_getTshirt_tshirtSize1 = (String) gettshirtlist_response.getProperty("TshirtSize").toString();//S + + + } + if ((str_getTshirtstatus_is_approved.equalsIgnoreCase("Approved"))) { + str_getTshirt_requestedID1 = ""; + } + + + } catch (Throwable t) { + //Toast.makeText(MainActivity.this, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Str_tshirterror3 = "yes"; + Log.e("request fail", "> " + t.getMessage()); + } + } catch (Throwable t) { + Str_tshirterror4 = "yes"; + Log.e("UnRegister Error", "> " + t.getMessage()); + + } + + + }//end of TshirtApply + + + private class AsyncCallFCM extends AsyncTask { + + ProgressDialog dialog; + + Context context; + boolean versionval; + + @Override + protected void onPreExecute() { + Log.i("Leadmis", "onPreExecute---tab2"); + /* dialog.setMessage("Please wait.."); + dialog.setCanceledOnTouchOutside(false); + dialog.show();*/ + + } + + @Override + protected void onProgressUpdate(Void... values) { + Log.i("Leadmis", "onProgressUpdate---tab2"); + } + + public AsyncCallFCM(HomeActivity activity) { + context = activity; + // dialog = new ProgressDialog(activity); + } + + @Override + protected Void doInBackground(String... params) { + Log.i("Leadmis", "doInBackground"); + + + setGCM1(); + setGCM1(); + + + // versionval = appversioncheck(versioncodeInString); + + + return null; + } + + @Override + protected void onPostExecute(Void result) { + /*if (dialog.isShowing()) { + dialog.dismiss(); + + }*/ + // Log.i(TAG, "onPostExecute"); + + /* if(versionval) + { }else{alerts();}*/ + + + } + }//end of AsynTask + + + public void setGCM1() { + + +// + + // Fetch Device info + + /* final TelephonyManager tm = (TelephonyManager) getBaseContext() + .getSystemService(Context.TELEPHONY_SERVICE);*/ + + tm1 = (TelephonyManager) getBaseContext() + .getSystemService(Context.TELEPHONY_SERVICE); + + // final String tmDevice, tmSerial, androidId; + String NetworkType; + //TelephonyManager telephonyManager = ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE)); + simOperatorName = tm1.getSimOperatorName(); + Log.v("Operator", "" + simOperatorName); + NetworkType = "GPRS"; + + + int simSpeed = tm1.getNetworkType(); + if (simSpeed == 1) + NetworkType = "Gprs"; + else if (simSpeed == 4) + NetworkType = "Edge"; + else if (simSpeed == 8) + NetworkType = "HSDPA"; + else if (simSpeed == 13) + NetworkType = "LTE"; + else if (simSpeed == 3) + NetworkType = "UMTS"; + else + NetworkType = "Unknown"; + + Log.v("SIM_INTERNET_SPEED", "" + NetworkType); + if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) { + // TODO: Consider calling + // ActivityCompat#requestPermissions + // here to request the missing permissions, and then overriding + // public void onRequestPermissionsResult(int requestCode, String[] permissions, + // int[] grantResults) + // to handle the case where the user grants the permission. See the documentation + // for ActivityCompat#requestPermissions for more details. + return; + } + //tmDevice = "" + tm1.getDeviceId(); + String tmDevice = Settings.Secure.getString(this.getContentResolver(), Settings.Secure.ANDROID_ID); + Log.v("DeviceIMEI", "" + tmDevice); + mobileNumber = "" + tm1.getLine1Number(); + Log.v("getLine1Number value", "" + mobileNumber); + + String mobileNumber1 = "" + tm1.getPhoneType(); + Log.v("getPhoneType value", "" + mobileNumber1); + // tmSerial = "" + tm1.getSimSerialNumber(); + TelephonyManager tMgr = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE); + try { + tmSerial = "" + tMgr.getSimSerialNumber(); + }catch(Exception ex) + { + tmSerial="inaccessible"; + } + + + + // Log.v("GSM devices Serial Number[simcard] ", "" + tmSerial); + androidId = "" + Settings.Secure.getString(getContentResolver(), + Settings.Secure.ANDROID_ID); + Log.v("androidId CDMA devices", "" + androidId); + UUID deviceUuid = new UUID(androidId.hashCode(), + ((long) tmDevice.hashCode() << 32) | tmSerial.hashCode()); + deviceId = deviceUuid.toString(); + Log.v("deviceIdUUID", "" + deviceId); + + + deviceModelName = Build.MODEL; + Log.v("Model Name", "" + deviceModelName); + deviceUSER = Build.USER; + Log.v("Name USER", "" + deviceUSER); + devicePRODUCT = Build.PRODUCT; + Log.v("PRODUCT", "" + devicePRODUCT); + deviceHARDWARE = Build.HARDWARE; + Log.v("HARDWARE", "" + deviceHARDWARE); + deviceBRAND = Build.BRAND; + Log.v("BRAND", "" + deviceBRAND); + myVersion = Build.VERSION.RELEASE; + Log.v("VERSION.RELEASE", "" + myVersion); + sdkVersion = Build.VERSION.SDK_INT; + Log.v("VERSION.SDK_INT", "" + sdkVersion); + sdkver = Integer.toString(sdkVersion); + // Get display details + + Measuredwidth = 0; + Measuredheight = 0; + Point size = new Point(); + // WindowManager w = getWindowManager(); + + DisplayMetrics displaymetrics = new DisplayMetrics(); + this.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); + /*int screenWidth = displaymetrics.widthPixels; + int screenHeight = displaymetrics.heightPixels;*/ + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + // w.getDefaultDisplay().getSize(size); + /* Measuredwidth = w.getDefaultDisplay().getWidth();//size.x; + Measuredheight = w.getDefaultDisplay().getHeight();//size.y;*/ + + Measuredwidth = displaymetrics.widthPixels;//size.x; + Measuredheight = displaymetrics.heightPixels;//size.y; + } else { + // Display d = w.getDefaultDisplay(); + /*Measuredwidth = d.getWidth(); + Measuredheight = d.getHeight();*/ + Measuredwidth = displaymetrics.widthPixels;//size.x; + Measuredheight = displaymetrics.heightPixels;//size.y; + } + + Log.v("SCREEN_Width", "" + Measuredwidth); + Log.v("SCREEN_Height", "" + Measuredheight); + + + regId = FirebaseInstanceId.getInstance().getToken(); + + + + Log.e("regId_DeviceID", "" + regId); + +/*string + string + string + string + string + string + string + string + string + string + string + string*/ + + //if (!regId.equals("")){ + if (2>1){ + // String WEBSERVICE_NAME = "http://dfhrms.cloudapp.net/PMSservice.asmx?WSDL"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/SaveDeviceDetails"; + String METHOD_NAME1 = "SaveDeviceDetails"; + String MAIN_NAMESPACE = "http://mis.leadcampus.org/"; + String URI = Class_URL.URL_Login.toString().trim(); + + + SoapObject request = new SoapObject(MAIN_NAMESPACE, METHOD_NAME1); + + // request.addProperty("LeadId", Password1); + request.addProperty("username",Str_FCMName ); + + request.addProperty("DeviceId", regId); + request.addProperty("OSVersion", myVersion); + request.addProperty("Manufacturer", deviceBRAND); + request.addProperty("ModelNo", deviceModelName); + request.addProperty("SDKVersion", sdkver); + request.addProperty("DeviceSrlNo", tmDevice); + request.addProperty("ServiceProvider", simOperatorName); + request.addProperty("SIMSrlNo", tmSerial); + request.addProperty("DeviceWidth", Measuredwidth); + request.addProperty("DeviceHeight", Measuredheight); + request.addProperty("AppVersion", versioncode); + //request.addProperty("AppVersion","4.0"); + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( + SoapEnvelope.VER11); + envelope.dotNet = true; + // Set output SOAP object + envelope.setOutputSoapObject(request); + Log.e("deviceDetails Request","deviceDetail"+request.toString()); + // Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URI); + + try { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + + System.out.println("Device Res"+response); + + Log.i("sending device detail", response.toString()); + + } catch (Exception e) { + e.printStackTrace(); + Log.i("err",e.toString()); + } + } + + + + + + + }//end of GCM() + + + + + + + + + + + +}//end of class diff --git a/app/src/main/java/com/leadcampusapp/ImageAdapter.java b/app/src/main/java/com/leadcampusapp/ImageAdapter.java new file mode 100644 index 0000000..bab37ea --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ImageAdapter.java @@ -0,0 +1,224 @@ +package com.leadcampusapp; + +import android.content.Context; +import android.database.sqlite.SQLiteDatabase; + +import androidx.recyclerview.widget.RecyclerView; +import android.util.Log; +import android.util.SparseBooleanArray; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.CompoundButton; +import android.widget.ImageView; + +import com.bumptech.glide.Glide; + +import java.util.ArrayList; + +/** + * @author Paresh Mayani (@pareshmayani) + */ + + + +public class ImageAdapter extends RecyclerView.Adapter { + + private ArrayList mImagesList; + // private ArrayList mImagesListByte; + private Context mContext; + private SparseBooleanArray mSparseBooleanArray; + + Class_imagedelete obj_classimagedelete; + ArrayList arrPackage; + + public ImageAdapter(Context context, ArrayList imageList) + + { + mContext = context; + mSparseBooleanArray = new SparseBooleanArray(); + mImagesList = new ArrayList(); + // mImagesListByte = new ArrayList<>(); + this.mImagesList = imageList; + + + arrPackage = new ArrayList<>(); + } + + public ArrayList getCheckedItems() + { + ArrayList mTempArry = new ArrayList(); + + for(int i=0;i getImageList() + { + // Toast.makeText(mContext,"return : " + mImagesList.size(),Toast.LENGTH_SHORT).show(); + return mImagesList; + + } + /* public ArrayList getImageListByte(){ + return mImagesListByte; + }*/ + + public void clear() + { + final int size = mImagesList.size(); + if (size > 0) { + for (int i = 0; i < size; i++) { + mImagesList.remove(0); + } + notifyItemRangeRemoved(0, size); + } + } + + + + public void insert_into_positiontable(String str_position) + { + SQLiteDatabase db1 = mContext.openOrCreateDatabase("Leaddb", Context.MODE_PRIVATE, null); + db1.execSQL("CREATE TABLE IF NOT EXISTS ImageDeletedlist(PID VARCHAR);"); + + + String SQLiteQuery = "INSERT INTO ImageDeletedlist (PID)" + + " VALUES ('"+str_position+"');"; + db1.execSQL(SQLiteQuery); + + + } + + + +}// end of class diff --git a/app/src/main/java/com/leadcampusapp/ImageCompWebserviceActivity.java b/app/src/main/java/com/leadcampusapp/ImageCompWebserviceActivity.java new file mode 100644 index 0000000..66a5b0a --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ImageCompWebserviceActivity.java @@ -0,0 +1,430 @@ +package com.leadcampusapp; + +import android.app.Activity; +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.database.Cursor; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.net.Uri; +import android.os.AsyncTask; +import android.os.Bundle; +import android.provider.MediaStore; +import androidx.appcompat.app.AppCompatActivity; +import android.util.Log; +import android.view.View; +import android.widget.Button; +import android.widget.ImageView; +import android.widget.Toast; + +import com.cocosw.bottomsheet.BottomSheet; + +import org.json.JSONArray; +import org.json.JSONObject; +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * Capture image from camera and set in imageview by reducing its size without affecting quality. + */ +public class ImageCompWebserviceActivity extends AppCompatActivity { + + private Button mbtnCapture; + private ImageView mivImage; + private Context mContext; + private final int REQUEST_CODE_CLICK_IMAGE = 1002, REQUEST_CODE_GALLERY_IMAGE = 1003; + public static String imageFilePath;//Made it static as need to override the original image with compressed image. + + + private BottomSheet mBottomSheetDialog; + + + byte[] signimageinbytesArray={0}; + byte[] signimageinbytesArray2={0}; + ArrayList listbteArray; + ArrayList listbteArray1; + SerializeModule serializeModule;//=new SerializeModule(); + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_imagecomwebservice); + mContext = ImageCompWebserviceActivity.this; + mbtnCapture = (Button) findViewById(R.id.button); + mivImage = (ImageView) findViewById(R.id.imageView); + imageFilePath = CommonUtils.getFilename(); + + listbteArray=new ArrayList(); + serializeModule=new SerializeModule(); + Log.d("Image Path===", imageFilePath); + mbtnCapture.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + showOptionBottomSheetDialog(); + } + }); + createBottomSheetDialog(); + } + + /** + * Request for camera app to open and capture image. + * @param isFromGallery-if true then launch gallery app else camera app. + */ + public void startIntent(boolean isFromGallery) { + if (!isFromGallery) { + File imageFile = new File(imageFilePath); + Uri imageFileUri = Uri.fromFile(imageFile); // convert path to Uri + Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); + intent.putExtra(MediaStore.EXTRA_OUTPUT, imageFileUri); // set the image file name + startActivityForResult(intent, REQUEST_CODE_CLICK_IMAGE); + } else if (isFromGallery) { + File imageFile = new File(imageFilePath); + Uri imageFileUri = Uri.fromFile(imageFile); // convert path to Uri + Intent intent = new Intent( + Intent.ACTION_PICK, + MediaStore.Images.Media.INTERNAL_CONTENT_URI); + intent.setType("image/*"); + intent.putExtra(MediaStore.EXTRA_OUTPUT, imageFileUri); // set the image file name + startActivityForResult( + Intent.createChooser(intent, "Select File"), + REQUEST_CODE_GALLERY_IMAGE); + } + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + if (resultCode == Activity.RESULT_OK && requestCode == REQUEST_CODE_CLICK_IMAGE) { + Log.e("tag","imageFilePath1="+imageFilePath); + new ImageCompression().execute(imageFilePath); + + } else if (requestCode == REQUEST_CODE_GALLERY_IMAGE && resultCode == RESULT_OK && data != null && data.getData() != null) { + + Uri uri = data.getData(); + String[] projection = {MediaStore.Images.Media.DATA}; + Cursor cursor = getContentResolver().query(uri, projection, null, null, null); + cursor.moveToFirst(); + + int columnIndex = cursor.getColumnIndex(projection[0]); + final String picturePath = cursor.getString(columnIndex); // returns null + cursor.close(); + //copy the selected file of gallery into app's sdcard folder and perform the compression operations on it. + //And override the original image with the newly resized image. + runOnUiThread(new Runnable() { + @Override + public void run() { + try { + CommonUtils.copyFile(picturePath, imageFilePath); + } catch (IOException e) { + e.printStackTrace(); + } + } + }); + Log.e("tag","imageFilePath2="+imageFilePath); + new ImageCompression().execute(imageFilePath); + + } + } + + + /** + * Show online options with the bottom sheet dialog with hangout,viber,skype calling options + */ + private void showOptionBottomSheetDialog() { + mBottomSheetDialog.show(); + } + + /** + * Create a bottomsheet dialog. + */ + public void createBottomSheetDialog() + { + BottomSheet.Builder builder = new BottomSheet.Builder(ImageCompWebserviceActivity.this).title("Choose Option").sheet(R + .menu + .image_selection_option).listener(new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + switch (which) { + case R.id.it_camera: + startIntent(false); + break; + case R.id.it_gallery: + startIntent(true); + + break; + case R.id.it_cancel: + + break; + } + CommonUtils.hideKeyboard(ImageCompWebserviceActivity.this); + } + }); + mBottomSheetDialog = builder.build(); + } + + /** + * Asynchronos task to reduce an image size without affecting its quality and set in imageview. + */ + public class ImageCompression extends AsyncTask { + + @Override + protected String doInBackground(String... strings) { + if (strings.length == 0 || strings[0] == null) + return null; + + return CommonUtils.compressImage(strings[0]); + } + + protected void onPostExecute(String imagePath) { + // imagePath is path of new compressed image. + Bitmap bmp =BitmapFactory.decodeFile(new File(imagePath).getAbsolutePath()); + + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + bmp.compress(Bitmap.CompressFormat.JPEG, 100, stream); + signimageinbytesArray = stream.toByteArray(); + serializeModule.setFileData(signimageinbytesArray); + + ByteArrayOutputStream stream1 = new ByteArrayOutputStream(); + bmp.compress(Bitmap.CompressFormat.JPEG, 100, stream); + signimageinbytesArray2 = stream1.toByteArray(); + serializeModule.setFileData(signimageinbytesArray2); + + listbteArray1=new ArrayList<>(); + listbteArray.add(signimageinbytesArray); + listbteArray.add(signimageinbytesArray2); + listbteArray1.addAll(listbteArray); + + Log.e("listbteArray=", String.valueOf(listbteArray)); + Log.e("listbteArray1=", String.valueOf(listbteArray1)); + /* for(int i=0;i<=listbteArray.size();i++) { + Log.e("listbteArray=", String.valueOf(listbteArray.get(i))); + }*/ + mivImage.setImageBitmap(bmp); + + UploadProjectImage uploadProjectImage = new UploadProjectImage(getApplicationContext()); + uploadProjectImage.execute(); + } + } + + public class UploadProjectImage extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + UploadProjectImage (Context ctx){ + context = ctx; + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + SoapPrimitive response =null; + + response = uploadProjectDocument(); + + //Log.d("Soap response is",response.toString()); + return response; + + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) view4.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + /* Toast.makeText(getActivity(),result.toString(),Toast.LENGTH_LONG).show(); + progressDialog.dismiss();*/ + + + if(result != null) { + if (result.toString().equalsIgnoreCase("success")) { + //Log.d("FinalSoapResult",result.toString()); +/* LoadApprovedProject loadApprovedProject = new LoadApprovedProject(getActivity()); + loadApprovedProject.execute();*/ + Toast.makeText(getApplicationContext(), "Success", Toast.LENGTH_LONG).show(); + + /* SubmitForCompletion submitForCompletion = new SubmitForCompletion(getApplicationContext()); + submitForCompletion.execute();*/ + } else { + + Toast.makeText(getApplicationContext(), result.toString(), Toast.LENGTH_LONG).show(); + // progressDialog.dismiss(); + } + + Log.d("Resultisssss", result.toString()); + }else{ + // progressDialog.dismiss(); + } + + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapPrimitive uploadProjectDocument() { + String METHOD_NAME = "UpdateProjectCompletionImgCompressList"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/UpdateProjectCompletionImgCompressList"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + Log.d("Insidexxxxx","uploadProjectDocumentssss"); + + try{ + //mis.leadcampus.org + + ArrayList newlist=new ArrayList<>(); + newlist.addAll(listbteArray); + int count=newlist.size(); + ArrayList intList=new ArrayList<>(); + intList.add(11); + intList.add(22); + intList.add(33); + + List companies = new ArrayList(); + companies.add(65); + companies.add(66); + companies.add(67); + + // serializeModule.setFileInt(intList); + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + request.addProperty("leadId","mh05102"); + request.addProperty("ProjectId","40913"); + // request.addProperty("ProfileImage", intList); + + JSONArray jsonArray=new JSONArray(); + jsonArray.put(listbteArray); + JSONObject jsonObject = new JSONObject(); + for(int k=0;k " + t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getApplicationContext(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + //getActivity().finish(); + } + } + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getApplicationContext(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getApplicationContext(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + } + + + @Override + protected void onStop() + { + if (mBottomSheetDialog != null) { + if (mBottomSheetDialog.isShowing()) { + mBottomSheetDialog.hide(); + } + } + super.onStop(); + } + + +} diff --git a/app/src/main/java/com/leadcampusapp/ImageUtil.java b/app/src/main/java/com/leadcampusapp/ImageUtil.java new file mode 100644 index 0000000..1753376 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ImageUtil.java @@ -0,0 +1,205 @@ +package com.leadcampusapp; + +import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.Canvas; +import android.graphics.Matrix; +import android.graphics.Paint; +import android.media.ExifInterface; +import android.net.Uri; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; + +/** + * Created on : June 18, 2016 + * Author : zetbaitsu + * Name : Zetra + * Email : zetra@mail.ugm.ac.id + * GitHub : https://github.com/zetbaitsu + * LinkedIn : https://id.linkedin.com/in/zetbaitsu + */ +class ImageUtil { + + private ImageUtil() { + + } + + static Bitmap getScaledBitmap(Context context, Uri imageUri, float maxWidth, float maxHeight, Bitmap.Config bitmapConfig) { + String filePath = FileUtil.getRealPathFromURI(context, imageUri); + Bitmap scaledBitmap = null; + + BitmapFactory.Options options = new BitmapFactory.Options(); + + //by setting this field as true, the actual bitmap pixels are not loaded in the memory. Just the bounds are loaded. If + //you try the use the bitmap here, you will get null. + options.inJustDecodeBounds = true; + Bitmap bmp = BitmapFactory.decodeFile(filePath, options); + if (bmp == null) { + + InputStream inputStream = null; + try { + inputStream = new FileInputStream(filePath); + BitmapFactory.decodeStream(inputStream, null, options); + inputStream.close(); + } catch (FileNotFoundException exception) { + exception.printStackTrace(); + } catch (IOException exception) { + exception.printStackTrace(); + } + } + + int actualHeight = options.outHeight; + int actualWidth = options.outWidth; + + if (actualWidth < 0 || actualHeight < 0) { + Bitmap bitmap2 = BitmapFactory.decodeFile(filePath); + actualWidth = bitmap2.getWidth(); + actualHeight = bitmap2.getHeight(); + } + + float imgRatio = (float) actualWidth / actualHeight; + float maxRatio = maxWidth / maxHeight; + + //width and height values are set maintaining the aspect ratio of the image + if (actualHeight > maxHeight || actualWidth > maxWidth) { + if (imgRatio < maxRatio) { + imgRatio = maxHeight / actualHeight; + actualWidth = (int) (imgRatio * actualWidth); + actualHeight = (int) maxHeight; + } else if (imgRatio > maxRatio) { + imgRatio = maxWidth / actualWidth; + actualHeight = (int) (imgRatio * actualHeight); + actualWidth = (int) maxWidth; + } else { + actualHeight = (int) maxHeight; + actualWidth = (int) maxWidth; + } + } + + //setting inSampleSize value allows to load a scaled down version of the original image + options.inSampleSize = calculateInSampleSize(options, actualWidth, actualHeight); + + //inJustDecodeBounds set to false to load the actual bitmap + options.inJustDecodeBounds = false; + + //this options allow android to claim the bitmap memory if it runs low on memory + options.inPurgeable = true; + options.inInputShareable = true; + options.inTempStorage = new byte[16 * 1024]; + + try { + //load the bitmap from its path + bmp = BitmapFactory.decodeFile(filePath, options); + if (bmp == null) { + + InputStream inputStream = null; + try { + inputStream = new FileInputStream(filePath); + BitmapFactory.decodeStream(inputStream, null, options); + inputStream.close(); + } catch (FileNotFoundException exception) { + exception.printStackTrace(); + } catch (IOException exception) { + exception.printStackTrace(); + } + } + } catch (OutOfMemoryError exception) { + exception.printStackTrace(); + } + try { + scaledBitmap = Bitmap.createBitmap(actualWidth, actualHeight, bitmapConfig); + } catch (OutOfMemoryError exception) { + exception.printStackTrace(); + } + + float ratioX = actualWidth / (float) options.outWidth; + float ratioY = actualHeight / (float) options.outHeight; + + Matrix scaleMatrix = new Matrix(); + scaleMatrix.setScale(ratioX, ratioY, 0, 0); + + Canvas canvas = new Canvas(scaledBitmap); + canvas.setMatrix(scaleMatrix); + canvas.drawBitmap(bmp, 0, 0, new Paint(Paint.FILTER_BITMAP_FLAG)); + + //check the rotation of the image and display it properly + ExifInterface exif; + try { + exif = new ExifInterface(filePath); + int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, 0); + Matrix matrix = new Matrix(); + if (orientation == 6) { + matrix.postRotate(90); + } else if (orientation == 3) { + matrix.postRotate(180); + } else if (orientation == 8) { + matrix.postRotate(270); + } + scaledBitmap = Bitmap.createBitmap(scaledBitmap, 0, 0, + scaledBitmap.getWidth(), scaledBitmap.getHeight(), + matrix, true); + } catch (IOException e) { + e.printStackTrace(); + } + + return scaledBitmap; + } + + static File compressImage(Context context, Uri imageUri, float maxWidth, float maxHeight, Bitmap.CompressFormat compressFormat, Bitmap.Config bitmapConfig, int quality, String parentPath) { + FileOutputStream out = null; + String filename = generateFilePath(context, parentPath, imageUri, compressFormat.name().toLowerCase()); + try { + out = new FileOutputStream(filename); + + //write the compressed bitmap at the destination specified by filename. + ImageUtil.getScaledBitmap(context, imageUri, maxWidth, maxHeight, bitmapConfig).compress(compressFormat, quality, out); + + } catch (FileNotFoundException e) { + e.printStackTrace(); + } finally { + try { + if (out != null) { + out.close(); + } + } catch (IOException ignored) { + } + } + + return new File(filename); + } + + private static String generateFilePath(Context context, String parentPath, Uri uri, String extension) { + File file = new File(parentPath); + if (!file.exists()) { + file.mkdirs(); + } + return file.getAbsolutePath() + File.separator + FileUtil.splitFileName(FileUtil.getFileName(context, uri))[0] + "." + extension; + } + + private static int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) { + final int height = options.outHeight; + final int width = options.outWidth; + int inSampleSize = 1; + + if (height > reqHeight || width > reqWidth) { + final int heightRatio = Math.round((float) height / (float) reqHeight); + final int widthRatio = Math.round((float) width / (float) reqWidth); + inSampleSize = heightRatio < widthRatio ? heightRatio : widthRatio; + } + + final float totalPixels = width * height; + final float totalReqPixelsCap = reqWidth * reqHeight * 2; + + while (totalPixels / (inSampleSize * inSampleSize) > totalReqPixelsCap) { + inSampleSize++; + } + + return inSampleSize; + } +} diff --git a/app/src/main/java/com/leadcampusapp/InputFilterMinMax.java b/app/src/main/java/com/leadcampusapp/InputFilterMinMax.java new file mode 100644 index 0000000..ac1f51d --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/InputFilterMinMax.java @@ -0,0 +1,33 @@ +package com.leadcampusapp; + +import android.text.InputFilter; +import android.text.Spanned; + +public class InputFilterMinMax implements InputFilter { + + private int min, max; + + public InputFilterMinMax(int min, int max) { + this.min = min; + this.max = max; + } + + public InputFilterMinMax(String min, String max) { + this.min = Integer.parseInt(min); + this.max = Integer.parseInt(max); + } + + @Override + public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { + try { + int input = Integer.parseInt(dest.toString() + source.toString()); + if (isInRange(min, max, input)) + return null; + } catch (NumberFormatException nfe) { } + return ""; + } + + private boolean isInRange(int a, int b, int c) { + return b > a ? c >= a && c <= b : c >= b && c <= a; + } +} diff --git a/app/src/main/java/com/leadcampusapp/ItemOffsetDecoration.java b/app/src/main/java/com/leadcampusapp/ItemOffsetDecoration.java new file mode 100644 index 0000000..4c8184a --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ItemOffsetDecoration.java @@ -0,0 +1,32 @@ +package com.leadcampusapp; + +import android.content.Context; +import android.graphics.Rect; +import androidx.annotation.DimenRes; +import androidx.annotation.NonNull; +import androidx.recyclerview.widget.RecyclerView; +import android.view.View; + +/** + * Created by Paresh.Mayani on 21/6/16. + */ + +public class ItemOffsetDecoration extends RecyclerView.ItemDecoration { + + private int mItemOffset; + + public ItemOffsetDecoration(int itemOffset) { + mItemOffset = itemOffset; + } + + public ItemOffsetDecoration(@NonNull Context context, @DimenRes int itemOffsetId) { + this(context.getResources().getDimensionPixelSize(itemOffsetId)); + } + + @Override + public void getItemOffsets(Rect outRect, View view, RecyclerView parent, + RecyclerView.State state) { + super.getItemOffsets(outRect, view, parent, state); + outRect.set(mItemOffset, mItemOffset, mItemOffset, mItemOffset); + } +} diff --git a/app/src/main/java/com/leadcampusapp/LeadFBFragment.java b/app/src/main/java/com/leadcampusapp/LeadFBFragment.java new file mode 100644 index 0000000..55f6161 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/LeadFBFragment.java @@ -0,0 +1,197 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 22-06-2018. + */ + +import android.os.Bundle; +import androidx.fragment.app.Fragment; +import android.util.DisplayMetrics; +import android.util.Log; +import android.view.KeyEvent; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.webkit.WebView; +import android.webkit.WebViewClient; + +//import com.android.sripad.leadnew_22_6_2018.R; + +public class LeadFBFragment extends Fragment { + WebView webview1; + private class MyWebViewClient extends WebViewClient { + //ProgressDialog pd = new ProgressDialog(LeadFBFragment.this); + @Override + public boolean shouldOverrideUrlLoading(WebView view, String url) { + view.loadUrl(url); + +// pd.setMessage("Please wait Loading..."); + // pd.show(); + + return true; + } + + + @Override + public void onPageFinished(WebView view, String url) { + System.out.println("on finish"); + // if (pd.isShowing()) { + // pd.dismiss(); + // } + /* if (view.canGoBack()) { + view.goBack(); + } +*/ + } + + + } + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + + View view =inflater.inflate(R.layout.leadfb_fragment, container, false); + webview1=(WebView)view.findViewById(R.id.webview1); + + // pspinner.setVisibility(View.VISIBLE); + webview1.setWebViewClient(new MyWebViewClient()); + + + webview1.setOnKeyListener(new View.OnKeyListener() { + @Override + public boolean onKey(View v, int keyCode, KeyEvent event) { + + if(event.getAction() == KeyEvent.ACTION_DOWN) + { + WebView webView = (WebView) v; + + switch(keyCode) + { + case KeyEvent.KEYCODE_BACK: + if(webView.canGoBack()) + { + Log.d("Inside","goBacksssssss"); + webView.goBack(); + return true; + } + break; + } + } + return false; + } + }); + + + + + + + + + + + + + /* webview1.setInitialScale(30); + webview1.getSettings().setJavaScriptEnabled(true); + webview1.getSettings().setLoadWithOverviewMode(true); + webview1.getSettings().setUseWideViewPort(true); + webview1.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); + webview1.setScrollbarFadingEnabled(false);*/ + + /*if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) { + Toast.makeText(getContext(), "Large screen", Toast.LENGTH_LONG).show(); + webview1.loadUrl("https://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fdcselead&width=460&height=750&colorscheme=light&show_faces=true&border_color&stream=true&header=true&"); + + } + else if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_NORMAL) { + Toast.makeText(getContext(), "Normal sized screen", Toast.LENGTH_LONG).show(); + webview1.loadUrl("https://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fdcselead&width=350&colorscheme=light&show_faces=true&border_color&stream=true&header=true&"); + // webview1.loadUrl("https://m.facebook.com/www.leadcampus.org/"); + } + else if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_SMALL) { + Toast.makeText(getContext(), "Small sized screen", Toast.LENGTH_LONG).show(); + webview1.loadUrl("https://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fdcselead&width=300&colorscheme=light&show_faces=true&border_color&stream=true&header=true&"); + } + else { + Toast.makeText(getContext(), "Screen size is neither large, normal or small", Toast.LENGTH_LONG).show(); + webview1.loadUrl("https://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fdcselead&width=250&colorscheme=light&show_faces=true&border_color&stream=true&header=true&"); + + }*/ + + DisplayMetrics metrics = new DisplayMetrics(); + getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics); + int density = metrics.densityDpi; + + if (density == DisplayMetrics.DENSITY_HIGH) { + + // Toast.makeText(getContext(), "DENSITY_HIGH... Density is " + String.valueOf(density), Toast.LENGTH_LONG).show(); + if(density>=230 || density<=250) { + Log.e("tag","screen DENSITY_HIGH 230 to 250=="+String.valueOf(density)); + webview1.loadUrl("https://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fdcselead&width=460&height=750&colorscheme=light&show_faces=true&border_color&stream=true&header=true&"); + } + else if(density>=250){ + Log.e("tag","screen DENSITY_HIGH >=250=="+String.valueOf(density)); + webview1.loadUrl("https://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fdcselead&width=480&height=750&colorscheme=light&show_faces=true&border_color&stream=true&header=true&"); + } + else if(density<230){ + Log.e("tag","screen DENSITY_HIGH <230=="+String.valueOf(density)); + webview1.loadUrl("https://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fdcselead&width=440&height=750&colorscheme=light&show_faces=true&border_color&stream=true&header=true&"); + } + } + else if (density == DisplayMetrics.DENSITY_MEDIUM) { + Log.e("tag","screen DENSITY_MEDIUM=="+String.valueOf(density)); + // Toast.makeText(getContext(), "DENSITY_MEDIUM... Density is " + String.valueOf(density), Toast.LENGTH_LONG).show(); + webview1.loadUrl("https://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fdcselead&width=400&colorscheme=light&show_faces=true&border_color&stream=true&header=true&"); + } + else if (density == DisplayMetrics.DENSITY_LOW) { + Log.e("tag","screen DENSITY_LOW=="+String.valueOf(density)); + // Toast.makeText(getContext(), "DENSITY_LOW... Density is " + String.valueOf(density), Toast.LENGTH_LONG).show(); + webview1.loadUrl("https://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fdcselead&width=320&colorscheme=light&show_faces=true&border_color&stream=true&header=true&"); + } + else if(density == DisplayMetrics.DENSITY_420){ + Log.e("tag","screen density420=="+String.valueOf(density)); + // Toast.makeText(getContext(), "Density is neither HIGH, MEDIUM OR LOW. Density is " + String.valueOf(density), Toast.LENGTH_LONG).show(); + webview1.loadUrl("https://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fdcselead&width=410&height=650&colorscheme=light&show_faces=true&border_color&stream=true&header=true&"); + } + else if(density == DisplayMetrics.DENSITY_280){ + Log.e("tag","screen density420=="+String.valueOf(density)); + // Toast.makeText(getContext(), "Density is neither HIGH, MEDIUM OR LOW. Density is " + String.valueOf(density), Toast.LENGTH_LONG).show(); + webview1.loadUrl("https://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fdcselead&width=410&height=650&colorscheme=light&show_faces=true&border_color&stream=true&header=true&"); + } + + else { + // Toast.makeText(getContext(), "Density is neither HIGH, MEDIUM OR LOW. Density is " + String.valueOf(density), Toast.LENGTH_LONG).show(); + if(density>=320 && density<=400) { + Log.e("tag","screen 320 to 400=="+String.valueOf(density)); + webview1.loadUrl("https://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fdcselead&width=360&colorscheme=light&show_faces=true&border_color&stream=true&header=true&"); + }else if(density>=401 && density<=440){ + Log.e("tag","screen 401 to 440=="+String.valueOf(density)); + webview1.loadUrl("https://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fdcselead&width=390&height=650&colorscheme=light&show_faces=true&border_color&stream=true&header=true&"); + }else if(density>=441 && density<=500){ + Log.e("tag","screen 441 to 500=="+String.valueOf(density)); + webview1.loadUrl("https://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fdcselead&width=360&colorscheme=light&show_faces=true&border_color&stream=true&header=true&"); + } + else { + Log.e("tag","screen else=="+String.valueOf(density)); + webview1.loadUrl("https://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fdcselead&width=350&colorscheme=light&show_faces=true&border_color&stream=true&header=true&"); + } + + } + + // webview1.loadUrl("https://www.facebook.com/plugins/likebox.php?href=https%3A%2F%2Fwww.facebook.com%2Fwww.leadcampus.org%2F&tabs=timeline&width=350&height=500&small_header=false&adapt_container_width=true&hide_cover=false&show_facepile=true&appId"); // webview1.loadData("https://www.facebook.com/plugins/post.php?href=https%3A%2F%2Fwww.facebook.com%2Fwww.leadcampus.org%2F&width=500&show_text=true&height=202&appId"); + // webview1.loadUrl("https://www.facebook.com/plugins/likebox.php?href=https%3A%2F%2Fwww.facebook.com%2Fwww.leadcampus.org%2F&tabs=timeline&width=500&height=500&small_header=false&adapt_container_width=true&hide_cover=false&show_facepile=true&appId"); + webview1.requestFocus(); + //openURL(); + + return view; + } + + private void openURL() { + + // webview1.setInitialScale(getScale()); + + webview1.loadUrl("https://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fdcselead&width=600&colorscheme=light&show_faces=true&border_color&stream=true&header=true&"); + webview1.requestFocus(); + // pspinner.setVisibility(View.GONE); + } +} diff --git a/app/src/main/java/com/leadcampusapp/LeadInFragment.java b/app/src/main/java/com/leadcampusapp/LeadInFragment.java new file mode 100644 index 0000000..175257c --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/LeadInFragment.java @@ -0,0 +1,95 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 22-06-2018. + */ + +import android.os.Bundle; +import androidx.fragment.app.Fragment; +import android.util.Log; +import android.view.KeyEvent; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.webkit.WebSettings; +import android.webkit.WebView; +import android.webkit.WebViewClient; + +//import com.android.sripad.leadnew_22_6_2018.R; + +public class LeadInFragment extends Fragment { + + WebView webview1; + private class MyWebViewClient extends WebViewClient { + //ProgressDialog pd = new ProgressDialog(LeadFBFragment.this); + @Override + public boolean shouldOverrideUrlLoading(WebView view, String url) { + view.loadUrl(url); + +// pd.setMessage("Please wait Loading..."); + // pd.show(); + + return true; + } + + + @Override + public void onPageFinished(WebView view, String url) { + System.out.println("on finish"); + // if (pd.isShowing()) { + // pd.dismiss(); + // } + + } + } + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + + View view =inflater.inflate(R.layout.leadin_fragment, container, false); + WebView webView = (WebView) view.findViewById(R.id.webview); + + WebSettings webSettings = webView.getSettings(); + webSettings.setJavaScriptEnabled(true); + + + webView.setOnKeyListener(new View.OnKeyListener() { + @Override + public boolean onKey(View v, int keyCode, KeyEvent event) { + + if(event.getAction() == KeyEvent.ACTION_DOWN) + { + WebView webView = (WebView) v; + + switch(keyCode) + { + case KeyEvent.KEYCODE_BACK: + if(webView.canGoBack()) + { + Log.d("Inside","goBacksssssss"); + webView.goBack(); + return true; + } + break; + } + } + return false; + } + }); + + + webView.loadUrl("https://www.instagram.com/leadcampus/"); + //openURL(); + + return view; + } + + /* private void openURL() { + + // webview1.setInitialScale(getScale()); + + webview1.loadUrl("https://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fdcselead&width=600&colorscheme=light&show_faces=true&border_color&stream=true&header=true&"); + + webview1.requestFocus(); + // pspinner.setVisibility(View.GONE); + }*/ +} diff --git a/app/src/main/java/com/leadcampusapp/LeadStoryActivity.java b/app/src/main/java/com/leadcampusapp/LeadStoryActivity.java new file mode 100644 index 0000000..86fcf9c --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/LeadStoryActivity.java @@ -0,0 +1,178 @@ +package com.leadcampusapp; + +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; + +import androidx.appcompat.app.AppCompatActivity; +import android.os.Bundle; +import android.util.Log; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.TextView; + +public class LeadStoryActivity extends AppCompatActivity implements ConnectivityReceiver.ConnectivityReceiverListener{ + + public static final String PREFBook_Stud= "prefbook_stud"; + private SharedPreferences shardpref_S_obj; + public static final String PrefID_Role = "prefid_role"; + public String str_role = null; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_lead_story); + + shardpref_S_obj=LeadStoryActivity.this.getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + shardpref_S_obj.getString(PrefID_Role, "").trim(); + str_role = shardpref_S_obj.getString(PrefID_Role, "").trim(); + + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + //getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background)); + + View actionBarView = getSupportActionBar().getCustomView(); + TextView actionBarTV = (TextView) actionBarView.findViewById(R.id.txt_actionBar); + actionBarTV.setText("Stories"); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); + + if (findViewById(R.id.fragment_container) != null) { + + // However, if we're being restored from a previous state, + // then we don't need to do anything and should return or else + // we could end up with overlapping fragments. + if (savedInstanceState != null) { + return; + } + + Intent intent = getIntent(); + String story_possion=intent.getStringExtra("stroy_position"); + Log.e("tag","story_possion="+story_possion); +// Log.e("string2",getIntent().getStringExtra("stroy_position").toString()); + // Create a new Fragment to be placed in the activity layout + LeadStoryFragment firstFragment = new LeadStoryFragment(); + + Bundle bundle = new Bundle(); + bundle.putString("story_possion" , story_possion); + firstFragment.setArguments(bundle); + + // In case this activity was started with special instructions from an + // Intent, pass the Intent's extras to the fragment as arguments + // firstFragment.setArguments(getIntent().getExtras()); + + // Add the fragment to the 'fragment_container' FrameLayout + getSupportFragmentManager().beginTransaction() + .add(R.id.fragment_container, firstFragment).commit(); + } + } + + + @Override + protected void onResume() { + super.onResume(); + + // register connection status listener + MyApplication.getInstance().setConnectivityListener(this); + } + + @Override + public void onNetworkConnectionChanged(boolean isConnected) { + showSnack(isConnected); + } + + private void showSnack(boolean isConnected) { + + if (!isConnected) { + + AlertDialog.Builder adb = new AlertDialog.Builder(LeadStoryActivity.this); + //adb.setView(alertDialogView); + + adb.setTitle("Sorry! Not connected to the internet"); + + adb.setIcon(android.R.drawable.ic_dialog_alert); + + adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + + adb.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + adb.setCancelable(true); + adb.show(); + + //finish(); + } + + } + + + + + + + + + + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_main, menu); + MenuItem action_editProfile = menu.findItem(R.id.action_editProfile); + action_editProfile.setVisible(false); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + + /* if (id == R.id.action_editProfile) { + Intent ittNewsFeedsToEditProfile = new Intent(NewsFeedsActivity.this ,EditProfileActivity.class); + startActivity(ittNewsFeedsToEditProfile); + return true; + }*/ + + if (id == R.id.action_logout) { + + //deleteCache(NewsFeedsActivity.this); + + Intent ittNewsFeedsToLogin = new Intent(LeadStoryActivity.this ,LoginActivity.class); + startActivity(ittNewsFeedsToLogin); + return true; + } + + if (id == android.R.id.home) { + /* Intent ittNewsFeedsToHome = new Intent(NewsFeedsActivity.this ,HomeActivity.class); + startActivity(ittNewsFeedsToHome);*/ + + if(str_role.equals("Student")) { + Intent ittEventsToStudHome = new Intent(LeadStoryActivity.this, HomeActivity.class); + startActivity(ittEventsToStudHome); + }else if(str_role.equalsIgnoreCase("Principal")){ + Intent ittEventsToStudHome = new Intent(LeadStoryActivity.this, PrincipleHomeActivity.class); + startActivity(ittEventsToStudHome); + } + else{ + Intent ittEventsToPMHome = new Intent(LeadStoryActivity.this, PMHomeActivity.class); + startActivity(ittEventsToPMHome); + } + + return true; + } + return super.onOptionsItemSelected(item); + } +} diff --git a/app/src/main/java/com/leadcampusapp/LeadStoryFragment.java b/app/src/main/java/com/leadcampusapp/LeadStoryFragment.java new file mode 100644 index 0000000..d8f3eca --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/LeadStoryFragment.java @@ -0,0 +1,451 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 22-06-2018. + */ + +import android.app.AlertDialog; +import android.content.Context; +import android.os.AsyncTask; +import android.os.Bundle; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; +import androidx.viewpager.widget.ViewPager; +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.widget.Toolbar; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ImageView; +import android.widget.ProgressBar; + +//import com.android.sripad.leadnew_22_6_2018.R; +import com.leadcampusapp.module.LeadStoryList; +import com.leadcampusapp.module.LeadStoryListModule; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.util.ArrayList; + +public class LeadStoryFragment extends Fragment { + + AlertDialog alertDialog; + // static LeadStoryFragment mcontext=this; + private ProgressBar progressBar; + LeadStoryListModule leadStoryListObj; + ArrayList leadStoryListModules; + LeadStoryListModule[] leadInfosarr; + int responseCount=0; + int i=0; + public static FragmentActivity mcontext; + + Context context; + static VerticalViewPager verticalViewPager; + String strtext; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) + { + View view =inflater.inflate(R.layout.leadstory_fragment, container, false); + strtext = getArguments().getString("story_possion").trim(); + // strtext = strtext.substring(0, strtext.length() - 1).trim(); + Log.e("tag","strtext="+strtext); + verticalViewPager = (VerticalViewPager) view.findViewById(R.id.vPager); + progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + mcontext=getActivity(); + + + // Button btn_top= (Button) view.findViewById(R.id.btn_top); + ImageView iv_top=(ImageView) view.findViewById(R.id.iv_top); + + GetLeadStoryDetails viewProject = new GetLeadStoryDetails(getActivity()); + viewProject.execute(); + + + Log.i("tag","LeadStoryList.listview_arr=="+LeadStoryList.listview_arr.size()); + // verticalViewPager.setAdapter(new VerticlePagerAdapter(getContext(), LeadStoryList.listview_arr)); + + + iv_top.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + verticalViewPager.setAdapter(new VerticlePagerAdapter(getActivity(), LeadStoryList.listview_arr)); + + //verticalViewPager.setPageTransformer(true, new VerticalPageTransformerAnimate()); + verticalViewPager.setCurrentItem(4); + } + }); + return view; + // initSwipePager(); + } + + public static void verticalFunction(){ + + verticalViewPager.setAdapter(new VerticlePagerAdapter(mcontext,LeadStoryList.listview_arr)); + + //verticalViewPager.setPageTransformer(true, new VerticalPageTransformerAnimate()); + verticalViewPager.setCurrentItem(0); + } + public class GetLeadStoryDetails extends AsyncTask { + + Context context; + // private ProgressDialog progressDialog; + + GetLeadStoryDetails (Context ctx){ + context = ctx; + // progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(Integer... params) { + // Integer ManagerId = (Integer) params [0]; + //SoapObject response = getStudDtls(leadid); + + //unapprovedProjectListObj = new UnapprovedProjectListModule(); + leadStoryListModules = new ArrayList(); + + String METHOD_NAME = "GetMasterLeaderStoryList1"; + String NamespaceMail="http://mis.leadcampus.org/", SOAP_ACTION1="http://mis.leadcampus.org/GetMasterLeaderStoryList1";//namespace+methodname + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + // request.addProperty("ManagerId", ManagerId); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapObject response = (SoapObject) envelope.getResponse(); + Log.d("Tag","soap response LeadStory="+response.toString()); + + responseCount = response.getPropertyCount(); + + Log.d("count", String.valueOf(response.getPropertyCount())); + + LeadStoryListModule.listview_arr.clear(); + LeadStoryList.listview_arr.clear(); + ArrayList innerObj_Class_centers = null; + if(responseCount>0) { + //complitionProjectListModules = new ArrayList(); + // ArrayList arrayList = new ArrayList(); + leadInfosarr=new LeadStoryListModule[responseCount]; + for (i = 0; i < responseCount; i++) + { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + /* leadStoryListObj.setSlno(response_soapobj.getProperty("slno").toString()); + leadStoryListObj.setStory_Title(response_soapobj.getProperty("Story_Title").toString()); + leadStoryListObj.setStory_Description(response_soapobj.getProperty("Story_Description").toString()); + leadStoryListObj.setImage_Path(response_soapobj.getProperty("Image_Path").toString()); + leadStoryListObj.setCreated_Date(response_soapobj.getProperty("Created_Date").toString()); + leadStoryListModules.add(leadStoryListObj); + + Log.d("tag","leadStoryListModules.get(i)="+leadStoryListModules.get(i).getStory_Title()); + Log.d("tag","leadStoryListModules="+leadStoryListModules.size()); + Log.d("tag","leadStoryListObj.getSlno()="+leadStoryListObj.getSlno()); +*/ + String Slno=response_soapobj.getProperty("slno").toString(); + String Story_Title=response_soapobj.getProperty("Story_Title").toString(); + String Story_Description=response_soapobj.getProperty("Story_Description").toString(); + String Image_Path=response_soapobj.getProperty("Image_Path").toString(); + String Created_Date=response_soapobj.getProperty("Created_Date").toString(); + String Story_Type=response_soapobj.getProperty("Story_Type").toString(); + String Card_Image_Path=response_soapobj.getProperty("Card_Image_Path").toString(); + String URL_Link=response_soapobj.getProperty("URL_Link").toString(); + String Video_Story_URL=response_soapobj.getProperty("Video_Story_URL").toString(); + + /* String Project_type=response_soapobj.getProperty("ThemeName").toString(); + String ActionPlan=response_soapobj.getProperty("ActionPlan").toString(); + String BeneficiaryNo=response_soapobj.getProperty("BeneficiaryNo").toString(); + String Objectives=response_soapobj.getProperty("Objectives").toString(); +*/ + leadInfosarr[i]=leadStoryListObj; + + LeadStoryList.listview_arr.add(new LeadStoryList(Slno, Story_Title,Story_Description, Image_Path, Story_Type,Card_Image_Path,URL_Link,Video_Story_URL)); + + Log.i("Tag","leadStoryListModules.getAmt="+ LeadStoryList.listview_arr.size()); + } + Log.i("tag","LeadStoryList.listview_arr1=="+LeadStoryList.listview_arr.size()); + // verticalViewPager.setAdapter(new VerticlePagerAdapter(getContext(), LeadStoryList.listview_arr)); + } + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.d("exception outside",t.getMessage().toString()); + } + + return null; + } + + @Override + protected void onPreExecute() { + + progressBar.setVisibility(View.VISIBLE); + /* progressDialog.setMessage("Loading Feeds for you..!!"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show();*/ + } + + @Override + protected void onPostExecute(SoapObject result) { + progressBar.setVisibility(View.GONE); + + if(result!=null) { + // progressDialog.dismiss(); + + Log.i("Tag", "leadInfosarr===" + leadInfosarr); + Log.i("Tag", "LeadStoryList.listview_arr.size()===" + LeadStoryList.listview_arr.size()); + Log.i("Tag", "LeadStoryList.listview_arr===" + LeadStoryList.listview_arr.get(0).getSlno()); + // showActivity(); + + Integer array_slno=0,notification_slno=0; + for(int k=0;k { + + + ViewProject (Context ctx){ + context = ctx; + } + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapObject response = getProjectDetails(); + + //SoapPrimitive response =getProjectDetails(); + Log.d("Soap response is",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + +// progressBar.setVisibility(View.VISIBLE); + } + + @Override + protected void onPostExecute(SoapObject result) { + /* SoapPrimitive S_ProjectTitle,S_ThemeName,S_BeneficiaryNo,S_Objective,S_actionPlan,S_ManagerComments,S_MaterialName,S_MaterialCost,S_TotalCost,S_ApprovalAmt; + Object O_ProjectTitle,O_ThemeName,O_BeneficiaryNo,O_Objective,O_actionPlan,O_ManagerComments,O_MaterialName,O_MaterialCost,O_TotalCost,O_ApprovalAmt,O_Status; + String str_ApprovalAmt= null,str_ProjectTitle = null,str_ThemeName = null,str_BeneficiaryNo = null,str_Objective = null,str_actionPlan = null,str_ManagerComments=null,str_materialName=null,str_materialCost=null; + SoapObject SO_ThemeName; + // if(flag==0) { + O_Status = result.getProperty("status"); + if(O_Status.toString().equals("Invalid project details")){ + Toast.makeText(getActivity(),"Invalid project details",Toast.LENGTH_LONG).show(); + }else { + O_ProjectTitle = result.getProperty("Title"); + if (!O_ProjectTitle.toString().equals("anyType") && !O_ProjectTitle.toString().equals(null)) { + S_ProjectTitle = (SoapPrimitive) result.getProperty("Title"); + Log.d("Titlesssssss", S_ProjectTitle.toString()); + str_ProjectTitle = S_ProjectTitle.toString(); + } + + O_ThemeName = result.getProperty("ThemeName"); + if (O_ThemeName.toString().equals("anyType") && O_ThemeName.toString().equals(null)) { + SO_ThemeName = (SoapObject) result.getProperty("ThemeName"); + Log.d("ThemeNamessss", SO_ThemeName.toString()); + str_ThemeName = SO_ThemeName.toString(); + // spin_projectType.setSelection(0); + } + if (!O_ThemeName.toString().equals("anyType") && !O_ThemeName.toString().equals(null)) { + S_ThemeName = (SoapPrimitive) result.getProperty("ThemeName"); + Log.d("ThemeNamessss", S_ThemeName.toString()); + str_ThemeName = S_ThemeName.toString(); + // spin_projectType.setSelection(0); + } + + O_BeneficiaryNo = result.getProperty("BeneficiaryNo"); + if (!O_BeneficiaryNo.toString().equals("anyType") && !O_BeneficiaryNo.toString().equals(null)) { + S_BeneficiaryNo = (SoapPrimitive) result.getProperty("BeneficiaryNo"); + Log.d("BeneficiaryNo", S_BeneficiaryNo.toString()); + str_BeneficiaryNo = S_BeneficiaryNo.toString(); + } + + O_ApprovalAmt = result.getProperty("SanctionAmount"); + if (!O_ApprovalAmt.toString().equals("anyType") && !O_ApprovalAmt.toString().equals(null)) { + S_ApprovalAmt = (SoapPrimitive) result.getProperty("SanctionAmount"); + Log.d("BeneficiaryNo", S_ApprovalAmt.toString()); + str_ApprovalAmt = S_ApprovalAmt.toString(); + } + + O_Objective = result.getProperty("Objectives"); + if (!O_Objective.toString().equals("anyType") && !O_Objective.toString().equals(null)) { + S_Objective = (SoapPrimitive) result.getProperty("Objectives"); + Log.d("Objectivess", S_Objective.toString()); + str_Objective = S_Objective.toString(); + } + + O_actionPlan = result.getProperty("ActionPlan"); + if (!O_actionPlan.toString().equals("anyType") && !O_actionPlan.toString().equals(null)) { + S_actionPlan = (SoapPrimitive) result.getProperty("ActionPlan"); + Log.d("ActionPlansss", S_actionPlan.toString()); + str_actionPlan = S_actionPlan.toString(); + } + + O_ManagerComments = result.getProperty("ManagerComments"); + if (!O_ManagerComments.toString().equals("anyType") && !O_ManagerComments.toString().equals(null)) { + S_ManagerComments = (SoapPrimitive) result.getProperty("ManagerComments"); + Log.d("Manager Comments", S_ManagerComments.toString()); + str_ManagerComments = S_ManagerComments.toString(); + } + + O_TotalCost = result.getProperty("Amount"); + if (!O_TotalCost.toString().equals("anyType") && !O_TotalCost.toString().equals(null)) { + S_TotalCost = (SoapPrimitive) result.getProperty("Amount"); + Log.d("Total Cost", S_TotalCost.toString()); + str_totalCost = S_TotalCost.toString(); + } + } + +*/ + // progressBar.setVisibility(View.GONE); + /* } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapObject getProjectDetails() { + String METHOD_NAME = "GetMasterLeaderStoryList"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetMasterLeaderStoryList"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE("http://testbed.dfindia.org:8080/leadws/Managerws.asmx?WSDL"); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapObject response = (SoapObject) envelope.getResponse(); + //SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + Log.e("Tag","soap response LeadStory"+response.toString()); + + //return null; + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + } + return null; + + } */ + + + + private class VerticalPageTransformerAnimate implements ViewPager.PageTransformer { + private static final float MIN_SCALE = 0.75f; + + @Override + public void transformPage(View view, float position) { + + int pageWidth = view.getWidth(); + int pageHeight = view.getHeight(); + float alpha = 0; + if (0 <= position && position <= 1) { + alpha = 1 - position; + } else if (-1 < position && position < 0) { + float scaleFactor = Math.max(MIN_SCALE, 1 - Math.abs(position)); + float verticalMargin = pageHeight * (1 - scaleFactor) / 2; + float horizontalMargin = pageWidth * (1 - scaleFactor) / 2; + if (position < 0) { + view.setTranslationX(horizontalMargin - verticalMargin / 2); + } else { + view.setTranslationX(-horizontalMargin + verticalMargin / 2); + } + + view.setScaleX(scaleFactor); + view.setScaleY(scaleFactor); + + alpha = position + 1; + } + + view.setAlpha(alpha); + view.setTranslationX(view.getWidth() * -position); + float yPosition = position * view.getHeight(); + view.setTranslationY(yPosition); + + } + } + +} diff --git a/app/src/main/java/com/leadcampusapp/LeadTWFragment.java b/app/src/main/java/com/leadcampusapp/LeadTWFragment.java new file mode 100644 index 0000000..c23054f --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/LeadTWFragment.java @@ -0,0 +1,104 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 22-06-2018. + */ + +import android.os.Build; +import android.os.Bundle; +import androidx.annotation.RequiresApi; +import androidx.fragment.app.Fragment; +import android.util.Log; +import android.view.KeyEvent; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.webkit.WebSettings; +import android.webkit.WebView; +import android.webkit.WebViewClient; + +//import com.android.sripad.leadnew_22_6_2018.R; + +public class LeadTWFragment extends Fragment { + WebView webview1; + WebView webView; + private class MyWebViewClient extends WebViewClient { + //ProgressDialog pd = new ProgressDialog(LeadFBFragment.this); + @Override + public boolean shouldOverrideUrlLoading(WebView view, String url) { + view.loadUrl(url); + +// pd.setMessage("Please wait Loading..."); + // pd.show(); + + return true; + } + + + @Override + public void onPageFinished(WebView view, String url) { + System.out.println("on finish"); + // if (pd.isShowing()) { + // pd.dismiss(); + // } + + } + } + @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + View view =inflater.inflate(R.layout.leadtw_fragment, container, false); + webView = (WebView) view.findViewById(R.id.webview_tw); + + WebSettings webSettings = webView.getSettings(); + webSettings.setJavaScriptEnabled(true); + + + webView.setOnKeyListener(new View.OnKeyListener() { + @Override + public boolean onKey(View v, int keyCode, KeyEvent event) { + + if(event.getAction() == KeyEvent.ACTION_DOWN) + { + WebView webView = (WebView) v; + + switch(keyCode) + { + case KeyEvent.KEYCODE_BACK: + if(webView.canGoBack()) + { + Log.d("Inside","goBacksssssss"); + webView.goBack(); + return true; + } + break; + } + } + return false; + } + }); + + + + + + //webView.loadUrl("https://www.twitter.com/dcseLEAD"); + webView.loadUrl("https://mobile.twitter.com/dcseLEAD"); + + + /* WebSettings wv = webView.getSettings(); + wv.setJavaScriptEnabled(true); + wv.setLoadsImagesAutomatically(true); + wv.setPluginState(WebSettings.PluginState.ON); + wv.setAllowUniversalAccessFromFileURLs(true); + // wv.setPluginsEnabled(true); + wv.setEnableSmoothTransition(true); + wv.l("https://twitter.com/dcseLEAD");*/ + return view; + } + /* @Override + public boolean shouldOverrideUrlLoading(WebView view, String url) + { + + }*/ +} diff --git a/app/src/main/java/com/leadcampusapp/LeaderProfileFragment.java b/app/src/main/java/com/leadcampusapp/LeaderProfileFragment.java new file mode 100644 index 0000000..fc8c394 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/LeaderProfileFragment.java @@ -0,0 +1,1045 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 22-06-2018. + */ + +import android.app.ProgressDialog; +import android.content.ActivityNotFoundException; +import android.content.ComponentName; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.pm.PackageManager; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.net.Uri; +import android.os.AsyncTask; +import android.os.Bundle; +import androidx.fragment.app.Fragment; +import android.telephony.PhoneNumberUtils; +import android.util.Base64; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.GridView; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; +import android.widget.Toast; + +//import com.android.sripad.leadnew_22_6_2018.R; +import com.bumptech.glide.Glide; +import com.bumptech.glide.load.engine.DiskCacheStrategy; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; + +public class LeaderProfileFragment extends Fragment { + private LinearLayout lnrlyt_projDtls; + private LinearLayout lnrlyt_events; + private LinearLayout lnrlyt_newsfeeds; + + public static final String PREFBook_PM= "prefbook_pm"; //sharedpreference Book + public static final String PrefID_PMID = "prefid_pmid"; // + public static final String PrefID_pmName = "prefid_pmname"; // + public static final String PrefID_PMEMailID = "prefid_pmemailid"; // + public static final String PrefID_PMMobile = "prefid_pmmobile"; // + public static final String PrefID_pmlocation = "prefid_pmlocation"; // + public static final String PrefID_pmimageurl = "prefid_pmimgurl"; + + + + public static final String PREFBook_Stud= "prefbook_stud"; //sharedpreference Book + public static final String PrefID_PM_ImagePath = "prefid_pm_imageUrl"; // + SharedPreferences shardprefPM_obj; + + + + + public static final String PrefID_SCellNo = "prefid_scellno"; + public static final String PrefID_PM_SName = "prefid_pmsname"; // + public static final String PrefID_PM_SEmailID = "prefid_pm_semailid"; // + public static final String PrefID_PM_S_ImagePath = "prefid_pm_imageUrl"; // + public static final String PrefID_PM_S_CellNo = "prefid_pm_s_cellno";// + public static final String PrefId_S_FB = "prefid_sfb"; + public static final String PrefId_S_TW = "prefid_stw"; + public static final String PrefId_S_IN = "prefid_sin"; + public static final String PrefId_S_Whatsapp = "prefid_swhatsapp"; + + SharedPreferences shardpref_S_obj; + + SharedPreferences.Editor editor_S; + + + private TextView txt_PMName; + private TextView txt_PMMobileNumber; + private TextView txt_PMMailId; + TextView about_TV,projectDetails_TV,events_TV,news_TV,contactus_TV; + ImageView about_IV,projectDetails_IV,events_IV,news_IV,contactus_IV; + private ImageView img_PMPick; + private ImageView fb_link,tw_link,inst_link,whatsapp_link; + LinearLayout social_link; + + + + + + + private String str_PMId,str_PMName,str_PMEmailId,str_PMMobile,str_PMLocation,str_PMImageUrl; + private View view; + private Result result2; + + private String getResult; + public static final String PrefID_SLeadID = "prefid_sleadid"; + private String str_leadId; + private String serverPath = Class_URL.ServerPath.toString().trim(); + private String str_PMImagePath; + private String str_fb,str_tw,str_in,str_whatsapp; + + public static final String PrefID_PM_CellNo = "prefid_pm_cellno";// + + public static final String PrefID_S_ImgBase64 = "prefid_s_imgBase64"; // + public static final String PrefID_PM_ImgBase64 = "prefid_pm_imgBase64"; + public static final String PrefId_S_IsFeesPaid = "prefid_sfeesPaid"; + private String str_isFeesPaid; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + + //Toast.makeText(getActivity(),"Inside Leader Profile",Toast.LENGTH_SHORT).show(); + + view = inflater.inflate(R.layout.leaderprofile_fragment, container, false); + + shardprefPM_obj=getActivity().getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + + shardpref_S_obj=getActivity().getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + + initializeViews(); + + + if(getActivity().getIntent().hasExtra("fromeditProfile")){ + getResult = getActivity().getIntent().getStringExtra("fromeditProfile"); + Log.d("GetResultsss",getResult); + + shardpref_S_obj = getActivity().getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + + + + shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + str_leadId = shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + + GetStudentDetails getStudentDetails = new GetStudentDetails(getActivity()); + getStudentDetails.execute(str_leadId); + + }else { + + + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_PMId = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + Log.d("str_PMId:", str_PMId); + + /* shardprefPM_obj.getString(PrefID_pmName, "").trim(); + str_PMName = shardprefPM_obj.getString(PrefID_pmName, "").trim(); + Log.d("str_PMName:",str_PMName);*/ + + shardpref_S_obj.getString(PrefID_PM_SName, "").trim(); + str_PMName = shardpref_S_obj.getString(PrefID_PM_SName, "").trim(); + Log.d("str_PMName:", str_PMName); + + /* shardprefPM_obj.getString(PrefID_PMEMailID, "").trim(); + str_PMEmailId = shardprefPM_obj.getString(PrefID_PMEMailID, "").trim(); + Log.d("str_PMEmailId:",str_PMEmailId);*/ + + shardpref_S_obj.getString(PrefID_PM_SEmailID, "").trim(); + str_PMEmailId = shardpref_S_obj.getString(PrefID_PM_SEmailID, "").trim(); + Log.d("str_PMEmailId:", str_PMEmailId); + + + /* shardprefPM_obj.getString(PrefID_PMMobile, "").trim(); + str_PMMobile = shardprefPM_obj.getString(PrefID_PMMobile, "").trim(); + Log.d("str_PMMobile:",str_PMMobile);*/ + + + shardpref_S_obj.getString(PrefID_PM_S_CellNo, "").trim(); + str_PMMobile = shardpref_S_obj.getString(PrefID_PM_S_CellNo, "").trim(); + Log.e("str_PMMobile:", str_PMMobile); + + shardprefPM_obj.getString(PrefID_pmlocation, "").trim(); + str_PMLocation = shardprefPM_obj.getString(PrefID_pmlocation, "").trim(); + Log.d("str_PMLocation:", str_PMLocation); + + + shardpref_S_obj.getString(PrefID_pmimageurl, "").trim(); + // str_PMImageUrl = shardpref_S_obj.getString(PrefID_pmimageurl, "").trim(); + str_PMImageUrl = shardpref_S_obj.getString(PrefID_PM_S_ImagePath, "").trim(); + Log.d("str_PMImageUrl:", String.valueOf(str_PMImageUrl)); + + shardpref_S_obj.getString(PrefId_S_FB, "").trim(); + str_fb = shardpref_S_obj.getString(PrefId_S_FB, "").trim(); + Log.d("str_fb:", str_fb); + + shardpref_S_obj.getString(PrefId_S_IN, "").trim(); + str_in = shardpref_S_obj.getString(PrefId_S_IN, "").trim(); + Log.d("str_in:", str_in); + + shardpref_S_obj.getString(PrefId_S_Whatsapp, "").trim(); + str_whatsapp = shardpref_S_obj.getString(PrefId_S_Whatsapp, "").trim(); + // str_whatsapp="918105227911"; + Log.d("str_whatsapp:", str_whatsapp); + + shardpref_S_obj.getString(PrefId_S_IsFeesPaid, "").trim(); + str_isFeesPaid = shardpref_S_obj.getString(PrefId_S_IsFeesPaid, "").trim(); + Log.d("FeesPaidisssssss",str_isFeesPaid); + + + + + shardpref_S_obj.getString(PrefId_S_TW, "").trim(); + str_tw = shardpref_S_obj.getString(PrefId_S_TW, "").trim(); + Log.d("str_fb:", str_tw); + + + if (str_PMName != null && !str_PMName.isEmpty() && str_PMName != "" && !str_PMName.equals("anyType{}")) { + txt_PMName.setText(str_PMName); + } + + if (str_PMMobile != null && !str_PMMobile.isEmpty() && str_PMMobile != "" && !str_PMMobile.equals("anyType{}")) { + txt_PMMobileNumber.setText(str_PMMobile); + } + + if (str_PMEmailId != null && !str_PMEmailId.isEmpty() && str_PMEmailId != "" && !str_PMEmailId.equals("anyType{}")) { + txt_PMMailId.setText(str_PMEmailId); + } + + + if (!str_PMImageUrl.equals(null) && !str_PMImageUrl.equalsIgnoreCase("null") && !str_PMImageUrl.isEmpty() && str_PMImageUrl != "" && !str_PMImageUrl.equals("anyType{}") && !str_PMImageUrl.equals("{}")) { + Log.d("InsideLoadProfileLeader", "Pick"); + /* LoadProfilePick loadMgrProfilePick = new LoadProfilePick(getActivity()); + loadMgrProfilePick.execute();*/ + + + Glide.with(getActivity()).load(str_PMImageUrl) + .thumbnail(0.5f) + .crossFade() + .diskCacheStrategy(DiskCacheStrategy.ALL) + .into(img_PMPick); + + + sociallinks(); + + //Log.d("Mgrbitmapss:",StudentPMImageBitmap.getPmBitmap().toString()); + + //img_PMPick.setImageBitmap(StudentPMImageBitmap.getPmBitmap()); + + /* shardpref_S_obj.getString(PrefID_PM_ImgBase64,"").trim(); + String str_pm_imgBase64 = shardpref_S_obj.getString(PrefID_PM_ImgBase64, "").trim(); + + Log.d("str_pm_imgBase64isss",str_pm_imgBase64); + + try { + if (!str_pm_imgBase64.equalsIgnoreCase("")) { + byte[] b = Base64.decode(str_pm_imgBase64, Base64.DEFAULT); + Bitmap bitmap = BitmapFactory.decodeByteArray(b, 0, b.length); + img_PMPick.setImageBitmap(bitmap); + } + }catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + }*/ + + } + + + } + + GridView gridView = (GridView) view.findViewById(R.id.gridview); + GridAdapter gridAdapter = new GridAdapter(getActivity()); + gridAdapter.setStr_isFeesPaid(str_isFeesPaid); + gridView.setAdapter(gridAdapter); + + GridView gridViewSecond = (GridView) view.findViewById(R.id.gridview1); + gridViewSecond.setAdapter(new GridAdapterSecond(getActivity())); + +/* + lnrlyt_projDtls = (LinearLayout) view.findViewById(R.id.lnrlyt_projectDtls); + lnrlyt_projDtls.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToProject = new Intent(getActivity().getBaseContext(), ProjectDetails.class); + startActivity(itthomeToProject); + } + }); + + lnrlyt_events = (LinearLayout) view.findViewById(R.id.lnrlyt_events); + lnrlyt_events.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToEvent = new Intent(getActivity().getBaseContext(), EventsActivity.class); + startActivity(itthomeToEvent); + } + }); + + lnrlyt_newsfeeds = (LinearLayout) view.findViewById(R.id.lnrlyt_newsfeeds); + lnrlyt_newsfeeds.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToNewsFeeds = new Intent(getActivity().getBaseContext(), NewsFeedsActivity.class); + startActivity(itthomeToNewsFeeds); + } + }); + + about_TV = (TextView) view.findViewById(R.id.about_TV); + about_TV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToAboutUs = new Intent(getActivity(),AboutUsActivity.class); + itthomeToAboutUs.putExtra("From","Student"); + startActivity(itthomeToAboutUs); + } + }); + + about_IV = (ImageView) view.findViewById(R.id.about_IV); + about_IV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToAboutUs = new Intent(getActivity(),AboutUsActivity.class); + itthomeToAboutUs.putExtra("From","Student"); + startActivity(itthomeToAboutUs); + } + }); + + contactus_TV = (TextView) view.findViewById(R.id.contactus_TV); + contactus_TV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToAboutUs = new Intent(getActivity(),ContactUsActivity.class); + itthomeToAboutUs.putExtra("From","Student"); + startActivity(itthomeToAboutUs); + } + }); + + contactus_IV = (ImageView) view.findViewById(R.id.contactus_IV); + contactus_IV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToAboutUs = new Intent(getActivity(),ContactUsActivity.class); + itthomeToAboutUs.putExtra("From","Student"); + startActivity(itthomeToAboutUs); + } + }); + +*/ + + shardpref_S_obj.getString(PrefId_S_IsFeesPaid, "").trim(); + str_isFeesPaid = shardpref_S_obj.getString(PrefId_S_IsFeesPaid, "").trim(); + Log.d("FeesPaidLeaderssss",str_isFeesPaid); + + + /* projectDetails_IV = (ImageView) view.findViewById(R.id.projectDetails_IV); + projectDetails_IV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if(str_isFeesPaid.equals("1")) { + Intent itthomeToProject = new Intent(getActivity().getBaseContext(), ProjectDetails.class); + // itthomeToProject.putExtra("From","Student"); + startActivity(itthomeToProject); + }else{ + Toast.makeText(getActivity(),"You have not paid the fees. Please contact Project Manager",Toast.LENGTH_LONG).show(); + } + } + }); + projectDetails_TV = (TextView) view.findViewById(R.id.projectDetails_TV); + projectDetails_TV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToProject = new Intent(getActivity().getBaseContext(), ProjectDetails.class); + // itthomeToProject.putExtra("From","Student"); + startActivity(itthomeToProject); + } + }); + + events_IV = (ImageView) view.findViewById(R.id.events_IV); + events_IV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToEvent = new Intent(getActivity().getBaseContext(), EventsActivity.class); + // itthomeToEvent.putExtra("From","Student"); + //Intent itthomeToEvent = new Intent(getActivity().getBaseContext(), TestActivity2.class); + startActivity(itthomeToEvent); + } + }); + events_TV = (TextView) view.findViewById(R.id.events_TV); + events_TV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToEvent = new Intent(getActivity().getBaseContext(), EventsActivity.class); + // itthomeToEvent.putExtra("From","Student"); + //Intent itthomeToEvent = new Intent(getActivity().getBaseContext(), TestActivity2.class); + startActivity(itthomeToEvent); + } + }); + + news_IV = (ImageView) view.findViewById(R.id.news_IV); + news_IV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToNewsFeeds = new Intent(getActivity().getBaseContext(), NewsFeedsActivity.class); + // itthomeToNewsFeeds.putExtra("From","Student"); + startActivity(itthomeToNewsFeeds); + } + }); + news_TV = (TextView) view.findViewById(R.id.news_TV); + news_TV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToNewsFeeds = new Intent(getActivity().getBaseContext(), NewsFeedsActivity.class); + // itthomeToNewsFeeds.putExtra("From","Student"); + startActivity(itthomeToNewsFeeds); + } + }); + + about_IV = (ImageView) view.findViewById(R.id.about_IV); + about_IV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToAboutUs = new Intent(getActivity().getBaseContext(), AboutUsActivity.class); + itthomeToAboutUs.putExtra("From","Student"); + startActivity(itthomeToAboutUs); + } + }); + about_TV = (TextView) view.findViewById(R.id.about_TV); + about_TV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToAboutUs = new Intent(getActivity().getBaseContext(), AboutUsActivity.class); + itthomeToAboutUs.putExtra("From","Student"); + startActivity(itthomeToAboutUs); + } + }); + + contactus_IV = (ImageView) view.findViewById(R.id.contactus_IV); + contactus_IV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToAboutUs = new Intent(getActivity().getBaseContext(), ContactUsActivity.class); + itthomeToAboutUs.putExtra("From","Student"); + startActivity(itthomeToAboutUs); + } + }); + contactus_TV = (TextView) view.findViewById(R.id.contactus_TV); + contactus_TV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToAboutUs = new Intent(getActivity().getBaseContext(), ContactUsActivity.class); + itthomeToAboutUs.putExtra("From","Student"); + startActivity(itthomeToAboutUs); + } + }); +*/ + + + return view; + } + + public void sociallinks(){ + if (str_fb != null && !str_fb.isEmpty() && str_fb != "" && !str_fb.equals("anyType{}") && !str_fb.equals("{}")) { + social_link.setVisibility(View.VISIBLE); + fb_link.setVisibility(View.VISIBLE); + + /* fb_link.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent i = new Intent(getActivity(), StoryBlogActivity.class); + i.putExtra("Story_Blog", str_fb); + startActivity(i); + } + });*/ + + fb_link.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (isAppInstalled()) { + // Toast.makeText(getContext(), "facebook app already installed", Toast.LENGTH_SHORT).show(); + try { + // Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://profile/100001821549638")); + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(str_fb)); + // Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://profile/www.facebook.com/madhushree.kubsad.1")); + startActivity(intent); + } catch (Exception e) { + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(str_fb))); + } + } else { + // Toast.makeText(getContext(), "facebook app not installing", Toast.LENGTH_SHORT).show(); + Intent i = new Intent(getActivity(), StoryBlogActivity.class); + i.putExtra("Story_Blog", str_fb); + startActivity(i); + } + + } + }); + } + + if (str_in != null && !str_in.isEmpty() && str_in != "" && !str_in.equals("anyType{}") && !str_in.equals("{}")) { + social_link.setVisibility(View.VISIBLE); + inst_link.setVisibility(View.VISIBLE); + + inst_link.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + /*Intent i = new Intent(getActivity(), StoryBlogActivity.class); + i.putExtra("Story_Blog", str_in); + + startActivity(i);*/ + + Uri uri = Uri.parse(str_in); + Intent likeIng = new Intent(Intent.ACTION_VIEW, uri); + + likeIng.setPackage("com.instagram.android"); + + try { + startActivity(likeIng); + } catch (ActivityNotFoundException e) { + startActivity(new Intent(Intent.ACTION_VIEW, + Uri.parse(str_in))); + } + } + }); + } + + if (str_tw != null && !str_tw.isEmpty() && str_tw != "" && !str_tw.equals("anyType{}") && !str_tw.equals("{}")) { + social_link.setVisibility(View.VISIBLE); + tw_link.setVisibility(View.VISIBLE); + + tw_link.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + /* Intent i = new Intent(getActivity(), StoryBlogActivity.class); + i.putExtra("Story_Blog", str_tw); + startActivity(i);*/ + + try { + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(str_tw))); + // startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("twitter://user?screen_name=" + twitter_user_name))); + } catch (Exception e) { + if (str_tw != null) { + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(str_tw))); + } + // startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://twitter.com/#!/" + twitter_user_name))); + } + } + } + ); + + + } + if (str_whatsapp != null && !str_whatsapp.isEmpty() && str_whatsapp != "" && !str_whatsapp.equals("anyType{}") && !str_whatsapp.equals("{}")) { + social_link.setVisibility(View.VISIBLE); + whatsapp_link.setVisibility(View.VISIBLE); + + whatsapp_link.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + /* Intent i = new Intent(getActivity(), StoryBlogActivity.class); + i.putExtra("Story_Blog", str_tw); + startActivity(i);*/ + + /*try { + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(str_whatsapp))); + // startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("twitter://user?screen_name=" + twitter_user_name))); + } catch (Exception e) { + if (str_whatsapp != null) { + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(str_whatsapp))); + } + // startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://twitter.com/#!/" + twitter_user_name))); + }*/ + + /* Intent whatsappIntent = new Intent(Intent.ACTION_SEND); + whatsappIntent.setType("text/plain"); + whatsappIntent.setPackage("com.whatsapp"); + whatsappIntent.putExtra(Intent.EXTRA_TEXT, "The text you wanted to share"); + try { + startActivity(whatsappIntent); + } catch (android.content.ActivityNotFoundException ex) { + // Toast.makeText("Whatsapp have not been installed.",); + Toast.makeText(getContext(), "Whatsapp have not been installed", Toast.LENGTH_SHORT).show(); + }*/ + String smsNumber = "91"+str_whatsapp; //without '+' + try { + Intent sendIntent = new Intent("android.intent.action.MAIN"); + sendIntent.setComponent(new ComponentName("com.whatsapp","com.whatsapp.Conversation")); + sendIntent.putExtra("jid", PhoneNumberUtils.stripSeparators(smsNumber)+"@s.whatsapp.net"); + startActivity(sendIntent); + } catch(Exception e) { + Toast.makeText(getContext(), "Whatsapp have not been installed", Toast.LENGTH_SHORT).show(); + } + } + } + ); + + + } + } + + public boolean isAppInstalled() { + try { + getContext().getPackageManager().getApplicationInfo("com.facebook.katana", 0); + return true; + } catch (PackageManager.NameNotFoundException e) { + return false; + } + } + private void initializeViews() { + txt_PMName = (TextView) view.findViewById(R.id.txt_PMName); + txt_PMMailId = (TextView) view.findViewById(R.id.txt_PMMailId); + txt_PMMobileNumber = (TextView) view.findViewById(R.id.txt_PMMobileNumber); + img_PMPick = (ImageView) view.findViewById(R.id.img_PMPick); + + social_link = (LinearLayout) view.findViewById(R.id.social_link); + fb_link = (ImageView) view.findViewById(R.id.fb_link); + tw_link = (ImageView) view.findViewById(R.id.tw_link); + inst_link = (ImageView) view.findViewById(R.id.inst_link); + whatsapp_link = (ImageView) view.findViewById(R.id.whatsapp_link); + + social_link.setVisibility(View.GONE); + fb_link.setVisibility(View.GONE); + tw_link.setVisibility(View.GONE); + inst_link.setVisibility(View.GONE); + whatsapp_link.setVisibility(View.GONE); + result2 = new Result(); + } + + + + public class GetStudentDetails extends AsyncTask { + + Context context; + //AlertDialog alertDialog; + + //private ProgressBar progressBar; + + private ProgressDialog progressDialog; + + GetStudentDetails (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(String... params) { + String str_leadId = (String) params [0]; + //String versionCode = (String) params[2]; + + SoapObject response = getStudDetails(str_leadId); + + Log.d("GetStudentDetailssresp",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + + progressDialog.setMessage("Loading"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + + + } + + @Override + protected void onPostExecute(SoapObject result) { + + if(result!=null) { + + Log.d("GetStudentDetailssresp", result.toString()); + + SoapPrimitive S_Status, S_ManagerName, S_ManagerMailId, S_ManagerMobileNumber, S_ManagerImagePath, S_FBLink, S_INLink, S_TWLink, S_WhatsApp; + Object O_Status, O_ManagerName, O_ManagerMailId, O_ManagerMobileNumber, O_ManagerImagePath, O_FBLink, O_INLink, O_TWLink, O_WhatsApp; + String str_Status = null, str_ManagerName = null, str_ManagerMailId = null, str_ManagerMobileNumber = null, str_ManagerImagePath = null, str_FBLink = null, str_INLink = null, str_TWLink = null, str_WhatsApp = null; + + + editor_S = shardpref_S_obj.edit(); + + + O_Status = result.getProperty("Status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) result.getProperty("Status"); + Log.d("Status:", S_Status.toString()); + str_Status = S_Status.toString(); + } + + if (str_Status.equalsIgnoreCase("Success")) { + O_ManagerName = result.getProperty("ManagerName"); + if (!O_ManagerName.toString().equals("anyType{}") && !O_ManagerName.toString().equals(null)) { + S_ManagerName = (SoapPrimitive) result.getProperty("ManagerName"); + Log.d("S_ManagerName", S_ManagerName.toString()); + str_ManagerName = S_ManagerName.toString(); + } + + O_ManagerMailId = result.getProperty("ManagerMailid"); + if (!O_ManagerMailId.toString().equals("anyType{}") && !O_ManagerMailId.toString().equals(null)) { + S_ManagerMailId = (SoapPrimitive) result.getProperty("ManagerMailid"); + Log.d("S_ManagerMailId", S_ManagerMailId.toString()); + str_ManagerMailId = S_ManagerMailId.toString(); + } + + O_ManagerMobileNumber = result.getProperty("ManagerMobileNumber"); + if (!O_ManagerMobileNumber.toString().equals("anyType{}") && !O_ManagerMobileNumber.toString().equals(null)) { + S_ManagerMobileNumber = (SoapPrimitive) result.getProperty("ManagerMobileNumber"); + Log.d("S_ManagerMobileNumber", S_ManagerMobileNumber.toString()); + str_ManagerMobileNumber = S_ManagerMobileNumber.toString(); + } + + O_ManagerImagePath = result.getProperty("ManagerImagePath"); + if (!O_ManagerImagePath.toString().equals("anyType{}") && !O_ManagerImagePath.toString().equals(null)) { + S_ManagerImagePath = (SoapPrimitive) result.getProperty("ManagerImagePath"); + Log.d("S_ManagerImagePath", S_ManagerImagePath.toString()); + str_ManagerImagePath = S_ManagerImagePath.toString(); + } + + O_FBLink = result.getProperty("Manager_Facebook"); + if (!O_FBLink.toString().equals("anyType{}") && !O_FBLink.toString().equals(null)) { + S_FBLink = (SoapPrimitive) result.getProperty("Manager_Facebook"); + Log.d("S_FBLink", S_FBLink.toString()); + str_fb = S_FBLink.toString(); + } + + O_INLink = result.getProperty("Manager_Instagram"); + if (!O_INLink.toString().equals("anyType{}") && !O_INLink.toString().equals(null)) { + S_INLink = (SoapPrimitive) result.getProperty("Manager_Instagram"); + Log.d("S_INLink", S_INLink.toString()); + str_in = S_INLink.toString(); + } + + O_WhatsApp = result.getProperty("Manager_WhatsApp"); + if (!O_WhatsApp.toString().equals("anyType{}") && !O_WhatsApp.toString().equals(null)) { + S_WhatsApp = (SoapPrimitive) result.getProperty("Manager_WhatsApp"); + Log.d("O_WhatsApp", S_WhatsApp.toString()); + str_whatsapp = S_WhatsApp.toString(); + } + + O_TWLink = result.getProperty("Manager_Twitter"); + if (!O_TWLink.toString().equals("anyType{}") && !O_TWLink.toString().equals(null)) { + S_TWLink = (SoapPrimitive) result.getProperty("Manager_Twitter"); + Log.d("S_TWLink", S_TWLink.toString()); + str_tw = S_TWLink.toString(); + } + + if (str_fb != null && !str_fb.isEmpty() && str_fb != "" && !str_fb.equals("anyType{}") && str_fb != "{}") { + editor_S.putString(PrefId_S_FB, str_fb); + } + + if (str_tw != null && !str_tw.isEmpty() && str_tw != "" && !str_tw.equals("anyType{}") && str_tw != "{}") { + editor_S.putString(PrefId_S_TW, str_tw); + } + + if (str_in != null && !str_in.isEmpty() && str_in != "" && !str_in.equals("anyType{}") && str_in != "{}") { + editor_S.putString(PrefId_S_IN, str_in); + } + if (str_whatsapp != null && !str_whatsapp.isEmpty() && str_whatsapp != "" && !str_whatsapp.equals("anyType{}") && str_whatsapp != "{}") { + editor_S.putString(PrefId_S_Whatsapp, str_whatsapp); + } + // sociallinks(); + if (str_ManagerName != null && !str_ManagerName.isEmpty() && str_ManagerName != "" && !str_ManagerName.equals("anyType{}") && str_ManagerName != "{}") { + txt_PMName.setText(str_ManagerName); + editor_S.putString(PrefID_PM_SName, str_ManagerName); + } + + /* else{ + shardpref_S_obj.getString(PrefID_PM_SName, "").trim(); + str_PMName = shardpref_S_obj.getString(PrefID_PM_SName, "").trim(); + txt_PMName.setText(str_PMName); + }*/ + + if (str_ManagerMailId != null && !str_ManagerMailId.isEmpty() && str_ManagerMailId != "" && !str_ManagerMailId.equals("anyType{}") && str_ManagerMailId != "{}") { + txt_PMMailId.setText(str_ManagerMailId); + + + editor_S.putString(PrefID_PM_SEmailID, str_ManagerMailId); + } + /* else{ + shardpref_S_obj.getString(PrefID_PM_SEmailID, "").trim(); + str_PMEmailId = shardpref_S_obj.getString(PrefID_PM_SEmailID, "").trim(); + txt_PMMailId.setText(str_PMEmailId); + }*/ + + if (str_ManagerMobileNumber != null && !str_ManagerMobileNumber.isEmpty() && str_ManagerMobileNumber != "" && !str_ManagerMobileNumber.equals("anyType{}") && str_ManagerMobileNumber != "{}") + { + txt_PMMobileNumber.setText(str_ManagerMobileNumber); + + editor_S.putString(PrefID_PM_S_CellNo, str_ManagerMobileNumber); + } + + + + /* else{ + shardpref_S_obj.getString(PrefID_PM_CellNo, "").trim(); + str_PMMobile = shardpref_S_obj.getString(PrefID_PM_CellNo, "").trim(); + txt_PMMobileNumber.setText(str_PMMobile); + }*/ + + if (str_ManagerImagePath != null && !str_ManagerImagePath.isEmpty() && str_ManagerImagePath != "" && !str_ManagerImagePath.equals("anyType{}") && str_ManagerImagePath != "{}") { + Log.d("InsideLoadProfile", "Pick"); + str_PMImageUrl = serverPath + str_ManagerImagePath.substring(2); + + editor_S.putString(PrefID_pmimageurl, str_PMImageUrl); + + /* LoadProfilePick loadStudProfilePick = new LoadProfilePick(getActivity()); + loadStudProfilePick.execute();*/ + + Glide.with(getActivity()).load(str_PMImageUrl) + .thumbnail(0.5f) + .crossFade() + .diskCacheStrategy(DiskCacheStrategy.ALL) + .into(img_PMPick); + } + + + editor_S.commit(); + sociallinks(); + /* else{ + + shardpref_S_obj.getString(PrefID_PM_ImagePath, "").trim(); + str_PMImagePath = shardpref_S_obj.getString(PrefID_PM_ImagePath, "").trim(); + + str_PMImageUrl = serverPath + str_PMImagePath.substring(2); + LoadProfilePick loadStudProfilePick = new LoadProfilePick(getActivity()); + loadStudProfilePick.execute(); + }*/ + } + } + //progressBar.setVisibility(View.GONE); + progressDialog.dismiss(); + + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + + private SoapObject getStudDetails(String leadid) + { + + String METHOD_NAME = "GetStudentDetailss"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetStudentDetailss"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + + /*request.addProperty("Username", mobilenum); + request.addProperty("Password", leadid);*/ + + /*request.addProperty("Username", leadid); + request.addProperty("Password", mobilenum);*/ + +/* String username=edt_leadid.getText().toString(); + String password=edt_mobnumber.getText().toString();*/ + + request.addProperty("leadId", leadid); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Login.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + Log.d("soap responseyyyyyyy",envelope.getResponse().toString()); + SoapObject response = (SoapObject) envelope.getResponse(); + Log.d("soap responseyyyyyyy",response.toString()); + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.d("exception outside",t.getMessage().toString()); + } + return null; + + + } + + + + public class LoadProfilePick extends AsyncTask { + + private Context context; + private ProgressDialog progressDialog; + //private ProgressBar progressBar; + + LoadProfilePick (Context context){ + this.context = context; + progressDialog = new ProgressDialog(context); + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + + progressDialog.setMessage("Loading"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + + } + + @Override + protected Bitmap doInBackground(Void... params) { + + Bitmap bitmaplogo=null; + + try { + //Log.d("Urlssssssssssss",url.toString()); + //bitmaplogo = BitmapFactory.decodeStream(url.openStream()); + URL urlis = null; + if(!str_PMImageUrl.equals(null) && !str_PMImageUrl.equalsIgnoreCase("null")) { + urlis = new URL(str_PMImageUrl); + Log.d("str_PMImageUrlinleader",str_PMImageUrl); + InputStream inputStream = urlis.openStream(); + bitmaplogo = BitmapFactory.decodeStream(inputStream); + } + + + + } catch (MalformedURLException e) { + e.printStackTrace(); +/* result2.setMgrresult(e.getMessage().toString());*/ + + final String exceptnMsg = e.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),exceptnMsg, Toast.LENGTH_LONG).show(); + } + }); + + + //return result2; + } catch (IOException e) { + e.printStackTrace(); + /* result2.setMgrresult(e.getMessage().toString());*/ + + final String exceptnMsg = e.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),exceptnMsg, Toast.LENGTH_LONG).show(); + } + }); + + + //return result2; + }catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + /*result2.setMgrbitmap(bitmaplogo); + return result2;*/ + return bitmaplogo; + } + + @Override + protected void onPostExecute(Bitmap result) { + + img_PMPick.setImageBitmap(result); + + try { + + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + result.compress(Bitmap.CompressFormat.PNG, 100, stream); + byte[] imageinbytesArray = stream.toByteArray(); + String encodedImage = Base64.encodeToString(imageinbytesArray, Base64.DEFAULT); + + /* shardpref_S_obj.edit(); + editor_S.putString(PrefID_PM_ImgBase64,encodedImage);*/ + + + editor_S = shardpref_S_obj.edit(); + editor_S.putString(PrefID_PM_ImgBase64, encodedImage); + editor_S.commit(); + }catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + + + + + + + + + + + /* bitmapList.add(bitmap); + + Log.d("count1iss", String.valueOf(count1)); + Log.d("count2iss", String.valueOf(count2)); + Log.d("Bitmapsizess", String.valueOf(bitmapList.size())); + if(bitmapList.size()==count2){ + img_mainGallery.setImageBitmap(bitmapList.get(0)); + txt_numOfImages.setText("Images: "+bitmapList.size()); + }*/ + + + //} +/* + + if(result2.getMgrresult()!=null) { + + //Log.d("Inside", bitmap.toString()); + + img_PMPick.setImageBitmap(result2.getMgrbitmap()); + } + else{ + Toast.makeText(getActivity(),"Exception occured in Manager:"+result2.getMgrresult(),Toast.LENGTH_LONG).show(); + + }*/ + + + + //progressBar.setVisibility(GONE); + progressDialog.dismiss(); + } + } + +} diff --git a/app/src/main/java/com/leadcampusapp/LoginActivity.java b/app/src/main/java/com/leadcampusapp/LoginActivity.java new file mode 100644 index 0000000..3d3a0d4 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/LoginActivity.java @@ -0,0 +1,2787 @@ +package com.leadcampusapp; + +import android.Manifest; +import android.annotation.SuppressLint; +import android.app.AlertDialog; +import android.app.Dialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.pm.PackageManager; +//import android.graphics.Bitmap; +//import android.graphics.BitmapFactory; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.Color; +import android.graphics.Point; +import android.net.Uri; +import android.os.AsyncTask; +import android.os.Build; +import android.os.PowerManager; +import android.provider.Settings; + +import androidx.annotation.NonNull; +import androidx.annotation.RequiresApi; +import androidx.core.app.ActivityCompat; +import androidx.core.content.ContextCompat; +import androidx.appcompat.app.AppCompatActivity; + +import android.os.Bundle; +import android.telephony.TelephonyManager; +import android.util.Base64; +import android.util.DisplayMetrics; +import android.util.Log; +import android.view.Display; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.widget.Button; +import android.widget.EditText; +import android.widget.TextView; +import android.widget.Toast; + +//import com.android.sripad.leadnew_22_6_2018.R; +import com.google.android.gms.auth.api.signin.GoogleSignIn; +import com.google.android.gms.auth.api.signin.GoogleSignInAccount; +import com.google.android.gms.auth.api.signin.GoogleSignInClient; +import com.google.android.gms.auth.api.signin.GoogleSignInOptions; +import com.google.android.gms.common.SignInButton; +import com.google.android.gms.common.api.ApiException; +import com.google.android.gms.tasks.OnCompleteListener; +import com.google.android.gms.tasks.Task; +import com.google.firebase.analytics.FirebaseAnalytics; +import com.google.firebase.auth.AuthCredential; +import com.google.firebase.auth.AuthResult; +import com.google.firebase.auth.FirebaseAuth; +import com.google.firebase.auth.FirebaseUser; +import com.google.firebase.auth.GoogleAuthProvider; +import com.google.firebase.iid.FirebaseInstanceId; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.UUID; + +public class LoginActivity extends AppCompatActivity { + private Button btn_login; + public static final int RequestPermissionCode = 7; + public Button btn_call; + public Button btn_guestlogin; + public Button btn_smaple; + private TextView txt_misscallnumber; + + private EditText edt_mobnumber, edt_leadid; + private String mobnumber, leadid; + private String versioncode; + + Class_InternetDectector cd; + + String Str_ManagerName, Str_PMEmailId, Str_PM_Mobile, Str_PMLocation, Str_Manager_Id, Str_PMImageURL; + Integer ManagerId; + + String str_regid, str_sname, str_s_pmname, str_s_leadid, str_s_emailID, str_s_cellno, str_s_collegeName, str_studImgUrl, str_s_studentType, str_s_isStudentLEADer, str_s_gender, str_s_starCount, str_fb, str_tw, str_whatsapp, str_in, str_s_pmMobileNo; + String str_isFeesPaid, Str_s_PMImageURL, str_tshirt_status, str_s_pm_mid, str_s_LLP, str_s_Prayana, str_s_Yuva, str_s_Valedicotry; + + String Str_StudImgUrl; + + String Str_PMImgUrl = null; + String Str_PM_S_Full_ImgUrl = null; + + private String serverPath = Class_URL.ServerPath.toString().trim(); + + public static final String PREFBook_PM = "prefbook_pm"; //sharedpreference Book + public static final String PrefID_PMID = "prefid_pmid"; // + public static final String PrefID_pmName = "prefid_pmname"; // + public static final String PrefID_PMEMailID = "prefid_pmemailid"; // + public static final String PrefID_PMMobile = "prefid_pmmobile"; // + public static final String PrefID_pmlocation = "prefid_pmlocation"; // + public static final String PrefID_pmimageurl = "prefid_pmimgurl"; // + public static final String PrefID_pm_username = "prefid_pm_username"; // + public static final String PrefID_pm_password = "prefid_pm_password"; // + + + SharedPreferences shardprefPM_obj; + SharedPreferences.Editor editor_PM; + + public static final String PREFBook_Stud = "prefbook_stud"; //sharedpreference Book + public static final String PrefID_RegID = "prefid_regid"; // + public static final String PrefID_SName = "prefid_sname"; // + public static final String PrefID_PM_SName = "prefid_pmsname"; // + public static final String PrefID_PM_S_MID = "prefid_pm_s_mid"; // + public static final String PrefID_SLeadID = "prefid_sleadid"; // + public static final String PrefID_PM_SEmailID = "prefid_pm_semailid"; // + public static final String PrefID_SCellNo = "prefid_scellno"; // + public static final String PrefID_SCollegeName = "prefid_scollegename"; // + public static final String PrefID_SImageUrl = "prefid_simgUrl"; // + public static final String PrefId_S_Password = "prefid_spassword"; + public static final String PrefId_S_Username = "prefid_susername"; + + public static final String PrefId_S_Gender = "prefid_sgender"; + public static final String PrefId_S_StarCount = "prefid_sstarCount"; + + public static final String PrefId_S_FB = "prefid_sfb"; + public static final String PrefId_S_TW = "prefid_stw"; + public static final String PrefId_S_IN = "prefid_sin"; + public static final String PrefId_S_Whatsapp = "prefid_swhatsapp"; + public static final String PrefId_S_IsFeesPaid = "prefid_sfeesPaid"; + + public static final String PrefId_S_TshirtStatus = "prefid_s_tshirtstatus"; + + + public static final String PrefId_S_AcademicId = "prefid_sacademicid"; + + public static final String PrefID_SStudentType = "prefid_sstudentType"; // + public static final String PrefID_SSisStudentLEADer = "prefid_ssisStudentLEADer"; + + public static final String PrefID_PM_S_ImagePath = "prefid_pm_imageUrl"; // + public static final String PrefID_PM_S_CellNo = "prefid_pm_s_cellno";// + + + public static final String PrefID_S_ImgBase64 = "prefid_s_imgBase64"; // + public static final String PrefID_PM_ImgBase64 = "prefid_pm_imgBase64"; + + public static final String PrefID_Role = "prefid_role"; + public static final String PrefID_S_isprofileEdited = "prefid_isprofileEdited"; + + public static final String PrefID_SLLP = "prefID_SLLP"; + public static final String PrefID_SPrayana = "prefID_SPrayana"; + public static final String PrefID_SYuva = "prefID_SYuva"; + public static final String PrefID_SValedicotry = "prefID_SValedicotry"; + + + SharedPreferences shardpref_S_obj; + SharedPreferences.Editor editor_S; + + + SharedPreferences shardprefPrinciple_info; + SharedPreferences.Editor editor_Principle_info; + public static final String PREBook_Principle_info = "prefbook_principle_info"; + public static final String PrefID_CollgeName = "prefid_CollgName"; + public static final String PrefID_AcademicId = "prefid_AcademicId"; + public static final String PrefID_PMailId = "prefid_PMailId"; + public static final String PrefID_PWhatsapp = "prefid_PWhatsapp"; + public static final String PrefID_PMobileNo = "prefid_PMobileNo"; + public static final String PrefID_PName = "prefid_PName"; + public static final String PrefID_PCollegeId = "prefid_PCollegeId"; + + + String str_loginresponse = "false"; + TelephonyManager tm1 = null; + String myVersion, deviceBRAND, deviceHARDWARE, devicePRODUCT, deviceUSER, deviceModelName, deviceId, tmDevice, tmSerial, androidId, simOperatorName, sdkver, mobileNumber; + int sdkVersion, Measuredwidth = 0, Measuredheight = 0, update_flage = 0; + AsyncTask mRegisterTask; + String regId = "leadxz", Str_FCMName; + String Principal_Name, Principal_MailId, Principal_WhatsAppNo, Principal_MobileNo, Principal_College_Name, Principal_College_Id; + + private ProgressDialog progressDialog; + + Class_InternetDectector internetDectector, internetDectector2; + Boolean isInternetPresent = false; + + + public static final String PREFBook_generalbook = "prefbook_generalbook"; //sharedpreference Book + SharedPreferences shardprefgeneralbook_obj; + SharedPreferences.Editor editor_generalbook; + String str_misscallno; + + SharedPreferences shardprefPM_obj_count; + SharedPreferences.Editor editor_PM_count; + public static final String PREFBook_PM_Count = "prefbook_pm_count"; //sharedpreference Book + public static final String PrefID_UNCount = "prefid_UNCount"; // + public static final String PrefID_ComCount = "prefid_ComCount"; // + public static final String PrefID_AppCount = "prefid_AppCount"; // + public static final String PrefID_ReqModCount = "prefid_ReqModCount"; // + public static final String PrefID_RejCount = "prefid_RejCount"; // + public static final String PrefID_ReqComCount = "prefid_ReqComCount"; // + public static final String PrefID_Tshirt = "prefID_Tshirt"; + + private FirebaseAnalytics firebaseAnalytics; + SignInButton google_signin_bt; + GoogleSignInClient googlesigninclient_obj; + private static final int RC_SIGN_IN = 234;////a constant for detecting the login intent result + GoogleSignInAccount account; + String str_gmailid; + FirebaseAuth firebaseauth_obj; + + String str_isuser_setpin,str_forgotusername,str_isuser_changepin,str_isuser_loggedfromgoogle; + SharedPreferences sharedpreference_usercredential_Obj; + public static final String sharedpreference_usercredential = "sharedpreferencebook_usercredential"; + public static final String KeyValue_isuser_setpin = "KeyValue_isuser_setpin"; + public static final String KeyValue_isuser_changepin = "KeyValue_isuser_changepin"; + public static final String KeyValue_loggedfromgoogle = "KeyValue_loggedfromgoogle"; + + String str_PMEmailId,str_PrincipleEmailId,str_S_EmailId; + TextView forgotpassword_tv; + EditText username_et,password_et, dialogusername_et; + + + @RequiresApi(api = Build.VERSION_CODES.KITKAT) + @SuppressLint("NewApi") + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_login); + + firebaseAnalytics = FirebaseAnalytics.getInstance(this); + Bundle bundle = new Bundle(); + //val bundle = Bundle(); + bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "my_item_id"); + firebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle); + + shardprefPM_obj = getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + shardpref_S_obj = getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + shardprefgeneralbook_obj = getSharedPreferences(PREFBook_generalbook, Context.MODE_PRIVATE); + + shardprefPM_obj_count = getSharedPreferences(PREFBook_PM_Count, Context.MODE_PRIVATE); + shardprefPrinciple_info = getSharedPreferences(PREBook_Principle_info, Context.MODE_PRIVATE); + + sharedpreference_usercredential_Obj=getSharedPreferences(sharedpreference_usercredential, Context.MODE_PRIVATE); + //str_isuser_setpin = sharedpreference_usercredential_Obj.getString(KeyValue_isuser_setpin, "").trim(); + str_isuser_setpin=""; + str_isuser_changepin=sharedpreference_usercredential_Obj.getString(KeyValue_isuser_changepin, "").trim(); + str_isuser_loggedfromgoogle=sharedpreference_usercredential_Obj.getString(KeyValue_loggedfromgoogle, "").trim(); + + shardpref_S_obj.getString(PrefID_PM_SEmailID, "").trim(); + str_S_EmailId = shardpref_S_obj.getString(PrefID_PM_SEmailID, "").trim(); + Log.d("str_S_EmailId:", str_S_EmailId); + + shardprefPM_obj.getString(PrefID_PMEMailID, "").trim(); + str_PMEmailId = shardprefPM_obj.getString(PrefID_PMEMailID, "").trim(); + Log.d("str_PMEmailId:", str_PMEmailId); + + shardprefPrinciple_info.getString(PrefID_PMailId, "").trim(); + str_PrincipleEmailId = shardprefPrinciple_info.getString(PrefID_PMailId, "").trim(); + Log.d("str_PrincipleEmailId:", str_PrincipleEmailId); + + edt_leadid = (EditText) findViewById(R.id.edt_leadid); + edt_mobnumber = (EditText) findViewById(R.id.edt_mobnumber); + btn_login = (Button) findViewById(R.id.btn_login); + btn_call = (Button) findViewById(R.id.btn_call); + btn_guestlogin = (Button) findViewById(R.id.btn_guestlogin); + btn_smaple = (Button) findViewById(R.id.btn_smaple); + txt_misscallnumber = (TextView) findViewById(R.id.txt_misscallnumber); + forgotpassword_tv=(TextView)findViewById(R.id.forgotpassword_tv); + + google_signin_bt =(SignInButton)findViewById(R.id.google_signin_bt); + google_signin_bt.setColorScheme(SignInButton.COLOR_DARK); + setGooglePlusButtonText(google_signin_bt," Sign in with Google "); + + + editor_PM_count = shardprefPM_obj_count.edit(); + editor_PM_count.putString(PrefID_AppCount, "0"); + Log.d("ApprovedCount", "0"); + editor_PM_count.putString(PrefID_ComCount, "0"); + editor_PM_count.putString(PrefID_RejCount, "0"); + editor_PM_count.putString(PrefID_UNCount, "0"); + editor_PM_count.putString(PrefID_ReqComCount, "0"); + editor_PM_count.putString(PrefID_ReqModCount, "0"); + editor_PM_count.putString(PrefID_Tshirt, "0"); + + editor_PM_count.commit(); + + str_misscallno = shardprefgeneralbook_obj.getString(PREFBook_generalbook, "").trim(); + txt_misscallnumber.setText(str_misscallno.toString()); + + + + if (CheckingPermissionIsEnabledOrNot()) { + // Toast.makeText(LoginActivity.this, "All Permissions Granted Successfully", Toast.LENGTH_LONG).show(); + } + // If, If permission is not enabled then else condition will execute. + else { + + //Calling method to enable permission. + //Toast.makeText(LoginActivity.this, "Requesting", Toast.LENGTH_LONG).show(); + RequestMultiplePermission(); + + } + + + try { + versioncode = this.getPackageManager().getPackageInfo(this.getPackageName(), 0).versionName; + } catch (PackageManager.NameNotFoundException e) { + e.printStackTrace(); + } + + + String MsgNotfication = ""; + + Bundle extras = getIntent().getExtras(); + + // if (extras != null){} + if (extras != null) { + MsgNotfication = extras.getString("2"); + if (MsgNotfication != null || MsgNotfication != "") { + Toast.makeText(getApplicationContext(), " " + MsgNotfication.toString(), Toast.LENGTH_LONG).show(); + Log.e("notifMsg", "notifMsg: " + MsgNotfication.toString()); + } + } + + //Google Sign initializing + firebaseauth_obj = FirebaseAuth.getInstance(); + GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) + .requestIdToken(getString(R.string.server_client_ID_type3)) + .requestEmail() + .build(); + googlesigninclient_obj = GoogleSignIn.getClient(this, gso); + //Google Sign initializing + + + google_signin_bt.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) + { + + + internetDectector = new Class_InternetDectector(getApplicationContext()); + isInternetPresent = internetDectector.isConnectingToInternet(); + + if (2>1) + { + if (isInternetPresent) + { + google_sign(); + }else{ + Toast.makeText(LoginActivity.this, "Kindly connect to internet", Toast.LENGTH_SHORT).show(); + } + } + + } + }); + + if(!str_S_EmailId.equalsIgnoreCase("")){ + signOut(); + } + if(!str_PMEmailId.equalsIgnoreCase("")){ + signOut(); + } + if(!str_PrincipleEmailId.equalsIgnoreCase("")){ + signOut(); + } + + btn_call.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(Intent.ACTION_DIAL); + intent.setData(Uri.parse("tel:" + txt_misscallnumber.getText().toString())); + startActivity(intent); + + + } + }); + + + btn_guestlogin.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + //Intent i = new Intent(LoginActivity.this, GuestActivity.class); + Intent i = new Intent(LoginActivity.this, GuestLoginActivity.class); + startActivity(i); + finish(); + } + }); + + + forgotpassword_tv.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) + { + final Dialog dialog = new Dialog(LoginActivity.this); + + + dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); + dialog.setContentView(R.layout.forgetdialog); + dialog.setCancelable(false); + + + Button forgotpasswordcancel_bt = (Button) dialog.findViewById(R.id.forgotpasswordcancel_bt); + Button forgotpasswordsubmit_bt = (Button) dialog.findViewById(R.id.forgotpasswordsubmit_bt); + dialogusername_et=(EditText)dialog.findViewById(R.id.dialogusername_et); + + forgotpasswordcancel_bt.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) + { + dialog.dismiss(); + + } + }); + + forgotpasswordsubmit_bt.setOnClickListener(new View.OnClickListener() { + + @Override + public void onClick(View arg0) + { + + internetDectector = new Class_InternetDectector(getApplicationContext()); + isInternetPresent = internetDectector.isConnectingToInternet(); + + if(forgotpassword_validation()) + { + if (isInternetPresent) + { + + str_forgotusername=dialogusername_et.getText().toString(); + dialog.dismiss(); + ForgotPassword forgotPassword=new ForgotPassword(LoginActivity.this); + forgotPassword.execute(); + } + else{ + Toast.makeText(LoginActivity.this, "Kindly connect to internet", Toast.LENGTH_SHORT).show(); + } + } + + + + } + }); + + + dialog.show(); + + + + } + }); + + btn_smaple.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + //Intent i = new Intent(LoginActivity.this, GuestActivity.class); + Intent i = new Intent(LoginActivity.this, ImageCompWebserviceActivity.class); + startActivity(i); + finish(); + } + }); + btn_login.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + + leadid = edt_leadid.getText().toString(); + mobnumber = edt_mobnumber.getText().toString(); + + + if (validation()) { + + internetDectector = new Class_InternetDectector(getApplicationContext()); + isInternetPresent = internetDectector.isConnectingToInternet(); + + if (isInternetPresent) { + GetLoginDetails getloginDetails = new GetLoginDetails(LoginActivity.this); + getloginDetails.execute(mobnumber, leadid); + //Toast.makeText(getApplicationContext(),"net"+isInternetPresent.toString(),Toast.LENGTH_SHORT).show(); + } else { + Toast.makeText(getApplicationContext(), "No Internet Connected", Toast.LENGTH_SHORT).show(); + } + } + + + /* Intent ittLoginToEditProfile = new Intent(LoginActivity.this,EditProfileActivity.class); + startActivity(ittLoginToEditProfile);*/ + } + }); + + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + Intent intent = new Intent(); + String packageName = getPackageName(); + PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE); + if (!pm.isIgnoringBatteryOptimizations(packageName)) { + intent.setAction(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); + intent.setData(Uri.parse("package:" + packageName)); + startActivity(intent); + } + } + + + }// end of oncreate + + public boolean forgotpassword_validation() + { + boolean b_username, b_password; + b_username=true; + + + if (dialogusername_et.getText().toString().trim().length() == 0|| + dialogusername_et.getText().toString().trim().length()<=4) { + dialogusername_et.setError("Enter Valid Username"); + username_et.requestFocus(); + b_username = false; + } + + + + return (b_username); + + } + + private void google_sign() { + //getting the google signin intent + Intent signInIntent = googlesigninclient_obj.getSignInIntent(); + //starting the activity for result + startActivityForResult(signInIntent, RC_SIGN_IN); + + } + private void signOut() + { + googlesigninclient_obj.signOut() + .addOnCompleteListener(this, new OnCompleteListener() { + @Override + public void onComplete(@NonNull Task task) + { + // ... + Toast.makeText(LoginActivity.this,"Sigined Out Successfully", Toast.LENGTH_SHORT).show(); + + /*editor_obj = sharedpreference_usercredential_Obj.edit(); + editor_obj.putString(KeyValue_loggedfromgoogle, ""); + editor_obj.commit();*/ + } + }); + } + @Override + public void onActivityResult(int requestCode, int resultCode, Intent data) + { + super.onActivityResult(requestCode, resultCode, data); + + //if the requestCode is the Google Sign In code that we defined at starting + if (requestCode == RC_SIGN_IN) { + //Getting the GoogleSignIn Task + Task task = GoogleSignIn.getSignedInAccountFromIntent(data); + try { + //Google Sign In was successful, authenticate with Firebase + account = task.getResult(ApiException.class); + //authenticating with firebase + firebaseAuthWithGoogle(account); + + } catch (ApiException e) { + Toast.makeText(LoginActivity.this, "Error:"+e.getMessage(), Toast.LENGTH_SHORT).show(); + } + } + } + + + + + private void firebaseAuthWithGoogle(final GoogleSignInAccount acct) + { + Log.d("TAG", "firebaseAuthWithGoogle:" + acct.getId()); + + //getting the auth credential + AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null); + str_gmailid=acct.getEmail().toString(); + + //Now using firebase we are signing in the user here + firebaseauth_obj.signInWithCredential(credential) + .addOnCompleteListener(this, new OnCompleteListener() + { + @Override + public void onComplete(@NonNull Task task) + { + if (task.isSuccessful()) { + Log.d("TAG", "signInWithCredential:success"); + FirebaseUser user = firebaseauth_obj.getCurrentUser(); + + + Toast.makeText(LoginActivity.this, "User Signed In:"+str_gmailid, Toast.LENGTH_SHORT).show(); + + // AsyncTask_Googleloginverify(); + GetGoogleLoginDetails getloginDetails = new GetGoogleLoginDetails(LoginActivity.this); + getloginDetails.execute(str_gmailid); + + /*try { + postRequest(); + } catch (IOException e) { + e.printStackTrace(); + }*/ + + } else + { + // If sign in fails, display a message to the user. + Log.w("TAG", "signInWithCredential:failure", task.getException()); + Toast.makeText(LoginActivity.this, "Authentication failed.", + Toast.LENGTH_SHORT).show(); + } + } + }); + } + + + public boolean validation() { + + Boolean bleadid = true, bpassword = true; + + if (edt_leadid.getText().toString().length() == 0) { + edt_leadid.setError("LEAD ID is required!"); + bleadid = false; + } + + if (edt_mobnumber.getText().toString().length() == 0) { + edt_mobnumber.setError("Mobile Number is required!"); + bpassword = false; + } + + if (bleadid && bpassword) { + return true; + } else { + return false; + } + } + + + public class GetLoginDetails extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + //private ProgressBar progressBar; + + + GetLoginDetails(Context ctx) { + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(String... params) { + String mobilenum = (String) params[0]; + String leadid = (String) params[1]; + //String versionCode = (String) params[2]; + + SoapObject response = getLoginDetails(mobilenum, leadid); + + + /*if(str_loginresponse.equals("Success")) + { + Toast.makeText(getApplicationContext(),"Set GCM",Toast.LENGTH_SHORT).show(); + }*/ + + //Log.d("Soap response is",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { +/* progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + + progressDialog.setMessage("Loading"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + + } + + @Override + protected void onPostExecute(SoapObject result) { + //progressBar.setVisibility(View.GONE); + progressDialog.dismiss(); + + if (result != null) { + + String finalResult = result.toString(); + String finals = finalResult.replace("anyType{}", ""); + Log.d("Finals is", finals); + + + SoapPrimitive status = (SoapPrimitive) result.getProperty("Status"); + //Log.d("Status is:",status.toString()); + + + if (status.toString().equals("Invalid Username or Password")) { + Toast.makeText(getApplicationContext(), "Invalid Username or Password", Toast.LENGTH_SHORT).show(); + //progressDialog.dismiss(); + } + + if (status.toString().equals("Success")) { + SoapPrimitive role = (SoapPrimitive) result.getProperty("Role"); + Log.d("Role is:", role.toString()); + + SoapPrimitive isProfileEdited = (SoapPrimitive) result.getProperty("isProfileEdit"); + + SoapPrimitive S_academicId = (SoapPrimitive) result.getProperty("AcademicId"); + String str_academicCode = S_academicId.toString(); + + editor_S = shardpref_S_obj.edit(); + editor_S.putString(PrefId_S_Username, leadid); + editor_S.putString(PrefId_S_Password, mobnumber); + editor_S.putString(PrefID_SLeadID, leadid); + + if (!str_academicCode.equals(null) && !str_academicCode.equals("anyType{}") && !str_academicCode.equals("{}") && !str_academicCode.isEmpty()) { + Log.d("Academic_code:", str_academicCode); + editor_S.putString(PrefId_S_AcademicId, str_academicCode); + } + + + /* SoapPrimitive S_ManagerName = (SoapPrimitive) result.getProperty("ManagerName"); + String str_ManagerName = S_ManagerName.toString(); + + SoapPrimitive S_MobileNo = (SoapPrimitive) result.getProperty("MobileNo"); + String str_MobileNo = S_MobileNo.toString(); + + SoapPrimitive S_MailId = (SoapPrimitive) result.getProperty("MailId"); + String str_MailId = S_MailId.toString(); + + SoapPrimitive S_Manager_Image_Path = (SoapPrimitive) result.getProperty("Manager_Image_Path"); + String str_Manager_Image_Path = S_Manager_Image_Path.toString(); + + + if(!str_ManagerName.equals(null) && !str_ManagerName.equals("anyType{}") && !str_ManagerName.equals("{}") && !str_ManagerName.isEmpty()){ + Log.d("str_ManagerName:",str_ManagerName); + editor_S.putString(PrefID_PM_SName,str_ManagerName); + } + + if(!str_MobileNo.equals(null) && !str_MobileNo.equals("anyType{}") && !str_MobileNo.equals("{}") && !str_MobileNo.isEmpty()){ + Log.d("str_MobileNo:",str_MobileNo); + editor_S.putString(PrefID_PM_CellNo,str_MobileNo); + } + + if(!str_MailId.equals(null) && !str_MailId.equals("anyType{}") && !str_MailId.equals("{}") && !str_MailId.isEmpty()){ + Log.d("str_MailId:",str_MailId); + editor_S.putString(PrefID_PM_SEmailID,str_MailId); + } + + if(!str_Manager_Image_Path.equals(null) && !str_Manager_Image_Path.equals("anyType{}") && !str_Manager_Image_Path.equals("{}") && !str_Manager_Image_Path.isEmpty()){ + Log.d("str_Manager_Image_Path:",str_Manager_Image_Path); + editor_S.putString(PrefID_PM_ImagePath,str_Manager_Image_Path); + }*/ + + + editor_S.commit(); + + + if (role.toString().equals("Student")) { + AsyncCallFCM task = new AsyncCallFCM(LoginActivity.this); + task.execute(); + + Str_FCMName = result.getProperty("Username").toString().toString();//name + + str_regid = result.getProperty("RegistrationId").toString(); //1 + str_sname = result.getProperty("Name").toString().toString();//name + str_s_pmname = result.getProperty("ManagerName").toString();//Abbhinandan + str_s_pm_mid = result.getProperty("ManagerId").toString();//1 + str_s_leadid = result.getProperty("Lead_Id").toString();//MHOO + str_s_emailID = result.getProperty("MailId").toString();// mailid@ + str_s_cellno = result.getProperty("Student_Mobile_No").toString();// long + + str_s_pmMobileNo = result.getProperty("MobileNo").toString(); + //mobile change + + str_s_studentType = result.getProperty("Student_Type").toString(); + + str_s_isStudentLEADer = result.getProperty("isStudentLEADer").toString(); + str_s_collegeName = result.getProperty("College_Name").toString(); + + // Str_PMImageURL = result.getProperty("Manager_Image_Path").toString(); + + Str_s_PMImageURL = result.getProperty("Manager_Image_Path").toString(); + + str_s_gender = result.getProperty("Gender").toString(); + + str_s_starCount = result.getProperty("StartCount").toString(); + + str_fb = result.getProperty("Facebook").toString(); + str_tw = result.getProperty("Twitter").toString(); + str_in = result.getProperty("InstaGram").toString(); + str_whatsapp = result.getProperty("WhatsApp").toString(); + + str_isFeesPaid = result.getProperty("isFeePaid").toString(); + str_tshirt_status = result.getProperty("isRequestForTShirt").toString(); + //-----------------------------edited by madhu 9aug19---------------- + str_s_LLP = result.getProperty("LLP_Badges").toString(); + str_s_Prayana = result.getProperty("Prayana_Badges").toString(); + str_s_Yuva = result.getProperty("Yuva_Badges").toString(); + str_s_Valedicotry = result.getProperty("Valedicotry_Badges").toString(); + + Log.d("str_isFeesPaidissssss", str_isFeesPaid); + Log.e("str_s_LLP=", str_s_LLP + "str_s_Prayana=" + str_s_Prayana); + + + editor_S = shardpref_S_obj.edit(); + editor_S.putString(PrefID_RegID, str_regid); + editor_S.putString(PrefID_SName, str_sname); + editor_S.putString(PrefID_SLeadID, str_s_leadid); + editor_S.putString(PrefID_SCollegeName, str_s_collegeName); + editor_S.putString(PrefID_Role, role.toString()); + editor_S.putString(PrefID_PM_SName, str_s_pmname); + editor_S.putString(PrefID_PM_S_MID, str_s_pm_mid); + editor_S.putString(PrefID_PM_SEmailID, str_s_emailID); + editor_S.putString(PrefID_SCellNo, str_s_cellno); + editor_S.putString(PrefID_SStudentType, str_s_studentType); + editor_S.putString(PrefID_SSisStudentLEADer, str_s_isStudentLEADer); + + editor_S.putString(PrefID_SLLP, str_s_LLP); + editor_S.putString(PrefID_SPrayana, str_s_Prayana); + editor_S.putString(PrefID_SYuva, str_s_Yuva); + editor_S.putString(PrefID_SValedicotry, str_s_Valedicotry); + + + // editor_S.putString(PrefID_PMMobile,str_s_pmMobileNo); + + editor_S.putString(PrefID_PM_S_CellNo, str_s_pmMobileNo); //PrefID_PM_S_CellNo + + editor_S.putString(PrefId_S_Gender, str_s_gender); + editor_S.putString(PrefId_S_StarCount, str_s_starCount); + + editor_S.putString(PrefId_S_FB, str_fb); + editor_S.putString(PrefId_S_TW, str_tw); + editor_S.putString(PrefId_S_IN, str_in); + editor_S.putString(PrefId_S_Whatsapp, str_whatsapp); + + editor_S.putString(PrefId_S_IsFeesPaid, str_isFeesPaid); + editor_S.putString(PrefId_S_TshirtStatus, str_tshirt_status); //0 not eligible, 1 eligible, 2 already sent request + + + String Imagestrings = Str_s_PMImageURL; + Str_PM_S_Full_ImgUrl = null; + if (Imagestrings == null || Imagestrings.equals("null") || Imagestrings.equals("anyType{}")) { + Str_PM_S_Full_ImgUrl = "null"; + } else { + String arr[] = Imagestrings.split("/", 2); + + String firstWord = arr[0]; //the + String secondWord = arr[1]; + + Str_PM_S_Full_ImgUrl = serverPath + secondWord; + Log.i("tag", "firstWord=" + firstWord + " secondWord=" + secondWord); + + Log.i("tag", "PMImage1=" + Str_s_PMImageURL); + Log.i("tag", "PMImgUrl=" + Str_PM_S_Full_ImgUrl); + } + + // editor_S.putString(PrefID_pmimageurl,Str_PMImgUrl); + + editor_S.putString(PrefID_PM_S_ImagePath, Str_PM_S_Full_ImgUrl); + + + if (isProfileEdited.toString().equals("0"))// first time user + { + Intent ittLoginToEditProfile = new Intent(LoginActivity.this, EditProfileActivity.class); + ittLoginToEditProfile.putExtra("leadid", leadid); + // ittLoginToEditProfile.putExtra("isProfileEdit","0"); + startActivity(ittLoginToEditProfile); + editor_S.putString(PrefID_S_isprofileEdited, "0"); + +/* LoadMgrProfilePick loadMgrProfilePick = new LoadMgrProfilePick(context); + loadMgrProfilePick.execute();*/ + + }else if (isProfileEdited.toString().equals("2"))// Manager edited profile time user + { + Intent ittLoginToEditProfile = new Intent(LoginActivity.this, EditProfileActivity.class); + ittLoginToEditProfile.putExtra("leadid", leadid); + // ittLoginToEditProfile.putExtra("isProfileEdit","0"); + startActivity(ittLoginToEditProfile); + editor_S.putString(PrefID_S_isprofileEdited, "2"); + +/* LoadMgrProfilePick loadMgrProfilePick = new LoadMgrProfilePick(context); + loadMgrProfilePick.execute();*/ + + } else { + + + str_studImgUrl = result.getProperty("UserImage").toString(); + + String Imagestring = str_studImgUrl; + Str_StudImgUrl = null; //Str_fullStudImgUrl + if (Imagestring.equals("null") || Imagestring.equals("anyType{}")) { + Str_StudImgUrl = "null"; //Str_fullStudImgUrl + } else { + String arr[] = Imagestring.split("/", 2); + + String firstWord = arr[0]; //the + String secondWord = arr[1]; + + Str_StudImgUrl = serverPath + secondWord; //Str_fullStudImgUrl + Log.i("tag", "firstWord=" + firstWord + " secondWord=" + secondWord); + + Log.i("tag", "StudentImage1=" + str_studImgUrl); + Log.i("tag", "StudentImage2=" + Str_StudImgUrl);//Str_fullStudImgUrl + } + + editor_S.putString(PrefID_S_isprofileEdited, "1"); + + + editor_S.putString(PrefID_SImageUrl, Str_StudImgUrl); //Str_fullStudImgUrl + + /* LoadStudentProfilePick loadStudentProfilePick = new LoadStudentProfilePick(context); + loadStudentProfilePick.execute();*/ + /*Intent i = new Intent(LoginActivity.this, HomeActivity.class); + startActivity(i);*/ + if (str_isuser_setpin.isEmpty()) { + + // Toast.makeText(getApplicationContext(),"empty",Toast.LENGTH_SHORT).show(); + Intent i = new Intent(LoginActivity.this, Activity_setpin.class); + startActivity(i); + finish(); + + } else { + Intent i = new Intent(LoginActivity.this, Activity_pinlogin.class); + startActivity(i); + finish(); + } + + } + + + editor_S.commit(); + + } + if (role.toString().equals("Manager")) { + + AsyncCallFCM task = new AsyncCallFCM(LoginActivity.this); + task.execute(); + + Str_FCMName = result.getProperty("Username").toString().toString(); + Str_Manager_Id = result.getProperty("ManagerId").toString(); + Str_ManagerName = result.getProperty("Name").toString(); + Str_PMEmailId = result.getProperty("MailId").toString(); + Str_PM_Mobile = result.getProperty("MobileNo").toString(); + Str_PMLocation = result.getProperty("Location").toString(); + Str_PMImageURL = result.getProperty("UserImage").toString(); + str_regid=result.getProperty("RegistrationId").toString(); + Log.i("tag", "PMImageURL=" + Str_PMImageURL); + + String Imagestring = Str_PMImageURL; + String Str_PMImgUrl = null; + if (Imagestring.equals("null") || Imagestring.equals("anyType{}")) { + Str_PMImgUrl = "null"; + } else { + String arr[] = Imagestring.split("/", 2); + + String firstWord = arr[0]; //the + String secondWord = arr[1]; + + Str_PMImgUrl = serverPath + secondWord; + Log.i("tag", "firstWord=" + firstWord + " secondWord=" + secondWord); + + Log.i("tag", "PMImage1=" + Str_PMImageURL); + Log.i("tag", "PMImgUrl=" + Str_PMImgUrl); + } + + + ManagerId = Integer.parseInt(Str_Manager_Id); + /*Intent ittLoginToEditProfile = new Intent(LoginActivity.this, PMHomeActivity.class); + + ittLoginToEditProfile.putExtra("ManagerId", ManagerId); + ittLoginToEditProfile.putExtra("ManagerName", Str_ManagerName); + ittLoginToEditProfile.putExtra("PMEmailId", Str_PMEmailId); + ittLoginToEditProfile.putExtra("PM_Mobile", Str_PM_Mobile); + ittLoginToEditProfile.putExtra("PMLocation", Str_PMLocation); + ittLoginToEditProfile.putExtra("PMImgUrl", Str_PMImgUrl);*/ + + editor_PM = shardprefPM_obj.edit(); + editor_PM.putString(PrefID_PMID, Str_Manager_Id); + Log.d("ManagerIdis", Str_Manager_Id); + editor_PM.putString(PrefID_pmName, Str_ManagerName); + editor_PM.putString(PrefID_PMEMailID, Str_PMEmailId); + editor_PM.putString(PrefID_PMMobile, Str_PM_Mobile); + editor_PM.putString(PrefID_pmlocation, Str_PMLocation); + editor_PM.putString(PrefID_pmimageurl, Str_PMImgUrl); + + editor_PM.putString(PrefID_pm_username, leadid.toString()); + editor_PM.putString(PrefID_pm_password, mobnumber.toString()); + + + Log.d("ManagerIds:", Str_Manager_Id); + Log.d("ManagerNames:", Str_ManagerName); + Log.d("ManagerEmailIds:", Str_PMEmailId); + Log.d("ManagerMobiles:", Str_PM_Mobile); + Log.d("Managerlocations:", Str_PMLocation); + Log.d("ManagerURLs:", Str_PMImgUrl); + + + editor_PM.commit(); + + editor_S = shardpref_S_obj.edit(); + editor_S.putString(PrefID_Role, role.toString()); + editor_S.putString(PrefID_RegID, str_regid); + editor_S.commit(); + + + // startActivity(ittLoginToEditProfile); + if (str_isuser_setpin.isEmpty()) { + + // Toast.makeText(getApplicationContext(),"empty",Toast.LENGTH_SHORT).show(); + Intent i = new Intent(LoginActivity.this, Activity_setpin.class); + startActivity(i); + finish(); + + } else { + Intent i = new Intent(LoginActivity.this, Activity_pinlogin.class); + startActivity(i); + finish(); + } + } + + //-----------------------------edited by madhu 9aug19---------------- + + if (role.toString().equals("Principal")) { + AsyncCallFCM task = new AsyncCallFCM(LoginActivity.this); + task.execute(); + + Str_FCMName = result.getProperty("Username").toString().toString(); + Principal_MailId = result.getProperty("Name").toString().toString(); + Principal_WhatsAppNo = result.getProperty("Lead_Id").toString().toString(); + Principal_MobileNo = result.getProperty("Student_Mobile_No").toString().toString(); + Principal_College_Name = result.getProperty("College_Name").toString().toString(); + Principal_College_Id = result.getProperty("LoginId").toString().toString(); + str_regid=result.getProperty("RegistrationId").toString(); + + editor_Principle_info = shardprefPrinciple_info.edit(); + editor_Principle_info.putString(PrefID_PName, Str_FCMName); + editor_Principle_info.putString(PrefID_AcademicId, str_academicCode); + editor_Principle_info.putString(PrefID_PMailId, Principal_MailId); + editor_Principle_info.putString(PrefID_PWhatsapp, Principal_WhatsAppNo); + editor_Principle_info.putString(PrefID_PMobileNo, Principal_MobileNo); + editor_Principle_info.putString(PrefID_CollgeName, Principal_College_Name); + editor_Principle_info.putString(PrefID_PCollegeId, Principal_College_Id); + + editor_Principle_info.commit(); + + editor_S = shardpref_S_obj.edit(); + editor_S.putString(PrefID_Role, role.toString()); + editor_S.putString(PrefID_RegID, str_regid); + editor_S.commit(); + + /* Intent i = new Intent(LoginActivity.this, PrincipleHomeActivity.class); + startActivity(i); + finish();*/ + if (str_isuser_setpin.isEmpty()) { + + // Toast.makeText(getApplicationContext(),"empty",Toast.LENGTH_SHORT).show(); + Intent i = new Intent(LoginActivity.this, Activity_setpin.class); + startActivity(i); + finish(); + + } else { + Intent i = new Intent(LoginActivity.this, Activity_pinlogin.class); + startActivity(i); + finish(); + } + + } + } else { + Log.d("Status is: ", status.toString()); + } + + //progressDialog.dismiss(); + +/* for (int i = 0; i < result.getPropertyCount(); i++) { + SoapObject list = (SoapObject) result.getProperty(i); + SoapPrimitive S_Name, email_id,S_Status; + Object O_CohortDuration,O_name,O_mobileNumber,O_email_Id,O_program,O_cohortName,O_Address,O_BloodGroup,O_fellowshipLogo,O_student_photo; + + Log.d("Result of soap objectdd",list.toString()); + + String results = + + *//* if(list.toString().contains(getString(R.string.txtStatus))){ + S_Status = (SoapPrimitive) list.getProperty("Status"); + applicationId.setError(S_Status.toString()); + } + + else { + + applicationId.setError(null); + + O_name = list.getProperty(getString(R.string.txtSName)); + if(O_name.toString().equals(getString(R.string.txtAnyType)) || O_name.toString().equals(null)){ + name.setText(""); + nameMain = name.getText().toString(); + } + else{ + S_Name = (SoapPrimitive) list.getProperty(getString(R.string.txtSName)); + name.setText(S_Name.toString()); + nameMain = name.getText().toString(); + } + + O_program = list.getProperty(getString(R.string.txtFellowshipName)); + if(O_program.toString().equals(getString(R.string.txtAnyType)) || O_program.toString().equals(null) ){ + program.setText(""); + } + else{ + program.setText(((SoapPrimitive) list.getProperty(getString(R.string.txtFellowshipName))).toString()); + } + + O_cohortName = list.getProperty(getString(R.string.txtCName)); + if(O_cohortName.toString().equals(getString(R.string.txtAnyType)) || O_cohortName.toString().equals(null)){ + cohortName=""; + } + else{ + cohortName = ((SoapPrimitive) list.getProperty(getString(R.string.txtCName))).toString(); + } + + O_mobileNumber = list.getProperty(getString(R.string.txtMobNo)); + if(O_mobileNumber.toString().equals(getString(R.string.txtAnyType)) || O_mobileNumber.toString().equals(null)){ + mobileNumber=""; + } + else{ + mobileNumber = ((SoapPrimitive) list.getProperty(getString(R.string.txtMobNo))).toString(); + } + + O_email_Id = list.getProperty(getString(R.string.txtemailId)); + if(O_email_Id.toString().equals(getString(R.string.txtAnyType)) || O_email_Id.toString().equals(null)) { + emailid=""; + } + else{ + emailid = ((SoapPrimitive) list.getProperty(getString(R.string.txtemailId))).toString(); + } + + O_student_photo = list.getProperty(getString(R.string.txtOstudentPhoto)); + if(O_student_photo.toString().equals(getString(R.string.txtAnyType)) || O_student_photo.toString().equals(null)) { + idCardGenerated = ""; + } + else{ + idCardGenerated = ((SoapPrimitive) list.getProperty(getString(R.string.txtOstudentPhoto))).toString(); + } + + + + O_CohortDuration = list.getProperty(getString(R.string.txtCohortDuration)); + if(O_CohortDuration.toString().equals(getString(R.string.txtAnyType))){ + cohortDurationFromTo = ""; + } + else{ + cohortDurationFromTo = ((SoapPrimitive) list.getProperty(getString(R.string.txtCohortDuration))).toString(); + } + + O_Address = list.getProperty(getString(R.string.txtAddress)); + if(O_Address.toString().equals(getString(R.string.txtAnyType))){ + studentAddress = ""; + } + else{ + studentAddress = ((SoapPrimitive) list.getProperty(getString(R.string.txtAddress))).toString(); + } + + O_BloodGroup = list.getProperty(getString(R.string.txtBloodGrp)); + if(O_BloodGroup.toString().equals(getString(R.string.txtAnyType)) || O_BloodGroup.toString().equals(getString(R.string.txtzero))){ + bloodGroup = ""; + } + else{ + bloodGroup = ((SoapPrimitive) list.getProperty(getString(R.string.txtBloodGrp))).toString(); + } + + + //O_fellowshipLogo = (((SoapPrimitive) list.getProperty("FellowshipLogo")).toString()); + O_fellowshipLogo = list.getProperty(getString(R.string.txtFellowshipLogo)); + if(O_fellowshipLogo.toString().equals(getString(R.string.txtAnyType)) || O_fellowshipLogo.toString().equals(getString(R.string.txtzero))){ + fellowshipimageLogo = ""; + } + else{ + fellowshipimageLogo = (((SoapPrimitive) list.getProperty(getString(R.string.txtFellowshipLogo))).toString()); + + String namespc = ((SoapPrimitive) list.getProperty(getString(R.string.txtFellowshipLogo))).getNamespace(); + //Log.d("namespc", namespc); + String url1 = fellowshipimageLogo.substring(2); + //Log.d("url1", url1); + + fellowshipimageLogo = getString(R.string.txtMainNamespace1) + url1; + } + + RelativeLayout rltlytMain = (RelativeLayout) findViewById(R.id.rltlyt_details); + rltlytMain.setVisibility(View.VISIBLE); + + }*//* + + }*/ + } + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + public class ForgotPassword extends AsyncTask { + + Context context; + //AlertDialog alertDialog; + + //private ProgressBar progressBar; + + private ProgressDialog progressDialog; + + ForgotPassword(Context ctx) { + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapPrimitive doInBackground(String... params) { + + SoapPrimitive response = ForgotPassword(); + + //Log.d("ResponseCommitsss", response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressDialog.setMessage("Loading"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + + + + // String str_result=result.getProperty("Status").toString(); + if(result.toString().equalsIgnoreCase("Success")){ + // dialog.dismiss(); + progressDialog.dismiss(); + + AlertDialog.Builder dialog = new AlertDialog.Builder(LoginActivity.this); + dialog.setCancelable(false); + dialog.setTitle(R.string.alert); + + + dialog.setMessage(" Password is sent to your Mail \n Thank you."); + + dialog.setPositiveButton("Ok", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) { + dialog.dismiss(); + } + }); + + + final AlertDialog alert = dialog.create(); + alert.setOnShowListener(new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface arg0) { + alert.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#004D40")); + } + }); + alert.show(); + + } + else{ + + progressDialog.dismiss(); + Toast toast = Toast.makeText(getApplicationContext(), "unauthorized Email ID", Toast.LENGTH_LONG); + TextView toastMessage = (TextView) toast.getView().findViewById(android.R.id.message); + toastMessage.setTextColor(Color.RED); + toast.show(); + } + + } + + } + private SoapPrimitive ForgotPassword() + { + + String METHOD_NAME = "ForgetPassword"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/ForgetPassword"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + request.addProperty("Email_Id", str_forgotusername);//string + //request.addProperty("StudentName",edt_studName.getText().toString()); + // request.addProperty("PIN",str_loginpin);//string + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Login.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + // SendStudentRequestforManager{Lead_Id=MF00993; Email_id=testing; Student_MobileNo=9689240475; Message=testing; } + + Log.e("tag","Request Forgotpwd="+request.toString()); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + // Log.d("soapResponseyyyyyyy",envelope.getResponse().toString()); + + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + Log.d("tag","soapRespons ForgotPwd="+response.toString()); + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.d("exception outside",t.getMessage().toString()); + } + return null; + + + } + + public class GetGoogleLoginDetails extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + //private ProgressBar progressBar; + + + GetGoogleLoginDetails(Context ctx) { + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(String... params) { + String gmail = (String) params[0]; + // String leadid = (String) params[1]; + //String versionCode = (String) params[2]; + + SoapObject response = getGoogleLoginDetails(gmail); + + + /*if(str_loginresponse.equals("Success")) + { + Toast.makeText(getApplicationContext(),"Set GCM",Toast.LENGTH_SHORT).show(); + }*/ + + //Log.d("Soap response is",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { +/* progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + + progressDialog.setMessage("Loading"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + + } + + @Override + protected void onPostExecute(SoapObject result) { + //progressBar.setVisibility(View.GONE); + progressDialog.dismiss(); + + if (result != null) { + + String finalResult = result.toString(); + String finals = finalResult.replace("anyType{}", ""); + Log.d("Finals is", finals); + + + SoapPrimitive status = (SoapPrimitive) result.getProperty("Status"); + //Log.d("Status is:",status.toString()); + + + if (status.toString().equals("Invalid Username or Password")) { + Toast.makeText(getApplicationContext(), "Invalid Username or Password", Toast.LENGTH_SHORT).show(); + //progressDialog.dismiss(); + } + + if (status.toString().equals("Success")) { + SoapPrimitive role = (SoapPrimitive) result.getProperty("Role"); + Log.d("Role is:", role.toString()); + + SoapPrimitive isProfileEdited = (SoapPrimitive) result.getProperty("isProfileEdit"); + + SoapPrimitive S_academicId = (SoapPrimitive) result.getProperty("AcademicId"); + String str_academicCode = S_academicId.toString(); + + editor_S = shardpref_S_obj.edit(); + editor_S.putString(PrefId_S_Username, leadid); + editor_S.putString(PrefId_S_Password, mobnumber); + editor_S.putString(PrefID_SLeadID, leadid); + + if (!str_academicCode.equals(null) && !str_academicCode.equals("anyType{}") && !str_academicCode.equals("{}") && !str_academicCode.isEmpty()) { + Log.d("Academic_code:", str_academicCode); + editor_S.putString(PrefId_S_AcademicId, str_academicCode); + } + + + /* SoapPrimitive S_ManagerName = (SoapPrimitive) result.getProperty("ManagerName"); + String str_ManagerName = S_ManagerName.toString(); + + SoapPrimitive S_MobileNo = (SoapPrimitive) result.getProperty("MobileNo"); + String str_MobileNo = S_MobileNo.toString(); + + SoapPrimitive S_MailId = (SoapPrimitive) result.getProperty("MailId"); + String str_MailId = S_MailId.toString(); + + SoapPrimitive S_Manager_Image_Path = (SoapPrimitive) result.getProperty("Manager_Image_Path"); + String str_Manager_Image_Path = S_Manager_Image_Path.toString(); + + + if(!str_ManagerName.equals(null) && !str_ManagerName.equals("anyType{}") && !str_ManagerName.equals("{}") && !str_ManagerName.isEmpty()){ + Log.d("str_ManagerName:",str_ManagerName); + editor_S.putString(PrefID_PM_SName,str_ManagerName); + } + + if(!str_MobileNo.equals(null) && !str_MobileNo.equals("anyType{}") && !str_MobileNo.equals("{}") && !str_MobileNo.isEmpty()){ + Log.d("str_MobileNo:",str_MobileNo); + editor_S.putString(PrefID_PM_CellNo,str_MobileNo); + } + + if(!str_MailId.equals(null) && !str_MailId.equals("anyType{}") && !str_MailId.equals("{}") && !str_MailId.isEmpty()){ + Log.d("str_MailId:",str_MailId); + editor_S.putString(PrefID_PM_SEmailID,str_MailId); + } + + if(!str_Manager_Image_Path.equals(null) && !str_Manager_Image_Path.equals("anyType{}") && !str_Manager_Image_Path.equals("{}") && !str_Manager_Image_Path.isEmpty()){ + Log.d("str_Manager_Image_Path:",str_Manager_Image_Path); + editor_S.putString(PrefID_PM_ImagePath,str_Manager_Image_Path); + }*/ + + + editor_S.commit(); + + + if (role.toString().equals("Student")) { + AsyncCallFCM task = new AsyncCallFCM(LoginActivity.this); + task.execute(); + + Str_FCMName = result.getProperty("Username").toString().toString();//name + + str_regid = result.getProperty("RegistrationId").toString(); //1 + str_sname = result.getProperty("Name").toString().toString();//name + str_s_pmname = result.getProperty("ManagerName").toString();//Abbhinandan + str_s_pm_mid = result.getProperty("ManagerId").toString();//1 + str_s_leadid = result.getProperty("Lead_Id").toString();//MHOO + str_s_emailID = result.getProperty("MailId").toString();// mailid@ + str_s_cellno = result.getProperty("Student_Mobile_No").toString();// long + + str_s_pmMobileNo = result.getProperty("MobileNo").toString(); + //mobile change + + str_s_studentType = result.getProperty("Student_Type").toString(); + + str_s_isStudentLEADer = result.getProperty("isStudentLEADer").toString(); + str_s_collegeName = result.getProperty("College_Name").toString(); + + // Str_PMImageURL = result.getProperty("Manager_Image_Path").toString(); + + Str_s_PMImageURL = result.getProperty("Manager_Image_Path").toString(); + + str_s_gender = result.getProperty("Gender").toString(); + + str_s_starCount = result.getProperty("StartCount").toString(); + + str_fb = result.getProperty("Facebook").toString(); + str_tw = result.getProperty("Twitter").toString(); + str_in = result.getProperty("InstaGram").toString(); + str_whatsapp = result.getProperty("WhatsApp").toString(); + + str_isFeesPaid = result.getProperty("isFeePaid").toString(); + str_tshirt_status = result.getProperty("isRequestForTShirt").toString(); + //-----------------------------edited by madhu 9aug19---------------- + str_s_LLP = result.getProperty("LLP_Badges").toString(); + str_s_Prayana = result.getProperty("Prayana_Badges").toString(); + str_s_Yuva = result.getProperty("Yuva_Badges").toString(); + str_s_Valedicotry = result.getProperty("Valedicotry_Badges").toString(); + + Log.d("str_isFeesPaidissssss", str_isFeesPaid); + Log.e("str_s_LLP=", str_s_LLP + "str_s_Prayana=" + str_s_Prayana); + + + editor_S = shardpref_S_obj.edit(); + editor_S.putString(PrefID_RegID, str_regid); + editor_S.putString(PrefID_SName, str_sname); + editor_S.putString(PrefID_SLeadID, str_s_leadid); + editor_S.putString(PrefID_SCollegeName, str_s_collegeName); + editor_S.putString(PrefID_Role, role.toString()); + editor_S.putString(PrefID_PM_SName, str_s_pmname); + editor_S.putString(PrefID_PM_S_MID, str_s_pm_mid); + editor_S.putString(PrefID_PM_SEmailID, str_s_emailID); + editor_S.putString(PrefID_SCellNo, str_s_cellno); + editor_S.putString(PrefID_SStudentType, str_s_studentType); + editor_S.putString(PrefID_SSisStudentLEADer, str_s_isStudentLEADer); + + editor_S.putString(PrefID_SLLP, str_s_LLP); + editor_S.putString(PrefID_SPrayana, str_s_Prayana); + editor_S.putString(PrefID_SYuva, str_s_Yuva); + editor_S.putString(PrefID_SValedicotry, str_s_Valedicotry); + + + // editor_S.putString(PrefID_PMMobile,str_s_pmMobileNo); + + editor_S.putString(PrefID_PM_S_CellNo, str_s_pmMobileNo); //PrefID_PM_S_CellNo + + editor_S.putString(PrefId_S_Gender, str_s_gender); + editor_S.putString(PrefId_S_StarCount, str_s_starCount); + + editor_S.putString(PrefId_S_FB, str_fb); + editor_S.putString(PrefId_S_TW, str_tw); + editor_S.putString(PrefId_S_IN, str_in); + editor_S.putString(PrefId_S_Whatsapp, str_whatsapp); + + editor_S.putString(PrefId_S_IsFeesPaid, str_isFeesPaid); + editor_S.putString(PrefId_S_TshirtStatus, str_tshirt_status); //0 not eligible, 1 eligible, 2 already sent request + + + String Imagestrings = Str_s_PMImageURL; + Str_PM_S_Full_ImgUrl = null; + if (Imagestrings == null || Imagestrings.equals("null") || Imagestrings.equals("anyType{}")) { + Str_PM_S_Full_ImgUrl = "null"; + } else { + String arr[] = Imagestrings.split("/", 2); + + String firstWord = arr[0]; //the + String secondWord = arr[1]; + + Str_PM_S_Full_ImgUrl = serverPath + secondWord; + Log.i("tag", "firstWord=" + firstWord + " secondWord=" + secondWord); + + Log.i("tag", "PMImage1=" + Str_s_PMImageURL); + Log.i("tag", "PMImgUrl=" + Str_PM_S_Full_ImgUrl); + } + + // editor_S.putString(PrefID_pmimageurl,Str_PMImgUrl); + + editor_S.putString(PrefID_PM_S_ImagePath, Str_PM_S_Full_ImgUrl); + + + if (isProfileEdited.toString().equals("0"))// first time user + { + Intent ittLoginToEditProfile = new Intent(LoginActivity.this, EditProfileActivity.class); + ittLoginToEditProfile.putExtra("leadid", leadid); + // ittLoginToEditProfile.putExtra("isProfileEdit","0"); + startActivity(ittLoginToEditProfile); + editor_S.putString(PrefID_S_isprofileEdited, "0"); + +/* LoadMgrProfilePick loadMgrProfilePick = new LoadMgrProfilePick(context); + loadMgrProfilePick.execute();*/ + + }else if (isProfileEdited.toString().equals("2"))// Manager edited profile time user + { + Intent ittLoginToEditProfile = new Intent(LoginActivity.this, EditProfileActivity.class); + ittLoginToEditProfile.putExtra("leadid", leadid); + // ittLoginToEditProfile.putExtra("isProfileEdit","0"); + startActivity(ittLoginToEditProfile); + editor_S.putString(PrefID_S_isprofileEdited, "2"); + +/* LoadMgrProfilePick loadMgrProfilePick = new LoadMgrProfilePick(context); + loadMgrProfilePick.execute();*/ + + } else { + + + str_studImgUrl = result.getProperty("UserImage").toString(); + + String Imagestring = str_studImgUrl; + Str_StudImgUrl = null; //Str_fullStudImgUrl + if (Imagestring.equals("null") || Imagestring.equals("anyType{}")) { + Str_StudImgUrl = "null"; //Str_fullStudImgUrl + } else { + String arr[] = Imagestring.split("/", 2); + + String firstWord = arr[0]; //the + String secondWord = arr[1]; + + Str_StudImgUrl = serverPath + secondWord; //Str_fullStudImgUrl + Log.i("tag", "firstWord=" + firstWord + " secondWord=" + secondWord); + + Log.i("tag", "StudentImage1=" + str_studImgUrl); + Log.i("tag", "StudentImage2=" + Str_StudImgUrl);//Str_fullStudImgUrl + } + + editor_S.putString(PrefID_S_isprofileEdited, "1"); + + + editor_S.putString(PrefID_SImageUrl, Str_StudImgUrl); //Str_fullStudImgUrl + + /* LoadStudentProfilePick loadStudentProfilePick = new LoadStudentProfilePick(context); + loadStudentProfilePick.execute();*/ + /* Intent i = new Intent(LoginActivity.this, HomeActivity.class); + startActivity(i);*/ + + if (str_isuser_setpin.isEmpty()) { + + // Toast.makeText(getApplicationContext(),"empty",Toast.LENGTH_SHORT).show(); + Intent i = new Intent(LoginActivity.this, Activity_setpin.class); + startActivity(i); + finish(); + + } else { + Intent i = new Intent(LoginActivity.this, Activity_pinlogin.class); + startActivity(i); + finish(); + } + + } + + + editor_S.commit(); + + } + if (role.toString().equals("Manager")) { + + AsyncCallFCM task = new AsyncCallFCM(LoginActivity.this); + task.execute(); + + Str_FCMName = result.getProperty("Username").toString().toString(); + Str_Manager_Id = result.getProperty("ManagerId").toString(); + Str_ManagerName = result.getProperty("Name").toString(); + Str_PMEmailId = result.getProperty("MailId").toString(); + Str_PM_Mobile = result.getProperty("MobileNo").toString(); + Str_PMLocation = result.getProperty("Location").toString(); + Str_PMImageURL = result.getProperty("UserImage").toString(); + str_regid=result.getProperty("RegistrationId").toString(); + Log.e("tag", "PMImageURL=" + Str_PMImageURL); + Log.e("tag", "str_regid=" + str_regid); + + String Imagestring = Str_PMImageURL; + String Str_PMImgUrl = null; + if (Imagestring.equals("null") || Imagestring.equals("anyType{}")) { + Str_PMImgUrl = "null"; + } else { + String arr[] = Imagestring.split("/", 2); + + String firstWord = arr[0]; //the + String secondWord = arr[1]; + + Str_PMImgUrl = serverPath + secondWord; + Log.i("tag", "firstWord=" + firstWord + " secondWord=" + secondWord); + + Log.i("tag", "PMImage1=" + Str_PMImageURL); + Log.i("tag", "PMImgUrl=" + Str_PMImgUrl); + } + + + ManagerId = Integer.parseInt(Str_Manager_Id); + /* Intent ittLoginToEditProfile = new Intent(LoginActivity.this, PMHomeActivity.class); + + ittLoginToEditProfile.putExtra("ManagerId", ManagerId); + ittLoginToEditProfile.putExtra("ManagerName", Str_ManagerName); + ittLoginToEditProfile.putExtra("PMEmailId", Str_PMEmailId); + ittLoginToEditProfile.putExtra("PM_Mobile", Str_PM_Mobile); + ittLoginToEditProfile.putExtra("PMLocation", Str_PMLocation); + ittLoginToEditProfile.putExtra("PMImgUrl", Str_PMImgUrl);*/ + + editor_PM = shardprefPM_obj.edit(); + editor_PM.putString(PrefID_PMID, Str_Manager_Id); + Log.d("ManagerIdis", Str_Manager_Id); + editor_PM.putString(PrefID_pmName, Str_ManagerName); + editor_PM.putString(PrefID_PMEMailID, Str_PMEmailId); + editor_PM.putString(PrefID_PMMobile, Str_PM_Mobile); + editor_PM.putString(PrefID_pmlocation, Str_PMLocation); + editor_PM.putString(PrefID_pmimageurl, Str_PMImgUrl); + + editor_PM.putString(PrefID_pm_username, leadid.toString()); + editor_PM.putString(PrefID_pm_password, mobnumber.toString()); + + + Log.d("ManagerIds:", Str_Manager_Id); + Log.d("ManagerNames:", Str_ManagerName); + Log.d("ManagerEmailIds:", Str_PMEmailId); + Log.d("ManagerMobiles:", Str_PM_Mobile); + Log.d("Managerlocations:", Str_PMLocation); + Log.d("ManagerURLs:", Str_PMImgUrl); + + + editor_PM.commit(); + + editor_S = shardpref_S_obj.edit(); + editor_S.putString(PrefID_Role, role.toString()); + editor_S.putString(PrefID_RegID, str_regid); + editor_S.commit(); + + + // startActivity(ittLoginToEditProfile); + + if (str_isuser_setpin.isEmpty()) { + + // Toast.makeText(getApplicationContext(),"empty",Toast.LENGTH_SHORT).show(); + /* Intent i = new Intent(LoginActivity.this, Activity_setpin.class); + startActivity(i); + finish();*/ + Intent ittLoginToEditProfile = new Intent(LoginActivity.this, Activity_setpin.class); + + /* ittLoginToEditProfile.putExtra("ManagerId", ManagerId); + ittLoginToEditProfile.putExtra("ManagerName", Str_ManagerName); + ittLoginToEditProfile.putExtra("PMEmailId", Str_PMEmailId); + ittLoginToEditProfile.putExtra("PM_Mobile", Str_PM_Mobile); + ittLoginToEditProfile.putExtra("PMLocation", Str_PMLocation); + ittLoginToEditProfile.putExtra("PMImgUrl", Str_PMImgUrl);*/ + startActivity(ittLoginToEditProfile); + finish(); + } else { + /*Intent i = new Intent(LoginActivity.this, Activity_pinlogin.class); + startActivity(i); + finish();*/ + Intent ittLoginToEditProfile = new Intent(LoginActivity.this, Activity_pinlogin.class); + + /* ittLoginToEditProfile.putExtra("ManagerId", ManagerId); + ittLoginToEditProfile.putExtra("ManagerName", Str_ManagerName); + ittLoginToEditProfile.putExtra("PMEmailId", Str_PMEmailId); + ittLoginToEditProfile.putExtra("PM_Mobile", Str_PM_Mobile); + ittLoginToEditProfile.putExtra("PMLocation", Str_PMLocation); + ittLoginToEditProfile.putExtra("PMImgUrl", Str_PMImgUrl);*/ + startActivity(ittLoginToEditProfile); + finish(); + } + } + + //-----------------------------edited by madhu 9aug19---------------- + + if (role.toString().equals("Principal")) { + AsyncCallFCM task = new AsyncCallFCM(LoginActivity.this); + task.execute(); + + Str_FCMName = result.getProperty("Username").toString().toString(); + Principal_MailId = result.getProperty("Name").toString().toString(); + Principal_WhatsAppNo = result.getProperty("Lead_Id").toString().toString(); + Principal_MobileNo = result.getProperty("Student_Mobile_No").toString().toString(); + Principal_College_Name = result.getProperty("College_Name").toString().toString(); + Principal_College_Id = result.getProperty("LoginId").toString().toString(); + str_regid=result.getProperty("RegistrationId").toString(); + + editor_Principle_info = shardprefPrinciple_info.edit(); + editor_Principle_info.putString(PrefID_PName, Str_FCMName); + editor_Principle_info.putString(PrefID_AcademicId, str_academicCode); + editor_Principle_info.putString(PrefID_PMailId, Principal_MailId); + editor_Principle_info.putString(PrefID_PWhatsapp, Principal_WhatsAppNo); + editor_Principle_info.putString(PrefID_PMobileNo, Principal_MobileNo); + editor_Principle_info.putString(PrefID_CollgeName, Principal_College_Name); + editor_Principle_info.putString(PrefID_PCollegeId, Principal_College_Id); + + editor_Principle_info.commit(); + + editor_S = shardpref_S_obj.edit(); + editor_S.putString(PrefID_Role, role.toString()); + editor_S.putString(PrefID_RegID, str_regid); + editor_S.commit(); + + /* Intent i = new Intent(LoginActivity.this, PrincipleHomeActivity.class); + startActivity(i); + finish();*/ + if (str_isuser_setpin.isEmpty()) { + + // Toast.makeText(getApplicationContext(),"empty",Toast.LENGTH_SHORT).show(); + Intent i = new Intent(LoginActivity.this, Activity_setpin.class); + startActivity(i); + finish(); + + } else { + Intent i = new Intent(LoginActivity.this, Activity_pinlogin.class); + startActivity(i); + finish(); + } + + } + } else { + Log.d("Status is: ", status.toString()); + } + + //progressDialog.dismiss(); + +/* for (int i = 0; i < result.getPropertyCount(); i++) { + SoapObject list = (SoapObject) result.getProperty(i); + SoapPrimitive S_Name, email_id,S_Status; + Object O_CohortDuration,O_name,O_mobileNumber,O_email_Id,O_program,O_cohortName,O_Address,O_BloodGroup,O_fellowshipLogo,O_student_photo; + + Log.d("Result of soap objectdd",list.toString()); + + String results = + + *//* if(list.toString().contains(getString(R.string.txtStatus))){ + S_Status = (SoapPrimitive) list.getProperty("Status"); + applicationId.setError(S_Status.toString()); + } + + else { + + applicationId.setError(null); + + O_name = list.getProperty(getString(R.string.txtSName)); + if(O_name.toString().equals(getString(R.string.txtAnyType)) || O_name.toString().equals(null)){ + name.setText(""); + nameMain = name.getText().toString(); + } + else{ + S_Name = (SoapPrimitive) list.getProperty(getString(R.string.txtSName)); + name.setText(S_Name.toString()); + nameMain = name.getText().toString(); + } + + O_program = list.getProperty(getString(R.string.txtFellowshipName)); + if(O_program.toString().equals(getString(R.string.txtAnyType)) || O_program.toString().equals(null) ){ + program.setText(""); + } + else{ + program.setText(((SoapPrimitive) list.getProperty(getString(R.string.txtFellowshipName))).toString()); + } + + O_cohortName = list.getProperty(getString(R.string.txtCName)); + if(O_cohortName.toString().equals(getString(R.string.txtAnyType)) || O_cohortName.toString().equals(null)){ + cohortName=""; + } + else{ + cohortName = ((SoapPrimitive) list.getProperty(getString(R.string.txtCName))).toString(); + } + + O_mobileNumber = list.getProperty(getString(R.string.txtMobNo)); + if(O_mobileNumber.toString().equals(getString(R.string.txtAnyType)) || O_mobileNumber.toString().equals(null)){ + mobileNumber=""; + } + else{ + mobileNumber = ((SoapPrimitive) list.getProperty(getString(R.string.txtMobNo))).toString(); + } + + O_email_Id = list.getProperty(getString(R.string.txtemailId)); + if(O_email_Id.toString().equals(getString(R.string.txtAnyType)) || O_email_Id.toString().equals(null)) { + emailid=""; + } + else{ + emailid = ((SoapPrimitive) list.getProperty(getString(R.string.txtemailId))).toString(); + } + + O_student_photo = list.getProperty(getString(R.string.txtOstudentPhoto)); + if(O_student_photo.toString().equals(getString(R.string.txtAnyType)) || O_student_photo.toString().equals(null)) { + idCardGenerated = ""; + } + else{ + idCardGenerated = ((SoapPrimitive) list.getProperty(getString(R.string.txtOstudentPhoto))).toString(); + } + + + + O_CohortDuration = list.getProperty(getString(R.string.txtCohortDuration)); + if(O_CohortDuration.toString().equals(getString(R.string.txtAnyType))){ + cohortDurationFromTo = ""; + } + else{ + cohortDurationFromTo = ((SoapPrimitive) list.getProperty(getString(R.string.txtCohortDuration))).toString(); + } + + O_Address = list.getProperty(getString(R.string.txtAddress)); + if(O_Address.toString().equals(getString(R.string.txtAnyType))){ + studentAddress = ""; + } + else{ + studentAddress = ((SoapPrimitive) list.getProperty(getString(R.string.txtAddress))).toString(); + } + + O_BloodGroup = list.getProperty(getString(R.string.txtBloodGrp)); + if(O_BloodGroup.toString().equals(getString(R.string.txtAnyType)) || O_BloodGroup.toString().equals(getString(R.string.txtzero))){ + bloodGroup = ""; + } + else{ + bloodGroup = ((SoapPrimitive) list.getProperty(getString(R.string.txtBloodGrp))).toString(); + } + + + //O_fellowshipLogo = (((SoapPrimitive) list.getProperty("FellowshipLogo")).toString()); + O_fellowshipLogo = list.getProperty(getString(R.string.txtFellowshipLogo)); + if(O_fellowshipLogo.toString().equals(getString(R.string.txtAnyType)) || O_fellowshipLogo.toString().equals(getString(R.string.txtzero))){ + fellowshipimageLogo = ""; + } + else{ + fellowshipimageLogo = (((SoapPrimitive) list.getProperty(getString(R.string.txtFellowshipLogo))).toString()); + + String namespc = ((SoapPrimitive) list.getProperty(getString(R.string.txtFellowshipLogo))).getNamespace(); + //Log.d("namespc", namespc); + String url1 = fellowshipimageLogo.substring(2); + //Log.d("url1", url1); + + fellowshipimageLogo = getString(R.string.txtMainNamespace1) + url1; + } + + RelativeLayout rltlytMain = (RelativeLayout) findViewById(R.id.rltlyt_details); + rltlytMain.setVisibility(View.VISIBLE); + + }*//* + + }*/ + } + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + public class LoadMgrProfilePick extends AsyncTask { + + private Context context; + + LoadMgrProfilePick(Context context) { + this.context = context; + } + + @Override + protected void onPreExecute() { + } + + @Override + protected Bitmap doInBackground(Void... params) { + + Bitmap bitmaplogo = null; + + try { + if (!Str_PMImgUrl.equals(null) && !Str_PMImgUrl.equalsIgnoreCase("null") && !Str_PMImgUrl.isEmpty() && Str_PMImgUrl != "" && !Str_PMImgUrl.equals("anyType{}") && !Str_PMImgUrl.equals("{}")) { + URL urlis = new URL(Str_PMImgUrl); + InputStream inputStream = urlis.openStream(); + bitmaplogo = BitmapFactory.decodeStream(inputStream); + } + } catch (MalformedURLException e) { + e.printStackTrace(); + final String exceptnMsg = e.getMessage().toString(); + + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(LoginActivity.this, exceptnMsg, Toast.LENGTH_LONG).show(); + } + }); + + } catch (IOException e) { + e.printStackTrace(); + final String exceptnMsg = e.getMessage().toString(); + + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(LoginActivity.this, exceptnMsg, Toast.LENGTH_LONG).show(); + } + }); + } catch (OutOfMemoryError ex) { + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context, "Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + return bitmaplogo; + } + + @Override + protected void onPostExecute(Bitmap pmBitmap) { + if (pmBitmap != null) { + Log.d("insidemgrbitmap", pmBitmap.toString()); + + try { + + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + pmBitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); + byte[] imageinbytesArray = stream.toByteArray(); + String encodedImage = Base64.encodeToString(imageinbytesArray, Base64.DEFAULT); + + /* shardpref_S_obj.edit(); + editor_S.putString(PrefID_PM_ImgBase64,encodedImage);*/ + + + editor_S = shardpref_S_obj.edit(); + editor_S.putString(PrefID_PM_ImgBase64, encodedImage); + editor_S.commit(); + + + //StudentPMImageBitmap.setPmByteArray(imageinbytesArray); + + + //StudentPMImageBitmap.setPmBitmap(pmBitmap); + + progressDialog.dismiss(); + + Intent i = new Intent(LoginActivity.this, HomeActivity.class); + startActivity(i); + } catch (OutOfMemoryError ex) { + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context, "Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + } + } + } + + + public class LoadStudentProfilePick extends AsyncTask { + + private Context context; + + LoadStudentProfilePick(Context context) { + this.context = context; + } + + @Override + protected void onPreExecute() { + + Log.d("InsideLoadStudent", "ProfilePick"); + } + + @Override + protected Bitmap doInBackground(Void... params) { + + Bitmap bitmaplogo = null; + + try { + if (!Str_StudImgUrl.equals(null) && !Str_StudImgUrl.equalsIgnoreCase("null") && !Str_StudImgUrl.isEmpty() && Str_StudImgUrl != "" && !Str_StudImgUrl.equals("anyType{}") && !Str_StudImgUrl.equals("{}")) { + Log.d("InsideStudImgUrl", "notnulls"); + URL urlis = new URL(Str_StudImgUrl); + InputStream inputStream = urlis.openStream(); + bitmaplogo = BitmapFactory.decodeStream(inputStream); + } + } catch (MalformedURLException e) { + e.printStackTrace(); + final String exceptnMsg = e.getMessage().toString(); + + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(LoginActivity.this, exceptnMsg, Toast.LENGTH_LONG).show(); + } + }); + + } catch (IOException e) { + e.printStackTrace(); + final String exceptnMsg = e.getMessage().toString(); + + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(LoginActivity.this, exceptnMsg, Toast.LENGTH_LONG).show(); + } + }); + } catch (OutOfMemoryError ex) { + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context, "Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + return bitmaplogo; + } + + @Override + protected void onPostExecute(Bitmap studBitmap) { + if (studBitmap != null) { + Log.d("insidestudbitmap", studBitmap.toString()); + + try { + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + studBitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); + //imageInByte; + byte[] imageinbytesArray = stream.toByteArray(); + + + String encodedImage = Base64.encodeToString(imageinbytesArray, Base64.DEFAULT); + + editor_S = shardpref_S_obj.edit(); + editor_S.putString(PrefID_S_ImgBase64, encodedImage); + editor_S.commit(); + } catch (OutOfMemoryError ex) { + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context, "Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + //textEncode.setText(encodedImage); + + //StudentPMImageBitmap.setStudByteArray(imageinbytesArray); + + + //StudentPMImageBitmap.setStudBitmap(studBitmap); + } + + LoadMgrProfilePick loadMgrProfilePick = new LoadMgrProfilePick(context); + loadMgrProfilePick.execute(); + } + } + + + private SoapObject getLoginDetails(String mobilenum, String leadid) { + + //changed from ValidateLogin to ValidateLogin1 + String METHOD_NAME = "ValidateLogin1"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/ValidateLogin1"; + + try { + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + Log.d("Mobile Number", mobilenum); + Log.d("Lead Id", leadid); + + /*request.addProperty("Username", mobilenum); + request.addProperty("Password", leadid);*/ + + /*request.addProperty("Username", leadid); + request.addProperty("Password", mobilenum);*/ + + String username = edt_leadid.getText().toString(); + String password = edt_mobnumber.getText().toString(); + request.addProperty("Username", username); + request.addProperty("Password", password); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Login.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapObject response = (SoapObject) envelope.getResponse(); + // str_loginresponse = (String)response.getProperty("Status"); + Log.d("soap LoginResponse", response.toString()); + + return response; + + } catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + } catch (Exception t) { + Log.d("exception outside", t.getMessage().toString()); + } + return null; + + + } + private SoapObject getGoogleLoginDetails(String gmail) { + + //changed from ValidateLogin to ValidateLogin1 + String METHOD_NAME = "ValidateLogin1_Principle_Google"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/ValidateLogin1_Principle_Google"; + + try { + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + Log.d("gmail", gmail); + + /*request.addProperty("Username", mobilenum); + request.addProperty("Password", leadid);*/ + + /*request.addProperty("Username", leadid); + request.addProperty("Password", mobilenum);*/ + + String username = edt_leadid.getText().toString(); + String password = edt_mobnumber.getText().toString(); + request.addProperty("Mail_Id", "madhushree.kubsad@dfmail.org"); + // request.addProperty("Password", password); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Login.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapObject response = (SoapObject) envelope.getResponse(); + // str_loginresponse = (String)response.getProperty("Status"); + Log.d("soap LoginResponse", response.toString()); + + return response; + + } catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + } catch (Exception t) { + Log.d("exception outside", t.getMessage().toString()); + } + return null; + + + } + + public boolean CheckingPermissionIsEnabledOrNot() { + + int FirstPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.READ_EXTERNAL_STORAGE); + int SecondPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE); + int ThirdPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.INTERNET); + int FourthPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.READ_PHONE_STATE); + int FifthPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.ACCESS_NETWORK_STATE); + int SixthPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.CALL_PHONE); + int SeventhPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.WAKE_LOCK); + return FirstPermissionResult == PackageManager.PERMISSION_GRANTED && + SecondPermissionResult == PackageManager.PERMISSION_GRANTED && ThirdPermissionResult == PackageManager.PERMISSION_GRANTED && FourthPermissionResult == PackageManager.PERMISSION_GRANTED && FifthPermissionResult == PackageManager.PERMISSION_GRANTED && SixthPermissionResult == PackageManager.PERMISSION_GRANTED && SeventhPermissionResult == PackageManager.PERMISSION_GRANTED; + } + + //Added by Sripad + private void RequestMultiplePermission() { + + // Creating String Array with Permissions. + ActivityCompat.requestPermissions(LoginActivity.this, new String[] + { + Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.INTERNET, Manifest.permission.READ_PHONE_STATE, Manifest.permission.ACCESS_NETWORK_STATE, Manifest.permission.CALL_PHONE + }, RequestPermissionCode); + + } + + @Override + public void onRequestPermissionsResult(int requestCode, + String permissions[], int[] grantResults) { + switch (requestCode) { + + case RequestPermissionCode: + + if (grantResults.length > 0) { + + boolean WriteExternalStoragePermission = grantResults[0] == PackageManager.PERMISSION_GRANTED; + boolean ReadExternalStoragePermission = grantResults[1] == PackageManager.PERMISSION_GRANTED; + boolean InternetPermission = grantResults[2] == PackageManager.PERMISSION_GRANTED; + boolean ReadPhonePermission = grantResults[3] == PackageManager.PERMISSION_GRANTED; + boolean AccessNetworkPermission = grantResults[4] == PackageManager.PERMISSION_GRANTED; + boolean CallPhonePermission = grantResults[5] == PackageManager.PERMISSION_GRANTED; + + if (WriteExternalStoragePermission && ReadExternalStoragePermission && InternetPermission && ReadPhonePermission && AccessNetworkPermission && CallPhonePermission) { + + //Toast.makeText(MainActivity.this, "Permission Granted", Toast.LENGTH_LONG).show(); + } else { + Toast.makeText(LoginActivity.this, "Permission Denied", Toast.LENGTH_LONG).show(); + } + } + + break; + } + + } + + protected void setGooglePlusButtonText(SignInButton signInButton, String buttonText) + { + // Find the TextView that is inside of the SignInButton and set its text + for (int i = 0; i < signInButton.getChildCount(); i++) { + View v = signInButton.getChildAt(i); + + if (v instanceof TextView) { + TextView tv = (TextView) v; + tv.setText(buttonText); + // tv.setBackgroundColor(Color.CYAN); + /* tv.setBackgroundDrawable( + new ColorDrawable(Color.parseColor(COLOR))); + tv.setTextColor(Color.WHITE); + tv.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/laouibold.ttf"));*/ + return; + } + } + } + + + private class AsyncCallFCM extends AsyncTask { + + ProgressDialog dialog; + + Context context; + boolean versionval; + + @Override + protected void onPreExecute() { + Log.i("Leadmis", "onPreExecute---tab2"); + /* dialog.setMessage("Please wait.."); + dialog.setCanceledOnTouchOutside(false); + dialog.show();*/ + + } + + @Override + protected void onProgressUpdate(Void... values) { + Log.i("Leadmis", "onProgressUpdate---tab2"); + } + + public AsyncCallFCM(LoginActivity activity) { + context = activity; + // dialog = new ProgressDialog(activity); + } + + @Override + protected Void doInBackground(String... params) { + Log.i("Leadmis", "doInBackground"); + + + setGCM1(); + setGCM1(); + + + // versionval = appversioncheck(versioncodeInString); + + + return null; + } + + @Override + protected void onPostExecute(Void result) { + /*if (dialog.isShowing()) { + dialog.dismiss(); + + }*/ + // Log.i(TAG, "onPostExecute"); + + /* if(versionval) + { }else{alerts();}*/ + + + } + }//end of AsynTask + + + /*public void setGCM1() { + + +// + + // Fetch Device info + + *//* final TelephonyManager tm = (TelephonyManager) getBaseContext() + .getSystemService(Context.TELEPHONY_SERVICE);*//* + + tm1 = (TelephonyManager) getBaseContext() + .getSystemService(Context.TELEPHONY_SERVICE); + + // final String tmDevice, tmSerial, androidId; + String NetworkType; + //TelephonyManager telephonyManager = ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE)); + simOperatorName = tm1.getSimOperatorName(); + Log.v("Operator", "" + simOperatorName); + NetworkType = "GPRS"; + + + int simSpeed = tm1.getNetworkType(); + if (simSpeed == 1) + NetworkType = "Gprs"; + else if (simSpeed == 4) + NetworkType = "Edge"; + else if (simSpeed == 8) + NetworkType = "HSDPA"; + else if (simSpeed == 13) + NetworkType = "LTE"; + else if (simSpeed == 3) + NetworkType = "UMTS"; + else + NetworkType = "Unknown"; + + Log.v("SIM_INTERNET_SPEED", "" + NetworkType); + if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) { + // TODO: Consider calling + // ActivityCompat#requestPermissions + // here to request the missing permissions, and then overriding + // public void onRequestPermissionsResult(int requestCode, String[] permissions, + // int[] grantResults) + // to handle the case where the user grants the permission. See the documentation + // for ActivityCompat#requestPermissions for more details. + return; + } + + //tmDevice = "" + tm1.getDeviceId(); + + String tmDevice = Settings.Secure.getString(this.getContentResolver(), Settings.Secure.ANDROID_ID); + Log.v("DeviceIMEI", "" + tmDevice); + + + Log.v("DeviceIMEI", "" + tmDevice); + mobileNumber = "" + tm1.getLine1Number(); + Log.v("getLine1Number value", "" + mobileNumber); + + String mobileNumber1 = "" + tm1.getPhoneType(); + Log.v("getPhoneType value", "" + mobileNumber1); + //tmSerial = "" + tm1.getSimSerialNumber(); + + + TelephonyManager tMgr = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE); + try { + tmSerial = "" + tMgr.getSimSerialNumber(); + }catch(Exception ex) + { + tmSerial="inaccessible"; + } + + // Log.v("GSM devices Serial Number[simcard] ", "" + tmSerial); + androidId = "" + android.provider.Settings.Secure.getString(getContentResolver(), + android.provider.Settings.Secure.ANDROID_ID); + Log.v("androidId CDMA devices", "" + androidId); + UUID deviceUuid = new UUID(androidId.hashCode(), + ((long) tmDevice.hashCode() << 32) | tmSerial.hashCode()); + deviceId = deviceUuid.toString(); + // Log.v("deviceIdUUID universally unique identifier", "" + deviceId); + + + deviceModelName = Build.MODEL; + Log.v("Model Name", "" + deviceModelName); + deviceUSER = Build.USER; + Log.v("Name USER", "" + deviceUSER); + devicePRODUCT = Build.PRODUCT; + Log.v("PRODUCT", "" + devicePRODUCT); + deviceHARDWARE = Build.HARDWARE; + Log.v("HARDWARE", "" + deviceHARDWARE); + deviceBRAND = Build.BRAND; + Log.v("BRAND", "" + deviceBRAND); + myVersion = Build.VERSION.RELEASE; + Log.v("VERSION.RELEASE", "" + myVersion); + sdkVersion = Build.VERSION.SDK_INT; + Log.v("VERSION.SDK_INT", "" + sdkVersion); + sdkver = Integer.toString(sdkVersion); + // Get display details + + Measuredwidth = 0; + Measuredheight = 0; + Point size = new Point(); + //WindowManager w = getWindowManager(); + + DisplayMetrics displaymetrics = new DisplayMetrics(); + this.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + // w.getDefaultDisplay().getSize(size); + *//*Measuredwidth = w.getDefaultDisplay().getWidth();//size.x; + Measuredheight = w.getDefaultDisplay().getHeight();//size.y;*//* + + Measuredwidth = displaymetrics.widthPixels;//size.x; + Measuredheight = displaymetrics.heightPixels;//size.y; + } else { + *//*Display d = w.getDefaultDisplay(); + Measuredwidth = d.getWidth(); + Measuredheight = d.getHeight();*//* + + Measuredwidth = displaymetrics.widthPixels;//size.x; + Measuredheight = displaymetrics.heightPixels;//size.y; + } + + Log.v("SCREEN_Width", "" + Measuredwidth); + Log.v("SCREEN_Height", "" + Measuredheight); + + + regId = FirebaseInstanceId.getInstance().getToken(); + + + + Log.e("regId_DeviceID", "" + regId); + +*//*string + string + string + string + string + string + string + string + string + string + string + string*//* + + //if (!regId.equals("")){ + if (2>1){ + // String WEBSERVICE_NAME = "http://dfhrms.cloudapp.net/PMSservice.asmx?WSDL"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/SaveDeviceDetails"; + String METHOD_NAME1 = "SaveDeviceDetails"; + String MAIN_NAMESPACE = "http://mis.leadcampus.org/"; + String URI = Class_URL.URL_Login.toString().trim(); + + + SoapObject request = new SoapObject(MAIN_NAMESPACE, METHOD_NAME1); + + // request.addProperty("LeadId", Password1); + request.addProperty("username",Str_FCMName ); + + request.addProperty("DeviceId", regId); + request.addProperty("OSVersion", myVersion); + request.addProperty("Manufacturer", deviceBRAND); + request.addProperty("ModelNo", deviceModelName); + request.addProperty("SDKVersion", sdkver); + request.addProperty("DeviceSrlNo", tmDevice); + request.addProperty("ServiceProvider", simOperatorName); + request.addProperty("SIMSrlNo", tmSerial); + request.addProperty("DeviceWidth", Measuredwidth); + request.addProperty("DeviceHeight", Measuredheight); + request.addProperty("AppVersion", versioncode); + //request.addProperty("AppVersion","4.0"); + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( + SoapEnvelope.VER11); + envelope.dotNet = true; + // Set output SOAP object + envelope.setOutputSoapObject(request); + Log.e("deviceDetails Request","deviceDetail"+request.toString()); + // Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URI); + + try { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + + System.out.println("Device Res"+response); + + Log.i("sending device detail", response.toString()); + + } catch (Exception e) { + e.printStackTrace(); + Log.i("err",e.toString()); + } + } + + + + + + + }//end of GCM()*/ + public void setGCM1() { + + +// + + // Fetch Device info + + /* final TelephonyManager tm = (TelephonyManager) getBaseContext() + .getSystemService(Context.TELEPHONY_SERVICE);*/ + + tm1 = (TelephonyManager) getBaseContext() + .getSystemService(Context.TELEPHONY_SERVICE); + + // final String tmDevice, tmSerial, androidId; + String NetworkType; + //TelephonyManager telephonyManager = ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE)); + simOperatorName = tm1.getSimOperatorName(); + Log.v("Operator", "" + simOperatorName); + NetworkType = "GPRS"; + + + int simSpeed = tm1.getNetworkType(); + if (simSpeed == 1) + NetworkType = "Gprs"; + else if (simSpeed == 4) + NetworkType = "Edge"; + else if (simSpeed == 8) + NetworkType = "HSDPA"; + else if (simSpeed == 13) + NetworkType = "LTE"; + else if (simSpeed == 3) + NetworkType = "UMTS"; + else + NetworkType = "Unknown"; + + Log.v("SIM_INTERNET_SPEED", "" + NetworkType); + if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) { + // TODO: Consider calling + // ActivityCompat#requestPermissions + // here to request the missing permissions, and then overriding + // public void onRequestPermissionsResult(int requestCode, String[] permissions, + // int[] grantResults) + // to handle the case where the user grants the permission. See the documentation + // for ActivityCompat#requestPermissions for more details. + return; + } + //tmDevice = "" + tm1.getDeviceId(); + String tmDevice = Settings.Secure.getString(this.getContentResolver(), Settings.Secure.ANDROID_ID); + Log.v("DeviceIMEI", "" + tmDevice); + mobileNumber = "" + tm1.getLine1Number(); + Log.v("getLine1Number value", "" + mobileNumber); + + String mobileNumber1 = "" + tm1.getPhoneType(); + Log.v("getPhoneType value", "" + mobileNumber1); + // tmSerial = "" + tm1.getSimSerialNumber(); + TelephonyManager tMgr = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE); + try { + tmSerial = "" + tMgr.getSimSerialNumber(); + }catch(Exception ex) + { + tmSerial="inaccessible"; + } + + + + // Log.v("GSM devices Serial Number[simcard] ", "" + tmSerial); + androidId = "" + Settings.Secure.getString(getContentResolver(), + Settings.Secure.ANDROID_ID); + Log.v("androidId CDMA devices", "" + androidId); + UUID deviceUuid = new UUID(androidId.hashCode(), + ((long) tmDevice.hashCode() << 32) | tmSerial.hashCode()); + deviceId = deviceUuid.toString(); + Log.v("deviceIdUUID", "" + deviceId); + + + deviceModelName = Build.MODEL; + Log.v("Model Name", "" + deviceModelName); + deviceUSER = Build.USER; + Log.v("Name USER", "" + deviceUSER); + devicePRODUCT = Build.PRODUCT; + Log.v("PRODUCT", "" + devicePRODUCT); + deviceHARDWARE = Build.HARDWARE; + Log.v("HARDWARE", "" + deviceHARDWARE); + deviceBRAND = Build.BRAND; + Log.v("BRAND", "" + deviceBRAND); + myVersion = Build.VERSION.RELEASE; + Log.v("VERSION.RELEASE", "" + myVersion); + sdkVersion = Build.VERSION.SDK_INT; + Log.v("VERSION.SDK_INT", "" + sdkVersion); + sdkver = Integer.toString(sdkVersion); + // Get display details + + Measuredwidth = 0; + Measuredheight = 0; + Point size = new Point(); + // WindowManager w = getWindowManager(); + + DisplayMetrics displaymetrics = new DisplayMetrics(); + this.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); + /*int screenWidth = displaymetrics.widthPixels; + int screenHeight = displaymetrics.heightPixels;*/ + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + // w.getDefaultDisplay().getSize(size); + /* Measuredwidth = w.getDefaultDisplay().getWidth();//size.x; + Measuredheight = w.getDefaultDisplay().getHeight();//size.y;*/ + + Measuredwidth = displaymetrics.widthPixels;//size.x; + Measuredheight = displaymetrics.heightPixels;//size.y; + } else { + // Display d = w.getDefaultDisplay(); + /*Measuredwidth = d.getWidth(); + Measuredheight = d.getHeight();*/ + Measuredwidth = displaymetrics.widthPixels;//size.x; + Measuredheight = displaymetrics.heightPixels;//size.y; + } + + Log.v("SCREEN_Width", "" + Measuredwidth); + Log.v("SCREEN_Height", "" + Measuredheight); + + + regId = FirebaseInstanceId.getInstance().getToken(); + + + + Log.e("regId_DeviceID", "" + regId); + +/*string + string + string + string + string + string + string + string + string + string + string + string*/ + + //if (!regId.equals("")){ + if (2>1){ + // String WEBSERVICE_NAME = "http://dfhrms.cloudapp.net/PMSservice.asmx?WSDL"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/SaveDeviceDetails"; + String METHOD_NAME1 = "SaveDeviceDetails"; + String MAIN_NAMESPACE = "http://mis.leadcampus.org/"; + String URI = Class_URL.URL_Login.toString().trim(); + + + SoapObject request = new SoapObject(MAIN_NAMESPACE, METHOD_NAME1); + + // request.addProperty("LeadId", Password1); + request.addProperty("username",Str_FCMName ); + + request.addProperty("DeviceId", regId); + request.addProperty("OSVersion", myVersion); + request.addProperty("Manufacturer", deviceBRAND); + request.addProperty("ModelNo", deviceModelName); + request.addProperty("SDKVersion", sdkver); + request.addProperty("DeviceSrlNo", tmDevice); + request.addProperty("ServiceProvider", simOperatorName); + request.addProperty("SIMSrlNo", tmSerial); + request.addProperty("DeviceWidth", Measuredwidth); + request.addProperty("DeviceHeight", Measuredheight); + request.addProperty("AppVersion", versioncode); + //request.addProperty("AppVersion","4.0"); + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( + SoapEnvelope.VER11); + envelope.dotNet = true; + // Set output SOAP object + envelope.setOutputSoapObject(request); + Log.e("deviceDetails Request","deviceDetail"+request.toString()); + // Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URI); + + try { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + + System.out.println("Device Res"+response); + + Log.i("sending device detail", response.toString()); + + } catch (Exception e) { + e.printStackTrace(); + Log.i("err",e.toString()); + } + } + + + + + + + }//end of GCM() + + + @Override + public void onBackPressed() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { + finishAffinity(); + } + System.exit(0); + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + +}// end of class diff --git a/app/src/main/java/com/leadcampusapp/MainActivity.java b/app/src/main/java/com/leadcampusapp/MainActivity.java new file mode 100644 index 0000000..0edd8fa --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/MainActivity.java @@ -0,0 +1,14 @@ +package com.leadcampusapp; + +import androidx.appcompat.app.AppCompatActivity; + +import android.os.Bundle; + +public class MainActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/ManagerFeesCollectionActivity.java b/app/src/main/java/com/leadcampusapp/ManagerFeesCollectionActivity.java new file mode 100644 index 0000000..6a3f078 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ManagerFeesCollectionActivity.java @@ -0,0 +1,2549 @@ +package com.leadcampusapp; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.AppCompatSpinner; +import androidx.core.content.ContextCompat; + +import android.annotation.SuppressLint; +import android.app.AlertDialog; +import android.app.DatePickerDialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.SharedPreferences; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.graphics.BitmapFactory; +import android.os.AsyncTask; +import android.os.Bundle; +import android.util.Log; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.DatePicker; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.RadioButton; +import android.widget.RadioGroup; +import android.widget.RelativeLayout; +import android.widget.Spinner; +import android.widget.TextView; +import android.widget.Toast; + +import org.json.JSONObject; +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.net.URL; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class ManagerFeesCollectionActivity extends AppCompatActivity { + + EditText etName,etLeadId,etMobile,emailid_ET,edt_paymentDate,amount_ET,remark_ET,dobseterror_TV; + AppCompatSpinner spin_feesCategory,spin_state,spin_district,spin_city,spin_program,spin_institution,spin_paymentmode; + Class_States[] arrayObj_Class_States, arrayObj_Class_States2; + Class_States obj_Class_States; + int statelistcount; + String str_StateStatus="x"; + String[] state_stringArray; + + Class_District[] arrayObj_Class_District, arrayObj_Class_District2; + Class_District obj_Class_District; + int districtlistcount; + String str_DistrictStatus="x"; + + Class_Taluk[] arrayObj_Class_Taluk, arrayObj_Class_Taluk2; + Class_Taluk obj_Class_Taluk; + int taluklistcount; + String str_TalukStatus="x"; + + Class_Colleges[] arrayObj_Class_Colleges, arrayObj_Class_Colleges2,arrayObj_Class_Colleges3; + Class_Colleges obj_Class_Colleges; + int collegeslistcount; + String str_CollegesStatus; + + Class_FeesCatg[] arrayObj_Class_FeesCatg, arrayObj_Class_FeesCatg2; + Class_FeesCatg obj_Class_FeesCatg; + int feesCatglistcount; + String str_FeesCatgStatus="x"; + + Class_PaymentMode[] arrayObj_Class_PaymentMode, arrayObj_Class_PaymentMode2; + Class_PaymentMode obj_Class_PaymentMode; + int PaymentModelistcount; + String str_PaymentModeStatus="x"; + + Class_Course[] arrayObj_Class_Course, arrayObj_Class_Course2; + Class_Course obj_Class_Course; + int courselistcount; + String str_CourseStatus; + String str_courseid,str_coursename; + + Class_Program[] arrayObj_Class_Program, arrayObj_Class_Program2; + Class_Program obj_Class_Program; + int programlistcount; + String str_ProgramStatus; + String str_programid,str_programname="x"; + + String O_statename,O_districtname,O_talukname,O_programmename,O_coursename,O_semname,O_collegename; + String O_statecode,O_districtcode,O_talukacode,O_collegenameCode,O_coursecode,O_StreamprogramCode,O_MailId,O_leadID; + static String O_StudentName = null; + static String O_RegistrationId="0"; + static String O_MobileNo=null; + TextView stateerror_tv,districterror_tv,cityerror_tv,collegeerror_tv,courseerror_tv,semerror_tv,paymentmodeerror_TV; + String str_Cityids,str_ColID,str_Sids,str_Dids; + String str_MobileNo,str_RegID,str_LeadID="0",str_studenttype,str_academiccode; + + + ImageView search_bt; + Button btn_submit; + RadioGroup registration_radiogroup; + RadioButton rdb_register,rdb_newRegister; + String str_Reg,str_newReg,str_feesCatSlno,str_feesCatName,str_feesId,str_feesAmount="0",str_PaymentModeID,str_PaymentModeName; + private int mYear, mMonth, mDay; + private int cYear, cMonth, cDay; + private Context context; + + String str_isProfileEdited,str_academicId; + + SharedPreferences shardpref_S_obj; + SharedPreferences.Editor editor_S; + + public static final String PREFBook_Stud= "prefbook_stud"; + public static final String PrefID_RegID = "prefid_regid"; // + public static final String PrefID_S_isprofileEdited = "prefid_isprofileEdited"; + public static final String PrefID_SLeadID = "prefid_sleadid"; // + public static final String PrefId_S_AcademicId = "prefid_sacademicid"; + + SharedPreferences shardprefPM_obj; + SharedPreferences.Editor editor_PM; + public static final String PREFBook_PM= "prefbook_pm"; //sharedpreference Book + public static final String PrefID_PMID = "prefid_pmid"; // + + String str_MangerID,str_RegistrationId; + Integer MDId; + + ArrayAdapter dataAdapter, dataAdapter_district, dataAdapter_city, dataAdapter_college,dataAdapter_feesCatg,dataAdapter_semlist; + ArrayAdapter dataAdapter_course,dataAdapter_program,dataAdapter_bloodgroup; + + Class_InternetDectector internetDectector, internetDectector2; + Boolean isInternetPresent = false; + Boolean isInternetPresent2 = false; + + + String internet_issue = "false"; + String internet_issue1="Noerror"; + int isNewRegistration; + RelativeLayout leadId_rl; + String searchStatus; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_manager_fees_collection); + + context = ManagerFeesCollectionActivity.this; + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + //getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background)); + + + View actionBarView = getSupportActionBar().getCustomView(); + TextView actionBarTV = (TextView) actionBarView.findViewById(R.id.txt_actionBar); + actionBarTV.setText("Manager Fees Collection"); + + spin_feesCategory = (AppCompatSpinner) findViewById(R.id.spin_feesCategory); + spin_state = (AppCompatSpinner) findViewById(R.id.spin_state); + stateerror_tv = (TextView) findViewById(R.id.stateerror_TV); + spin_district = (AppCompatSpinner) findViewById(R.id.spin_district); + districterror_tv = (TextView) findViewById(R.id.districterror_TV); + spin_city = (AppCompatSpinner) findViewById(R.id.spin_city); + cityerror_tv = (TextView) findViewById(R.id.cityerror_TV); + spin_program = (AppCompatSpinner) findViewById(R.id.spin_program); + courseerror_tv = (TextView) findViewById(R.id.courselabel_TV); + spin_institution = (AppCompatSpinner) findViewById(R.id.spin_institution); + collegeerror_tv = (TextView) findViewById(R.id.collegeerror_TV); + etLeadId = (EditText) findViewById(R.id.etLeadId); + search_bt = (ImageView) findViewById(R.id.search_bt); + etName = (EditText) findViewById(R.id.etName); + etMobile = (EditText) findViewById(R.id.etMobile); + emailid_ET = (EditText) findViewById(R.id.emailid_ET); + edt_paymentDate = (EditText) findViewById(R.id.edt_paymentDate); + dobseterror_TV = (EditText) findViewById(R.id.dobseterror_TV); + amount_ET = (EditText) findViewById(R.id.amount_ET); + spin_paymentmode =(AppCompatSpinner) findViewById(R.id.spin_paymentmode); + paymentmodeerror_TV = (TextView) findViewById(R.id.paymentmodeerror_TV); + remark_ET =(EditText)findViewById(R.id.remark_ET); + registration_radiogroup = (RadioGroup) findViewById(R.id.registration_radiogroup); + btn_submit = (Button) findViewById(R.id.btn_submit); + rdb_register=(RadioButton) findViewById(R.id.rdb_register); + rdb_newRegister=(RadioButton)findViewById(R.id.rdb_newRegister); + leadId_rl=(RelativeLayout) findViewById(R.id.leadId_rl); + + shardpref_S_obj=this.getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + + shardpref_S_obj.getString(PrefID_S_isprofileEdited, "").trim(); + str_isProfileEdited = shardpref_S_obj.getString(PrefID_S_isprofileEdited, "").trim(); + shardpref_S_obj.getString(PrefId_S_AcademicId, "").trim(); + str_academicId = shardpref_S_obj.getString(PrefId_S_AcademicId, "").trim(); + Log.d("str_academicId:",str_academicId); + + shardprefPM_obj= getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MangerID = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + Log.d("str_MangerID:",str_MangerID); + // Toast.makeText(this,"LeadId: "+str_MangerID,Toast.LENGTH_LONG).show(); + MDId=Integer.parseInt(str_MangerID); + /*str_LeadID = shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + Log.e("tag","str_LeadID="+str_LeadID);*/ + + shardpref_S_obj.getString(PrefID_RegID, "").trim(); + str_RegistrationId = shardpref_S_obj.getString(PrefID_RegID, "").trim(); + Log.d("str_RegistrationId:",str_RegistrationId); + + etMobile.setEnabled(false); + etMobile.setClickable(false); + amount_ET.setClickable(false); + amount_ET.setEnabled(false); + + internetDectector = new Class_InternetDectector(getApplicationContext()); + isInternetPresent = internetDectector.isConnectingToInternet(); + if(isInternetPresent){ + getFeesCatglist_AsynTask(); + getPaymentModelist_AsynTask(); + getstatelist_AsynTask(); + + } + if(rdb_newRegister.isChecked()){ + Log.e("tag","rdb_newRegister="+rdb_newRegister.isChecked()); + leadId_rl.setVisibility(View.GONE); + etMobile.setEnabled(true); + etMobile.setClickable(true); + }else{ + Log.e("tag","rdb_newRegister="+rdb_newRegister.isChecked()); + leadId_rl.setVisibility(View.VISIBLE); + etMobile.setEnabled(false); + etMobile.setClickable(false); + } + setPaymentDate(); + spin_state.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected (AdapterView < ? > parent, View view, + int position, long id){ + // TODO Auto-generated method stub + + obj_Class_States = (Class_States) spin_state.getSelectedItem(); + str_Sids = obj_Class_States.getstate_id().toString(); + spin_city.setAdapter(null); + spin_program.setAdapter(null); + spin_institution.setAdapter(null); + // spin_course.setAdapter(null); + //spin_semester.setAdapter(null); + + str_Cityids=str_ColID=str_Dids=str_courseid=str_programid="x"; + //Toast.makeText(getApplicationContext(),"State"+spin_state.getSelectedItem().toString()+"ID:"+str_Sids,Toast.LENGTH_SHORT).show(); + + // Toast.makeText(getApplicationContext(),"State:"+spin_state.getSelectedItem().toString(),Toast.LENGTH_SHORT).show(); + if(!( (str_Sids.equals("x"))|| (str_Sids.equals("0")) )) + { stateerror_tv.setText(""); + stateerror_tv.setVisibility(View.GONE); + getdistrictlist_AsynTask(); + } + + } + + @Override + public void onNothingSelected (AdapterView < ? > parent){ + // TODO Auto-generated method stub + } + }); + + spin_district.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected (AdapterView < ? > parent, View view, + int position, long id){ + // TODO Auto-generated method stub + obj_Class_District = (Class_District) spin_district.getSelectedItem(); + str_Dids = obj_Class_District.getdistrict_id().toString(); + // Toast.makeText(getApplicationContext(),"District ID"+str_Dids+"State:"+spin_district.getSelectedItem().toString(),Toast.LENGTH_LONG).show(); + + //Toast.makeText(getApplicationContext(),"District ID:"+spin_district.getSelectedItem().toString(),Toast.LENGTH_LONG).show(); + + spin_city.setAdapter(null); + spin_program.setAdapter(null); + spin_institution.setAdapter(null); + // spin_course.setAdapter(null); + // spin_semester.setAdapter(null); + + // str_Cityids="x"; + if(!(str_Dids.equals("x"))) + { districterror_tv.setVisibility(View.GONE); + getTaluklist_AsynTask(); + } + } + + @Override + public void onNothingSelected (AdapterView < ? > parent){ + // TODO Auto-generated method stub + + } + }); + + spin_city.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected (AdapterView < ? > parent, View view, + int position, long id){ + // TODO Auto-generated method stub + obj_Class_Taluk = (Class_Taluk) spin_city.getSelectedItem(); + str_Cityids = obj_Class_Taluk.gettaluk_id().toString(); + // Toast.makeText(getApplicationContext(),"City ID"+str_Cityids+"City:"+spin_city.getSelectedItem().toString(),Toast.LENGTH_LONG).show(); + + if(!(str_Cityids.equals("x"))|| !(spin_district.getSelectedItem().toString().equals("Select City"))) + { cityerror_tv.setVisibility(View.GONE); } + getProgramlist_AsynTask(); + } + + @Override + public void onNothingSelected (AdapterView < ? > parent){ + // TODO Auto-generated method stub + + } + }); + + //Course + spin_program.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected (AdapterView < ? > parent, View view, + int position, long id){ + // TODO Auto-generated method stub + obj_Class_Program = (Class_Program) spin_program.getSelectedItem(); + + str_programid = obj_Class_Program.getprogram_id().toString(); + str_programname = obj_Class_Program.getprog_name().toString(); + + if(!(str_programname.equals("x"))) + { + if(!(spin_program.getSelectedItem().toString().equals("Select Course"))) { + getCollegelist_AsynTask(); + } + } + // Toast.makeText(getApplicationContext(),"str_Programsid: "+str_programid,Toast.LENGTH_SHORT).show(); + } + + @Override + public void onNothingSelected (AdapterView < ? > parent){ + // TODO Auto-generated method stub + } + }); + + spin_institution.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected (AdapterView < ? > parent, View view, + int position, long id){ + // TODO Auto-generated method stub + + if(str_CollegesStatus.equals("Fail")||str_CollegesStatus.equals("There are no colleges")||str_ColID.equals("x")) + { + Log.e("In strCollegesStatus","In str_CollegesStatus"); + amount_ET.setText("0"); + } + else { + obj_Class_Colleges = (Class_Colleges) spin_institution.getSelectedItem(); + str_ColID = obj_Class_Colleges.getcollege_id().toString(); + amount_ET.setText(obj_Class_Colleges.getFees().toString()); + str_feesId = obj_Class_Colleges.getFees_Id().toString(); + str_feesAmount = obj_Class_Colleges.getFees().toString(); + } + + + if(!(str_ColID.equals("x")) || !(spin_institution.getSelectedItem().toString().equals("Select Institution"))||!(spin_institution.getSelectedItem().toString().equals("There are no colleges"))) + { + Log.e("str_ColID",str_ColID.toString()); + Log.e("Institution",spin_institution.getSelectedItem().toString()); + collegeerror_tv.setVisibility(View.GONE); + // getCourselist_AsynTask(); + } + } + + @Override + public void onNothingSelected (AdapterView < ? > parent){ + // TODO Auto-generated method stub + + } + }); + + spin_feesCategory.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected (AdapterView < ? > parent, View view, + int position, long id){ + // TODO Auto-generated method stub + obj_Class_FeesCatg = (Class_FeesCatg) spin_feesCategory.getSelectedItem(); + + str_feesCatSlno = obj_Class_FeesCatg.getFees_Category_Slno().toString(); + str_feesCatName = obj_Class_FeesCatg.getFees_category_description().toString(); + + + + Log.e("tag","str_feesCatName="+str_feesCatName); + if(str_feesCatName.equalsIgnoreCase("Registration")){ + registration_radiogroup.setVisibility(View.VISIBLE); + }else{ + registration_radiogroup.setVisibility(View.GONE); + } + // Toast.makeText(getApplicationContext(),"str_Programsid: "+str_programid,Toast.LENGTH_SHORT).show(); + } + + @Override + public void onNothingSelected (AdapterView < ? > parent){ + // TODO Auto-generated method stub + } + }); + /*if(rdb_newRegister.isChecked()){ + Log.e("tag","rdb_newRegister="+rdb_newRegister.isChecked()); + leadId_rl.setVisibility(View.GONE); + }else{ + Log.e("tag","rdb_newRegister="+rdb_newRegister.isChecked()); + leadId_rl.setVisibility(View.VISIBLE); + }*/ + + + spin_paymentmode.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected (AdapterView < ? > parent, View view, + int position, long id){ + // TODO Auto-generated method stub + obj_Class_PaymentMode = (Class_PaymentMode) spin_paymentmode.getSelectedItem(); + + str_PaymentModeID = obj_Class_PaymentMode.getPayment_mode_slno().toString(); + str_PaymentModeName = obj_Class_PaymentMode.getDescription().toString(); + + Log.e("tag","str_PaymentModeName="+str_PaymentModeName); + // Toast.makeText(getApplicationContext(),"str_Programsid: "+str_programid,Toast.LENGTH_SHORT).show(); + } + + @Override + public void onNothingSelected (AdapterView < ? > parent){ + // TODO Auto-generated method stub + } + }); + + + search_bt.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + str_LeadID=etLeadId.getText().toString(); + Log.e("tag","str_LeadID="+str_LeadID); + if(etLeadId.getText().length()==0||str_LeadID==null){ + etLeadId.setError("Enter Lead ID"); + etLeadId.requestFocus(); + // Toast.makeText(getApplicationContext(),"Enter Lead ID",Toast.LENGTH_LONG).show(); + }else { + getStudentDetails(); + } + } + }); + + btn_submit.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if(validation()) + { + internetDectector2 = new Class_InternetDectector(getApplicationContext()); + isInternetPresent2 = internetDectector2.isConnectingToInternet(); + + if (isInternetPresent2) + { + SubmitAcknowledgements submitAcknowledgements=new SubmitAcknowledgements(ManagerFeesCollectionActivity.this); + submitAcknowledgements.execute(); + + } + else + { + Toast.makeText(getApplicationContext(),"No Internet",Toast.LENGTH_LONG).show(); + } + } + + } + }); + } // End onCreate + + public void onRadioButtonNewRegClicked(View view) { + boolean checked = ((RadioButton) view).isChecked(); + + switch(view.getId()) { + case R.id.rdb_register: if(checked){ + leadId_rl.setVisibility(View.VISIBLE); + etMobile.setEnabled(false); + etMobile.setClickable(false); + } break; + case R.id.rdb_newRegister: if (checked){ + leadId_rl.setVisibility(View.GONE); + etMobile.setEnabled(true); + etMobile.setClickable(true); + + } break; + } + } + + public boolean validation() + { + boolean validationresult = true; + + boolean b_studenname,b_alernativecell,b_emailid,b_dob,b_aadhara1,b_aadhara2,b_account1,b_account2,b_iifscode1,b_iifscode2; + boolean b_state,b_district,b_city,b_college,b_course,b_sem,b_programid,b_mytalent; + + b_studenname=b_alernativecell=b_emailid=b_dob=b_aadhara1=b_aadhara2=b_account1=b_account2=b_iifscode1=b_iifscode2=true; + b_state=b_district=b_city=b_college=b_course=b_sem=b_programid=b_mytalent=true; + + if (etName.getText().toString().length() == 0 || etName.getText().toString().length() <= 2 || etName.getText().toString().trim().length() == 0) { + etName.setError("InValid Student name"); + etName.requestFocus(); + b_studenname=false; + validationresult = false; + } + + if (etMobile.getText().toString().length() == 0 || etMobile.getText().toString().length() <= 9) { + etMobile.setError("InValid Mobile number"); + //alernativecell_et.requestFocus(); + b_alernativecell=false; + validationresult = false; + } + + if (emailid_ET.getText().toString().length() == 0 ||emailid_ET.getText().toString().length()<=5) { + emailid_ET.setError("Enter Valid EmailID!"); + //emailid_et.requestFocus(); + b_emailid=false; + validationresult = false; + } + +/* + + if (edt_paymentDate.getText().toString().length() == 0 ||edt_paymentDate.getText().toString().length()<=5) + { + dobseterror_TV.setVisibility(View.VISIBLE); + dobseterror_TV.setError("Enter the Payment Date!"); + b_dob=false; + validationresult = false; + } +*/ + + + + + if(str_Sids.equals("x")||spin_state.getSelectedItem().toString().equals("Select State")) + { //Toast.makeText(getApplicationContext(),"select the state",Toast.LENGTH_SHORT).show(); + // ((TextView)spin_state.getSelectedView()).setError("Error message"); + stateerror_tv.setVisibility(View.VISIBLE); + stateerror_tv.setError("Select State"); + b_state=false; + validationresult = false; + } + if(str_Dids.equals("x")||spin_district.getSelectedItem().toString().equals("Select District")) + { districterror_tv.setVisibility(View.VISIBLE); + districterror_tv.setError("Select District"); + //Toast.makeText(getApplicationContext(),"select the District",Toast.LENGTH_SHORT).show(); + b_district=false; + validationresult = false;} + + if(str_Cityids.equals("x")||spin_city.getSelectedItem().toString().equals("Select City")) + { cityerror_tv.setVisibility(View.VISIBLE); + cityerror_tv.setError("Select City"); + // Toast.makeText(getApplicationContext(),"select the City",Toast.LENGTH_SHORT).show(); + b_city=false; + validationresult = false; + } + if(str_programid.equals("x")) + { b_programid=false; + //Toast.makeText(getApplicationContext(),"select the Program",Toast.LENGTH_SHORT).show(); + validationresult = false;} + + if(str_ColID.equals("x")||spin_institution.getSelectedItem().toString().equals("Select Institution")||spin_institution.getSelectedItem().toString().equals("There are no colleges")||spin_institution.getSelectedItem().toString().equals("WS Exception")) + // if(spin_institution.getSelectedItem().toString().equals("Select Institution")||spin_institution.getSelectedItem().toString().equals("There are no colleges")||spin_institution.getSelectedItem().toString().equals("WS Exception")) + { b_college=false; + collegeerror_tv.setVisibility(View.VISIBLE); + collegeerror_tv.setError("Select Institution"); + //Toast.makeText(getApplicationContext(),"select the College",Toast.LENGTH_SHORT).show(); + validationresult = false; + } + + if(str_programid.equals("x")||spin_program.getSelectedItem().toString().equals("Select Course")) + { courseerror_tv.setVisibility(View.VISIBLE); + courseerror_tv.setError("Select Course"); + //Toast.makeText(getApplicationContext(),"select the Course",Toast.LENGTH_SHORT).show(); + b_college=false; + validationresult = false;} + + if(str_PaymentModeID.equals("x")||spin_paymentmode.getSelectedItem().toString().equalsIgnoreCase("[SELECT]")) + { paymentmodeerror_TV.setVisibility(View.VISIBLE); + paymentmodeerror_TV.setError("Select Payment Mode"); + //Toast.makeText(getApplicationContext(),"select the Course",Toast.LENGTH_SHORT).show(); + b_college=false; + validationresult = false;} + + if(spin_paymentmode.getSelectedItem().toString().equalsIgnoreCase("Online")){ + if(remark_ET.getText().length()==0) { + remark_ET.setVisibility(View.VISIBLE); + remark_ET.setError("Empty not allowed"); + b_college=false; + validationresult = false; + } + //Toast.makeText(getApplicationContext(),"select the Course",Toast.LENGTH_SHORT).show(); + + } + //return validationresult; + return (b_studenname&&b_alernativecell&&b_emailid&&b_dob&&b_aadhara1&&b_aadhara2&&b_account1&&b_account2&&b_iifscode1 + &&b_iifscode2&&b_state&&b_district&&b_city&&b_college&&b_course&&b_sem&&b_programid&&b_mytalent); + } + private boolean isValidEmail(String email) { + String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{3,})$"; + + Pattern pattern = Pattern.compile(EMAIL_PATTERN); + Matcher matcher = pattern.matcher(email); + return matcher.matches(); + } + + public void onRadioButtonGenderClicked(View view) { + boolean checked = ((RadioButton) view).isChecked(); + + switch (view.getId()) { + case R.id.rdb_male: + if (checked) { + str_Reg="M"; + } + break; + case R.id.rdb_female: + if (checked) { + str_newReg="F"; + } + break; + } + } + + private void setPaymentDate() { + + final Calendar c = Calendar.getInstance(); + + edt_paymentDate.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + mYear = c.get(Calendar.YEAR); + mMonth = c.get(Calendar.MONTH); + mDay = c.get(Calendar.DAY_OF_MONTH); + + DatePickerDialog datePickerDialog = new DatePickerDialog(context, R.style.DatePickerTheme, + new DatePickerDialog.OnDateSetListener() { + + @Override + public void onDateSet(DatePicker view, int year, + int monthOfYear, int dayOfMonth) { + + cDay = dayOfMonth; + cMonth = monthOfYear; + cYear = year; + + // String date =dayOfMonth + "/" + (monthOfYear + 1) + "/" + year; + String date =year + "-" + (monthOfYear + 1) + "-" + dayOfMonth; + + + // SimpleDateFormat dateFormat= new SimpleDateFormat("dd/MM/yyyy"); + SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd"); + + try { + Date d=dateFormat.parse(date); + System.out.println("Formated"+dateFormat.format(d)); + dobseterror_TV.setVisibility(View.GONE); + edt_paymentDate.setText(dateFormat.format(d).toString()); + + } + catch(Exception e) { + //java.text.ParseException: Unparseable date: Geting error + System.out.println("Excep"+e); + } + //TextView txtExactDate = (TextView) findViewById(R.id.txt_exactDate); + + + //txtDate.edita + } + }, mYear, mMonth, mDay); + + datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()); + //datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()-(1000 * 60 * 60 * 24 * 365 * 14)); + // - (1000 * 60 * 60 * 24 * 365.25 * 14) +//------ + + datePickerDialog.show(); + } + }); + + + } + + // ============================All AsynTask Call + + public void getFeesCatglist_AsynTask() + { + FeesCatglistAsyncCallWS task = new FeesCatglistAsyncCallWS(ManagerFeesCollectionActivity.this); + task.execute(); + } + + private class FeesCatglistAsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + /* dialog.setMessage("Please wait,District Loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show();*/ + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetFeesCatglist(); // get the District list + return null; + } + + public FeesCatglistAsyncCallWS(ManagerFeesCollectionActivity activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + + //dialog.dismiss(); + + /*uploadfromDB_Statelist(); + uploadfromDB_Districtlist(); + setSpinner();*/ + // uploadfromDB_Districtlist(); + + + if(str_FeesCatgStatus.equals("Success")) + { + +// if(str_isProfileEdited.equals("1")) +// { +// dataAdapter_feesCatg = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_FeesCatg); +// dataAdapter_feesCatg.setDropDownViewResource(R.layout.spinnercustomstyle); +// spin_district.setAdapter(dataAdapter_feesCatg); +// spin_district.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); +// +// // if(O_districtname!="" || O_districtname!=null) { +// for (int i = 0; i < spin_feesCategory.getCount(); i++) { +// Log.e("spin District",spin_feesCategory.getItemAtPosition(i).toString()); +// // if (spin_feesCategory.getItemAtPosition(i).toString().equals(O_districtname)) +// // { +// spin_feesCategory.setSelection(i); +// // break; +// //} +// // } +// } +// +// +// } +// else +// { + dataAdapter_feesCatg = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_FeesCatg); + //dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_feesCatg.setDropDownViewResource(R.layout.spinnercustomstyle); + // districtsearch_ATV.setAdapter(dataAdapter_district); + spin_feesCategory.setAdapter(dataAdapter_feesCatg); + spin_feesCategory.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + // } + } + + + }//end of onPostExecute + }// end Async task + + public void GetFeesCatglist() + { + + String URL = Class_URL.URL_Manager.toString().trim(); + String METHOD_NAME = "Get_Fees_Category_Master"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/Get_Fees_Category_Master"; + + + + //for final + + + try { +//vijay district + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + + // request.addProperty("distid", Long.parseLong(str_Sids));//Long + + // request.addProperty("distid", 17);//Long + + request.addProperty("Academic_Id", str_academicId);//Long + request.addProperty("Registration_Id", 0);//Long + request.addProperty("College_ID", 0);//Long + + //request.addProperty("stateId", 17);//Long + // long + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + // Log.i(TAG, "GetAllLoginDetails is running"); + // result1 = (Vector) envelope.getResponse(); + + // response = (SoapPrimitive) envelope.getResponse(); + + // SoapPrimitive res =(SoapPrimitive)envelope.getResponse(); + + SoapObject response = (SoapObject ) envelope.getResponse(); + Log.e("response feesCatglist",response.toString()); + feesCatglistcount = response.getPropertyCount(); + SoapObject districtresponse=(SoapObject)response.getProperty(0); + str_FeesCatgStatus=districtresponse.getProperty("Status").toString(); + Log.d("feesCatgcount", String.valueOf(response.getPropertyCount())); + + + if(str_FeesCatgStatus.equals("Success")) { + if (feesCatglistcount > 0) { + arrayObj_Class_FeesCatg = new Class_FeesCatg[feesCatglistcount]; + for (int i = 0; i < feesCatglistcount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + + Class_FeesCatg innerObj_Class_FeesCatg = new Class_FeesCatg(); + innerObj_Class_FeesCatg.setFees_category_code(response_soapobj.getProperty("fees_category_code").toString()); //1 + innerObj_Class_FeesCatg.setFees_category_description(response_soapobj.getProperty("Fees_category_description").toString()); //Hubballi + innerObj_Class_FeesCatg.setFees_Category_Slno(response_soapobj.getProperty("Fees_Category_Slno").toString());// HB + innerObj_Class_FeesCatg.setAcademic_year(response_soapobj.getProperty("academic_year").toString());// <1 + innerObj_Class_FeesCatg.setStatus(response_soapobj.getProperty("Status").toString());// <1 + innerObj_Class_FeesCatg.setFees(response_soapobj.getProperty("Fees").toString());// <1 + innerObj_Class_FeesCatg.setFees_ID(response_soapobj.getProperty("Fees_ID").toString());// <1 + + str_FeesCatgStatus = response_soapobj.getProperty("Status").toString(); + + arrayObj_Class_FeesCatg[i] = innerObj_Class_FeesCatg; + + }//end for loop + + }//end of if + + } + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + }//End of uploaddetails + + public void getstatelist_AsynTask() + { + StatelistAsyncCallWS task = new StatelistAsyncCallWS(ManagerFeesCollectionActivity.this); + task.execute(); + } + + private class StatelistAsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + /*dialog.setMessage("Please wait,State Loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); +*/ + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetStatelist(); // get the state list + return null; + } + + public StatelistAsyncCallWS(ManagerFeesCollectionActivity activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + //dialog.dismiss(); + + //uploadfromDB_Statelist(); + + + if(str_StateStatus.equals("Success")) + { + + // if(str_isProfileEdited.equals("1")) + Log.e("tag","str_LeadID=="+str_LeadID); + if(!str_LeadID.equals("0")) + { + Log.e("tag","1O_statecode="+O_statecode); + + dataAdapter = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_States); + dataAdapter.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_state.setAdapter(dataAdapter); + spin_state.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + int spinnerposition =1; + //spinnerposition = dataAdapter.getPosition(O_statecode); + // spinnerposition= Integer.parseInt(O_statecode); + // spin_state.setSelection(spinnerposition); + if(!O_statename.equals("")||!O_statename.equalsIgnoreCase(null)) { + spin_state.setSelection(getIndex(spin_state, O_statename)); + /*for (int i = 0; i < spin_state.getCount(); i++) { + Log.e(" spin_state=", spin_state.getItemAtPosition(i).toString()); + if (spin_state.getItemAtPosition(i).toString().equals(O_statecode)) { + spin_state.setSelection(i); + break; + } + }*/ + } + // spin_state.setSelection(getIndex(spin_state, O_statecode)); + + Log.e("tag","O_statecode="+O_statecode); + // spin_state.setSelection(spinnerposition-1); + } + else + { + dataAdapter = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_States); + dataAdapter.setDropDownViewResource(R.layout.spinnercustomstyle); + /*class_hintspinneradapter_obj = new Class_HintSpinnerAdapter(getApplicationContext(), R.layout.spinnercustomstyle); + class_hintspinneradapter_obj.addAll(state_stringArray); + */ + //class_hintspinneradapter_obj + //dataAdapter.add("Select State"); + //spin_state.setPrompt("Select State"); + + spin_state.setAdapter(dataAdapter); //working + + /*class_hintspinneradapter_obj.add("Select State"); + spin_state.setAdapter(class_hintspinneradapter_obj); + spin_state.setSelection(class_hintspinneradapter_obj.getCount());*/ + + spin_state.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + } + + } + + }//end of onPostExecute + }// end Async task + + public void GetStatelist() + { + String URL =Class_URL.URL_Login.toString().trim(); + String METHOD_NAME = "GetstateList"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/GetstateList"; + + try { + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + request.addProperty("stateid", "0");//long + request.addProperty("Manager_Id",MDId); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + // Log.i(TAG, "GetAllLoginDetails is running"); + // result1 = (Vector) envelope.getResponse(); + + // response = (SoapPrimitive) envelope.getResponse(); + + // SoapPrimitive res =(SoapPrimitive)envelope.getResponse(); + + SoapObject response = (SoapObject ) envelope.getResponse(); + SoapObject o_stateresponse =(SoapObject)response.getProperty(0); + str_StateStatus = o_stateresponse.getProperty("Status").toString(); + + Log.e("response state list",response.toString()); + statelistcount = response.getPropertyCount(); + + Log.d("statecount", String.valueOf(response.getPropertyCount())); + + + /*1 + Andaman and Nicobar Islands + Success + + */ + if(str_StateStatus.equals("Success")) { + if (statelistcount > 0) { + // arrayObj_Class_States = new Class_States[statelistcount]; + + + arrayObj_Class_States = new Class_States[statelistcount]; + state_stringArray = new String[statelistcount]; + + /*Class_States innerObj_Class_states1 = new Class_States(); + innerObj_Class_states1.setstate_id("0"); //long + innerObj_Class_states1.setstate_name("Select State Name"); //Andaman and Nicobar Islands + innerObj_Class_states1.setstate_status("Success Status");// Success + arrayObj_Class_States[0]=innerObj_Class_states1;*/ + + for (int i = 0; i < statelistcount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + + Class_States innerObj_Class_states = new Class_States(); + innerObj_Class_states.setstate_id(response_soapobj.getProperty("code").toString()); //long + innerObj_Class_states.setstate_name(response_soapobj.getProperty("StateName").toString()); //Andaman and Nicobar Islands + innerObj_Class_states.setstate_status(response_soapobj.getProperty("Status").toString());// Success + + arrayObj_Class_States[i] = innerObj_Class_states; + + + String str_stateID = response_soapobj.getProperty("code").toString(); + String str_statename = response_soapobj.getProperty("StateName").toString(); + //String str_Status=response_soapobj.getProperty("Status").toString(); + + // DBCreate_Statedetails_insert_2SQLiteDB(str_stateID,str_statename); + + state_stringArray[i]=response_soapobj.getProperty("StateName").toString(); + + }//end for loop + + }//end of if + } + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + }//End of uploaddetails + + public void getPaymentModelist_AsynTask() + { + PaymentModelistAsyncCallWS task = new PaymentModelistAsyncCallWS(ManagerFeesCollectionActivity.this); + task.execute(); + } + + private class PaymentModelistAsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + /*dialog.setMessage("Please wait,State Loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); +*/ + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetPaymentModelist(); // get the state list + return null; + } + + public PaymentModelistAsyncCallWS(ManagerFeesCollectionActivity activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) { + + + if(str_PaymentModeStatus.equals("Success")) + { + + + dataAdapter = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_PaymentMode); + dataAdapter.setDropDownViewResource(R.layout.spinnercustomstyle); + + spin_paymentmode.setAdapter(dataAdapter); //working + spin_paymentmode.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + + } + + }//end of onPostExecute + }// end Async task + + public void GetPaymentModelist() + { + String URL =Class_URL.URL_Manager.toString().trim(); + String METHOD_NAME = "Get_Payment_Mode"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/Get_Payment_Mode"; + + try { + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + // Log.i(TAG, "GetAllLoginDetails is running"); + // result1 = (Vector) envelope.getResponse(); + + // response = (SoapPrimitive) envelope.getResponse(); + + // SoapPrimitive res =(SoapPrimitive)envelope.getResponse(); + + SoapObject response = (SoapObject ) envelope.getResponse(); + SoapObject o_PaymentModeresponse =(SoapObject)response.getProperty(0); + str_PaymentModeStatus = o_PaymentModeresponse.getProperty("Status").toString(); + + Log.e("tag","response payment mode list"+response.toString()); + PaymentModelistcount = response.getPropertyCount(); + + Log.d("paymentmode count", String.valueOf(response.getPropertyCount())); + + + /*1 + Andaman and Nicobar Islands + Success + + */ + if(str_PaymentModeStatus.equals("Success")) { + if (PaymentModelistcount > 0) { + // arrayObj_Class_States = new Class_States[statelistcount]; + + + arrayObj_Class_PaymentMode = new Class_PaymentMode[PaymentModelistcount]; + // state_stringArray = new String[statelistcount]; + + /*Class_States innerObj_Class_states1 = new Class_States(); + innerObj_Class_states1.setstate_id("0"); //long + innerObj_Class_states1.setstate_name("Select State Name"); //Andaman and Nicobar Islands + innerObj_Class_states1.setstate_status("Success Status");// Success + arrayObj_Class_States[0]=innerObj_Class_states1;*/ + + for (int i = 0; i < PaymentModelistcount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + + Class_PaymentMode innerObj_Class_paymentmode = new Class_PaymentMode(); + innerObj_Class_paymentmode.setDescription(response_soapobj.getProperty("description").toString()); //long + innerObj_Class_paymentmode.setPayment_mode_slno(response_soapobj.getProperty("payment_mode_slno").toString()); //Andaman and Nicobar Islands + innerObj_Class_paymentmode.setShort_code(response_soapobj.getProperty("short_code").toString());// Success + innerObj_Class_paymentmode.setStatus(response_soapobj.getProperty("Status").toString()); //Andaman and Nicobar Islands + + arrayObj_Class_PaymentMode[i] = innerObj_Class_paymentmode; + + + /* String str_stateID = response_soapobj.getProperty("code").toString(); + String str_statename = response_soapobj.getProperty("StateName").toString();*/ + //String str_Status=response_soapobj.getProperty("Status").toString(); + + // DBCreate_Statedetails_insert_2SQLiteDB(str_stateID,str_statename); + + // state_stringArray[i]=response_soapobj.getProperty("StateName").toString(); + + }//end for loop + + }//end of if + } + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + }//End of uploaddetails + + public void getdistrictlist_AsynTask() + { + DistrictlistAsyncCallWS task = new DistrictlistAsyncCallWS(ManagerFeesCollectionActivity.this); + task.execute(); + } + + private class DistrictlistAsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + /* dialog.setMessage("Please wait,District Loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show();*/ + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetDistrictlist(); // get the District list + return null; + } + + public DistrictlistAsyncCallWS(ManagerFeesCollectionActivity activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + + //dialog.dismiss(); + + /*uploadfromDB_Statelist(); + uploadfromDB_Districtlist(); + setSpinner();*/ + // uploadfromDB_Districtlist(); + + + if(str_DistrictStatus.equals("Success")) + { + + // if(str_isProfileEdited.equals("1")) + if(!str_LeadID.equals("0")) + { + dataAdapter_district = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_District); + dataAdapter_district.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_district.setAdapter(dataAdapter_district); + spin_district.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + + if(O_districtname!="" || O_districtname!=null) { + for (int i = 0; i < spin_district.getCount(); i++) { + Log.e("spin District",spin_district.getItemAtPosition(i).toString()); + if (spin_district.getItemAtPosition(i).toString().equals(O_districtname)) + { + spin_district.setSelection(i); + break; + } + } + } + + + } + else + { + dataAdapter_district = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_District); + //dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_district.setDropDownViewResource(R.layout.spinnercustomstyle); + // districtsearch_ATV.setAdapter(dataAdapter_district); + spin_district.setAdapter(dataAdapter_district); + spin_district.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + } + } + + + }//end of onPostExecute + }// end Async task + + public void GetDistrictlist() + { + + String URL = Class_URL.URL_Login.toString().trim(); + String METHOD_NAME = "GetDistricts"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/GetDistricts"; + + + + //for final + + + try { +//vijay district + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + + // request.addProperty("distid", Long.parseLong(str_Sids));//Long + + // request.addProperty("distid", 17);//Long + + request.addProperty("stateId", Long.parseLong(str_Sids));//Long + request.addProperty("Manager_Id",MDId); + //request.addProperty("stateId", 17);//Long + // long + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + // Log.i(TAG, "GetAllLoginDetails is running"); + // result1 = (Vector) envelope.getResponse(); + + // response = (SoapPrimitive) envelope.getResponse(); + + // SoapPrimitive res =(SoapPrimitive)envelope.getResponse(); + + SoapObject response = (SoapObject ) envelope.getResponse(); + Log.e("response districtlist",response.toString()); + districtlistcount = response.getPropertyCount(); + SoapObject districtresponse=(SoapObject)response.getProperty(0); + str_DistrictStatus=districtresponse.getProperty("status").toString(); + Log.d("districtcount", String.valueOf(response.getPropertyCount())); + + + + //anyType{vmdist=anyType{DistrictId=1; DistrictName=Nicobar; Stateid=1; status=Success; + + /* + 1 + Nicobar + Success + 1*/ + if(str_DistrictStatus.equals("Success")) { + if (districtlistcount > 0) { + arrayObj_Class_District = new Class_District[districtlistcount]; + for (int i = 0; i < districtlistcount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + + Class_District innerObj_Class_district = new Class_District(); + innerObj_Class_district.setdistrict_id(response_soapobj.getProperty("DistrictId").toString()); //1 + innerObj_Class_district.setdistrict_name(response_soapobj.getProperty("DistrictName").toString()); //Hubballi + innerObj_Class_district.setdistrict_status(response_soapobj.getProperty("status").toString());// HB + innerObj_Class_district.setdstateid_id(response_soapobj.getProperty("Stateid").toString());// <1 + + str_DistrictStatus = response_soapobj.getProperty("status").toString(); + + arrayObj_Class_District[i] = innerObj_Class_district; + + + String str_districtID = response_soapobj.getProperty("DistrictId").toString(); + String str_districtname = response_soapobj.getProperty("DistrictName").toString(); + String str_districtstateid = response_soapobj.getProperty("Stateid").toString(); + + //DBCreate_Districtdetails_insert_2SQLiteDB(str_districtID,str_districtname,str_districtstateid); + + + }//end for loop + + }//end of if + + } + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + }//End of uploaddetails + + public void getTaluklist_AsynTask() + { + TaluklistAsyncCallWS task = new TaluklistAsyncCallWS(ManagerFeesCollectionActivity.this); + task.execute(); + } + + private class TaluklistAsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + /*dialog.setMessage("Please wait,Taluk loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show();*/ + + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetTaluklist(); // get the District list + return null; + } + + public TaluklistAsyncCallWS(ManagerFeesCollectionActivity activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + + // dialog.dismiss(); + + /*uploadfromDB_Statelist(); + uploadfromDB_Districtlist();*/ + + // setSpinner(); + + + // uploadfromDB_Districtlist(); + + + //arrayObj_Class_Taluk + + + if(str_TalukStatus.equals("Success")) //status=Success; + { + //if (str_isProfileEdited.equals("1")) + if(!str_LeadID.equals("0")) + { + dataAdapter_city = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_Taluk); + dataAdapter_city.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_city.setAdapter(dataAdapter_city); + spin_city.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + + if(O_talukname!="" || O_talukname!=null) { + for (int i = 0; i < spin_city.getCount(); i++) { + if (spin_city.getItemAtPosition(i).toString().equals(O_talukname)) + { + spin_city.setSelection(i); + break; + } + } + } + } + else { + + + dataAdapter_city = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_Taluk); + // dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_city.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_city.setAdapter(dataAdapter_city); + spin_city.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + } + } + + }//end of onPostExecute + }// end Async task + + public void GetTaluklist() + { + + + + String URL = Class_URL.URL_Login.toString().trim(); + String METHOD_NAME = "GetCities"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/GetCities"; + + + + //for final + + + try { + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + //request.addProperty("cityid", "0");//short + + request.addProperty("district", Long.parseLong(str_Dids));//long + request.addProperty("Manager_Id",MDId); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + // Log.i(TAG, "GetAllLoginDetails is running"); + // result1 = (Vector) envelope.getResponse(); + + // response = (SoapPrimitive) envelope.getResponse(); + + // SoapPrimitive res =(SoapPrimitive)envelope.getResponse(); + + SoapObject response = (SoapObject ) envelope.getResponse(); + Log.e("response taluklist",response.toString()); + taluklistcount = response.getPropertyCount(); + // str_TalukStatus =(String)response.getProperty(0).toString(); + SoapObject TalukSoapresponse = (SoapObject)response.getProperty(0); + str_TalukStatus=TalukSoapresponse.getProperty("status").toString(); + Log.d("talukcount", String.valueOf(response.getPropertyCount())); + + /* anyType{vmcity=anyType{Id=0; District_Id=0; status=There are no cities; };*/ + /* + 70 + 266 + Hubli + Success + + */ + //status=Success; + if(str_TalukStatus.equals("Success")) { + + if (taluklistcount > 0) { + arrayObj_Class_Taluk = new Class_Taluk[taluklistcount]; + + + for (int i = 0; i < taluklistcount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + + Class_Taluk innerObj_Class_taluk = new Class_Taluk(); + innerObj_Class_taluk.settaluk_id(response_soapobj.getProperty("Id").toString()); //1 + innerObj_Class_taluk.settaluk_did(response_soapobj.getProperty("District_Id").toString()); //266 + innerObj_Class_taluk.settalukname(response_soapobj.getProperty("Taluk_Name").toString());// Hubli + innerObj_Class_taluk.settalukstatus(response_soapobj.getProperty("status").toString());// Success + + str_TalukStatus = response_soapobj.getProperty("status").toString(); + + arrayObj_Class_Taluk[i] = innerObj_Class_taluk; + + + String str_talukID = response_soapobj.getProperty("Id").toString(); + String str_taluk_did = response_soapobj.getProperty("District_Id").toString(); + String str_talukname = response_soapobj.getProperty("Taluk_Name").toString(); + + + // DBCreate_Talukdetails_insert_2SQLiteDB(str_talukID,str_taluk_did,str_talukname); + + + }//end for loop + + }//end of if + + } + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + }//End of uploaddetails + + public void getCollegelist_AsynTask() + { + CollegelistAsyncCallWS task = new CollegelistAsyncCallWS(ManagerFeesCollectionActivity.this); + task.execute(); + } + private class CollegelistAsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + dialog.setMessage("Please wait,College loading..."); + + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetCollegelist(); // get the College list + return null; + } + + public CollegelistAsyncCallWS(ManagerFeesCollectionActivity activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + + dialog.dismiss(); + + + /* uploadfromDB_Statelist(); + uploadfromDB_Districtlist(); +*/ + /*uploadfromDB_Statelist(); + uploadfromDB_Districtlist(); + + uploadfromDB_collegeTypeSpinner();*/ //vijay + + if(str_CollegesStatus.equals("Success")) + { + // if (str_isProfileEdited.equals("1")) + if(!str_LeadID.equals("0")) + { + dataAdapter_college = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_Colleges); + dataAdapter_college.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_institution.setAdapter(dataAdapter_college); + spin_institution.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + + str_ColID="y"; + if(O_collegename!="" || O_collegename!=null) + { + for (int i = 0; i < spin_institution.getCount(); i++) { + if (spin_institution.getItemAtPosition(i).toString().equals(O_collegename)) + { + spin_institution.setSelection(i); + break; + } + } + } + + } + else { + + str_ColID="y"; + dataAdapter_college = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_Colleges); + // dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_college.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_institution.setAdapter(dataAdapter_college); + spin_institution.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + } + } + else { + //There are no colleges + if (str_CollegesStatus.equals("There are no colleges")) + { + /*List list = new ArrayList(); + list.add("No Colleges");*/ + dataAdapter_college = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_Colleges3); + // dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_college.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_institution.setAdapter(dataAdapter_college); + spin_institution.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + + } + else + { + List list = new ArrayList(); + list.add("WS Exception"); + dataAdapter_college = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, list); + // dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_college.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_institution.setAdapter(dataAdapter_college); + spin_institution.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + + } + + } + + }//end of onPostExecute + }// end Async task + + public void GetCollegelist() + { + + String URL = Class_URL.URL_Login.toString().trim(); + String METHOD_NAME = "GetCollegesOnCity"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/GetCollegesOnCity"; + + + + //for final + + + try { + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + // request.addProperty("clgid", 0);//string shubham.dsep@detedu.org str_loginemailid + + request.addProperty("city", Long.parseLong(str_Cityids));// long + request.addProperty("type", str_programname);// string + request.addProperty("Manager_Id",MDId); + request.addProperty("Fees_Category_Id",Integer.valueOf(str_feesCatSlno)); + request.addProperty("User_Type","Manager"); + + // + Log.e("request collegelist",request.toString()); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + // Log.i(TAG, "GetAllLoginDetails is running"); + // result1 = (Vector) envelope.getResponse(); + + // response = (SoapPrimitive) envelope.getResponse(); + + // SoapPrimitive res =(SoapPrimitive)envelope.getResponse(); + + SoapObject response = (SoapObject ) envelope.getResponse(); + Log.e("resp collegelist",response.toString()); + collegeslistcount = response.getPropertyCount(); + SoapObject response_soapobj1 = (SoapObject) response.getProperty(0); + str_CollegesStatus=response_soapobj1.getProperty("Status").toString();//Status=There are no colleges; //Status=Success; + Log.d("Ccount", String.valueOf(response.getPropertyCount())); + + + if(str_CollegesStatus.equals("Success")) + { + if (collegeslistcount > 0) { + arrayObj_Class_Colleges = new Class_Colleges[collegeslistcount]; + + + for (int i = 0; i < collegeslistcount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + + /*long + long + string + string*/ + + Class_Colleges innerObj_Class_colleges = new Class_Colleges(); + innerObj_Class_colleges.setcollege_id(response_soapobj.getProperty("CollegeId").toString()); //long + innerObj_Class_colleges.setcollege_tid(response_soapobj.getProperty("TalukId").toString()); //long + innerObj_Class_colleges.setcollegename(response_soapobj.getProperty("College_Name").toString());// string + innerObj_Class_colleges.setFees(response_soapobj.getProperty("Fees").toString()); + innerObj_Class_colleges.setFees_Id(response_soapobj.getProperty("Fees_Id").toString()); + + innerObj_Class_colleges.setcollegestatus(response_soapobj.getProperty("Status").toString());// Success + + + str_CollegesStatus = response_soapobj.getProperty("Status").toString(); + + arrayObj_Class_Colleges[i] = innerObj_Class_colleges; + + + String str_collegeID = response_soapobj.getProperty("CollegeId").toString(); + String str_college_tid = response_soapobj.getProperty("TalukId").toString(); + String str_collegename = response_soapobj.getProperty("College_Name").toString(); + + + // DBCreate_Collegedetails_insert_2SQLiteDB(str_collegeID,str_college_tid,str_collegename); + + // DBCreate_Collegedetails_insert_2SQLiteDB(str_collegeID, str_college_tid, str_collegename); + + + }//end for loop + + }//end of if + + + }// end of if + else + { + arrayObj_Class_Colleges3 = new Class_Colleges[1]; + Class_Colleges innerObj_Class_colleges = new Class_Colleges(); + innerObj_Class_colleges.setcollege_id("0"); //long + innerObj_Class_colleges.setcollege_tid("0"); //long + innerObj_Class_colleges.setcollegename("There are no colleges");// string + + str_CollegesStatus ="There are no colleges"; + arrayObj_Class_Colleges3[0] = innerObj_Class_colleges; + + } + + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("getCollege fail", "> " + t.getMessage()); + internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + }//End of uploaddetails + + + + private void getStudentDetails() { + GetStudentDetails getStudentDetails = new GetStudentDetails(ManagerFeesCollectionActivity.this); + getStudentDetails.execute(str_LeadID); + } + + + public class GetStudentDetails extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + // private ProgressBar progressBar; + + ProgressDialog dialog; + + GetStudentDetails(Context ctx) + { + context = ctx; + dialog = new ProgressDialog(ctx); + } + + + @Override + protected SoapObject doInBackground(String... params) { + String leadid = (String) params[0]; + //String versionCode = (String) params[2]; + + + SoapObject response = getStudDtls(leadid); + + //Log.d("Soap response is",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + /*pd_getstudentdetails.setMessage("Please wait,Downloading Details loading..."); + pd_getstudentdetails.setCanceledOnTouchOutside(false); + pd_getstudentdetails.show(); +*/ + + dialog.setMessage("Please wait,Updating Details loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + } + + @Override + protected void onPostExecute(SoapObject result) { + // progressBar.setVisibility(View.GONE); + + dialog.dismiss(); + // pd_getstudentdetails.dismiss(); + + + + // Log.e("tag","result =="+result.getProperty("Status").toString()); + if(searchStatus.equals("Success")) { + if (O_StudentName.equalsIgnoreCase("anyType{}") || O_StudentName.equalsIgnoreCase("") || O_StudentName == null) { + etName.setText(""); + } else { + etName.setText(O_StudentName.toString().trim()); + } + /* if(O_AlternativeMobileNo.toString().length()==0) + {alernativecell_et.setText(" "); } + else { alernativecell_et.setText(O_AlternativeMobileNo.toString().trim()); } +*/ + + if (O_MailId.equalsIgnoreCase("anyType{}") || O_MailId.equalsIgnoreCase("") || O_MailId == null) { + emailid_ET.setText(""); + + } else { + emailid_ET.setText(O_MailId.toString().trim()); + } + etMobile.setText(O_MobileNo.toString().trim()); + + getstatelist_AsynTask(); + }else{ + Toast.makeText(context, result.getProperty("Status").toString(), Toast.LENGTH_LONG).show(); + } + /* if(O_AadharNo.equals("anyType{}")||O_AadharNo.equals("anytype{}")||O_AadharNo.equals("0")) + { aadhara_et.setText(""); } + else + { aadhara_et.setText(O_AadharNo.toString().trim()); } + + if(O_Account_No.equals("anyType{}")||O_Account_No.equals("anytype{}")||O_Account_No.equals("0")) + { account_et.setText(""); } + else + { account_et.setText(O_Account_No.toString().trim()); } +*/ + + + /*if(O_IFSC_code.equals("anyType{}")||O_IFSC_code.equals("anytype{}")||O_IFSC_code.equals("0")) + { iifscode_et.setText("");} + else{ iifscode_et.setText(O_IFSC_code.toString().trim()); } + + + + if(O_mytalent.equalsIgnoreCase("anyType{}")||O_mytalent.isEmpty()) + { mytalent_et.setText(""); } + else{ mytalent_et.setText(O_mytalent.toString().trim()); } +*/ + // edt_dob.setText(O_DOB.toString().trim()); + // leadid_tv.setText(O_leadID.toString().trim()); + // student_tv.setText(O_Student_Type.toString().trim()); + + /*if(O_Gender.equals("M")) + { + gender_radiogroup.check(R.id.rdb_male); } + else + { gender_radiogroup.check(R.id.rdb_female); } + + + if(O_BloodGroup!="" || O_BloodGroup!=null) + { + for (int i = 0; i < spin_bg.getCount(); i++) { + if (spin_bg.getItemAtPosition(i).toString().equals(O_BloodGroup)) + { + spin_bg.setSelection(i); + break; + } + } + }*/ + + // img_profilePick.setImageBitmap(Studentbmp); + + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapObject getStudDtls(String leadid) { + String METHOD_NAME = "GetStudentDetailss"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetStudentDetailss"; + + try { + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + /* Log.d("Mobile Number",mobilenum);*/ + Log.d("Lead Id", leadid); + + /*request.addProperty("Username", mobilenum); + request.addProperty("Password", leadid);*/ + + request.addProperty("leadId", leadid); + /* request.addProperty("Password", mobilenum);*/ + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Login.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapObject response = (SoapObject) envelope.getResponse(); + Log.e("GetStudent","soap response"+ response.toString()); + searchStatus=response.getProperty("Status").toString(); + if(searchStatus.equals("Success")) { + O_RegistrationId = response.getProperty("RegistrationId").toString(); + O_StudentName = response.getProperty("StudentName").toString(); + // O_DOB=response.getProperty("DOB").toString(); + String RegistrationDate = response.getProperty("RegistrationDate").toString(); + String isProfileEdit = response.getProperty("isProfileEdit").toString(); + O_statecode = response.getProperty("StateCode").toString(); + O_districtcode = response.getProperty("DistrictCode").toString(); + O_talukacode = response.getProperty("TalukaCode").toString(); + O_collegenameCode = response.getProperty("CollegeCode").toString(); + O_coursecode = response.getProperty("CourseCode").toString(); + O_StreamprogramCode = response.getProperty("StreamCode").toString(); + String O_semcode = response.getProperty("SemName").toString(); + // O_AadharNo=response.getProperty("AadharNo").toString(); + String O_Address = response.getProperty("Address").toString(); + O_MailId = response.getProperty("MailId").toString(); + /* O_AlternativeMobileNo=response.getProperty("AlternativeMobileNo").toString(); + O_Gender=response.getProperty("Gender").toString(); + O_BloodGroup=response.getProperty("BloodGroup").toString(); + */ + String O_FacebookId = response.getProperty("FacebookId").toString(); + String O_LinkedInId = response.getProperty("LinkedInId").toString(); + String O_AcademicCode = response.getProperty("AcademicCode").toString(); + // O_Student_Type=response.getProperty("Student_Type").toString(); + String O_Bank_Name = response.getProperty("Bank_Name").toString(); + String O_Branch_Name = response.getProperty("Branch_Name").toString(); + // O_Account_No=response.getProperty("Account_No").toString(); + // O_IFSC_code=response.getProperty("IFSC_code").toString(); + String O_Status = response.getProperty("Status").toString(); + // O_Student_Image=response.getProperty("Student_Image").toString(); + String O_ManagerMobileNumber = response.getProperty("ManagerMobileNumber").toString(); + O_MobileNo = response.getProperty("MobileNo").toString(); + // O_mytalent=response.getProperty("MyTalent").toString();// + // Log.e("tag","RegistrationId="+O_RegistrationId+"StudentName="+O_StudentName+"DOB="+O_DOB); + Log.e("tag", "RegistrationDate=" + RegistrationDate + "isProfileEdit=" + isProfileEdit + "StateCode=" + O_statecode); + Log.e("tag", "DistrictCode=" + O_districtcode + "TalukaCode=" + O_talukacode + "CollegeCode=" + O_collegenameCode); + + O_leadID = response.getProperty("Lead_Id").toString(); + // O_altermailid= response .getProperty("AlternateMailId").toString(); + O_collegename = response.getProperty("College_Name").toString(); + O_statename = response.getProperty("StateName").toString(); + O_districtname = response.getProperty("DistrictName").toString(); + O_talukname = response.getProperty("Taluk_Name").toString(); + O_programmename = response.getProperty("programmeName").toString(); + O_coursename = response.getProperty("CourseName").toString(); + O_semname = response.getProperty("SemName").toString(); + + + } + + /* String arr[] = O_Student_Image.split("/", 2); + + String firstWord = arr[0]; //the + String secondWord = arr[1]; + + Str_studentImgUrl = serverPath + secondWord; + Log.i("tag", "firstWord=" + firstWord + " secondWord=" + secondWord); + + Log.e("student URL", ""+Str_studentImgUrl); + + URL url = new URL(Str_studentImgUrl.toString().trim()); + Studentbmp = BitmapFactory.decodeStream(url.openConnection().getInputStream()); +*/ + // img_profilePick.setImageBitmap(Studentbmp); + + + + return response; + + } catch (Exception t) { + + Log.e("request fail", "> " + t.getMessage().toString()); + + + } + } catch (Exception t) { + Log.d("exception outside", t.getMessage().toString()); + } + return null; + } + + public void getProgramlist_AsynTask() + { + getProgramlist_AsynTask task = new getProgramlist_AsynTask(ManagerFeesCollectionActivity.this); + task.execute(); + } + + private class getProgramlist_AsynTask extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + /* dialog.setMessage("Please wait,ProgramList loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show();*/ + + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetProgramlist(); // get the Course list + return null; + } + + public getProgramlist_AsynTask(ManagerFeesCollectionActivity activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + + // dialog.dismiss(); + + //Update_Programlist_spinner(); + + + if(str_ProgramStatus.equals("Success")) + { + // if(str_isProfileEdited.equals("1")) + if(!str_LeadID.equals("0")) + { + + + dataAdapter_program = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_Program); + // dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_program.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_program.setAdapter(dataAdapter_program); + spin_program.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + + if(O_programmename!="" || O_programmename!=null) + { + for (int i = 0; i < spin_program.getCount(); i++) { + if (spin_program.getItemAtPosition(i).toString().equals(O_programmename)) + { + spin_program.setSelection(i); + break; + } + } + } + + } + else + { + dataAdapter_program = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_Program); + // dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + dataAdapter_program.setDropDownViewResource(R.layout.spinnercustomstyle); + spin_program.setAdapter(dataAdapter_program); + spin_program.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + } + + } + + }//end of onPostExecute + }// end Async task + + public void GetProgramlist() + { + + + + String URL = Class_URL.URL_Login.toString().trim(); + String METHOD_NAME = "GetprogramList"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/GetprogramList"; + + + + //for final + + + try { + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + // request.addProperty("courseid", 0);//long + + // + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + + + SoapObject response = (SoapObject ) envelope.getResponse(); + SoapObject o_programresponse = (SoapObject ) response.getProperty(0); + str_ProgramStatus = o_programresponse.getProperty("status").toString(); + Log.e("resp Programlist",response.toString()); + programlistcount = response.getPropertyCount(); + + Log.d("Programcount", String.valueOf(response.getPropertyCount())); + + + + if(str_ProgramStatus.equals("Success")) + { + if (programlistcount > 0) { + arrayObj_Class_Program = new Class_Program[programlistcount]; + + + for (int i = 0; i < programlistcount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + /* long + string + string*/ + + + Class_Program innerObj_Class_program = new Class_Program(); + innerObj_Class_program.setprogram_id(response_soapobj.getProperty("programmeId").toString()); //long + innerObj_Class_program.setprog_name(response_soapobj.getProperty("programmeName").toString()); // string + innerObj_Class_program.setprog_status(response_soapobj.getProperty("status").toString()); // string + + + + + + + + + str_ProgramStatus = response_soapobj.getProperty("status").toString(); + + arrayObj_Class_Program[i] = innerObj_Class_program; + + + String str_progID = response_soapobj.getProperty("programmeId").toString(); + String str_progname = response_soapobj.getProperty("programmeName").toString(); + + + + + // DBCreate_Programdetails_insert_2SQLiteDB(str_progID, str_progname); + + + }//end for loop + + }//end of if + + } + + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("getCollege fail", "> " + t.getMessage()); + internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + }//End of uploaddetails + + public class SubmitAcknowledgements extends AsyncTask { + + AlertDialog alertDialog; + //private ProgressBar progressBar; + private ProgressDialog progressDialog; + + SubmitAcknowledgements (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapPrimitive response = submitArrLystLeadIds(); + + //Log.d("Soap response issssss",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + + progressDialog.setMessage("Submitting"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + progressDialog.dismiss(); + if(result!=null) { + if (result.toString().equalsIgnoreCase("success")) { + Toast.makeText(context, "Student data saved successfully", Toast.LENGTH_LONG).show(); + //counter = 0; + finish(); + startActivity(getIntent()); + }else if(result.toString().equalsIgnoreCase("EXISTS")){ + Toast.makeText(context, "Student mobile number already exists in LEAD", Toast.LENGTH_LONG).show(); + //counter = 0; + //finish(); + // startActivity(getIntent()); + } else { + + Toast.makeText(context, result.toString(), Toast.LENGTH_LONG).show(); + } + } + //progressBar.setVisibility(View.GONE); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapPrimitive submitArrLystLeadIds() { + String METHOD_NAME = "Save_Manager_PaymentDetails"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/Save_Manager_PaymentDetails"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + JSONObject jsonObject = new JSONObject(); + + if(rdb_register.isChecked()){ + isNewRegistration=0; + }else if(rdb_newRegister.isChecked()){ + isNewRegistration=1; + } + + Log.e("tag","isNewRegistration="+isNewRegistration); + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + request.addProperty("Fees_Category_ID",Integer.valueOf(str_feesCatSlno)); + request.addProperty("Fees_Category_Name",str_feesCatName); + request.addProperty("Fees_ID",Integer.valueOf(str_feesId)); + request.addProperty("isNewRegistration",isNewRegistration); // new reg==1, reg==0 + request.addProperty("Payment_Remark",remark_ET.getText().toString()); + request.addProperty("Manager_Id",MDId); + /* request.addProperty("Fees_Category_ID",Integer.valueOf(str_feesCatSlno)); + request.addProperty("Fees_Category_Name",str_feesCatName); + request.addProperty("Fees_ID",Integer.valueOf(str_feesId)); + request.addProperty("isNewRegistration",isNewRegistration); + request.addProperty("Payment_Remark",remark_ET.getText().toString()); + request.addProperty("Manager_Id",MDId);*/ +//[{"Registration_Id":38267,"Student_Name":"Madhu","MobileNo":"8904674048","State_Id":17,"District_Id":266,"City_Id":68,"stream_Id":3,"College_ID":178,"Email_Id":"madhushree.kubsad@dfmail.org","Paid_date":"0","Paid_fees":100,"Payment_Mode":1,"Payment_Remark":"fees paid"}] + /* jsonObject.put("Registration_Id",38267); + Log.e("tag","str_RegistrationId="+str_RegistrationId); + jsonObject.put("Student_Name",etName.getText().toString()); + jsonObject.put("MobileNo","8904674048"); + jsonObject.put("State_Id",17); + jsonObject.put("District_Id",266); + jsonObject.put("City_Id",68); + jsonObject.put("stream_Id",3); + jsonObject.put("College_ID",178); + jsonObject.put("Email_Id","madhushree.kubsad@dfmail.org"); + jsonObject.put("Paid_date","2021-02-22"); + Log.e("tag","paid Date="+edt_paymentDate.getText().toString()); + jsonObject.put("Paid_fees",1); + jsonObject.put("Payment_Mode",1); + jsonObject.put("Payment_Remark","test test");*/ + // [{"Registration_Id":0,"Student_Name":"test a","MobileNo":"8904674048","State_Id":"17","District_Id":"256","City_Id":"14","stream":"5","College_ID":"37","Email_Id":"madhushree.kubsad@dfmail.org","Paid_date":"2021-02-22","Paid_fees":"1","Payment_Mode":"1","Payment_Remark":"test test"}] + jsonObject.put("Registration_Id",Integer.valueOf(O_RegistrationId)); + Log.e("tag","str_RegistrationId="+O_RegistrationId); + jsonObject.put("Student_Name",etName.getText().toString()); + jsonObject.put("MobileNo",etMobile.getText().toString()); + jsonObject.put("State_Id",Integer.valueOf(str_Sids)); + jsonObject.put("District_Id",Integer.valueOf(str_Dids)); + jsonObject.put("City_Id",Integer.valueOf(str_Cityids)); + jsonObject.put("stream_Id",Integer.valueOf(str_programid)); + jsonObject.put("College_ID",Integer.valueOf(str_ColID)); + jsonObject.put("Email_Id",emailid_ET.getText().toString()); + // jsonObject.put("Paid_date",edt_paymentDate.getText().toString()); + // Log.e("tag","paid Date="+edt_paymentDate.getText().toString()); + jsonObject.put("Paid_fees",Integer.valueOf(str_feesAmount)); + jsonObject.put("Payment_Mode",Integer.valueOf(str_PaymentModeID)); + // jsonObject.put("Payment_Remark",remark_ET.getText().toString()); + + request.addProperty("PaymentDetails","["+jsonObject+"]"); + + + Log.d("Requestisxxxxx",request.toString()); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + // Log.d("soap response1xxxx",envelope.getResponse().toString()); + + + //SoapObject response = (SoapObject) envelope.getResponse(); + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + Log.e("Responseissss",envelope.getResponse().toString()); + + //return null; + + return response; + + }catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + + } + + public int getIndex(Spinner spinner, String myString) { + int index = 0; + String item = null; + for (int i = 0; i < spinner.getCount(); i++) { + // Log.e("entered getIndex", "entered getIndex"); + + item = spinner.getItemAtPosition(i).toString(); + if (item.equals(myString)) { + index = i; + Log.e("entered myString i=", String.valueOf(index)); + + } + } + return index; + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/MasterRequestFragment.java b/app/src/main/java/com/leadcampusapp/MasterRequestFragment.java new file mode 100644 index 0000000..f6acdde --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/MasterRequestFragment.java @@ -0,0 +1,423 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 20-07-2018. + */ + +import android.app.Activity; +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.SharedPreferences; +import android.graphics.Color; +import android.os.AsyncTask; +import android.os.Bundle; +import androidx.fragment.app.Fragment; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; + +import android.widget.BaseAdapter; +import android.widget.Button; +import android.widget.ImageView; +import android.widget.ListAdapter; +import android.widget.ListView; +import android.widget.ProgressBar; +import android.widget.SimpleAdapter; + +import android.widget.TextView; +import android.widget.Toast; + +//import com.android.sripad.leadnew_22_6_2018.R; +import com.leadcampusapp.module.MasterRequestList; +import com.leadcampusapp.module.MasterRequestListModule; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Locale; + +public class MasterRequestFragment extends Fragment +{ + + ListView list,list_head; + ArrayList> mylist, mylist_title; + ListAdapter adapter_title, adapter; + HashMap map1, map2; + + MasterRequestListModule masterRequestListObj; + ArrayList masterRequestListModules; + private ProgressBar progressBar; + MasterRequestListModule[] masterRequestInfosarr; + int responseCount=0; + int i=0; + String str_Lead_Id; + + // Integer ManagerId; + + public static final String PREFBook_PM= "prefbook_pm"; //sharedpreference Book + public static final String PrefID_PMID = "prefid_pmid"; // + SharedPreferences shardprefPM_obj; + String str_MangerID; + Integer MDId; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + + View view=inflater.inflate(R.layout.masterrequest_fragment, container, false); + + list = (ListView) view.findViewById(R.id.lv_masterlist); + list_head = (ListView) view.findViewById(R.id.lv_masterlisthead); + progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + masterRequestListObj = new MasterRequestListModule(); + +/* ManagerId = getActivity().getIntent().getExtras().getInt("ManagerId"); + Log.i("tag","MangerID PMProjectDetails="+ManagerId); +*/ + + shardprefPM_obj= getActivity().getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MangerID = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + Log.d("str_leadId:",str_MangerID); + // Toast.makeText(this,"LeadId: "+str_MangerID,Toast.LENGTH_LONG).show(); + MDId=Integer.parseInt(str_MangerID); + + GetMasterRequestDetails getMasterRequestDetails = new GetMasterRequestDetails(getActivity()); + getMasterRequestDetails.execute(MDId); + + // showActivity(); + return view; + } + + public void showActivity() { + + mylist = new ArrayList>(); + mylist_title = new ArrayList>(); + + /**********Display the headings************/ + map1 = new HashMap(); + + // map1.put("slno", "Lead Id"); + map1.put("one", " LEAD Id"); + map1.put("two", "Student Name"); + map1.put("three","Student Type"); + /* map1.put("three","Applied"); + map1.put("four","Disperse Amount"); + map1.put("five","Balance Amount");*/ + mylist_title.add(map1); + + + try { + adapter_title = new SimpleAdapter(getContext(), mylist_title, R.layout.pmmasterrequest_list, + new String[]{ "one", "two","three"}, new int[]{ + R.id.LeadId, R.id.StudentName, R.id.StudentType}); + list_head.setAdapter(adapter_title); + } catch (Exception e) { + + } + + /********************************************************/ + + + for (int i = 0; i < MasterRequestList.listview_arr.size(); i++) { + + map2 = new HashMap(); + map2.put("one", MasterRequestList.listview_arr.get(i).getLead_Id()); + map2.put("two", MasterRequestList.listview_arr.get(i).getStudentName()); + map2.put("three", MasterRequestList.listview_arr.get(i).getStudent_Type()); + // map2.put("four", ApprovedProjectList.listview_arr.get(i).getDisperse_amount()); + //map2.put("five", ApprovedProjectList.listview_arr.get(i).getBalance_amount()); + mylist.add(map2); + + /* if(ApprovedProjectList.listview_arr.get(i).getApproved_amount().equals("0")){ + list.setBackgroundColor(Color.GREEN); + }*/ + } + + try { + adapter = new SimpleAdapter(getContext(), mylist, R.layout.pmmasterrequest_list, + new String[]{"one", "two","three"}, new int[]{ + R.id.LeadId, R.id.StudentName, R.id.StudentType}); + list.setAdapter(adapter); + } catch (Exception e) { + + } + /* if (ApprovedProjectList.listview_arr.get(i).getApproved_amount().equals("0")) { + list.setBackgroundColor(Color.YELLOW); + }*/ + + list.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + + Object o = list.getItemAtPosition(position); + + str_Lead_Id=MasterRequestList.listview_arr.get(position).getLead_Id(); + + AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity()); + alertDialogBuilder.setMessage("Are you sure, You wanted to make master leader"); + alertDialogBuilder.setPositiveButton("Yes", + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface arg0, int arg1) { + // Toast.makeText(getActivity(), "You clicked yes button", Toast.LENGTH_LONG).show(); + SubmitDetails submitDetails = new SubmitDetails(); + submitDetails.execute(); + } + }); + alertDialogBuilder.setNegativeButton("No",new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + getActivity().finish(); + } + }); + + final AlertDialog alertDialog = alertDialogBuilder.create(); + + alertDialog.setOnShowListener( new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface arg0) { + alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(Color.RED); + alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#004D40")); + } + }); + alertDialog.show(); + } + + }); + } + + public class SubmitDetails extends AsyncTask { + + AlertDialog alertDialog; + // private ProgressBar progressBar; + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapPrimitive response = MasterRequest(); + + // SoapObject response = ReApplyProjectDetails(); + Log.d("Soap response issssss",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressBar.setVisibility(View.VISIBLE); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + if(result!=null) { + if (result.toString().equals("Error")) { + Toast.makeText(getContext(), "Error occured while saving to database", Toast.LENGTH_LONG).show(); + } else { + Toast.makeText(getContext(), "Sucessfully updated to Master Leader", Toast.LENGTH_LONG).show(); + /*Intent ittEditProjToProjStatus = new Intent(getContext(),PMProjectDetailActivity.class); + ittEditProjToProjStatus.putExtra("pageCount",0); + startActivity(ittEditProjToProjStatus);*/ + GetMasterRequestDetails getMasterRequestDetails = new GetMasterRequestDetails(getActivity()); + getMasterRequestDetails.execute(MDId); + } + } + progressBar.setVisibility(View.GONE); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapPrimitive MasterRequest() { + String METHOD_NAME = "Applyleadmasterandambassador"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/Applyleadmasterandambassador"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + request.addProperty("Lead_Id",str_Lead_Id); + Log.d("PDIdssssssxxxx","hi"); + + request.addProperty("Student_Type","Master Leader"); + + Log.d("Requestisxxxxx",request.toString()); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + Log.e("tag","soap masterrequest update"+envelope.getResponse().toString()); + + //return null; + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + } + return null; + + } + + + public class GetMasterRequestDetails extends AsyncTask { + + Context context; + + GetMasterRequestDetails (Context ctx){ + context = ctx; + } + + + @Override + protected SoapObject doInBackground(Integer... params) { + Integer ManagerId = (Integer) params [0]; + //SoapObject response = getStudDtls(leadid); + + //unapprovedProjectListObj = new UnapprovedProjectListModule(); + masterRequestListModules = new ArrayList(); + + String METHOD_NAME = "ApplayedLeadMembers"; + String NamespaceMail="http://mis.leadcampus.org/", SOAP_ACTION1="http://mis.leadcampus.org/ApplayedLeadMembers";//namespace+methodname + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + request.addProperty("ManagerId", ManagerId); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapObject response = (SoapObject) envelope.getResponse(); + + Log.d("Tag", "soap response ApplayedLeadMembers=" + response.toString()); + + + responseCount = response.getPropertyCount(); + + + Log.d("count master", String.valueOf(response.getPropertyCount())); + + MasterRequestListModule.listview_arr.clear(); + MasterRequestList.listview_arr.clear(); + + if (responseCount > 0) { + + masterRequestInfosarr = new MasterRequestListModule[responseCount]; + for (i = 0; i < responseCount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + String Status=response_soapobj.getProperty("Status").toString(); + Log.i("tag","Status"+Status); + + if( Status.equals("Success")) { + masterRequestListObj.setStudentName(response_soapobj.getProperty("StudentName").toString()); + masterRequestListObj.setLead_Id(response_soapobj.getProperty("Lead_Id").toString()); + masterRequestListObj.setIsApply_MasterLeader(response_soapobj.getProperty("isApply_MasterLeader").toString()); + masterRequestListObj.setIsApply_LeadAmbassador(response_soapobj.getProperty("isApply_LeadAmbassador").toString()); + masterRequestListObj.setStudent_Type(response_soapobj.getProperty("Student_Type").toString()); + + // approvedProjectListObj.setBalance_amount(response_soapobj.getProperty("Amount").toString()); + masterRequestListModules.add(masterRequestListObj); + + Log.d("tag", "masterRequestListModules.get(i)=" + masterRequestListModules.get(i).getStudentName()); + Log.d("tag", "masterRequestListModules=" + masterRequestListModules.size()); + Log.d("tag", "masterRequestListModules=" + masterRequestListObj.getStudentName()); + + String StudentName = response_soapobj.getProperty("StudentName").toString(); + String Lead_Id = response_soapobj.getProperty("Lead_Id").toString(); + String isApply_MasterLeader = response_soapobj.getProperty("isApply_MasterLeader").toString(); + String isApply_LeadAmbassador = response_soapobj.getProperty("isApply_LeadAmbassador").toString(); + String Student_Type = response_soapobj.getProperty("Student_Type").toString(); + + + masterRequestInfosarr[i] = masterRequestListObj; + + MasterRequestList.listview_arr.add(new MasterRequestList(Lead_Id, StudentName, isApply_MasterLeader, isApply_LeadAmbassador, Student_Type)); + + Log.i("Tag", "MasterRequestList.size=" + MasterRequestList.listview_arr.size()); + }else{ + return null; + } + } + } + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.d("exception outside",t.getMessage().toString()); + } + + return null; + } + + @Override + protected void onPreExecute() { + + progressBar.setVisibility(View.VISIBLE); + } + + @Override + protected void onPostExecute(SoapObject result) { + progressBar.setVisibility(View.GONE); + + /* if(result==null){ + Toast.makeText(getActivity(),"There is no student applied for Master Leader ",Toast.LENGTH_LONG).show(); + }*/ + + showActivity(); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + +}//end of fragment class + + diff --git a/app/src/main/java/com/leadcampusapp/MyApplication.java b/app/src/main/java/com/leadcampusapp/MyApplication.java new file mode 100644 index 0000000..5b9f466 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/MyApplication.java @@ -0,0 +1,93 @@ +package com.leadcampusapp; + +import android.app.Application; +import com.google.android.gms.analytics.Tracker; +import com.google.android.gms.analytics.GoogleAnalytics; +import com.google.android.gms.analytics.HitBuilders; +import com.google.android.gms.analytics.StandardExceptionParser; + +/** + * Created by Ravi Tamada on 15/06/16. + * www.androidhive.info + */ +public class MyApplication extends Application { + + private static MyApplication mInstance; + + @Override + public void onCreate() { + super.onCreate(); + + mInstance = this; + + + + AnalyticsTrackers.initialize(this); + AnalyticsTrackers.getInstance().get(AnalyticsTrackers.Target.APP); + } + + public static synchronized MyApplication getInstance() { + return mInstance; + } + + public synchronized Tracker getGoogleAnalyticsTracker() { + AnalyticsTrackers analyticsTrackers = AnalyticsTrackers.getInstance(); + return analyticsTrackers.get(AnalyticsTrackers.Target.APP); + } + + + /*** + * Tracking screen view + * + * @param screenName screen name to be displayed on GA dashboard + */ + public void trackScreenView(String screenName) { + Tracker t = getGoogleAnalyticsTracker(); + + // Set screen name. + t.setScreenName(screenName); + + // Send a screen view. + t.send(new HitBuilders.ScreenViewBuilder().build()); + + GoogleAnalytics.getInstance(this).dispatchLocalHits(); + } + + /*** + * Tracking exception + * + * @param e exception to be tracked + */ + public void trackException(Exception e) { + if (e != null) { + Tracker t = getGoogleAnalyticsTracker(); + + t.send(new HitBuilders.ExceptionBuilder() + .setDescription( + new StandardExceptionParser(this, null) + .getDescription(Thread.currentThread().getName(), e)) + .setFatal(false) + .build() + ); + } + } + + /*** + * Tracking event + * + * @param category event category + * @param action action of the event + * @param label label + */ + public void trackEvent(String category, String action, String label) { + Tracker t = getGoogleAnalyticsTracker(); + + // Build and send an Event. + t.send(new HitBuilders.EventBuilder().setCategory(category).setAction(action).setLabel(label).build()); + } + + + public void setConnectivityListener(ConnectivityReceiver.ConnectivityReceiverListener listener) { + ConnectivityReceiver.connectivityReceiverListener = listener; + } +} diff --git a/app/src/main/java/com/leadcampusapp/MyFTPClientFunctions.java b/app/src/main/java/com/leadcampusapp/MyFTPClientFunctions.java new file mode 100644 index 0000000..b2fb0d8 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/MyFTPClientFunctions.java @@ -0,0 +1,228 @@ +package com.leadcampusapp; + +import android.content.Context; +import android.util.Log; + +import org.apache.commons.net.ftp.FTP; +import org.apache.commons.net.ftp.FTPClient; +import org.apache.commons.net.ftp.FTPFile; +import org.apache.commons.net.ftp.FTPReply; + +import java.io.FileInputStream; +import java.io.FileOutputStream; + +/*import it.sauronsoftware.ftp4j.FTPClient; +import it.sauronsoftware.ftp4j.FTPReply;*/ + +public class MyFTPClientFunctions { + + // Now, declare a public FTP client object. + + private static final String TAG = "MyFTPClientFunctions"; + public FTPClient mFTPClient = null; + + // Method to connect to FTP server: + public boolean ftpConnect(String host, String username, String password, + int port) { + try { + mFTPClient = new FTPClient(); + // connecting to the host + mFTPClient.connect(host, port); + + // now check the reply code, if positive mean connection success + if (FTPReply.isPositiveCompletion(mFTPClient.getReplyCode())) { + // login using username & password + boolean status = mFTPClient.login(username, password); + + /* + * Set File Transfer Mode + * + * To avoid corruption issue you must specified a correct + * transfer mode, such as ASCII_FILE_TYPE, BINARY_FILE_TYPE, + * EBCDIC_FILE_TYPE .etc. Here, I use BINARY_FILE_TYPE for + * transferring text, image, and compressed files. + */ + mFTPClient.setFileType(FTP.BINARY_FILE_TYPE); + mFTPClient.enterLocalPassiveMode(); + + return status; + } + } catch (Exception e) { + Log.d(TAG, "Error: could not connect to host " + host); + } + + return false; + } + + // Method to disconnect from FTP server: + + public boolean ftpDisconnect() { + try { + mFTPClient.logout(); + mFTPClient.disconnect(); + return true; + } catch (Exception e) { + Log.d(TAG, "Error occurred while disconnecting from ftp server."); + } + + return false; + } + + // Method to get current working directory: + + public String ftpGetCurrentWorkingDirectory() { + try { + String workingDir = mFTPClient.printWorkingDirectory(); + return workingDir; + } catch (Exception e) { + Log.d(TAG, "Error: could not get current working directory."); + } + + return null; + } + + // Method to change working directory: + + public boolean ftpChangeDirectory(String directory_path) { + try { + mFTPClient.changeWorkingDirectory(directory_path); + } catch (Exception e) { + Log.d(TAG, "Error: could not change directory to " + directory_path); + } + + return false; + } + + // Method to list all files in a directory: + + public String[] ftpPrintFilesList(String dir_path) { + String[] fileList = null; + try { + FTPFile[] ftpFiles = mFTPClient.listFiles(dir_path); + int length = ftpFiles.length; + fileList = new String[length]; + for (int i = 0; i < length; i++) { + String name = ftpFiles[i].getName(); + boolean isFile = ftpFiles[i].isFile(); + + if (isFile) { + fileList[i] = "File :: " + name; + Log.i(TAG, "File : " + name); + } else { + fileList[i] = "Directory :: " + name; + Log.i(TAG, "Directory : " + name); + } + } + return fileList; + } catch (Exception e) { + e.printStackTrace(); + return fileList; + } + } + + // Method to create new directory: + + public boolean ftpMakeDirectory(String new_dir_path) { + try { + boolean status = mFTPClient.makeDirectory(new_dir_path); + return status; + } catch (Exception e) { + Log.d(TAG, "Error: could not create new directory named " + + new_dir_path); + } + + return false; + } + + // Method to delete/remove a directory: + + public boolean ftpRemoveDirectory(String dir_path) { + try { + boolean status = mFTPClient.removeDirectory(dir_path); + return status; + } catch (Exception e) { + Log.d(TAG, "Error: could not remove directory named " + dir_path); + } + + return false; + } + + // Method to delete a file: + + public boolean ftpRemoveFile(String filePath) { + try { + boolean status = mFTPClient.deleteFile(filePath); + return status; + } catch (Exception e) { + e.printStackTrace(); + } + + return false; + } + + // Method to rename a file: + + public boolean ftpRenameFile(String from, String to) { + try { + boolean status = mFTPClient.rename(from, to); + return status; + } catch (Exception e) { + Log.d(TAG, "Could not rename file: " + from + " to: " + to); + } + + return false; + } + + // Method to download a file from FTP server: + + /** + * mFTPClient: FTP client connection object (see FTP connection example) + * srcFilePath: path to the source file in FTP server desFilePath: path to + * the destination file to be saved in sdcard + */ + public boolean ftpDownload(String srcFilePath, String desFilePath) { + boolean status = false; + try { + FileOutputStream desFileStream = new FileOutputStream(desFilePath); + ; + status = mFTPClient.retrieveFile(srcFilePath, desFileStream); + desFileStream.close(); + + return status; + } catch (Exception e) { + Log.d(TAG, "download failed"); + } + + return status; + } + + // Method to upload a file to FTP server: + + /** + * mFTPClient: FTP client connection object (see FTP connection example) + * srcFilePath: source file path in sdcard desFileName: file name to be + * stored in FTP server desDirectory: directory path where the file should + * be upload to + */ + public boolean ftpUpload(String srcFilePath, String desFileName, + String desDirectory, Context context) { + boolean status = false; + try { + FileInputStream srcFileStream = new FileInputStream(srcFilePath); + + // change working directory to the destination directory + // if (ftpChangeDirectory(desDirectory)) { + status = mFTPClient.storeFile(desFileName, srcFileStream); + // } + + srcFileStream.close(); + + return status; + } catch (Exception e) { + e.printStackTrace(); + Log.d(TAG, "upload failed: " + e); + } + + return status; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/MyFirebaseInstanceIDService.java b/app/src/main/java/com/leadcampusapp/MyFirebaseInstanceIDService.java new file mode 100644 index 0000000..059392c --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/MyFirebaseInstanceIDService.java @@ -0,0 +1,32 @@ +package com.leadcampusapp; + +import android.util.Log; + +import com.google.firebase.iid.FirebaseInstanceId; +import com.google.firebase.iid.FirebaseInstanceIdService; + +/** + * Created by User on 7/18/2017. + */ + +public class MyFirebaseInstanceIDService extends FirebaseInstanceIdService { + private static final String TAG = "MyFirebaseIIDService"; + + @Override + public void onTokenRefresh() { + String refreshedToken = FirebaseInstanceId.getInstance().getToken(); + Log.e(TAG, "Refreshed token: " + refreshedToken); + System.out.println("Hi below"); + System.out.println("Hi device ID"+refreshedToken); + + sendRegistrationToServer(refreshedToken); + } + + private void sendRegistrationToServer(String token) { + // TODO: Send any registration to your app's servers. + + } + + + +} diff --git a/app/src/main/java/com/leadcampusapp/MyFirebaseMessagingService.java b/app/src/main/java/com/leadcampusapp/MyFirebaseMessagingService.java new file mode 100644 index 0000000..282ddce --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/MyFirebaseMessagingService.java @@ -0,0 +1,566 @@ +package com.leadcampusapp; + +import android.annotation.SuppressLint; +import android.app.NotificationChannel; +import android.app.NotificationManager; +import android.app.PendingIntent; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.Color; +import android.media.RingtoneManager; +import android.net.Uri; +import android.os.Build; +import androidx.core.app.NotificationCompat; +import android.util.Log; + +import com.google.firebase.messaging.FirebaseMessagingService; +import com.google.firebase.messaging.RemoteMessage; + +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.URL; + +//import com.android.sripad.leadnew_22_6_2018.R; + +//import static java.lang.System.lineSeparator; + + +/** + * Created by User on 7/18/2017. + */ + +public class MyFirebaseMessagingService extends FirebaseMessagingService +{ + + private static final String TAG = "MyFirebaseMsgService"; + Bitmap url2bitmap=null; + + String str_titlewhr2go; + + NotificationCompat.Builder notificationBuilders; + int x; + + + + public static final String PREFBook_Stud= "prefbook_stud"; //sharedpreference Book + public static final String PrefID_S_isprofileEdited = "prefid_isprofileEdited"; + SharedPreferences shardpref_S_obj; + + + + String str_isProfileEdited; + + + Intent intent,intent_student,intent_pm,intent_events,intent_story,intent_request,intent_pm_request,intent_pm_tshirt; + + + + + public static final String PREFBook_LoginTrack= "prefbook_logintrack"; //sharedpreference Book + public static final String PrefID_WhereToGo = "prefid_wheretogo"; // + SharedPreferences shardprefLoginTrack_obj; + String str_loginTrack; + String NOTIFICATION_CHANNEL_ID = "my_channel_id_01"; + + @Override + public void onMessageReceived(RemoteMessage remoteMessage) + { + // Create and show notification + + NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + NotificationChannel notificationChannel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, "My Notifications", NotificationManager.IMPORTANCE_DEFAULT); + + // Configure the notification channel. + notificationChannel.setDescription("Channel description"); + notificationChannel.enableLights(true); + notificationChannel.setLightColor(Color.RED); + notificationChannel.setVibrationPattern(new long[]{0, 1000, 500, 1000}); + notificationChannel.enableVibration(false); + notificationManager.createNotificationChannel(notificationChannel); + } + + + notificationBuilders = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID); + + /* notificationBuilders.setAutoCancel(true) + .setDefaults(Notification.DEFAULT_ALL) + .setWhen(System.currentTimeMillis()) + .setSmallIcon(R.drawable.ic_launcher) + .setTicker("Hearty365") + // .setPriority(Notification.PRIORITY_MAX) + .setContentTitle("Default notification") + .setContentText("Lorem ipsum dolor sit amet, consectetur adipiscing elit.") + .setContentInfo("Info"); + + notificationManager.notify(*//*notification id*//*1, notificationBuilders.build()); +*/ + x=1; + // notificationBuilders = new NotificationCompat.Builder(this); + + // Log.e(TAG, "From: " + remoteMessage.getData().get("title")); + // Log.e(TAG, "From: " + remoteMessage.getData().get("message").toString()); + +// System.out.println("TestTitle:" + remoteMessage.getData().get("title")); + + Log.e(TAG, "Image: " + remoteMessage.getData().get("image")); + + + shardpref_S_obj=this.getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + str_isProfileEdited = shardpref_S_obj.getString(PrefID_S_isprofileEdited, "").trim(); + Log.e("profileedited",str_isProfileEdited); + + shardprefLoginTrack_obj=getSharedPreferences(PREFBook_LoginTrack, Context.MODE_PRIVATE); + str_loginTrack = shardprefLoginTrack_obj.getString(PrefID_WhereToGo, "").trim(); + + Log.e("logintrack",str_loginTrack); + + // sendNotification(remoteMessage.getNotification().getBody()); + + // Log.e(TAG, "From: " + remoteMessage.getData().get("message").toString()); + //sendNotification(remoteMessage.getData().get("title")); + + /* if (remoteMessage.getData().get("message").toString()!=null ||remoteMessage.getData().get("message").toString()!="" ||remoteMessage.getData().get("message").toString().length()!=0) + { + sendNotification(remoteMessage.getData().get("message")); + }*/ + + + str_titlewhr2go = remoteMessage.getData().get("title").trim(); + Log.e("notitle","notitle:"+str_titlewhr2go.toString()); + if(str_titlewhr2go.equals("empty")||str_titlewhr2go.equals("Empty")||str_titlewhr2go==null ||str_titlewhr2go==""||str_titlewhr2go.isEmpty()) + { str_titlewhr2go="empty";} + else { } + + + String imageUrl = remoteMessage.getData().get("image"); + if(imageUrl.equals("empty")||imageUrl.equals("Empty")||imageUrl==null ||imageUrl==""||imageUrl.isEmpty()) + { // Log.e("Storyimage","imageURLText:"+imageUrl.toString()); + + } + else { + //To get a Bitmap image from the URL received + url2bitmap = getBitmapfromUrl(imageUrl); + } + + sendNotification(remoteMessage.getData().get("message").trim()); + + } + + @SuppressLint("NewApi") + private void sendNotification(String messageBody) + { + Log.e("MessageBoby: ", " " + messageBody); + + if (messageBody == null || messageBody == "" || messageBody.isEmpty()) { + Log.e("empty:", "Empty"); + } else + { + Log.e("else: ", " " + messageBody.toString()); + /*Bitmap bmp_image = BitmapFactory.decodeResource(getApplicationContext().getResources(), + R.drawable.aboutus);*/ + //bmp_image=null; + + int breakat =3; + String splittedmessagex=""; + String[] messsagetobreak = messageBody.split("\\s+"); + for (int i = 0; i < messsagetobreak.length; i++) + { + if(i==breakat) + { + breakat=breakat+4; + splittedmessagex= splittedmessagex+" "+messsagetobreak[i]+ System.lineSeparator(); + Log.e("Finalx",splittedmessagex.toString()); + } + else + { splittedmessagex=splittedmessagex+" "+messsagetobreak[i];} + } + + messageBody=splittedmessagex; + Log.e("SplitString",splittedmessagex.toString()); + Log.e("MessageString",messageBody.toString()); + + + + if(str_loginTrack=="" || str_loginTrack==null ||(str_loginTrack.trim().length()==0)||str_loginTrack.trim().equals("com.leadcampusapp.LoginActivity")) + { + intent = new Intent(this, LoginActivity.class); + intent_student = intent_pm = intent_events = intent_story = intent_request = intent; + } + else + { + + if(str_titlewhr2go.equals("Manager")) + { + intent_pm = new Intent(this, PMHomeActivity.class); + intent_student = intent= intent_events = intent_story = intent_request = + intent_pm_request=intent_pm_tshirt=intent_pm; + + } + if(str_titlewhr2go.equalsIgnoreCase("ApprovalLetter"))//ApprovalLetter + { + intent_pm_request = new Intent(this, PMRequestActivity.class); + + intent_student = intent= intent_events = intent_story = intent_request = + intent_pm=intent_pm_tshirt=intent_pm_request; + } + + if(str_titlewhr2go.equalsIgnoreCase("pmtshirt"))//pmtshirt + { + intent_pm_tshirt = new Intent(this, TShirtPaidActivity.class); + + intent_student = intent= intent_events = intent_story = intent_request = + intent_pm=intent_pm_request=intent_pm_tshirt; + } + + + else + { + if (str_isProfileEdited.equals("0")) + { + intent = new Intent(this, EditProfileActivity.class); + intent_student = intent_pm = intent_events = intent_story = intent_request=intent_pm_request= + intent_pm_tshirt=intent_pm=intent; + + } else { + intent = new Intent(this, LoginActivity.class); + intent_student = new Intent(this, HomeActivity.class); + intent_pm = new Intent(this, PMHomeActivity.class); + intent_events = new Intent(this, EventsActivity.class); + intent_story = new Intent(this, LeadStoryActivity.class); + // intent_story.putExtra("story_possion" , "5"); + + intent_request = new Intent(this, EditProfileActivity.class); + intent_pm_request= new Intent(this, PMRequestActivity.class); + } + + }//end of else + + }//end of main else + //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- + // intent.putExtra( "notification_id", 0); + //intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + // intent.putExtra("2", messageBody); + //-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- + + intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + intent_student.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + intent_pm.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + intent_events.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + intent_story.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + intent_request.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + intent_pm_request.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + /*String str_passString=messageBody.toString(); + Log.e("str_passString",str_passString);*/ + + intent.putExtra("2", messageBody); + + if(str_titlewhr2go.equalsIgnoreCase("Student")|| + str_titlewhr2go.equalsIgnoreCase("studenttshirtrequested")|| + str_titlewhr2go.equalsIgnoreCase("Proposed")) + { + x++; + int id = (int) System.currentTimeMillis(); + // intent.putExtra("2", str_passString); + PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent_student, + PendingIntent.FLAG_ONE_SHOT); + + Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); + + NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this,NOTIFICATION_CHANNEL_ID) + /*.setSmallIcon(R.mipmap.ic_launcher_round)*/ + // notificationBuilders + .setSmallIcon(R.drawable.logo_notification) + .setContentTitle("LEADCampus") + /*.setContentText(messageBody)*/ + .setStyle(new NotificationCompat.BigTextStyle().bigText(messageBody)) + .setAutoCancel(true) + .setSound(defaultSoundUri) + .setContentIntent(pendingIntent); + + NotificationManager notificationManager = + (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + + notificationManager.notify(id /* ID of notification */, notificationBuilder.build()); + + } + else if(str_titlewhr2go.equalsIgnoreCase("Manager")) + { + x++; + int id = (int) System.currentTimeMillis(); + PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent_pm, + PendingIntent.FLAG_ONE_SHOT); + + Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); + + NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this,NOTIFICATION_CHANNEL_ID) + /*.setSmallIcon(R.mipmap.ic_launcher_round)*/ + + // notificationBuilders + .setSmallIcon(R.drawable.logo_notification) + .setContentTitle("LEADCampus") + /*.setContentText(messageBody) + .setStyle(new NotificationCompat.BigPictureStyle() + .bigPicture(url2bitmap).setSummaryText(messageBody))*//*Notification with Image*/ + + .setStyle(new NotificationCompat.BigTextStyle().bigText(messageBody)) + .setAutoCancel(true) + .setSound(defaultSoundUri) + .setContentIntent(pendingIntent); + + NotificationManager notificationManager = + (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + + notificationManager.notify(id /* ID of notification */, notificationBuilder.build()); + } + + + + else if (url2bitmap!=null && str_titlewhr2go.equalsIgnoreCase("Events")) + { + x++; + int id = (int) System.currentTimeMillis(); + PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent_events, + PendingIntent.FLAG_ONE_SHOT); + + Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); + + NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this,NOTIFICATION_CHANNEL_ID) + /*.setSmallIcon(R.mipmap.ic_launcher_round)*/ + //notificationBuilders + .setSmallIcon(R.drawable.logo_notification) + .setContentTitle("LEADCampus") + .setContentText(messageBody) + .setStyle(new NotificationCompat.BigPictureStyle() + .bigPicture(url2bitmap).setSummaryText(messageBody))/*Notification with Image*/ + .setAutoCancel(true) + .setSound(defaultSoundUri) + .setContentIntent(pendingIntent); + + NotificationManager notificationManager = + (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + + notificationManager.notify(id /* ID of notification */, notificationBuilder.build()); + } + + else if( (url2bitmap!=null) && (str_titlewhr2go.equalsIgnoreCase("Stories")||str_titlewhr2go.equalsIgnoreCase("Story"))) + { + // messageBody="LEaders in TV9 Kannada^67"; + messageBody=messageBody.replace("^^","-"); + Log.e("tag","messageBody con=="+messageBody); + + String[] parts = messageBody.split("-"); + messageBody = parts[0]; // 004 + String requestcode = parts[1]; // 034556 + intent_story.putExtra("stroy_position", requestcode); + + x++; + int id = (int) System.currentTimeMillis(); + PendingIntent pendingIntent = PendingIntent.getActivity(this, id /* Request code */, intent_story, + PendingIntent.FLAG_ONE_SHOT); + + Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); + + NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this,NOTIFICATION_CHANNEL_ID) + + // notificationBuilders + /*.setSmallIcon(R.mipmap.ic_launcher_round)*/ + .setSmallIcon(R.drawable.logo_notification) + .setContentTitle("LEADCampus") + .setContentText(messageBody) + .setStyle(new NotificationCompat.BigPictureStyle() + .bigPicture(url2bitmap).setSummaryText(messageBody))/*Notification with Image*/ + .setAutoCancel(true) + .setSound(defaultSoundUri) + .setContentIntent(pendingIntent); + + NotificationManager notificationManager = + (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + + notificationManager.notify(id /* ID of notification */, notificationBuilder.build()); + } + + else if( (url2bitmap==null) && (str_titlewhr2go.equalsIgnoreCase("Stories")||str_titlewhr2go.equalsIgnoreCase("Story")) ) + { + + messageBody=messageBody.replace("^^","-"); + Log.e("tag","messageBody con=="+messageBody); + + String[] parts = messageBody.split("-"); + messageBody = parts[0]; // 004 + String requestcode = parts[1]; // 034556 + intent_story.putExtra("stroy_position", requestcode); + + + + x++; + int id = (int) System.currentTimeMillis(); + PendingIntent pendingIntent = PendingIntent.getActivity(this, id /* Request code */, intent_story, + PendingIntent.FLAG_ONE_SHOT); + + Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); + NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this,NOTIFICATION_CHANNEL_ID) + /*.setSmallIcon(R.mipmap.ic_launcher_round)*/ + // notificationBuilders + .setSmallIcon(R.drawable.logo_notification) + .setContentTitle("LEADCampus") + .setStyle(new NotificationCompat.BigTextStyle().bigText(messageBody)) + .setAutoCancel(true) + .setSound(defaultSoundUri) + .setContentIntent(pendingIntent); + + NotificationManager notificationManager = + (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + + notificationManager.notify(id /* ID of notification */, notificationBuilder.build()); + } + + else if (str_titlewhr2go.equals("Request")) + { + x++; + int id = (int) System.currentTimeMillis(); + // intent.putExtra("2", str_passString); + PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent_request, + PendingIntent.FLAG_ONE_SHOT); + + Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); + + NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this,NOTIFICATION_CHANNEL_ID) + /*.setSmallIcon(R.mipmap.ic_launcher_round)*/ + //notificationBuilders + .setSmallIcon(R.drawable.logo_notification) + .setContentTitle("LEADCampus") + .setContentText(messageBody) + /*.setStyle(new NotificationCompat.BigTextStyle().bigText(messageBody))*/ + .setAutoCancel(true) + .setSound(defaultSoundUri) + .setContentIntent(pendingIntent); + + NotificationManager notificationManager = + (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + + notificationManager.notify(id /* ID of notification */, notificationBuilder.build()); + + + + } + + + + else if(str_titlewhr2go.equalsIgnoreCase("ApprovalLetter"))//ApprovalLetter + { + x++; + int id = (int) System.currentTimeMillis(); + // intent.putExtra("2", str_passString); + PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent_pm_request, + PendingIntent.FLAG_ONE_SHOT); + + Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); + + NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this,NOTIFICATION_CHANNEL_ID) + /*.setSmallIcon(R.mipmap.ic_launcher_round)*/ + //notificationBuilders + .setSmallIcon(R.drawable.logo_notification) + .setContentTitle("LEADCampus") + .setContentText(messageBody) + /*.setStyle(new NotificationCompat.BigTextStyle().bigText(messageBody))*/ + .setAutoCancel(true) + .setSound(defaultSoundUri) + .setContentIntent(pendingIntent); + + NotificationManager notificationManager = + (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + + notificationManager.notify(id /* ID of notification */, notificationBuilder.build()); + } + + + else if(str_titlewhr2go.equalsIgnoreCase("pmtshirt"))////intent_pm_tshirt + { + x++; + int id = (int) System.currentTimeMillis(); + // intent.putExtra("2", str_passString); + PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent_pm_tshirt, + PendingIntent.FLAG_ONE_SHOT); + + Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); + + NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this,NOTIFICATION_CHANNEL_ID) + /*.setSmallIcon(R.mipmap.ic_launcher_round)*/ + //notificationBuilders + .setSmallIcon(R.drawable.logo_notification) + .setContentTitle("LEADCampus") + .setContentText(messageBody) + /*.setStyle(new NotificationCompat.BigTextStyle().bigText(messageBody))*/ + .setAutoCancel(true) + .setSound(defaultSoundUri) + .setContentIntent(pendingIntent); + + NotificationManager notificationManager = + (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + + notificationManager.notify(id /* ID of notification */, notificationBuilder.build()); + } + + + + + else + { + x++; + int id = (int) System.currentTimeMillis(); + + PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent, + PendingIntent.FLAG_ONE_SHOT); + + Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); + + NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this,NOTIFICATION_CHANNEL_ID) + /*.setSmallIcon(R.mipmap.ic_launcher_round)*/ + //notificationBuilders + .setSmallIcon(R.drawable.logo_notification) + .setContentTitle("LEADCampus") + .setStyle(new NotificationCompat.BigTextStyle().bigText(messageBody)) + .setAutoCancel(true) + .setSound(defaultSoundUri); + //.setContentIntent(pendingIntent); + + NotificationManager notificationManager = + (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + + notificationManager.notify(id /* ID of notification */, notificationBuilder.build()); + + } + + } + + } + + + public Bitmap getBitmapfromUrl(String imageUrl) + { + try { + URL url = new URL(imageUrl); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + connection.setDoInput(true); + connection.connect(); + InputStream input = connection.getInputStream(); + Bitmap bitmap = BitmapFactory.decodeStream(input); + return bitmap; + + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + return null; + + } + } + + +}// end of class + diff --git a/app/src/main/java/com/leadcampusapp/MyProfileFragment.java b/app/src/main/java/com/leadcampusapp/MyProfileFragment.java new file mode 100644 index 0000000..76d047a --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/MyProfileFragment.java @@ -0,0 +1,2528 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 22-06-2018. + */ + +import android.app.Dialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.res.ColorStateList; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.Color; +import android.graphics.drawable.ColorDrawable; +import android.os.AsyncTask; +import android.os.Build; +import android.os.Bundle; + +import androidx.annotation.RequiresApi; +import androidx.fragment.app.Fragment; +import androidx.core.content.ContextCompat; +import androidx.appcompat.widget.AppCompatSpinner; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.animation.Animation; +import android.view.animation.AnimationUtils; +import android.widget.Button; +import android.widget.EditText; +import android.widget.FrameLayout; +import android.widget.GridView; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.RadioButton; +import android.widget.RadioGroup; +import android.widget.TextView; +import android.widget.Toast; + + +import com.codesgood.views.JustifiedTextView; +import com.facebook.shimmer.ShimmerFrameLayout; +import com.kofigyan.stateprogressbar.StateProgressBar; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; + +import pl.bclogic.pulsator4droid.library.PulsatorLayout; + + +public class MyProfileFragment extends Fragment { + + private LinearLayout lnrlyt_projDtls; + private LinearLayout lnrlyt_events; + private LinearLayout lnrlyt_newsfeeds; + private LinearLayout lnrlyt_aboutUs; + + private LinearLayout lnrlyt_viewProfile; + + TextView about_TV,projectDetails_TV,events_TV,news_TV,contactus_TV; + ImageView about_IV,projectDetails_IV,events_IV,news_IV,contactus_IV; + + private Context context; + private AppCompatSpinner spin_state; + private AppCompatSpinner spin_city; + private AppCompatSpinner spin_institution; + private AppCompatSpinner spin_semester; + private EditText edt_dob; + + // private String[] descriptionData = {"Student", "Leader", "Master", "Ambassador"}; + private String[] descriptionData = {"Student", "Initiator","Change Maker","LEADer", "Master Leader"}; + + private int mYear, mMonth, mDay; + private int cYear, cMonth, cDay; + + public static final String PREFBook_Stud= "prefbook_stud"; //sharedpreference Book + public static final String PrefID_RegID = "prefid_regid"; // + public static final String PrefID_SName = "prefid_sname"; // + public static final String PrefID_PM_SName = "prefid_pmsname"; // + public static final String PrefID_PM_S_MID = "prefid_pm_s_mid"; // + public static final String PrefID_SLeadID = "prefid_sleadid"; // + public static final String PrefID_PM_SEmailID = "prefid_pm_semailid"; // + public static final String PrefID_SCellNo = "prefid_scellno"; // + public static final String PrefID_Role = "prefid_role"; + public static final String PrefID_SCollegeName = "prefid_scollegename"; + public static final String PrefID_SImageUrl = "prefid_simgUrl"; + + public static final String PrefId_S_Gender = "prefid_sgender"; + public static final String PrefId_S_StarCount = "prefid_sstarCount"; + + public static final String PrefID_S_ImgBase64 = "prefid_s_imgBase64"; // + public static final String PrefID_PM_ImgBase64 = "prefid_pm_imgBase64"; + + + public static final String PrefID_SStudentType = "prefid_sstudentType"; // + public static final String PrefID_SSisStudentLEADer ="prefid_ssisStudentLEADer"; + + public static final String PrefId_S_TshirtStatus = "prefid_s_tshirtstatus"; + + public static final String PrefID_SLLP = "prefID_SLLP"; + public static final String PrefID_SPrayana = "prefID_SPrayana"; + public static final String PrefID_SYuva = "prefID_SYuva"; + public static final String PrefID_SValedicotry = "prefID_SValedicotry"; + + SharedPreferences shardpref_S_obj; + + private TextView txt_studName; + private TextView txt_studCollegeName; + private TextView txt_studType; + private TextView txt_leadId; + private ImageView img_studProfPick; + private ImageView img_crownMan,img_crownWoman,img_studProfPick1,star_count,img_studProfPick2; + private TextView txt_noOfProjects; + private View view; + private String str_leadId,str_studName,str_role,str_collegeName,str_studImgUrl,str_username,str_password,str_s_studentType,str_s_isStudentLEADer; + + private String str_regId,str_s_gender,str_s_starCount,str_tshirt_status,str_managerId; + private String str_LLP,str_Prayana,str_Yuva,str_Valedicotry; + private Result result; + private String getResult; + + SharedPreferences.Editor editor_S; + public static final String PrefId_S_Password = "prefid_spassword"; + public static final String PrefId_S_Username = "prefid_susername"; + private String serverPath = Class_URL.ServerPath.toString().trim(); + + private FrameLayout fram_layout; + private LinearLayout bages; + ImageView img_badge1,img_badge2,img_badge3,img_badge4; + ShimmerFrameLayout container1,container2,container3,container4; + TextView badge1text,badge2text,badge3text,badge4text; + private int starCount; + // private Button btn_apply; + private ImageView btn_TshirtApply; + + private StateProgressBar stateProgressBar; + public static final String PrefId_S_IsFeesPaid = "prefid_sfeesPaid"; + private String str_isFeesPaid,str_gettshirtlistresponse,str_getTshirtStatus; + + + + Class_InternetDectector internetDectector; + Boolean isInternetPresent = false; + + String Str_tshirterror1,Str_tshirterror2,str_tshirtresponse,str_tshirtsize; + RadioGroup rg_tshirtradiogroup; + private RadioButton rb_tshirtradiobutton; + ImageView h_student,h_initiator,h_cm,h_leader,h_ml,h_amb; + private PulsatorLayout mPulsator1,mPulsator2,mPulsator3,mPulsator4,mPulsator5,mPulsator6; + + + + View stud_right,initiater_left,initiater_right,cm_left,cm_right,leader_left,leader_right,ml_left,ml_right,amb_left; + TextView stud_tv,initiater_tv,cm_tv,leader_tv,ml_tv,amb_tv; + Dialog myDialog; + ImageView ib_close; + JustifiedTextView tv_popupinfo; + TextView popupHeader; + + // LinearLayout popup; + + + String str_getTshirt_requestedID,str_getTshirt_tshirtSize,str_Tshirt_applySecondTime,str_reasontochange; + + @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) + { + view = inflater.inflate(R.layout.myprofile_fragment_new, container, false); + context = getActivity().getBaseContext(); + + + Str_tshirterror1=Str_tshirterror2=str_getTshirt_requestedID=str_Tshirt_applySecondTime="no"; + + initializeViews(); + + + + + shardpref_S_obj=getActivity().getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + + if(getActivity().getIntent().hasExtra("fromeditProfile")) + { + getResult = getActivity().getIntent().getStringExtra("fromeditProfile"); + Log.d("GetResultsss",getResult); + + + shardpref_S_obj.getString(PrefId_S_Username, "").trim(); + str_username = shardpref_S_obj.getString(PrefId_S_Username, "").trim(); + Log.d("str_username",str_username); + + + shardpref_S_obj.getString(PrefId_S_Password, "").trim(); + str_password = shardpref_S_obj.getString(PrefId_S_Password, "").trim(); + Log.d("str_password",str_password); + + shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + str_leadId = shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + + str_regId = shardpref_S_obj.getString(PrefID_RegID, "").trim(); + str_managerId = shardpref_S_obj.getString(PrefID_PM_S_MID, "").trim(); + + + + shardpref_S_obj.getString(PrefId_S_Gender,"").trim(); + str_s_gender = shardpref_S_obj.getString(PrefId_S_Gender, "").trim(); + + shardpref_S_obj.getString(PrefId_S_StarCount,"").trim(); + str_s_starCount = shardpref_S_obj.getString(PrefId_S_StarCount, "").trim(); + starCount = Integer.parseInt(str_s_starCount); + + + str_tshirt_status = shardpref_S_obj.getString(PrefId_S_TshirtStatus, "").trim(); + + str_LLP = shardpref_S_obj.getString(PrefID_SLLP, "").trim(); + str_Prayana = shardpref_S_obj.getString(PrefID_SPrayana, "").trim(); + str_Yuva = shardpref_S_obj.getString(PrefID_SYuva, "").trim(); + str_Valedicotry = shardpref_S_obj.getString(PrefID_SValedicotry, "").trim(); + + + if(starCount>0){ + img_studProfPick1.setVisibility(View.VISIBLE); + fram_layout.setVisibility(View.GONE); + // bages.setVisibility(View.VISIBLE); + if(str_s_gender.equals("M")){ + + // img_crownWoman.setVisibility(View.GONE); + // img_crownMan.setVisibility(View.VISIBLE); + star_count.setVisibility(View.VISIBLE); + txt_noOfProjects.setText(str_s_starCount); + txt_noOfProjects.setVisibility(View.VISIBLE); + }else{ + + // img_crownWoman.setVisibility(View.VISIBLE); + // img_crownMan.setVisibility(View.GONE); + star_count.setVisibility(View.VISIBLE); + txt_noOfProjects.setText(str_s_starCount); + txt_noOfProjects.setVisibility(View.VISIBLE); + } + } + + + if(!str_Prayana.equals("0")){ + bages.setVisibility(View.VISIBLE); + img_badge1.setVisibility(View.VISIBLE); + badge1text.setVisibility(View.VISIBLE); + badge1text.setText(str_Prayana); + container1.startShimmer(); + result = new Result(); + }else{ + // bages.setVisibility(View.GONE); + img_badge1.setVisibility(View.GONE); + badge1text.setVisibility(View.GONE); + container1.stopShimmer(); + result = new Result(); + } + if(!str_Yuva.equals("0")){ + bages.setVisibility(View.VISIBLE); + img_badge2.setVisibility(View.VISIBLE); + badge2text.setVisibility(View.VISIBLE); + badge2text.setText(str_Yuva); + container2.startShimmer(); + result = new Result(); + }else{ + // bages.setVisibility(View.GONE); + img_badge2.setVisibility(View.GONE); + badge2text.setVisibility(View.GONE); + container2.stopShimmer(); + result = new Result(); + } + if(!str_Valedicotry.equals("0")){ + bages.setVisibility(View.VISIBLE); + img_badge3.setVisibility(View.VISIBLE); + badge3text.setVisibility(View.VISIBLE); + badge3text.setText(str_Valedicotry); + container3.startShimmer(); + result = new Result(); + }else{ + // bages.setVisibility(View.GONE); + badge3text.setVisibility(View.GONE); + img_badge3.setVisibility(View.GONE); + container3.stopShimmer(); + result = new Result(); + } + if(!str_LLP.equals("0")){ + bages.setVisibility(View.VISIBLE); + img_badge4.setVisibility(View.VISIBLE); + badge4text.setVisibility(View.VISIBLE); + badge4text.setText(str_LLP); + container4.startShimmer(); + result = new Result(); + }else{ + // bages.setVisibility(View.GONE); + img_badge4.setVisibility(View.GONE); + badge4text.setVisibility(View.GONE); + container4.stopShimmer(); + result = new Result(); + } + + GetStudentDetails getStudentDetails = new GetStudentDetails(getActivity()); + getStudentDetails.execute(str_leadId); + + + + + } + + //getStudentDetails(); + else { + + shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + str_leadId = shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + + shardpref_S_obj.getString(PrefID_RegID, "").trim(); + str_regId = shardpref_S_obj.getString(PrefID_RegID, "").trim(); + + str_managerId = shardpref_S_obj.getString(PrefID_PM_S_MID, "").trim(); + + shardpref_S_obj.getString(PrefID_SName, "").trim(); + str_studName = shardpref_S_obj.getString(PrefID_SName, "").trim(); + + shardpref_S_obj.getString(PrefID_Role, "").trim(); + str_role = shardpref_S_obj.getString(PrefID_Role, "").trim(); + + shardpref_S_obj.getString(PrefID_SCollegeName, "").trim(); + str_collegeName = shardpref_S_obj.getString(PrefID_SCollegeName, "").trim(); + + + shardpref_S_obj.getString(PrefID_SImageUrl, "").trim(); + str_studImgUrl = shardpref_S_obj.getString(PrefID_SImageUrl, "").trim(); + + + shardpref_S_obj.getString(PrefID_SStudentType, "").trim(); + str_s_studentType = shardpref_S_obj.getString(PrefID_SStudentType, "").trim(); + + shardpref_S_obj.getString(PrefID_SSisStudentLEADer, "").trim(); + str_s_isStudentLEADer = shardpref_S_obj.getString(PrefID_SSisStudentLEADer, "").trim(); + + shardpref_S_obj.getString(PrefId_S_Gender,"").trim(); + str_s_gender = shardpref_S_obj.getString(PrefId_S_Gender, "").trim(); + + shardpref_S_obj.getString(PrefId_S_StarCount,"").trim(); + str_s_starCount = shardpref_S_obj.getString(PrefId_S_StarCount, "").trim(); + starCount = Integer.parseInt(str_s_starCount); + + + + str_tshirt_status = shardpref_S_obj.getString(PrefId_S_TshirtStatus, "").trim(); + + + str_LLP = shardpref_S_obj.getString(PrefID_SLLP, "").trim(); + str_Prayana = shardpref_S_obj.getString(PrefID_SPrayana, "").trim(); + str_Yuva = shardpref_S_obj.getString(PrefID_SYuva, "").trim(); + str_Valedicotry = shardpref_S_obj.getString(PrefID_SValedicotry, "").trim(); + + + /* str_Prayana="1"; + str_LLP="0"; + str_Yuva="1";*/ + + if (str_studName != null && !str_studName.isEmpty() && str_studName != "" && !str_studName.equals("anyType{}")) { + txt_studName.setText(str_studName); + } + + if (str_leadId != null && !str_leadId.isEmpty() && str_leadId != "" && !str_leadId.equals("anyType{}")) { + txt_leadId.setText(str_leadId); + } + + if (str_collegeName != null && !str_collegeName.isEmpty() && str_collegeName != "" && !str_collegeName.equals("anyType{}")) { + txt_studCollegeName.setText(str_collegeName); + } + + /* if (str_role != null && !str_role.isEmpty() && str_role != "" && !str_role.equals("anyType{}")) { + txt_studType.setText(str_role); + }*/ + + if (str_s_studentType != null && !str_s_studentType.isEmpty() && str_s_studentType != "" && !str_s_studentType.equals("anyType{}")) { + txt_studType.setText(str_s_studentType); + } + + + if (!str_studImgUrl.equals(null) && !str_studImgUrl.equalsIgnoreCase("null") && !str_studImgUrl.isEmpty() && str_studImgUrl != "" && !str_studImgUrl.equals("anyType{}") && str_studImgUrl != "{}") { + Log.d("InsideLoadProfile", "Pick"); + + LoadStudProfilePick loadStudProfilePick = new LoadStudProfilePick(getActivity()); + loadStudProfilePick.execute(); + + + /*Glide.with(getActivity()).load(str_studImgUrl) + .thumbnail(0.5f) + .crossFade() + .diskCacheStrategy(DiskCacheStrategy.ALL) + .into(img_studProfPick);*/ + + + + /* if (img_studProfPick1.getVisibility() == View.VISIBLE) { + //img_studProfPick1.setImageBitmap(result); + Glide.with(getActivity()).load(str_studImgUrl) + .thumbnail(0.5f) + .crossFade() + .diskCacheStrategy(DiskCacheStrategy.ALL) + .into(img_studProfPick1); + } else { + //img_studProfPick.setImageBitmap(result); + + Glide.with(getActivity()).load(str_studImgUrl) + .thumbnail(0.5f) + .crossFade() + .diskCacheStrategy(DiskCacheStrategy.ALL) + .into(img_studProfPick); + }*/ + + + /* if(img_studProfPick1.getVisibility()==View.VISIBLE){ + + //Log.d("studentbitmapss:",StudentPMImageBitmap.getStudBitmap().toString()); + + shardpref_S_obj.getString(PrefID_S_ImgBase64,"").trim(); + String str_s_imgBase64 = shardpref_S_obj.getString(PrefID_S_ImgBase64, "").trim(); + + Log.d("str_s_imgBase64issss",str_s_imgBase64); + + *//* byte[] byteArray = Base64.decode(str_s_imgBase64, Base64.DEFAULT); + Bitmap bitmap = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length); + img_studProfPick1.setImageBitmap(bitmap);*//* + try { + if (!str_s_imgBase64.equalsIgnoreCase("")) { + Log.d("str_s_imgBase64issss", str_s_imgBase64); + byte[] b = Base64.decode(str_s_imgBase64, Base64.DEFAULT); + Bitmap bitmap = BitmapFactory.decodeByteArray(b, 0, b.length); + img_studProfPick1.setImageBitmap(bitmap); + } + }catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + + //img_studProfPick1.setImageBitmap(StudentPMImageBitmap.getStudBitmap()); + +*//* byte[] imageinbytesArray={0}; + + Bitmap yourImage = StudentPMImageBitmap.getStudBitmap(); + + + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + yourImage.compress(Bitmap.CompressFormat.PNG, 100, stream); + //imageInByte; + imageinbytesArray = stream.toByteArray(); + // Log.e("output before conversion", imageInByte.toString()); + // Log.d("Insert: ", "Inserting ..image"); + Bitmap bm = BitmapFactory.decodeByteArray(imageinbytesArray, 0, imageinbytesArray.length);*//* + // Log.d("Insert image report: ",bm.toString() ); + + //studPickBase64 = Base64.encodeToString(imageinbytesArray, Base64.DEFAULT); + //img_studProfPick1.setImageBitmap(bm); + + } + else{ + //img_studProfPick.setImageBitmap(StudentPMImageBitmap.getStudBitmap()); + + shardpref_S_obj.getString(PrefID_S_ImgBase64,"").trim(); + String str_s_imgBase64 = shardpref_S_obj.getString(PrefID_S_ImgBase64, "").trim(); + + + + try { + if (!str_s_imgBase64.equalsIgnoreCase("")) { + byte[] b = Base64.decode(str_s_imgBase64, Base64.DEFAULT); + Bitmap bitmap = BitmapFactory.decodeByteArray(b, 0, b.length); + img_studProfPick.setImageBitmap(bitmap); + } + }catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + + + }*/ + + } + + if(starCount>0){ + img_studProfPick1.setVisibility(View.VISIBLE); + fram_layout.setVisibility(View.GONE); + // bages.setVisibility(View.VISIBLE); + + if(str_s_gender.equals("M")){ + + + + // img_crownWoman.setVisibility(View.GONE); + // img_crownMan.setVisibility(View.VISIBLE); + + /* RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( + RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); + + params.setMargins(-40,0,0,0); + txt_noOfProjects.setLayoutParams(params);*/ + star_count.setVisibility(View.VISIBLE); + txt_noOfProjects.setText(str_s_starCount); + txt_noOfProjects.setVisibility(View.VISIBLE); + + + }else{ + + /* img_studProfPick1.setVisibility(View.VISIBLE); + fram_layout.setVisibility(View.GONE);*/ + + // img_crownWoman.setVisibility(View.VISIBLE); +// img_crownMan.setVisibility(View.GONE); + + star_count.setVisibility(View.VISIBLE); + + + + + /* RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( + RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); + + params.setMargins(-20,0,0,0); + txt_noOfProjects.setLayoutParams(params);*/ + txt_noOfProjects.setText(str_s_starCount); + txt_noOfProjects.setVisibility(View.VISIBLE); + } + } + + + if(!str_Prayana.equals("0")){ + bages.setVisibility(View.VISIBLE); + img_badge1.setVisibility(View.VISIBLE); + badge1text.setVisibility(View.VISIBLE); + badge1text.setText(str_Prayana); + container1.startShimmer(); + result = new Result(); + }else{ + // bages.setVisibility(View.GONE); + img_badge1.setVisibility(View.GONE); + badge1text.setVisibility(View.GONE); + container1.stopShimmer(); + result = new Result(); + } + if(!str_Yuva.equals("0")){ + bages.setVisibility(View.VISIBLE); + img_badge2.setVisibility(View.VISIBLE); + badge2text.setVisibility(View.VISIBLE); + badge2text.setText(str_Yuva); + container2.startShimmer(); + result = new Result(); + }else{ + // bages.setVisibility(View.GONE); + img_badge2.setVisibility(View.GONE); + badge2text.setVisibility(View.GONE); + container2.stopShimmer(); + result = new Result(); + } + if(!str_Valedicotry.equals("0")){ + bages.setVisibility(View.VISIBLE); + img_badge3.setVisibility(View.VISIBLE); + badge3text.setVisibility(View.VISIBLE); + badge3text.setText(str_Valedicotry); + container3.startShimmer(); + result = new Result(); + }else{ + // bages.setVisibility(View.GONE); + badge3text.setVisibility(View.GONE); + img_badge3.setVisibility(View.GONE); + container3.stopShimmer(); + result = new Result(); + } + if(!str_LLP.equals("0")){ + bages.setVisibility(View.VISIBLE); + img_badge4.setVisibility(View.VISIBLE); + badge4text.setVisibility(View.VISIBLE); + badge4text.setText(str_LLP); + container4.startShimmer(); + result = new Result(); + }else{ + // bages.setVisibility(View.GONE); + img_badge4.setVisibility(View.GONE); + badge4text.setVisibility(View.GONE); + container4.stopShimmer(); + result = new Result(); + } + + //Toast.makeText(getActivity(),"Inside My Profile",Toast.LENGTH_SHORT).show(); + + + } + + + shardpref_S_obj.getString(PrefID_SStudentType, "").trim(); + str_s_studentType = shardpref_S_obj.getString(PrefID_SStudentType, "").trim(); + + shardpref_S_obj.getString(PrefID_SSisStudentLEADer, "").trim(); + str_s_isStudentLEADer = shardpref_S_obj.getString(PrefID_SSisStudentLEADer, "").trim(); + + stateProgressBar = (StateProgressBar) view.findViewById(R.id.usage_stateprogressbar); + stateProgressBar.setStateDescriptionData(descriptionData); + + if (str_s_studentType.equals("Student")) { + //stateProgressBar.setCurrentStateNumber(StateProgressBar.StateNumber.ONE); + h_student.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.colorWhite))); + mPulsator1.start(); + } + + if (str_s_studentType.equals("Initiator")) { + // stateProgressBar.setCurrentStateNumber(StateProgressBar.StateNumber.TWO); + h_student.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.colorPerpule))); + h_initiator.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.colorWhite))); + mPulsator2.start(); + // GetLeaderStatus getLeaderStatus = new GetLeaderStatus(getActivity()); + // getLeaderStatus.execute(); + } + if (str_s_studentType.equals("Change Maker")) { + //stateProgressBar.setCurrentStateNumber(StateProgressBar.StateNumber.THREE); + h_student.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.colorPerpule))); + h_initiator.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.colorPerpule))); + h_cm.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.colorWhite))); + + stud_right.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.colorPerpule)); + initiater_left.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.colorPerpule)); + initiater_right.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.colorPerpule)); + cm_left.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.colorPerpule)); + stud_tv.setTextColor(ContextCompat.getColor(getContext(),R.color.colorPerpule)); + initiater_tv.setTextColor(ContextCompat.getColor(getContext(),R.color.colorPerpule)); + cm_tv.setTextColor(ContextCompat.getColor(getContext(),R.color.colorPerpule)); + + + mPulsator3.start(); + } + if (str_s_studentType.equals("LEADer")) { + //stateProgressBar.setCurrentStateNumber(StateProgressBar.StateNumber.FOUR); + h_student.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.colorPerpule))); + h_initiator.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.colorPerpule))); + h_cm.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.colorPerpule))); + h_leader.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.colorWhite))); + + + + stud_right.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.colorPerpule)); + initiater_left.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.colorPerpule)); + initiater_right.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.colorPerpule)); + cm_left.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.colorPerpule)); + cm_right.setBackgroundColor(ContextCompat.getColor(getContext(),R.color.colorPerpule)); + + leader_left.setBackgroundColor(ContextCompat.getColor(getContext(),R.color.colorPerpule)); + stud_tv.setTextColor(ContextCompat.getColor(getContext(),R.color.colorPerpule)); + initiater_tv.setTextColor(ContextCompat.getColor(getContext(),R.color.colorPerpule)); + cm_tv.setTextColor(ContextCompat.getColor(getContext(),R.color.colorPerpule)); + leader_tv.setTextColor(ContextCompat.getColor(getContext(),R.color.colorPerpule)); + + + mPulsator4.start(); + GetLeaderStatus getLeaderStatus = new GetLeaderStatus(getActivity()); + getLeaderStatus.execute(); + } + if (str_s_studentType.equals("Master Leader")) { + //stateProgressBar.setCurrentStateNumber(StateProgressBar.StateNumber.FIVE); + if(Integer.valueOf(str_s_isStudentLEADer)<1){ + h_leader.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.light_gray))); + leader_tv.setTextColor(ContextCompat.getColor(getContext(),R.color.light_gray)); + }else + { + h_leader.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.colorPerpule))); + leader_tv.setTextColor(ContextCompat.getColor(getContext(),R.color.colorPerpule)); + } + h_student.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.colorPerpule))); + h_initiator.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.colorPerpule))); + h_cm.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.colorPerpule))); + + h_ml.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.colorWhite))); + + + stud_right.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.colorPerpule)); + initiater_left.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.colorPerpule)); + initiater_right.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.colorPerpule)); + cm_left.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.colorPerpule)); + cm_right.setBackgroundColor(ContextCompat.getColor(getContext(),R.color.colorPerpule)); + leader_left.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.colorPerpule)); + leader_right.setBackgroundColor(ContextCompat.getColor(getContext(),R.color.colorPerpule)); + ml_left.setBackgroundColor(ContextCompat.getColor(getContext(),R.color.colorPerpule)); + + stud_tv.setTextColor(ContextCompat.getColor(getContext(),R.color.colorPerpule)); + initiater_tv.setTextColor(ContextCompat.getColor(getContext(),R.color.colorPerpule)); + cm_tv.setTextColor(ContextCompat.getColor(getContext(),R.color.colorPerpule)); + ml_tv.setTextColor(ContextCompat.getColor(getContext(),R.color.colorPerpule)); + + + + mPulsator5.start(); + GetMasterStatus getMasterStatus = new GetMasterStatus(getActivity()); + getMasterStatus.execute(); + + } + + if (str_s_studentType.equals("Lead Ambassador")) { + // stateProgressBar.setCurrentStateNumber(StateProgressBar.StateNumber.FIVE); + h_student.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.colorPerpule))); + h_initiator.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.colorPerpule))); + h_cm.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.colorPerpule))); + //h_leader.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.colorPerpule))); + + if(Integer.valueOf(str_s_isStudentLEADer)<1){ + h_leader.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.light_gray))); + leader_tv.setTextColor(ContextCompat.getColor(getContext(),R.color.light_gray)); + }else + { + h_leader.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.colorPerpule))); + leader_tv.setTextColor(ContextCompat.getColor(getContext(),R.color.colorPerpule)); + } + + + + + h_ml.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.colorPerpule))); + + + stud_right.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.colorPerpule)); + initiater_left.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.colorPerpule)); + initiater_right.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.colorPerpule)); + cm_left.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.colorPerpule)); + cm_right.setBackgroundColor(ContextCompat.getColor(getContext(),R.color.colorPerpule)); + leader_left.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.colorPerpule)); + leader_right.setBackgroundColor(ContextCompat.getColor(getContext(),R.color.colorPerpule)); + ml_left.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.colorPerpule)); + ml_right.setBackgroundColor(ContextCompat.getColor(getContext(),R.color.colorPerpule)); + amb_left.setBackgroundColor(ContextCompat.getColor(getContext(),R.color.colorPerpule)); + + stud_tv.setTextColor(ContextCompat.getColor(getContext(),R.color.colorPerpule)); + initiater_tv.setTextColor(ContextCompat.getColor(getContext(),R.color.colorPerpule)); + cm_tv.setTextColor(ContextCompat.getColor(getContext(),R.color.colorPerpule)); + ml_tv.setTextColor(ContextCompat.getColor(getContext(),R.color.colorPerpule)); + amb_tv.setTextColor(ContextCompat.getColor(getContext(),R.color.colorPerpule)); + + + + h_amb.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.colorWhite))); + mPulsator6.start(); + } + + /* h_initiator.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + popup.setVisibility(View.VISIBLE); + } + });*/ + + h_initiator.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + ib_close.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + myDialog.dismiss(); + } + }); + popupHeader.setText("Initiator"); + tv_popupinfo.setText("Any one fix the issue/any initiative by spending less than 8 hours of time."); + myDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); + myDialog.show(); + } + }); + h_cm.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + ib_close.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + myDialog.dismiss(); + } + }); + popupHeader.setText("Change Maker"); + tv_popupinfo.setText("The one who engaged for 8 hours of minimum time and makes a feasible/visible/countable change in the community/people."); + myDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); + myDialog.show(); + } + }); + h_leader.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + ib_close.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + myDialog.dismiss(); + } + }); + popupHeader.setText("Leader"); + tv_popupinfo.setText("The one who works in a team, lead a minimum of three members make a change in the community/people, works minimum for a month with the same or changed team on same or new initiatives. Contributing a minimum of 30 hours."); + myDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); + myDialog.show(); + } + }); + h_ml.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + ib_close.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + myDialog.dismiss(); + } + }); + popupHeader.setText("Master Leader"); + tv_popupinfo.setText("The one who completes the change maker or leader phase\n" + + "\n" + + "• Minimum 3 projects or long term involvement in one the project which has a bigger impact\n" + + "\n" + + "• Minimum 6 months engagement with LEAD Program"); + myDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); + myDialog.show(); + } + }); + h_amb.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + ib_close.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + myDialog.dismiss(); + } + }); + popupHeader.setText("LEAD Ambassador"); + tv_popupinfo.setText("•Master LEADer who is active for three months is only eligible.\n" + + "\n" + + "• Qualifying personal interview.\n" + + "\n" + + "Should have a specific plan of action at least for the next 6 months. (Impact or entrepreneurial project or support team to LEAD)\n" + + "\n" + + "• Completed 1 academic year in the LEAD Program."); + myDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); + myDialog.show(); + } + }); + + + + shardpref_S_obj.getString(PrefId_S_IsFeesPaid, "").trim(); + str_isFeesPaid = shardpref_S_obj.getString(PrefId_S_IsFeesPaid, "").trim(); + Log.d("FeesPaidisssssss",str_isFeesPaid); + + + GridView gridView = (GridView) view.findViewById(R.id.gridview); + GridAdapter gridAdapter = new GridAdapter(getActivity());//GridAdapter.java + gridAdapter.setStr_isFeesPaid(str_isFeesPaid); + gridView.setAdapter(gridAdapter); + + GridView gridViewSecond = (GridView) view.findViewById(R.id.gridview1); + gridViewSecond.setAdapter(new GridAdapterSecond(getActivity())); //GridAdapterSecond.java + + + + + /* projectDetails_IV = (ImageView) view.findViewById(R.id.projectDetails_IV); + projectDetails_IV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if(str_isFeesPaid.equals("1")) { + Intent itthomeToProject = new Intent(getActivity().getBaseContext(), ProjectDetails.class); + // itthomeToProject.putExtra("From","Student"); + startActivity(itthomeToProject); + }else{ + Toast.makeText(getActivity(),"You have not paid the fees. Please contact Project Manager",Toast.LENGTH_LONG).show(); + } + } + }); + projectDetails_TV = (TextView) view.findViewById(R.id.projectDetails_TV); + projectDetails_TV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToProject = new Intent(getActivity().getBaseContext(), ProjectDetails.class); + // itthomeToProject.putExtra("From","Student"); + startActivity(itthomeToProject); + } + }); + + events_IV = (ImageView) view.findViewById(R.id.events_IV); + events_IV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToEvent = new Intent(getActivity().getBaseContext(), EventsActivity.class); + // itthomeToEvent.putExtra("From","Student"); + //Intent itthomeToEvent = new Intent(getActivity().getBaseContext(), TestActivity2.class); + startActivity(itthomeToEvent); + } + }); + events_TV = (TextView) view.findViewById(R.id.events_TV); + events_TV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToEvent = new Intent(getActivity().getBaseContext(), EventsActivity.class); + // itthomeToEvent.putExtra("From","Student"); + //Intent itthomeToEvent = new Intent(getActivity().getBaseContext(), TestActivity2.class); + startActivity(itthomeToEvent); + } + }); + + news_IV = (ImageView) view.findViewById(R.id.news_IV); + news_IV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToNewsFeeds = new Intent(getActivity().getBaseContext(), NewsFeedsActivity.class); + // itthomeToNewsFeeds.putExtra("From","Student"); + startActivity(itthomeToNewsFeeds); + } + }); + news_TV = (TextView) view.findViewById(R.id.news_TV); + news_TV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToNewsFeeds = new Intent(getActivity().getBaseContext(), NewsFeedsActivity.class); + // itthomeToNewsFeeds.putExtra("From","Student"); + startActivity(itthomeToNewsFeeds); + } + }); + + about_IV = (ImageView) view.findViewById(R.id.about_IV); + about_IV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToAboutUs = new Intent(getActivity().getBaseContext(), AboutUsActivity.class); + itthomeToAboutUs.putExtra("From","Student"); + startActivity(itthomeToAboutUs); + } + }); + about_TV = (TextView) view.findViewById(R.id.about_TV); + about_TV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToAboutUs = new Intent(getActivity().getBaseContext(), AboutUsActivity.class); + itthomeToAboutUs.putExtra("From","Student"); + startActivity(itthomeToAboutUs); + } + }); + + contactus_IV = (ImageView) view.findViewById(R.id.contactus_IV); + contactus_IV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToAboutUs = new Intent(getActivity().getBaseContext(), ContactUsActivity.class); + itthomeToAboutUs.putExtra("From","Student"); + startActivity(itthomeToAboutUs); + } + }); + contactus_TV = (TextView) view.findViewById(R.id.contactus_TV); + contactus_TV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToAboutUs = new Intent(getActivity().getBaseContext(), ContactUsActivity.class); + itthomeToAboutUs.putExtra("From","Student"); + startActivity(itthomeToAboutUs); + } + }); + + +*/ + + + + + + + + + + + + /* lnrlyt_viewProfile = (LinearLayout) view.findViewById(R.id.lnrlyt_viewProfile); + if(lnrlyt_viewProfile.getVisibility()==View.VISIBLE) { + + lnrlyt_projDtls = (LinearLayout) view.findViewById(R.id.lnrlyt_projectDtls); + lnrlyt_projDtls.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToProject = new Intent(getActivity().getBaseContext(), ProjectDetails.class); + startActivity(itthomeToProject); + } + }); + + lnrlyt_events = (LinearLayout) view.findViewById(R.id.lnrlyt_events); + lnrlyt_events.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToEvent = new Intent(getActivity().getBaseContext(), EventsActivity.class); + startActivity(itthomeToEvent); + } + }); + + lnrlyt_newsfeeds = (LinearLayout) view.findViewById(R.id.lnrlyt_newsfeeds); + lnrlyt_newsfeeds.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToNewsFeeds = new Intent(getActivity().getBaseContext(), NewsFeedsActivity.class); + startActivity(itthomeToNewsFeeds); + } + }); + + } + + else{ + spin_state = (AppCompatSpinner) view.findViewById(R.id.spin_state); + spin_city = (AppCompatSpinner) view.findViewById(R.id.spin_city); + spin_institution = (AppCompatSpinner) view.findViewById(R.id.spin_institution); + spin_semester = (AppCompatSpinner) view.findViewById(R.id.spin_sem); + edt_dob = (EditText) view.findViewById(R.id.edt_dob); + + + setStateSpinner(view); + setCitySpinner(view); + setInstitutionSpinner(view); + setSemesterSpinner(view); + + setDateOfBirth(view); + }*/ + + editor_S = shardpref_S_obj.edit(); + /*btn_apply.setOnClickListener(new View.OnClickListener() + { + @Override + public void onClick(View v) { + if(str_s_studentType.equals("Leader")){ + ApplyForMasterLeader applyForMasterLeader = new ApplyForMasterLeader(getActivity()); + applyForMasterLeader.execute(); + + stateProgressBar.setCurrentStateNumber(StateProgressBar.StateNumber.THREE); + + str_s_studentType = "Master Leader"; + txt_studType.setText(str_s_studentType); + editor_S.putString(PrefID_SStudentType,str_s_studentType); + editor_S.commit(); + + } + + if(str_s_studentType.equals("Master Leader")){ + ApplyForAmbassador applyForAmbassador = new ApplyForAmbassador(getActivity()); + applyForAmbassador.execute(); + + stateProgressBar.setCurrentStateNumber(StateProgressBar.StateNumber.FOUR); + + str_s_studentType = "Lead Ambassador"; + txt_studType.setText(str_s_studentType); + editor_S.putString(PrefID_SStudentType,str_s_studentType); + editor_S.commit(); + } + } + });*/ + + + +// for T-shirt request + //1: eligible for T-shirt ,2-requested but not approved by PM + //3- already given Tshirt + if(str_tshirt_status.equals("1")||str_tshirt_status.equals("2")) + { + bages.setVisibility(View.VISIBLE); + btn_TshirtApply.setVisibility(View.VISIBLE); + Animation startAnimation = AnimationUtils.loadAnimation(getActivity(), R.anim.blinking_animation); + btn_TshirtApply.startAnimation(startAnimation); + + GetTshirtlist_AsyncCallWS task = new GetTshirtlist_AsyncCallWS(getActivity()); + task.execute(); + + + + + btn_TshirtApply.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) + { + final Dialog myDialog = new Dialog(getActivity()); + myDialog.setContentView(R.layout.tshirt_customdialog); + myDialog.setCancelable(false); + + rg_tshirtradiogroup =(RadioGroup)myDialog.findViewById(R.id. tshirtradiogroup_RG); + Button dialog_bt_tshirtapply= (Button) myDialog.findViewById(R.id.tshirtapply_BT); + Button dialog_bt_tshirtcancel= (Button) myDialog.findViewById(R.id.tshirtcancel_BT); + TextView previous_request_tv =(TextView)myDialog.findViewById(R.id.previous_request_tv); + + if(str_gettshirtlistresponse.equals("Success")) + { + previous_request_tv.setVisibility(View.VISIBLE); + previous_request_tv.setText("Previous request was:"+str_getTshirt_tshirtSize.toString()); + }else{previous_request_tv.setVisibility(View.GONE);} + + + dialog_bt_tshirtapply.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) + { + int selectedId = rg_tshirtradiogroup.getCheckedRadioButtonId(); + + rb_tshirtradiobutton = (RadioButton) myDialog.findViewById(selectedId); + + String string= rb_tshirtradiobutton.getText().toString().trim(); + String[] vals = string.split(" "); + if (vals.length > 1) + { str_tshirtsize = vals[0]; } + + internetDectector = new Class_InternetDectector(getActivity()); + isInternetPresent = internetDectector.isConnectingToInternet(); + + /* Toast.makeText(getActivity(),"RegID: "+str_regId.toString(),Toast.LENGTH_LONG).show(); + Toast.makeText(getActivity(),"LeadID: "+str_leadId.toString(),Toast.LENGTH_LONG).show(); + Toast.makeText(getActivity(),"ManagerID: "+str_managerId.toString(),Toast.LENGTH_LONG).show(); + Toast.makeText(getActivity(),"StudentName: "+str_studName.toString(),Toast.LENGTH_LONG).show(); + Toast.makeText(getActivity(),"T-shirtSize: "+str_tshirtsize.toString(),Toast.LENGTH_LONG).show(); +*/ + //str_studName + + //Toast.makeText(getActivity(),"ManagerID"+str_leadId.toString(),Toast.LENGTH_LONG).show(); + + if (isInternetPresent) + { + TshirtRequest_AsyncCallWS task = new TshirtRequest_AsyncCallWS(getActivity()); + task.execute(); + myDialog.cancel(); + } + else + { + Toast.makeText(getActivity(),"No Internet",Toast.LENGTH_LONG).show(); + } + + } + }); + + + + dialog_bt_tshirtcancel.setOnClickListener(new View.OnClickListener() + { + @Override + public void onClick(View v) { + + myDialog.cancel(); + } + }); + + myDialog.show(); + } + }); + + }else if(str_tshirt_status.equals("3")) + { btn_TshirtApply.setVisibility(View.GONE); } + else{ btn_TshirtApply.setVisibility(View.GONE); + + } + + + + + + + return view; + + }// end of onCreateView + + + public class GetLeaderStatus extends AsyncTask { + + GetLeaderStatus (Context ctx){ + context = ctx; + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapObject response = getLeaderStatus(); + + //Log.d("Soapresponseissssss",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + } + + @Override + protected void onPostExecute(SoapObject result) { + + if(result!=null) { + SoapPrimitive S_Status; + Object O_Status; + String str_status = null; + + Log.d("Resultssssss", result.toString()); + + O_Status = result.getProperty("Status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) result.getProperty("Status"); + Log.d("Status:", S_Status.toString()); + str_status = S_Status.toString(); + } + Log.d("str_statusissssss", str_status); + + /* if (Integer.valueOf(str_status) == 1) { + btn_apply.setVisibility(View.GONE); + } + if (Integer.valueOf(str_status) == 2) { + btn_apply.setText("Applied"); + btn_apply.setVisibility(View.GONE); + }*/ + } + + + } + } + + private SoapObject getLeaderStatus() { + String METHOD_NAME = "Getleadmemberdetails"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/Getleadmemberdetails"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + request.addProperty("leadId",str_leadId); + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + envelope.setOutputSoapObject(request); + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Projects.toString().trim()); + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + SoapObject response = (SoapObject) envelope.getResponse(); + Log.e("soapcompletionxxxx",response.toString()); + return response; + + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + } + + + public class GetMasterStatus extends AsyncTask { + + GetMasterStatus (Context ctx){ + context = ctx; + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapObject response = getMasterStatus(); + + //Log.d("Soapresponseissssss",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + } + + @Override + protected void onPostExecute(SoapObject result) { + + if(result!=null) { + SoapPrimitive S_Status; + Object O_Status; + String str_status = null; + + Log.d("Resultssssss", result.toString()); + + O_Status = result.getProperty("Status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) result.getProperty("Status"); + Log.d("Status:", S_Status.toString()); + str_status = S_Status.toString(); + } + { + str_status="0"; + } + Log.d("str_statusissssss", str_status); + + /* if (Integer.valueOf(str_status) == 1) { + btn_apply.setVisibility(View.GONE); + } + if (Integer.valueOf(str_status) == 2) { + btn_apply.setText("Applied"); + btn_apply.setVisibility(View.GONE); + }*/ + } + } + } + + private SoapObject getMasterStatus() { + String METHOD_NAME = "GetLeadAmbassadordetails"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetLeadAmbassadordetails"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + request.addProperty("leadId",str_leadId); + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + envelope.setOutputSoapObject(request); + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Projects.toString().trim()); + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + SoapObject response = (SoapObject) envelope.getResponse(); + Log.e("soapcompletionxxxx",response.toString()); + return response; + + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + public class ApplyForMasterLeader extends AsyncTask { + + private ProgressDialog progressDialog; + + ApplyForMasterLeader (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapPrimitive response = applyForMasterLeader(); + + //Log.d("Soapresponseissssss",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressDialog.setMessage("Applying"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + + if(result!=null) { + + SoapPrimitive S_Status; + Object O_Status; + String str_status = null; + + Log.d("RsltApplyforMastr", result.toString()); + progressDialog.dismiss(); + + /* if (result.toString().contains("success")) { + btn_apply.setText("Applied"); + }*/ + + /* O_Status = result.getProperty("Status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) result.getProperty("Status"); + Log.d("Status:", S_Status.toString()); + str_status = S_Status.toString(); + } + Log.d("str_statusissssss",str_status); + + if(Integer.valueOf(str_status) == 0){ + btn_apply.setVisibility(View.VISIBLE); + }*/ + } + + } + } + + private SoapPrimitive applyForMasterLeader() { + String METHOD_NAME = "Applyformasterleader"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/Applyformasterleader"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + request.addProperty("Lead_Id",str_leadId); + request.addProperty("isApply_MasterLeader",1); + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + envelope.setOutputSoapObject(request); + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Projects.toString().trim()); + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + Log.e("soapcompletionxxxx",response.toString()); + return response; + + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + } + + public class ApplyForAmbassador extends AsyncTask { + + private ProgressDialog progressDialog; + + ApplyForAmbassador (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapPrimitive response = applyForAmbassador(); + + //Log.d("Soapresponseissssss",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressDialog.setMessage("Applying"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + if(result!=null) { + SoapPrimitive S_Status; + Object O_Status; + String str_status = null; + + Log.d("RsltApplyforMastr", result.toString()); + progressDialog.dismiss(); + + /* if (result.toString().contains("success")) { + btn_apply.setText("Applied"); + }*/ + } + } + } + + private SoapPrimitive applyForAmbassador() { + String METHOD_NAME = "ApplyforLeadAmbassador"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/ApplyforLeadAmbassador"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + request.addProperty("Lead_Id",str_leadId); + request.addProperty("isApply_LeadAmbassador",1); + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + envelope.setOutputSoapObject(request); + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Projects.toString().trim()); + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + Log.e("soapcompletionxxxx",response.toString()); + return response; + + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + } + + + + + + + + + + + + + public class GetStudentDetails extends AsyncTask { + + Context context; + //AlertDialog alertDialog; + private ProgressDialog progressDialog; + + //private ProgressBar progressBar; + + GetStudentDetails (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(String... params) { + String str_leadId = (String) params [0]; + //String versionCode = (String) params[2]; + + SoapObject response = getStudDetails(str_leadId); + + Log.d("GetStudentDetailssresp",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + + progressDialog.setMessage("Loading"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + + } + + @Override + protected void onPostExecute(SoapObject result) { + + if(result!=null) { + + Log.d("GetStudentDetailssresp", result.toString()); + + SoapPrimitive S_Status, O_ManagerName, S_StudName, S_StudCollegeName, S_StudType, S_StudLeadId, S_StudImagePath, S_ManagerMailId, S_ManagerMobileNumber, O_ManagerImagePath; + Object O_Status, O_StudName, O_StudCollegeName, O_StudType, O_StudLeadId, O_StudImagePath; + String str_Status = null, str_StudName = null, str_StudCollegeName = null, str_StudType = null, str_StudLeadId = null, str_StudImagePath = null; + + + O_Status = result.getProperty("Status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) result.getProperty("Status"); + Log.d("Status:", S_Status.toString()); + str_Status = S_Status.toString(); + } + + if (str_Status.equalsIgnoreCase("Success")) { + O_StudName = result.getProperty("StudentName"); + if (!O_StudName.toString().equals("anyType{}") && !O_StudName.toString().equals(null)) { + S_StudName = (SoapPrimitive) result.getProperty("StudentName"); + Log.d("StudentName", S_StudName.toString()); + str_StudName = S_StudName.toString(); + } + + O_StudCollegeName = result.getProperty("College_Name"); + if (!O_StudCollegeName.toString().equals("anyType{}") && !O_StudCollegeName.toString().equals(null)) { + S_StudCollegeName = (SoapPrimitive) result.getProperty("College_Name"); + Log.d("S_StudCollegeName", S_StudCollegeName.toString()); + str_StudCollegeName = S_StudCollegeName.toString(); + } + + O_StudType = result.getProperty("Student_Type"); + if (!O_StudType.toString().equals("anyType{}") && !O_StudType.toString().equals(null)) { + S_StudType = (SoapPrimitive) result.getProperty("Student_Type"); + Log.d("S_StudType", S_StudType.toString()); + str_StudType = S_StudType.toString(); + } + + O_StudLeadId = result.getProperty("Lead_Id"); + if (!O_StudLeadId.toString().equals("anyType{}") && !O_StudLeadId.toString().equals(null)) { + S_StudLeadId = (SoapPrimitive) result.getProperty("Lead_Id"); + Log.d("S_StudLeadId", S_StudLeadId.toString()); + str_StudLeadId = S_StudLeadId.toString(); + } + + O_StudImagePath = result.getProperty("Student_Image"); + if (!O_StudImagePath.toString().equals("anyType{}") && !O_StudImagePath.toString().equals(null)) { + S_StudImagePath = (SoapPrimitive) result.getProperty("Student_Image"); + Log.d("S_StudImagePath", S_StudImagePath.toString()); + str_StudImagePath = S_StudImagePath.toString(); + } + + if (str_StudName != null && !str_StudName.isEmpty() && str_StudName != "" && !str_StudName.equals("anyType{}") && str_StudName != "{}") { + txt_studName.setText(str_StudName); + } + + if (str_StudCollegeName != null && !str_StudCollegeName.isEmpty() && str_StudCollegeName != "" && !str_StudCollegeName.equals("anyType{}") && str_StudCollegeName != "{}") { + txt_studCollegeName.setText(str_StudCollegeName); + } + + if (str_StudLeadId != null && !str_StudLeadId.isEmpty() && str_StudLeadId != "" && !str_StudLeadId.equals("anyType{}") && str_StudLeadId != "{}") { + txt_leadId.setText(str_StudLeadId); + } + + if (str_StudType != null && !str_StudType.isEmpty() && str_StudType != "" && !str_StudType.equals("anyType{}") && str_StudType != "{}") { + txt_studType.setText(str_StudType); + } + + if (str_StudImagePath != null && !str_StudImagePath.isEmpty() && str_StudImagePath != "" && !str_StudImagePath.equals("anyType{}") && str_StudImagePath != "{}") { + Log.d("InsideLoadProfile", "Pick"); + str_studImgUrl = serverPath + str_StudImagePath.substring(2); + + Log.d("str_studImgUrlsssssssss", str_studImgUrl); + + LoadStudProfilePick loadStudProfilePick = new LoadStudProfilePick(getActivity()); + loadStudProfilePick.execute(); + + /* Glide.with(getActivity()).load(str_studImgUrl) + .thumbnail(0.5f) + .crossFade() + .diskCacheStrategy(DiskCacheStrategy.ALL) + .into(img_studProfPick);*/ + + /* if (img_studProfPick1.getVisibility() == View.VISIBLE) { + //img_studProfPick1.setImageBitmap(result); + Glide.with(getActivity()).load(str_studImgUrl) + .thumbnail(0.5f) + .crossFade() + .diskCacheStrategy(DiskCacheStrategy.ALL) + .into(img_studProfPick1); + } else { + //img_studProfPick.setImageBitmap(result); + + Glide.with(getActivity()).load(str_studImgUrl) + .thumbnail(0.5f) + .crossFade() + .diskCacheStrategy(DiskCacheStrategy.ALL) + .into(img_studProfPick); + }*/ + + + } + } + + + + + + + +/* SoapPrimitive status = (SoapPrimitive) result.getProperty("Status"); + //Log.d("Status is:",status.toString()); + + + + + if(status.toString().equals("Success")) { + SoapPrimitive role = (SoapPrimitive) result.getProperty("Role"); + Log.d("Role is:", role.toString()); + + SoapPrimitive isProfileEdited = (SoapPrimitive) result.getProperty("isProfileEdit"); + }*/ + } + //progressBar.setVisibility(View.GONE); + progressDialog.dismiss(); + + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapObject getStudDetails(String leadid) + { + + String METHOD_NAME = "GetStudentDetailss"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetStudentDetailss"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + + /*request.addProperty("Username", mobilenum); + request.addProperty("Password", leadid);*/ + + /*request.addProperty("Username", leadid); + request.addProperty("Password", mobilenum);*/ + +/* String username=edt_leadid.getText().toString(); + String password=edt_mobnumber.getText().toString();*/ + + request.addProperty("leadId", leadid); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Login.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + Log.d("soap responseyyyyyyy",envelope.getResponse().toString()); + SoapObject response = (SoapObject) envelope.getResponse(); + Log.d("soap responseyyyyyyy",response.toString()); + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.d("exception outside",t.getMessage().toString()); + } + return null; + + + } + + + + + + private void initializeViews() { + txt_studName = (TextView) view.findViewById(R.id.txt_studName); + txt_studCollegeName = (TextView) view.findViewById(R.id.txt_studCollegeName); + txt_studType = (TextView) view.findViewById(R.id.txt_studType); + txt_leadId = (TextView) view.findViewById(R.id.txt_leadId); + img_studProfPick = (ImageView) view.findViewById(R.id.img_studProfPick); + + img_crownMan = (ImageView) view.findViewById(R.id.img_crownMan); + img_crownWoman = (ImageView) view.findViewById(R.id.img_crownWoman); + txt_noOfProjects = (TextView) view.findViewById(R.id.txt_noOfProjects); + + img_studProfPick1 = (ImageView) view.findViewById(R.id.img_studProfPick1); + fram_layout = (FrameLayout) view.findViewById(R.id.fram_layout); + star_count = (ImageView) view.findViewById(R.id.star_count); + bages=(LinearLayout) view.findViewById(R.id.bages); + // bages.setVisibility(View.GONE); + // btn_apply = (Button) view.findViewById(R.id.btn_apply); + + img_badge1 =(ImageView) view.findViewById(R.id.badge1); + img_badge2 =(ImageView) view.findViewById(R.id.badge2); + img_badge3 =(ImageView) view.findViewById(R.id.badge3); + img_badge4 =(ImageView) view.findViewById(R.id.badge4); + + badge1text =(TextView) view.findViewById(R.id.badge1text); + badge2text =(TextView) view.findViewById(R.id.badge2text); + badge3text =(TextView) view.findViewById(R.id.badge3text); + badge4text =(TextView) view.findViewById(R.id.badge4text); + + + container1 = + (ShimmerFrameLayout) view.findViewById(R.id.shimmer_view1); + container2 = + (ShimmerFrameLayout) view.findViewById(R.id.shimmer_view2); + container3 = + (ShimmerFrameLayout) view.findViewById(R.id.shimmer_view3); + container4 = + (ShimmerFrameLayout) view.findViewById(R.id.shimmer_view4); + /* ShimmerLayout shimmerLayout = view.findViewById(R.id.shimmer_text); + shimmerLayout.setShimmerColor(R.drawable.smaple_effect); + shimmerLayout.startShimmerAnimation();*/ + + btn_TshirtApply =(ImageView)view.findViewById(R.id.btn_tshirt_apply); + + h_student= (ImageView) view.findViewById(R.id.student); + h_initiator= (ImageView) view.findViewById(R.id.initiater); + h_cm= (ImageView) view.findViewById(R.id.changemaker); + h_leader= (ImageView) view.findViewById(R.id.leader); + h_ml= (ImageView) view.findViewById(R.id.master); + h_amb= (ImageView) view.findViewById(R.id.ambasiter); + mPulsator1 = (PulsatorLayout) view.findViewById(R.id.pulsator1); + mPulsator2 = (PulsatorLayout) view.findViewById(R.id.pulsator2); + mPulsator3 = (PulsatorLayout) view.findViewById(R.id.pulsator3); + mPulsator4 = (PulsatorLayout) view.findViewById(R.id.pulsator4); + mPulsator5 = (PulsatorLayout) view.findViewById(R.id.pulsator5); + mPulsator6 = (PulsatorLayout) view.findViewById(R.id.pulsator6); + stud_right = (View) view.findViewById(R.id.stud_right); + initiater_left = (View) view.findViewById(R.id.initiater_left); + initiater_right = (View) view.findViewById(R.id.initiater_right); + cm_left = (View) view.findViewById(R.id.cm_left); + cm_right = (View) view.findViewById(R.id.cm_right); + leader_left = (View) view.findViewById(R.id.leader_left); + leader_right = (View) view.findViewById(R.id.leader_right); + ml_left = (View) view.findViewById(R.id.ml_left); + ml_right = (View) view.findViewById(R.id.ml_right); + amb_left = (View) view.findViewById(R.id.amb_left); + stud_tv = (TextView) view.findViewById(R.id.stud_tv); + initiater_tv = (TextView) view.findViewById(R.id.initiater_tv); + cm_tv = (TextView) view.findViewById(R.id.cm_tv); + leader_tv = (TextView) view.findViewById(R.id.leader_tv); + ml_tv = (TextView) view.findViewById(R.id.ml_tv); + amb_tv = (TextView) view.findViewById(R.id.amb_tv); + myDialog = new Dialog(getContext()); + myDialog.setContentView(R.layout.stud_progression_popup); + ib_close =(ImageView) myDialog.findViewById(R.id.ib_close); + tv_popupinfo =(JustifiedTextView) myDialog.findViewById(R.id.tv_popupinfo); + popupHeader = (TextView) myDialog.findViewById(R.id.popupHeader); + // popup=(LinearLayout) view.findViewById(R.id.popup); + // btn_TshirtApply.setVisibility(View.INVISIBLE); + + + } + + + public class LoadStudProfilePick extends AsyncTask { + + private Context context; + private ProgressDialog progressDialog; + + LoadStudProfilePick (Context context){ + this.context = context; + progressDialog = new ProgressDialog(context); + } + + @Override + protected void onPreExecute() { + progressDialog.setMessage("Loading"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + + } + + @Override + protected Bitmap doInBackground(Void... params) { + + Bitmap bitmaplogo=null; + + try { + //Log.d("Urlssssssssssss",url.toString()); + //bitmaplogo = BitmapFactory.decodeStream(url.openStream()); + URL urlis = new URL(str_studImgUrl); + InputStream inputStream = urlis.openStream(); + bitmaplogo = BitmapFactory.decodeStream(inputStream); + } + catch(FileNotFoundException ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Please update profile picture", Toast.LENGTH_LONG).show(); + } + }); + } + + catch (MalformedURLException e) { + e.printStackTrace(); +/* result.setStudresult(e.getMessage().toString());*/ + + final String exceptnMsg = e.getMessage().toString(); + + getActivity().runOnUiThread(new Runnable() { + public void run() { + // Toast.makeText(getActivity(),exceptnMsg, Toast.LENGTH_LONG).show(); + Toast.makeText(getActivity(),"No Internet",Toast.LENGTH_LONG).show(); + } + }); + + //return result; + } catch (IOException e) { + e.printStackTrace(); + /* result.setStudresult(e.getMessage().toString());*/ + + final String exceptnMsg = e.getMessage().toString(); + + getActivity().runOnUiThread(new Runnable() { + public void run() { + // Toast.makeText(getActivity(),exceptnMsg, Toast.LENGTH_LONG).show(); + Toast.makeText(getActivity(),"No Internet",Toast.LENGTH_LONG).show(); + } + }); + //return result; + }catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + + + + //result.setStudbitmap(bitmaplogo); + return bitmaplogo; + //return result; + } + + @Override + protected void onPostExecute(Bitmap result) { + /* bitmapList.add(bitmap); + + Log.d("count1iss", String.valueOf(count1)); + Log.d("count2iss", String.valueOf(count2)); + Log.d("Bitmapsizess", String.valueOf(bitmapList.size())); + if(bitmapList.size()==count2){ + img_mainGallery.setImageBitmap(bitmapList.get(0)); + txt_numOfImages.setText("Images: "+bitmapList.size()); + }*/ + + + //} + if(result!=null) { + try { + if (img_studProfPick1.getVisibility() == View.VISIBLE) { + img_studProfPick1.setImageBitmap(result); + } else { + img_studProfPick.setImageBitmap(result); + } + } catch (OutOfMemoryError ex) { + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context, "Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + } + + + /* if(result.getStudresult()!=null) { + + //Log.d("Inside", bitmap.toString()); + + img_studProfPick.setImageBitmap(result.getStudbitmap()); + } + else{ + Toast.makeText(getActivity(),"Exception occured student:"+result.getStudresult(),Toast.LENGTH_LONG).show(); + }*/ + + //progressBar.setVisibility(GONE); + + progressDialog.dismiss(); + } + } + + + +/* private void setStateSpinner(View view) { + + + final ArrayList liststate = new ArrayList(); + liststate.add("Karnataka"); + liststate.add("Maharashtra"); + liststate.add("AndhraPradesh"); + + ArrayAdapter dataAdapterState = new ArrayAdapter(context, R.layout.simple_spinner_items, liststate); + + // Drop down layout style - list view with radio button + dataAdapterState.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + + // attaching data adapter to spinner + spin_state.setAdapter(dataAdapterState); + spin_state.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorWhite)); + } + + private void setCitySpinner(View view) { + + + final ArrayList listcity = new ArrayList(); + listcity.add("Hubballi"); + listcity.add("Dharwad"); + listcity.add("Belgaum"); + + ArrayAdapter dataAdapterCity = new ArrayAdapter(context, R.layout.simple_spinner_items, listcity); + + // Drop down layout style - list view with radio button + dataAdapterCity.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + + // attaching data adapter to spinner + spin_city.setAdapter(dataAdapterCity); + spin_city.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorWhite)); + } + + private void setInstitutionSpinner(View view) { + + + final ArrayList listinstitution = new ArrayList(); + listinstitution.add("JG College of commerce"); + listinstitution.add("B.V.B College of Engineering"); + + ArrayAdapter dataAdapterInstitution = new ArrayAdapter(context, R.layout.simple_spinner_items, listinstitution); + + // Drop down layout style - list view with radio button + dataAdapterInstitution.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + + // attaching data adapter to spinner + spin_institution.setAdapter(dataAdapterInstitution); + spin_institution.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorWhite)); + } + + private void setSemesterSpinner(View view) { + + + final ArrayList listsemester = new ArrayList(); + listsemester.add("1"); + listsemester.add("2"); + listsemester.add("3"); + + //ArrayAdapter dataAdapterSem = new ArrayAdapter(context, R.layout.simple_spinner_semester, listsemester); + ArrayAdapter dataAdapterSem = new ArrayAdapter(context, R.layout.simple_spinner_items, listsemester); + + // Drop down layout style - list view with radio button + dataAdapterSem.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + + // attaching data adapter to spinner + spin_semester.setAdapter(dataAdapterSem); + spin_semester.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorWhite)); + } + + private void setDateOfBirth(View view) { + + final Calendar c = Calendar.getInstance(); + + edt_dob.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + mYear = c.get(Calendar.YEAR); + mMonth = c.get(Calendar.MONTH); + mDay = c.get(Calendar.DAY_OF_MONTH); + + DatePickerDialog datePickerDialog = new DatePickerDialog(context, + new DatePickerDialog.OnDateSetListener() { + + @Override + public void onDateSet(DatePicker view, int year, + int monthOfYear, int dayOfMonth) { + + cDay = dayOfMonth; + cMonth = monthOfYear; + cYear = year; + + //TextView txtExactDate = (TextView) findViewById(R.id.txt_exactDate); + edt_dob.setText(dayOfMonth + "/" + (monthOfYear + 1) + "/" + year); + + //txtDate.edita + } + }, mYear, mMonth, mDay); + + datePickerDialog.show(); + } + }); + + + }*/ + + + + private class TshirtRequest_AsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + dialog.setMessage("Please wait.."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("LeadMIS", "doInBackground"); + // GetAllEvents(); + + Tshirt_request(); //apply T-shirt request + + + return null; + } + + public TshirtRequest_AsyncCallWS(Context context1) { + context = context1; + dialog = new ProgressDialog(context1); + } + + @Override + protected void onPostExecute(Void result) + { + dialog.dismiss(); + + + if(Str_tshirterror1.equals("no")||Str_tshirterror2.equals("no")) + { + if(str_tshirtresponse.equals("Success")||str_tshirtresponse.equals("success")) + { + + /*editor_S = shardpref_S_obj.edit(); + editor_S.putString(PrefId_S_TshirtStatus,"1"); + editor_S.commit();*/ + Toast.makeText(getActivity(), "T-Shirt request sent Successfully", Toast.LENGTH_SHORT).show(); + + Intent i = new Intent(getActivity(), HomeActivity.class); + startActivity(i); + } + else + { + Toast.makeText(getActivity(), "Error: WS", Toast.LENGTH_SHORT).show(); + } + } + else + { + Toast.makeText(getActivity(), "Error: WS", Toast.LENGTH_SHORT).show(); + } + + }//end of OnPostExecute + + }// end Async task + + + + + public void Tshirt_request() + { + + //URL + String URL = Class_URL.URL_Projects.toString().trim(); + String METHOD_NAME = "ApplyTshirtRequested"; + String Namespace = "http://mis.leadcampus.org/", SOAPACTION = "http://mis.leadcampus.org/ApplyTshirtRequested"; + //URL + + + if(str_Tshirt_applySecondTime.equals("no")) + { + str_getTshirt_requestedID=""; + str_reasontochange=""; + } + + Integer int_registrationId= Integer.parseInt(str_regId.toString().trim()); + Integer int_managerid =Integer.parseInt(str_managerId.toString().trim()); + + + try { + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + + //for re-request of t-shirt + request.addProperty("RequestedId", str_getTshirt_requestedID);//string + request.addProperty("TshirtModSize",str_tshirtsize.trim());//string + + //for re-request of t-shirt + + request.addProperty("RegistrationId", int_registrationId);//int + request.addProperty("Lead_Id", str_leadId.toString().trim());//string + request.addProperty("ManagerId", int_managerid);//int + request.addProperty("MemberName", str_studName);//string + request.addProperty("TshirtSize", str_tshirtsize.trim());//string + request.addProperty("RequestedCount", 1);//int + request.addProperty("ReapplyReson",str_reasontochange);//string + + +/*int + string + int + string + string + int*/ + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + androidHttpTransport.call(SOAPACTION, envelope); + + SoapPrimitive tshirt_response = (SoapPrimitive) envelope.getResponse(); + + // SoapObject tshirt_response = (SoapObject) envelope.getResponse(); + + Log.e("tshirt response", tshirt_response.toString()); + + str_tshirtresponse=tshirt_response.toString().trim(); + + } catch (Throwable t) { + //Toast.makeText(MainActivity.this, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Str_tshirterror1 ="yes"; + Log.e("request fail", "> " + t.getMessage()); + } + } catch (Throwable t) { + Str_tshirterror2="yes"; + Log.e("UnRegister Error", "> " + t.getMessage()); + + } + + + }//end of TshirtApply + + + + + + + + private class GetTshirtlist_AsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + + /*dialog.setMessage("Please wait.."); + dialog.setCanceledOnTouchOutside(false); + dialog.show();*/ + + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("LeadMIS", "doInBackground"); + // GetAllEvents(); + + GetTshirtlist_request(); // call of GetTshirtlist + + + return null; + } + + public GetTshirtlist_AsyncCallWS(Context context1) { + context = context1; + dialog = new ProgressDialog(context1); + } + + @Override + protected void onPostExecute(Void result) + { + // dialog.dismiss(); + + if(str_getTshirtStatus.equals("Success")) + { + str_Tshirt_applySecondTime="yes"; + } + + + + }//end of OnPostExecute + + }// end Async task + + + public void GetTshirtlist_request() + { + + //URL + String URL = Class_URL.URL_Projects.toString().trim(); + String METHOD_NAME = "GetTshirtlist"; + String Namespace = "http://mis.leadcampus.org/", SOAPACTION = "http://mis.leadcampus.org/GetTshirtlist"; + //URL + + /*16 + S + 10/13/2018 1:41:44 PM + 10/13/2018 1:43:46 PM + Exchange + Success*/ + + /* + 0 + There is no Tshirt request here + */ + + try { + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + + + request.addProperty("Lead_id", str_leadId.toString().trim());//string + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + androidHttpTransport.call(SOAPACTION, envelope); + SoapObject gettshirtlist_response = (SoapObject) envelope.getResponse(); + + Log.e("gettshirt list", gettshirtlist_response.toString()); + + gettshirtlist_response= (SoapObject) gettshirtlist_response.getProperty(0); + + str_gettshirtlistresponse=gettshirtlist_response.getProperty("Status").toString(); + + str_getTshirtStatus = gettshirtlist_response.getProperty("Status").toString(); + + if(str_getTshirtStatus.equals("Success")) + { + + str_getTshirt_requestedID=(String)gettshirtlist_response.getProperty("RequestedId").toString();//16 + str_getTshirt_tshirtSize=(String)gettshirtlist_response.getProperty("TshirtSize").toString();//S + + + } + + } catch (Throwable t) { + //Toast.makeText(MainActivity.this, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Str_tshirterror1 ="yes"; + Log.e("request fail", "> " + t.getMessage()); + } + } catch (Throwable t) { + Str_tshirterror2="yes"; + Log.e("UnRegister Error", "> " + t.getMessage()); + + } + + + }//end of TshirtApply + + + + + + + + + + + + + + +} diff --git a/app/src/main/java/com/leadcampusapp/MyProfileFragmentNew.java b/app/src/main/java/com/leadcampusapp/MyProfileFragmentNew.java new file mode 100644 index 0000000..a3ce708 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/MyProfileFragmentNew.java @@ -0,0 +1,1635 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 22-06-2018. + */ + +import android.app.ProgressDialog; +import android.content.Context; +import android.content.SharedPreferences; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.os.AsyncTask; +import android.os.Bundle; +import androidx.fragment.app.Fragment; +import androidx.appcompat.widget.AppCompatSpinner; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.EditText; +import android.widget.FrameLayout; +import android.widget.GridView; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; +import android.widget.Toast; + + +import com.kofigyan.stateprogressbar.StateProgressBar; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.net.MalformedURLException; +import java.net.URL; + +public class MyProfileFragmentNew extends Fragment { + + private LinearLayout lnrlyt_projDtls; + private LinearLayout lnrlyt_events; + private LinearLayout lnrlyt_newsfeeds; + private LinearLayout lnrlyt_aboutUs; + + private LinearLayout lnrlyt_viewProfile; + + TextView about_TV,projectDetails_TV,events_TV,news_TV,contactus_TV; + ImageView about_IV,projectDetails_IV,events_IV,news_IV,contactus_IV; + + private Context context; + private AppCompatSpinner spin_state; + private AppCompatSpinner spin_city; + private AppCompatSpinner spin_institution; + private AppCompatSpinner spin_semester; + private EditText edt_dob; + + private String[] descriptionData = {"Student", "Leader", "Master", "Ambassador"}; + + private int mYear, mMonth, mDay; + private int cYear, cMonth, cDay; + + public static final String PREFBook_Stud= "prefbook_stud"; //sharedpreference Book + public static final String PrefID_RegID = "prefid_regid"; // + public static final String PrefID_SName = "prefid_sname"; // + public static final String PrefID_PM_SName = "prefid_pmsname"; // + public static final String PrefID_SLeadID = "prefid_sleadid"; // + public static final String PrefID_PM_SEmailID = "prefid_pm_semailid"; // + public static final String PrefID_SCellNo = "prefid_scellno"; // + public static final String PrefID_Role = "prefid_role"; + public static final String PrefID_SCollegeName = "prefid_scollegename"; + public static final String PrefID_SImageUrl = "prefid_simgUrl"; + + public static final String PrefId_S_Gender = "prefid_sgender"; + public static final String PrefId_S_StarCount = "prefid_sstarCount"; + + public static final String PrefID_S_ImgBase64 = "prefid_s_imgBase64"; // + public static final String PrefID_PM_ImgBase64 = "prefid_pm_imgBase64"; + + + public static final String PrefID_SStudentType = "prefid_sstudentType"; // + + SharedPreferences shardpref_S_obj; + + private TextView txt_studName; + private TextView txt_studCollegeName; + private TextView txt_studType; + private TextView txt_leadId; + private ImageView img_studProfPick; + private ImageView img_crownMan,img_crownWoman,img_studProfPick1; + private TextView txt_noOfProjects; + private View view; + private String str_leadId,str_studName,str_role,str_collegeName,str_studImgUrl,str_username,str_password,str_s_studentType,str_s_gender,str_s_starCount; + private Result result; + private String getResult; + + SharedPreferences.Editor editor_S; + public static final String PrefId_S_Password = "prefid_spassword"; + public static final String PrefId_S_Username = "prefid_susername"; + private String serverPath = Class_URL.ServerPath.toString().trim(); + + private FrameLayout fram_layout; + private int starCount; + private Button btn_apply; + + private StateProgressBar stateProgressBar; + public static final String PrefId_S_IsFeesPaid = "prefid_sfeesPaid"; + private String str_isFeesPaid; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + view = inflater.inflate(R.layout.myprofile_fragment_new, container, false); + context = getActivity().getBaseContext(); + + initializeViews(); + + + + shardpref_S_obj=getActivity().getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + + if(getActivity().getIntent().hasExtra("fromeditProfile")){ + getResult = getActivity().getIntent().getStringExtra("fromeditProfile"); + Log.d("GetResultsss",getResult); + + + shardpref_S_obj.getString(PrefId_S_Username, "").trim(); + str_username = shardpref_S_obj.getString(PrefId_S_Username, "").trim(); + Log.d("str_username",str_username); + + + shardpref_S_obj.getString(PrefId_S_Password, "").trim(); + str_password = shardpref_S_obj.getString(PrefId_S_Password, "").trim(); + Log.d("str_password",str_password); + + shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + str_leadId = shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + + shardpref_S_obj.getString(PrefId_S_Gender,"").trim(); + str_s_gender = shardpref_S_obj.getString(PrefId_S_Gender, "").trim(); + + shardpref_S_obj.getString(PrefId_S_StarCount,"").trim(); + str_s_starCount = shardpref_S_obj.getString(PrefId_S_StarCount, "").trim(); + starCount = Integer.parseInt(str_s_starCount); + + + if(starCount>0){ + img_studProfPick1.setVisibility(View.GONE); + fram_layout.setVisibility(View.VISIBLE); + + if(str_s_gender.equals("M")){ + + img_crownWoman.setVisibility(View.GONE); + img_crownMan.setVisibility(View.VISIBLE); + + txt_noOfProjects.setText(str_s_starCount); + txt_noOfProjects.setVisibility(View.VISIBLE); + }else{ + + img_crownWoman.setVisibility(View.VISIBLE); + img_crownMan.setVisibility(View.GONE); + + txt_noOfProjects.setText(str_s_starCount); + txt_noOfProjects.setVisibility(View.VISIBLE); + } + } + + GetStudentDetails getStudentDetails = new GetStudentDetails(getActivity()); + getStudentDetails.execute(str_leadId); + + } + + //getStudentDetails(); + else { + + shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + str_leadId = shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + + shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + str_leadId = shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + + shardpref_S_obj.getString(PrefID_SName, "").trim(); + str_studName = shardpref_S_obj.getString(PrefID_SName, "").trim(); + + shardpref_S_obj.getString(PrefID_Role, "").trim(); + str_role = shardpref_S_obj.getString(PrefID_Role, "").trim(); + + shardpref_S_obj.getString(PrefID_SCollegeName, "").trim(); + str_collegeName = shardpref_S_obj.getString(PrefID_SCollegeName, "").trim(); + + + shardpref_S_obj.getString(PrefID_SImageUrl, "").trim(); + str_studImgUrl = shardpref_S_obj.getString(PrefID_SImageUrl, "").trim(); + + + shardpref_S_obj.getString(PrefID_SStudentType, "").trim(); + str_s_studentType = shardpref_S_obj.getString(PrefID_SStudentType, "").trim(); + + + shardpref_S_obj.getString(PrefId_S_Gender,"").trim(); + str_s_gender = shardpref_S_obj.getString(PrefId_S_Gender, "").trim(); + + shardpref_S_obj.getString(PrefId_S_StarCount,"").trim(); + str_s_starCount = shardpref_S_obj.getString(PrefId_S_StarCount, "").trim(); + starCount = Integer.parseInt(str_s_starCount); + + + + + + + + + + + + if (str_studName != null && !str_studName.isEmpty() && str_studName != "" && !str_studName.equals("anyType{}")) { + txt_studName.setText(str_studName); + } + + if (str_leadId != null && !str_leadId.isEmpty() && str_leadId != "" && !str_leadId.equals("anyType{}")) { + txt_leadId.setText(str_leadId); + } + + if (str_collegeName != null && !str_collegeName.isEmpty() && str_collegeName != "" && !str_collegeName.equals("anyType{}")) { + txt_studCollegeName.setText(str_collegeName); + } + + /* if (str_role != null && !str_role.isEmpty() && str_role != "" && !str_role.equals("anyType{}")) { + txt_studType.setText(str_role); + }*/ + + if (str_s_studentType != null && !str_s_studentType.isEmpty() && str_s_studentType != "" && !str_s_studentType.equals("anyType{}")) { + txt_studType.setText(str_s_studentType); + } + + if (!str_studImgUrl.equals(null) && !str_studImgUrl.equalsIgnoreCase("null") && !str_studImgUrl.isEmpty() && str_studImgUrl != "" && !str_studImgUrl.equals("anyType{}") && str_studImgUrl != "{}") { + Log.d("InsideLoadProfile", "Pick"); + + LoadStudProfilePick loadStudProfilePick = new LoadStudProfilePick(getActivity()); + loadStudProfilePick.execute(); + + + /*Glide.with(getActivity()).load(str_studImgUrl) + .thumbnail(0.5f) + .crossFade() + .diskCacheStrategy(DiskCacheStrategy.ALL) + .into(img_studProfPick);*/ + + + + /* if (img_studProfPick1.getVisibility() == View.VISIBLE) { + //img_studProfPick1.setImageBitmap(result); + Glide.with(getActivity()).load(str_studImgUrl) + .thumbnail(0.5f) + .crossFade() + .diskCacheStrategy(DiskCacheStrategy.ALL) + .into(img_studProfPick1); + } else { + //img_studProfPick.setImageBitmap(result); + + Glide.with(getActivity()).load(str_studImgUrl) + .thumbnail(0.5f) + .crossFade() + .diskCacheStrategy(DiskCacheStrategy.ALL) + .into(img_studProfPick); + }*/ + + + /* if(img_studProfPick1.getVisibility()==View.VISIBLE){ + + //Log.d("studentbitmapss:",StudentPMImageBitmap.getStudBitmap().toString()); + + shardpref_S_obj.getString(PrefID_S_ImgBase64,"").trim(); + String str_s_imgBase64 = shardpref_S_obj.getString(PrefID_S_ImgBase64, "").trim(); + + Log.d("str_s_imgBase64issss",str_s_imgBase64); + + *//* byte[] byteArray = Base64.decode(str_s_imgBase64, Base64.DEFAULT); + Bitmap bitmap = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length); + img_studProfPick1.setImageBitmap(bitmap);*//* + try { + if (!str_s_imgBase64.equalsIgnoreCase("")) { + Log.d("str_s_imgBase64issss", str_s_imgBase64); + byte[] b = Base64.decode(str_s_imgBase64, Base64.DEFAULT); + Bitmap bitmap = BitmapFactory.decodeByteArray(b, 0, b.length); + img_studProfPick1.setImageBitmap(bitmap); + } + }catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + + //img_studProfPick1.setImageBitmap(StudentPMImageBitmap.getStudBitmap()); + +*//* byte[] imageinbytesArray={0}; + + Bitmap yourImage = StudentPMImageBitmap.getStudBitmap(); + + + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + yourImage.compress(Bitmap.CompressFormat.PNG, 100, stream); + //imageInByte; + imageinbytesArray = stream.toByteArray(); + // Log.e("output before conversion", imageInByte.toString()); + // Log.d("Insert: ", "Inserting ..image"); + Bitmap bm = BitmapFactory.decodeByteArray(imageinbytesArray, 0, imageinbytesArray.length);*//* + // Log.d("Insert image report: ",bm.toString() ); + + //studPickBase64 = Base64.encodeToString(imageinbytesArray, Base64.DEFAULT); + //img_studProfPick1.setImageBitmap(bm); + + } + else{ + //img_studProfPick.setImageBitmap(StudentPMImageBitmap.getStudBitmap()); + + shardpref_S_obj.getString(PrefID_S_ImgBase64,"").trim(); + String str_s_imgBase64 = shardpref_S_obj.getString(PrefID_S_ImgBase64, "").trim(); + + + + try { + if (!str_s_imgBase64.equalsIgnoreCase("")) { + byte[] b = Base64.decode(str_s_imgBase64, Base64.DEFAULT); + Bitmap bitmap = BitmapFactory.decodeByteArray(b, 0, b.length); + img_studProfPick.setImageBitmap(bitmap); + } + }catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + + + }*/ + + } + + if(starCount>0){ + img_studProfPick1.setVisibility(View.GONE); + fram_layout.setVisibility(View.VISIBLE); + + if(str_s_gender.equals("M")){ + + + + img_crownWoman.setVisibility(View.GONE); + img_crownMan.setVisibility(View.VISIBLE); + + /* RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( + RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); + + params.setMargins(-40,0,0,0); + txt_noOfProjects.setLayoutParams(params);*/ + txt_noOfProjects.setText(str_s_starCount); + txt_noOfProjects.setVisibility(View.VISIBLE); + + + }else{ + + /* img_studProfPick1.setVisibility(View.VISIBLE); + fram_layout.setVisibility(View.GONE);*/ + + img_crownWoman.setVisibility(View.VISIBLE); + img_crownMan.setVisibility(View.GONE); + + + + + + + /* RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( + RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); + + params.setMargins(-20,0,0,0); + txt_noOfProjects.setLayoutParams(params);*/ + txt_noOfProjects.setText(str_s_starCount); + txt_noOfProjects.setVisibility(View.VISIBLE); + } + } + + + //Toast.makeText(getActivity(),"Inside My Profile",Toast.LENGTH_SHORT).show(); + + + } + + + shardpref_S_obj.getString(PrefID_SStudentType, "").trim(); + str_s_studentType = shardpref_S_obj.getString(PrefID_SStudentType, "").trim(); + + + stateProgressBar = (StateProgressBar) view.findViewById(R.id.usage_stateprogressbar); + stateProgressBar.setStateDescriptionData(descriptionData); + + if (str_s_studentType.equals("Student")) { + stateProgressBar.setCurrentStateNumber(StateProgressBar.StateNumber.ONE); + } + + if (str_s_studentType.equals("Leader")) { + stateProgressBar.setCurrentStateNumber(StateProgressBar.StateNumber.TWO); + + + GetLeaderStatus getLeaderStatus = new GetLeaderStatus(getActivity()); + getLeaderStatus.execute(); + } + + if (str_s_studentType.equals("Master Leader")) { + stateProgressBar.setCurrentStateNumber(StateProgressBar.StateNumber.THREE); + + GetMasterStatus getMasterStatus = new GetMasterStatus(getActivity()); + getMasterStatus.execute(); + + } + + if (str_s_studentType.equals("Lead Ambassador")) { + stateProgressBar.setCurrentStateNumber(StateProgressBar.StateNumber.FOUR); + } + + shardpref_S_obj.getString(PrefId_S_IsFeesPaid, "").trim(); + str_isFeesPaid = shardpref_S_obj.getString(PrefId_S_IsFeesPaid, "").trim(); + Log.d("FeesPaidisssssss",str_isFeesPaid); + + + GridView gridView = (GridView) view.findViewById(R.id.gridview); + gridView.setAdapter(new GridAdapter(getActivity())); + GridView gridViewSecond = (GridView) view.findViewById(R.id.gridview1); + gridViewSecond.setAdapter(new GridAdapterSecond(getActivity())); //GridAdapterSecond.java + + + + + /* projectDetails_IV = (ImageView) view.findViewById(R.id.projectDetails_IV); + projectDetails_IV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if(str_isFeesPaid.equals("1")) { + Intent itthomeToProject = new Intent(getActivity().getBaseContext(), ProjectDetails.class); + // itthomeToProject.putExtra("From","Student"); + startActivity(itthomeToProject); + }else{ + Toast.makeText(getActivity(),"You have not paid the fees. Please contact Project Manager",Toast.LENGTH_LONG).show(); + } + } + }); + projectDetails_TV = (TextView) view.findViewById(R.id.projectDetails_TV); + projectDetails_TV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToProject = new Intent(getActivity().getBaseContext(), ProjectDetails.class); + // itthomeToProject.putExtra("From","Student"); + startActivity(itthomeToProject); + } + }); + + events_IV = (ImageView) view.findViewById(R.id.events_IV); + events_IV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToEvent = new Intent(getActivity().getBaseContext(), EventsActivity.class); + // itthomeToEvent.putExtra("From","Student"); + //Intent itthomeToEvent = new Intent(getActivity().getBaseContext(), TestActivity2.class); + startActivity(itthomeToEvent); + } + }); + events_TV = (TextView) view.findViewById(R.id.events_TV); + events_TV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToEvent = new Intent(getActivity().getBaseContext(), EventsActivity.class); + // itthomeToEvent.putExtra("From","Student"); + //Intent itthomeToEvent = new Intent(getActivity().getBaseContext(), TestActivity2.class); + startActivity(itthomeToEvent); + } + }); + + news_IV = (ImageView) view.findViewById(R.id.news_IV); + news_IV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToNewsFeeds = new Intent(getActivity().getBaseContext(), NewsFeedsActivity.class); + // itthomeToNewsFeeds.putExtra("From","Student"); + startActivity(itthomeToNewsFeeds); + } + }); + news_TV = (TextView) view.findViewById(R.id.news_TV); + news_TV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToNewsFeeds = new Intent(getActivity().getBaseContext(), NewsFeedsActivity.class); + // itthomeToNewsFeeds.putExtra("From","Student"); + startActivity(itthomeToNewsFeeds); + } + }); + + about_IV = (ImageView) view.findViewById(R.id.about_IV); + about_IV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToAboutUs = new Intent(getActivity().getBaseContext(), AboutUsActivity.class); + itthomeToAboutUs.putExtra("From","Student"); + startActivity(itthomeToAboutUs); + } + }); + about_TV = (TextView) view.findViewById(R.id.about_TV); + about_TV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToAboutUs = new Intent(getActivity().getBaseContext(), AboutUsActivity.class); + itthomeToAboutUs.putExtra("From","Student"); + startActivity(itthomeToAboutUs); + } + }); + + contactus_IV = (ImageView) view.findViewById(R.id.contactus_IV); + contactus_IV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToAboutUs = new Intent(getActivity().getBaseContext(), ContactUsActivity.class); + itthomeToAboutUs.putExtra("From","Student"); + startActivity(itthomeToAboutUs); + } + }); + contactus_TV = (TextView) view.findViewById(R.id.contactus_TV); + contactus_TV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToAboutUs = new Intent(getActivity().getBaseContext(), ContactUsActivity.class); + itthomeToAboutUs.putExtra("From","Student"); + startActivity(itthomeToAboutUs); + } + }); + + +*/ + + + + + + + + + + + + /* lnrlyt_viewProfile = (LinearLayout) view.findViewById(R.id.lnrlyt_viewProfile); + if(lnrlyt_viewProfile.getVisibility()==View.VISIBLE) { + + lnrlyt_projDtls = (LinearLayout) view.findViewById(R.id.lnrlyt_projectDtls); + lnrlyt_projDtls.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToProject = new Intent(getActivity().getBaseContext(), ProjectDetails.class); + startActivity(itthomeToProject); + } + }); + + lnrlyt_events = (LinearLayout) view.findViewById(R.id.lnrlyt_events); + lnrlyt_events.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToEvent = new Intent(getActivity().getBaseContext(), EventsActivity.class); + startActivity(itthomeToEvent); + } + }); + + lnrlyt_newsfeeds = (LinearLayout) view.findViewById(R.id.lnrlyt_newsfeeds); + lnrlyt_newsfeeds.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToNewsFeeds = new Intent(getActivity().getBaseContext(), NewsFeedsActivity.class); + startActivity(itthomeToNewsFeeds); + } + }); + + } + + else{ + spin_state = (AppCompatSpinner) view.findViewById(R.id.spin_state); + spin_city = (AppCompatSpinner) view.findViewById(R.id.spin_city); + spin_institution = (AppCompatSpinner) view.findViewById(R.id.spin_institution); + spin_semester = (AppCompatSpinner) view.findViewById(R.id.spin_sem); + edt_dob = (EditText) view.findViewById(R.id.edt_dob); + + + setStateSpinner(view); + setCitySpinner(view); + setInstitutionSpinner(view); + setSemesterSpinner(view); + + setDateOfBirth(view); + }*/ + + editor_S = shardpref_S_obj.edit(); + btn_apply.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if(str_s_studentType.equals("Leader")){ + ApplyForMasterLeader applyForMasterLeader = new ApplyForMasterLeader(getActivity()); + applyForMasterLeader.execute(); + + stateProgressBar.setCurrentStateNumber(StateProgressBar.StateNumber.THREE); + + str_s_studentType = "Master Leader"; + txt_studType.setText(str_s_studentType); + editor_S.putString(PrefID_SStudentType,str_s_studentType); + editor_S.commit(); + + } + + if(str_s_studentType.equals("Master Leader")){ + ApplyForAmbassador applyForAmbassador = new ApplyForAmbassador(getActivity()); + applyForAmbassador.execute(); + + stateProgressBar.setCurrentStateNumber(StateProgressBar.StateNumber.FOUR); + + str_s_studentType = "Lead Ambassador"; + txt_studType.setText(str_s_studentType); + editor_S.putString(PrefID_SStudentType,str_s_studentType); + editor_S.commit(); + } + } + }); + + return view; + } + + + public class GetLeaderStatus extends AsyncTask { + + GetLeaderStatus (Context ctx){ + context = ctx; + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapObject response = getLeaderStatus(); + + //Log.d("Soapresponseissssss",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + } + + @Override + protected void onPostExecute(SoapObject result) { + + if(result!=null) { + + SoapPrimitive S_Status; + Object O_Status; + String str_status = null; + + Log.d("Resultssssss", result.toString()); + + O_Status = result.getProperty("Status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) result.getProperty("Status"); + Log.d("Status:", S_Status.toString()); + str_status = S_Status.toString(); + } + Log.d("str_statusissssss", str_status); + + if (Integer.valueOf(str_status) == 1) { + btn_apply.setVisibility(View.GONE); + } + if (Integer.valueOf(str_status) == 2) { + btn_apply.setText("Applied"); + btn_apply.setVisibility(View.GONE); + } + + } + + } + } + + private SoapObject getLeaderStatus() { + String METHOD_NAME = "Getleadmemberdetails"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/Getleadmemberdetails"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + request.addProperty("leadId",str_leadId); + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + envelope.setOutputSoapObject(request); + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Projects.toString().trim()); + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + SoapObject response = (SoapObject) envelope.getResponse(); + Log.e("soapcompletionxxxx",response.toString()); + return response; + + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + } + + + public class GetMasterStatus extends AsyncTask { + + GetMasterStatus (Context ctx){ + context = ctx; + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapObject response = getMasterStatus(); + + //Log.d("Soapresponseissssss",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + } + + @Override + protected void onPostExecute(SoapObject result) { + + if(result!=null) { + SoapPrimitive S_Status; + Object O_Status; + String str_status = null; + + Log.d("Resultssssss", result.toString()); + + O_Status = result.getProperty("Status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) result.getProperty("Status"); + Log.d("Status:", S_Status.toString()); + str_status = S_Status.toString(); + } + Log.d("str_statusissssss", str_status); + + if (Integer.valueOf(str_status) == 1) { + btn_apply.setVisibility(View.GONE); + } + if (Integer.valueOf(str_status) == 2) { + btn_apply.setText("Applied"); + btn_apply.setVisibility(View.GONE); + } + } + } + } + + private SoapObject getMasterStatus() { + String METHOD_NAME = "GetLeadAmbassadordetails"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetLeadAmbassadordetails"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + request.addProperty("leadId",str_leadId); + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + envelope.setOutputSoapObject(request); + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Projects.toString().trim()); + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + SoapObject response = (SoapObject) envelope.getResponse(); + Log.e("soapcompletionxxxx",response.toString()); + return response; + + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + } + + + + + + + + + + + + + + + + + + + + + + + + + + + public class ApplyForMasterLeader extends AsyncTask { + + private ProgressDialog progressDialog; + + ApplyForMasterLeader (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapPrimitive response = applyForMasterLeader(); + + //Log.d("Soapresponseissssss",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressDialog.setMessage("Applying"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + + if(result!=null) { + SoapPrimitive S_Status; + Object O_Status; + String str_status = null; + + Log.d("RsltApplyforMastr", result.toString()); + progressDialog.dismiss(); + + if (result.toString().contains("success")) { + btn_apply.setText("Applied"); + } + + /* O_Status = result.getProperty("Status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) result.getProperty("Status"); + Log.d("Status:", S_Status.toString()); + str_status = S_Status.toString(); + } + Log.d("str_statusissssss",str_status); + + if(Integer.valueOf(str_status) == 0){ + btn_apply.setVisibility(View.VISIBLE); + }*/ + } + + } + } + + private SoapPrimitive applyForMasterLeader() { + String METHOD_NAME = "Applyformasterleader"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/Applyformasterleader"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + request.addProperty("Lead_Id",str_leadId); + request.addProperty("isApply_MasterLeader",1); + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + envelope.setOutputSoapObject(request); + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Projects.toString().trim()); + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + Log.e("soapcompletionxxxx",response.toString()); + return response; + + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + } + + public class ApplyForAmbassador extends AsyncTask { + + private ProgressDialog progressDialog; + + ApplyForAmbassador (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapPrimitive response = applyForAmbassador(); + + //Log.d("Soapresponseissssss",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressDialog.setMessage("Applying"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + if(result!=null) { + SoapPrimitive S_Status; + Object O_Status; + String str_status = null; + + Log.d("RsltApplyforMastr", result.toString()); + progressDialog.dismiss(); + + if (result.toString().contains("success")) { + btn_apply.setText("Applied"); + } + } + } + } + + private SoapPrimitive applyForAmbassador() { + String METHOD_NAME = "ApplyforLeadAmbassador"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/ApplyforLeadAmbassador"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + request.addProperty("Lead_Id",str_leadId); + request.addProperty("isApply_LeadAmbassador",1); + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + envelope.setOutputSoapObject(request); + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Projects.toString().trim()); + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + Log.e("soapcompletionxxxx",response.toString()); + return response; + + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + } + + + + + + + + + + + + + public class GetStudentDetails extends AsyncTask { + + Context context; + //AlertDialog alertDialog; + private ProgressDialog progressDialog; + + //private ProgressBar progressBar; + + GetStudentDetails (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(String... params) { + String str_leadId = (String) params [0]; + //String versionCode = (String) params[2]; + + SoapObject response = getStudDetails(str_leadId); + + Log.d("GetStudentDetailssresp",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + + progressDialog.setMessage("Loading"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + + } + + @Override + protected void onPostExecute(SoapObject result) { + + if(result!=null) { + + Log.d("GetStudentDetailssresp", result.toString()); + + SoapPrimitive S_Status, O_ManagerName, S_StudName, S_StudCollegeName, S_StudType, S_StudLeadId, S_StudImagePath, S_ManagerMailId, S_ManagerMobileNumber, O_ManagerImagePath; + Object O_Status, O_StudName, O_StudCollegeName, O_StudType, O_StudLeadId, O_StudImagePath; + String str_Status = null, str_StudName = null, str_StudCollegeName = null, str_StudType = null, str_StudLeadId = null, str_StudImagePath = null; + + + O_Status = result.getProperty("Status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) result.getProperty("Status"); + Log.d("Status:", S_Status.toString()); + str_Status = S_Status.toString(); + } + + if (str_Status.equalsIgnoreCase("Success")) { + O_StudName = result.getProperty("StudentName"); + if (!O_StudName.toString().equals("anyType{}") && !O_StudName.toString().equals(null)) { + S_StudName = (SoapPrimitive) result.getProperty("StudentName"); + Log.d("StudentName", S_StudName.toString()); + str_StudName = S_StudName.toString(); + } + + O_StudCollegeName = result.getProperty("College_Name"); + if (!O_StudCollegeName.toString().equals("anyType{}") && !O_StudCollegeName.toString().equals(null)) { + S_StudCollegeName = (SoapPrimitive) result.getProperty("College_Name"); + Log.d("S_StudCollegeName", S_StudCollegeName.toString()); + str_StudCollegeName = S_StudCollegeName.toString(); + } + + O_StudType = result.getProperty("Student_Type"); + if (!O_StudType.toString().equals("anyType{}") && !O_StudType.toString().equals(null)) { + S_StudType = (SoapPrimitive) result.getProperty("Student_Type"); + Log.d("S_StudType", S_StudType.toString()); + str_StudType = S_StudType.toString(); + } + + O_StudLeadId = result.getProperty("Lead_Id"); + if (!O_StudLeadId.toString().equals("anyType{}") && !O_StudLeadId.toString().equals(null)) { + S_StudLeadId = (SoapPrimitive) result.getProperty("Lead_Id"); + Log.d("S_StudLeadId", S_StudLeadId.toString()); + str_StudLeadId = S_StudLeadId.toString(); + } + + O_StudImagePath = result.getProperty("Student_Image"); + if (!O_StudImagePath.toString().equals("anyType{}") && !O_StudImagePath.toString().equals(null)) { + S_StudImagePath = (SoapPrimitive) result.getProperty("Student_Image"); + Log.d("S_StudImagePath", S_StudImagePath.toString()); + str_StudImagePath = S_StudImagePath.toString(); + } + + if (str_StudName != null && !str_StudName.isEmpty() && str_StudName != "" && !str_StudName.equals("anyType{}") && str_StudName != "{}") { + txt_studName.setText(str_StudName); + } + + if (str_StudCollegeName != null && !str_StudCollegeName.isEmpty() && str_StudCollegeName != "" && !str_StudCollegeName.equals("anyType{}") && str_StudCollegeName != "{}") { + txt_studCollegeName.setText(str_StudCollegeName); + } + + if (str_StudLeadId != null && !str_StudLeadId.isEmpty() && str_StudLeadId != "" && !str_StudLeadId.equals("anyType{}") && str_StudLeadId != "{}") { + txt_leadId.setText(str_StudLeadId); + } + + if (str_StudType != null && !str_StudType.isEmpty() && str_StudType != "" && !str_StudType.equals("anyType{}") && str_StudType != "{}") { + txt_studType.setText(str_StudType); + } + + if (str_StudImagePath != null && !str_StudImagePath.isEmpty() && str_StudImagePath != "" && !str_StudImagePath.equals("anyType{}") && str_StudImagePath != "{}") { + Log.d("InsideLoadProfile", "Pick"); + str_studImgUrl = serverPath + str_StudImagePath.substring(2); + + Log.d("str_studImgUrlsssssssss", str_studImgUrl); + + LoadStudProfilePick loadStudProfilePick = new LoadStudProfilePick(getActivity()); + loadStudProfilePick.execute(); + + /* Glide.with(getActivity()).load(str_studImgUrl) + .thumbnail(0.5f) + .crossFade() + .diskCacheStrategy(DiskCacheStrategy.ALL) + .into(img_studProfPick);*/ + + /* if (img_studProfPick1.getVisibility() == View.VISIBLE) { + //img_studProfPick1.setImageBitmap(result); + Glide.with(getActivity()).load(str_studImgUrl) + .thumbnail(0.5f) + .crossFade() + .diskCacheStrategy(DiskCacheStrategy.ALL) + .into(img_studProfPick1); + } else { + //img_studProfPick.setImageBitmap(result); + + Glide.with(getActivity()).load(str_studImgUrl) + .thumbnail(0.5f) + .crossFade() + .diskCacheStrategy(DiskCacheStrategy.ALL) + .into(img_studProfPick); + }*/ + + + } + } + + + + + + + +/* SoapPrimitive status = (SoapPrimitive) result.getProperty("Status"); + //Log.d("Status is:",status.toString()); + + + + + if(status.toString().equals("Success")) { + SoapPrimitive role = (SoapPrimitive) result.getProperty("Role"); + Log.d("Role is:", role.toString()); + + SoapPrimitive isProfileEdited = (SoapPrimitive) result.getProperty("isProfileEdit"); + }*/ + + //progressBar.setVisibility(View.GONE); + } + progressDialog.dismiss(); + + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapObject getStudDetails(String leadid) + { + + String METHOD_NAME = "GetStudentDetailss"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetStudentDetailss"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + + /*request.addProperty("Username", mobilenum); + request.addProperty("Password", leadid);*/ + + /*request.addProperty("Username", leadid); + request.addProperty("Password", mobilenum);*/ + +/* String username=edt_leadid.getText().toString(); + String password=edt_mobnumber.getText().toString();*/ + + request.addProperty("leadId", leadid); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Login.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + Log.d("soap responseyyyyyyy",envelope.getResponse().toString()); + SoapObject response = (SoapObject) envelope.getResponse(); + Log.d("soap responseyyyyyyy",response.toString()); + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.d("exception outside",t.getMessage().toString()); + } + return null; + + + } + + + + + + private void initializeViews() { + txt_studName = (TextView) view.findViewById(R.id.txt_studName); + txt_studCollegeName = (TextView) view.findViewById(R.id.txt_studCollegeName); + txt_studType = (TextView) view.findViewById(R.id.txt_studType); + txt_leadId = (TextView) view.findViewById(R.id.txt_leadId); + img_studProfPick = (ImageView) view.findViewById(R.id.img_studProfPick); + + img_crownMan = (ImageView) view.findViewById(R.id.img_crownMan); + img_crownWoman = (ImageView) view.findViewById(R.id.img_crownWoman); + txt_noOfProjects = (TextView) view.findViewById(R.id.txt_noOfProjects); + + img_studProfPick1 = (ImageView) view.findViewById(R.id.img_studProfPick1); + + fram_layout = (FrameLayout) view.findViewById(R.id.fram_layout); + + btn_apply = (Button) view.findViewById(R.id.btn_apply); + + + result = new Result(); + } + + + public class LoadStudProfilePick extends AsyncTask { + + private Context context; + private ProgressDialog progressDialog; + + LoadStudProfilePick (Context context){ + this.context = context; + progressDialog = new ProgressDialog(context); + } + + @Override + protected void onPreExecute() { + progressDialog.setMessage("Loading"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + + } + + @Override + protected Bitmap doInBackground(Void... params) { + + Bitmap bitmaplogo=null; + + try { + //Log.d("Urlssssssssssss",url.toString()); + //bitmaplogo = BitmapFactory.decodeStream(url.openStream()); + URL urlis = new URL(str_studImgUrl); + InputStream inputStream = urlis.openStream(); + bitmaplogo = BitmapFactory.decodeStream(inputStream); + } + catch(FileNotFoundException ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Please update profile picture", Toast.LENGTH_LONG).show(); + } + }); + } + + catch (MalformedURLException e) { + e.printStackTrace(); +/* result.setStudresult(e.getMessage().toString());*/ + + final String exceptnMsg = e.getMessage().toString(); + + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),exceptnMsg, Toast.LENGTH_LONG).show(); + } + }); + + //return result; + } catch (IOException e) { + e.printStackTrace(); + /* result.setStudresult(e.getMessage().toString());*/ + + final String exceptnMsg = e.getMessage().toString(); + + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),exceptnMsg, Toast.LENGTH_LONG).show(); + } + }); + //return result; + }catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + + + + //result.setStudbitmap(bitmaplogo); + return bitmaplogo; + //return result; + } + + @Override + protected void onPostExecute(Bitmap result) { + /* bitmapList.add(bitmap); + + Log.d("count1iss", String.valueOf(count1)); + Log.d("count2iss", String.valueOf(count2)); + Log.d("Bitmapsizess", String.valueOf(bitmapList.size())); + if(bitmapList.size()==count2){ + img_mainGallery.setImageBitmap(bitmapList.get(0)); + txt_numOfImages.setText("Images: "+bitmapList.size()); + }*/ + + + //} + if(result!=null) { + try { + if (img_studProfPick1.getVisibility() == View.VISIBLE) { + img_studProfPick1.setImageBitmap(result); + } else { + img_studProfPick.setImageBitmap(result); + } + } catch (OutOfMemoryError ex) { + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context, "Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + } + + + /* if(result.getStudresult()!=null) { + + //Log.d("Inside", bitmap.toString()); + + img_studProfPick.setImageBitmap(result.getStudbitmap()); + } + else{ + Toast.makeText(getActivity(),"Exception occured student:"+result.getStudresult(),Toast.LENGTH_LONG).show(); + }*/ + + //progressBar.setVisibility(GONE); + + progressDialog.dismiss(); + } + } + + + +/* private void setStateSpinner(View view) { + + + final ArrayList liststate = new ArrayList(); + liststate.add("Karnataka"); + liststate.add("Maharashtra"); + liststate.add("AndhraPradesh"); + + ArrayAdapter dataAdapterState = new ArrayAdapter(context, R.layout.simple_spinner_items, liststate); + + // Drop down layout style - list view with radio button + dataAdapterState.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + + // attaching data adapter to spinner + spin_state.setAdapter(dataAdapterState); + spin_state.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorWhite)); + } + + private void setCitySpinner(View view) { + + + final ArrayList listcity = new ArrayList(); + listcity.add("Hubballi"); + listcity.add("Dharwad"); + listcity.add("Belgaum"); + + ArrayAdapter dataAdapterCity = new ArrayAdapter(context, R.layout.simple_spinner_items, listcity); + + // Drop down layout style - list view with radio button + dataAdapterCity.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + + // attaching data adapter to spinner + spin_city.setAdapter(dataAdapterCity); + spin_city.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorWhite)); + } + + private void setInstitutionSpinner(View view) { + + + final ArrayList listinstitution = new ArrayList(); + listinstitution.add("JG College of commerce"); + listinstitution.add("B.V.B College of Engineering"); + + ArrayAdapter dataAdapterInstitution = new ArrayAdapter(context, R.layout.simple_spinner_items, listinstitution); + + // Drop down layout style - list view with radio button + dataAdapterInstitution.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + + // attaching data adapter to spinner + spin_institution.setAdapter(dataAdapterInstitution); + spin_institution.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorWhite)); + } + + private void setSemesterSpinner(View view) { + + + final ArrayList listsemester = new ArrayList(); + listsemester.add("1"); + listsemester.add("2"); + listsemester.add("3"); + + //ArrayAdapter dataAdapterSem = new ArrayAdapter(context, R.layout.simple_spinner_semester, listsemester); + ArrayAdapter dataAdapterSem = new ArrayAdapter(context, R.layout.simple_spinner_items, listsemester); + + // Drop down layout style - list view with radio button + dataAdapterSem.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + + // attaching data adapter to spinner + spin_semester.setAdapter(dataAdapterSem); + spin_semester.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorWhite)); + } + + private void setDateOfBirth(View view) { + + final Calendar c = Calendar.getInstance(); + + edt_dob.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + mYear = c.get(Calendar.YEAR); + mMonth = c.get(Calendar.MONTH); + mDay = c.get(Calendar.DAY_OF_MONTH); + + DatePickerDialog datePickerDialog = new DatePickerDialog(context, + new DatePickerDialog.OnDateSetListener() { + + @Override + public void onDateSet(DatePicker view, int year, + int monthOfYear, int dayOfMonth) { + + cDay = dayOfMonth; + cMonth = monthOfYear; + cYear = year; + + //TextView txtExactDate = (TextView) findViewById(R.id.txt_exactDate); + edt_dob.setText(dayOfMonth + "/" + (monthOfYear + 1) + "/" + year); + + //txtDate.edita + } + }, mYear, mMonth, mDay); + + datePickerDialog.show(); + } + }); + + + }*/ + + +} diff --git a/app/src/main/java/com/leadcampusapp/MySpannable.java b/app/src/main/java/com/leadcampusapp/MySpannable.java new file mode 100644 index 0000000..5467471 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/MySpannable.java @@ -0,0 +1,35 @@ +package com.leadcampusapp; + +import android.graphics.Color; +import android.text.TextPaint; +import android.text.style.ClickableSpan; +import android.view.View; + +/** + * Created by User on 7/20/2018. + */ + +public class MySpannable extends ClickableSpan { + + private boolean isUnderline = false; + + /** + * Constructor + */ + public MySpannable(boolean isUnderline) { + this.isUnderline = isUnderline; + } + + @Override + public void updateDrawState(TextPaint ds) { + + ds.setUnderlineText(isUnderline); + ds.setColor(Color.parseColor("#343434")); + + } + + @Override + public void onClick(View widget) { + + } +} diff --git a/app/src/main/java/com/leadcampusapp/NewsFeedsActivity.java b/app/src/main/java/com/leadcampusapp/NewsFeedsActivity.java new file mode 100644 index 0000000..a2fba2f --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/NewsFeedsActivity.java @@ -0,0 +1,327 @@ +package com.leadcampusapp; + +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +//import android.support.design.widget.TabLayout; +import androidx.viewpager.widget.ViewPager; +import androidx.appcompat.app.AppCompatActivity; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.ImageButton; +import android.widget.ImageView; +import android.widget.TextView; + +//import com.android.sripad.leadnew_22_6_2018.R; + +import com.google.android.material.tabs.TabLayout; + +import java.io.File; + +public class NewsFeedsActivity extends AppCompatActivity implements ConnectivityReceiver.ConnectivityReceiverListener{ + + ImageButton img_newsfeedsBack; + + public static final String PREFBook_Stud= "prefbook_stud"; + private SharedPreferences shardpref_S_obj; + public static final String PrefID_Role = "prefid_role"; + public String str_role = null; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_news_feeds); + + //img_newsfeedsBack = (ImageButton) findViewById(R.id.img_newsfeedsBack); + + shardpref_S_obj=NewsFeedsActivity.this.getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + shardpref_S_obj.getString(PrefID_Role, "").trim(); + str_role = shardpref_S_obj.getString(PrefID_Role, "").trim(); + + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + //getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background)); + + View actionBarView = getSupportActionBar().getCustomView(); + TextView actionBarTV = (TextView) actionBarView.findViewById(R.id.txt_actionBar); + actionBarTV.setText("News Feeds"); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); + + + + + + + /* View view1; + LayoutInflater inflater1 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view1 = inflater1.inflate(R.layout.leadstorytablayout, null);*/ + + View view2; + LayoutInflater inflater2 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view2 = inflater2.inflate(R.layout.leadfbtablayout, null); + + View view3; + LayoutInflater inflater3 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view3 = inflater3.inflate(R.layout.leadintablayout, null); + + View view4; + LayoutInflater inflater4 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view4 = inflater4.inflate(R.layout.leadtwtablayout, null); + + + + + TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); + // tabLayout.addTab(tabLayout.newTab().setCustomView(view1)); + tabLayout.addTab(tabLayout.newTab().setCustomView(view2)); + tabLayout.addTab(tabLayout.newTab().setCustomView(view3)); + tabLayout.addTab(tabLayout.newTab().setCustomView(view4)); + + + TabLayout.Tab selectedTab = tabLayout.getTabAt(0); + View view = selectedTab.getCustomView(); + ImageView img1=(ImageView) view.findViewById(R.id.img_newsfeedstabtitle); + //img1.setImageResource(R.drawable.story_wht); + // img1.setImageResource(R.drawable.fb_001); + + // TextView selectedText = (TextView) view.findViewById(R.id.txt_newsfeedstabtitle); + //selectedText.setTextColor(Color.parseColor("#FFFFFF")); + + + //tabLayout.addTab(tabLayout.newTab().setText("Tab 3")); + //tabLayout.setTabGravity(TabLayout.GRAVITY_FILL); + + final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); + final NewsFeedsAdapter adapter = new NewsFeedsAdapter(getSupportFragmentManager(), tabLayout.getTabCount()); + viewPager.setAdapter(adapter); + viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); + tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { + @Override + public void onTabSelected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + /* if(tab.getPosition()==0) { + ImageView img1 = (ImageView) view.findViewById(R.id.img_newsfeedstabtitle); + //img1.setImageResource(R.drawable.story_wht); + img1.setImageResource(R.drawable.story); + }else */ + if(tab.getPosition()==0){ + ImageView img1 = (ImageView) view.findViewById(R.id.img_fbfeedstabtitle); + //img1.setImageResource(R.drawable.fb_whit_001); + img1.setImageResource(R.drawable.fb_001); + }else if(tab.getPosition()==1){ + ImageView img1 = (ImageView) view.findViewById(R.id.img_infeedstabtitle); + //img1.setImageResource(R.drawable.instwht_001); + img1.setImageResource(R.drawable.inst_001); + }else if(tab.getPosition()==2){ + ImageView img1 = (ImageView) view.findViewById(R.id.img_twfeedstabtitle); + //img1.setImageResource(R.drawable.tw_wht001); + img1.setImageResource(R.drawable.tw_001); + } + // TextView selectedText = (TextView) view.findViewById(R.id.txt_newsfeedstabtitle); + // selectedText.setTextColor(Color.parseColor("#FFFFFF")); + + viewPager.setCurrentItem(tab.getPosition()); + } + + @Override + public void onTabUnselected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + /* if(tab.getPosition()==0) { + ImageView img1 = (ImageView) view.findViewById(R.id.img_newsfeedstabtitle); + img1.setImageResource(R.drawable.story); + }else*/ + if(tab.getPosition()==0){ + ImageView img1 = (ImageView) view.findViewById(R.id.img_fbfeedstabtitle); + img1.setImageResource(R.drawable.fb_001); + }else if(tab.getPosition()==1){ + ImageView img1 = (ImageView) view.findViewById(R.id.img_infeedstabtitle); + img1.setImageResource(R.drawable.inst_001); + }else if(tab.getPosition()==2){ + ImageView img1 = (ImageView) view.findViewById(R.id.img_twfeedstabtitle); + img1.setImageResource(R.drawable.tw_001); + } + // TextView selectedText = (TextView) view.findViewById(R.id.txt_newsfeedstabtitle); + // selectedText.setTextColor(Color.parseColor("#000000")); + } + + @Override + public void onTabReselected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + /* if(tab.getPosition()==0) { + ImageView img1 = (ImageView) view.findViewById(R.id.img_newsfeedstabtitle); + //img1.setImageResource(R.drawable.story_wht); + img1.setImageResource(R.drawable.story); + }else */ + if(tab.getPosition()==0){ + ImageView img1 = (ImageView) view.findViewById(R.id.img_fbfeedstabtitle); + //img1.setImageResource(R.drawable.fb_whit_001); + img1.setImageResource(R.drawable.fb_001); + }else if(tab.getPosition()==1){ + ImageView img1 = (ImageView) view.findViewById(R.id.img_infeedstabtitle); + //img1.setImageResource(R.drawable.instwht_001); + img1.setImageResource(R.drawable.inst_001); + }else if(tab.getPosition()==2){ + ImageView img1 = (ImageView) view.findViewById(R.id.img_twfeedstabtitle); + //img1.setImageResource(R.drawable.tw_wht001); + img1.setImageResource(R.drawable.tw_001); + } + // TextView selectedText = (TextView) view.findViewById(R.id.txt_newsfeedstabtitle); + //selectedText.setTextColor(Color.parseColor("#FFFFFF")); + } + }); + + /*img_newsfeedsBack.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + finish(); + } + });*/ + + + + + + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_main, menu); + MenuItem action_editProfile = menu.findItem(R.id.action_editProfile); + action_editProfile.setVisible(false); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + + /* if (id == R.id.action_editProfile) { + Intent ittNewsFeedsToEditProfile = new Intent(NewsFeedsActivity.this ,EditProfileActivity.class); + startActivity(ittNewsFeedsToEditProfile); + return true; + }*/ + + if (id == R.id.action_logout) { + + //deleteCache(NewsFeedsActivity.this); + + Intent ittNewsFeedsToLogin = new Intent(NewsFeedsActivity.this ,LoginActivity.class); + startActivity(ittNewsFeedsToLogin); + return true; + } + + if (id == android.R.id.home) { + /* Intent ittNewsFeedsToHome = new Intent(NewsFeedsActivity.this ,HomeActivity.class); + startActivity(ittNewsFeedsToHome);*/ + + if(str_role.equals("Student")) { + Intent ittEventsToStudHome = new Intent(NewsFeedsActivity.this, HomeActivity.class); + startActivity(ittEventsToStudHome); + }else if(str_role.equalsIgnoreCase("Principal")){ + Intent ittEventsToStudHome = new Intent(NewsFeedsActivity.this, PrincipleHomeActivity.class); + startActivity(ittEventsToStudHome); + } + else{ + Intent ittEventsToPMHome = new Intent(NewsFeedsActivity.this, PMHomeActivity.class); + startActivity(ittEventsToPMHome); + } + + return true; + } + return super.onOptionsItemSelected(item); + } + + + @Override + protected void onResume() { + super.onResume(); + // register connection status listener + MyApplication.getInstance().setConnectivityListener(this); + } + + @Override + public void onNetworkConnectionChanged(boolean isConnected) { + showSnack(isConnected); + } + + private void showSnack(boolean isConnected) { + + if (!isConnected) { + + AlertDialog.Builder adb = new AlertDialog.Builder(NewsFeedsActivity.this); + //adb.setView(alertDialogView); + + adb.setTitle("Sorry! Not connected to the internet"); + + adb.setIcon(android.R.drawable.ic_dialog_alert); + + adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + + adb.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + adb.setCancelable(true); + adb.show(); + } + +/* String message; + int color; + if (isConnected) { + message = "Good! Connected to Internet"; + color = Color.WHITE; + } else { + message = "Sorry! Not connected to internet"; + color = Color.RED; + } + + Snackbar snackbar = Snackbar + .make(findViewById(R.id.coordinator_layout), message, Snackbar.LENGTH_LONG); + + View sbView = snackbar.getView(); + TextView textView = (TextView) sbView.findViewById(android.support.design.R.id.snackbar_text); + textView.setTextColor(color); + snackbar.show();*/ + } + + + public static void deleteCache(Context context) { + try { + File dir = context.getCacheDir(); + deleteDir(dir); + } catch (Exception e) {} + } + + public static boolean deleteDir(File dir) { + if (dir != null && dir.isDirectory()) { + String[] children = dir.list(); + for (int i = 0; i < children.length; i++) { + boolean success = deleteDir(new File(dir, children[i])); + if (!success) { + return false; + } + } + return dir.delete(); + } else if(dir!= null && dir.isFile()) { + return dir.delete(); + } else { + return false; + } + } + +} diff --git a/app/src/main/java/com/leadcampusapp/NewsFeedsAdapter.java b/app/src/main/java/com/leadcampusapp/NewsFeedsAdapter.java new file mode 100644 index 0000000..9f7436c --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/NewsFeedsAdapter.java @@ -0,0 +1,45 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 22-06-2018. + */ +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentStatePagerAdapter; + +public class NewsFeedsAdapter extends FragmentStatePagerAdapter { + int mNumOfTabs; + + public NewsFeedsAdapter(FragmentManager fm, int NumOfTabs) { + super(fm); + this.mNumOfTabs = NumOfTabs; + } + + @Override + public Fragment getItem(int position) { + + switch (position) { + + /* case 0: + LeadStoryFragment tab0 = new LeadStoryFragment(); + return tab0;*/ + case 0: + LeadFBFragment tab1 = new LeadFBFragment(); + return tab1; + case 1: + LeadInFragment tab2= new LeadInFragment(); + return tab2; + case 2: + LeadTWFragment tab3 = new LeadTWFragment(); + return tab3; + + default: + return null; + } + } + + @Override + public int getCount() { + return mNumOfTabs; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/NonScrollListView.java b/app/src/main/java/com/leadcampusapp/NonScrollListView.java new file mode 100644 index 0000000..570871b --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/NonScrollListView.java @@ -0,0 +1,29 @@ +package com.leadcampusapp; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.ViewGroup; +import android.widget.ListView; + +/** + * Created by Admin on 16-04-2018. + */ +public class NonScrollListView extends ListView { + public NonScrollListView(Context context) { + super(context); + } + public NonScrollListView(Context context, AttributeSet attrs) { + super(context, attrs); + } + public NonScrollListView(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + } + @Override + public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec( + Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); + super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom); + ViewGroup.LayoutParams params = getLayoutParams(); + params.height = getMeasuredHeight(); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/NotificationCustomAdapter.java b/app/src/main/java/com/leadcampusapp/NotificationCustomAdapter.java new file mode 100644 index 0000000..2ec8012 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/NotificationCustomAdapter.java @@ -0,0 +1,127 @@ +package com.leadcampusapp; + +/** + * Created by User on 9/27/2018. + */ + + import android.app.Activity; + import android.content.Context; + import android.util.Log; + import android.view.LayoutInflater; + import android.view.View; + import android.view.View.OnClickListener; + import android.view.ViewGroup; + import android.widget.BaseAdapter; + import android.widget.ImageView; + import android.widget.TextView; + import android.widget.Toast; + + import com.leadcampusapp.module.NotificationActivityModel; + + import java.text.ParseException; + import java.text.SimpleDateFormat; + import java.util.ArrayList; + import java.util.Date; + +public class NotificationCustomAdapter extends BaseAdapter{ + String [] result; + Context context; + int [] imageId; + private static LayoutInflater inflater=null; + public ArrayList projList; + Activity activity; + + public NotificationCustomAdapter(NotificationHistoryActivity mainActivity, String[] prgmNameList, int[] prgmImages) { + // TODO Auto-generated constructor stub + result=prgmNameList; + context=mainActivity; + imageId=prgmImages; + inflater = ( LayoutInflater )context. + getSystemService(Context.LAYOUT_INFLATER_SERVICE); + } + private ArrayList mDisplayedValues = null; + + public NotificationCustomAdapter(Activity activity, ArrayList projList) { + super(); + this.activity = activity; + this.projList = projList; + context=activity; + this.mDisplayedValues = projList; + inflater = ( LayoutInflater )context. + getSystemService(Context.LAYOUT_INFLATER_SERVICE); + } + + @Override + public int getCount() { + // TODO Auto-generated method stub + return mDisplayedValues.size(); + } + + @Override + public Object getItem(int position) { + // TODO Auto-generated method stub + return position; + } + + @Override + public long getItemId(int position) { + // TODO Auto-generated method stub + return position; + } + + public class Holder + { + TextView tv1; + TextView tv2; + TextView tv3; + ImageView img; + } + @Override + public View getView(final int position, View convertView, ViewGroup parent) { + // TODO Auto-generated method stub + Holder holder=new Holder(); + View rowView; + rowView = inflater.inflate(R.layout.notification_list, null); + LayoutInflater inflater = activity.getLayoutInflater(); + // LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + + //rowView = inflater.inflate(R.layout.notification_list, parent, false); + + NotificationActivityModel item = projList.get(position); + + holder.tv1=(TextView) rowView.findViewById(R.id.label); + holder.tv2=(TextView) rowView.findViewById(R.id.n_message); + holder.tv3=(TextView) rowView.findViewById(R.id.n_date); + holder.img=(ImageView) rowView.findViewById(R.id.img); + + + SimpleDateFormat inFormat = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss aa"); + Date date = null; + String day = null; + try { + date = inFormat.parse(item.getNotification_Date()); + SimpleDateFormat outFormat = new SimpleDateFormat("dd MMM hh:mm aa"); + day = outFormat.format(date); + Log.e("tag","day="+day+" date="+date); + } catch (ParseException e) { + e.printStackTrace(); + } + + holder.tv1.setText(item.getNotification_Type()); + holder.tv2.setText(item.getNotification_Message()); + holder.tv3.setText(day); + // holder.img.setImageResource(imageId[position]); + /* rowView.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + // TODO Auto-generated method stub + Toast.makeText(context, "You Clicked "+result[position], Toast.LENGTH_LONG).show(); + } + });*/ + + + + return rowView; + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/NotificationHistoryActivity.java b/app/src/main/java/com/leadcampusapp/NotificationHistoryActivity.java new file mode 100644 index 0000000..1912be3 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/NotificationHistoryActivity.java @@ -0,0 +1,291 @@ +package com.leadcampusapp; + +import android.app.AlertDialog; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.AsyncTask; +import androidx.appcompat.app.AppCompatActivity; +import android.os.Bundle; +import android.util.Log; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.ListView; +import android.widget.ProgressBar; +import android.widget.Toast; + +import com.leadcampusapp.module.NotificationActivityModel; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.util.ArrayList; + +public class NotificationHistoryActivity extends AppCompatActivity { + + String[] mobileArray = {"Android","IPhone","WindowsMobile","Blackberry", + "WebOS","Ubuntu","Windows7","Max OS X"}; + + + Class_URL config_obj= new Class_URL(); + public static final String PREFBook_LoginTrack= "prefbook_logintrack"; + public static final String PrefID_WhereToGo = "prefid_wheretogo"; // + SharedPreferences shardprefLoginTrack_obj; + SharedPreferences.Editor editor_LoginTrack; + + private Context context; + + public static final String PREFBook_Stud= "prefbook_stud"; //sharedpreference Book + public static final String PrefID_RegID = "prefid_regid"; // + public static final String PrefID_SLeadID = "prefid_sleadid"; // + private SharedPreferences shardpref_S_obj; + private String str_leadId; + private ArrayList originalList = null; + private ArrayList notifList; + private NotificationCustomAdapter adapter; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_notification_history); + + context = this; + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + + notifList = new ArrayList(); + + shardpref_S_obj=getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + str_leadId = shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + Log.d("str_leadId:",str_leadId); + + // ArrayAdapter adapter = new ArrayAdapter(this, + // R.layout.notification_list, mobileArray); + // AnimateBell(); + ListView listView = (ListView) findViewById(R.id.mobile_list); + // listView.setAdapter(adapter); + // listView.setAdapter(new NotificationCustomAdapter(this, prgmNameList,prgmImages)); + adapter = new NotificationCustomAdapter(this,notifList); + listView.setAdapter(adapter); + + GetNotificationDetails getNotificationDetails = new GetNotificationDetails(this); + getNotificationDetails.execute(); + } + + /* public void AnimateBell() { + Animation shake = AnimationUtils.loadAnimation(this, R.anim.shakeanimation); + ImageView imgBell= (ImageView) findViewById(R.id.notification); + imgBell.setImageResource(R.drawable.baseline_notifications_white_24); + imgBell.setAnimation(shake); + }*/ + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu, menu); + MenuItem action_request = menu.findItem(R.id.action_request); + action_request.setVisible(false); + MenuItem action_feedback = menu.findItem(R.id.action_feedback); + action_feedback.setVisible(false); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + + if (id == R.id.action_editProfile) { + Intent itthomeToEditProfile = new Intent(NotificationHistoryActivity.this ,EditProfileActivity.class); + startActivity(itthomeToEditProfile); + return true; + } + + + if (id == R.id.action_logout) { + + /* editor_LoginTrack = shardprefLoginTrack_obj.edit(); + editor_LoginTrack.putString(PrefID_WhereToGo, config_obj.packagename+"LoginActivity"); + editor_LoginTrack.commit();*/ + + //deleteCache(context); + + Intent itthomeToLogin = new Intent(NotificationHistoryActivity.this ,LoginActivity.class); + startActivity(itthomeToLogin); + return true; + } + + /*if (id == R.id.notification) { + Intent itthomeToNotification = new Intent(NotificationHistoryActivity.this ,NotificationHistoryActivity.class); + startActivity(itthomeToNotification); + return true; + }*/ + + return super.onOptionsItemSelected(item); + } + + public class GetNotificationDetails extends AsyncTask { + + AlertDialog alertDialog; + private ProgressBar progressBar; + + GetNotificationDetails (Context ctx){ + context = ctx; + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapObject response = getProjectDtls(); + + //Log.d("Soapresponseissssss",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); + } + + @Override + protected void onPostExecute(SoapObject result) { + notifList.clear(); + if (result != null) { + + SoapPrimitive S_Notification_Type, S_Notification_Message, S_Notification_Date, S_ProjectStatus, S_Rating, S_ProjectId, S_Status; + Object O_Notification_Type, O_Notification_Message, O_Notification_Date, O_ProjectStatus, O_Rating, O_ProjectId, O_Status; + String str_Notification_Type = null, str_Notification_Message = null, str_Notification_Date = null, str_ProjectStatus = null, str_Rating = null, str_projectId = null, str_Status = null; + + for (int i = 0; i < result.getPropertyCount(); i++) { + SoapObject list = (SoapObject) result.getProperty(i); + + Log.d("Result", list.toString()); + + O_Status = list.getProperty("Status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) list.getProperty("Status"); + Log.d("Status:", S_Status.toString()); + str_Status = S_Status.toString(); + } + + if (str_Status.equalsIgnoreCase("Success")) { + + O_Notification_Type = list.getProperty("Notification_Type"); + if (!O_Notification_Type.toString().equals("anyType{}") && !O_Notification_Type.toString().equals(null)) { + S_Notification_Type = (SoapPrimitive) list.getProperty("Notification_Type"); + Log.d("Notification_Type", S_Notification_Type.toString()); + str_Notification_Type = S_Notification_Type.toString(); + } + + O_Notification_Message = list.getProperty("Notification_Message"); + if (!O_Notification_Message.toString().equals("anyType{}") && !O_Notification_Message.toString().equals(null)) { + S_Notification_Message = (SoapPrimitive) list.getProperty("Notification_Message"); + Log.d("Notification_Message", S_Notification_Message.toString()); + str_Notification_Message = S_Notification_Message.toString(); + } + + O_Notification_Date = list.getProperty("Notification_Date"); + if (!O_Notification_Date.toString().equals("anyType{}") && !O_Notification_Date.toString().equals(null)) { + S_Notification_Date = (SoapPrimitive) list.getProperty("Notification_Date"); + Log.d("Notification_Date", S_Notification_Date.toString()); + str_Notification_Date = S_Notification_Date.toString(); + } + + NotificationActivityModel item; + + item = new NotificationActivityModel(str_Notification_Type, str_Notification_Message, str_Notification_Date); + notifList.add(item); + } + } + + + + + originalList = new ArrayList(); + originalList.clear(); + originalList.addAll(notifList); + + adapter.notifyDataSetChanged(); + + } + progressBar.setVisibility(View.GONE); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapObject getProjectDtls() { + String METHOD_NAME = "GetTopTenStudentNotificationList"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetTopTenStudentNotificationList"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + request.addProperty("Lead_Id",str_leadId); + // request.addProperty("PDId",mapProjectIdProject.get(selectedProject)); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + envelope.setOutputSoapObject(request); + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Login.toString().trim()); + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + SoapObject response = (SoapObject) envelope.getResponse(); + Log.e("soapcompletionxxxx",response.toString()); + return response; + + } + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(NotificationHistoryActivity.this,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(NotificationHistoryActivity.this,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + //getActivity().finish(); + } + } + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(NotificationHistoryActivity.this,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(NotificationHistoryActivity.this,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + + } +} diff --git a/app/src/main/java/com/leadcampusapp/PMApprovedFragment.java b/app/src/main/java/com/leadcampusapp/PMApprovedFragment.java new file mode 100644 index 0000000..d983ebb --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/PMApprovedFragment.java @@ -0,0 +1,417 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 22-06-2018. + */ + +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.AsyncTask; +import android.os.Bundle; +import androidx.fragment.app.Fragment; +import androidx.appcompat.app.AppCompatActivity; +import android.text.Editable; +import android.text.TextWatcher; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.EditText; +import android.widget.ListAdapter; +import android.widget.ListView; +import android.widget.ProgressBar; +import android.widget.SimpleAdapter; +import android.widget.TextView; +import android.widget.Toast; + +//import com.android.sripad.leadnew_22_6_2018.R; +import com.leadcampusapp.module.ApprovedProjectList; +import com.leadcampusapp.module.ApprovedProjectListModule; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Locale; + +public class PMApprovedFragment extends Fragment { + + // private ArrayList> list; + public static final String FIRST_COLUMN="First"; + public static final String SECOND_COLUMN="Second"; + public static final String THIRD_COLUMN="Third"; + public static final String FOURTH_COLUMN="Fourth"; + + ListView list,list_head; + ArrayList> mylist, mylist_title; + ListAdapter adapter_title, adapter; + HashMap map1, map2; + + String[] LeadId= {"MG10441","MG10442","MG10443","MG10444"}; + String[] Names = {"Pramod. K","Pooja. K","Shiva. S","Shripad. A"}; + // String[] Colleges = {"BVB","KLE","BVB","KLE"}; + String[] ProjectTittle = {"Food","Books","Food","Books"}; + String[] Approved_amt = {"100","200","300","400"}; + String[] Disperse_amt = {"100","200","100","200"}; + String[] Balance_amt = {"0","0","200","200"}; + + + ApprovedProjectListModule approvedProjectListObj; + ArrayList approvedProjectListModules; + private ProgressBar progressBar; + ApprovedProjectListModule[] approvedInfosarr; + int responseCount=0; + int i=0; + + // Integer ManagerId; + + public static final String PREFBook_PM= "prefbook_pm"; //sharedpreference Book + public static final String PrefID_PMID = "prefid_pmid"; // + SharedPreferences shardprefPM_obj; + String str_MangerID; + Integer MDId; + + private EditText etSearch; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + + View view=inflater.inflate(R.layout.pmapproved_fragment, container, false); + + list = (ListView) view.findViewById(R.id.lv_PMapproved); + list_head = (ListView) view.findViewById(R.id.lv_approvedlisthead); + progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + + approvedProjectListObj = new ApprovedProjectListModule(); + +/* ManagerId = getActivity().getIntent().getExtras().getInt("ManagerId"); + Log.i("tag","MangerID PMProjectDetails="+ManagerId); +*/ + + shardprefPM_obj= getActivity().getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MangerID = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + Log.d("str_leadId:",str_MangerID); + // Toast.makeText(this,"LeadId: "+str_MangerID,Toast.LENGTH_LONG).show(); + MDId=Integer.parseInt(str_MangerID); + + etSearch = (EditText) view.findViewById(R.id.etSearch); + etSearch.addTextChangedListener(new TextWatcher() { + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + // Call back the Adapter with current character to Filter + } + + @Override + public void beforeTextChanged(CharSequence s, int start, int count,int after) { + } + ; + @Override + public void afterTextChanged(Editable s) { + //adapter.getFilter().filter(s.toString()); + String text = etSearch.getText().toString().toLowerCase(Locale.getDefault()); + if(adapter!=null && text!=null) { + ((SimpleAdapter) adapter).getFilter().filter(text); + } + } + }); + + + GetApprovedProjectDetails getApprovedProjectDetails = new GetApprovedProjectDetails(getActivity()); + getApprovedProjectDetails.execute(MDId); + + // showActivity(); + return view; + } + + public void showActivity() { + + mylist = new ArrayList>(); + mylist_title = new ArrayList>(); + + /**********Display the headings************/ + map1 = new HashMap(); + + // map1.put("slno", "Lead Id"); + map1.put("one", " Name"); + // map1.put("two", " College"); + map1.put("two","Project Title"); + map1.put("three","Approved Amount"); + map1.put("four","Disperse Amount"); + map1.put("five","Balance Amount"); + mylist_title.add(map1); + + + try { + adapter_title = new SimpleAdapter(getContext(), mylist_title, R.layout.pmapproved_listhead, + new String[]{ "one", "two","three","four","five"}, new int[]{ + R.id.Name, R.id.ProjectTittle, R.id.tv_approved, R.id.tv_disperse, R.id.tv_balnce}); + list_head.setAdapter(adapter_title); + } catch (Exception e) { + + } + + /********************************************************/ + + + /**********Display the contents************/ + + /* for (int i = 0; i < Names.length; i++) { + map2 = new HashMap(); + + // map2.put("slno", LeadId[i]); + map2.put("one", Names[i]); + // map2.put("two", Colleges[i]); + map2.put("two", ProjectTittle[i]); + map2.put("three", Approved_amt[i]); + map2.put("four", Disperse_amt[i]); + map2.put("five", Balance_amt[i]); + mylist.add(map2); + } +*/ + for (int i = 0; i < ApprovedProjectList.listview_arr.size(); i++) { + + map2 = new HashMap(); + map2.put("one", ApprovedProjectList.listview_arr.get(i).getStudent_name()); + map2.put("two", ApprovedProjectList.listview_arr.get(i).getProject_tittle()); + map2.put("three", ApprovedProjectList.listview_arr.get(i).getApproved_amount()); + map2.put("four", ApprovedProjectList.listview_arr.get(i).getDisperse_amount()); + map2.put("five", ApprovedProjectList.listview_arr.get(i).getBalance_amount()); + map2.put("six", ApprovedProjectList.listview_arr.get(i).getLeadId()); + map2.put("seven", ApprovedProjectList.listview_arr.get(i).getPDId()); + map2.put("eight", ApprovedProjectList.listview_arr.get(i).getMobileNo()); + map2.put("nine", ApprovedProjectList.listview_arr.get(i).getStudent_Image_Path()); + map2.put("ten", ApprovedProjectList.listview_arr.get(i).getpmappr_collegename()); + map2.put("eleven", ApprovedProjectList.listview_arr.get(i).getpmappr_streamname()); + + /* Log.e("pmcollegename",ApprovedProjectList.listview_arr.get(i).getpmappr_collegename()); + Log.e("pmstreamname",ApprovedProjectList.listview_arr.get(i).getpmappr_streamname());*/ + mylist.add(map2); + + /* if(ApprovedProjectList.listview_arr.get(i).getApproved_amount().equals("0")){ + list.setBackgroundColor(Color.GREEN); + }*/ + } + + try { + adapter = new SimpleAdapter(getContext(), mylist, R.layout.pmapproved_list, + new String[]{"one", "two","three","four","five","six","seven","eight","nine","ten","eleven"}, new int[]{ + R.id.Name, R.id.ProjectTittle, R.id.tv_approved, R.id.tv_disperse, R.id.tv_balnce,R.id.tv_leadid,R.id.tv_projId,R.id.tv_mobileNo,R.id.tv_studImagePath, + R.id.pmapprov_collegenamelist_tv,R.id.pmapprov_streamnamelist_tv}); + list.setAdapter(adapter); + } catch (Exception e) { + + } + /* if (ApprovedProjectList.listview_arr.get(i).getApproved_amount().equals("0")) { + list.setBackgroundColor(Color.YELLOW); + }*/ + + list.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + // String item = ((TextView)view).getText().toString(); + // String selectedItem = (String) parent.getItemAtPosition(position); + //Object o = list.getItemAtPosition(position); + + + // Toast.makeText(getContext(), "item"+name, Toast.LENGTH_LONG).show(); + /* String approveamt=ApprovedProjectList.listview_arr.get(position).getApproved_amount(); + String desamt=ApprovedProjectList.listview_arr.get(position).getDisperse_amount(); + if(approveamt.equals(desamt)){ + // Toast.makeText(getActivity(),"approveamt: "+approveamt+" desamt="+desamt,Toast.LENGTH_LONG).show(); + Log.i("Tag","approveamt: "+approveamt+" desamt="+desamt); + }*/ + String approvedAmt = ((TextView) view.findViewById(R.id.tv_approved)).getText().toString(); + + Log.d("ApprovedAmountisssss",approvedAmt); + + + // if (approvedAmt.equals("0")) { + + if (approvedAmt.equals("-200")) //condition has been changed + { + view.setEnabled(false); + view.setOnClickListener(null); + + Toast.makeText(getActivity(),"Approved Amount is Zero",Toast.LENGTH_LONG).show(); + } else { + String name = ((TextView) view.findViewById(R.id.Name)).getText().toString(); + + String Lead_Id= ((TextView) view.findViewById(R.id.tv_leadid)).getText().toString(); + String ProjectId= ((TextView) view.findViewById(R.id.tv_projId)).getText().toString(); + String DisAmt = ((TextView) view.findViewById(R.id.tv_disperse)).getText().toString(); + String MobileNo = ((TextView) view.findViewById(R.id.tv_mobileNo)).getText().toString(); + String Student_Image_Path = ((TextView) view.findViewById(R.id.tv_studImagePath)).getText().toString(); + String pmapprove_collegenamelist= ((TextView) view.findViewById(R.id.pmapprov_collegenamelist_tv)).getText().toString(); + String pmapprove_streamnamelist=((TextView) view.findViewById(R.id.pmapprov_streamnamelist_tv)).getText().toString(); + + /* String Lead_Id= ApprovedProjectList.listview_arr.get(position).getLeadId(); + String ProjectId= ApprovedProjectList.listview_arr.get(position).getPDId(); + String DisAmt=ApprovedProjectList.listview_arr.get(position).getDisperse_amount(); + String MobileNo=ApprovedProjectList.listview_arr.get(position).getMobileNo(); + String Student_Image_Path= ApprovedProjectList.listview_arr.get(position).getStudent_Image_Path();*/ + Intent i = new Intent(getContext(), PMApproved_DetailsActivity.class); + i.putExtra("name", name); + i.putExtra("Lead_Id", Lead_Id); + i.putExtra("ProjectId", ProjectId); + i.putExtra("DisAmt",DisAmt); + i.putExtra("ManagerId", MDId); + i.putExtra("MobileNo",MobileNo); + i.putExtra("Student_Image_Path",Student_Image_Path); + i.putExtra("pmapprove_collegenamelist",pmapprove_collegenamelist); + i.putExtra("pmapprove_streamnamelist",pmapprove_streamnamelist); + startActivity(i); + } + } + + }); + } + public class GetApprovedProjectDetails extends AsyncTask { + + Context context; + + GetApprovedProjectDetails (Context ctx){ + context = ctx; + } + + + @Override + protected SoapObject doInBackground(Integer... params) { + Integer ManagerId = (Integer) params [0]; + //SoapObject response = getStudDtls(leadid); + + //unapprovedProjectListObj = new UnapprovedProjectListModule(); + approvedProjectListModules = new ArrayList(); + + String METHOD_NAME = "GetApprovedProjectList"; + String NamespaceMail="http://mis.leadcampus.org/", SOAP_ACTION1="http://mis.leadcampus.org/GetApprovedProjectList";//namespace+methodname + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + request.addProperty("ManagerId", ManagerId); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapObject response = (SoapObject) envelope.getResponse(); + // Log.d("soap responseyyyyyyy",response.toString()); + Log.d("Tag","soap response Approved"+response.toString()); + + responseCount = response.getPropertyCount(); + + + Log.d("count", String.valueOf(response.getPropertyCount())); + + ApprovedProjectListModule.listview_arr.clear(); + ApprovedProjectList.listview_arr.clear(); + ArrayList innerObj_Class_centers = null; + if(responseCount>0) { + //complitionProjectListModules = new ArrayList(); + // ArrayList arrayList = new ArrayList(); + approvedInfosarr=new ApprovedProjectListModule[responseCount]; + for (i = 0; i < responseCount; i++) + { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + //approvedProjectListObj = new ApprovedProjectListModule(); + + approvedProjectListObj.setStudent_name(response_soapobj.getProperty("StudentName").toString()); + approvedProjectListObj.setProject_tittle(response_soapobj.getProperty("Title").toString()); + approvedProjectListObj.setApproved_amount(response_soapobj.getProperty("SanctionAmount").toString()); + approvedProjectListObj.setDisperse_amount(response_soapobj.getProperty("Amount").toString()); + approvedProjectListObj.setLeadId(response_soapobj.getProperty("Lead_Id").toString()); + approvedProjectListObj.setPDId(response_soapobj.getProperty("PDId").toString()); + approvedProjectListObj.setpmappr_collegename(response_soapobj.getProperty("College_name").toString());//Lalbhai Dalpatbhai + approvedProjectListObj.setpmappr_streamname(response_soapobj.getProperty("StreamCode").toString());//Engineering + + // approvedProjectListObj.setBalance_amount(response_soapobj.getProperty("Amount").toString()); + approvedProjectListModules.add(approvedProjectListObj); + + // innerObj_Class_centers = new ArrayList(); + // innerObj_Class_centers.add(response_soapobj.getProperty("StudentName").toString()); //1 + Log.d("tag","approvedProjectListModules.get(i)="+approvedProjectListModules.get(i).getStudent_name()); + Log.d("tag","approvedProjectListModules="+approvedProjectListModules.size()); + Log.d("tag","approvedProjectListModules="+approvedProjectListObj.getStudent_name()); + + String Sname=response_soapobj.getProperty("StudentName").toString(); + String ProjectTittle=response_soapobj.getProperty("Title").toString(); + String ApprovedAmount=response_soapobj.getProperty("SanctionAmount").toString(); + String DisperseAmount=response_soapobj.getProperty("giventotal").toString(); + String MobileNo=response_soapobj.getProperty("MobileNo").toString(); + String Student_Image_Path=response_soapobj.getProperty("Student_Image_Path").toString(); + String college_name=response_soapobj.getProperty("College_name").toString(); + String stream_name=response_soapobj.getProperty("StreamCode").toString(); + // Double BalanceAmountdbl=Double.valueOf(ApprovedAmount).doubleValue()-Double.valueOf(DisperseAmount).doubleValue(); + long BalanceAmountdbl=Integer.valueOf(ApprovedAmount).intValue()-Integer.valueOf(DisperseAmount).intValue(); + + String BalanceAmount=String.valueOf(BalanceAmountdbl); + Log.i("Tag","BalanceAmountdbl"+BalanceAmountdbl); + String Lead_Id=response_soapobj.getProperty("Lead_Id").toString(); + String Project_Id=response_soapobj.getProperty("PDId").toString(); + approvedInfosarr[i]=approvedProjectListObj; + + ApprovedProjectList.listview_arr.add(new ApprovedProjectList(Sname,ProjectTittle, ApprovedAmount,DisperseAmount,BalanceAmount,Lead_Id,Project_Id,MobileNo,Student_Image_Path, + college_name,stream_name)); + + Log.i("Tag","ApprovedProjectListModule.getAmt="+ ApprovedProjectList.listview_arr.size()); + } + } + return response; + + } + catch (Exception t) { + Log.e("requestfail PMapprov", "> " + t.getMessage().toString()); + + } + }catch (Exception t) { + Log.d("exception outside",t.getMessage().toString()); + } + + return null; + } + + @Override + protected void onPreExecute() { + + progressBar.setVisibility(View.VISIBLE); + } + + @Override + protected void onPostExecute(SoapObject result) { + progressBar.setVisibility(View.GONE); + + /* Log.i("Tag","approvedInfosarr==="+approvedInfosarr); + Log.i("Tag","approvedInfosarr.length==="+approvedInfosarr.length);*/ + if(result!=null) { + showActivity(); + } + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + +} diff --git a/app/src/main/java/com/leadcampusapp/PMApproved_DetailsActivity.java b/app/src/main/java/com/leadcampusapp/PMApproved_DetailsActivity.java new file mode 100644 index 0000000..49ec303 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/PMApproved_DetailsActivity.java @@ -0,0 +1,1656 @@ +package com.leadcampusapp; + +import android.annotation.SuppressLint; +import android.app.ActionBar.LayoutParams; +import android.app.AlertDialog; +import android.app.DatePickerDialog; +import android.app.Dialog; +import android.app.DialogFragment; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.Color; +import android.graphics.Typeface; +import android.net.Uri; +import android.os.AsyncTask; +import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; +import android.text.Html; +import android.util.Log; +import android.view.Gravity; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.DatePicker; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.ProgressBar; +import android.widget.TableLayout; +import android.widget.TableRow; +import android.widget.TextView; +import android.widget.Toast; + +//import com.android.sripad.leadnew_22_6_2018.R; + +import org.joda.time.Days; +import org.joda.time.LocalDate; +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; + + +public class PMApproved_DetailsActivity extends AppCompatActivity implements ConnectivityReceiver.ConnectivityReceiverListener{ + + private static final String TAG = "Tag"; + + String material[]={"Books","Digital camera","Pen","Mouse","xyz"}; + String cost[]={"100","200","300","400"}; + + // private AppCompatSpinner spin_projtype; + EditText edt_title,edt_noOfBeneficiaries,edt_fundamount,edt_objectives,edt_actionPlan,edt_amount,edt_balance_amount,edt_disperseamount,edt_pmcomment,edt_placeofImt,edt_whoareBeneficiaries; + TextView txt_TotalCost,txt_projectType,txt_studentid,txt_mobileno; + ImageView btn_submit,img_student,btn_reject; + + String PMImgUrl; + private String serverPath = Class_URL.ServerPath.toString().trim(); + Context context; + String Lead_Id,ProjectId; + int Project_Id,ManagerId; + private String str_totalCost = null; + private ArrayList lstMaterialName = new ArrayList(); + private ArrayList lstMaterialCost = new ArrayList(); + + private ArrayList lstMemberName = new ArrayList(); + private ArrayList lstMemberEmail = new ArrayList<>(); + String Student_Image_Path; + + public static final String PREFBook_PM= "prefbook_pm"; //sharedpreference Book + public static final String PrefID_PMID = "prefid_pmid"; // + SharedPreferences shardprefPM_obj; + String str_MangerID; + Integer MDId; + + Integer DisAmtint; + + + + static TextView pmapproved_clickstartproject_editdate_tv; + static TextView pmapproved_clickendproject_editdate_tv; + static String yyyyMMdd_pmapproved_startdate = ""; + static String yyyyMMdd_pmapproved_enddate = ""; + + private static TextView pmapproved_numberofdays_tv; + static LinearLayout pmapproved_studentdays_linearlayout; + + static Class_alert_msg obj_class_alert_msg; + static Context static_context; + + TextView pmapprov_collegename_tv,pmapprov_streamname_tv; + String str_pmapprov_collegename="",str_pmapprov_streamname=""; + + + CheckBox pmapprov_impactproject_cb; + int int_approved_impactproject=0; + + public Button pm_chat_txt; + + @Override + protected void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_approved__details); + + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + //getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background)); + + View actionBarView = getSupportActionBar().getCustomView(); + TextView actionBarTV = (TextView) actionBarView.findViewById(R.id.txt_actionBar); + actionBarTV.setText("Dispersement Amount"); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); + + obj_class_alert_msg = new Class_alert_msg(getApplicationContext()); + static_context=getApplicationContext(); + + Intent intent = getIntent(); + String Name = intent.getStringExtra("name"); + Lead_Id = intent.getStringExtra("Lead_Id"); + ProjectId = intent.getStringExtra("ProjectId"); + String DisAmt=intent.getStringExtra("DisAmt"); + String MobileNo=intent.getStringExtra("MobileNo"); + Student_Image_Path=intent.getStringExtra("Student_Image_Path"); + + str_pmapprov_collegename=intent.getStringExtra("pmapprove_collegenamelist"); + str_pmapprov_streamname=intent.getStringExtra("pmapprove_streamnamelist"); + + DisAmtint=Integer.parseInt(DisAmt); + Project_Id=Integer.parseInt(ProjectId); + + shardprefPM_obj= getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MangerID = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + Log.d("str_leadId:",str_MangerID); + // Toast.makeText(this,"LeadId: "+str_MangerID,Toast.LENGTH_LONG).show(); + MDId=Integer.parseInt(str_MangerID); + + /* ManagerId = getIntent().getExtras().getInt("ManagerId"); + Log.i("tag","MangerID PMApproved="+ManagerId); +*/ + Log.e(TAG,"name="+Name); + Log.e(TAG,"ProjectId="+ProjectId); + Log.e(TAG,"Lead_Id="+Lead_Id); + + // spin_projtype = (AppCompatSpinner) findViewById(R.id.spin_projectType); + + TextView name_tv= (TextView) findViewById(R.id.txt_name); + name_tv.setText(Name); + txt_studentid=(TextView) findViewById(R.id.txt_studentid); + txt_studentid.setText(Lead_Id); + + txt_mobileno=(TextView) findViewById(R.id.txt_mobileno); + txt_mobileno.setText(MobileNo); + //setProjectTypeSpinner(); + + img_student=(ImageView) findViewById(R.id.img_student); + edt_actionPlan=(EditText) findViewById(R.id.edt_actionplan); + edt_amount=(EditText)findViewById(R.id.edt_amount); + edt_noOfBeneficiaries=(EditText)findViewById(R.id.edt_noOfBeneficiaries); + edt_objectives=(EditText)findViewById(R.id.edt_objective); + edt_title=(EditText)findViewById(R.id.edt_title); + edt_balance_amount=(EditText)findViewById(R.id.edt_balance_amount); + edt_disperseamount=(EditText)findViewById(R.id.edt_disperseamount); + edt_pmcomment=(EditText)findViewById(R.id.edt_pmcomment); + edt_fundamount=(EditText)findViewById(R.id.edt_fundamount); + edt_placeofImt=(EditText) findViewById(R.id.edt_placeOfImpl); + edt_whoareBeneficiaries=(EditText) findViewById(R.id.edt_whoareBeneficiaries); + // txt_TotalCost=(TextView) findViewById(R.id.totalCost); + txt_projectType=(TextView) findViewById(R.id.txt_projectType); + + pmapprov_collegename_tv=(TextView) findViewById(R.id.pmapprov_collegename_tv); + pmapprov_streamname_tv=(TextView) findViewById(R.id.pmapprov_streamname_tv); + + + + pmapproved_clickstartproject_editdate_tv = (TextView) findViewById(R.id.pmapproved_clickstartproject_editdate_tv); + pmapproved_clickendproject_editdate_tv = (TextView) findViewById(R.id.pmapproved_clickendproject_editdate_tv); + + pmapproved_numberofdays_tv=(TextView)findViewById(R.id.pmapproved_numberofdays_tv); + pmapproved_studentdays_linearlayout=(LinearLayout)findViewById(R.id.pmapproved_studentdays_linearlayout); + + pmapprov_impactproject_cb=(CheckBox)findViewById(R.id.pmapprov_impactproject_cb); + + pm_chat_txt=(Button) findViewById(R.id.pm_chat_txt); + + + btn_submit=(ImageView) findViewById(R.id.btn_submit); + btn_reject=(ImageView) findViewById(R.id.btn_reject); + edt_title.setEnabled(false); + edt_objectives.setEnabled(false); + edt_noOfBeneficiaries.setEnabled(false); + edt_amount.setEnabled(false); + edt_actionPlan.setEnabled(false); + edt_balance_amount.setEnabled(false); + edt_fundamount.setEnabled(false); + edt_whoareBeneficiaries.setEnabled(false); + edt_placeofImt.setEnabled(false); + + edt_fundamount.setText(DisAmt); + + String Imagestring = Student_Image_Path; + if (Imagestring==null||Imagestring.equals("null") || Imagestring.equals("anyType{}")) { + // PMImgUrl="null"; + img_student.setImageResource(R.drawable.devanand); + } else { + String arr[] = Imagestring.split("/", 2); + + String firstWord = arr[0]; //the + String secondWord = arr[1]; + + PMImgUrl = serverPath + secondWord; + + Log.i("tag", "firstWord=" + firstWord + " secondWord=" + secondWord); + LoadGalleryImage loadGalleryImage = new LoadGalleryImage(PMApproved_DetailsActivity.this); + loadGalleryImage.execute(); + } + txt_mobileno.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(Intent.ACTION_DIAL); + intent.setData(Uri.parse("tel:"+txt_mobileno.getText().toString())); + startActivity(intent); + } + }); + + + + pmapprov_collegename_tv.setText(str_pmapprov_collegename); + pmapprov_streamname_tv.setText(str_pmapprov_streamname); + + + // Integer approved_amt= Integer.parseInt(edt_amount.getText().toString()); + // Log.i("tag","approved_amt="+approved_amt); + // String ApprovedAmt=edt_amount.getText().toString(); + + /* edt_disperseamount.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + + } + + @Override + public void afterTextChanged(Editable s) { + Integer v1 = Integer.parseInt(!edt_amount.getText().toString().isEmpty() ? + edt_amount.getText().toString() : "0"); + Integer v2 = Integer.parseInt(!edt_disperseamount.getText().toString().isEmpty() ? + edt_disperseamount.getText().toString() : "0"); + Integer value = v1 - v2; + edt_balance_amount.setText(value.toString()); + } + }); +*/ + ViewProject viewProject = new ViewProject(context); + viewProject.execute(); + + + + + //-----------------date------------------ + + pmapproved_clickstartproject_editdate_tv.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + DialogFragment fromdateFragment = new DatePickerFragmentFromDate(); + fromdateFragment.show(getFragmentManager(), "Date Picker"); + + } + }); + + + pmapproved_clickendproject_editdate_tv.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + // settodate(); + DialogFragment dFragment = new DatePickerFragmentEndDate(); + // Show the date picker dialog fragment + dFragment.show(getFragmentManager(), "Date Picker"); + + + } + }); + + + + + + + //--------------date------------------------ + + pm_chat_txt.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Log.e("tag","ProjectId chat=="+ProjectId); + Intent i=new Intent(PMApproved_DetailsActivity.this,ChatActivity.class); + i.putExtra("projectStatus","approved"); + i.putExtra("projectId",ProjectId); + i.putExtra("userType","Manager"); + startActivity(i); + } + }); + btn_submit.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + + if (validation_ReApply()) + { + String ApprovedAmt=edt_amount.getText().toString(); + String DisperseAmt=edt_disperseamount.getText().toString(); + String BalanceAmt=edt_balance_amount.getText().toString(); + Integer BalanceAmtInt=Integer.parseInt(BalanceAmt); + Integer DisperseAmtInt=Integer.parseInt(DisperseAmt); + Integer ApprovedAmtInt=Integer.parseInt(ApprovedAmt); + Log.e("tag","ApprovedAmt="+ApprovedAmt+"DisperseAmt="+DisperseAmt); + Log.e("tag","DisperseAmtInt="+DisperseAmtInt+"ApprovedAmtInt="+ApprovedAmtInt); + + if(DisperseAmtInt>BalanceAmtInt) + { + Toast.makeText(getApplicationContext()," Dispersed amount cannot be more than balance amount",Toast.LENGTH_LONG).show(); + } + else { + btn_submit.setVisibility(View.GONE); + SubmitApprovedDetails submitApprovedDetails = new SubmitApprovedDetails(context); + submitApprovedDetails.execute(); + } + + } + + } + }); + + btn_reject.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if( edt_pmcomment.getText().toString().length() == 0 ){ + edt_pmcomment.setError( "Manager comments required!" );} + else { + SubmitRejectDetails submitRejectDetails = new SubmitRejectDetails(context); + submitRejectDetails.execute(); + } + + } + }); + + + + pmapprov_impactproject_cb.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + if(pmapprov_impactproject_cb.isChecked()) + { + int_approved_impactproject=1; + }else{ + int_approved_impactproject=0; + } + } + }); + + + + + + + + /* final LinearLayout lm = (LinearLayout) findViewById(R.id.ll_materialCost); + + // create the layout params that will be used to define how your + // button will be displayed + LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( + LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); + + //Create four + for(int j=0;j<=4;j++) + { + // Create LinearLayout + LinearLayout ll = new LinearLayout(this); + ll.setOrientation(LinearLayout.HORIZONTAL); + params.weight=2; + + // Create TextView + TextView product = new TextView(this); + product.setText(material[j]+j+" "); + product.setTextColor(Color.parseColor("#FFFFFF")); + product.setPadding(20,0,50,10); + + product.setMaxWidth(500); + ll.addView(product); + + // Create TextView + TextView price = new TextView(this); + price.setText(" $"+j+" "); + price.setTextColor(Color.parseColor("#FFFFFF")); + // price.setPadding(10,0,100,10); + // price.setMaxWidth(100); + ll.addView(price); + + final int index = j; + // Set click listener for button + //Add button to LinearLayout defined in XML + lm.addView(ll); + }*/ + + // init(); + + + + }// end of oncreate() + + @Override + protected void onResume() { + super.onResume(); + // register connection status listener + MyApplication.getInstance().setConnectivityListener(this); + } + + @Override + public void onNetworkConnectionChanged(boolean isConnected) { + showSnack(isConnected); + } + + private void showSnack(boolean isConnected) { + + if (!isConnected) { + + AlertDialog.Builder adb = new AlertDialog.Builder(PMApproved_DetailsActivity.this); + //adb.setView(alertDialogView); + + adb.setTitle("Sorry! Not connected to the internet"); + + adb.setIcon(android.R.drawable.ic_dialog_alert); + + adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + + adb.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + adb.setCancelable(true); + adb.show(); + } + +/* String message; + int color; + if (isConnected) { + message = "Good! Connected to Internet"; + color = Color.WHITE; + } else { + message = "Sorry! Not connected to internet"; + color = Color.RED; + } + + Snackbar snackbar = Snackbar + .make(findViewById(R.id.coordinator_layout), message, Snackbar.LENGTH_LONG); + + View sbView = snackbar.getView(); + TextView textView = (TextView) sbView.findViewById(android.support.design.R.id.snackbar_text); + textView.setTextColor(color); + snackbar.show();*/ + } + + + + + public boolean validation_ReApply() + { + + Boolean bpmcomments=true,bamount=true,b_datevalidation2=true,b_datevalidation3=true; + + + if( edt_pmcomment.getText().toString().length() == 0 ){ + edt_pmcomment.setError( "Manager comments required!" );bpmcomments=false;} + + if( edt_disperseamount.getText().toString().length() == 0 ){ + edt_disperseamount.setError( "Disperse Amount required!" );bamount=false;} + + + if(pmapproved_clickstartproject_editdate_tv.getText().toString().equalsIgnoreCase("Click for Calendar") + ||pmapproved_clickendproject_editdate_tv.getText().toString().equalsIgnoreCase("Click for Calendar")) + { + Toast.makeText(getApplicationContext(), "Kindly enter the date", Toast.LENGTH_SHORT).show(); + b_datevalidation3=false; + } + + + if((!pmapproved_clickstartproject_editdate_tv.getText().toString().equalsIgnoreCase("Click for Calendar")) + &&(!pmapproved_clickendproject_editdate_tv.getText().toString().equalsIgnoreCase("Click for Calendar"))) + + { + + if ((pmapproved_clickstartproject_editdate_tv.getText().toString().length() != 0) + && (pmapproved_clickendproject_editdate_tv.getText().toString().length() != 0)) { + /*if(date1.compareTo(date2)<0){ //0 comes when two date are same, + //1 comes when date1 is higher then date2 + //-1 comes when date1 is lower then date2 }*/ + + + SimpleDateFormat mdyFormat = new SimpleDateFormat("yyyy-MM-dd"); //2017-06-22 + + try { + Date fromdate = mdyFormat.parse(yyyyMMdd_pmapproved_startdate); + Date todate = mdyFormat.parse(yyyyMMdd_pmapproved_enddate); + + if (fromdate.compareTo(todate) <= 0) + { + //return true; + } else { + Toast.makeText(context, "Kindly enter valid date", Toast.LENGTH_SHORT).show(); + b_datevalidation2 = false; + //return false; + } + + + } catch (ParseException e) { + e.printStackTrace(); + } + }//end of if + + } + + + + + + if(bpmcomments&&bamount&&b_datevalidation2&&b_datevalidation3) { + return true; + }else{return false;} + } + private SoapObject getProjectDetails() { + String METHOD_NAME = "GetApprovedProjectDetails"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetApprovedProjectDetails"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + request.addProperty("leadId",Lead_Id); + request.addProperty("PDId",Project_Id); + + Log.d("projectIdsssss",ProjectId); + //users.ad + //request.add + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + // Log.d("soap response1xxxx",envelope.getResponse().toString()); + + + SoapObject response = (SoapObject) envelope.getResponse(); + //SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + //Log.e("Tag","soap response ApprovedDetails"+response.toString()); + + //return null; + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + } + return null; + + } + + public class LoadGalleryImage extends AsyncTask { + + private Context context; + // private ProgressBar progressBar; + + LoadGalleryImage (Context context){ + this.context = context; + } + + @Override + protected void onPreExecute() { + // progressBar = (ProgressBar) findViewById(R.id.progressBar); + // progressBar.setVisibility(View.VISIBLE); + + } + + @Override + protected Bitmap doInBackground(Void... params) { + ArrayList bitmapLst=null; + Bitmap bitmaplogo=null; + + try { + URL url= new URL(PMImgUrl); + Log.d("Urlssssssssssss",url.toString()); + bitmaplogo = BitmapFactory.decodeStream(url.openStream()); + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return bitmaplogo; + } + + @Override + protected void onPostExecute(Bitmap bitmap) { + // bitmapList.add(bitmap); + img_student.setImageBitmap(bitmap); + // progressBar.setVisibility(GONE); + } + } + + public class ViewProject extends AsyncTask { + + AlertDialog alertDialog; + private ProgressBar progressBar; + + ViewProject (Context ctx){ + context = ctx; + } + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapObject response = getProjectDetails(); + + //SoapPrimitive response =getProjectDetails(); + Log.d("Soap response is",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); + } + + @Override + protected void onPostExecute(SoapObject result) { + if(result!=null) + { + + SoapPrimitive S_ProjectTitle, S_ThemeName, S_BeneficiaryNo, S_Objective, S_actionPlan, S_ManagerComments, S_MaterialName, S_MaterialCost, S_TotalCost, S_ApprovalAmt, S_PlaceofImt, S_WhoareBeneficiary, S_MembersName, S_MemberEmail; + Object O_ProjectTitle, O_ThemeName, O_BeneficiaryNo, O_Objective, O_actionPlan, O_ManagerComments, O_MaterialName, O_MaterialCost, O_TotalCost, O_ApprovalAmt, O_Status, O_PlaceofImt, O_WhoareBeneficiary, O_MembersName, O_MemberEmail; + String str_ApprovalAmt = null, str_ProjectTitle = null, str_ThemeName = null, str_BeneficiaryNo = null, str_Objective = null, str_actionPlan = null, str_ManagerComments = null, str_materialName = null, str_materialCost = null, str_placeofImt = null, str_whoareBeneficiary = null, str_memberName = null, str_memberEmail = null; + SoapObject SO_ThemeName; + + Object O_impactproject; + SoapPrimitive S_impactproject; + + SoapPrimitive S_startdate,S_enddate; + Object O_startdate,O_enddate = null; + String str_startdate,str_enddate; + + // if(flag==0) { + O_Status = result.getProperty("status"); + if (O_Status.toString().equals("Invalid project details")) + { + Toast.makeText(getApplicationContext(), "Invalid project details", Toast.LENGTH_LONG).show(); + } else + { + O_ProjectTitle = result.getProperty("Title"); + if (!O_ProjectTitle.toString().equals("anyType") && !O_ProjectTitle.toString().equals("anyType{}") && !O_ProjectTitle.toString().equals(null)) { + S_ProjectTitle = (SoapPrimitive) result.getProperty("Title"); + Log.d("Titlesssssss", S_ProjectTitle.toString()); + str_ProjectTitle = S_ProjectTitle.toString(); + } + + O_ThemeName = result.getProperty("ThemeName"); + if (O_ThemeName.toString().equals("anyType") && O_ThemeName.toString().equals("anyType{}") && O_ThemeName.toString().equals(null)) { + SO_ThemeName = (SoapObject) result.getProperty("ThemeName"); + Log.d("ThemeNamessss", SO_ThemeName.toString()); + str_ThemeName = SO_ThemeName.toString(); + // spin_projectType.setSelection(0); + } + if (!O_ThemeName.toString().equals("anyType") && !O_ThemeName.toString().equals("anyType{}") && !O_ThemeName.toString().equals(null)) { + S_ThemeName = (SoapPrimitive) result.getProperty("ThemeName"); + Log.d("ThemeNamessss", S_ThemeName.toString()); + str_ThemeName = S_ThemeName.toString(); + // spin_projectType.setSelection(0); + } + + O_BeneficiaryNo = result.getProperty("BeneficiaryNo"); + if (!O_BeneficiaryNo.toString().equals("anyType") && !O_BeneficiaryNo.toString().equals("anyType{}") && !O_BeneficiaryNo.toString().equals(null)) { + S_BeneficiaryNo = (SoapPrimitive) result.getProperty("BeneficiaryNo"); + Log.d("BeneficiaryNo", S_BeneficiaryNo.toString()); + str_BeneficiaryNo = S_BeneficiaryNo.toString(); + } + + O_ApprovalAmt = result.getProperty("SanctionAmount"); + if (!O_ApprovalAmt.toString().equals("anyType") && !O_ApprovalAmt.toString().equals("anyType{}") && !O_ApprovalAmt.toString().equals(null)) { + S_ApprovalAmt = (SoapPrimitive) result.getProperty("SanctionAmount"); + Log.d("BeneficiaryNo", S_ApprovalAmt.toString()); + str_ApprovalAmt = S_ApprovalAmt.toString(); + } + + O_Objective = result.getProperty("Objectives"); + if (!O_Objective.toString().equals("anyType") && !O_Objective.toString().equals("anyType{}") && !O_Objective.toString().equals(null)) { + S_Objective = (SoapPrimitive) result.getProperty("Objectives"); + Log.d("Objectivess", S_Objective.toString()); + str_Objective = S_Objective.toString(); + } + + O_actionPlan = result.getProperty("ActionPlan"); + if (!O_actionPlan.toString().equals("anyType") && !O_actionPlan.toString().equals("anyType{}") && !O_actionPlan.toString().equals(null)) { + S_actionPlan = (SoapPrimitive) result.getProperty("ActionPlan"); + Log.d("ActionPlansss", S_actionPlan.toString()); + str_actionPlan = S_actionPlan.toString(); + } + + O_ManagerComments = result.getProperty("ManagerComments"); + if (!O_ManagerComments.toString().equals("anyType") && !O_ManagerComments.toString().equals("anyType{}") && !O_ManagerComments.toString().equals(null)) { + S_ManagerComments = (SoapPrimitive) result.getProperty("ManagerComments"); + Log.d("Manager Comments", S_ManagerComments.toString()); + str_ManagerComments = S_ManagerComments.toString(); + } + + O_TotalCost = result.getProperty("Amount"); + if (!O_TotalCost.toString().equals("anyType") && !O_TotalCost.toString().equals("anyType{}") && !O_TotalCost.toString().equals(null)) { + S_TotalCost = (SoapPrimitive) result.getProperty("Amount"); + Log.d("Total Cost", S_TotalCost.toString()); + str_totalCost = S_TotalCost.toString(); + } + + O_PlaceofImt = result.getProperty("Placeofimplement"); + if (!O_PlaceofImt.toString().equals("anyType") && !O_PlaceofImt.toString().equals("anyType{}") && !O_PlaceofImt.toString().equals(null)) { + S_PlaceofImt = (SoapPrimitive) result.getProperty("Placeofimplement"); + Log.d("Placeofimplement", S_PlaceofImt.toString()); + str_placeofImt = S_PlaceofImt.toString(); + } + + O_WhoareBeneficiary = result.getProperty("BeneficiariesList"); + if (!O_WhoareBeneficiary.toString().equals("anyType") && !O_WhoareBeneficiary.toString().equals("anyType{}") && !O_WhoareBeneficiary.toString().equals(null)) + { + S_WhoareBeneficiary = (SoapPrimitive) result.getProperty("BeneficiariesList"); + Log.d("WhoareBeneficiary", S_WhoareBeneficiary.toString()); + str_whoareBeneficiary = S_WhoareBeneficiary.toString(); + } + + + O_startdate= result.getProperty("ProjectStartDate");//2019-07-14 + Log.e("startDate",O_startdate.toString()); + if (O_startdate.toString().equalsIgnoreCase("anyType{}") + ||O_startdate.toString().equals("0000-00-00")) + { + // S_startdate = O_startdate; + + // Log.e("startDate",S_startdate.toString()); + + str_startdate = "Click for Calendar"; + }else + { + str_startdate = O_startdate.toString(); + yyyyMMdd_pmapproved_startdate=str_startdate; + } + + // Toast.makeText(context,""+O_startdate.toString(),Toast.LENGTH_LONG).show(); + pmapproved_clickstartproject_editdate_tv.setText(str_startdate.toString()); + + + O_enddate= result.getProperty("ProjectEndDate");//2019-07-16 + if (O_enddate.toString().equalsIgnoreCase("anyType{}") + ||O_enddate.toString().equals("0000-00-00")) { + /* S_enddate = (SoapPrimitive) result.getProperty("ProjectEndDate"); + + Log.e("endDate",S_enddate.toString());*/ + str_enddate = "Click for Calendar"; + }else{ + str_enddate = O_enddate.toString(); + yyyyMMdd_pmapproved_enddate=str_enddate; + } + pmapproved_clickendproject_editdate_tv.setText(str_enddate.toString()); + + + if(str_startdate.toString().equalsIgnoreCase("anyType{}") + || str_startdate.toString().equals(null) + ||str_startdate.toString().equals("0000-00-00") + ||str_startdate.toString().equalsIgnoreCase("Click for Calendar") + ||str_enddate.toString().equals("anyType{}") + ||str_enddate.toString().equals(null) + ||str_enddate.toString().equals("0000-00-00") + ||str_enddate.toString().equalsIgnoreCase("Click for Calendar")) + { + + //alert(); + + }else + { + + + try{ + int days_count = Days.daysBetween(new LocalDate(str_startdate), new LocalDate(str_enddate)).getDays(); + int int_days=days_count+1; + Log.e("days",String.valueOf(int_days)); + pmapproved_numberofdays_tv.setText("Number of Days: "+String.valueOf(int_days)); + }catch(Throwable t) + { + pmapproved_numberofdays_tv.setText(" "); + } + } + + + + O_impactproject= result.getProperty("IsImpactProject");//0 + + if (O_impactproject.toString().equals("anyType")|| + O_impactproject.toString().equals("anyType{}") || O_impactproject.toString().equals(null)) + { + int_approved_impactproject=0; + pmapprov_impactproject_cb.setChecked(false); + } + else if(O_impactproject.toString().equals("0")) + { + int_approved_impactproject=0; + pmapprov_impactproject_cb.setChecked(false); + } + else{ + int_approved_impactproject=1; + pmapprov_impactproject_cb.setChecked(true); + } + + + + + }// end of else + + txt_projectType.setText(str_ThemeName); + //txt_projectType.setFocusable(false); + //txt_projectType.setInputType(0); + txt_projectType.setTextSize(15); + + edt_amount.setText(str_ApprovalAmt); + edt_amount.setTextSize(15); + + edt_title.setText(str_ProjectTitle); + // edt_title.setFocusable(true); + //edt_title.setInputType(0); + edt_title.setTextSize(15); + + edt_noOfBeneficiaries.setText(str_BeneficiaryNo); + // edt_noOfBeneficiaries.setFocusable(true); + // edt_noOfBeneficiaries.setInputType(0); + edt_noOfBeneficiaries.setTextSize(15); + + edt_objectives.setText(str_Objective); + // edt_objectives.setFocusable(true); + edt_objectives.setInputType(0); + edt_objectives.setTextSize(15); + + edt_actionPlan.setText(str_actionPlan); + // edt_actionPlan.setFocusable(true); + // edt_actionPlan.setInputType(0); + edt_actionPlan.setTextSize(15); + + // edt_pmcomment.setText(str_ManagerComments); + // edt_pmcomment.setTextSize(15); + + edt_placeofImt.setText(str_placeofImt); + edt_placeofImt.setTextSize(15); + + edt_whoareBeneficiaries.setText(str_whoareBeneficiary); + edt_whoareBeneficiaries.setTextSize(15); + + Log.i("Tag", "edt_pmcomment=" + str_ManagerComments); + + Integer ApprovedAmtInt = Integer.parseInt(str_ApprovalAmt); + Integer Balance = ApprovedAmtInt - DisAmtint; + edt_balance_amount.setText(Balance.toString()); + Log.e("tag", "Balance=" + Balance); +// txt_PMComments.setText(str_ManagerComments); + + SoapObject materialList = (SoapObject) result.getProperty("materials"); + for (int i = 0; i < materialList.getPropertyCount(); i++) { + SoapObject vmmateriallist = (SoapObject) materialList.getProperty(i); + + O_MaterialName = vmmateriallist.getProperty("MeterialName"); + if (!O_MaterialName.toString().equals("anyType") && !O_MaterialName.toString().equals("anyType{}") && !O_MaterialName.toString().equals(null)) { + S_MaterialName = (SoapPrimitive) vmmateriallist.getProperty("MeterialName"); + Log.d("MaterialNamesssss", S_MaterialName.toString()); + str_materialName = S_MaterialName.toString(); + + lstMaterialName.add(str_materialName); + } + + O_MaterialCost = vmmateriallist.getProperty("MeterialCost"); + if (!O_MaterialCost.toString().equals("anyType") && !O_MaterialCost.toString().equals("anyType{}") && !O_MaterialCost.toString().equals(null)) { + S_MaterialCost = (SoapPrimitive) vmmateriallist.getProperty("MeterialCost"); + Log.d("MaterialCostsssss", S_MaterialCost.toString()); + str_materialCost = S_MaterialCost.toString(); + + lstMaterialCost.add(str_materialCost); + } + } + + SoapObject MembersList = (SoapObject) result.getProperty("Members"); + for (int i = 0; i < MembersList.getPropertyCount(); i++) { + SoapObject vmmemberlist = (SoapObject) MembersList.getProperty(i); + + O_MembersName = vmmemberlist.getProperty("MemberName"); + if (!O_MembersName.toString().equals("anyType") && !O_MembersName.toString().equals("anyType{}") && !O_MembersName.toString().equals(null)) { + S_MembersName = (SoapPrimitive) vmmemberlist.getProperty("MemberName"); + Log.d("MemberNamesssss", S_MembersName.toString()); + str_memberName = S_MembersName.toString(); + + lstMemberName.add(str_memberName); + } + + O_MemberEmail = vmmemberlist.getProperty("MemberEmail"); + if (!O_MemberEmail.toString().equals("anyType") && !O_MemberEmail.toString().equals("anyType{}") && !O_MemberEmail.toString().equals(null)) { + S_MemberEmail = (SoapPrimitive) vmmemberlist.getProperty("MemberEmail"); + Log.d("MemberEmail", S_MemberEmail.toString()); + str_memberEmail = S_MemberEmail.toString(); + + lstMemberEmail.add(str_memberEmail); + } + } + initMaterials(); + initMembers(); + + } + progressBar.setVisibility(View.GONE); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + public class SubmitApprovedDetails extends AsyncTask { + + AlertDialog alertDialog; + private ProgressBar progressBar; + + SubmitApprovedDetails (Context ctx){ + context = ctx; + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapPrimitive response = SubmitProjectDetails(); + + // SoapObject response = ReApplyProjectDetails(); + Log.d("tag","Soap response approvedDetails"+response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + if(result!=null) { + if (result.toString().equals("Error")) { + btn_submit.setVisibility(View.VISIBLE); + Toast.makeText(getApplicationContext(), "Error occured while saving to database", Toast.LENGTH_LONG).show(); + } else { + Toast.makeText(getApplicationContext(), "Amount funded successfully", Toast.LENGTH_LONG).show(); + finish(); + Intent ittEditProjToProjStatus = new Intent(PMApproved_DetailsActivity.this, PMProjectDetailActivity.class); + ittEditProjToProjStatus.putExtra("pageCount", 1); + startActivity(ittEditProjToProjStatus); + } + } + progressBar.setVisibility(View.GONE); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + private SoapPrimitive SubmitProjectDetails() { + String METHOD_NAME = "AddFundAmountwithPMcomments"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/AddFundAmountwithPMcomments"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + // long projectIds = (long) Integer.valueOf(projectId); + Log.d("PDIdssssssxxxx","hi"); + Log.d("PDIdssssssxxxx", String.valueOf(Project_Id)); + request.addProperty("PDId",Project_Id); + request.addProperty("ManagerId",MDId); + request.addProperty("LeadId",Lead_Id); + request.addProperty("Amount",Integer.parseInt(edt_disperseamount.getText().toString())); + request.addProperty("ManagerRemark",edt_pmcomment.getText().toString()); + + request.addProperty("ProjectStartDate",yyyyMMdd_pmapproved_startdate.toString());//string + request.addProperty("ProjectEndDate",yyyyMMdd_pmapproved_enddate.toString());// string + + request.addProperty("IsImpactProject",int_approved_impactproject);// int + Log.d("Requestisxxxxx",request.toString()); + + + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + // Log.d("soap response1xxxx",envelope.getResponse().toString()); + + // SoapObject response = (SoapObject) envelope.getResponse(); + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + //Log.e("soapupdateProjectDtlsss",envelope.getResponse().toString()); + + //return null; + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + } + return null; + + } + + public class SubmitRejectDetails extends AsyncTask { + + AlertDialog alertDialog; + private ProgressBar progressBar; + + SubmitRejectDetails (Context ctx){ + context = ctx; + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapPrimitive response = RejectProjectDetails(); + + // SoapObject response = ReApplyProjectDetails(); + //Log.d("Soap response issssss",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + if(result.toString().equals("Error")){ + Toast.makeText(PMApproved_DetailsActivity.this,"Error occured while saving to database",Toast.LENGTH_LONG).show(); + } + else{ + Toast.makeText(PMApproved_DetailsActivity.this,"Project Rejected Successfully",Toast.LENGTH_LONG).show(); + finish(); + /*Intent ittEditProjToProjStatus = new Intent(PMUnapproved_DetailsActivity.this,PMProjectDetailActivity.class); + ittEditProjToProjStatus.putExtra("pageCount",0); + startActivity(ittEditProjToProjStatus);*/ + } + progressBar.setVisibility(View.GONE); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + private SoapPrimitive RejectProjectDetails() { + String METHOD_NAME = "ManagerRejectProject"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/ManagerRejectProject"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + // long projectIds = (long) Integer.valueOf(projectId); + request.addProperty("PDId",Project_Id); + Log.d("PDIdssssssxxxx","hi"); + // Log.d("PDIdssssssxxxx", String.valueOf(projectId)); + // request.addProperty("ProjectStatus","Rejected"); + Log.d("actionplansxxxxxx",edt_pmcomment.getText().toString()); + request.addProperty("ManagerComments",edt_pmcomment.getText().toString()); + Log.d("Requestisxxxxx",request.toString()); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + // Log.d("soap response1xxxx",envelope.getResponse().toString()); + + // SoapObject response = (SoapObject) envelope.getResponse(); + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + //Log.e("soapupdateProjectDtlsss",envelope.getResponse().toString()); + + //return null; + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + } + return null; + + } + + + /* public void initMaterials() { + TableLayout stk = (TableLayout) findViewById(R.id.table_main); + TableRow tbrow0 = new TableRow(this); + TextView tv0 = new TextView(this); + String matrl_name = " Material Name "; + tv0.setText(Html.fromHtml(matrl_name)); + tv0.setTextColor(Color.WHITE); + tv0.setGravity(Gravity.LEFT); + tv0.setWidth(500); + tv0.setTypeface(null, Typeface.BOLD); + tv0.setPadding(5, 10, 5, 5); + tbrow0.addView(tv0); + TextView tv1 = new TextView(this); + String matrl_cost = " Cost "; + tv1.setText(Html.fromHtml(matrl_cost)); + tv1.setTextColor(Color.WHITE); + tv1.setGravity(Gravity.CENTER); + tv1.setTypeface(null, Typeface.BOLD); + tv1.setWidth(200); + tv1.setPadding(50, 10, 0, 5); + tbrow0.addView(tv1); + stk.addView(tbrow0); + for (int i = 0; i < lstMaterialName.size() && i < lstMaterialCost.size(); i++) { + TableRow tbrow = new TableRow(this); + TextView t1v = new TextView(this); + t1v.setText(lstMaterialName.get(i)); + t1v.setTextColor(Color.WHITE); + t1v.setGravity(Gravity.LEFT); + t1v.setWidth(500); + t1v.setPadding(5, 5, 5, 5); + tbrow.addView(t1v); + + TextView t2v = new TextView(this); + t2v.setText(lstMaterialCost.get(i)); + t2v.setTextColor(Color.WHITE); + t2v.setGravity(Gravity.CENTER); + t2v.setWidth(100); + t2v.setPadding(50, 5, 0, 5); + tbrow.addView(t2v); + + stk.addView(tbrow); + } + + TableRow tbrow = new TableRow(this); + TextView t1v = new TextView(this); + t1v.setText("Total"); + t1v.setTypeface(null, Typeface.BOLD); + t1v.setTextColor(Color.WHITE); + t1v.setGravity(Gravity.LEFT); + t1v.setWidth(500); + t1v.setPadding(5, 5, 5, 5); + tbrow.addView(t1v); + + TextView t2v = new TextView(this); + t2v.setText(str_totalCost); + t2v.setTextColor(Color.WHITE); + t2v.setTypeface(null, Typeface.BOLD); + t2v.setGravity(Gravity.CENTER); + t2v.setWidth(100); + t2v.setPadding(50, 5, 0, 5); + tbrow.addView(t2v); + stk.addView(tbrow); + + // txt_TotalCost.setText(str_totalCost); + } +*/ + public void initMaterials() { + TableLayout stk = (TableLayout) findViewById(R.id.table_material); + TableRow tbrow0 = new TableRow(this); + TextView tv0 = new TextView(this); + String matrl_name = " Material Name "; + tv0.setText(Html.fromHtml(matrl_name)); + tv0.setTextColor(Color.BLACK); + tv0.setGravity(Gravity.CENTER); + tv0.setTypeface(null, Typeface.BOLD); + tv0.setPadding(5, 10, 5, 5); + tbrow0.addView(tv0); + TextView tv1 = new TextView(this); + String matrl_cost = " Cost "; + tv1.setText(Html.fromHtml(matrl_cost)); + tv1.setTextColor(Color.BLACK); + tv1.setGravity(Gravity.CENTER); + tv1.setTypeface(null, Typeface.BOLD); + tv1.setPadding(50, 10, 0, 5); + tbrow0.addView(tv1); + stk.addView(tbrow0); + for (int i = 0; i < lstMaterialName.size() && i < lstMaterialCost.size(); i++) { + TableRow tbrow = new TableRow(this); + TextView t1v = new TextView(this); + t1v.setText(lstMaterialName.get(i)); + t1v.setTextColor(Color.BLACK); + t1v.setGravity(Gravity.LEFT); + t1v.setPadding(5, 5, 5, 5); + tbrow.addView(t1v); + + TextView t2v = new TextView(this); + t2v.setText(lstMaterialCost.get(i)); + t2v.setTextColor(Color.BLACK); + t2v.setGravity(Gravity.CENTER); + t2v.setPadding(50, 5, 0, 5); + tbrow.addView(t2v); + + stk.addView(tbrow); + } + + TableRow tbrow = new TableRow(this); + TextView t1v = new TextView(this); + t1v.setText("Total"); + t1v.setTypeface(null, Typeface.BOLD); + t1v.setTextColor(Color.BLACK); + t1v.setGravity(Gravity.LEFT); + t1v.setPadding(5, 5, 5, 5); + tbrow.addView(t1v); + + TextView t2v = new TextView(this); + t2v.setText(str_totalCost); + t2v.setTextColor(Color.BLACK); + t2v.setTypeface(null, Typeface.BOLD); + t2v.setGravity(Gravity.CENTER); + t2v.setPadding(50, 5, 0, 5); + tbrow.addView(t2v); + + stk.addView(tbrow); + } + + public void initMembers() { + TableLayout stk = (TableLayout) findViewById(R.id.table_main); + TableRow tbrow0 = new TableRow(this); + TextView tv0 = new TextView(this); + String member_name = " Member Name "; + tv0.setText(Html.fromHtml(member_name)); + tv0.setTextColor(Color.BLACK); + tv0.setGravity(Gravity.CENTER); + tv0.setTypeface(null, Typeface.BOLD); + tv0.setPadding(5, 10, 5, 5); + tbrow0.addView(tv0); + TextView tv1 = new TextView(this); + String member_MailId = " Mail Id "; + tv1.setText(Html.fromHtml(member_MailId)); + tv1.setTextColor(Color.BLACK); + tv1.setGravity(Gravity.CENTER); + tv1.setTypeface(null, Typeface.BOLD); + tv1.setPadding(50, 10, 0, 5); + tbrow0.addView(tv1); + stk.addView(tbrow0); + for (int i = 0; i < lstMemberName.size() && i < lstMemberEmail.size(); i++) { + TableRow tbrow = new TableRow(this); + TextView t1v = new TextView(this); + t1v.setText(lstMemberName.get(i)); + t1v.setTextColor(Color.BLACK); + t1v.setGravity(Gravity.LEFT); + t1v.setPadding(5, 5, 5, 5); + tbrow.addView(t1v); + + TextView t2v = new TextView(this); + t2v.setText(lstMemberEmail.get(i)); + t2v.setTextColor(Color.BLACK); + t2v.setGravity(Gravity.CENTER); + t2v.setPadding(50, 5, 0, 5); + tbrow.addView(t2v); + + stk.addView(tbrow); + } + + } + + + @SuppressLint("RestrictedApi") + private void setProjectTypeSpinner() { + final ArrayList liststate = new ArrayList(); + liststate.add("Education"); + liststate.add("Health Care"); + liststate.add("Sports"); + + ArrayAdapter dataAdapterState = new ArrayAdapter(getApplicationContext(), R.layout.simple_spinner_items, liststate); + + // Drop down layout style - list view with radio button + dataAdapterState.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + + // attaching data adapter to spinner + /* spin_projtype.setAdapter(dataAdapterState); + spin_projtype.setSupportBackgroundTintList(ContextCompat.getColorStateList(getApplicationContext(), R.color.colorWhite)); + spin_projtype.setSelection(1); + spin_projtype.setEnabled(false); + spin_projtype.setClickable(false);*/ + } + + public void init() { + TableLayout stk = (TableLayout) findViewById(R.id.table_main); + TableRow tbrow0 = new TableRow(this); + tbrow0.setPadding(40, 1, 1, 1); + + TextView tv0 = new TextView(this); + tv0.setText(" Material Name "); + tv0.setTextColor(Color.WHITE); + tv0.setGravity(Gravity.LEFT); + tv0.setTypeface(null, Typeface.BOLD); + tv0.setPadding(5, 10, 5, 5); + tbrow0.addView(tv0); + TextView tv1 = new TextView(this); + tv1.setText(" Cost "); + tv1.setTextColor(Color.WHITE); + tv1.setGravity(Gravity.CENTER); + tv1.setTypeface(null, Typeface.BOLD); + tv1.setPadding(50, 10, 0, 5); + tbrow0.addView(tv1); + stk.addView(tbrow0); + for (int i = 0; i < 4; i++) { + TableRow tbrow = new TableRow(this); + tbrow.setPadding(40, 1, 1, 1); + + tbrow.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); + TextView t1v = new TextView(this); + // t1v.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); + t1v.setWidth(700); + t1v.setText(material[i]); + t1v.setTextColor(Color.WHITE); + t1v.setGravity(Gravity.LEFT); + t1v.setPadding(5, 5, 5, 5); + + tbrow.addView(t1v); + TextView t2v = new TextView(this); + t2v.setText(cost[i]); + t2v.setTextColor(Color.WHITE); + t2v.setGravity(Gravity.CENTER); + t2v.setWidth(100); + t2v.setPadding(50, 5, 0, 5); + tbrow.addView(t2v); + stk.addView(tbrow); + } + + } + + + + + //-------------------------------date-------------------------------- + + // start of from date + @SuppressLint("ValidFragment") + public static class DatePickerFragmentFromDate extends DialogFragment + implements DatePickerDialog.OnDateSetListener{ + + @Override + public Dialog onCreateDialog(Bundle savedInstanceState) { + final Calendar c = Calendar.getInstance(); + int year = c.get(Calendar.YEAR); + int month = c.get(Calendar.MONTH); + int day = c.get(Calendar.DAY_OF_MONTH); + + + /*return new DatePickerDialog(getActivity(),(DatePickerDialog.OnDateSetListener) + getActivity(), year, month, day);*/ + + + + + + DatePickerDialog dialog = new DatePickerDialog(getActivity(), + this, year, month, day); + + + /* dialog.getDatePicker().setMinDate(c.getTimeInMillis()); + dialog.getDatePicker().setMaxDate(c.getTimeInMillis()); +*/ + + /* dialog.getDatePicker().setMinDate(c.getTimeInMillis()); + c.add(Calendar.DAY_OF_MONTH,150); + dialog.getDatePicker().setMaxDate(c.getTimeInMillis()); +*/ + return dialog; + + + } + public void onDateSet(DatePicker view, int year, int month, int day) { + Calendar cal = new GregorianCalendar(year, month, day); + setDate(cal); + } + + public void setDate(final Calendar calendar) { + final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM); + //((TextView) findViewById(R.id.showDate)).setText(dateFormat.format(calendar.getTime())); + + + // clickstartproject_editdate_tv.setText(dateFormat.format(calendar.getTime())); + + // SimpleDateFormat mdyFormat = new SimpleDateFormat("MM/dd/yyyy");//2017-06-22 + + SimpleDateFormat mdyFormat = new SimpleDateFormat("yyyy-MM-dd"); + yyyyMMdd_pmapproved_startdate = mdyFormat.format(calendar.getTime()); + + + pmapproved_clickstartproject_editdate_tv.setText(yyyyMMdd_pmapproved_startdate); + + pmapproved_clickendproject_editdate_tv.setText("Click for Calendar"); + // System.out.println("From date:"+ yyyyMMdd_fromdate); + } + + } + + + + + + public static class DatePickerFragmentEndDate extends DialogFragment + implements DatePickerDialog.OnDateSetListener{ + + @Override + public Dialog onCreateDialog(Bundle savedInstanceState) { + final Calendar c = Calendar.getInstance(); + int year = c.get(Calendar.YEAR); + int month = c.get(Calendar.MONTH); + int day = c.get(Calendar.DAY_OF_MONTH); + + + /*return new DatePickerDialog(getActivity(),(DatePickerDialog.OnDateSetListener) + getActivity(), year, month, day);*/ + + + + + + DatePickerDialog dialog = new DatePickerDialog(getActivity(), + this, year, month, day); + + // dialog.getDatePicker().setMaxDate(c.getTimeInMillis()); // this will set maximum date validation + //dialog.getDatePicker().setMinDate(System.currentTimeMillis() - 1000); + //dialog.getDatePicker().setMaxDate(c.getTimeInMillis()); + + // dialog.getDatePicker().setMaxDate(c.getTimeInMillis()+((1000*60*60*24*90)));//Error:fromDate: Sun Jun 18 12:50:44 GMT+05:30 2017 does not precede toDate: Fri Jun 09 02:45:11 GMT+05:30 2017 + + + /* dialog.getDatePicker().setMinDate(c.getTimeInMillis()); + c.add(Calendar.DAY_OF_MONTH,150); + dialog.getDatePicker().setMaxDate(c.getTimeInMillis());*/ + + return dialog; + + + } + public void onDateSet(DatePicker view, int year, int month, int day) { + Calendar cal = new GregorianCalendar(year, month, day); + setDate(cal); + } + + public void setDate(final Calendar calendar) { + final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM); + //((TextView) findViewById(R.id.showDate)).setText(dateFormat.format(calendar.getTime())); + + // clickendproject_editdate_tv.setText(dateFormat.format(calendar.getTime())); + + SimpleDateFormat mdyFormat = new SimpleDateFormat("yyyy-MM-dd"); //2017-06-22 + + yyyyMMdd_pmapproved_enddate = mdyFormat.format(calendar.getTime()); + pmapproved_clickendproject_editdate_tv.setText(yyyyMMdd_pmapproved_enddate); + + // System.out.println("To Date:"+ yyyyMMdd_todate); + + + int days_count = Days.daysBetween(new LocalDate(yyyyMMdd_pmapproved_startdate), new LocalDate(yyyyMMdd_pmapproved_enddate)).getDays(); + int int_days=days_count+1; + + + pmapproved_numberofdays_tv.setText("Number of Days: "+String.valueOf(int_days)); + System.out.println ("Days: "+int_days); + + + if((int_days<0)) + { + + obj_class_alert_msg.alerts_dialog("error","error",getActivity()); + pmapproved_clickendproject_editdate_tv.setText("Click for Calendar"); + pmapproved_numberofdays_tv.setText("Number of Days: "); + + } + + + + /* int days_count = Days.daysBetween(new LocalDate(yyyyMMdd_startdate), new LocalDate(yyyyMMdd_enddate)).getDays(); + int int_days=days_count+1; + System.out.println ("Days: "+int_days); + + if((int_days<=6)) + { + + } + else{ + //alerts_dialog_fortodate(); + }*/ + + + + } + + } + + +//----------------------------date------------------------------------ + + + + + + + + + + + + + + + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_main, menu); + MenuItem action_editProfile = menu.findItem(R.id.action_editProfile); + action_editProfile.setVisible(false); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + + /* if (id == R.id.action_editProfile) { + Intent itthomeToEditProfile = new Intent(PMApproved_DetailsActivity.this ,PMEditProfileActivity.class); + itthomeToEditProfile.putExtra("ManagerId",ManagerId); + startActivity(itthomeToEditProfile); + return true; + }*/ + + + if (id == R.id.action_logout) { + Intent itthomeToLogin = new Intent(PMApproved_DetailsActivity.this ,LoginActivity.class); + startActivity(itthomeToLogin); + return true; + } + + if (id == android.R.id.home) { + Intent ittProjDtlsToHome = new Intent(PMApproved_DetailsActivity.this ,PMProjectDetailActivity.class); + ittProjDtlsToHome.putExtra("pageCount",1); + startActivity(ittProjDtlsToHome); + return true; + } + + return super.onOptionsItemSelected(item); + } + + +}//end of class diff --git a/app/src/main/java/com/leadcampusapp/PMComplitionFragment.java b/app/src/main/java/com/leadcampusapp/PMComplitionFragment.java new file mode 100644 index 0000000..8fa0597 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/PMComplitionFragment.java @@ -0,0 +1,505 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 22-06-2018. + */ + +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.AsyncTask; +import android.os.Bundle; +import androidx.fragment.app.Fragment; +import android.text.Editable; +import android.text.TextWatcher; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.EditText; +import android.widget.ListAdapter; +import android.widget.ListView; +import android.widget.ProgressBar; +import android.widget.SimpleAdapter; +import android.widget.TextView; + +//import com.android.sripad.leadnew_22_6_2018.R; +import com.leadcampusapp.module.ComplitedProjectList; +import com.leadcampusapp.module.ComplitionProjectListModule; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Locale; + +public class PMComplitionFragment extends Fragment { + + ListView list,list_head; + ArrayList> mylist, mylist_title; + ListAdapter adapter_title,adapter,adapter2; + HashMap map1, map2; + + String[] LeadId= {"MG10441","MG10442","MG10443","MG10444"}; + String[] Names = {"Pramod. K","Akshatha. K","Shiva. S","Shripad. A"}; + String[] Colleges = {"BVB","KLE","BVB","KLE"}; + String[] ProjectTittle = {"Food","Books","Food","Books"}; + String[] Budget = {"100","200","300","400"}; + + ComplitionProjectListModule complitedProjectListObj; + ArrayList complitedProjectListModules; + private ProgressBar progressBar; + // UnapprovedListAdapter adapter1 ; + ComplitionProjectListModule[] complitedInfosarr; + ArrayList arrayList= new ArrayList(); + + private HashMap mapPTitlePId; + + int responseCount=0; + int i=0; + // Integer ManagerId; + + public static final String PREFBook_PM= "prefbook_pm"; //sharedpreference Book + public static final String PrefID_PMID = "prefid_pmid"; // + SharedPreferences shardprefPM_obj; + String str_MangerID; + Integer MDId; + + private EditText etSearch; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + + View view=inflater.inflate(R.layout.pmcomplitionproject_fragment, container, false); + + mapPTitlePId = new HashMap(); + + progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + + list = (ListView) view.findViewById(R.id.lv_complitedlist); + list_head = (ListView) view.findViewById(R.id.lv_complitedlistHead); + + mylist = new ArrayList>(); + mylist_title = new ArrayList>(); + + complitedProjectListObj = new ComplitionProjectListModule(); + +/* ManagerId = getActivity().getIntent().getExtras().getInt("ManagerId"); + Log.i("tag","MangerID PMProjectDetails="+ManagerId); +*/ + + shardprefPM_obj= getActivity().getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MangerID = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + Log.d("str_leadId:",str_MangerID); + // Toast.makeText(this,"LeadId: "+str_MangerID,Toast.LENGTH_LONG).show(); + MDId=Integer.parseInt(str_MangerID); + + + etSearch = (EditText) view.findViewById(R.id.etSearch); + etSearch.addTextChangedListener(new TextWatcher() { + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + // Call back the Adapter with current character to Filter + } + + @Override + public void beforeTextChanged(CharSequence s, int start, int count,int after) { + } + ; + @Override + public void afterTextChanged(Editable s) { + //adapter.getFilter().filter(s.toString()); + String text = etSearch.getText().toString().toLowerCase(Locale.getDefault()); + if(adapter!=null && text!=null) { + ((SimpleAdapter) adapter).getFilter().filter(text); + } + } + }); + + + GetComplitedProjectDetails getComplitedProjectDetails = new GetComplitedProjectDetails(getActivity()); + getComplitedProjectDetails.execute(MDId); + + return view; + } + + public void showActivity1() { + + mylist = new ArrayList>(); + mylist_title = new ArrayList>(); + + /**********Display the headings************/ + + + map1 = new HashMap(); + + // map1.put("slno", "Lead Id"); + map1.put("one", " Name"); + map1.put("two", " College"); + map1.put("three","Project Title"); + map1.put("four","Budget"); + mylist_title.add(map1); + + + try { + adapter_title = new SimpleAdapter(getContext(), mylist_title, R.layout.pmcomplited_list, + new String[]{ "one", "two","three","four"}, new int[]{ + R.id.Name, R.id.College, R.id.ProjectTittle, R.id.Budget}); + list_head.setAdapter(adapter_title); + } catch (Exception e) { + + } + + /********************************************************/ + + + /**********Display the contents************/ + + /* for (int i = 0; i < Names.length; i++) { + map2 = new HashMap(); + + // map2.put("slno", LeadId[i]); + map2.put("one", Names[i]); + map2.put("two", Colleges[i]); + map2.put("three", ProjectTittle[i]); + map2.put("four", Budget[i]); + mylist.add(map2); + }*/ + map2 = new HashMap(); + + map2.put("one", "Madhu"); + map2.put("two", "College"); + map2.put("three", "ProjectTittle"); + map2.put("four", "Budget"); + mylist.add(map2); + + try { + adapter = new SimpleAdapter(getContext(), mylist, R.layout.pmcomplited_list, + new String[]{"one", "two","three","four"}, new int[]{ + R.id.Name, R.id.College, R.id.ProjectTittle, R.id.Budget}); + list.setAdapter(adapter); + } catch (Exception e) { + + } + + list.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + // String item = ((TextView)view).getText().toString(); + // String selectedItem = (String) parent.getItemAtPosition(position); + Object o = list.getItemAtPosition(position); + String name = ((TextView) view.findViewById(R.id.Name)).getText().toString(); + + // Toast.makeText(getContext(), "item"+name, Toast.LENGTH_LONG).show(); + Intent i= new Intent(getContext(), PMComplitionProjectActivity.class); + i.putExtra("name",name); + i.putExtra("ManagerId",MDId); + startActivity(i); + } + + }); + } + public void showActivity() { + + mylist = new ArrayList>(); + mylist_title = new ArrayList>(); + + /**********Display the headings************/ + + map1 = new HashMap(); + + // map1.put("slno", "Lead Id"); + map1.put("one", " Name"); + map1.put("two", " College"); + map1.put("three","Project Title"); + map1.put("four","Approved Amount"); + mylist_title.add(map1); + + + try { + adapter_title = new SimpleAdapter(getContext(), mylist_title, R.layout.pmunapproved_listhead, + new String[]{ "one", "two","three","four"}, new int[]{ + R.id.Name, R.id.College, R.id.ProjectTittle, R.id.Budget}); + list_head.setAdapter(adapter_title); + } catch (Exception e) { + + } + + + + + + + + + + + + + + + /********************************************************/ + + Log.i("Tag","complitedProjectListObj="+complitedProjectListObj.getStudent_name()); + Log.i("Tag","ComplitedProjectList.listview_arr.size="+ ComplitedProjectList.listview_arr.size()); + Log.i("Tag","ComplitedProjectListModule.listview_arr.size="+ ComplitionProjectListModule.listview_arr.size()); + + /**********Display the contents************/ + for (int i = 0; i < ComplitedProjectList.listview_arr.size(); i++) { + + String Collegestring = ComplitedProjectList.listview_arr.get(i).getCollege_name(); + String firstWord = ""; + /*String arr[] = Collegestring.split(" ", 2); + + String firstWord = arr[0]; //the + String secondWord = arr[1]; + + Log.i("tag","firstWord="+firstWord+" secondWord="+secondWord);*/ + if(Collegestring.equals("anyType{}")){ + + }else { + + String arr[] = Collegestring.split(" "); + + if (arr.length == 1) { + firstWord = arr[0]; + } else { + firstWord = arr[0]; + } + Log.i("tag", "firstWord=" + firstWord);//+ " secondWord=" + secondWord); + } + map2 = new HashMap(); + map2.put("one", ComplitedProjectList.listview_arr.get(i).getStudent_name()); + map2.put("two", firstWord); + map2.put("three", ComplitedProjectList.listview_arr.get(i).getProject_tittle()); + map2.put("four", ComplitedProjectList.listview_arr.get(i).getAmount()); + + map2.put("five", ComplitedProjectList.listview_arr.get(i).getLeadId()); + map2.put("six", ComplitedProjectList.listview_arr.get(i).getProjectId()); + map2.put("seven", ComplitedProjectList.listview_arr.get(i).getMobileNo()); + //Log.e("ImagePathissssssss",ComplitedProjectList.listview_arr.get(i).getStudent_Image_Path()); + map2.put("eight", ComplitedProjectList.listview_arr.get(i).getStudent_Image_Path()); + + map2.put("nine", ComplitedProjectList.listview_arr.get(i).getpmcomp_collegename()); + map2.put("ten", ComplitedProjectList.listview_arr.get(i).getpmcomp_stream_name()); + map2.put("eleven", ComplitedProjectList.listview_arr.get(i).get_is_impactproject()); + + /* Log.e("pmcom_collegename",ComplitedProjectList.listview_arr.get(i).getpmcomp_collegename()); + Log.e("pmcom_streamname",ComplitedProjectList.listview_arr.get(i).getpmcomp_stream_name());*/ + mylist.add(map2); + } + + try { + adapter = new SimpleAdapter(getContext(), mylist, R.layout.pmcomplited_list, + new String[]{"one", "two","three","four","five","six","seven","eight","nine","ten","eleven"}, new int[]{ + R.id.Name, R.id.College, R.id.ProjectTittle, R.id.Budget,R.id.tv_leadid,R.id.tv_projId,R.id.tv_mobileNo,R.id.tv_studImagePath, + R.id.pmcomp_collegenamelist_tv,R.id.pmcomp_streamnamelist_tv,R.id.pmcomp_isimpactproject_tv}); + list.setAdapter(adapter); + } catch (Exception e) { + + } + + list.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + // String item = ((TextView)view).getText().toString(); + // String selectedItem = (String) parent.getItemAtPosition(position); + Object o = list.getItemAtPosition(position); + String name = ((TextView) view.findViewById(R.id.Name)).getText().toString(); + + String project_Title = ((TextView) view.findViewById(R.id.ProjectTittle)).getText().toString(); + +/* String LeadId = ComplitedProjectList.listview_arr.get(position).getLeadId(); + String PDId = ComplitedProjectList.listview_arr.get(position).getProjectId(); + String MobileNo= ComplitedProjectList.listview_arr.get(position).getMobileNo(); + String Student_Image_Path= ComplitedProjectList.listview_arr.get(position).getStudent_Image_Path();*/ + + String LeadId = ((TextView) view.findViewById(R.id.tv_leadid)).getText().toString(); + String PDId = ((TextView) view.findViewById(R.id.tv_projId)).getText().toString(); + String MobileNo = ((TextView) view.findViewById(R.id.tv_mobileNo)).getText().toString(); + String Student_Image_Path = ((TextView) view.findViewById(R.id.tv_studImagePath)).getText().toString(); + String str_pmcomp_collegename = ((TextView) view.findViewById(R.id.pmcomp_collegenamelist_tv)).getText().toString(); + + String str_pmcomp_streamname = ((TextView) view.findViewById(R.id.pmcomp_streamnamelist_tv)).getText().toString(); + + String str_pmcomp_is_impactproject = ((TextView) view.findViewById(R.id.pmcomp_isimpactproject_tv)).getText().toString(); + + String Project_Id = mapPTitlePId.get(project_Title); + Log.d("Project Idxxxx",Project_Id); + + // Toast.makeText(getContext(), "item"+name, Toast.LENGTH_LONG).show(); + Intent i= new Intent(getContext(), PMComplitionProjectActivity.class); + i.putExtra("name",name); + i.putExtra("projectId",Project_Id); + i.putExtra("LeadId",LeadId); + i.putExtra("PDId",PDId); + i.putExtra("MobileNo",MobileNo); + i.putExtra("Student_Image_Path",Student_Image_Path); + i.putExtra("str_pmcomp_collegename",str_pmcomp_collegename); + i.putExtra("str_pmcomp_streamname",str_pmcomp_streamname); + i.putExtra("str_pmcomp_is_impactproject",str_pmcomp_is_impactproject); + + Log.i("tag","projectId="+Project_Id+"PDId="+PDId); + + + startActivity(i); + } + + }); + } + + public class GetComplitedProjectDetails extends AsyncTask { + + Context context; + // private ProgressDialog progressDialog; + + GetComplitedProjectDetails (Context ctx){ + context = ctx; + // progressDialog = new ProgressDialog(context); + } + + @Override + protected SoapObject doInBackground(Integer... params) { + Integer ManagerId = (Integer) params [0]; + + complitedProjectListModules = new ArrayList(); + + String METHOD_NAME = "GetcomplitedProjectList"; + String NamespaceMail="http://mis.leadcampus.org/", SOAP_ACTION1="http://mis.leadcampus.org/GetcomplitedProjectList";//namespace+methodname + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + request.addProperty("ManagerId", ManagerId); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapObject response = (SoapObject) envelope.getResponse(); + // Log.d("soap responseyyyyyyy",response.toString()); + //Log.d("Tag","soap response Complited"+response.toString()); + + responseCount = response.getPropertyCount(); + + Log.d("count", String.valueOf(response.getPropertyCount())); + + ComplitionProjectListModule.listview_arr.clear(); + ComplitedProjectList.listview_arr.clear(); + ArrayList innerObj_Class_centers = null; + if(responseCount>0) { + complitedInfosarr=new ComplitionProjectListModule[responseCount]; + for (i = 0; i < responseCount; i++) + { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + Log.d("response_soapobjxx",response_soapobj.toString()); + + complitedProjectListObj.setStudent_name(response_soapobj.getProperty("StudentName").toString()); + complitedProjectListObj.setCollege_name(response_soapobj.getProperty("College_name").toString()); + complitedProjectListObj.setProject_tittle(response_soapobj.getProperty("Title").toString()); + complitedProjectListObj.setSanction_amount(response_soapobj.getProperty("SanctionAmount").toString()); + complitedProjectListObj.setLeadId(response_soapobj.getProperty("Lead_Id").toString()); + complitedProjectListObj.setProjectId(response_soapobj.getProperty("PDId").toString()); + + complitedProjectListObj.setpmcomp_collegename(response_soapobj.getProperty("College_name").toString());//Lalbhai Dalpatbhai + complitedProjectListObj.setpmcomp_stream_name(response_soapobj.getProperty("StreamCode").toString());//Engineering + + complitedProjectListObj.set_is_impactproject(response_soapobj.getProperty("IsImpactProject").toString());//0 + + complitedProjectListModules.add(complitedProjectListObj); + + Log.d("tag","complitedProjectListModules.get(i)="+complitedProjectListModules.get(i).getStudent_name()); + Log.d("tag","complitedProjectListModules="+complitedProjectListModules.size()); + Log.d("tag","complitedProjectListModules="+complitedProjectListObj.getStudent_name()); + + String Sname=response_soapobj.getProperty("StudentName").toString(); + String College=response_soapobj.getProperty("College_name").toString(); + String ProjectTittle=response_soapobj.getProperty("Title").toString(); + String Amount=response_soapobj.getProperty("SanctionAmount").toString(); + String Project_Id = response_soapobj.getProperty("PDId").toString(); + String Lead_Id = response_soapobj.getProperty("Lead_Id").toString(); + String MobileNo=response_soapobj.getProperty("MobileNo").toString(); + String Student_Image_Path=response_soapobj.getProperty("Student_Image_Path").toString(); + + String str_collegename=response_soapobj.getProperty("College_name").toString(); + String str_streamname=response_soapobj.getProperty("StreamCode").toString(); + + String str_impactproject=response_soapobj.getProperty("IsImpactProject").toString(); + + mapPTitlePId.put(ProjectTittle,Project_Id); + + complitedInfosarr[i]=complitedProjectListObj; + + ComplitedProjectList.listview_arr.add(new ComplitedProjectList(Sname, College,ProjectTittle, Amount,Lead_Id,Project_Id,MobileNo,Student_Image_Path,str_collegename,str_streamname,str_impactproject)); + + Log.i("Tag","ComplitedProjectListlistview_arr.size="+ ComplitedProjectList.listview_arr.size()); + + } + + } + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.d("exception outside",t.getMessage().toString()); + } + + //Log.d("Soap response is",response.toString()); + + return null; + } + + @Override + protected void onPreExecute() { + + progressBar.setVisibility(View.VISIBLE); + /*progressDialog.setMessage("Loading"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show();*/ + + } + + @Override + protected void onPostExecute(SoapObject result) { + progressBar.setVisibility(View.GONE); + // progressDialog.dismiss(); + if(result!=null) { + + Log.i("Tag", "complitedInfosarr===" + complitedInfosarr); + Log.i("Tag", "complitedInfosarr.length===" + complitedInfosarr.length); + showActivity(); + } + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + +} diff --git a/app/src/main/java/com/leadcampusapp/PMComplitionProjectActivity.java b/app/src/main/java/com/leadcampusapp/PMComplitionProjectActivity.java new file mode 100644 index 0000000..b48be69 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/PMComplitionProjectActivity.java @@ -0,0 +1,4031 @@ +package com.leadcampusapp; + +import android.annotation.SuppressLint; +import android.app.AlertDialog; +import android.app.Dialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.Color; +import android.net.Uri; +import android.os.AsyncTask; +import android.os.Bundle; +import android.os.Environment; +import android.os.Handler; +import androidx.core.content.ContextCompat; +import androidx.core.content.FileProvider; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.AppCompatSpinner; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.ProgressBar; +import android.widget.RatingBar; +import android.widget.RelativeLayout; +import android.widget.TextView; +import android.widget.Toast; + +//import com.android.sripad.leadnew_22_6_2018.R; + +import org.joda.time.Days; +import org.joda.time.LocalDate; +import org.json.JSONException; +import org.json.JSONObject; +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.ProtocolException; +import java.net.URL; +import java.util.ArrayList; + +import static android.view.View.GONE; + +public class PMComplitionProjectActivity extends AppCompatActivity implements ConnectivityReceiver.ConnectivityReceiverListener{ + + Context mContext=this; + String count; + RelativeLayout rl_gallery_images; + + private TextView projectname_tv; + private TextView projecttype_tv; + private TextView projectobjective_tv; + private EditText edt_placeofimplementation; + private EditText edt_fundraised; + EditText edt_resources,edt_CurrentSituation,edt_HoursSpend,resourcesUtilised_amount_pm_et; + private TextView leadfund_tv; + private TextView approvedamt_tv; + private EditText edt_challenges; + private EditText edt_learning; + private EditText edt_story; + private EditText edt_pmcomment; + + private AppCompatSpinner spin_studLevel; + + private ImageView btn_saveImg,img_student,btn_reject; + + private Context context; + + private RatingBar ratingBar; + + private ArrayList imagePathList; + private ArrayList bitmapList; + private String serverPath = Class_URL.ServerPath.toString().trim(); + private URL url; + private TextView txt_numOfImages; + private ImageView img_mainGallery; + private int count1; + private int count2; + private TextView txt_studentid,txt_mobileno,spin_error_TV; + private String wordDocPath="null"; + private String wordDocumentName; + private String docName; + private URL downloadUrl; + File outputFile = null; + String LeadId,PDId; + String Student_Image_Path,MobileNo; + String Name; + Integer ManagerId; + ArrayList urllist = new ArrayList(); + ArrayList bitmapLst=new ArrayList(); + + public static final String PREFBook_PM= "prefbook_pm"; //sharedpreference Book + public static final String PrefID_PMID = "prefid_pmid"; // + SharedPreferences shardprefPM_obj; + String str_MangerID; + Integer MDId; + + String PMImgUrl,str_studLevel; + private ProgressDialog progressDialog; + + ArrayAdapter dataAdapter_studLevel; + + private RatingBar innovaion_ratingbar_rb,leadership_ratingbar_rb,risktaken_ratingbar_rb,impact_ratingbar_rb,fundraised_ratingbar_rb,final_ratingbar_rb; + + int ratingbar1_intvalue,ratingbar2_intvalue,ratingbar3_intvalue,ratingbar4_intvalue,ratingbar5_intvalue; + String ratingg_str,ratingg_str2,ratingg_str3,ratingg_str4,ratingg_str5,ratingg_str_final; + //innovaion_ratingbar_rb + TextView finalrating_tv; + + + static TextView pmcomp_clickstartproject_editdate_tv; + static TextView pmcomp_clickendproject_editdate_tv; + + private TextView pmcomplition_numberofdays_tv; + + LinearLayout calendarlabel_linearlayout,calendar_linearlayout,pmcomplition_studentdays_linearlayout; + + TextView pmcomp_collegename_tv,pmcomp_streamname_tv; + String str_collegename="",str_streamname="",str_impactproject=""; + + Button impactproject_bt; + + TextView pmcomplition_sdgs_display_tv,pmcomplition_sdgs_dropdownvalue_tv; + + CheckBox goal_1_nopoverty_cb,goal_2_zerohunger_cb,goal_3_goodhealth_cb,goal_4_quality_cb,goal_5_gender_cb,goal_6_clean_cb, + goal_7_affordable_cb,goal_8_decent_cb,goal_9_industry_cb,goal_10_reduce_cb,goal_11_sustain_cb,goal_12_responsible_cb, + goal_13_climate_cb,goal_14_lifewater_cb,goal_15_lifeland_cb,goal_16_peace_cb,goal_17_partnerships_cb,goal_18_none_cb; + Dialog dialog = null; + String str_alertshowhide; + JSONObject goals_jsonobject; + + + + String str_collaboration_resp,str_permissionactivities_resp,str_exp_initiative_resp,str_lacking_initiative_resp + ,str_againtstide_resp,str_cross_hurdles_resp,str_venture_resp,str_govern_award_resp,str_leadership_role_resp,str_sdgs_goals_resp; + + private ArrayList arraylist_goalsln = new ArrayList(); + String str_selected_goals_response=""; + private ArrayList arraylist_goalsln_forcheckbox = new ArrayList(); + + + + CheckBox impactproject_collabaration_cb,impactproject_againtstide_cb,impactproject_crosshurdles_cb,impactproject_venture_cb, + impactproject_governaward_cb,impactproject_leadershiprole_cb; + + EditText impactproject_collabaration_et,impactproject_againtstide_et,impactproject_crosshurdles_et, + impactproject_venture_et,impactproject_governaward_et,impactproject_leadershiprole_et,permissionactivities_et, + exp_initiative_et,lacking_initiative_et; + + String str_validation_leadershiprole,str_validation_governaward,str_validation_venture,str_validation_crosshurdles,str_validation_againtstide, + str_validation_collabaration,str_sdgs_goals_verified; + LinearLayout impactproject_linearlayout; + + TextView make_impactproject_tv; + + Button pm_chat_txt; + + @Override + protected void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_pmcomplition_project); + + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + //getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background)); + + View actionBarView = getSupportActionBar().getCustomView(); + TextView actionBarTV = (TextView) actionBarView.findViewById(R.id.txt_actionBar); + actionBarTV.setText("Completion Project"); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); + + Intent intent = getIntent(); + Name = intent.getStringExtra("name"); + Log.e("TAG","name="+Name); + // count =intent.getStringExtra("count"); + // Log.e("TAG","count="+count); + LeadId=intent.getStringExtra("LeadId"); + PDId = intent.getStringExtra("PDId"); + MobileNo=intent.getStringExtra("MobileNo"); + Student_Image_Path=intent.getStringExtra("Student_Image_Path"); + str_collegename=intent.getStringExtra("str_pmcomp_collegename"); + str_streamname=intent.getStringExtra("str_pmcomp_streamname"); + str_impactproject=intent.getStringExtra("str_pmcomp_is_impactproject"); + + + + + Log.e("TAG","LeadId="+LeadId); + Log.e("TAG","PDId="+PDId); + TextView txt_name=(TextView) findViewById(R.id.txt_name); + txt_name.setText(Name); + + edt_CurrentSituation=(EditText) findViewById(R.id.edt_CurrentSituation); + edt_resources=(EditText) findViewById(R.id.edt_resources); + edt_HoursSpend=(EditText) findViewById(R.id.edt_hoursspend); + resourcesUtilised_amount_pm_et=(EditText) findViewById(R.id.resourcesUtilised_amount_pm_et); + + spin_studLevel = (AppCompatSpinner) findViewById(R.id.spin_studLevel); + spin_error_TV = (TextView) findViewById(R.id.spin_error_TV); + + spin_error_TV.setVisibility(View.GONE); + txt_mobileno=(TextView) findViewById(R.id.txt_mobileno); + txt_mobileno.setText(MobileNo); + txt_mobileno.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(Intent.ACTION_DIAL); + intent.setData(Uri.parse("tel:"+txt_mobileno.getText().toString())); + startActivity(intent); + } + }); + + pm_chat_txt=(Button) findViewById(R.id.pm_chat_txt); + + innovaion_ratingbar_rb=(RatingBar)findViewById(R.id.innovaion_ratingbar_rb); + leadership_ratingbar_rb= (RatingBar)findViewById(R.id.leadership_ratingbar_rb); + risktaken_ratingbar_rb= (RatingBar)findViewById(R.id.risktaken_ratingbar_rb); + impact_ratingbar_rb= (RatingBar)findViewById(R.id.impact_ratingbar_rb); + fundraised_ratingbar_rb=(RatingBar)findViewById(R.id.fundraised_ratingbar_rb); + + final_ratingbar_rb= (RatingBar)findViewById(R.id.final_ratingbar_rb); + finalrating_tv=(TextView)findViewById(R.id.finalrating_tv); + + + ratingBar = (RatingBar)findViewById(R.id.ratingBar); + img_student=(ImageView) findViewById(R.id.img_student); + + + pmcomp_clickstartproject_editdate_tv = (TextView) findViewById(R.id.pmcomp_clickstartproject_editdate_TV); + pmcomp_clickendproject_editdate_tv = (TextView) findViewById(R.id.pmcomp_clickendproject_editdate_TV); + + pmcomplition_numberofdays_tv=(TextView) findViewById(R.id.pmcomplition_numberofdays_tv); + + impactproject_bt=(Button)findViewById(R.id.impactproject_bt); + + pmcomp_collegename_tv=(TextView) findViewById(R.id.pmcomp_collegename_tv); + pmcomp_streamname_tv=(TextView) findViewById(R.id.pmcomp_streamname_tv); + calendarlabel_linearlayout=(LinearLayout)findViewById(R.id.calendarlabel_linearlayout); + calendar_linearlayout=(LinearLayout)findViewById(R.id.calendar_linearlayout); + pmcomplition_studentdays_linearlayout=(LinearLayout)findViewById(R.id.pmcomplition_studentdays_linearlayout); + + + pmcomplition_sdgs_display_tv=(TextView) findViewById(R.id.pmcomplition_sdgs_display_tv); + pmcomplition_sdgs_dropdownvalue_tv=(TextView) findViewById(R.id.pmcomplition_sdgs_dropdownvalue_tv); + + + + impactproject_linearlayout =(LinearLayout)findViewById(R.id.impactproject_linearlayout); + impactproject_collabaration_cb=(CheckBox)findViewById(R.id.impactproject_collabaration_cb); + impactproject_againtstide_cb=(CheckBox)findViewById(R.id.impactproject_againtstide_cb); + impactproject_crosshurdles_cb=(CheckBox)findViewById(R.id.impactproject_crosshurdles_cb); + impactproject_venture_cb=(CheckBox)findViewById(R.id.impactproject_venture_cb); + impactproject_governaward_cb=(CheckBox)findViewById(R.id.impactproject_governaward_cb); + impactproject_leadershiprole_cb=(CheckBox)findViewById(R.id.impactproject_leadershiprole_cb); + + impactproject_collabaration_et=(EditText) findViewById(R.id.impactproject_collabaration_et); + impactproject_againtstide_et=(EditText) findViewById(R.id.impactproject_againtstide_et); + impactproject_crosshurdles_et=(EditText) findViewById(R.id.impactproject_crosshurdles_et); + impactproject_venture_et=(EditText) findViewById(R.id.impactproject_venture_et); + impactproject_governaward_et=(EditText) findViewById(R.id.impactproject_governaward_et); + impactproject_leadershiprole_et=(EditText) findViewById(R.id.impactproject_leadershiprole_et); + permissionactivities_et=(EditText) findViewById(R.id.permissionactivities_et); + exp_initiative_et=(EditText) findViewById(R.id.exp_initiative_et); + lacking_initiative_et=(EditText) findViewById(R.id.lacking_initiative_et); + make_impactproject_tv=(TextView)findViewById(R.id.make_impactproject_tv); + + str_validation_leadershiprole=str_validation_governaward=str_validation_venture=str_validation_crosshurdles + =str_validation_againtstide=str_validation_collabaration="yes"; + str_sdgs_goals_verified="no"; + + + + + + + + + + + shardprefPM_obj=this.getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MangerID = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + Log.d("str_leadId:",str_MangerID); + // Toast.makeText(this,"LeadId: "+str_MangerID,Toast.LENGTH_LONG).show(); + MDId=Integer.parseInt(str_MangerID); + + /* ManagerId = getIntent().getExtras().getInt("ManagerId"); + Log.i("tag","MangerID PMProjectDetails="+ManagerId);*/ + + rl_gallery_images=(RelativeLayout)findViewById(R.id.rl_gallery_images); + + if(str_impactproject.equals("0")) + { + make_impactproject_tv.setText("Make this an Impact project : "); + impactproject_linearlayout.setVisibility(View.GONE); + } + else{ + make_impactproject_tv.setText("Make this an Non-Impact project : "); + impactproject_linearlayout.setVisibility(View.VISIBLE); + } + + setStudentLevelSpinner(); + + String Imagestring = Student_Image_Path; + if (Imagestring==null||Imagestring.equals("null") || Imagestring.equals("anyType{}")) { + // PMImgUrl="null"; + img_student.setImageResource(R.drawable.devanand); + } else { + Log.e("studentImageStringis:",Imagestring); + String arr[] = Imagestring.split("/", 2); + + String firstWord = arr[0]; //the + String secondWord = arr[1]; + + PMImgUrl = serverPath + secondWord; + + Log.i("tag", "firstWord=" + firstWord + " secondWord=" + secondWord); + LoadGalleryImage_stud loadGalleryImage = new LoadGalleryImage_stud(PMComplitionProjectActivity.this); + loadGalleryImage.execute(); + } + + + + pmcomp_collegename_tv.setText(str_collegename); + pmcomp_streamname_tv.setText(str_streamname); + + + ratingBar.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener(){ + + @Override + public void onRatingChanged(RatingBar ratingBar, float rating, + boolean fromUser) { + // TODO Auto-generated method stub + ratingBar.setRating(rating); + // ratingBar_Indicator.setRating(rating); + /*Toast.makeText(PMComplitionProjectActivity.this, "rating:"+String.valueOf(ratingBar.getRating()), + Toast.LENGTH_LONG).show();;*/ + }}); + + ImageView doc_iv = (ImageView) findViewById(R.id.btn_doc); + + initializeViews(); + + getProjectCompletionDtls(); + + doc_iv.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + /*File file= new File(String.valueOf(Environment.getRootDirectory())); + Log.d("TAG","file="+file); + //File file1=new File(Environment.getExternalStorageDirectory(),"Documents.docx"); + File file1=new File(Environment.getExternalStorageDirectory(),"MH00_Upload_Test file.docx"); + Log.d("TAG","file1="+file1); + File myFile = new File(Environment.DIRECTORY_DOCUMENTS,"mmr1.docx"); + Log.d("TAG","myfile="+myFile); + try { + //FileOpen.openFile(mContext, myFile); + FileOpen.openFile(mContext, file1); + } catch (IOException e) { + e.printStackTrace(); + }*/ + Log.d("wordDocPath",wordDocPath); + // Log.d("downloadUrl", String.valueOf(downloadUrl)); + + if(wordDocPath.equals("null")){ + Toast.makeText(PMComplitionProjectActivity.this, "File Not Exist", + Toast.LENGTH_SHORT).show(); + }else{ + LoadDocument loadDocument = new LoadDocument(context); + loadDocument.execute(); + } + + + + // Intent i=new Intent(PMComplitionProjectActivity.this,DocumentViewActivity.class); + // startActivity(i); + /* File file = new File(Environment.getExternalStorageDirectory(), + "Document.docx"); + + try { + if (file.exists()) { + Uri path = Uri.fromFile(file); + Intent objIntent = new Intent(Intent.ACTION_VIEW); + // replace "application/msword" with + // "application/vnd.openxmlformats-officedocument.wordprocessingml.document" + // for docx files + // objIntent.setDataAndType(path,"application/msword"); + objIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + startActivity(objIntent); + } else { + Toast.makeText(PMComplitionProjectActivity.this, "File NotFound", + Toast.LENGTH_SHORT).show(); + } + } catch (ActivityNotFoundException e) { + Toast.makeText(PMComplitionProjectActivity.this, + "No Viewer Application Found", Toast.LENGTH_SHORT) + .show(); + } catch (Exception e) { + e.printStackTrace(); + }*/ + } + }); + + //progressDialog = new ProgressDialog(context); + + spin_studLevel.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected (AdapterView < ? > parent, View view, + int position, long id){ + // TODO Auto-generated method stub + str_studLevel = spin_studLevel.getSelectedItem().toString(); + // Toast.makeText(getApplicationContext(),"Blood:"+str_bloodgroup,Toast.LENGTH_SHORT).show(); + if(!( (str_studLevel.equals("x"))|| (str_studLevel.equals("Select")) )) + { spin_error_TV.setText(""); + spin_error_TV.setVisibility(View.GONE); + } + } + @Override + public void onNothingSelected (AdapterView < ? > parent){ + // TODO Auto-generated method stub + + } + }); + + rl_gallery_images.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + //Log.d("lengthoflistsss", String.valueOf(bitmapList.size())); + Log.d("lengthoflistsss", String.valueOf(bitmapLst.size())); + + // Toast.makeText(getApplicationContext(),"On Click of relative layout submit",Toast.LENGTH_LONG).show(); + + /* progressDialog.setMessage("Submitting"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show();*/ + + try { + if (bitmapLst.size() > 0) { + + /*File projImageFolder = null; + + if (new CheckForSDCard().isSDCardPresent()) { + projImageFolder = new File( + Environment.getExternalStorageDirectory() + "/" + + "ProjectImagesFiles"); + } else { + Toast.makeText(context, "Oops!! There is no SD Card.", Toast.LENGTH_SHORT).show(); + } + + if (!projImageFolder.exists()) { + projImageFolder.mkdir(); + Log.e("Main", "Directory Created."); + } + + String mainFolder = projImageFolder.getAbsolutePath().toString(); + File subFolder = new File(mainFolder,"Images_"+LeadId.toString()); + + if (!subFolder.exists()) { + subFolder.mkdir(); + Log.e("Main", "SubDirectory Created."); + } + + for(int k=0;k0) + { + check_box_enable2(); + }else + { + } + + + + + + goal_18_none_cb.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) + { + if(goal_18_none_cb.isChecked()) + { + + + goal_1_nopoverty_cb.setChecked(false); + goal_2_zerohunger_cb.setChecked(false); + goal_3_goodhealth_cb.setChecked(false); + goal_4_quality_cb.setChecked(false); + goal_5_gender_cb.setChecked(false); + goal_6_clean_cb.setChecked(false); + goal_7_affordable_cb.setChecked(false); + goal_8_decent_cb.setChecked(false); + goal_9_industry_cb.setChecked(false); + goal_10_reduce_cb.setChecked(false); + goal_11_sustain_cb.setChecked(false); + goal_12_responsible_cb.setChecked(false); + goal_13_climate_cb.setChecked(false); + goal_14_lifewater_cb.setChecked(false); + goal_15_lifeland_cb.setChecked(false); + goal_16_peace_cb.setChecked(false); + goal_17_partnerships_cb.setChecked(false); + + goal_1_nopoverty_cb.setEnabled(false); + goal_2_zerohunger_cb.setEnabled(false); + goal_3_goodhealth_cb.setEnabled(false); + goal_4_quality_cb.setEnabled(false); + goal_5_gender_cb.setEnabled(false); + goal_6_clean_cb.setEnabled(false); + goal_7_affordable_cb.setEnabled(false); + goal_8_decent_cb.setEnabled(false); + goal_9_industry_cb.setEnabled(false); + goal_10_reduce_cb.setEnabled(false); + goal_11_sustain_cb.setEnabled(false); + goal_12_responsible_cb.setEnabled(false); + goal_13_climate_cb.setEnabled(false); + goal_14_lifewater_cb.setEnabled(false); + goal_15_lifeland_cb.setEnabled(false); + goal_16_peace_cb.setEnabled(false); + goal_17_partnerships_cb.setEnabled(false); + //goalslist_linearlayout.setVisibility(View.INVISIBLE); + + }else + { + + goal_1_nopoverty_cb.setEnabled(true); + goal_2_zerohunger_cb.setEnabled(true); + goal_3_goodhealth_cb.setEnabled(true); + goal_4_quality_cb.setEnabled(true); + goal_5_gender_cb.setEnabled(true); + goal_6_clean_cb.setEnabled(true); + goal_7_affordable_cb.setEnabled(true); + goal_8_decent_cb.setEnabled(true); + goal_9_industry_cb.setEnabled(true); + goal_10_reduce_cb.setEnabled(true); + goal_11_sustain_cb.setEnabled(true); + goal_12_responsible_cb.setEnabled(true); + goal_13_climate_cb.setEnabled(true); + goal_14_lifewater_cb.setEnabled(true); + goal_15_lifeland_cb.setEnabled(true); + goal_16_peace_cb.setEnabled(true); + goal_17_partnerships_cb.setEnabled(true); + + //goalslist_linearlayout.setVisibility(View.VISIBLE); + + } + + } + }); + + + + + addgoals_bt.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) + { + // Toast.makeText(context, "Request Has Been Sent", Toast.LENGTH_LONG).show(); + //if(validation_forgoals()) + + + // goal_1_nopoverty_cb,goal_2_zerohunger_cb,goal_3_goodhealth_cb,goal_4_quality_cb + //goal_5_gender_cb,goal_6_clean_cb,goal_7_affordable_cb,goal_8_decent_cb,goal_9_industry_cb + //goal_10_reduce_cb,goal_11_sustain_cb,goal_12_responsible_cb,goal_13_climate_cb + //goal_14_lifewater_cb,goal_15_lifeland_cb,goal_16_peace_cb,goal_17_partnerships_cb + //goal_18_none_cb + + + if(goal_1_nopoverty_cb.isChecked()||goal_2_zerohunger_cb.isChecked()||goal_3_goodhealth_cb.isChecked() + ||goal_4_quality_cb.isChecked()||goal_5_gender_cb.isChecked()||goal_6_clean_cb.isChecked() + ||goal_7_affordable_cb.isChecked()||goal_8_decent_cb.isChecked()||goal_9_industry_cb.isChecked() + ||goal_10_reduce_cb.isChecked()||goal_11_sustain_cb.isChecked()||goal_12_responsible_cb.isChecked() + ||goal_13_climate_cb.isChecked()||goal_14_lifewater_cb.isChecked()||goal_15_lifeland_cb.isChecked()|| + goal_16_peace_cb.isChecked()||goal_17_partnerships_cb.isChecked()||goal_18_none_cb.isChecked()) + { + str_alertshowhide="yes"; + check_box_selected(); + } + else + { + + str_alertshowhide="no"; + Toast.makeText(getApplicationContext(),"Select atleast one option",Toast.LENGTH_SHORT).show(); + } + + + + /*EditProfileActivity.SubmitQuery submitQuery = new EditProfileActivity.SubmitQuery(context); + submitQuery.execute();*/ + + if(str_alertshowhide.equals("no")) + { + + } + else + { + + + dialog.dismiss(); + } + + + } + }); + + cancel_goals_bt.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) + { + + goals_jsonobject = new JSONObject(); + try { + goals_jsonobject.put("", ""); + } catch (JSONException e) { + e.printStackTrace(); + } + + pmcomplition_sdgs_display_tv.setText(""); + + dialog.dismiss(); + } + }); + + + dialog.show(); + + + } + }); + + //sdgs goal + + + + + + impactproject_collabaration_cb.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) + { + if(impactproject_collabaration_cb.isChecked()) + { + impactproject_collabaration_et.setVisibility(View.VISIBLE); + str_validation_collabaration="yes"; + }else{ + impactproject_collabaration_et.setVisibility(View.GONE); + impactproject_collabaration_et.setText(""); + str_validation_collabaration="no"; + } + + } + }); + + + + + impactproject_againtstide_cb.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) + { + if(impactproject_againtstide_cb.isChecked()) + { + impactproject_againtstide_et.setVisibility(View.VISIBLE); + str_validation_againtstide="yes"; + }else{ + impactproject_againtstide_et.setVisibility(View.GONE); + impactproject_againtstide_et.setText(""); + str_validation_againtstide="no"; + } + + } + }); + + + + + + impactproject_crosshurdles_cb.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) + { + if(impactproject_crosshurdles_cb.isChecked()) + { + impactproject_crosshurdles_et.setVisibility(View.VISIBLE); + str_validation_crosshurdles="yes"; + }else{ + impactproject_crosshurdles_et.setVisibility(View.GONE); + impactproject_crosshurdles_et.setText(""); + str_validation_crosshurdles="no"; + } + + } + }); + + + + impactproject_venture_cb.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) + { + if(impactproject_venture_cb.isChecked()) + { + impactproject_venture_et.setVisibility(View.VISIBLE); + str_validation_venture="yes"; + }else{ + impactproject_venture_et.setVisibility(View.GONE); + impactproject_venture_et.setText(""); + str_validation_venture="no"; + } + + } + }); + + + + + + + impactproject_governaward_cb.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) + { + if(impactproject_governaward_cb.isChecked()) + { + + impactproject_governaward_et.setVisibility(View.VISIBLE); + str_validation_governaward="yes"; + }else{ + impactproject_governaward_et.setVisibility(View.GONE); + impactproject_governaward_et.setText(""); + str_validation_governaward="no"; + } + + } + }); + + + + + impactproject_leadershiprole_cb.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) + { + if(impactproject_leadershiprole_cb.isChecked()) + { + impactproject_leadershiprole_et.setVisibility(View.VISIBLE); + str_validation_leadershiprole="yes"; + }else{ + impactproject_leadershiprole_et.setVisibility(View.GONE); + impactproject_leadershiprole_et.setText(""); + str_validation_leadershiprole="no"; + } + + } + }); + + + + + }// end of oncreate() + + + + public void calculateFinalRating1() + { + float calculate = (float) (ratingbar1_intvalue + + ratingbar2_intvalue + ratingbar3_intvalue + ratingbar4_intvalue + ratingbar5_intvalue) / 5; + System.out.println(" calculate value..." + calculate); + //ratingbar_final.setNumStars(calculate); + // float val = (float) calculate; + // System.out.println(" val value..." + val); + final_ratingbar_rb.setRating(calculate); + Toast.makeText(getApplicationContext(),""+calculate,Toast.LENGTH_SHORT).show(); + + // finalvalue.setText(String.valueOf(calculate)); + } + @SuppressLint("RestrictedApi") + private void setStudentLevelSpinner() { + final ArrayList listStudLevel = new ArrayList(); + listStudLevel.add("Select"); + listStudLevel.add("Initiator"); + listStudLevel.add("Change Maker"); + listStudLevel.add("LEADer"); + + + //ArrayAdapter dataAdapterSem = new ArrayAdapter(context, R.layout.simple_spinner_semester, listsemester); + dataAdapter_studLevel = new ArrayAdapter(this, R.layout.simple_spinner_items, listStudLevel); + + // Drop down layout style - list view with radio button + dataAdapter_studLevel.setDropDownViewResource(R.layout.spinnercustomstyle); + + // attaching data adapter to spinner + spin_studLevel.setAdapter(dataAdapter_studLevel); + spin_studLevel.setSupportBackgroundTintList(ContextCompat.getColorStateList(this, R.color.colorBlack)); + + } + public void calculateFinalRating() { + float calculate = (float) (ratingbar1_intvalue + ratingbar2_intvalue + ratingbar3_intvalue + ratingbar4_intvalue + ratingbar5_intvalue) / 5; + System.out.println(" calculate value..." + calculate); + + // Toast.makeText(getApplicationContext(),""+calculate,Toast.LENGTH_SHORT).show(); + + + //finalvalue.setText(calculate); + float[] array1= new float[]{1.1f, 1.2f,1.3f,1.4f,1.6f,1.7f,1.8f,1.9f}; + float[] array2= new float[]{2.1f, 2.2f,2.3f,2.4f,2.6f,2.7f,2.8f,2.9f}; + float[] array3= new float[]{3.1f, 3.2f,3.3f,3.4f,3.6f,3.7f,3.8f,3.9f}; + float[] array4= new float[]{4.1f, 4.2f,4.3f,4.4f,4.6f,4.7f,4.8f,4.9f}; + + + + /*if((calculate==array1[0])||(calculate==array1[1])){ + final_ratingbar_rb.setRating(1.0f); + finalrating_tv.setText("1.0"); + + }else if((calculate==array1[2])||(calculate==array1[3]) || (calculate==array1[4])||(calculate==array1[5])){ + final_ratingbar_rb.setRating(1.5f); + finalrating_tv.setText("1.5"); + + }else if((calculate==array1[6])||(calculate==array1[7]) || (calculate==array2[0])||(calculate==array2[1])){ + final_ratingbar_rb.setRating(2.0f); + finalrating_tv.setText("2.0"); + + }else if((calculate==array2[2])||(calculate==array2[3]) || (calculate==array2[4])||(calculate==array2[5])){ + final_ratingbar_rb.setRating(2.5f); + finalrating_tv.setText("2.5"); + + }else if((calculate==array2[6])||(calculate==array2[7]) || (calculate==array3[0])||(calculate==array3[1]) ){ + final_ratingbar_rb.setRating(3.0f); + finalrating_tv.setText("3.0"); + + }else if((calculate==array3[2])||(calculate==array3[3]) || (calculate==array3[4])||(calculate==array3[5])){ + final_ratingbar_rb.setRating(3.5f); + finalrating_tv.setText("3.5"); + + }else if((calculate==array3[6])||(calculate==array3[7]) || (calculate==array4[0])||(calculate==array4[1])){ + final_ratingbar_rb.setRating(4.0f); + finalrating_tv.setText("4.0"); + + }else if((calculate==array4[2])||(calculate==array4[3]) || (calculate==array4[4])||(calculate==array4[5])){ + final_ratingbar_rb.setRating(4.5f); + finalrating_tv.setText("4.5"); + + }else if((calculate==array4[6])||(calculate==array4[7])){ + final_ratingbar_rb.setRating(5.0f); + finalrating_tv.setText("5.0"); + + }*/ + + + + if((calculate==array1[0])||(calculate==array1[1])||(calculate==1.0f)){ + final_ratingbar_rb.setRating(1.0f); + finalrating_tv.setText("1.0"); + + }else if((calculate==array1[2])||(calculate==array1[3]) || (calculate==array1[4])||(calculate==array1[5])){ + final_ratingbar_rb.setRating(1.5f); + finalrating_tv.setText("1.5"); + + }else if((calculate==array1[6])||(calculate==array1[7]) || (calculate==array2[0])||(calculate==array2[1])||(calculate==2.0f)){ + final_ratingbar_rb.setRating(2.0f); + finalrating_tv.setText("2.0"); + + }else if((calculate==array2[2])||(calculate==array2[3]) || (calculate==array2[4])||(calculate==array2[5])){ + final_ratingbar_rb.setRating(2.5f); + finalrating_tv.setText("2.5"); + + }else if((calculate==array2[6])||(calculate==array2[7]) || (calculate==array3[0])||(calculate==array3[1]) ||(calculate==3.0f)){ + final_ratingbar_rb.setRating(3.0f); + finalrating_tv.setText("3.0"); + + }else if((calculate==array3[2])||(calculate==array3[3]) || (calculate==array3[4])||(calculate==array3[5])){ + final_ratingbar_rb.setRating(3.5f); + finalrating_tv.setText("3.5"); + + }else if((calculate==array3[6])||(calculate==array3[7]) || (calculate==array4[0])||(calculate==array4[1])||(calculate==4.0f)){ + final_ratingbar_rb.setRating(4.0f); + finalrating_tv.setText("4.0"); + + }else if((calculate==array4[2])||(calculate==array4[3]) || (calculate==array4[4])||(calculate==array4[5])){ + final_ratingbar_rb.setRating(4.5f); + finalrating_tv.setText("4.5"); + + }else if((calculate==array4[6])||(calculate==array4[7])||(calculate==5.0f)){ + final_ratingbar_rb.setRating(5.0f); + finalrating_tv.setText("5.0"); + + } + + + + + } + + + @Override + protected void onResume() { + super.onResume(); + + // register connection status listener + MyApplication.getInstance().setConnectivityListener(this); + } + + @Override + public void onNetworkConnectionChanged(boolean isConnected) { + showSnack(isConnected); + } + + private void showSnack(boolean isConnected) { + + if (!isConnected) { + + AlertDialog.Builder adb = new AlertDialog.Builder(PMComplitionProjectActivity.this); + //adb.setView(alertDialogView); + + adb.setTitle("Sorry! Not connected to the internet"); + + adb.setIcon(android.R.drawable.ic_dialog_alert); + + adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + + adb.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + adb.setCancelable(true); + adb.show(); + } + +/* String message; + int color; + if (isConnected) { + message = "Good! Connected to Internet"; + color = Color.WHITE; + } else { + message = "Sorry! Not connected to internet"; + color = Color.RED; + } + + Snackbar snackbar = Snackbar + .make(findViewById(R.id.coordinator_layout), message, Snackbar.LENGTH_LONG); + + View sbView = snackbar.getView(); + TextView textView = (TextView) sbView.findViewById(android.support.design.R.id.snackbar_text); + textView.setTextColor(color); + snackbar.show();*/ + } + + + + + + + + + + + + + + + + + + public boolean validation_Save() + { + + Boolean bpmcomments=true,bamount=true,blevel=true,bsdgs_goals=true; + Boolean bpmresource_amount1=true,bpmresource_amount2=true,bpmresource_amount3=true; + Boolean bpmplaceofimplementation=true,bpm_challengefaced=true,bpm_learnings=true,bpm_story=true, + bpm_currentsituation=true,bpm_sdgsgoals=true,bpm_impactproject_collabaration=true,bpm_impactproject_againtstide=true,bpm_impactproject_crosshurdles=true,bpm_impactproject_venture=true, + bpm_impactproject_governaward=true,bpm_impactproject_leadershiprole=true,bpm_resources=true; + + + + String str_resource_amount=resourcesUtilised_amount_pm_et.getText().toString().trim(); + + + + if(edt_placeofimplementation.getText().toString().trim().length()==0|| + edt_placeofimplementation.getText().toString().trim().length()<2) + { + if(edt_placeofimplementation.getText().toString().trim().length()<2) + { + edt_placeofimplementation.setError("Minimum 3 character"); + edt_placeofimplementation.requestFocus(); + bpmplaceofimplementation= false; + } + else { + edt_placeofimplementation.setError("Enter the Place of Implementation"); + edt_placeofimplementation.requestFocus(); + bpmplaceofimplementation = false; + } + } + + + if(edt_challenges.getText().toString().trim().length()<10){ + + edt_challenges.setError("Minimum 10 characters"); + edt_challenges.requestFocus(); + bpm_challengefaced=false; + } + + //edt_learning edt_story edt_CurrentSituation + // Boolean bpmplaceofimplementation=true,bpm_challengefaced=true,bpm_learnings=true,bpm_story=true; + + if(edt_learning.getText().toString().trim().length()<20){ + edt_learning.setError("Minimum 20 characters"); + edt_learning.requestFocus(); + bpm_learnings=false; + } + + + + if(edt_story.getText().toString().trim().length()<10){ + edt_story.setError("Minimum 10 characters"); + edt_story.requestFocus(); + bpm_story=false; + } + + if(edt_CurrentSituation.getText().toString().trim().length()<3){ + edt_CurrentSituation.setError("Minimum 3 characters"); + edt_CurrentSituation.requestFocus(); + bpm_currentsituation=false; + } + + + + + if(edt_resources.getText().toString().trim().length()<5) + { + edt_resources.setError("Minimum 5 character"); + edt_resources.requestFocus(); + bpm_resources=false; + } + + + if(str_resource_amount.isEmpty()){ + + resourcesUtilised_amount_pm_et.setError("Enter the Amount"); + resourcesUtilised_amount_pm_et.requestFocus(); + bpmresource_amount1= false; + } + + if(resourcesUtilised_amount_pm_et.getText().toString().trim().length()==0){ + + resourcesUtilised_amount_pm_et.setError("Enter the Amount"); + resourcesUtilised_amount_pm_et.requestFocus(); + bpmresource_amount2= false; + } + + /* if(str_resource_amount.equalsIgnoreCase("0")) + { + resourcesUtilised_amount_pm_et.setError("Enter the Amount"); + resourcesUtilised_amount_pm_et.requestFocus(); + bpmresource_amount3= false; + } +*/ + + if(pmcomplition_sdgs_display_tv.getText().toString().trim().length()==0) + { + /*pmcomplition_sdgs_display_tv.setError("Select the goals"); + pmcomplition_sdgs_display_tv.requestFocus();*/ + Toast.makeText(getApplicationContext(),"Select the goals",Toast.LENGTH_SHORT).show(); + bpm_sdgsgoals=false; + + } + + if(str_impactproject.equals("1")) + { + if(impactproject_collabaration_cb.isChecked()) + { + if(impactproject_collabaration_et.getText().toString().trim().length()==0) + { + impactproject_collabaration_et.setError("Enter collabaration"); + impactproject_collabaration_et.requestFocus(); + bpm_impactproject_collabaration=false; + } + if(impactproject_collabaration_et.getText().toString().trim().length()<19) + { + impactproject_collabaration_et.setError("Minimum 20 character"); + impactproject_collabaration_et.requestFocus(); + bpm_impactproject_collabaration=false; + } + } + + + if(impactproject_againtstide_cb.isChecked()) + { + if(impactproject_againtstide_et.getText().toString().trim().length()==0) + { + impactproject_againtstide_et.setError("Empty not allowed"); + impactproject_againtstide_et.requestFocus(); + bpm_impactproject_againtstide=false; + } + if(impactproject_againtstide_et.getText().toString().trim().length()<19) + { + impactproject_againtstide_et.setError("Minimum 20 character"); + impactproject_againtstide_et.requestFocus(); + bpm_impactproject_againtstide=false; + } + } + + + if(impactproject_crosshurdles_cb.isChecked()) + { + if(impactproject_crosshurdles_et.getText().toString().trim().length()==0) + { + impactproject_crosshurdles_et.setError("Empty not allowed"); + impactproject_crosshurdles_et.requestFocus(); + bpm_impactproject_crosshurdles=false; + } + if(impactproject_crosshurdles_et.getText().toString().trim().length()<19) + { + impactproject_crosshurdles_et.setError("Minimum 20 character"); + impactproject_crosshurdles_et.requestFocus(); + bpm_impactproject_crosshurdles=false; + } + } + + + + + + if(impactproject_venture_cb.isChecked()) + { + if(impactproject_venture_et.getText().toString().trim().length()==0) + { + impactproject_venture_et.setError("Empty not allowed"); + impactproject_venture_et.requestFocus(); + bpm_impactproject_venture=false; + } + if(impactproject_venture_et.getText().toString().trim().length()<19) + { + impactproject_venture_et.setError("Minimum 20 character"); + impactproject_venture_et.requestFocus(); + bpm_impactproject_venture=false; + } + } + + + + + + if(impactproject_governaward_cb.isChecked()) + { + if(impactproject_governaward_et.getText().toString().trim().length()==0) + { + impactproject_governaward_et.setError("Empty not allowed"); + impactproject_governaward_et.requestFocus(); + bpm_impactproject_governaward=false; + } + if(impactproject_governaward_et.getText().toString().trim().length()<19) + { + impactproject_governaward_et.setError("Minimum 20 character"); + impactproject_governaward_et.requestFocus(); + bpm_impactproject_governaward=false; + } + } + + + + + if(impactproject_leadershiprole_cb.isChecked()) + { + if(impactproject_leadershiprole_et.getText().toString().trim().length()==0) + { + impactproject_leadershiprole_et.setError("Empty not allowed"); + impactproject_leadershiprole_et.requestFocus(); + bpm_impactproject_leadershiprole=false; + } + if(impactproject_leadershiprole_et.getText().toString().trim().length()<19) + { + impactproject_leadershiprole_et.setError("Minimum 20 character"); + impactproject_leadershiprole_et.requestFocus(); + bpm_impactproject_leadershiprole=false; + } + } + + + + if(permissionactivities_et.getText().toString().trim().length()==0) + { + permissionactivities_et.setError("Empty not allowed"); + permissionactivities_et.requestFocus(); + return false; + } + if(permissionactivities_et.getText().toString().trim().length()<100) + { + permissionactivities_et.setError("Minimum 100 character"); + permissionactivities_et.requestFocus(); + return false; + } + + + + if(exp_initiative_et.getText().toString().trim().length()==0) + { + exp_initiative_et.setError("Empty not allowed"); + exp_initiative_et.requestFocus(); + return false; + } + if(exp_initiative_et.getText().toString().trim().length()<19) + { + exp_initiative_et.setError("Minimum 20 character"); + exp_initiative_et.requestFocus(); + return false; + } + + + if(lacking_initiative_et.getText().toString().trim().length()==0) + { + lacking_initiative_et.setError("Empty not allowed"); + lacking_initiative_et.requestFocus(); + return false; + } + if(lacking_initiative_et.getText().toString().trim().length()<19) + { + lacking_initiative_et.setError("Minimum 20 character"); + lacking_initiative_et.requestFocus(); + return false; + } + + + } + + if(str_studLevel.equals("x")||spin_studLevel.getSelectedItem().toString().equals("Select")) + { //Toast.makeText(getApplicationContext(),"select the state",Toast.LENGTH_SHORT).show(); + // ((TextView)spin_state.getSelectedView()).setError("Error message"); + spin_error_TV.setVisibility(View.VISIBLE); + spin_error_TV.setError("Select Student level"); + blevel=false; + } + + if( edt_pmcomment.getText().toString().length() == 0 ){ + edt_pmcomment.setError( "Manager comments required!" );bpmcomments=false;} + + + + innovaion_ratingbar_rb=(RatingBar)findViewById(R.id.innovaion_ratingbar_rb); + leadership_ratingbar_rb= (RatingBar)findViewById(R.id.leadership_ratingbar_rb); + risktaken_ratingbar_rb= (RatingBar)findViewById(R.id.risktaken_ratingbar_rb); + impact_ratingbar_rb= (RatingBar)findViewById(R.id.impact_ratingbar_rb); + fundraised_ratingbar_rb=(RatingBar)findViewById(R.id.fundraised_ratingbar_rb); + + + + if(innovaion_ratingbar_rb.getRating()==0.0 + ||leadership_ratingbar_rb.getRating()==0.0 + ||risktaken_ratingbar_rb.getRating()==0.0 + ||impact_ratingbar_rb.getRating()==0.0 + ||fundraised_ratingbar_rb.getRating()==0.0 + ||final_ratingbar_rb.getRating()==0.0) + { + Toast.makeText(context,"Rating is mandatory",Toast.LENGTH_LONG).show(); + bamount=false;} + + + if(pmcomplition_sdgs_display_tv.getText().toString().trim().length()==0) + { + pmcomplition_sdgs_display_tv.setError("Select the goals"); + pmcomplition_sdgs_display_tv.requestFocus(); + bsdgs_goals= false; + } + + + /* if( final_ratingbar_rb.getRating()==0.0){ + Toast.makeText(context,"Rating is mandatory",Toast.LENGTH_LONG).show();bamount=false;} +*/ + + + + + if(bpmcomments&&bamount&&blevel&&bsdgs_goals&& bpmresource_amount1&&bpmresource_amount2&&bpmresource_amount3 + &&bpmplaceofimplementation&&bpm_challengefaced&&bpm_learnings&&bpm_story&&bpm_currentsituation&&bpm_sdgsgoals + &&bpm_impactproject_collabaration&&bpm_impactproject_againtstide&&bpm_impactproject_crosshurdles&&bpm_impactproject_venture&&bpm_impactproject_governaward + &&bpm_impactproject_leadershiprole&&bpm_resources) { + return true; + }else{return false;} + + } + + + + + + public class SubmitCompletionProject extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + private ProgressBar progressBar; + + // private ProgressDialog progressDialog; + + SubmitCompletionProject (Context ctx){ + context = ctx; + // progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapPrimitive response = submitCompletionProject(); + + //Log.d("Soap response is",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); + + /*progressDialog.setMessage("Submitting"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show();*/ + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + //Toast.makeText(context,result.toString(),Toast.LENGTH_LONG).show(); + if(result!=null) { + if (result.toString().equals("Error")) { + Toast.makeText(getApplicationContext(), "Error occured while saving to database", Toast.LENGTH_LONG).show(); + } else + { + + if(result.toString().trim().equalsIgnoreCase("Project Updated Successfully")|| + result.toString().trim().equalsIgnoreCase("Success")|| result.toString().trim().equalsIgnoreCase("Success.") ) { + Toast.makeText(getApplicationContext(), "Project Updated Successfully", Toast.LENGTH_LONG).show(); + finish(); + Intent ittEditProjToProjStatus = new Intent(PMComplitionProjectActivity.this, PMProjectDetailActivity.class); + ittEditProjToProjStatus.putExtra("pageCount", 2); + startActivity(ittEditProjToProjStatus); + }else + { + Toast.makeText(getApplicationContext(), "Error:"+result.toString(), Toast.LENGTH_LONG).show(); + } + + } + } + progressBar.setVisibility(GONE); + // progressDialog.dismiss(); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapPrimitive submitCompletionProject() + { + String METHOD_NAME = "UpdateComplitedprojectDetails1"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/UpdateComplitedprojectDetails1"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + Log.d("Insidexxxxx","submitCompletionProject"); + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + request.addProperty("Lead_Id",LeadId); + int projId = Integer.valueOf(getIntent().getStringExtra("PDId")); + int PDid=Integer.valueOf(PDId); + Log.d("ProjectId", String.valueOf(projId)); + request.addProperty("PDId",PDid); + request.addProperty("ProjectStatus","Completed"); + + + String str_placeOfImpl = edt_placeofimplementation.getText().toString(); + String str_fundRaised = edt_fundraised.getText().toString(); + String str_Challanges = edt_challenges.getText().toString(); + String str_learning = edt_learning.getText().toString(); + String str_story = edt_story.getText().toString(); + String str_CurrentSituation = edt_CurrentSituation.getText().toString(); + String str_Resource = edt_resources.getText().toString(); + String str_HoursSpend = edt_HoursSpend.getText().toString(); + String str_resource_amount=resourcesUtilised_amount_pm_et.getText().toString(); + + int int_innovationrating=(int) innovaion_ratingbar_rb.getRating(); + int int_leadershiprating=(int)leadership_ratingbar_rb.getRating();// + int int_risktakenrating=(int)risktaken_ratingbar_rb.getRating(); + int int_impactrating=(int)impact_ratingbar_rb.getRating(); + int int_fundraisedrating= (int)fundraised_ratingbar_rb.getRating(); + + // Double double_finalrating = Double.valueOf(final_ratingbar_rb.getRating()); + + String str_managerComments = edt_pmcomment.getText().toString(); + + if(!str_placeOfImpl.isEmpty() && !str_placeOfImpl.equals("") && !str_placeOfImpl.equals(null)) { + + request.addProperty("Placeofimplement", str_placeOfImpl); + Log.d("Placeofimplement", str_placeOfImpl); + } + else{ + request.addProperty("Placeofimplement", ""); + } + if(!str_fundRaised.isEmpty() && !str_fundRaised.equals("") && !str_fundRaised.equals(null)) { + request.addProperty("FundsRaised", Integer.valueOf(str_fundRaised)); + Log.d("FundsRaised", str_fundRaised); + }else{ + request.addProperty("FundsRaised", ""); + } + if(!str_Challanges.isEmpty() && !str_Challanges.equals("") && !str_Challanges.equals(null)){ + request.addProperty("Challenge",str_Challanges); + Log.d("Challenge", str_Challanges); + }else{ + request.addProperty("Challenge",""); + } + + if(!str_learning.isEmpty() && !str_learning.equals("") && !str_learning.equals(null)){ + request.addProperty("Learning",str_learning); + Log.d("Learning", str_learning); + }else{ + request.addProperty("Learning",""); + } + + if(!str_story.isEmpty() && !str_story.equals("") && !str_story.equals(null)){ + request.addProperty("AsAStory",str_story); + Log.d("AsAStory", str_story); + }else{ + request.addProperty("AsAStory",""); + } + +//-----------------added by madhu 17/9/18 + if(!str_CurrentSituation.isEmpty() && !str_CurrentSituation.equals("") && !str_CurrentSituation.equals(null)){ + request.addProperty("CurrentSituation",str_CurrentSituation); + Log.d("CurrentSituation", str_CurrentSituation); + }else{ + request.addProperty("CurrentSituation",""); + } + + if(!str_Resource.isEmpty() && !str_Resource.equals("") && !str_Resource.equals(null)){ + request.addProperty("Resource",str_Resource); + Log.d("Resource", str_Resource); + }else{ + request.addProperty("Resource",""); + } + + + + if(!str_resource_amount.isEmpty() && !str_resource_amount.equals("") && !str_resource_amount.equals(null)) + { + // int int_resourse_amt= Integer.parseInt(str_resource_amount); + + + long long_resoursce_amount= Long.parseLong(str_resource_amount); + request.addProperty("ResourceAmount",long_resoursce_amount);//long + Log.d("str_resourceamount", str_resource_amount); + }else{ + request.addProperty("ResourceAmount",0);//long + } + + + if(!str_HoursSpend.isEmpty() && !str_HoursSpend.equals("") && !str_HoursSpend.equals(null)){ + request.addProperty("HoursSpend",str_HoursSpend); + Log.d("str_HoursSpend", str_HoursSpend); + }else{ + request.addProperty("HoursSpend",""); + } + + if(!str_studLevel.isEmpty() && !str_studLevel.equals("") && !str_studLevel.equals(null)){ + request.addProperty("Level",str_studLevel); + Log.d("str_studLevel", str_studLevel); + }else{ + request.addProperty("Level",str_studLevel); + } +//---------- + /* if(int_finalrating!=0){ + request.addProperty("Rating",int_finalrating); + Log.d("Rating", String.valueOf(int_finalrating)); + }else{ + request.addProperty("Rating",0); + }*/ + + // request.addProperty("Rating",double_finalrating); + + String str_finalratingbar= String.valueOf(final_ratingbar_rb.getRating()); + request.addProperty("Rating",str_finalratingbar); + + + if(!str_managerComments.isEmpty() && !str_managerComments.equals("") && !str_managerComments.equals(null)){ + request.addProperty("ManagerComments",str_managerComments); + Log.d("ManagerComments", str_managerComments); + }else{ + request.addProperty("ManagerComments",""); + } + + + request.addProperty("InnovationRating",int_innovationrating);///int + request.addProperty("LeadershipRating",int_leadershiprating);///int + request.addProperty("RiskTakenRating",int_risktakenrating);///< int + request.addProperty("ImpactRating",int_impactrating);///int + request.addProperty("FundRaisedRating",int_fundraisedrating);///int + + + + + request.addProperty("SDG_Goal",goals_jsonobject.toString());// string + + + + request.addProperty("Collaboration_Supported",impactproject_collabaration_et.getText().toString());// string + request.addProperty("Permission_And_Activities",permissionactivities_et.getText().toString());//string + request.addProperty("Experience_Of_Initiative",exp_initiative_et.getText().toString());//string + request.addProperty("Lacking_initiative",lacking_initiative_et.getText().toString());//string + request.addProperty("Against_Tide",impactproject_againtstide_et.getText().toString());//string + request.addProperty("Cross_Hurdles",impactproject_crosshurdles_et.getText().toString());//string + request.addProperty("Entrepreneurial_Venture",impactproject_venture_et.getText().toString());//string + request.addProperty("Government_Awarded",impactproject_governaward_et.getText().toString());//string + request.addProperty("Leadership_Roles",impactproject_leadershiprole_et.getText().toString());//string + + + + + + + + + Log.e("request",request.toString()); + + + //users.ad + //request.add + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + Log.d("soapresponse1xxxx",envelope.getResponse().toString()); + + //Log.d("Requestsssss",request.toString()); + + + //SoapObject response = (SoapObject) envelope.getResponse(); + + //return null; + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + Log.e("submitResponse",response.toString()); + return response; + + } + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + + } + + public class SubmitRejectDetails extends AsyncTask { + + AlertDialog alertDialog; + private ProgressBar progressBar; + + SubmitRejectDetails (Context ctx){ + context = ctx; + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapPrimitive response = RejectProjectDetails(); + + // SoapObject response = ReApplyProjectDetails(); + //Log.d("Soap response issssss",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + if(result.toString().equals("Error")){ + Toast.makeText(PMComplitionProjectActivity.this,"Error occured while saving to database",Toast.LENGTH_LONG).show(); + } + else{ + Toast.makeText(PMComplitionProjectActivity.this,"Project Rejected Successfully",Toast.LENGTH_LONG).show(); + finish(); + /*Intent ittEditProjToProjStatus = new Intent(PMUnapproved_DetailsActivity.this,PMProjectDetailActivity.class); + ittEditProjToProjStatus.putExtra("pageCount",0); + startActivity(ittEditProjToProjStatus);*/ + } + progressBar.setVisibility(View.GONE); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + private SoapPrimitive RejectProjectDetails() { + String METHOD_NAME = "ManagerRejectProject"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/ManagerRejectProject"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + // long projectIds = (long) Integer.valueOf(projectId); + // request.addProperty("PDId",Project_Id); + int projId = Integer.valueOf(getIntent().getStringExtra("PDId")); + int PDid=Integer.valueOf(PDId); + Log.d("ProjectId", String.valueOf(projId)); + request.addProperty("PDId",PDid); + Log.d("PDIdssssssxxxx","hi"); + // Log.d("PDIdssssssxxxx", String.valueOf(projectId)); + // request.addProperty("ProjectStatus","Rejected"); + Log.d("actionplansxxxxxx",edt_pmcomment.getText().toString()); + request.addProperty("ManagerComments",edt_pmcomment.getText().toString()); + Log.d("Requestisxxxxx",request.toString()); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + // Log.d("soap response1xxxx",envelope.getResponse().toString()); + + // SoapObject response = (SoapObject) envelope.getResponse(); + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + //Log.e("soapupdateProjectDtlsss",envelope.getResponse().toString()); + + //return null; + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + } + return null; + + } + + private void getProjectCompletionDtls() { + GetProjCompletionDtls getProjCompDtls = new GetProjCompletionDtls(mContext); + getProjCompDtls.execute(); + } + + public class GetProjCompletionDtls extends AsyncTask { + + AlertDialog alertDialog; + private ProgressBar progressBar; + // private ProgressDialog progressDialog; + + GetProjCompletionDtls (Context ctx){ + context = ctx; + // progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapObject response = getCompletionProjectDtls(); + + Log.d("Soap response issssss",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); + + /*progressDialog.setMessage("Loading"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show();*/ + + } + + @Override + protected void onPostExecute(SoapObject result) { + + if(result!=null){ + SoapPrimitive S_Status; + Object O_Status; + String str_status = null; + + + O_Status = result.getProperty("Status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) result.getProperty("Status"); + Log.d("Title", S_Status.toString()); + str_status = O_Status.toString(); + } + + if (!str_status.equals("Success")) { + Toast.makeText(context, str_status, Toast.LENGTH_LONG).show(); + LinearLayout mainLayout = (LinearLayout) findViewById(R.id.LinearLayout02); + mainLayout.setVisibility(GONE); + } else { + SoapPrimitive S_ProjectName, S_ProjectType, S_PlaceOfImpl, S_Objectives, S_FundRaised, S_ApprovedAmount, S_FundReceived, S_Challenges, S_Learning, S_Story, S_CurrentSituation, S_Resource,S_HoursSpend,S_resource_amount; + Object O_ProjectName, O_ProjectType, O_PlaceOfImpl, O_Objectives, O_FundRaised, O_ApprovedAmount, O_FundReceived, O_Challanges, O_Learning, O_Story, O_CurrentSituation, O_Resource,O_HoursSpend,O_resource_amount; + + Object O_projectstartdate,O_projectenddate; + String str_ProjectName = null, str_ProjectType = null, str_PlaceOfImpl = null, str_Objectives = null, str_FundRaised = null, str_ApprovedAmount = null, str_FundReceived = null, str_Challanges = null, str_HoursSpend=null,str_Learning = null, str_Story = null, str_CurrentSituation = null, str_Resource = null; + String str_pmstartdate=null,str_pmenddate=null,str_resource_amount=null; + + O_ProjectName = result.getProperty("Title"); + if (!O_ProjectName.toString().equals("anyType{}") && !O_ProjectName.toString().equals(null)) { + S_ProjectName = (SoapPrimitive) result.getProperty("Title"); + Log.d("Title:", S_ProjectName.toString()); + str_ProjectName = S_ProjectName.toString(); + projectname_tv.setText(str_ProjectName); + } + + O_ProjectType = result.getProperty("Theme"); + if (!O_ProjectType.toString().equals("anyType{}") && !O_ProjectType.toString().equals(null)) { + S_ProjectType = (SoapPrimitive) result.getProperty("Theme"); + Log.d("Project Type", S_ProjectType.toString()); + str_ProjectType = S_ProjectType.toString(); + projecttype_tv.setText(str_ProjectType); + } + + /* O_Beneficiaries = result.getProperty("BeneficiaryNo"); + if(!O_Beneficiaries.toString().equals("anyType") && !O_Beneficiaries.toString().equals(null)){ + S_Beneficiaries = (SoapPrimitive) result.getProperty("BeneficiaryNo"); + Log.d("Beneficiaries:",S_Beneficiaries.toString()); + str_Beneficiaries = S_Beneficiaries.toString(); + txt_beneficiaries.setText(str_Beneficiaries); + }*/ + + O_Objectives = result.getProperty("Objectives"); + if (!O_Objectives.toString().equals("anyType{}") && !O_Objectives.toString().equals(null)) { + S_Objectives = (SoapPrimitive) result.getProperty("Objectives"); + Log.d("Objectives:", S_Objectives.toString()); + str_Objectives = S_Objectives.toString(); + projectobjective_tv.setText(str_Objectives); + } + + O_PlaceOfImpl = result.getProperty("Placeofimplement"); + if (!O_PlaceOfImpl.toString().equals("anyType{}") && !O_PlaceOfImpl.toString().equals(null)) { + S_PlaceOfImpl = (SoapPrimitive) result.getProperty("Placeofimplement"); + Log.d("Placeofimplement:", S_PlaceOfImpl.toString()); + str_PlaceOfImpl = S_PlaceOfImpl.toString(); + edt_placeofimplementation.setText(str_PlaceOfImpl); + } + + O_FundRaised = result.getProperty("FundsRaised"); + if (!O_FundRaised.toString().equals("anyType{}") && !O_FundRaised.toString().equals(null)) { + S_FundRaised = (SoapPrimitive) result.getProperty("FundsRaised"); + Log.d("FundsRaised:", S_FundRaised.toString()); + str_FundRaised = S_FundRaised.toString(); + edt_fundraised.setText(str_FundRaised); + } + + O_ApprovedAmount = result.getProperty("SanctionAmount"); + if (!O_ApprovedAmount.toString().equals("anyType{}") && !O_ApprovedAmount.toString().equals(null)) { + S_ApprovedAmount = (SoapPrimitive) result.getProperty("SanctionAmount"); + Log.d("SanctionAmount:", S_ApprovedAmount.toString()); + str_ApprovedAmount = S_ApprovedAmount.toString(); + approvedamt_tv.setText(str_ApprovedAmount); + } + + O_FundReceived = result.getProperty("Fund_Received"); + if (!O_FundReceived.toString().equals("anyType{}") && !O_FundReceived.toString().equals(null)) { + S_FundReceived = (SoapPrimitive) result.getProperty("Fund_Received"); + Log.d("Fund_Received:", S_FundReceived.toString()); + str_FundReceived = S_FundReceived.toString(); + leadfund_tv.setText(str_FundReceived); + } + + O_Challanges = result.getProperty("Challenge"); + if (!O_Challanges.toString().equals("anyType{}") && !O_Challanges.toString().equals(null)) { + S_Challenges = (SoapPrimitive) result.getProperty("Challenge"); + Log.d("Challenge:", S_Challenges.toString()); + str_Challanges = S_Challenges.toString(); + edt_challenges.setText(str_Challanges); + } + + + O_Learning = result.getProperty("Learning"); + if (!O_Learning.toString().equals("anyType{}") && !O_Learning.toString().equals(null)) { + S_Learning = (SoapPrimitive) result.getProperty("Learning"); + Log.d("Learning:", S_Learning.toString()); + str_Learning = S_Learning.toString(); + edt_learning.setText(str_Learning); + } + + O_Story = result.getProperty("AsAStory"); + if (!O_Story.toString().equals("anyType{}") && !O_Story.toString().equals(null)) { + S_Story = (SoapPrimitive) result.getProperty("AsAStory"); + Log.d("AsAStory:", S_Story.toString()); + str_Story = S_Story.toString(); + edt_story.setText(str_Story); + } + + //-----------------added by madhu 17/9/18 + O_CurrentSituation = result.getProperty("CurrentSituation"); + if (!O_CurrentSituation.toString().equals("anyType{}") && !O_CurrentSituation.toString().equals(null)) { + S_CurrentSituation = (SoapPrimitive) result.getProperty("CurrentSituation"); + Log.d("CurrentSituation:", S_CurrentSituation.toString()); + str_CurrentSituation = S_CurrentSituation.toString(); + edt_CurrentSituation.setText(str_CurrentSituation); + } + + O_Resource = result.getProperty("Resource"); + if (!O_Resource.toString().equals("anyType{}") && !O_Resource.toString().equals(null)) { + S_Resource = (SoapPrimitive) result.getProperty("Resource"); + Log.d("CurrentSituation:", S_Resource.toString()); + str_Resource = S_Resource.toString(); + edt_resources.setText(str_Resource); + } + //---------------------------- + //-----------------added by madhu 03/07/19------- + O_HoursSpend = result.getProperty("HoursSpend"); + if (!O_HoursSpend.toString().equals("anyType{}") && !O_HoursSpend.toString().equals(null)) + { + S_HoursSpend = (SoapPrimitive) result.getProperty("HoursSpend"); + Log.d("HoursSpend:", S_HoursSpend.toString()); + str_HoursSpend = S_HoursSpend.toString(); + edt_HoursSpend.setText(str_HoursSpend); + } + + + O_resource_amount=result.getProperty("TotalResourses");//0 + if (!O_resource_amount.toString().equals("anyType{}") && !O_resource_amount.toString().equals(null)) + { + S_resource_amount= (SoapPrimitive) result.getProperty("TotalResourses"); + str_resource_amount=S_resource_amount.toString(); + resourcesUtilised_amount_pm_et.setText(str_resource_amount); + } + +//pmcomp_clickstartproject_editdate_tv + + + + O_projectstartdate= result.getProperty("ProjectStartDate");//0000-00-00 + if(O_projectstartdate.toString().equals("anyType{}") + || O_projectstartdate.toString().equals(null) + ||O_projectstartdate.toString().equals("0000-00-00")) + { + calendarlabel_linearlayout.setVisibility(View.GONE); + calendar_linearlayout.setVisibility(View.GONE); + str_pmstartdate=O_projectstartdate.toString(); + + } + else{ + + SoapPrimitive S_projectstartdate=(SoapPrimitive) result.getProperty("ProjectStartDate"); + String str_projectstartdate=S_projectstartdate.toString(); + str_pmstartdate=S_projectstartdate.toString(); + pmcomp_clickstartproject_editdate_tv.setText(str_projectstartdate); + + } + + + + O_projectenddate= result.getProperty("ProjectEndDate");//0000-00-00 + + if(O_projectenddate.toString().equals("anyType{}") + ||O_projectenddate.toString().equals(null) + ||O_projectenddate.toString().equals("0000-00-00")) + { + str_pmenddate=O_projectenddate.toString(); + calendarlabel_linearlayout.setVisibility(View.GONE); + calendar_linearlayout.setVisibility(View.GONE); + + } + else{ + + SoapPrimitive S_projectenddate=(SoapPrimitive) result.getProperty("ProjectEndDate"); + String str_projectenddate=S_projectenddate.toString(); + str_pmenddate=S_projectenddate.toString(); + pmcomp_clickendproject_editdate_tv.setText(str_projectenddate); + } + + + + if( + str_pmstartdate.toString().equals(null) + || str_pmstartdate.toString().equals("anyType{}") + ||str_pmstartdate.toString().equals("0000-00-00") + ||str_pmstartdate.toString().equalsIgnoreCase("Click for Calendar") + ||str_pmenddate.toString().equals(null) + ||str_pmenddate.toString().equals("anyType{}") + ||str_pmenddate.toString().equals("0000-00-00") + ||str_pmenddate.toString().equalsIgnoreCase("Click for Calendar")) + { + calendarlabel_linearlayout.setVisibility(View.GONE); + calendar_linearlayout.setVisibility(View.GONE); + pmcomplition_studentdays_linearlayout.setVisibility(View.GONE); + + }else + { + + + try{ + int days_count = Days.daysBetween(new LocalDate(str_pmstartdate), new LocalDate(str_pmenddate)).getDays(); + int int_days=days_count+1; + Log.e("days",String.valueOf(int_days)); + pmcomplition_numberofdays_tv.setText("Number of Days: "+String.valueOf(int_days)); + }catch(Throwable t) + { + pmcomplition_numberofdays_tv.setText(" "); + } + } + + + + + if (result.toString().contains("SDG_Status"))//No Goals + { + + goals_jsonobject = new JSONObject(); + try { + goals_jsonobject.put("", ""); + } catch (JSONException e) { + e.printStackTrace(); + } + str_sdgs_goals_resp=""; + pmcomplition_sdgs_display_tv.setText(str_sdgs_goals_resp); + } else + { + + + + + SoapObject sdgsList = (SoapObject) result.getProperty("SDG_List"); + Object O_goalsln; + SoapPrimitive primitive_slno; + String str_slno = null; + arraylist_goalsln.clear(); + + for (int i = 0; i < sdgsList.getPropertyCount(); i++) { + SoapObject goal_sln = (SoapObject) sdgsList.getProperty(i); + + O_goalsln = goal_sln.getProperty("Slno"); + + { + primitive_slno = (SoapPrimitive) goal_sln.getProperty("Slno");//Slno + Log.e("goalslnname", primitive_slno.toString()); + str_slno = primitive_slno.toString(); + + arraylist_goalsln.add(str_slno); + } + + } + + arraylist_goalsln_forcheckbox=arraylist_goalsln; + set_sdgs_display_tv(); + + } + + + + str_collaboration_resp = result.getProperty("Collaboration_Supported").toString();// + str_permissionactivities_resp = result.getProperty("Permission_And_Activities").toString();// + str_exp_initiative_resp = result.getProperty("Experience_Of_Initiative").toString();// + str_lacking_initiative_resp = result.getProperty("Lacking_initiative").toString();// + str_againtstide_resp = result.getProperty("Against_Tide").toString();// + str_cross_hurdles_resp = result.getProperty("Cross_Hurdles").toString();// + str_venture_resp = result.getProperty("Entrepreneurial_Venture").toString();// + str_govern_award_resp = result.getProperty("Government_Awarded").toString();// + str_leadership_role_resp = result.getProperty("Leadership_Roles").toString();// + + + if(str_collaboration_resp.equals("anyType{}")) + { + impactproject_collabaration_et.setText(""); + impactproject_collabaration_cb.setChecked(false); + impactproject_collabaration_et.setVisibility(View.GONE); + }else + { impactproject_collabaration_et.setText(str_collaboration_resp.toString()); + if(str_collaboration_resp.trim().length()>0) + { impactproject_collabaration_cb.setChecked(true); + impactproject_collabaration_et.setVisibility(View.VISIBLE); + } + else{impactproject_collabaration_cb.setChecked(false); + impactproject_collabaration_et.setVisibility(View.GONE); + } + } + + + if(str_permissionactivities_resp.equals("anyType{}")) + { + permissionactivities_et.setText(""); + + }else + { permissionactivities_et.setText(str_permissionactivities_resp.toString()); + + } + + if(str_exp_initiative_resp.equals("anyType{}")) + { + exp_initiative_et.setText(""); + }else + { exp_initiative_et.setText(str_exp_initiative_resp.toString());} + + + + + + + if(str_lacking_initiative_resp.equals("anyType{}")) + { + lacking_initiative_et.setText(""); + }else + { lacking_initiative_et.setText(str_lacking_initiative_resp.toString());} + + + if(str_againtstide_resp.equals("anyType{}")) + { + impactproject_againtstide_et.setText(""); + impactproject_againtstide_cb.setChecked(false); + impactproject_againtstide_et.setVisibility(View.GONE); + }else + { impactproject_againtstide_et.setText(str_againtstide_resp.toString()); + if(str_againtstide_resp.toString().trim().length()>0) + { impactproject_againtstide_cb.setChecked(true); } + else{impactproject_againtstide_cb.setChecked(false); + impactproject_againtstide_et.setVisibility(View.GONE);} + + } + + if(str_cross_hurdles_resp.equals("anyType{}")) + { + impactproject_crosshurdles_et.setText(""); + impactproject_crosshurdles_cb.setChecked(false); + impactproject_crosshurdles_et.setVisibility(View.GONE); + + }else + { impactproject_crosshurdles_et.setText(str_cross_hurdles_resp.toString()); + if(str_cross_hurdles_resp.toString().trim().length()>0) + { impactproject_crosshurdles_cb.setChecked(true); } + else{impactproject_crosshurdles_cb.setChecked(false); + impactproject_crosshurdles_et.setVisibility(View.GONE); + } + // + } + + + + + if(str_venture_resp.equals("anyType{}")) + { + impactproject_venture_et.setText(""); + impactproject_venture_cb.setChecked(false); + impactproject_venture_et.setVisibility(View.GONE); + }else + { impactproject_venture_et.setText(str_venture_resp.toString()); + if(str_venture_resp.toString().length()>0) + { impactproject_venture_cb.setChecked(true); } + else{impactproject_venture_cb.setChecked(false); + impactproject_venture_et.setVisibility(View.GONE); + } + + } + + if(str_govern_award_resp.equals("anyType{}")) + { + impactproject_governaward_et.setText(""); + impactproject_governaward_cb.setChecked(false); + impactproject_governaward_et.setVisibility(View.GONE); + }else + { impactproject_governaward_et.setText(str_govern_award_resp.toString()); + if(str_govern_award_resp.trim().length()>0) + { + impactproject_governaward_cb.setChecked(true); + }else{ + impactproject_governaward_cb.setChecked(false); + impactproject_governaward_et.setVisibility(View.GONE); + } + } + + if(str_leadership_role_resp.equals("anyType{}")) + { + impactproject_leadershiprole_et.setText(""); + impactproject_leadershiprole_cb.setChecked(false); + impactproject_leadershiprole_et.setVisibility(View.GONE); + + }else + { impactproject_leadershiprole_et.setText(str_leadership_role_resp.toString()); + if(str_leadership_role_resp.trim().length()>0) + { impactproject_leadershiprole_cb.setChecked(true);} + else{ + impactproject_leadershiprole_cb.setChecked(false); + impactproject_leadershiprole_et.setVisibility(View.GONE); + } + + // + } + + + + + + +// add impact + + + + + /*if(str_startdate.toString().equals("anyType{}") + || str_startdate.toString().equals(null) + ||str_startdate.toString().equals("0000-00-00") + ||str_startdate.toString().equalsIgnoreCase("Click for Calendar") + ||str_enddate.toString().equals("anyType{}") + ||str_enddate.toString().equals(null) + ||str_enddate.toString().equals("0000-00-00") + ||str_enddate.toString().equalsIgnoreCase("Click for Calendar")) + { + editstudentdays_linearlayout.setVisibility(View.GONE); + editproject_date_linearlayout.setVisibility(View.GONE); + editproject_datelabel_linearlayout.setVisibility(View.GONE); + + + }else + { + + + try{ + int days_count = Days.daysBetween(new LocalDate(str_startdate), new LocalDate(str_enddate)).getDays(); + int int_days=days_count+1; + Log.e("days",String.valueOf(int_days)); + editstudent_numberofdays_tv.setText("Number of Days: "+String.valueOf(int_days)); + }catch(Throwable t) + { + editstudent_numberofdays_tv.setText(" "); + } + } + + +*/ + + + + + + //----------------------------------- + + + /* O_FundReceived = result.getProperty("Fund_Received"); + if(!O_FundReceived.toString().equals("anyType") && !O_FundReceived.toString().equals(null)){ + S_ApprovedAmount = (SoapPrimitive) result.getProperty("Fund_Received"); + Log.d("Approved Amount:",S_ApprovedAmount.toString()); + str_ApprovedAmount = S_ApprovedAmount.toString(); + approvedamt_tv.setText(str_ApprovedAmount); + }*/ + + SoapObject soapObj = (SoapObject) result.getProperty("docs"); + + if (!soapObj.toString().equals("anyType{}") && !soapObj.toString().equals(null)) { + + SoapPrimitive S_DocumentPath; + Object O_DocumentPath; + String str_DocumentPath, str_actualdocPath; + //count2 = soapObj.getPropertyCount(); + + for (count1 = 0; count1 < soapObj.getPropertyCount(); count1++) { + SoapObject doclist = (SoapObject) soapObj.getProperty(count1); + Log.d("doclist", doclist.toString()); + + O_DocumentPath = doclist.getProperty("Document_Path"); + if (!O_DocumentPath.toString().equals("anyType{}") && !O_DocumentPath.toString().equals(null)) { + S_DocumentPath = (SoapPrimitive) doclist.getProperty("Document_Path"); + str_DocumentPath = S_DocumentPath.toString(); + + + //Log.d("F") + + str_actualdocPath = serverPath + str_DocumentPath.substring(2); + //Log.d("Documentsssssss",str_actualdocPath); + + + // if(str_actualdocPath.endsWith("jpg") || str_actualdocPath.endsWith("jpeg") || str_actualdocPath.endsWith("png")){ + + if (str_actualdocPath.endsWith("jpg") || str_actualdocPath.endsWith("jpeg") || str_actualdocPath.endsWith("png") || str_actualdocPath.endsWith("gif") || str_actualdocPath.endsWith("psd")) { + count2++; + + str_actualdocPath = str_actualdocPath.replace(" ", "%20"); + //Log.d("str_actualdocPath", str_actualdocPath); + + //if(!str_actualdocPath.contains("(1)")) { + try { + url = new URL(str_actualdocPath); + urllist.add(url); + Log.d("Urlsssss", url.toString()); + } catch (MalformedURLException e) { + e.printStackTrace(); + } + + imagePathList.add(str_actualdocPath); +/* + LoadGalleryImage loadGalleryImg = new LoadGalleryImage(context); + loadGalleryImg.execute();*/ + } + + if (str_actualdocPath.endsWith("docx") || str_actualdocPath.endsWith("doc") || str_actualdocPath.endsWith("pdf")) { + wordDocPath = str_actualdocPath; + wordDocPath = wordDocPath.replace(" ", "%20"); + + Log.d("wordDocPath", wordDocPath); + Log.d("downloadUrl", String.valueOf(downloadUrl)); + String[] docNameArray = wordDocPath.split("/"); + docName = docNameArray[4]; + Log.d("doclengthisss", String.valueOf(docNameArray.length)); + Log.d("Docnameesssss", docName); + + + try { + downloadUrl = new URL(wordDocPath); + } catch (MalformedURLException e) { + e.printStackTrace(); + } + /* LoadDocument loadDocument = new LoadDocument(context); + loadDocument.execute();*/ + } + + } + } + + + LoadGalleryImage loadGalleryImg = new LoadGalleryImage(context); + loadGalleryImg.execute(); + + + + + + /* Log.d("bitmapsssssssizes", String.valueOf(bitmapList.size())); + if(bitmapList.size()>0){ + img_mainGallery.setImageBitmap(bitmapList.get(0)); + txt_numOfImages.setText("Images: "+bitmapList.size()); + }else{ + txt_numOfImages.setText("No images to show"); + }*/ + } + + } + + + //progressBar.setVisibility(GONE); + + //progressDialog.dismiss(); + } + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + public class LoadDocument extends AsyncTask { + // private ProgressDialog progressDialog; + private Context context; + + private ProgressBar progressBar; + + private String downloadFileName = ""; + private static final String TAG = "Download Task"; + File apkStorage = null; + + + + LoadDocument (Context context){ + this.context = context; + // progressDialog = new ProgressDialog(context); + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); +// progressDialog=new ProgressDialog(context); + + /* progressDialog.setMessage("Downloading..."); + progressDialog.show();*/ + + /* progressDialog.setMessage("Loading"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show();*/ + } + + @Override + protected Void doInBackground(Void... params) { + /* ArrayList bitmapLst=null; + Bitmap bitmaplogo=null; + try { + Log.d("Urlssssssssssss",url.toString()); + bitmaplogo = BitmapFactory.decodeStream(url.openStream()); + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + }*/ + + HttpURLConnection c = null;//Open Url Connection + try { + c = (HttpURLConnection) downloadUrl.openConnection(); + } catch (IOException e) { + e.printStackTrace(); + } + try { + c.setRequestMethod("GET");//Set Request Method to "GET" since we are grtting data + } catch (ProtocolException e) { + e.printStackTrace(); + } + try { + c.connect();//connect the URL Connection + } catch (IOException e) { + e.printStackTrace(); + } + + //If Connection response is not OK then show Logs + try { + if (c.getResponseCode() != HttpURLConnection.HTTP_OK) { + Log.e(TAG, "Server returned HTTP " + c.getResponseCode() + + " " + c.getResponseMessage()); + + } + } catch (IOException e) { + e.printStackTrace(); + } + + + //Get File if SD card is present + if (new CheckForSDCard().isSDCardPresent()) { + + apkStorage = new File( + Environment.getExternalStorageDirectory() + "/" + + "ProjectDocumentFiles"); + } else + Toast.makeText(context, "Oops!! There is no SD Card.", Toast.LENGTH_SHORT).show(); + + //If File is not present create directory + if (!apkStorage.exists()) { + apkStorage.mkdir(); + Log.e(TAG, "Directory Created."); + } + + docName = docName.replace("%20",""); + outputFile = new File(apkStorage, docName);//Create Output file in Main File + + //Create New File if not present + if (!outputFile.exists()) { + try { + outputFile.createNewFile(); + } catch (IOException e) { + e.printStackTrace(); + } + Log.e(TAG, "File Created"); + } + + FileOutputStream fos = null;//Get OutputStream for NewFile Location + try { + fos = new FileOutputStream(outputFile); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + + InputStream is = null;//Get InputStream for connection + try { + is = c.getInputStream(); + } catch (IOException e) { + e.printStackTrace(); + } + + byte[] buffer = new byte[1024];//Set buffer type + int len1 = 0;//init length + try { + while ((len1 = is.read(buffer)) != -1) { + fos.write(buffer, 0, len1);//Write new file + } + } catch (IOException e) { + e.printStackTrace(); + } + + //Close all connection after doing task + try { + fos.close(); + + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + + + + return null; + + //return bitmaplogo; + } + + @Override + protected void onPostExecute(Void string) { + /* bitmapList.add(bitmap); + + Log.d("count1iss", String.valueOf(count1)); + Log.d("count2iss", String.valueOf(count2)); + Log.d("Bitmapsizess", String.valueOf(bitmapList.size())); + if(bitmapList.size()==count2){ + img_mainGallery.setImageBitmap(bitmapList.get(0)); + txt_numOfImages.setText("Images: "+bitmapList.size()); + }*/ + + try { + if (outputFile != null) { + // progressDialog.dismiss(); + progressBar.setVisibility(GONE); + Toast.makeText(context, "Downloaded Successfully", Toast.LENGTH_SHORT).show(); + + try { + //FileOpen.openFile(mContext, myFile); + FileOpen.openFile(mContext, outputFile); + } catch (IOException e) { + e.printStackTrace(); + } + } else { + + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + + } + }, 3000); + + Log.e(TAG, "Download Failed"); + + } + } catch (Exception e) { + e.printStackTrace(); + + //Change button text if exception occurs + + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + + } + }, 3000); + Log.e(TAG, "Download Failed with Exception - " + e.getLocalizedMessage()); + + } + + // progressDialog.dismiss(); + + progressBar.setVisibility(GONE); + } + } + + + + + public class LoadGalleryImage_stud extends AsyncTask { + + private Context context; + private ProgressBar progressBar; + + LoadGalleryImage_stud (Context context){ + this.context = context; + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); + + } + + @Override + protected Bitmap doInBackground(Void... params) { + ArrayList bitmapLst=null; + Bitmap bitmaplogo=null; + + try { + URL url= new URL(PMImgUrl); + Log.d("Urlssssssssssss",url.toString()); + bitmaplogo = BitmapFactory.decodeStream(url.openStream()); + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return bitmaplogo; + } + + @Override + protected void onPostExecute(Bitmap bitmap) { + // bitmapList.add(bitmap); + img_student.setImageBitmap(bitmap); + progressBar.setVisibility(GONE); + } + } + + public class LoadGalleryImage extends AsyncTask> { + + private Context context; + private ProgressBar progressBar; + private ArrayList bitmapList = new ArrayList(); + // private ProgressDialog progressDialog; + + LoadGalleryImage (Context context){ + this.context = context; + // progressDialog = new ProgressDialog(context); + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); +// progressDialog.setMessage("Loading"); +// progressDialog.setCanceledOnTouchOutside(false); +// progressDialog.show(); + + } + + @Override + protected ArrayList doInBackground(Void... params) { + + Bitmap bitmaplogo=null; + + for(int k=0;k bitmap) { + /* bitmapList.add(bitmap); + + Log.d("count1iss", String.valueOf(count1)); + Log.d("count2iss", String.valueOf(count2)); + Log.d("Bitmapsizess", String.valueOf(bitmapList.size())); + if(bitmapList.size()==count2){ + img_mainGallery.setImageBitmap(bitmapList.get(0)); + txt_numOfImages.setText("Images: "+bitmapList.size()); + }*/ + + try { + if (bitmap != null) { + if (bitmap.size() > 0) { + img_mainGallery.setImageBitmap(bitmap.get(0)); + txt_numOfImages.setText("Images: " + bitmap.size()); + } + } + }catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + //} + + + + + progressBar.setVisibility(GONE); + // progressDialog.dismiss(); + } + } + + + + + private SoapObject getCompletionProjectDtls() { + String METHOD_NAME = "GetProjectCompletionDetails"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetProjectCompletionDetails"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + long projId = (long) Integer.valueOf(getIntent().getStringExtra("PDId")); + + int PDid=Integer.valueOf(PDId); + request.addProperty("Lead_Id",LeadId); + request.addProperty("projectId",projId); + + Log.e("tag","Lead_Id:"+LeadId); + Log.e("tag","projectId:"+projId); + /*request.addProperty("leadId","MH00"); + request.addProperty("PDId",mapProjectIdProject.get(selectedProject));*/ + + + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + envelope.setOutputSoapObject(request); + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + SoapObject response = (SoapObject) envelope.getResponse(); + Log.e("soapcompletionxxxx",response.toString()); + return response; + + } + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + + } + + + + private void initializeViews() { + + projectname_tv = (TextView) findViewById(R.id.projectname_tv); + projecttype_tv = (TextView) findViewById(R.id.projecttype_tv); + projectobjective_tv = (TextView) findViewById(R.id.projectobjective_tv); + leadfund_tv = (TextView) findViewById(R.id.leadfund_tv); + approvedamt_tv = (TextView) findViewById(R.id.approvedamt_tv); + + edt_placeofimplementation = (EditText) findViewById(R.id.edt_placeofimplementation); + edt_fundraised = (EditText) findViewById(R.id.edt_fundraised); + edt_challenges = (EditText) findViewById(R.id.edt_challenges); + edt_learning = (EditText) findViewById(R.id.edt_learning); + edt_story = (EditText) findViewById(R.id.edt_story); + edt_pmcomment = (EditText) findViewById(R.id.edt_pmcomment); + + btn_saveImg = (ImageView) findViewById(R.id.btn_saveImg); + btn_reject = (ImageView) findViewById(R.id.btn_reject); + img_mainGallery = (ImageView) findViewById(R.id.img_mainGallery); + txt_numOfImages = (TextView) findViewById(R.id.txt_numOfImages); + + txt_studentid = (TextView) findViewById(R.id.txt_studentid); + txt_studentid.setText(LeadId); + + + imagePathList = new ArrayList(); + bitmapList = new ArrayList(); + + } + /* public void init() { + TableLayout stk = (TableLayout) findViewById(R.id.table_main); + TableRow tbrow = new TableRow(this); + ImageView iv1 = new ImageView(this); + iv1.setImageResource(R.drawable.lead_logo); + iv1.setLayoutParams(new TableRow.LayoutParams(100,100)); + tbrow.addView(iv1); + //stk.addView(tbrow); + ImageView iv2 = new ImageView(this); + iv2.setImageResource(R.drawable.lead_logo); + iv2.setLayoutParams(new TableRow.LayoutParams(100,100)); + iv2.setPadding(2,0,0,0); + tbrow.addView(iv2); + stk.addView(tbrow); + TableRow tbrow1 = new TableRow(this); + ImageView iv3 = new ImageView(this); + iv3.setImageResource(R.drawable.lead_logo); + iv3.setLayoutParams(new TableRow.LayoutParams(100,100)); + tbrow1.addView(iv3); + stk.addView(tbrow1); + + }*/ + + /*public void init1() { + TableLayout stk = (TableLayout) findViewById(R.id.table_main); + TableRow tbrow = new TableRow(this); + ImageView iv1 = new ImageView(this); + iv1.setImageResource(R.drawable.n1); + iv1.setLayoutParams(new TableRow.LayoutParams(100,100)); + tbrow.addView(iv1); + //stk.addView(tbrow); + ImageView iv2 = new ImageView(this); + iv2.setImageResource(R.drawable.n2); + iv2.setLayoutParams(new TableRow.LayoutParams(100,100)); + iv2.setPadding(2,0,0,0); + tbrow.addView(iv2); + stk.addView(tbrow); + TableRow tbrow1 = new TableRow(this); + ImageView iv11 = new ImageView(this); + iv11.setImageResource(R.drawable.n4); + iv11.setLayoutParams(new TableRow.LayoutParams(100,100)); + tbrow1.addView(iv11); + //stk.addView(tbrow); + ImageView iv22 = new ImageView(this); + iv22.setImageResource(R.drawable.n5); + iv22.setLayoutParams(new TableRow.LayoutParams(100,100)); + iv22.setPadding(2,0,0,0); + tbrow1.addView(iv22); + stk.addView(tbrow1); + + stk.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent i=new Intent(PMComplitionProjectActivity.this,PMGallaryActivity.class); + startActivity(i); + }}); + + }*/ + public static class FileOpen { + + public static void openFile(Context context, File url) throws IOException { + // Create URI + File file=url; + // Uri uri = Uri.fromFile(file); + Uri uri = FileProvider.getUriForFile(context, "com.mydomain.fileprovider", file); + + + Intent intent = new Intent(Intent.ACTION_VIEW); + // Check what kind of file you are trying to open, by comparing the url with extensions. + // When the if condition is matched, plugin sets the correct intent (mime) type, + // so Android knew what application to use to open the file + if (url.toString().contains(".doc") || url.toString().contains(".docx")) { + // Word document + intent.setDataAndType(uri, "application/msword"); + } else if(url.toString().contains(".pdf")) { + // PDF file + intent.setDataAndType(uri, "application/pdf"); + } else if(url.toString().contains(".ppt") || url.toString().contains(".pptx")) { + // Powerpoint file + intent.setDataAndType(uri, "application/vnd.ms-powerpoint"); + } else if(url.toString().contains(".xls") || url.toString().contains(".xlsx")) { + // Excel file + intent.setDataAndType(uri, "application/vnd.ms-excel"); + } else if(url.toString().contains(".zip") || url.toString().contains(".rar")) { + // WAV audio file + intent.setDataAndType(uri, "application/x-wav"); + } else if(url.toString().contains(".rtf")) { + // RTF file + intent.setDataAndType(uri, "application/rtf"); + } else if(url.toString().contains(".wav") || url.toString().contains(".mp3")) { + // WAV audio file + intent.setDataAndType(uri, "audio/x-wav"); + } else if(url.toString().contains(".gif")) { + // GIF file + intent.setDataAndType(uri, "image/gif"); + } else if(url.toString().contains(".jpg") || url.toString().contains(".jpeg") || url.toString().contains(".png")) { + // JPG file + intent.setDataAndType(uri, "image/jpeg"); + } else if(url.toString().contains(".txt")) { + // Text file + intent.setDataAndType(uri, "text/plain"); + } else if(url.toString().contains(".3gp") || url.toString().contains(".mpg") || url.toString().contains(".mpeg") || url.toString().contains(".mpe") || url.toString().contains(".mp4") || url.toString().contains(".avi")) { + // Video files + intent.setDataAndType(uri, "video/*"); + } else { + //if you want you can also define the intent type for any other file + + //additionally use else clause below, to manage other unknown extensions + //in this case, Android will show all applications installed on the device + //so you can choose which application to use + intent.setDataAndType(uri, "*/*"); + } + + // intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + context.startActivity(intent); + } + } + + + + void impactproject_alert_dialog() + { + AlertDialog.Builder dialog = new AlertDialog.Builder(PMComplitionProjectActivity.this); + dialog.setCancelable(false); + dialog.setTitle("LEADCampus"); + + if(str_impactproject.equals("0")) { + dialog.setMessage("Are you sure want to mark this an Impact-Project?"); + } + if(str_impactproject.equals("1")) + { + dialog.setMessage("Are you sure want to mark this an Non-Impact-Project?"); + } + + dialog.setPositiveButton("Yes", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) + { + + Submit_ImpactProject_AsyncTask submit_impactproject = new Submit_ImpactProject_AsyncTask(mContext); + submit_impactproject.execute(); + dialog.dismiss(); + //call web service + } + }) + .setNegativeButton("No", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + //Action for "Cancel". + dialog.dismiss(); + } + }); + + final AlertDialog alert = dialog.create(); + alert.setOnShowListener( new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface arg0) { + alert.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(Color.RED); + alert.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#004D40")); + } + }); + alert.show(); + + } + + +//sdgs goals + + + public void check_box_selected() + { + String str_selected_goals=""; + String str_selected_goals_array=""; + + if(goal_1_nopoverty_cb.isChecked()) + { + str_selected_goals=str_selected_goals+goal_1_nopoverty_cb.getText().toString()+" ,"; + + str_selected_goals_array = str_selected_goals_array+goal_1_nopoverty_cb.getText().toString()+","+"1"+","; + + } + if(goal_2_zerohunger_cb.isChecked()) + { + str_selected_goals=str_selected_goals+goal_2_zerohunger_cb.getText().toString()+" ,"; + + str_selected_goals_array = str_selected_goals_array+goal_2_zerohunger_cb.getText().toString()+","+"2"+","; + + + } + if(goal_3_goodhealth_cb.isChecked()) + { + str_selected_goals=str_selected_goals+goal_3_goodhealth_cb.getText().toString()+" ,"; + + str_selected_goals_array = str_selected_goals_array+goal_3_goodhealth_cb.getText().toString()+","+"3"+","; + } + if(goal_4_quality_cb.isChecked()) + { + str_selected_goals=str_selected_goals+goal_4_quality_cb .getText().toString()+" ,"; + + str_selected_goals_array = str_selected_goals_array+goal_4_quality_cb .getText().toString()+","+"4"+","; + } + if(goal_5_gender_cb.isChecked()) + { + str_selected_goals= str_selected_goals+goal_5_gender_cb.getText().toString()+" ,"; + + str_selected_goals_array = str_selected_goals_array+goal_5_gender_cb.getText().toString()+","+"5"+","; + } + if(goal_6_clean_cb.isChecked()) + { + str_selected_goals= str_selected_goals+goal_6_clean_cb.getText().toString()+" ,"; + + str_selected_goals_array = str_selected_goals_array+goal_6_clean_cb.getText().toString()+","+"6"+","; + } + + + + if(goal_7_affordable_cb.isChecked()) + { + str_selected_goals= str_selected_goals+goal_7_affordable_cb.getText().toString()+" ,"; + + str_selected_goals_array = str_selected_goals_array+goal_7_affordable_cb.getText().toString()+","+"7"+","; + } + if(goal_8_decent_cb.isChecked()) + { + str_selected_goals= str_selected_goals+goal_8_decent_cb.getText().toString()+" ,"; + + str_selected_goals_array = str_selected_goals_array+goal_8_decent_cb.getText().toString()+","+"8"+","; + } + if(goal_9_industry_cb.isChecked()) + { + str_selected_goals= str_selected_goals+goal_9_industry_cb.getText().toString()+" ,"; + + str_selected_goals_array = str_selected_goals_array+goal_9_industry_cb.getText().toString()+","+"9"+","; + } + if(goal_10_reduce_cb.isChecked()) + { + str_selected_goals= str_selected_goals+goal_10_reduce_cb.getText().toString()+","; + + str_selected_goals_array = str_selected_goals_array+goal_10_reduce_cb.getText().toString()+","+"10"+","; + } + if(goal_11_sustain_cb.isChecked()) + { + str_selected_goals= str_selected_goals+goal_11_sustain_cb.getText().toString()+" ,"; + + str_selected_goals_array = str_selected_goals_array+goal_11_sustain_cb.getText().toString()+","+"11"+","; + } + if(goal_12_responsible_cb.isChecked()) + { + str_selected_goals= str_selected_goals+goal_12_responsible_cb.getText().toString()+" ,"; + str_selected_goals_array = str_selected_goals_array+goal_12_responsible_cb.getText().toString()+","+"12"+","; + } + if(goal_13_climate_cb.isChecked()) + { + str_selected_goals= str_selected_goals+goal_13_climate_cb.getText().toString()+" ,"; + + str_selected_goals_array = str_selected_goals_array+goal_13_climate_cb.getText().toString()+","+"13"+","; + } + + if(goal_14_lifewater_cb.isChecked()) + { + str_selected_goals= str_selected_goals+goal_14_lifewater_cb.getText().toString()+" ,"; + str_selected_goals_array = str_selected_goals_array+goal_14_lifewater_cb.getText().toString()+","+"14"+","; + } + if(goal_15_lifeland_cb.isChecked()) + { + str_selected_goals= str_selected_goals+goal_15_lifeland_cb.getText().toString()+" ,"; + + str_selected_goals_array = str_selected_goals_array+goal_15_lifeland_cb.getText().toString()+","+"15"+","; + } + if(goal_16_peace_cb.isChecked()) + { + str_selected_goals= str_selected_goals+goal_16_peace_cb.getText().toString()+" ,"; + + str_selected_goals_array = str_selected_goals_array+goal_16_peace_cb.getText().toString()+","+"16"+","; + } + if(goal_17_partnerships_cb.isChecked()) + { + str_selected_goals= str_selected_goals+goal_17_partnerships_cb.getText().toString(); + str_selected_goals_array = str_selected_goals_array+goal_17_partnerships_cb.getText().toString()+","+"17"+","; + } + + + if(goal_18_none_cb.isChecked()) + { + /* goalslist_linearlayout.setVisibility(View.GONE); + goal_1_nopoverty_cb.setVisibility(View.GONE);*/ + + str_selected_goals=""; + str_selected_goals_array=""; + str_selected_goals= str_selected_goals+goal_18_none_cb.getText().toString(); + str_selected_goals_array = str_selected_goals_array+goal_18_none_cb.getText().toString()+","+"18"+","; + } + + + + str_selected_goals_array = str_selected_goals_array.substring(0, str_selected_goals_array.length() - 1); + + Log.e("str",str_selected_goals_array); + + + //String x="No Poverty ,1,No Poverty ,Zero Hunger ,2"; + + String [] stringArray=str_selected_goals_array.split(","); + + Log.e("str",stringArray.toString()); + + Log.e("length", String.valueOf(stringArray.length)); + + //Log.e("str1",stringArray[3].toString()); + + + // Create JSONObject + goals_jsonobject = new JSONObject(); + + + + + + for(int i=0;i { + + Context context; + AlertDialog alertDialog; + + private ProgressBar progressBar; + + // private ProgressDialog progressDialog; + + Submit_ImpactProject_AsyncTask (Context ctx){ + context = ctx; + // progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapPrimitive response = submit_impactProject(); + + //Log.d("Soap response is",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); + + /*progressDialog.setMessage("Submitting"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show();*/ + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + //Toast.makeText(context,result.toString(),Toast.LENGTH_LONG).show(); + if(result!=null) + { + Log.e("result",result.toString()); //Success + + + if(result.toString().equalsIgnoreCase("Success")) + { + + if(str_impactproject.equals("0")) { + Intent intent_obj = new Intent(PMComplitionProjectActivity.this, PMProjectDetailActivity.class); + intent_obj.putExtra("pageCount", 2); + startActivity(intent_obj); + } + else + { + + + Intent i = new Intent(PMComplitionProjectActivity.this, PMComplitionProjectActivity.class); + i.putExtra("name",Name); + i.putExtra("projectId",PDId); + i.putExtra("LeadId",LeadId); + i.putExtra("PDId",PDId); + i.putExtra("MobileNo",MobileNo); + i.putExtra("Student_Image_Path",Student_Image_Path); + i.putExtra("str_pmcomp_collegename",str_collegename); + i.putExtra("str_pmcomp_streamname",str_streamname); + i.putExtra("str_pmcomp_is_impactproject","0"); + startActivity(i); + + + + + + + } + } + /* if (result.toString().equals("Error")) { + Toast.makeText(getApplicationContext(), "Error occured while saving to database", Toast.LENGTH_LONG).show(); + } else { + Toast.makeText(getApplicationContext(), "Project Updated Successfully", Toast.LENGTH_LONG).show(); + finish(); + Intent ittEditProjToProjStatus = new Intent(PMComplitionProjectActivity.this, PMProjectDetailActivity.class); + ittEditProjToProjStatus.putExtra("pageCount", 2); + startActivity(ittEditProjToProjStatus); + }*/ + } + progressBar.setVisibility(GONE); + // progressDialog.dismiss(); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + + + private SoapPrimitive submit_impactProject() + { + String METHOD_NAME = "UpdateProjectAsImpact"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/UpdateProjectAsImpact"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + int int_isimpactproject= 2;//purposely assigned + + + long long_pid= Long.parseLong(PDId); + + if(str_impactproject.equals("0")) + { + int_isimpactproject=1; + } + if(str_impactproject.equals("1")) + { + int_isimpactproject=0; + } + + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + + + + + + request.addProperty("PDId",long_pid);// long + request.addProperty("isImpactProject",int_isimpactproject);//int + + + Log.e("request",request.toString()); + + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + + + + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + Log.d("soapresponse1xxxx",envelope.getResponse().toString()); + + + //return null; + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + Log.e("ImpactResponse",response.toString()); + return response; + + } + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_main, menu); + MenuItem action_editProfile = menu.findItem(R.id.action_editProfile); + action_editProfile.setVisible(false); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + + /* if (id == R.id.action_editProfile) { + Intent itthomeToEditProfile = new Intent(PMComplitionProjectActivity.this ,PMEditProfileActivity.class); + startActivity(itthomeToEditProfile); + return true; + }*/ + + + if (id == R.id.action_logout) { + Intent itthomeToLogin = new Intent(PMComplitionProjectActivity.this ,LoginActivity.class); + startActivity(itthomeToLogin); + return true; + } + + if (id == android.R.id.home) { + Intent ittProjDtlsToHome = new Intent(PMComplitionProjectActivity.this ,PMProjectDetailActivity.class); + ittProjDtlsToHome.putExtra("pageCount",2); + startActivity(ittProjDtlsToHome); + return true; + } + + return super.onOptionsItemSelected(item); + } + + + + public void validation_sdg_confirm() + { + if((str_sdgs_goals_verified.equalsIgnoreCase("no"))) + { + AlertDialog.Builder dialog = new AlertDialog.Builder(PMComplitionProjectActivity.this); + dialog.setCancelable(false); + dialog.setTitle("LEADCampus"); + dialog.setMessage("Kindly verify SDGS Goal before Submitting" ); + + dialog.setPositiveButton("Yes", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) + { + + str_sdgs_goals_verified="yes"; + dialog.dismiss(); + } + }) + .setNegativeButton("No", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + //Action for "Cancel". + str_sdgs_goals_verified="no"; + dialog.dismiss(); + + } + }); + + final AlertDialog alert = dialog.create(); + alert.setOnShowListener( new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface arg0) { + alert.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(Color.RED); + alert.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#004D40")); + } + }); + alert.show(); + + //alert.getWindow().setBackgroundDrawableResource(android.R.color.background_dark); + + + } + } + + + + + + + + + public void check_box_enable2() + { + + + String str_inner_goalsln; + Log.e("size", String.valueOf(arraylist_goalsln_forcheckbox.size())); + + for (int i = 0; i < arraylist_goalsln_forcheckbox.size(); i++) + { + + str_inner_goalsln=arraylist_goalsln_forcheckbox.get(i).toString().trim(); + if(str_inner_goalsln.equals("1")) + { + goal_1_nopoverty_cb.setChecked(true); + } + if(str_inner_goalsln.equals("2")) + { + goal_2_zerohunger_cb.setChecked(true); + } + + + if(str_inner_goalsln.equals("3")) + { + goal_3_goodhealth_cb.setChecked(true); + } + + if(str_inner_goalsln.equals("4")) + { + goal_4_quality_cb.setChecked(true); + } + + if(str_inner_goalsln.equals("5")) + { + goal_5_gender_cb.setChecked(true); + } + + if(str_inner_goalsln.equals("6")) + { + goal_6_clean_cb.setChecked(true); + } + + if(str_inner_goalsln.equals("7")) + { + goal_7_affordable_cb.setChecked(true); + } + + if(str_inner_goalsln.equals("8")) + { + goal_8_decent_cb.setChecked(true); + } + + if(str_inner_goalsln.equals("9")) + { + goal_9_industry_cb.setChecked(true); + } + + if(str_inner_goalsln.equals("10")) + { + goal_10_reduce_cb.setChecked(true); + } + + if(str_inner_goalsln.equals("11")) + { + goal_11_sustain_cb.setChecked(true); + } + + if(str_inner_goalsln.equals("12")) + { + goal_12_responsible_cb.setChecked(true); + } + + if(str_inner_goalsln.equals("13")) + { + goal_13_climate_cb.setChecked(true); + } + + if(str_inner_goalsln.equals("14")) + { + goal_14_lifewater_cb.setChecked(true); + } + + if(str_inner_goalsln.equals("15")) + { + goal_15_lifeland_cb.setChecked(true); + } + + if(str_inner_goalsln.equals("16")) + { + goal_16_peace_cb.setChecked(true); + } + + if(str_inner_goalsln.equals("17")) + { + goal_17_partnerships_cb.setChecked(true); + } + + if(str_inner_goalsln.equals("18")) + { + goal_18_none_cb.setChecked(true); + + goal_1_nopoverty_cb.setEnabled(false); + goal_2_zerohunger_cb.setEnabled(false); + goal_3_goodhealth_cb.setEnabled(false); + goal_4_quality_cb.setEnabled(false); + goal_5_gender_cb.setEnabled(false); + goal_6_clean_cb.setEnabled(false); + goal_7_affordable_cb.setEnabled(false); + goal_8_decent_cb.setEnabled(false); + goal_9_industry_cb.setEnabled(false); + goal_10_reduce_cb.setEnabled(false); + goal_11_sustain_cb.setEnabled(false); + goal_12_responsible_cb.setEnabled(false); + goal_13_climate_cb.setEnabled(false); + goal_14_lifewater_cb.setEnabled(false); + goal_15_lifeland_cb.setEnabled(false); + goal_16_peace_cb.setEnabled(false); + goal_17_partnerships_cb.setEnabled(false); + } + + } + + arraylist_goalsln_forcheckbox.clear(); + } + + + + + + + + + + + + + + + @Override + public void onBackPressed() { + Intent ittProjDtlsToHome = new Intent(PMComplitionProjectActivity.this ,PMProjectDetailActivity.class); + ittProjDtlsToHome.putExtra("pageCount",2); + startActivity(ittProjDtlsToHome); + } +}// end of class diff --git a/app/src/main/java/com/leadcampusapp/PMEditProfileActivity.java b/app/src/main/java/com/leadcampusapp/PMEditProfileActivity.java new file mode 100644 index 0000000..69783c0 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/PMEditProfileActivity.java @@ -0,0 +1,1378 @@ +package com.leadcampusapp; + +import android.annotation.SuppressLint; +import android.app.Activity; +import android.app.AlertDialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.database.Cursor; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.Color; +import android.graphics.Matrix; +import android.media.ExifInterface; +import android.net.Uri; +import android.os.AsyncTask; +import android.os.Build; +import android.os.Bundle; +import android.provider.MediaStore; +import androidx.core.content.ContextCompat; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.AppCompatSpinner; +import android.util.Base64; +import android.util.Log; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.ArrayAdapter; +import android.widget.EditText; +import android.widget.ImageButton; +import android.widget.ImageView; +import android.widget.ProgressBar; +import android.widget.RadioButton; +import android.widget.TextView; +import android.widget.Toast; + +//import com.android.sripad.leadnew_22_6_2018.R; +import com.leadcampusapp.module.ManagerDetails; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; + +public class PMEditProfileActivity extends AppCompatActivity implements ConnectivityReceiver.ConnectivityReceiverListener{ + + private AppCompatSpinner spin_state; + private AppCompatSpinner spin_city; + private AppCompatSpinner spin_institution; + private AppCompatSpinner spin_semester; + private AppCompatSpinner spin_gender; + private AppCompatSpinner spin_bg; + private EditText edt_dob; + + private int mYear, mMonth, mDay; + private int cYear, cMonth, cDay; + private Context context; + + private ImageView btn_save; + private ImageView btn_addProfile; + + int responseCount=0; + int i=0; + private ProgressBar progressBar; + ProgressDialog dialog; + + EditText Mname_et,mailid_et,address_et,facebook_et,tw_et,inst_et; + EditText Mobile_tv; + RadioButton rdb_male,rdb_female; + EditText whatsapp_tv; + + ManagerDetails managerDetailsObj; + ArrayList managerDetails=new ArrayList<>(); + int ManagerId; + String result_of_submit; + String status; + String PMImgUrl; + ImageView img_profilePick; + private ImageButton imgBtn_addProfile; + private int REQUEST_CAMERA = 0, SELECT_FILE = 1; + String encodedImageString; + + private String serverPath = Class_URL.ServerPath.toString().trim(); + + public static final String PREFBook_PM= "prefbook_pm"; //sharedpreference Book + public static final String PrefID_PMID = "prefid_pmid"; // + public static final String PrefID_pmName = "prefid_pmname"; // + public static final String PrefID_PMEMailID = "prefid_pmemailid"; // + public static final String PrefID_PMMobile = "prefid_pmmobile"; // + // public static final String PrefID_pmlocation = "prefid_pmlocation"; // + public static final String PrefID_pmimageurl = "prefid_pmimgurl"; // + + SharedPreferences shardprefPM_obj; + + SharedPreferences.Editor editor_PM; + String str_MangerID,str_MangerName,str_ManagerEmail,str_ManagerMaobile,str_MangerImg; + Integer MDId; + byte[] byteArray; + Bitmap bitmap; + byte[] imageinbytesArray={0}; + + String Image_Path,Mname,mailid,bloodGroup,mobileno,address,gender,InstaGram,Facebook,Twitter,Whatsapp; + + + Class_URL config_obj= new Class_URL(); + public static final String PREFBook_LoginTrack= "prefbook_logintrack"; + public static final String PrefID_WhereToGo = "prefid_wheretogo"; // + SharedPreferences shardprefLoginTrack_obj; + SharedPreferences.Editor editor_LoginTrack; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_pmedit_profilenew); + + /*getSupportActionBar().setTitle("LeadMIS");*/ + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + //getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background)); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); + + + + + shardprefLoginTrack_obj =this.getSharedPreferences(PREFBook_LoginTrack,Context.MODE_PRIVATE); + editor_LoginTrack = shardprefLoginTrack_obj.edit(); + editor_LoginTrack.putString(PrefID_WhereToGo,config_obj.packagename+"PMEditProfileActivity"); + editor_LoginTrack.commit(); + + + + + View actionBarView = getSupportActionBar().getCustomView(); + TextView actionBarTV = (TextView) actionBarView.findViewById(R.id.txt_actionBar); + actionBarTV.setText("Edit Profile"); + /* ManagerId = getIntent().getExtras().getInt("ManagerId"); + Log.i("tag","MangerID PMProjectDetails="+ManagerId); +*/ + context = PMEditProfileActivity.this; + progressBar = (ProgressBar) findViewById(R.id.progressBar); + // dialog= new ProgressDialog(this); + managerDetailsObj=new ManagerDetails(); + spin_bg = (AppCompatSpinner) findViewById(R.id.spin_bg); + btn_save = (ImageView) findViewById(R.id.btn_save); + imgBtn_addProfile = (ImageButton) findViewById(R.id.imgBtn_addProfile); + Mname_et = (EditText) findViewById(R.id.edt_mentorName); + mailid_et = (EditText) findViewById(R.id.edt_emailid); + address_et = (EditText) findViewById(R.id.edt_address); + Mobile_tv = (EditText) findViewById(R.id.mobile_tv); + rdb_male = (RadioButton) findViewById(R.id.rdb_male); + rdb_female = (RadioButton) findViewById(R.id.rdb_female); + img_profilePick = (ImageView) findViewById(R.id.img_profilePick); + + facebook_et= (EditText) findViewById(R.id.edt_fb); + tw_et=(EditText) findViewById(R.id.edt_twitter); + inst_et=(EditText)findViewById(R.id.edt_inst); + whatsapp_tv=(EditText) findViewById(R.id.whatsapp_tv); + + + shardprefPM_obj= getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MangerID = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + Log.d("str_leadId:",str_MangerID); + // Toast.makeText(this,"LeadId: "+str_MangerID,Toast.LENGTH_LONG).show(); + MDId=Integer.parseInt(str_MangerID); + + shardprefPM_obj.getString(PrefID_PMEMailID, "").trim(); + str_ManagerEmail = shardprefPM_obj.getString(PrefID_PMEMailID, "").trim(); + Log.d("str_ManagerEmail:",str_ManagerEmail); + // Toast.makeText(this,"LeadId: "+str_MangerID,Toast.LENGTH_LONG).show(); + + shardprefPM_obj.getString(PrefID_pmName, "").trim(); + str_MangerName = shardprefPM_obj.getString(PrefID_pmName, "").trim(); + Log.d("str_MangerName:",str_MangerName); + // Toast.makeText(this,"LeadId: "+str_MangerID,Toast.LENGTH_LONG).show(); + + shardprefPM_obj.getString(PrefID_PMMobile, "").trim(); + str_ManagerMaobile = shardprefPM_obj.getString(PrefID_PMMobile, "").trim(); + Log.d("str_ManagerMaobile:",str_ManagerMaobile); + // Toast.makeText(this,"LeadId: "+str_MangerID,Toast.LENGTH_LONG).show(); + shardprefPM_obj.getString(PrefID_pmimageurl, "").trim(); + str_MangerImg = shardprefPM_obj.getString(PrefID_pmimageurl, "").trim(); + Log.d("str_MangerImg:",str_MangerImg); + + /* shardprefPM_obj.getString(PrefID_pmlocation, "").trim(); + str_ManagerLocation = shardprefPM_obj.getString(PrefID_pmlocation, "").trim(); + Log.d("str_ManagerLocation:",str_ManagerLocation); +*/ + /* Intent intent = getIntent(); + String MangerID=intent.getStringExtra("ManagerId"); + Log.i("tag","MangerID"+MangerID); + if(MangerID.equals("null")){ + ManagerId=1; + }else + { + ManagerId = Integer.parseInt(MangerID); + + } +*/ + GetManagerDetails getManagerDetails = new GetManagerDetails(this); + getManagerDetails.execute(MDId); + + + btn_save.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (validation()) { + UpdateManagerDetails updateManagerDetails = new UpdateManagerDetails(PMEditProfileActivity.this); + updateManagerDetails.execute(); + } + + } + }); + + imgBtn_addProfile.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + selectImage(); + } + }); + + // setGenderSpinner(); + setBloodGroupSpinner(); + } + + @Override + protected void onResume() { + super.onResume(); + + // register connection status listener + MyApplication.getInstance().setConnectivityListener(this); + } + + @Override + public void onNetworkConnectionChanged(boolean isConnected) { + showSnack(isConnected); + } + + private void showSnack(boolean isConnected) { + + if (!isConnected) { + + AlertDialog.Builder adb = new AlertDialog.Builder(PMEditProfileActivity.this); + //adb.setView(alertDialogView); + + adb.setTitle("Sorry! Not connected to the internet"); + + adb.setIcon(android.R.drawable.ic_dialog_alert); + + adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + + adb.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + adb.setCancelable(true); + adb.show(); + } + +/* String message; + int color; + if (isConnected) { + message = "Good! Connected to Internet"; + color = Color.WHITE; + } else { + message = "Sorry! Not connected to internet"; + color = Color.RED; + } + + Snackbar snackbar = Snackbar + .make(findViewById(R.id.coordinator_layout), message, Snackbar.LENGTH_LONG); + + View sbView = snackbar.getView(); + TextView textView = (TextView) sbView.findViewById(android.support.design.R.id.snackbar_text); + textView.setTextColor(color); + snackbar.show();*/ + } + + + + private void selectImage() + { + final CharSequence[] items = {"Take Photo", "Choose from Library", + "Cancel"}; + + AlertDialog.Builder builder = new AlertDialog.Builder(context); + builder.setTitle("Add Photo!"); + builder.setItems(items, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int item) { + if (items[item].equals("Take Photo")) { + //userChoosenTask ="Take Photo"; + cameraIntent(); + + } else if (items[item].equals("Choose from Library")) { + //userChoosenTask ="Choose from Library"; + galleryIntent(); + + } else if (items[item].equals("Cancel")) { + dialog.dismiss(); + } + } + }); + builder.show(); + } + + private void cameraIntent() + { + Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); + startActivityForResult(intent, REQUEST_CAMERA); + } + + private void galleryIntent() { + Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); + intent.setType("image/*"); + //intent.setAction(Intent.ACTION_GET_CONTENT); + startActivityForResult(Intent.createChooser(intent, "Select File"), SELECT_FILE); + } + + /* private void selectImage() { + final CharSequence[] items = {"Take Photo", "Choose from Library", + "Cancel"}; + + AlertDialog.Builder builder = new AlertDialog.Builder(context); + builder.setTitle("Add Photo!"); + builder.setItems(items, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int item) { + if (items[item].equals("Take Photo")) { + //userChoosenTask ="Take Photo"; + cameraIntent(); + + } else if (items[item].equals("Choose from Library")) { + //userChoosenTask ="Choose from Library"; + galleryIntent(); + + } else if (items[item].equals("Cancel")) { + dialog.dismiss(); + } + } + }); + builder.show(); + } + + private void cameraIntent() { + Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); + startActivityForResult(intent, REQUEST_CAMERA); + } + + private void galleryIntent() { + Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); + intent.setType("image/*"); + //intent.setAction(Intent.ACTION_GET_CONTENT); + startActivityForResult(Intent.createChooser(intent, "Select File"), SELECT_FILE); + } +*/ + public void onRadioButtonGenderClicked(View view) { + boolean checked = ((RadioButton) view).isChecked(); + + switch(view.getId()) { + case R.id.rdb_male: if(checked){} break; + case R.id.rdb_female: if (checked){} break; + } + } + + public boolean validation() + { + + Boolean bfarmername=true,baddress=true,blocation=true,bimageview=true,bnetwork=true,bfees=true,bcluster=true; + + + if( Mname_et.getText().toString().length() == 0 ){ + Mname_et.setError( "Manager name is required!" );bfarmername=false;} + + if( address_et.getText().toString().length() == 0 ){ + address_et.setError( "Address is required!" );baddress=false;} + + if( mailid_et.getText().toString().length() == 0 ){ + mailid_et.setError( "Mail ID is required!" );blocation=false;} + + /*if(imageview.getDrawable() == null){ + Toast.makeText(MainActivity.this, "Image is not taken", Toast.LENGTH_LONG).show();bimageview= false;} +*/ + /*if(spin_bg.getSelectedItemPosition()==0){ + TextView errorText = (TextView) spin_bg.getSelectedView(); + errorText.setError("Select Fees"); + bfees=false; + } + if(cluster.getSelectedItemPosition() ==0){ + TextView errorText = (TextView) cluster.getSelectedView(); + errorText.setError("Select Cluster"); + bcluster=false; + }*/ + + + if(bfarmername&&baddress&&blocation&&bimageview&&bnetwork&&bfees&&bcluster) { + return true; + }else{return false;} + } + + @Override + public void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + + if (resultCode == Activity.RESULT_OK) { + if (requestCode == SELECT_FILE) { + //onSelectFromGalleryResult(data); + + if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + //if (android.os.Build.VERSION.SDK_INT > 24) { + + Uri selectedImage = data.getData(); + Log.e("uri", selectedImage.toString()); + + String[] filePathColumn = {MediaStore.Images.Media.DATA}; + + Cursor cursor = getContentResolver().query(selectedImage, + filePathColumn, null, null, null); + cursor.moveToFirst(); + + int columnIndex = cursor.getColumnIndex(filePathColumn[0]); + String picturePath = cursor.getString(columnIndex); + cursor.close(); + + bitmap = BitmapFactory.decodeFile(picturePath); + + /* ImageView imgProj = (ImageView) view2.findViewById(projImageId); + imgProj.setImageBitmap(bitmap);*/ + + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + bitmap.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream); + byteArray = byteArrayOutputStream .toByteArray(); + + encodedImageString = Base64.encodeToString(byteArray, Base64.DEFAULT); + + Log.i("tag","encodedImageString1="+encodedImageString); + + //In marshmallow version camara image rotation code + + ExifInterface exif= null; + try { + exif = new ExifInterface(picturePath.toString()); + } catch (IOException e) { + e.printStackTrace(); + } + + Log.d("EXIF value1", exif.getAttribute(ExifInterface.TAG_ORIENTATION)); + if(exif.getAttribute(ExifInterface.TAG_ORIENTATION).equalsIgnoreCase("6")){ + bitmap= rotate(bitmap, 90); + } else if(exif.getAttribute(ExifInterface.TAG_ORIENTATION).equalsIgnoreCase("8")){ + bitmap= rotate(bitmap, 270); + } else if(exif.getAttribute(ExifInterface.TAG_ORIENTATION).equalsIgnoreCase("3")){ + bitmap= rotate(bitmap, 180); + }/* else if(exif.getAttribute(ExifInterface.TAG_ORIENTATION).equalsIgnoreCase("0")){ + bitmap= rotate(bitmap, 0); + }*/ +//----------------------------------- + img_profilePick.setImageBitmap(bitmap); + + /* ByteArrayOutputStream stream = new ByteArrayOutputStream(); + + bitmapPicture.compress(Bitmap.CompressFormat.PNG, 50, stream); + // bmp.recycle(); + byte[] byteArray = stream.toByteArray(); + img_data = Base64.encodeToString(byteArray, Base64.DEFAULT);*/ + + + } else { + Bundle extras2 = data.getExtras(); + if (extras2 != null) { + Bitmap yourImage = extras2.getParcelable("data"); + // convert bitmap to byte + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + yourImage.compress(Bitmap.CompressFormat.PNG, 100, stream); + byte[] imageInByte; + imageInByte = stream.toByteArray(); + // Log.e("output before conversion", imageInByte.toString()); + // Log.d("Insert: ", "Inserting ..image"); + bitmap = BitmapFactory.decodeByteArray(imageInByte, 0, imageInByte.length); + // Log.d("Insert image report: ",bm.toString() ); + + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + bitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream); + byteArray = byteArrayOutputStream .toByteArray(); + + encodedImageString = Base64.encodeToString(byteArray, Base64.DEFAULT); + Log.i("tag","encodedImageString2="+encodedImageString); + img_profilePick.setImageBitmap(bitmap); + // Inserting Contacts + + // db.addPhoto(new Photo(lead_id, imageInByte)); + // addimage(); + + } + } + + + } else if (requestCode == REQUEST_CAMERA) { + //onCaptureImageResult(data); + Bundle extras = data.getExtras(); + + if (extras != null) { + Bitmap yourImage = extras.getParcelable("data"); + // convert bitmap to byte + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + yourImage.compress(Bitmap.CompressFormat.JPEG, 100, stream); + byte[] imageInByte; + imageInByte = stream.toByteArray(); + // Log.e("output before conversion", imageInByte.toString()); + // Inserting Contacts + bitmap = BitmapFactory.decodeByteArray(imageInByte, 0, imageInByte.length); + + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + bitmap.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream); + byteArray = byteArrayOutputStream .toByteArray(); + + encodedImageString = Base64.encodeToString(byteArray, Base64.DEFAULT); + Log.i("tag","encodedImageString3="+encodedImageString); + //report_photo.setImageBitmap(bm); + + /*Log.d("projectImageidxxxx",String.valueOf(projImageId)); + + ImageView imgProj = (ImageView) view2.findViewById(projImageId); + imgProj.setImageBitmap(bm);*/ + + + /* Bitmap circleBitmap = Bitmap.createBitmap(yourImage.getWidth(), yourImage.getHeight(), Bitmap.Config.ARGB_8888); + + BitmapShader shader = new BitmapShader (yourImage, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); + Paint paint = new Paint(); + paint.setShader(shader); + + Canvas c = new Canvas(circleBitmap); + c.drawCircle(yourImage.getWidth()/2, yourImage.getHeight()/2, yourImage.getWidth()/2, paint); + + img_profilePick.setImageBitmap(circleBitmap);*/ + + img_profilePick.setImageBitmap(bitmap); + } + } + } + } + + public static Bitmap rotate(Bitmap bitmap, int degree) { + int w = bitmap.getWidth(); + int h = bitmap.getHeight(); + + Matrix mtx = new Matrix(); + // mtx.postRotate(degree); + mtx.setRotate(degree); + + return Bitmap.createBitmap(bitmap, 0, 0, w, h, mtx, true); + } + + + public class GetManagerDetailsNew extends AsyncTask { + + Context context; + + private ProgressBar progressBar; + + GetManagerDetailsNew (Context ctx){ + context = ctx; + } + Boolean res=false; + String str_Response; + + @Override + protected SoapObject doInBackground(Integer... params) { + Integer ManagerId = (Integer) params [0]; + //SoapObject response = getStudDtls(leadid); + + String METHOD_NAME = "GetManagerDetails"; + String NamespaceMail="http://mis.leadcampus.org/", SOAP_ACTION1="http://mis.leadcampus.org/GetManagerDetails";//namespace+methodname + SoapObject response = null; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + request.addProperty("ManagerId", ManagerId); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + response = (SoapObject) envelope.getResponse(); + Log.d("tag","soap response getresult="+response.toString()); + + str_Response=response.getProperty("Status").toString(); + Mname=response.getProperty("ManagerName").toString(); + mailid=response.getProperty("MailId").toString(); + bloodGroup=response.getProperty("BloodGroup").toString(); + gender=response.getProperty("Gender").toString(); + mobileno=response.getProperty("MobileNo").toString(); + address=response.getProperty("Address").toString(); + Image_Path=response.getProperty("Image_Path").toString(); + Facebook = response.getProperty("Facebook").toString(); + Twitter = response.getProperty("Twitter").toString(); + InstaGram = response.getProperty("InstaGram").toString(); + Whatsapp = response.getProperty("WhatsApp").toString(); + Log.d("Image_Path=",Image_Path); + + String Imagestring = Image_Path; + if(Imagestring.equals("null")||Imagestring.equals("anyType{}")){ + // PMImgUrl="null"; + img_profilePick.setImageResource(R.drawable.devanand); + }else { + String arr[] = Imagestring.split("/", 2); + + String firstWord = arr[0]; //the + String secondWord = arr[1]; + + PMImgUrl = serverPath + secondWord; + + Log.i("tag", "firstWord=" + firstWord + " secondWord=" + secondWord); + LoadGalleryImage loadGalleryImage=new LoadGalleryImage(PMEditProfileActivity.this); + loadGalleryImage.execute(); + } + + editor_PM = shardprefPM_obj.edit(); + editor_PM.clear(); + editor_PM.commit(); + + + editor_PM = shardprefPM_obj.edit(); + editor_PM.putString(PrefID_PMID, String.valueOf(MDId)); + editor_PM.putString(PrefID_pmName,Mname); + editor_PM.putString(PrefID_PMEMailID,mailid); + editor_PM.putString(PrefID_PMMobile,mobileno); + // editor_PM.putString(Pre,mobileno); + editor_PM.putString(PrefID_pmimageurl,PMImgUrl); + editor_PM.commit(); + + + Log.d("ManagerIds:", String.valueOf(MDId)); + Log.d("ManagerNames:",Mname); + Log.d("ManagerEmailIds:",mailid); + Log.d("ManagerMobiles:",mobileno); + // Log.d("Managerlocations:",Str_PMLocation); + Log.d("ManagerURLs:",PMImgUrl); + Log.d("mailid",mailid); + /*if(response.getProperty("Status").toString().equals("Success")){ + Log.i("tag","Status="+response.getProperty("Status").toString()); + res=true; + } + else { + res=false; + }*/ + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + + + + + Mname_et.setText(Mname); + mailid_et.setText(mailid); + Mobile_tv.setText(mobileno); + address_et.setText(address); + if(gender.equals("M")){ + rdb_male.setChecked(true); + } + else{ + rdb_female.setChecked(true); + } + if(bloodGroup.equals("A+")){ + spin_bg.setSelection(1); + }else if(bloodGroup.equals("B+")){ + spin_bg.setSelection(2); + }else if(bloodGroup.equals("A-")){ + spin_bg.setSelection(3); + }else if(bloodGroup.equals("B-")){ + spin_bg.setSelection(4); + }else if(bloodGroup.equals("AB+")){ + spin_bg.setSelection(5); + }else if(bloodGroup.equals("AB-")){ + spin_bg.setSelection(6); + }else if(bloodGroup.equals("O+")){ + spin_bg.setSelection(7); + }else if(bloodGroup.equals("O-")){ + spin_bg.setSelection(8); + }else if(bloodGroup.equals("Select")||bloodGroup.equals("null")||bloodGroup.equals("anyType{}")){ + spin_bg.setSelection(0); + } + + + + }catch (Exception t) { + Log.d("exception outside",t.getMessage().toString()); + } + + //Log.d("Soap response is",response.toString()); + // SoapObject response = (SoapObject) .getResponse(); + + return null; + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); + + } + + @Override + protected void onPostExecute(SoapObject result) { + progressBar.setVisibility(View.GONE); + + // Log.d("GetManagerDetailsNewre",result.toString()); + + // if(result.getProperty("Status").toString().equals("Success")) { + //if(res==true){ + if(result!=null) { + if (str_Response.equals("Success")) { + Intent ittEditToHome = new Intent(PMEditProfileActivity.this, PMHomeActivity.class); + startActivity(ittEditToHome); + } + } + + // String finalResult = result.toString(); + // Log.d("finalResultssssss",finalResult); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + + public class GetManagerDetails extends AsyncTask { + + Context context; + + private ProgressBar progressBar; + + GetManagerDetails (Context ctx){ + context = ctx; + } + + + @Override + protected SoapObject doInBackground(Integer... params) { + Integer ManagerId = (Integer) params [0]; + //SoapObject response = getStudDtls(leadid); + + String METHOD_NAME = "GetManagerDetails"; + String NamespaceMail="http://mis.leadcampus.org/", SOAP_ACTION1="http://mis.leadcampus.org/GetManagerDetails";//namespace+methodname + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + request.addProperty("ManagerId", ManagerId); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapObject response = (SoapObject) envelope.getResponse(); + Log.d("soap responseyyyyyyy",response.toString()); + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.d("exception outside",t.getMessage().toString()); + } + + //Log.d("Soap response is",response.toString()); + + return null; + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); + + } + + @Override + protected void onPostExecute(SoapObject result) { + progressBar.setVisibility(View.GONE); + + if(result!=null) { + String finalResult = result.toString(); + Log.d("finalResultssssss", finalResult); + Mname = result.getProperty("ManagerName").toString(); + mailid = result.getProperty("MailId").toString(); + bloodGroup = result.getProperty("BloodGroup").toString(); + gender = result.getProperty("Gender").toString(); + mobileno = result.getProperty("MobileNo").toString(); + address = result.getProperty("Address").toString(); + Image_Path = result.getProperty("Image_Path").toString(); + Facebook = result.getProperty("Facebook").toString(); + Twitter = result.getProperty("Twitter").toString(); + InstaGram = result.getProperty("InstaGram").toString(); + Whatsapp = result.getProperty("WhatsApp").toString(); + Log.d("Image_Path=", Image_Path); + + String Imagestring = Image_Path; + if (Imagestring.equals("null") || Imagestring.equals("anyType{}")) { + // PMImgUrl="null"; + img_profilePick.setImageResource(R.drawable.devanand); + } else { + String arr[] = Imagestring.split("/", 2); + + String firstWord = arr[0]; //the + String secondWord = arr[1]; + + PMImgUrl = serverPath + secondWord; + + Log.i("tag", "firstWord=" + firstWord + " secondWord=" + secondWord); + LoadGalleryImage loadGalleryImage = new LoadGalleryImage(PMEditProfileActivity.this); + loadGalleryImage.execute(); + } + + + + + /* editor_PM.putString(PrefID_PMID, String.valueOf(MDId)); + editor_PM.putString(PrefID_pmName,Mname); + editor_PM.putString(PrefID_PMEMailID,mailid); + editor_PM.putString(PrefID_PMMobile,mobileno); + editor_PM.putString(PrefID_pmimageurl,PMImgUrl); + editor_PM.commit();//();*/ + + if (Facebook.equals("null") || Facebook.equals("anyType{}")) { + facebook_et.setText(""); + } else { + facebook_et.setText(Facebook); + } + if (Twitter.equals("null") || Twitter.equals("anyType{}")) { + tw_et.setText(""); + } else { + tw_et.setText(Twitter); + } + if (InstaGram.equals("null") || InstaGram.equals("anyType{}")) { + inst_et.setText(""); + } else { + inst_et.setText(InstaGram); + } + if (address.equals("null") || address.equals("anyType{}")) { + address_et.setText(""); + } else { + address_et.setText(address); + } + if (Whatsapp.equals("null") || Whatsapp.equals("anyType{}")) { + whatsapp_tv.setText(""); + } else { + whatsapp_tv.setText(Whatsapp); + } + Mname_et.setText(Mname); + mailid_et.setText(mailid); + Mobile_tv.setText(mobileno); + + if (gender.equals("M")) { + rdb_male.setChecked(true); + } else { + rdb_female.setChecked(true); + } + + + if (bloodGroup.equals("A+")) { + spin_bg.setSelection(1); + } else if (bloodGroup.equals("B+")) { + spin_bg.setSelection(2); + } else if (bloodGroup.equals("A-")) { + spin_bg.setSelection(3); + } else if (bloodGroup.equals("B-")) { + spin_bg.setSelection(4); + } else if (bloodGroup.equals("AB+")) { + spin_bg.setSelection(5); + } else if (bloodGroup.equals("AB-")) { + spin_bg.setSelection(6); + } else if (bloodGroup.equals("O+")) { + spin_bg.setSelection(7); + } else if (bloodGroup.equals("O-")) { + spin_bg.setSelection(8); + } else if (bloodGroup.equals("Bombay Blood")) { + spin_bg.setSelection(9); + } else if (bloodGroup.equals("Select") || bloodGroup.equals("null") || bloodGroup.equals("anyType{}")) { + spin_bg.setSelection(0); + } + } + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + public class LoadGalleryImage extends AsyncTask { + + private Context context; + // private ProgressBar progressBar; + + LoadGalleryImage (Context context){ + this.context = context; + } + + @Override + protected void onPreExecute() { + // progressBar = (ProgressBar) findViewById(R.id.progressBar); + // progressBar.setVisibility(View.VISIBLE); + + } + + @Override + protected Bitmap doInBackground(Void... params) { + ArrayList bitmapLst=null; + Bitmap bitmaplogo=null; + + try { + URL url= new URL(PMImgUrl); + Log.d("Urlssssssssssss",url.toString()); + bitmaplogo = BitmapFactory.decodeStream(url.openStream()); + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return bitmaplogo; + } + + @Override + protected void onPostExecute(Bitmap bitmap) { + // bitmapList.add(bitmap); + img_profilePick.setImageBitmap(bitmap); + // progressBar.setVisibility(GONE); + } + } + + private class UpdateManagerDetails extends AsyncTask + { + // ProgressDialog dialog; + + Context context; + + // public UpdateManagerDetails(GetManagerDetails getManagerDetails) { + // } + + @Override + protected void onPreExecute() + { + Log.i("TAG", "onPreExecute---tab2"); + dialog.setMessage("Please wait.."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + + } + + @Override + protected void onProgressUpdate(Void... values) + { + Log.i("TAG", "onProgressUpdate---tab2"); + } + + public UpdateManagerDetails(PMEditProfileActivity activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + @Override + protected Void doInBackground(String... params) + { + Log.i("TAG", "doInBackground"); + //submit_PMProfile(ManagerId); + Submit(); + return null; + } + + @Override + protected void onPostExecute(Void result) + { + Log.i("TAG", "onPostExecute"); + + Log.d("ServiceResponseisss: ",status.toString()); + + dialog.dismiss(); + /* if(status.equals("Error")){ + Toast.makeText(PMEditProfileActivity.this, "Update Request Failed " , + Toast.LENGTH_LONG).show(); + }*/ + if(status.equals("Success")) { + Toast.makeText(PMEditProfileActivity.this, "Profile Updated Successfully " , + Toast.LENGTH_LONG).show(); + Log.i("MDId","MDId="+MDId); + GetManagerDetailsNew getManagerDetails1 = new GetManagerDetailsNew(PMEditProfileActivity.this); + getManagerDetails1.execute(MDId); + + /* editor_PM=shardprefPM_obj.edit(); + editor_PM.putString(PrefID_PMID, String.valueOf(MDId)); + editor_PM.putString(PrefID_pmName,Mname); + editor_PM.putString(PrefID_PMEMailID,mailid); + editor_PM.putString(PrefID_PMMobile,mobileno); + editor_PM.putString(PrefID_pmimageurl,PMImgUrl); + Log.d("ManagerIds:", String.valueOf(MDId)); + Log.d("ManagerNames:",Mname); + Log.d("ManagerEmailIds:",mailid); + Log.d("ManagerMobiles:",mobileno); + // Log.d("Managerlocations:",Str_PMLocation); + Log.d("ManagerURLs:",PMImgUrl); + Log.d("mailid",mailid); + editor_PM.commit();*/ + + /* ittEditToHome.putExtra("ManagerId",MDId); + ittEditToHome.putExtra("ManagerName",Mname_et.getText().toString()); + ittEditToHome.putExtra("PMEmailId",mailid_et.getText().toString()); + ittEditToHome.putExtra("PM_Mobile",Mobile_tv.getText().toString()); + ittEditToHome.putExtra("PMLocation",address_et.getText().toString()); + ittEditToHome.putExtra("PMImgUrl",str_MangerImg); + startActivity(ittEditToHome);*/ + + } + else{ + Toast.makeText(PMEditProfileActivity.this, "Update Request Failed " , + Toast.LENGTH_LONG).show(); + } + } + } + @SuppressLint("RestrictedApi") + private void setGenderSpinner() { + final ArrayList listgender = new ArrayList(); + listgender.add("Male"); + listgender.add("Female"); + + //ArrayAdapter dataAdapterSem = new ArrayAdapter(context, R.layout.simple_spinner_semester, listsemester); + ArrayAdapter dataAdapterGender = new ArrayAdapter(context, R.layout.simple_spinner_items, listgender); + + // Drop down layout style - list view with radio button + dataAdapterGender.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + + // attaching data adapter to spinner + spin_gender.setAdapter(dataAdapterGender); + spin_gender.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorWhite)); + } + + @SuppressLint("RestrictedApi") + private void setBloodGroupSpinner() { + final ArrayList listBg = new ArrayList(); + listBg.add("Select"); + listBg.add("A+"); + listBg.add("B+"); + listBg.add("A-"); + listBg.add("B-"); + listBg.add("AB+"); + listBg.add("AB-"); + listBg.add("O+"); + listBg.add("O-"); + listBg.add("Bombay Blood"); + + //ArrayAdapter dataAdapterSem = new ArrayAdapter(context, R.layout.simple_spinner_semester, listsemester); + ArrayAdapter dataAdapterBg = new ArrayAdapter(context, R.layout.simple_spinner_items, listBg); + + // Drop down layout style - list view with radio button + dataAdapterBg.setDropDownViewResource(R.layout.spinnercustomstyle); + + // attaching data adapter to spinner + spin_bg.setAdapter(dataAdapterBg); + //spin_bg.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorWhite)); + } + + + public void submit_PMProfile(Integer managerId) + { + +// String engage_class1= status.getTag().toString(); + // Vector result1 = null; + String URL = Class_URL.URL_Manager.toString().trim();//"Login.asmx?WSDL"; + // String METHOD_NAME = "intCount";//"NewAppReleseDetails"; + // String Namespace="http://www.example.com", SOAPACTION="http://www.example.com/intCount"; + // String URL = "http://192.168.1.196:8080/deterp_ws/server4.php?wsdl";//"Login.asmx?WSDL"; + String METHOD_NAME = "UpdateManagerDetails";//"NewAppReleseDetails"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/UpdateManagerDetails"; + try{ + String Gender = null; + String MnameNew=Mname_et.getText().toString(); + String EmailIdNew= mailid_et.getText().toString(); + String AddressNew=address_et.getText().toString(); + String MobileNo=Mobile_tv.getText().toString(); + if(rdb_female.isChecked()){ + Gender="F"; + }else if(rdb_male.isChecked()){ + Gender="M"; + } + + + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + request.addProperty("ManagerId",MDId); + request.addProperty("ManagerName", MnameNew); + request.addProperty("MailId", EmailIdNew); + request.addProperty("Address", AddressNew); + request.addProperty("MobileNo", MobileNo); + request.addProperty("Gender", Gender); + request.addProperty("BloodGroup", AddressNew); + + // request.addProperty("to", 9); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try + { + + androidHttpTransport.call(SOAPACTION, envelope); + // Log.i(TAG, "GetAllLoginDetails is running"); + // result1 = (Vector) envelope.getResponse(); + SoapObject response = (SoapObject) envelope.getResponse(); + // result_of_submit=response.getProperty(0).toString(); + Log.i("Tag","string value at response >"+response.toString()); + + } + catch (Throwable t) { + //Toast.makeText(MainActivity.this, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + + } + }catch (Throwable t) { + Log.e("Tag","UnRegister Receiver Error >" + t.getMessage()); + + } + + } + + public void Submit() { + + String URL = Class_URL.URL_Manager.toString().trim(); + String METHOD_NAME = "UpdateManagerDetailswithstring"; + String Namespace = "http://mis.leadcampus.org/", SOAPACTION = "http://mis.leadcampus.org/UpdateManagerDetailswithstring"; + + //for final + byte[] imageinbytesArray1; + imageinbytesArray1=imageinbytesArray; + + try { + + String Gender = null; + String MnameNew = Mname_et.getText().toString(); + String EmailIdNew = mailid_et.getText().toString(); + String AddressNew = address_et.getText().toString(); + String MobileNo = Mobile_tv.getText().toString(); + String Facebook = facebook_et.getText().toString(); + String Twitter = tw_et.getText().toString(); + String Inst = inst_et.getText().toString(); + String Whatsapp=whatsapp_tv.getText().toString(); + + if (rdb_female.isChecked()) { + Gender = "F"; + } else if (rdb_male.isChecked()) { + Gender = "M"; + } + String BloodGroop = spin_bg.getSelectedItem().toString(); + + String encodestr="data:image/jpg;base64/"+encodedImageString; + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + // request.addProperty("distid", "0");//short + request.addProperty("ManagerId", MDId); + request.addProperty("ManagerName", MnameNew); + request.addProperty("MailId", EmailIdNew); + request.addProperty("Address", AddressNew); + request.addProperty("MobileNo", MobileNo); + request.addProperty("Gender", Gender); + request.addProperty("BloodGroup", BloodGroop); + request.addProperty("ProfileImage",encodedImageString); + request.addProperty("Facebook",Facebook); + request.addProperty("Twitter",Twitter); + request.addProperty("InstaGram",Inst); + request.addProperty("WhatsApp",Whatsapp); + + Log.e("tag","imageinbytesArray=="+imageinbytesArray); + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + // Log.i(TAG, "GetAllLoginDetails is running"); + // result1 = (Vector) envelope.getResponse(); + + ///SoapObject response = (SoapObject) envelope.getResponse(); + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + //Log.e("tag","soap response Updateresponse"+ response.toString()); + + status = response.toString(); + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + } + + @Override + public void onBackPressed() + { + // Do Here what ever you want do on back press; + + AlertDialog.Builder dialog = new AlertDialog.Builder(PMEditProfileActivity.this); + dialog.setCancelable(false); + dialog.setTitle("LEADCampus"); + dialog.setMessage("Are you sure want to Exit from Edit Profile" ); + + dialog.setPositiveButton("Yes", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) + { + Intent i = new Intent(PMEditProfileActivity.this,PMHomeActivity.class); + startActivity(i); + finish(); + } + }) + .setNegativeButton("No", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + //Action for "Cancel". + dialog.dismiss(); + } + }); + + final AlertDialog alert = dialog.create(); + alert.setOnShowListener( new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface arg0) { + alert.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(Color.RED); + alert.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#004D40")); + } + }); + alert.show(); + + + + + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_main, menu); + MenuItem action_editProfile = menu.findItem(R.id.action_editProfile); + action_editProfile.setVisible(false); + + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + /* if (id == R.id.action_settings) { + return true; + }*/ + + if (id == R.id.action_logout) { + + editor_LoginTrack = shardprefLoginTrack_obj.edit(); + editor_LoginTrack.putString(PrefID_WhereToGo, config_obj.packagename+"LoginActivity"); + editor_LoginTrack.commit(); + Intent itthomeToLogin = new Intent(PMEditProfileActivity.this ,LoginActivity.class); + startActivity(itthomeToLogin); + return true; + } + + if (id == android.R.id.home) + { + + + AlertDialog.Builder dialog = new AlertDialog.Builder(PMEditProfileActivity.this); + dialog.setCancelable(false); + dialog.setTitle("LEADCampus"); + dialog.setMessage("Are you sure want to Exit from Edit Profile" ); + + dialog.setPositiveButton("Yes", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) + { + Intent i = new Intent(PMEditProfileActivity.this,PMHomeActivity.class); + startActivity(i); + finish(); + } + }) + .setNegativeButton("No", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + //Action for "Cancel". + dialog.dismiss(); + + } + }); + + final AlertDialog alert = dialog.create(); + alert.setOnShowListener( new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface arg0) { + alert.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(Color.RED); + alert.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#004D40")); + } + }); + alert.show(); + + + /*Intent ittProjDtlsToHome = new Intent(PMEditProfileActivity.this ,PMHomeActivity.class); + // ittProjDtlsToHome.putExtra("ManagerId",MDId); + startActivity(ittProjDtlsToHome);*/ + return true; + } + + + return super.onOptionsItemSelected(item); + } + + +} diff --git a/app/src/main/java/com/leadcampusapp/PMFundAmountFragment.java b/app/src/main/java/com/leadcampusapp/PMFundAmountFragment.java new file mode 100644 index 0000000..82a47c1 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/PMFundAmountFragment.java @@ -0,0 +1,814 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 22-06-2018. + */ + +import android.app.AlertDialog; +import android.app.Dialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.AsyncTask; +import android.os.Bundle; +import androidx.fragment.app.Fragment; +import android.text.Editable; +import android.text.TextWatcher; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.Button; +import android.widget.EditText; +import android.widget.ListAdapter; +import android.widget.ListView; +import android.widget.ProgressBar; +import android.widget.SimpleAdapter; +import android.widget.TextView; +import android.widget.Toast; + +//import com.android.sripad.leadnew_22_6_2018.R; +import com.leadcampusapp.module.FundProjectList; +import com.leadcampusapp.module.FundProjectListModule; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.Locale; + +public class PMFundAmountFragment extends Fragment { + + ListView list,list_head; + ArrayList> mylist, mylist_title; + ListAdapter adapter_title, adapter; + HashMap map1, map2; + + String[] Names = {"Pramod. K","Uma. K","Shiva. S","Shripad. A"}; + String[] Colleges = {"BVB","KLE","BVB","KLE"}; + String[] ProjectTittle = {"Food","Books","Food","Books"}; + String[] Budget = {"100","0","200","400"}; + String[] Fund = {"100","0","200","400"}; + ArrayList array_image = new ArrayList(); + + FundProjectListModule fundProjectListObj; + ArrayList fundProjectListModules; + private ProgressBar progressBar; + // UnapprovedListAdapter adapter1 ; + FundProjectListModule[] fundInfosarr; + //ArrayList arrayList= new ArrayList(); + + String LeadId,ProjectId; + int Project_id,Lead_id; + int responseCount=0; + int i=0; + EditText userInput; + Integer ManagerId; + + public static final String PREFBook_PM= "prefbook_pm"; //sharedpreference Book + public static final String PrefID_PMID = "prefid_pmid"; // + SharedPreferences shardprefPM_obj; + String str_MangerID; + Integer MDId; + String giventotal,balanceAmount,approvedAmount; + private EditText etSearch; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + View view= inflater.inflate(R.layout.pmfundamount_fragment, container, false); + + list = (ListView) view.findViewById(R.id.lv_fundamt); + list_head = (ListView) view.findViewById(R.id.lv_fundamtHead); + progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + + array_image.add(String.valueOf(R.drawable.cash_bag)); + array_image.add(String.valueOf(R.drawable.cash_bag)); + array_image.add(String.valueOf(R.drawable.cash_bag)); + array_image.add(String.valueOf(R.drawable.cash_bag)); + + //showActivity(); + /* ManagerId = getActivity().getIntent().getExtras().getInt("ManagerId"); + Log.i("tag","MangerID PMProjectDetails="+ManagerId); +*/ + shardprefPM_obj= getActivity().getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MangerID = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + Log.d("str_leadId:",str_MangerID); + // Toast.makeText(this,"LeadId: "+str_MangerID,Toast.LENGTH_LONG).show(); + MDId=Integer.parseInt(str_MangerID); + + + + etSearch = (EditText) view.findViewById(R.id.etSearch); + etSearch.addTextChangedListener(new TextWatcher() { + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + // Call back the Adapter with current character to Filter + } + + @Override + public void beforeTextChanged(CharSequence s, int start, int count,int after) { + } + ; + @Override + public void afterTextChanged(Editable s) { + //adapter.getFilter().filter(s.toString()); + String text = etSearch.getText().toString().toLowerCase(Locale.getDefault()); + if(adapter!=null && text!=null) { + ((SimpleAdapter) adapter).getFilter().filter(text); + } + } + }); + + + + + + + + + + + + + + GetFundProjectDetails getFundProjectDetails = new GetFundProjectDetails(getActivity()); + getFundProjectDetails.execute(MDId); + return view; + } + + /* public void showActivity1() { + + mylist = new ArrayList>(); + mylist_title = new ArrayList>(); + + /**********Display the headings************/ + + /* map1 = new HashMap(); + + map1.put("slno", "SlNo"); + map1.put("one", " Name"); + map1.put("two", " College"); + map1.put("three","Project Tittle"); + map1.put("four","Approved Amount"); + map1.put("five","Fund"); + mylist_title.add(map1); + + + try { + adapter_title = new SimpleAdapter(getContext(), mylist_title, R.layout.pmfundamount_listhead, + new String[]{ "one", "two","three","four","five"}, new int[]{ + R.id.Name, R.id.College, R.id.ProjectTittle, R.id.Budget, R.id.tv_balnce}); + list_head.setAdapter(adapter_title); + } catch (Exception e) { + + } + + /********************************************************/ + + + /**********Display the contents************/ + + /* for (int i = 0; i < Names.length; i++) { + map2 = new HashMap(); + + map2.put("slno", String.valueOf(i + 1)); + map2.put("one", Names[i]); + map2.put("two", Colleges[i]); + map2.put("three", ProjectTittle[i]); + map2.put("four", Budget[i]); + map2.put("five", Fund[i]); + Log.i("tag","Fund[i]="+Fund[i]); + Log.i("tag","Fund[i]="+Fund[i].toString()); + if(Fund[i].toString().equals("0")){ + map2.put("six","00"); + }else { + map2.put("six", array_image.get(i)); + } + mylist.add(map2); + } + + + try { + adapter = new SimpleAdapter(getContext(), mylist, R.layout.pmfundamount_list, + new String[]{"one", "two","three","four","five","six"}, new int[]{ + R.id.Name, R.id.College, R.id.ProjectTittle, R.id.Budget, R.id.Fund, R.id.Fund1}); + list.setAdapter(adapter); + } catch (Exception e) { + + } + + list.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + // String item = ((TextView)view).getText().toString(); + // String selectedItem = (String) parent.getItemAtPosition(position); + Object o = list.getItemAtPosition(position); + String name = ((TextView) view.findViewById(R.id.Name)).getText().toString(); + String College = ((TextView) view.findViewById(R.id.College)).getText().toString(); + String PT = ((TextView) view.findViewById(R.id.ProjectTittle)).getText().toString(); + String Budget = ((TextView) view.findViewById(R.id.Budget)).getText().toString(); + String Fund = ((TextView) view.findViewById(R.id.Fund)).getText().toString(); + String img= String.valueOf(R.drawable.smile_emoji); + + // String currentdate=getCurrentTimeStamp(); + + Toast.makeText(getContext(), "Name: "+name, Toast.LENGTH_LONG).show(); + + LayoutInflater li = LayoutInflater.from(getContext()); + View promptsView = li.inflate(R.layout.pmfund_prompt, null); + + AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder( + getContext(),AlertDialog.THEME_DEVICE_DEFAULT_DARK); + + // set prompts.xml to alertdialog builder + alertDialogBuilder.setView(promptsView); + + final EditText userInput = (EditText) promptsView + .findViewById(R.id.fundamtPromt_et); + + // set dialog message + alertDialogBuilder + .setCancelable(false) + .setPositiveButton("OK", + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog,int id) { + // get user input and set it to result + // edit text + Toast.makeText(getContext(), userInput.getText(), Toast.LENGTH_LONG).show(); + //result.setText(userInput.getText()); + } + }) + .setNegativeButton("Cancel", + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.cancel(); + } + }); + + // create alert dialog + AlertDialog alertDialog = alertDialogBuilder.create(); + + // show it + alertDialog.show(); + + /* map2 = new HashMap(); + + map2.put("one", name); + map2.put("two", College); + map2.put("three", PT); + map2.put("four", Budget); + map2.put("five", Fund); + map2.put("six", img); + mylist.add(map2); + + try { + adapter = new SimpleAdapter(getContext(), mylist, R.layout.pmfundamount_list, + new String[]{"one", "two","three","four","five","six"}, new int[]{ + R.id.Name, R.id.College, R.id.ProjectTittle, R.id.Budget, R.id.Fund,R.id.Fund1}); + list.setAdapter(adapter); + } catch (Exception e) { + + }*/ + /* Intent i= new Intent(getContext(), PMUnapproved_DetailsActivity.class); + i.putExtra("name",name); + startActivity(i);*/ + /* } + + }); + + + }*/ + public static String getCurrentTimeStamp(){ + try { + + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String currentDateTime = dateFormat.format(new Date()); // Find todays date + + return currentDateTime; + } catch (Exception e) { + e.printStackTrace(); + + return null; + } + } + public void showActivity() { + + mylist = new ArrayList>(); + mylist_title = new ArrayList>(); + + /**********Display the headings************/ + + + map1 = new HashMap(); + + // map1.put("slno", "Lead Id"); + map1.put("one", "Name"); + map1.put("two", "Project Title"); + map1.put("three","Approved Amount"); + map1.put("four","Disperse Amount"); + map1.put("five","Balance Amount"); + mylist_title.add(map1); + + + try { + adapter_title = new SimpleAdapter(getContext(), mylist_title, R.layout.pmfundamount_listhead, + new String[]{ "one", "two","three","four","five"}, new int[]{ + R.id.Name, R.id.ProjectTittle, R.id.ApprovedAmt, R.id.DisperseAmt, R.id.BalanceAmt}); + list_head.setAdapter(adapter_title); + } catch (Exception e) { + + } + + /********************************************************/ + +// Log.i("Tag","fundProjectListObj="+fundProjectListObj.getStudent_name()); + Log.i("Tag","fundProjectList.listview_arr.size="+ FundProjectList.listview_arr.size()); + Log.i("Tag","fundProjectListModule.listview_arr.size="+ FundProjectListModule.listview_arr.size()); + + /**********Display the contents************/ + for (int i = 0; i < FundProjectList.listview_arr.size(); i++) { + + map2 = new HashMap(); + map2.put("one", FundProjectList.listview_arr.get(i).getStudent_name()); + map2.put("two", FundProjectList.listview_arr.get(i).getProject_tittle()); + map2.put("three", FundProjectList.listview_arr.get(i).getSanctionAmount()); + map2.put("four", FundProjectList.listview_arr.get(i).getGiventotal()); + map2.put("six", FundProjectList.listview_arr.get(i).getBalanceAmount()); + if(FundProjectList.listview_arr.get(i).getSanctionAmount().equals("0")){ + map2.put("five", String.valueOf(R.drawable.no_cash_bag)); + } + else { + map2.put("five", String.valueOf(R.drawable.cash_bag)); + } + + map2.put("seven", FundProjectList.listview_arr.get(i).getLead_id()); + map2.put("eight", FundProjectList.listview_arr.get(i).getProject_id()); + //map2.put("nine", FundProjectList.listview_arr.get(i).getBalanceAmount()); + + mylist.add(map2); + } + + try { + adapter = new SimpleAdapter(getContext(), mylist, R.layout.pmfund_list, + new String[]{"one", "two","three","four","six","five","seven","eight"}, new int[]{ + R.id.Name, R.id.ProjectTittle, R.id.tv_approved, R.id.tv_disperse, R.id.tv_balnce, R.id.Fund1,R.id.tv_leadid,R.id.tv_projId}); + list.setAdapter(adapter); + } catch (Exception e) { + + } + + list.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + // String item = ((TextView)view).getText().toString(); + // String selectedItem = (String) parent.getItemAtPosition(position); + Object o = list.getItemAtPosition(position); + Log.i("Tag", "o==" + o.toString()); + Log.i("Tag", "position==" + position); + + String name = ((TextView) view.findViewById(R.id.Name)).getText().toString(); + + /* LeadId = FundProjectList.listview_arr.get(position).getLead_id(); + ProjectId = FundProjectList.listview_arr.get(position).getProject_id();*/ + + LeadId = ((TextView) view.findViewById(R.id.tv_leadid)).getText().toString(); + ProjectId = ((TextView) view.findViewById(R.id.tv_projId)).getText().toString(); + + Project_id = Integer.parseInt(ProjectId); + + + // Lead_id=Integer.parseInt(LeadId); + + //final String BalanceAmt = FundProjectList.listview_arr.get(position).getBalanceAmount(); + + final String BalanceAmt = ((TextView) view.findViewById(R.id.tv_balnce)).getText().toString(); + + /* final String BalanceAmt; + TextView txtViewBalance = (TextView) view.findViewById(R.id.tv_balAmt); + if(txtViewBalance.getVisibility()==View.VISIBLE) { + BalanceAmt = ((TextView) view.findViewById(R.id.tv_balAmt)).getText().toString(); + } + else{ + BalanceAmt = ((TextView) view.findViewById(R.id.tv_balnce)).getText().toString(); + }*/ + + // Toast.makeText(getContext(), "item=" + name, Toast.LENGTH_LONG).show(); + Log.i("Tag", "Lead_id=" + LeadId); + Log.i("Tag", "Project_id=" + ProjectId); + Log.i("Tag", "BalanceAmt=" + BalanceAmt); + /* Toast.makeText(getContext(), "Lead_id="+Lead_id, Toast.LENGTH_LONG).show(); + Toast.makeText(getContext(), "Project_type="+Project_type+"Action_plan="+Action_plan, Toast.LENGTH_LONG).show(); + Toast.makeText(getContext(), "Benficiaries="+Benficiaries+"Objectivies="+Objectivies, Toast.LENGTH_LONG).show();*/ + /* Intent i= new Intent(getContext(), PMUnapproved_DetailsActivity.class); + i.putExtra("name",name); + i.putExtra("lead_id",Lead_id); + i.putExtra("Project_id",Project_id); + startActivity(i);*/ + + /*approvedAmount= FundProjectList.listview_arr.get(position).getSanctionAmount(); + balanceAmount = FundProjectList.listview_arr.get(position).getBalanceAmount(); + giventotal = FundProjectList.listview_arr.get(position).getGiventotal();*/ + + approvedAmount = ((TextView) view.findViewById(R.id.tv_approved)).getText().toString(); + balanceAmount = BalanceAmt; + giventotal = ((TextView) view.findViewById(R.id.tv_disperse)).getText().toString(); + + + + Log.i("tag","giventotal="+giventotal); + Log.i("tag","balanceAmount="+balanceAmount); + + /* if (FundProjectList.listview_arr.get(position).getBalanceAmount().equals("0")) { + view.setEnabled(false); + view.setOnClickListener(null); + Toast.makeText(getActivity(),"Balance Amount is Zero ",Toast.LENGTH_LONG).show(); + }*/ + if (balanceAmount.equals("0")) { + view.setEnabled(false); + view.setOnClickListener(null); + Toast.makeText(getActivity(),"Balance Amount is Zero ",Toast.LENGTH_LONG).show(); + } + else { + + LayoutInflater li = LayoutInflater.from(getContext()); + View promptsView = li.inflate(R.layout.pmfund_prompt, null); + + AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder( + getContext(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT); + + // set prompts.xml to alertdialog builder + alertDialogBuilder.setView(promptsView); + userInput = (EditText) promptsView.findViewById(R.id.fundamtPromt_et); + userInput.setText(BalanceAmt); + + // set dialog message + + + alertDialogBuilder + .setCancelable(false) + .setPositiveButton("OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + // get user input and set it to result + // edit text + //result.setText(userInput.getText()); + + /* if(userInput.toString().length() == 0) { + userInput.setError( "Amount required!" ); + } + if(Integer.valueOf(balanceAmount)>Integer.valueOf(giventotal)) { + Toast.makeText(getContext(), "Fund amount cannot be more than balance amount ", Toast.LENGTH_LONG).show(); } + else { + // long BalanceAmountdbl=Integer.valueOf(SanctionAmount).intValue()-Integer.valueOf(giventotal).intValue(); + SubmitFund submitFund = new SubmitFund(getActivity()); + submitFund.execute(); + Toast.makeText(getContext(), userInput.getText(), Toast.LENGTH_LONG).show(); + }*/ + + } + }) + .setNegativeButton("Cancel", + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.cancel(); + } + }); + + // create alert dialog + AlertDialog alertDialog = alertDialogBuilder.create(); + + // show it + alertDialog.show(); + + Button theButton = alertDialog.getButton(DialogInterface.BUTTON_POSITIVE); + theButton.setOnClickListener(new CustomListener(alertDialog)); + } + } + + }); + } + + class CustomListener implements View.OnClickListener { + private final Dialog dialog; + public CustomListener(Dialog dialog) { + this.dialog = dialog; + } + @Override + public void onClick(View v) { + // put your code here + // String mValue = userInput.getText().toString(); + if(validation()) { + // dialog.dismiss(); + + if (fundAmt()) { + SubmitFund submitFund = new SubmitFund(getActivity()); + submitFund.execute(); + } else { + Toast.makeText(getContext(), "Fund amount cannot be more than balance amount ", Toast.LENGTH_LONG).show(); + } + } + /*else{ + Toast.makeText(getActivity(), "Invalid data", Toast.LENGTH_SHORT).show(); + }*/ + } + } + public boolean validation(){ + + Boolean bpmcomments=true,bamount=true; + + + if( userInput.getText().toString().length() == 0 ){ + userInput.setError( "Amount required!" );bpmcomments=false;} + + if(bpmcomments&&bamount) { + return true; + }else{return false;} + } + public boolean fundAmt(){ + + Boolean bpmcomments=true,bamount=true; + + String balanceAmt=userInput.getText().toString(); + Integer approvedAmtInt=Integer.parseInt(approvedAmount); + Integer balanceAmtInt=Integer.parseInt(balanceAmt); + Integer giventotalInt=Integer.parseInt(giventotal); + + Integer totalBalanceInt=approvedAmtInt-giventotalInt; + + Log.i("tag","balanceAmtInt="+balanceAmtInt+"giventotalInt="+giventotalInt+"totalBalanceInt="+totalBalanceInt); + + if( balanceAmtInt>totalBalanceInt ){ + // Toast.makeText(getContext(), "Fund amount cannot be more than balance amount ", Toast.LENGTH_LONG).show(); } + bpmcomments=false;} + + if(bpmcomments&&bamount) { + return true; + }else{return false;} + } + public class SubmitFund extends AsyncTask { + + AlertDialog alertDialog; + // private ProgressBar progressBar; + Context context; + private ProgressDialog progressDialog; + + SubmitFund (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapPrimitive response = SubmitFundDetails(); + + // SoapObject response = ReApplyProjectDetails(); + Log.d("Soap response issssss",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + // progressBar = (ProgressBar) findViewById(R.id.progressBar); + // progressBar.setVisibility(View.VISIBLE); + progressDialog.setMessage("Loading"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + if(result!=null) { + if (result.toString().equals("Error")) { + Toast.makeText(context, "Error occured while saving to database", Toast.LENGTH_LONG).show(); + } else { + Toast.makeText(context, "Amount funded successfully", Toast.LENGTH_LONG).show(); + Intent ittEditProjToProjStatus = new Intent(getActivity(), PMProjectDetailActivity.class); + ittEditProjToProjStatus.putExtra("pageCount", 3); + startActivity(ittEditProjToProjStatus); + } + } + // progressBar.setVisibility(View.GONE); + progressDialog.dismiss(); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + private SoapPrimitive SubmitFundDetails() { + String METHOD_NAME = "AddFundAmount"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/AddFundAmount"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + // long projectIds = (long) Integer.valueOf(projectId); + request.addProperty("PDId",Project_id); + Log.d("PDIdssssssxxxx","hi"); + Log.d("PDIdssssssxxxx", String.valueOf(Project_id)); + request.addProperty("ManagerId",MDId); + request.addProperty("LeadId",LeadId); + Log.d("LeadIdxxxxxx",LeadId); + /* int themeId = hashProjTypeId.get(spin_projectType.getSelectedItem().toString()); + Log.d("themeidsssssxxxx", String.valueOf(themeId)); + request.addProperty("Theme",String.valueOf(themeId)); + long beneficiaryNo = (long) Integer.valueOf(edt_noOfBeneficiaries.getText().toString()); + Log.d("beneficiaryNosssxxxx", String.valueOf(beneficiaryNo)); + request.addProperty("BeneficiaryNo",beneficiaryNo); + Log.d("objectivesxxxxxx",edt_objectives.getText().toString()); + request.addProperty("Objectives",edt_objectives.getText().toString()); + Log.d("actionplansxxxxxx",edt_actionPlan.getText().toString()); + request.addProperty("ActionPlan",edt_actionPlan.getText().toString()); + Log.d("actionplansxxxxxx",edt_amount.getText().toString()); + request.addProperty("SanctionAmount",edt_amount.getText().toString());*/ + request.addProperty("Amount",userInput.getText().toString()); + Log.d("Amountsxxxxxx",userInput.getText().toString()); + // request.addProperty("ManagerComments",edt_pmcomment.getText().toString()); + // Log.d("Requestisxxxxx",request.toString()); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + // Log.d("soap response1xxxx",envelope.getResponse().toString()); + + // SoapObject response = (SoapObject) envelope.getResponse(); + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + //Log.e("soapupdateProjectDtlsss",envelope.getResponse().toString()); + + //return null; + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + } + return null; + + } + + public class GetFundProjectDetails extends AsyncTask { + + Context context; + + GetFundProjectDetails (Context ctx){ + context = ctx; + } + + + @Override + protected SoapObject doInBackground(Integer... params) { + Integer ManagerId = (Integer) params [0]; + //SoapObject response = getStudDtls(leadid); + + //unapprovedProjectListObj = new UnapprovedProjectListModule(); + fundProjectListModules = new ArrayList(); + + String METHOD_NAME = "GetFundstatusList"; + String NamespaceMail="http://mis.leadcampus.org/", SOAP_ACTION1="http://mis.leadcampus.org/GetFundstatusList";//namespace+methodname + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + request.addProperty("ManagerId", ManagerId); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapObject response = (SoapObject) envelope.getResponse(); + Log.d("Tag","soap response Fund"+response.toString()); + + responseCount = response.getPropertyCount(); + + + Log.d("count", String.valueOf(response.getPropertyCount())); + + FundProjectListModule.listview_arr.clear(); + FundProjectList.listview_arr.clear(); + ArrayList innerObj_Class_centers = null; + if(responseCount>0) { + //complitionProjectListModules = new ArrayList(); + // ArrayList arrayList = new ArrayList(); + fundInfosarr=new FundProjectListModule[responseCount]; + for (i = 0; i < responseCount; i++) + { + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + /* fundProjectListObj.setStudent_name(response_soapobj.getProperty("StudentName").toString()); + fundProjectListObj.setProject_tittle(response_soapobj.getProperty("Title").toString()); + fundProjectListObj.setLead_id(response_soapobj.getProperty("Lead_Id").toString()); + fundProjectListObj.setProject_id(response_soapobj.getProperty("PDId").toString()); + fundProjectListObj.setSanctionAmount(response_soapobj.getProperty("SanctionAmount").toString()); + fundProjectListObj.setGiventotal(response_soapobj.getProperty("giventotal").toString()); + + fundProjectListModules.add(fundProjectListObj); + + Log.d("tag","fundProjectListObj.get(i)="+fundProjectListModules.get(i).getStudent_name()); + Log.d("tag","fundProjectListModules="+fundProjectListModules.size()); + Log.d("tag","fundProjectListObj="+fundProjectListObj.getStudent_name()); +*/ + String Sname=response_soapobj.getProperty("StudentName").toString(); + String ProjectTittle=response_soapobj.getProperty("Title").toString(); + String SanctionAmount=response_soapobj.getProperty("SanctionAmount").toString(); + String Lead_id=response_soapobj.getProperty("Lead_Id").toString(); + String ProjectId=response_soapobj.getProperty("PDId").toString(); + String giventotal=response_soapobj.getProperty("giventotal").toString(); + long BalanceAmountdbl=Integer.valueOf(SanctionAmount).intValue()-Integer.valueOf(giventotal).intValue(); + String BalanceAmount=String.valueOf(BalanceAmountdbl); + Log.i("Tag","BalanceAmountdbl"+BalanceAmountdbl); + Log.i("Tag","BalanceAmountdbl"+BalanceAmountdbl); + fundInfosarr[i]=fundProjectListObj; + Log.i("Tag","Sname"+Sname); + Log.i("Tag","ProjectTittle"+ProjectTittle); + FundProjectList.listview_arr.add(new FundProjectList(Lead_id, ProjectId,Sname, ProjectTittle,SanctionAmount,giventotal,BalanceAmount)); + + Log.i("Tag","FundProjectListModule.getAmt="+ FundProjectList.listview_arr.size()); + } + } + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.d("exception outside",t.getMessage().toString()); + } + + return null; + } + + @Override + protected void onPreExecute() { + + progressBar.setVisibility(View.VISIBLE); + } + + @Override + protected void onPostExecute(SoapObject result) { + progressBar.setVisibility(View.GONE); + + if(result!=null) { + Log.i("Tag", "fundInfosarr===" + fundInfosarr); + Log.i("Tag", "fundInfosarr.length===" + fundInfosarr.length); + showActivity(); + } + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + +} diff --git a/app/src/main/java/com/leadcampusapp/PMGallaryActivity.java b/app/src/main/java/com/leadcampusapp/PMGallaryActivity.java new file mode 100644 index 0000000..27afa8d --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/PMGallaryActivity.java @@ -0,0 +1,227 @@ +package com.leadcampusapp; + +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.graphics.Bitmap; +import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; +import android.util.Log; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.AdapterView; +import android.widget.Gallery; +import android.widget.ImageView; +import android.widget.TextView; + +//import com.android.sripad.leadnew_22_6_2018.R; + +import java.util.ArrayList; + +public class PMGallaryActivity extends AppCompatActivity implements ConnectivityReceiver.ConnectivityReceiverListener{ + + ImageView selectedImage; + ArrayList bitmapList; + String LeadId,PDId; + String Student_Image_Path,MobileNo; + String Name; + Integer ManagerId; + + public static final String PREFBook_PM= "prefbook_pm"; //sharedpreference Book + public static final String PrefID_PMID = "prefid_pmid"; // + SharedPreferences shardprefPM_obj; + String str_MangerID; + Integer MDId; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_pmgallary); + + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + // getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background)); + + View actionBarView = getSupportActionBar().getCustomView(); + TextView actionBarTV = (TextView) actionBarView.findViewById(R.id.txt_actionBar); + actionBarTV.setText("Gallery"); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); + + Gallery gallery = (Gallery) findViewById(R.id.gallery); + + bitmapList = GalleryImageBitmap.getBitmapGalleryImage(); + + selectedImage=(ImageView)findViewById(R.id.imageView); + selectedImage.setImageBitmap(bitmapList.get(0)); + + Intent intent = getIntent(); + Name = intent.getStringExtra("name"); + Log.e("TAG","name="+Name); + + LeadId=intent.getStringExtra("LeadId"); + PDId = intent.getStringExtra("PDId"); + MobileNo=intent.getStringExtra("MobileNo"); + Student_Image_Path=intent.getStringExtra("Student_Image_Path"); + + /* ManagerId = getIntent().getExtras().getInt("ManagerId"); + Log.i("tag","MangerID PMProjectDetails="+ManagerId);*/ + shardprefPM_obj=this.getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MangerID = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + Log.d("str_leadId:",str_MangerID); + // Toast.makeText(this,"LeadId: "+str_MangerID,Toast.LENGTH_LONG).show(); + MDId=Integer.parseInt(str_MangerID); + + Log.e("TAG","LeadId="+LeadId); + Log.e("TAG","PDId="+PDId); + + gallery.setSpacing(5); + gallery.setAnimationDuration(2000); + final GalleryImageAdapter galleryImageAdapter= new GalleryImageAdapter(this,bitmapList); + + gallery.setAdapter(galleryImageAdapter); + + + gallery.setOnItemClickListener(new AdapterView.OnItemClickListener() { + public void onItemClick(AdapterView parent, View v, int position, long id) { + // show the selected Image + //selectedImage.setImageResource(galleryImageAdapter.mImageIds[position]); + selectedImage.setImageBitmap(galleryImageAdapter.mBitmapList.get(position)); + } + }); + } + + + @Override + protected void onResume() { + super.onResume(); + + // register connection status listener + MyApplication.getInstance().setConnectivityListener(this); + } + + @Override + public void onNetworkConnectionChanged(boolean isConnected) { + showSnack(isConnected); + } + + private void showSnack(boolean isConnected) { + + if (!isConnected) { + + AlertDialog.Builder adb = new AlertDialog.Builder(PMGallaryActivity.this); + //adb.setView(alertDialogView); + + adb.setTitle("Sorry! Not connected to the internet"); + + adb.setIcon(android.R.drawable.ic_dialog_alert); + + adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + + adb.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + adb.setCancelable(true); + adb.show(); + } + +/* String message; + int color; + if (isConnected) { + message = "Good! Connected to Internet"; + color = Color.WHITE; + } else { + message = "Sorry! Not connected to internet"; + color = Color.RED; + } + + Snackbar snackbar = Snackbar + .make(findViewById(R.id.coordinator_layout), message, Snackbar.LENGTH_LONG); + + View sbView = snackbar.getView(); + TextView textView = (TextView) sbView.findViewById(android.support.design.R.id.snackbar_text); + textView.setTextColor(color); + snackbar.show();*/ + } + + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_main, menu); + MenuItem action_editProfile = menu.findItem(R.id.action_editProfile); + action_editProfile.setVisible(false); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + + /* if (id == R.id.action_editProfile) { + Intent itthomeToEditProfile = new Intent(PMComplitionProjectActivity.this ,PMEditProfileActivity.class); + startActivity(itthomeToEditProfile); + return true; + }*/ + + + if (id == R.id.action_logout) { + Intent itthomeToLogin = new Intent(PMGallaryActivity.this ,LoginActivity.class); + startActivity(itthomeToLogin); + return true; + } + + if (id == android.R.id.home) { + /* Intent ittProjDtlsToHome = new Intent(PMGallaryActivity.this ,PMComplitionProjectActivity.class); + ittProjDtlsToHome.putExtra("ManagerId",MDId); + ittProjDtlsToHome.putExtra("name",Name); + ittProjDtlsToHome.putExtra("projectId",PDId); + ittProjDtlsToHome.putExtra("LeadId",LeadId); + ittProjDtlsToHome.putExtra("MobileNo",MobileNo); + ittProjDtlsToHome.putExtra("Student_Image_Path",Student_Image_Path); + startActivity(ittProjDtlsToHome);*/ + + Intent ittProjDtlsToHome = new Intent(PMGallaryActivity.this ,PMComplitionProjectActivity.class); + /* ittProjDtlsToHome.putExtra("ManagerId",MDId); + ittProjDtlsToHome.putExtra("name",Name); + ittProjDtlsToHome.putExtra("projectId",PDId); + ittProjDtlsToHome.putExtra("LeadId",LeadId); + ittProjDtlsToHome.putExtra("MobileNo",MobileNo); + ittProjDtlsToHome.putExtra("Student_Image_Path",Student_Image_Path);*/ + + ittProjDtlsToHome.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); + + startActivity(ittProjDtlsToHome); + return true; + } + + return super.onOptionsItemSelected(item); + } + @Override + public void onBackPressed() + { + super.onBackPressed(); +/* Intent ittProjDtlsToHome = new Intent(PMGallaryActivity.this ,PMComplitionProjectActivity.class); + ittProjDtlsToHome.putExtra("ManagerId",MDId); + ittProjDtlsToHome.putExtra("name",Name); + ittProjDtlsToHome.putExtra("projectId",PDId); + ittProjDtlsToHome.putExtra("LeadId",LeadId); + ittProjDtlsToHome.putExtra("MobileNo",MobileNo); + ittProjDtlsToHome.putExtra("Student_Image_Path",Student_Image_Path); + startActivity(ittProjDtlsToHome);*/ + } +} diff --git a/app/src/main/java/com/leadcampusapp/PMGetThemeWiseProjectCount.java b/app/src/main/java/com/leadcampusapp/PMGetThemeWiseProjectCount.java new file mode 100644 index 0000000..ce18427 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/PMGetThemeWiseProjectCount.java @@ -0,0 +1,410 @@ +package com.leadcampusapp; + +import android.app.ProgressDialog; +import android.content.Context; +import android.os.AsyncTask; +import androidx.appcompat.app.AppCompatActivity; +import android.os.Bundle; +import android.util.Log; + +//import com.android.sripad.leadnew_22_6_2018.R; +import com.github.mikephil.charting.charts.BarChart; +import com.github.mikephil.charting.data.BarData; +import com.github.mikephil.charting.data.BarDataSet; +import com.github.mikephil.charting.data.BarEntry; +import com.github.mikephil.charting.utils.ColorTemplate; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.util.ArrayList; + +public class PMGetThemeWiseProjectCount extends AppCompatActivity { + + private int MDId; + private ArrayList listThemeName; + private ArrayList listCount; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_pmget_theme_wise_project_count); + + + listThemeName = new ArrayList(); + listCount = new ArrayList(); + + MDId = getIntent().getIntExtra("MDId",0); + Log.d("MDIdiss", String.valueOf(MDId)); + + GetThemeWiseProjCount getThemeWiseProjCount = new GetThemeWiseProjCount(PMGetThemeWiseProjectCount.this); + getThemeWiseProjCount.execute(); + } + + + public class GetThemeWiseProjCount extends AsyncTask { + + Context context; + //AlertDialog alertDialog; + private ProgressDialog progressDialog; + + //private ProgressBar progressBar; + + GetThemeWiseProjCount (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String str_leadId = (String) params [0]; + //String versionCode = (String) params[2]; + + SoapObject response = getThemeWiseProjCount(); + + //Log.d("GetThemeWiseProjCout",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + + progressDialog.setMessage("Loading"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + + } + + @Override + protected void onPostExecute(SoapObject result) { + + Log.d("GetStudentDetailssresp",result.toString()); + + /* SoapPrimitive S_Status,S_ThemeName,S_Counts; + Object O_Status,O_ThemeName,O_Counts; + String str_Status=null,str_ThemeName=null,str_Counts=null; + + for(int i=0;i bargroup1 = new ArrayList<>(); + bargroup1.add(new BarEntry(8f, 0)); + bargroup1.add(new BarEntry(2f, 1)); + bargroup1.add(new BarEntry(5f, 2)); + bargroup1.add(new BarEntry(20f, 3)); + bargroup1.add(new BarEntry(15f, 4)); + bargroup1.add(new BarEntry(19f, 5)); + +// create BarEntry for Bar Group 1 + ArrayList bargroup2 = new ArrayList<>(); + bargroup2.add(new BarEntry(6f, 0)); + bargroup2.add(new BarEntry(10f, 1)); + bargroup2.add(new BarEntry(5f, 2)); + bargroup2.add(new BarEntry(25f, 3)); + bargroup2.add(new BarEntry(4f, 4)); + bargroup2.add(new BarEntry(17f, 5)); + +// creating dataset for Bar Group1 + BarDataSet barDataSet1 = new BarDataSet(bargroup1, "Bar Group 1"); + +//barDataSet1.setColor(Color.rgb(0, 155, 0)); + barDataSet1.setColors(ColorTemplate.COLORFUL_COLORS); + +// creating dataset for Bar Group 2 + BarDataSet barDataSet2 = new BarDataSet(bargroup2, "Bar Group 2"); + barDataSet2.setColors(ColorTemplate.COLORFUL_COLORS); + + List dataSets = new ArrayList<>(); // combined all dataset into an arraylist + dataSets.add(barDataSet1); + dataSets.add(barDataSet2); + + + + + + + + //BarDataSet bardataset = new BarDataSet(entries, "Cells"); + + ArrayList labels = new ArrayList(); + labels.add("2016"); + labels.add("2015"); + labels.add("2014"); + labels.add("2013"); + labels.add("2012"); + labels.add("2011"); + labels.add("2010"); + labels.add("2009"); + labels.add("2008"); + labels.add("2007"); + labels.add("2006"); + labels.add("2005"); + labels.add("2004"); + labels.add("2003"); + + + //BarData data = new BarData(labels,dataSets); + BarData data = new BarData(labels,dataSets); + barChart.setData(data); // set the data and list of lables into chart + + barChart.setDescription("Set Bar Chart Description"); // set the description + + //bardataset.setColors(ColorTemplate.COLORFUL_COLORS); + + barChart.animateY(5000);*/ + + + + + + //HorizontalBarChart barChart = (HorizontalBarChart) findViewById(R.id.barchart); + BarChart barChart = (BarChart) findViewById(R.id.barchart); + + ArrayList entries = new ArrayList<>(); + + + for(int k=0;k labels = new ArrayList(); + labels.add("2016"); + labels.add("2015"); + labels.add("2014"); + labels.add("2013"); + labels.add("2012"); + labels.add("2011"); + + // barChart.getXAxis().setValueFormatter(new IndexAxisValueFormatter(labels)); + // XAxis xAxis = barChart.getXAxis(); + // xAxis.setValueFormatter(new IndexAxisValueFormatter(labels)); + + String[] arrString = new String[listThemeName.size()]; + + for(int l=0;l"); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + Log.d("soap responseyyyyyyy",envelope.getResponse().toString()); + SoapObject response = (SoapObject) envelope.getResponse(); + Log.d("soap responseyyyyyyy",response.toString()); + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.d("exception outside",t.getMessage().toString()); + } + return null; + + + } + + +} diff --git a/app/src/main/java/com/leadcampusapp/PMHomeActivity.java b/app/src/main/java/com/leadcampusapp/PMHomeActivity.java new file mode 100644 index 0000000..e63d9af --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/PMHomeActivity.java @@ -0,0 +1,2213 @@ +package com.leadcampusapp; + +import android.annotation.SuppressLint; +import android.app.AlertDialog; +import android.app.Dialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.pm.PackageManager; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.Color; +import android.graphics.Point; +import android.os.AsyncTask; +import android.os.Build; +import android.os.Bundle; +import android.os.Handler; + +import androidx.core.app.ActivityCompat; +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.RecyclerView; + +import android.provider.Settings; +import android.telephony.TelephonyManager; +import android.util.DisplayMetrics; +import android.util.Log; +import android.view.Display; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.view.Window; +import android.view.WindowManager; +import android.view.animation.Animation; +import android.view.animation.AnimationUtils; +import android.widget.Button; +import android.widget.EditText; +import android.widget.GridView; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.ProgressBar; +import android.widget.TextView; +import android.widget.Toast; + +import com.google.firebase.iid.FirebaseInstanceId; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.UUID; + +//import com.android.sripad.leadnew_22_6_2018.R; + +public class PMHomeActivity extends AppCompatActivity implements ConnectivityReceiver.ConnectivityReceiverListener { + + TextView about_TV, projectDetails_TV, events_TV, news_TV, contactus_TV, request_TV; + ImageView about_IV, projectDetails_IV, events_IV, news_IV, contactus_IV, request_IV; + TextView textCartItemCompliteCount, textCartItemApprovedCount, textCartItemUnApprovedCount; + int mCartItemCount = 110; + ProgressBar progressBar; + private boolean doubleBackToExitPressedOnce = false; + + TextView compeleted_tv, pending_tv, approved_tv, tshirt_tv; + + // String[] descriptionData = {"Student", "Leader", "Master", "Ambassador"}; + + int ManagerId; + String ManagerName, PMEmailId, PM_Mobile, PMLocation, PMImgUrl; + String str_responsecount, str_responseStatus, str_studentcount, str_collegecount, str_TshirtStatus, str_TshirtRequestCount; + String ApprovedCount = "0", ComplitedCount = "0", UnapprovedCount = "0", RequestForCompletion = "0", Rejected = "0", RequestForModification = "0", TshirtStatus = "0"; + TextView txt_Name, txt_mailid, txt_mobile; + ImageView iv_profilepic; + + public static final String PREFBook_PM = "prefbook_pm"; //sharedpreference Book + public static final String PrefID_PMID = "prefid_pmid"; // + public static final String PrefID_pmName = "prefid_pmname"; // + public static final String PrefID_PMEMailID = "prefid_pmemailid"; // + public static final String PrefID_PMMobile = "prefid_pmmobile"; // + public static final String PrefID_pmlocation = "prefid_pmlocation"; // + public static final String PrefID_pmimageurl = "prefid_pmimgurl"; // + public static final String PrefID_pm_username = "prefid_pm_username"; // + public static final String PrefID_pm_password = "prefid_pm_password"; // + + public static final String PREFBook_Stud = "prefbook_stud"; //sharedpreference Book + public static final String PrefID_Role = "prefid_role"; + public static final String PrefID_RegID = "prefid_regid"; + SharedPreferences shardpref_S_obj; + + + SharedPreferences shardprefPM_obj; + SharedPreferences.Editor editor_PM; + String str_MangerID,str_role,str_regId, str_MangerName, str_ManagerEmail, str_ManagerMaobile, str_ManagerLocation, str_MangerImg; + Integer MDId; + + Class_URL config_obj = new Class_URL(); + public static final String PREFBook_LoginTrack = "prefbook_logintrack"; + public static final String PrefID_WhereToGo = "prefid_wheretogo"; // + SharedPreferences shardprefLoginTrack_obj; + SharedPreferences.Editor editor_LoginTrack; + + private Button themeWiseProjCount_BT; + + RecyclerView recyclerView; + ArrayList arrayList; + + GridView gridview; + + public static final String PREFBook_PM_Count = "prefbook_pm_count"; //sharedpreference Book + public static final String PrefID_UNCount = "prefid_UNCount"; // + public static final String PrefID_ComCount = "prefid_ComCount"; // + public static final String PrefID_AppCount = "prefid_AppCount"; // + public static final String PrefID_Tshirt = "prefID_Tshirt"; + public static final String PrefID_ReqModCount = "prefid_ReqModCount"; // + public static final String PrefID_RejCount = "prefid_RejCount"; // + public static final String PrefID_ReqComCount = "prefid_ReqComCount"; // + + SharedPreferences shardprefPM_obj_count; + SharedPreferences.Editor editor_PM_count; + + /* public static String[] osNameList = { + "Android", + "iOS", + "Linux", + "MacOS", + "MS DOS", + "Symbian", + "Windows 10", + "Windows XP", + }; + public static int[] osImages = { + R.drawable.about, + R.drawable.project, + R.drawable.event, + R.drawable.news, + R.drawable.analytical, + R.drawable.masters,};*/ + + + String Str_ManagerName, Str_PMEmailId, Str_PM_Mobile, Str_PMLocation, Str_Manager_Id, Str_PMImageURL, str_pm_username, str_pm_password, Str_FCMName; + + + private ProgressDialog progressDialog_pmswiperefresh; + private String serverPath = Class_URL.ServerPath.toString().trim(); + SwipeRefreshLayout swipeToRefresh_pmhomeactivity; + Class_InternetDectector internetDectector; + Boolean isInternetPresent = false; + + ImageView complited_img, pending_img, approved_img, tshirt_img; + Integer complited_count = 0, pending_count = 0, approved_count = 0, tshirt_count = 0; + String completed_str, pending_str, approved_str, tshirt_str = "0"; + + + TelephonyManager tm1 = null; + String myVersion, deviceBRAND, deviceHARDWARE, devicePRODUCT, deviceUSER, deviceModelName, deviceId, tmDevice, tmSerial, androidId, simOperatorName, sdkver, mobileNumber; + int sdkVersion, Measuredwidth = 0, Measuredheight = 0, update_flage = 0; + AsyncTask mRegisterTask; + String regId = "leadxz"; + private String versioncode; + EditText username_et,password_et, dialognewpwd_et,dialogconfpwd_et; + String str_newPwd; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.pm_activity_main); + + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + // getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background)); + progressBar = (ProgressBar) findViewById(R.id.progressBar); + View actionBarView = getSupportActionBar().getCustomView(); + TextView actionBarTV = (TextView) actionBarView.findViewById(R.id.txt_actionBar); + actionBarTV.setText("Mentor Profile"); + + + swipeToRefresh_pmhomeactivity = (SwipeRefreshLayout) findViewById(R.id.swipeToRefresh_pmhomeactivity); + + + shardprefLoginTrack_obj = this.getSharedPreferences(PREFBook_LoginTrack, Context.MODE_PRIVATE); + editor_LoginTrack = shardprefLoginTrack_obj.edit(); + editor_LoginTrack.putString(PrefID_WhereToGo, config_obj.packagename + "PMHomeActivity"); + editor_LoginTrack.commit(); + + + shardprefPM_obj_count = getSharedPreferences(PREFBook_PM_Count, Context.MODE_PRIVATE); + + shardprefPM_obj = getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MangerID = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + Log.d("str_leadId:", str_MangerID); + // Toast.makeText(this,"LeadId: "+str_MangerID,Toast.LENGTH_LONG).show(); + MDId = Integer.parseInt(str_MangerID); + + shardprefPM_obj.getString(PrefID_PMEMailID, "").trim(); + str_ManagerEmail = shardprefPM_obj.getString(PrefID_PMEMailID, "").trim(); + Log.d("str_ManagerEmail:", str_ManagerEmail); + // Toast.makeText(this,"LeadId: "+str_MangerID,Toast.LENGTH_LONG).show(); + + shardprefPM_obj.getString(PrefID_pmName, "").trim(); + str_MangerName = shardprefPM_obj.getString(PrefID_pmName, "").trim(); + Log.d("str_MangerName:", str_MangerName); + // Toast.makeText(this,"LeadId: "+str_MangerID,Toast.LENGTH_LONG).show(); + + shardprefPM_obj.getString(PrefID_PMMobile, "").trim(); + str_ManagerMaobile = shardprefPM_obj.getString(PrefID_PMMobile, "").trim(); + Log.d("str_ManagerMaobile:", str_ManagerMaobile); + // Toast.makeText(this,"LeadId: "+str_MangerID,Toast.LENGTH_LONG).show(); + shardprefPM_obj.getString(PrefID_pmimageurl, "").trim(); + str_MangerImg = shardprefPM_obj.getString(PrefID_pmimageurl, "").trim(); + Log.d("str_MangerImg:", str_MangerImg); + + + str_pm_username = shardprefPM_obj.getString(PrefID_pm_username, "").trim(); + Log.e("str_pm_username:", str_pm_username); + str_pm_password = shardprefPM_obj.getString(PrefID_pm_password, "").trim(); + Log.e("str_pm_passwrd:", str_pm_password); + + shardpref_S_obj= getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + shardpref_S_obj.getString(PrefID_Role, "").trim(); + str_regId = shardpref_S_obj.getString(PrefID_RegID, "").trim(); + str_role = shardpref_S_obj.getString(PrefID_Role, "").trim(); + Log.e("str_role:", str_role); + + /* shardprefPM_obj.getString(PrefID_pmlocation, "").trim(); + str_ManagerLocation = shardprefPM_obj.getString(PrefID_pmlocation, "").trim(); + Log.d("str_ManagerLocation:",str_ManagerLocation); +*/ + // Intent intent = getIntent(); + /* String MangerID=intent.getStringExtra("ManagerId"); + Log.i("tag","MangerID="+MangerID); + if(MangerID.equals("null")){ + ManagerId=1; + }else + { + ManagerId = Integer.parseInt(MangerID); + Log.i("tag","ManagerId="+ManagerId); + }*/ + // String MangerID=intent.getStringExtra("ManagerId"); +/* ManagerId = getIntent().getExtras().getInt("ManagerId"); + Log.i("tag","MangerID PMProjectDetails="+ManagerId); +*/ + /* ManagerName = intent.getStringExtra("ManagerName"); + PMEmailId= intent.getStringExtra("PMEmailId"); + PM_Mobile= intent.getStringExtra("PM_Mobile"); + PMLocation= intent.getStringExtra("PMLocation"); + PMImgUrl=intent.getStringExtra("PMImgUrl");**/ + + Log.i("str_MangerImg=", str_MangerImg); + txt_Name = (TextView) findViewById(R.id.txt_Name); + txt_mailid = (TextView) findViewById(R.id.txt_mailid); + txt_mobile = (TextView) findViewById(R.id.txt_mobile); + // txt_location=(TextView)findViewById(R.id.txt_location); + iv_profilepic = (ImageView) findViewById(R.id.iv_profilepic); + + approved_tv = (TextView) findViewById(R.id.approved_tv); + compeleted_tv = (TextView) findViewById(R.id.compeleted_tv); + pending_tv = (TextView) findViewById(R.id.pending_tv); + tshirt_tv = (TextView) findViewById(R.id.tshirt_tv); + + approved_img = (ImageView) findViewById(R.id.approved_img); + pending_img = (ImageView) findViewById(R.id.pending_img); + complited_img = (ImageView) findViewById(R.id.complited_img); + tshirt_img = (ImageView) findViewById(R.id.tshirt_img); + + txt_Name.setText(str_MangerName); + txt_mailid.setText(str_ManagerEmail); + ; + + txt_mobile.setText(str_ManagerMaobile); + + /* TextView chart_TV=(TextView) findViewById(R.id.chart_TV); + ImageView chart_IV = (ImageView) findViewById(R.id.chart_IV);*/ + /* if(str_ManagerLocation.equals("anyType{}") || str_ManagerLocation.equals(null)){ + txt_location.setText(""); + }else{ + txt_location.setText(str_ManagerLocation); + }*/ + + GetProjectCount getProjectCount = new GetProjectCount(this); + getProjectCount.execute(MDId); + + GridView gridView = (GridView) findViewById(R.id.gridview); + gridView.setAdapter(new GridAdapterPMFirst(this)); + + GridView gridViewSecond = (GridView) findViewById(R.id.gridview2); + gridViewSecond.setAdapter(new GridAdapterPMSecond(this)); + // gridViewSecond.setAdapter(new GridAdapterPMSecond(this, UnapprovedCount, ComplitedCount, ApprovedCount, RequestForCompletion, RequestForModification, Rejected, str_studentcount, str_collegecount)); + GridView gridViewTrid = (GridView) findViewById(R.id.gridview1); + gridViewTrid.setAdapter(new GridAdapterPMThrid(this)); + + GridView gridViewFour = (GridView) findViewById(R.id.gridview3); + gridViewFour.setAdapter(new GridAdapterPMFour(this)); + + + pending_img.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent ittProjDtlsToHome = new Intent(PMHomeActivity.this, PMProjectDetailActivity.class); + ittProjDtlsToHome.putExtra("pageCount", 0); + startActivity(ittProjDtlsToHome); + } + }); + + complited_img.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent ittProjDtlsToHome = new Intent(PMHomeActivity.this, PMProjectDetailActivity.class); + ittProjDtlsToHome.putExtra("pageCount", 3); + startActivity(ittProjDtlsToHome); + } + }); + + approved_img.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent ittProjDtlsToHome = new Intent(PMHomeActivity.this, PMProjectDetailActivity.class); + ittProjDtlsToHome.putExtra("pageCount", 1); + startActivity(ittProjDtlsToHome); + } + }); + + tshirt_img.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToFeesPaid = new Intent(PMHomeActivity.this, TShirtPaidActivity.class); + itthomeToFeesPaid.putExtra("From", "Manager"); + v.getContext().startActivity(itthomeToFeesPaid); + } + }); + + + if (str_MangerImg.equals("null") || str_MangerImg.equals("anyType{}")) { + iv_profilepic.setImageResource(R.drawable.devanand); + } else { + LoadGalleryImage loadGalleryImage = new LoadGalleryImage(this); + loadGalleryImage.execute(); + } + /*textCartItemCompliteCount = (TextView) findViewById(R.id.cart_badge); + textCartItemApprovedCount = (TextView) findViewById(R.id.cart_badge2); + textCartItemUnApprovedCount = (TextView) findViewById(R.id.cart_badge1);*/ + LinearLayout pending_count = (LinearLayout) findViewById(R.id.pending_count); + + /* themeWiseProjCount_BT = (Button) findViewById(R.id.themeWiseProjCount_BT); + themeWiseProjCount_BT.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent ittThemeWiseProjCount = new Intent(PMHomeActivity.this,PMGetThemeWiseProjectCount.class); + ittThemeWiseProjCount.putExtra("MDId",MDId); + startActivity(ittThemeWiseProjCount); + } + });*/ + + /* int widthsize1=500; + int widthsize2=300; + DisplayMetrics metrics = new DisplayMetrics(); + getWindowManager().getDefaultDisplay().getMetrics(metrics); + int density = metrics.densityDpi; + if (density == DisplayMetrics.DENSITY_HIGH) { + // Toast.makeText(getContext(), "DENSITY_HIGH... Density is " + String.valueOf(density), Toast.LENGTH_LONG).show(); + if (density >= 230 || density <= 250) { + widthsize1=300; + widthsize2=200; + } + } + recyclerView = (RecyclerView) findViewById(R.id.recyclerView); + RecyclerView recyclerView1 =(RecyclerView) findViewById(R.id.recyclerView_contact); + + ArrayList arrayList1=new ArrayList<>(); + arrayList1=new ArrayList<>(); + arrayList1.add(new DataModel("Fees", R.drawable.fees_new, "#ffbc00")); + arrayList1.add(new DataModel("ML & LA", R.drawable.mlal_new, "#d94343")); + arrayList1.add(new DataModel("Reports", R.drawable.report_new, "#1e7145")); + arrayList1.add(new DataModel("News Feeds", R.drawable.newsfeeds_new, "#0a64c5")); + arrayList1.add(new DataModel("Events", R.drawable.events_new, "#84795d")); + arrayList1.add(new DataModel("Contact Us",R.drawable.contact_new,"#f42a2a"));*/ + /* ArrayList arrayList2=new ArrayList<>(); + arrayList2=new ArrayList<>(); + arrayList2.add(new DataModel("Pending",R.drawable.pending_home,"#3E51B1")); + arrayList2.add(new DataModel("Approved",R.drawable.approve_home,"#3E51B1")); + arrayList2.add(new DataModel("Completed",R.drawable.completed_home,"#3E51B1"));*/ + + /* arrayList = new ArrayList<>(); + arrayList.add(new DataModel("About LEAD", R.drawable.about_new, "#97c024")); + arrayList.add(new DataModel("Projects", R.drawable.project_new, "#f58d00")); + + + RecyclerViewAdapter adapter = new RecyclerViewAdapter(PMHomeActivity.this, arrayList, this); + recyclerView.setAdapter(adapter); + + AutoFitGridLayoutManager layoutManager = new AutoFitGridLayoutManager(this, widthsize1); + recyclerView.setLayoutManager(layoutManager); + + RecyclerViewAdapter adapter1 = new RecyclerViewAdapter(PMHomeActivity.this, arrayList1, this); + recyclerView1.setAdapter(adapter1); + + AutoFitGridLayoutManager layoutManager1 = new AutoFitGridLayoutManager(this, widthsize2); + recyclerView1.setLayoutManager(layoutManager1);*/ + + /* RecyclerViewCountAdapter adapter2 = new RecyclerViewCountAdapter(PMHomeActivityNew.this, arrayList2,this); + recyclerView2.setAdapter(adapter2); + + AutoFitGridLayoutManager layoutManager2 = new AutoFitGridLayoutManager(this, 300); + recyclerView2.setLayoutManager(layoutManager2);*/ + + /* gridview = (GridView) findViewById(R.id.customgrid); + gridview.setAdapter(new ImageAdapter(this, osNameList, osImages)); + +*/ + + + //currently commented + + /* GetStudentCount getStudentCount = new GetStudentCount(this); + getStudentCount.execute(MDId); + + GetCollegeCount getCollegeCount = new GetCollegeCount(this); + getCollegeCount.execute(MDId);*/ + // currently commented + + + + + /* chart_IV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent i = new Intent(PMHomeActivityNew.this,AnalyticChartActivity.class); + i.putExtra("UnapprovedCount",UnapprovedCount); + i.putExtra("ComplitedCount",ComplitedCount); + i.putExtra("ApprovedCount",ApprovedCount); + i.putExtra("RequestForCompletion",RequestForCompletion); + i.putExtra("RequestForModification",RequestForModification); + i.putExtra("Rejected",Rejected); + i.putExtra("str_studentcount",str_studentcount); + i.putExtra("str_collegecount",str_collegecount); + startActivity(i); + } + }); + + + chart_TV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent i = new Intent(PMHomeActivityNew.this,AnalyticChartActivity.class); + i.putExtra("UnapprovedCount",UnapprovedCount); + i.putExtra("ComplitedCount",ComplitedCount); + i.putExtra("ApprovedCount",ApprovedCount); + i.putExtra("RequestForCompletion",RequestForCompletion); + i.putExtra("RequestForModification",RequestForModification); + i.putExtra("Rejected",Rejected); + i.putExtra("str_studentcount",str_studentcount); + i.putExtra("str_collegecount",str_collegecount); + startActivity(i); + } + }); + projectDetails_TV = (TextView) findViewById(R.id.projectDetails_TV); + projectDetails_TV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToProject = new Intent(PMHomeActivityNew.this,PMProjectDetailActivity.class); + itthomeToProject.putExtra("pageCount",0); + Log.i("Tag","ManagerId homeintent="+MDId); + *//* itthomeToProject.putExtra("ManagerId",MDId); + itthomeToProject.putExtra("ManagerName",str_MangerName); + itthomeToProject.putExtra("PMEmailId",str_ManagerEmail); + itthomeToProject.putExtra("PM_Mobile",str_ManagerMaobile); + itthomeToProject.putExtra("PMLocation",str_ManagerLocation); + itthomeToProject.putExtra("PMImgUrl",str_MangerImg);*//* + startActivity(itthomeToProject); + } + }); + + projectDetails_IV = (ImageView) findViewById(R.id.projectDetails_IV); + projectDetails_IV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToProject = new Intent(PMHomeActivityNew.this,PMProjectDetailActivity.class); + itthomeToProject.putExtra("pageCount",0); + Log.i("Tag","ManagerId homeintent="+MDId); + *//* itthomeToProject.putExtra("ManagerId",MDId); + itthomeToProject.putExtra("ManagerName",str_MangerName); + itthomeToProject.putExtra("PMEmailId",str_ManagerEmail); + itthomeToProject.putExtra("PM_Mobile",str_ManagerMaobile); + itthomeToProject.putExtra("PMLocation",str_ManagerLocation); + itthomeToProject.putExtra("PMImgUrl",str_MangerImg);*//* + startActivity(itthomeToProject); + } + }); + + events_TV = (TextView) findViewById(R.id.events_TV); + events_TV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToEvent = new Intent(PMHomeActivityNew.this,EventsActivity.class); + startActivity(itthomeToEvent); + } + }); + events_IV = (ImageView) findViewById(R.id.events_IV); + events_IV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToEvent = new Intent(PMHomeActivityNew.this,EventsActivity.class); + startActivity(itthomeToEvent); + } + }); + news_TV = (TextView) findViewById(R.id.news_TV); + news_TV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToNewsFeeds = new Intent(PMHomeActivityNew.this,NewsFeedsActivity.class); + startActivity(itthomeToNewsFeeds); + } + }); + news_IV = (ImageView) findViewById(R.id.news_IV); + news_IV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToNewsFeeds = new Intent(PMHomeActivityNew.this,NewsFeedsActivity.class); + startActivity(itthomeToNewsFeeds); + } + }); + + about_TV = (TextView) findViewById(R.id.about_TV); + about_TV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToAboutUs = new Intent(PMHomeActivityNew.this,AboutUsActivity.class); + itthomeToAboutUs.putExtra("From","Manager"); + startActivity(itthomeToAboutUs); + } + }); + + about_IV = (ImageView) findViewById(R.id.about_IV); + about_IV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToAboutUs = new Intent(PMHomeActivityNew.this,AboutUsActivity.class); + itthomeToAboutUs.putExtra("From","Manager"); + startActivity(itthomeToAboutUs); + } + }); + + contactus_TV = (TextView) findViewById(R.id.contactus_TV); + contactus_TV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToAboutUs = new Intent(PMHomeActivityNew.this,ContactUsActivity.class); + itthomeToAboutUs.putExtra("From","Manager"); + startActivity(itthomeToAboutUs); + } + }); + + contactus_IV = (ImageView) findViewById(R.id.contactus_IV); + contactus_IV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToAboutUs = new Intent(PMHomeActivityNew.this,ContactUsActivity.class); + itthomeToAboutUs.putExtra("From","Manager"); + startActivity(itthomeToAboutUs); + } + }); + + request_TV = (TextView) findViewById(R.id.request_TV); + request_TV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToAboutUs = new Intent(PMHomeActivityNew.this,RequestActivity.class); + itthomeToAboutUs.putExtra("From","Manager"); + startActivity(itthomeToAboutUs); + } + }); + + request_IV = (ImageView) findViewById(R.id.request_IV); + request_IV.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent itthomeToAboutUs = new Intent(PMHomeActivityNew.this,RequestActivity.class); + itthomeToAboutUs.putExtra("From","Manager"); + startActivity(itthomeToAboutUs); + } + }); +*/ + + /* StateProgressBar stateProgressBar = (StateProgressBar) findViewById(R.id.usage_stateprogressbar); + stateProgressBar.setStateDescriptionData(descriptionData); + stateProgressBar.setCurrentStateNumber(StateProgressBar.StateNumber.THREE); +*/ + + + swipeToRefresh_pmhomeactivity.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { + + + @Override + public void onRefresh() { + + internetDectector = new Class_InternetDectector(getApplicationContext()); + isInternetPresent = internetDectector.isConnectingToInternet(); + + if (isInternetPresent) { + + // implement Handler to wait for 2 seconds and then update UI + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + // cancle the Visual indication of a refresh + /*try { + wait(300); + } catch (InterruptedException e) { + e.printStackTrace(); + }*/ + swipeToRefresh_pmhomeactivity.setRefreshing(false); + + GetLoginDetails getloginDetails = new GetLoginDetails(PMHomeActivity.this); + getloginDetails.execute(); + //Toast.makeText(getApplicationContext(),"net"+isInternetPresent.toString(),Toast.LENGTH_SHORT).show(); + + + AsyncCallFCM task = new AsyncCallFCM(PMHomeActivity.this); + task.execute(); + + + } + }, 500); + + } else { + Toast.makeText(getApplicationContext(), "No Internet", Toast.LENGTH_LONG).show(); + } + + } + + + }); + + + }// end of OnCreate() + + @Override + protected void onResume() { + super.onResume(); + + // register connection status listener + MyApplication.getInstance().setConnectivityListener(this); + } + + @Override + public void onNetworkConnectionChanged(boolean isConnected) { + showSnack(isConnected); + } + + private void showSnack(boolean isConnected) { + + if (!isConnected) { + + AlertDialog.Builder adb = new AlertDialog.Builder(PMHomeActivity.this); + //adb.setView(alertDialogView); + + adb.setTitle("Sorry! Not connected to the internet"); + + adb.setIcon(android.R.drawable.ic_dialog_alert); + + adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + + adb.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + adb.setCancelable(true); + adb.show(); + + //finish(); + } + } + + + public class LoadGalleryImage extends AsyncTask { + + private Context context; + // private ProgressBar progressBar; + + LoadGalleryImage(Context context) { + this.context = context; + } + + @Override + protected void onPreExecute() { + // progressBar = (ProgressBar) findViewById(R.id.progressBar); + // progressBar.setVisibility(View.VISIBLE); + + } + + @Override + protected Bitmap doInBackground(Void... params) { + ArrayList bitmapLst = null; + Bitmap bitmaplogo = null; + + try { + URL url = new URL(str_MangerImg); + Log.d("Urlssssssssssss", url.toString()); + bitmaplogo = BitmapFactory.decodeStream(url.openStream()); + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } catch (OutOfMemoryError ex) { + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context, "Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + return bitmaplogo; + } + + @Override + protected void onPostExecute(Bitmap bitmap) { + // bitmapList.add(bitmap); + iv_profilepic.setImageBitmap(bitmap); + // progressBar.setVisibility(GONE); + } + } + + private void setupComplited() { + + if (textCartItemCompliteCount != null) { + if (Integer.parseInt(ComplitedCount) == 0) { + if (textCartItemCompliteCount.getVisibility() != View.GONE) { + textCartItemCompliteCount.setVisibility(View.GONE); + } + } else { + // textCartItemCount.setText(String.valueOf(Math.min(mCartItemCount, 110))); + textCartItemCompliteCount.setText(ComplitedCount); + if (textCartItemCompliteCount.getVisibility() != View.VISIBLE) { + textCartItemCompliteCount.setVisibility(View.VISIBLE); + } + } + } + } + + private void setupUnapproved() { + + if (textCartItemUnApprovedCount != null) { + if (Integer.parseInt(UnapprovedCount) == 0) { + if (textCartItemUnApprovedCount.getVisibility() != View.GONE) { + textCartItemUnApprovedCount.setVisibility(View.GONE); + } + } else { + // textCartItemCount.setText(String.valueOf(Math.min(mCartItemCount, 110))); + textCartItemUnApprovedCount.setText(UnapprovedCount); + if (textCartItemUnApprovedCount.getVisibility() != View.VISIBLE) { + textCartItemUnApprovedCount.setVisibility(View.VISIBLE); + } + } + } + } + + private void setupApproved() { + + if (textCartItemApprovedCount != null) { + if (Integer.parseInt(ApprovedCount) == 0) { + if (textCartItemApprovedCount.getVisibility() != View.GONE) { + textCartItemApprovedCount.setVisibility(View.GONE); + } + } else { + // textCartItemCount.setText(String.valueOf(Math.min(mCartItemCount, 110))); + textCartItemApprovedCount.setText(ApprovedCount); + if (textCartItemApprovedCount.getVisibility() != View.VISIBLE) { + textCartItemApprovedCount.setVisibility(View.VISIBLE); + } + } + } + } + + + + + /*@Override + public void onItemClick(DataModel item) { + + String itemName=item.text; + // Toast.makeText(getApplicationContext(), item.text + " is clicked", Toast.LENGTH_SHORT).show(); + if(itemName.equals("About LEAD")){ + Intent itthomeToAboutUs = new Intent(PMHomeActivity.this,AboutUsActivity.class); + itthomeToAboutUs.putExtra("From","Manager"); + startActivity(itthomeToAboutUs); + } + if(itemName.equals("Projects")){ + Intent itthomeToProject = new Intent(PMHomeActivity.this,PMProjectDetailActivity.class); + itthomeToProject.putExtra("pageCount",0); + startActivity(itthomeToProject); + } + if(itemName.equals("Fees")){ + Intent itthomeToFeesPaid = new Intent(PMHomeActivity.this,FeesPaidActivity.class); + itthomeToFeesPaid.putExtra("From","Manager"); + startActivity(itthomeToFeesPaid); + } + if(itemName.equals("ML & LA")){ + Intent itthomeToAboutUs = new Intent(PMHomeActivity.this,RequestActivity.class); + itthomeToAboutUs.putExtra("From","Manager"); + startActivity(itthomeToAboutUs); + } + if(itemName.equals("Reports")){ + Intent i = new Intent(PMHomeActivity.this,AnalyticChartActivity.class); + i.putExtra("UnapprovedCount",UnapprovedCount); + i.putExtra("ComplitedCount",ComplitedCount); + i.putExtra("ApprovedCount",ApprovedCount); + i.putExtra("RequestForCompletion",RequestForCompletion); + i.putExtra("RequestForModification",RequestForModification); + i.putExtra("Rejected",Rejected); + i.putExtra("str_studentcount",str_studentcount); + i.putExtra("str_collegecount",str_collegecount); + startActivity(i); + } + if(itemName.equals("News Feeds")){ + Intent itthomeToNewsFeeds = new Intent(PMHomeActivity.this,NewsFeedsActivity.class); + startActivity(itthomeToNewsFeeds); + } + if(itemName.equals("Events")){ + Intent itthomeToEvent = new Intent(PMHomeActivity.this,EventsActivity.class); + startActivity(itthomeToEvent); + } + if(itemName.equals("Contact Us")){ + Intent itthomeToAboutUs = new Intent(PMHomeActivity.this,ContactUsActivity.class); + itthomeToAboutUs.putExtra("From","Manager"); + startActivity(itthomeToAboutUs); + } + + + }*/ + + + public class GetProjectCount extends AsyncTask { + + Context context; + + //ProgressBar progressBar; + + GetProjectCount(Context ctx) { + context = ctx; + } + + + @Override + protected SoapObject doInBackground(Integer... params) { + Integer ManagerId = (Integer) params[0]; + //SoapObject response = getStudDtls(leadid); + + String METHOD_NAME = "GetProjectCount"; + String NamespaceMail = "http://mis.leadcampus.org/", SOAP_ACTION1 = "http://mis.leadcampus.org/GetProjectCount";//namespace+methodname + + try { + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + request.addProperty("ManagerId", ManagerId); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + + //anyType{Counts=1; ProjectStatus=Approved; Status=Success; }; + + try { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapObject response = (SoapObject) envelope.getResponse(); + Log.d("tag", "soap response project count" + response.toString()); + + int int_projectcount = response.getPropertyCount(); + + Log.e("projectcount", Integer.toString(int_projectcount)); + + for (int i = 0; i < int_projectcount; i++) { + SoapObject innerresponse = (SoapObject) response.getProperty(i); + str_responsecount = innerresponse.getProperty("Counts").toString(); + str_responseStatus = innerresponse.getProperty("ProjectStatus").toString(); + str_TshirtStatus = innerresponse.getProperty("TshirtStatus").toString(); + str_TshirtRequestCount = innerresponse.getProperty("TshirtRequestCount").toString(); + + Log.e("tag", "str_TshirtRequestCount:" + str_TshirtRequestCount); + if (str_responseStatus.equals("Approved")) { + ApprovedCount = str_responsecount; + } else if (str_responseStatus.equals("Completed")) { + ComplitedCount = str_responsecount; + } else if (str_responseStatus.equals("Proposed")) { + UnapprovedCount = str_responsecount; + } else if (str_responseStatus.equals("Rejected")) { + Rejected = str_responsecount; + } else if (str_responseStatus.equals("RequestForCompletion")) { + RequestForCompletion = str_responsecount; + } else if (str_responseStatus.equals("RequestForModification")) { + RequestForModification = str_responsecount; + } + + Log.e("innerresponse", str_responsecount + str_responseStatus); + } + Log.e("innerresponse", str_responsecount + str_responseStatus); + + String Counts = response.getProperty(0).toString(); + Log.e("Counts", Counts); + Log.e("ApprovedCount", ApprovedCount); + Log.e("ComplitedCount", ComplitedCount); + Log.e("UnapprovedCount", UnapprovedCount); + + + + /* String Counts=response.getProperty("Counts").toString(); + String ProjectStatus=response.getProperty("ProjectStatus").toString(); + + Log.d("Counts",Counts); + Log.d("ProjectStatus",ProjectStatus);*/ + + return response; + + } catch (Exception t) { + Log.e("request fail PCount", "> " + t.getMessage().toString()); + } + } catch (Exception t) { + Log.d("exception outside", t.getMessage().toString()); + } + + //Log.d("Soap response is",response.toString()); + + return null; + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); + + } + + @Override + protected void onPostExecute(SoapObject result) { + + if (result != null) { + progressBar.setVisibility(View.GONE); + compeleted_tv.setText(ComplitedCount); + pending_tv.setText(UnapprovedCount); + approved_tv.setText(ApprovedCount); + tshirt_tv.setText(str_TshirtRequestCount); + + shardprefPM_obj_count.getString(PrefID_ComCount, "").trim(); + completed_str = shardprefPM_obj_count.getString(PrefID_ComCount, "").trim(); + Log.d("completed_str:", completed_str); + // Toast.makeText(this,"LeadId: "+str_MangerID,Toast.LENGTH_LONG).show(); + complited_count = Integer.parseInt(completed_str); + + shardprefPM_obj_count.getString(PrefID_AppCount, "").trim(); + approved_str = shardprefPM_obj_count.getString(PrefID_AppCount, "").trim(); + Log.d("approved_str:", approved_str); + // Toast.makeText(this,"LeadId: "+str_MangerID,Toast.LENGTH_LONG).show(); + approved_count = Integer.parseInt(approved_str); + + shardprefPM_obj_count.getString(PrefID_UNCount, "").trim(); + pending_str = shardprefPM_obj_count.getString(PrefID_UNCount, "").trim(); + Log.d("pending_str:", pending_str); + pending_count = Integer.parseInt(pending_str); + + shardprefPM_obj_count.getString(PrefID_Tshirt, "").trim(); + tshirt_str = shardprefPM_obj_count.getString(PrefID_Tshirt, "").trim(); + Log.d("tshirt_str:", tshirt_str); + tshirt_count = Integer.parseInt(tshirt_str); + + if (approved_count < Integer.valueOf(ApprovedCount)) { + Animation startAnimation = AnimationUtils.loadAnimation(PMHomeActivity.this, R.anim.blinking_animation); + approved_tv.startAnimation(startAnimation); + approved_img.startAnimation(startAnimation); + + editor_PM_count = shardprefPM_obj_count.edit(); + editor_PM_count.putString(PrefID_AppCount, ApprovedCount); + Log.d("ApprovedCount", ApprovedCount); + /* editor_PM_count.putString(PrefID_ComCount,ComplitedCount); + editor_PM_count.putString(PrefID_RejCount,Rejected); + editor_PM_count.putString(PrefID_UNCount,UnapprovedCount); + editor_PM_count.putString(PrefID_ReqComCount,RequestForCompletion); + editor_PM_count.putString(PrefID_ReqModCount,RequestForModification);*/ + editor_PM_count.commit(); + + } else if (approved_count == Integer.valueOf(ApprovedCount)) { + approved_tv.clearAnimation(); + approved_img.clearAnimation(); + } + + if (complited_count < Integer.valueOf(ComplitedCount)) { + Animation startAnimation = AnimationUtils.loadAnimation(PMHomeActivity.this, R.anim.blinking_animation); + compeleted_tv.startAnimation(startAnimation); + complited_img.startAnimation(startAnimation); + + editor_PM_count = shardprefPM_obj_count.edit(); + editor_PM_count.putString(PrefID_ComCount, ComplitedCount); + editor_PM_count.commit(); + } else if (complited_count == Integer.valueOf(ComplitedCount)) { + compeleted_tv.clearAnimation(); + complited_img.clearAnimation(); + } + + if (pending_count < Integer.valueOf(UnapprovedCount)) { + Animation startAnimation = AnimationUtils.loadAnimation(PMHomeActivity.this, R.anim.blinking_animation); + pending_tv.startAnimation(startAnimation); + pending_img.startAnimation(startAnimation); + + editor_PM_count = shardprefPM_obj_count.edit(); + editor_PM_count.putString(PrefID_UNCount, UnapprovedCount); + // editor_PM_count.putString(PrefID_AppCount,ApprovedCount); + // editor_PM_count.putString(PrefID_ComCount,ComplitedCount); + /* editor_PM_count.putString(PrefID_RejCount,Rejected); + editor_PM_count.putString(PrefID_UNCount,UnapprovedCount); + editor_PM_count.putString(PrefID_ReqComCount,RequestForCompletion); + editor_PM_count.putString(PrefID_ReqModCount,RequestForModification);*/ + editor_PM_count.commit(); + } else if (pending_count == Integer.valueOf(UnapprovedCount)) { + pending_tv.clearAnimation(); + pending_img.clearAnimation(); + } + + if (tshirt_count < Integer.valueOf(str_TshirtRequestCount)) { + Animation startAnimation = AnimationUtils.loadAnimation(PMHomeActivity.this, R.anim.blinking_animation); + tshirt_tv.startAnimation(startAnimation); + tshirt_img.startAnimation(startAnimation); + + editor_PM_count = shardprefPM_obj_count.edit(); + editor_PM_count.putString(PrefID_Tshirt, str_TshirtRequestCount); + editor_PM_count.commit(); + } else if (tshirt_count == Integer.valueOf(str_TshirtRequestCount)) { + tshirt_tv.clearAnimation(); + tshirt_img.clearAnimation(); + } + + Log.e("ApprovedCount1", ApprovedCount); + Log.e("ComplitedCount1", ComplitedCount); + Log.e("UnapprovedCount1", UnapprovedCount); + Log.e("approved_count", String.valueOf(approved_count)); + Log.e("pending_count", String.valueOf(pending_count)); + Log.e("complited_count", String.valueOf(complited_count)); + } + + + /* setupComplited(); + setupApproved(); + setupUnapproved();*/ + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + + public class GetStudentCount extends AsyncTask { + + Context context; + + //ProgressBar progressBar; + + GetStudentCount(Context ctx) { + context = ctx; + } + + + @Override + protected SoapObject doInBackground(Integer... params) { + Integer ManagerId = (Integer) params[0]; + //SoapObject response = getStudDtls(leadid); + + String METHOD_NAME = "GetStudentcount"; + String NamespaceMail = "http://mis.leadcampus.org/", SOAP_ACTION1 = "http://mis.leadcampus.org/GetStudentcount";//namespace+methodname + + try { + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + request.addProperty("ManagerId", ManagerId); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + + //anyType{Counts=1; ProjectStatus=Approved; Status=Success; }; + + try { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapObject response = (SoapObject) envelope.getResponse(); + Log.d("tag", "soap response GetStudentcount" + response.toString()); + + int int_projectcount = response.getPropertyCount(); + + Log.e("projectcount", Integer.toString(int_projectcount)); + + // String str_Status=response.getProperty("Status").toString(); + + for (int i = 0; i < int_projectcount; i++) { + SoapObject innerresponse = (SoapObject) response.getProperty(i); + + str_studentcount = innerresponse.getProperty("Counts").toString(); + Log.i("str_studentcount=", str_studentcount); + + /* if(str_responseStatus.equals("Approved")){ + ApprovedCount=str_responsecount; + } + else if(str_responseStatus.equals("Completed")){ + ComplitedCount=str_responsecount; + } + else if(str_responseStatus.equals("Proposed")){ + UnapprovedCount=str_responsecount; + } + else if(str_responseStatus.equals("Rejected")){ + Rejected=str_responsecount; + } + else if(str_responseStatus.equals("RequestForCompletion")){ + RequestForCompletion=str_responsecount; + } + else if(str_responseStatus.equals("RequestForModification")){ + RequestForModification=str_responsecount; + }*/ + + Log.e("innerresponse", str_responsecount); + } + Log.e("innerresponse", str_responsecount); + + String Counts = response.getProperty(0).toString(); + Log.e("Counts", Counts); + + + /* String Counts=response.getProperty("Counts").toString(); + String ProjectStatus=response.getProperty("ProjectStatus").toString(); + + Log.d("Counts",Counts); + Log.d("ProjectStatus",ProjectStatus);*/ + + // return response; + + } catch (Exception t) { + Log.e("request fail PCount", "> " + t.getMessage().toString()); + } + } catch (Exception t) { + Log.d("exception outside", t.getMessage().toString()); + } + + //Log.d("Soap response is",response.toString()); + + return null; + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); + + } + + @Override + protected void onPostExecute(SoapObject result) { + progressBar.setVisibility(View.GONE); + /*if(result==null){ + Toast.makeText(PMHomeActivity.this, "Web Service Error", Toast.LENGTH_SHORT).show(); + }*/ + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + public class GetCollegeCount extends AsyncTask { + + Context context; + + //ProgressBar progressBar; + + GetCollegeCount(Context ctx) { + context = ctx; + } + + + @Override + protected SoapObject doInBackground(Integer... params) { + Integer ManagerId = (Integer) params[0]; + //SoapObject response = getStudDtls(leadid); + + String METHOD_NAME = "GetManagerCollegeCount"; + String NamespaceMail = "http://mis.leadcampus.org/", SOAP_ACTION1 = "http://mis.leadcampus.org/GetManagerCollegeCount";//namespace+methodname + + try { + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + request.addProperty("ManagerId", ManagerId); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + + //anyType{Counts=1; ProjectStatus=Approved; Status=Success; }; + + try { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapObject response = (SoapObject) envelope.getResponse(); + Log.d("tag", "soap response GetManagerCollegeCount" + response.toString()); + + int int_projectcount = response.getPropertyCount(); + + Log.e("projectcount", Integer.toString(int_projectcount)); + + // String str_Status=response.getProperty("Status").toString(); + + for (int i = 0; i < int_projectcount; i++) { + SoapObject innerresponse = (SoapObject) response.getProperty(i); + + str_collegecount = innerresponse.getProperty("Counts").toString(); + Log.i("str_collegecount=", str_collegecount); + + /* if(str_responseStatus.equals("Approved")){ + ApprovedCount=str_responsecount; + } + else if(str_responseStatus.equals("Completed")){ + ComplitedCount=str_responsecount; + } + else if(str_responseStatus.equals("Proposed")){ + UnapprovedCount=str_responsecount; + } + else if(str_responseStatus.equals("Rejected")){ + Rejected=str_responsecount; + } + else if(str_responseStatus.equals("RequestForCompletion")){ + RequestForCompletion=str_responsecount; + } + else if(str_responseStatus.equals("RequestForModification")){ + RequestForModification=str_responsecount; + }*/ + + Log.e("innerresponse", str_responsecount); + } + Log.e("innerresponse", str_responsecount); + + String Counts = response.getProperty(0).toString(); + Log.e("Counts", Counts); + + + /* String Counts=response.getProperty("Counts").toString(); + String ProjectStatus=response.getProperty("ProjectStatus").toString(); + + Log.d("Counts",Counts); + Log.d("ProjectStatus",ProjectStatus);*/ + + // return response; + + } catch (Exception t) { + Log.e("request fail PCount", "> " + t.getMessage().toString()); + } + } catch (Exception t) { + Log.d("exception outside", t.getMessage().toString()); + } + + //Log.d("Soap response is",response.toString()); + + return null; + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); + + } + + @Override + protected void onPostExecute(SoapObject result) { + progressBar.setVisibility(View.GONE); + /*if(result==null){ + Toast.makeText(PMHomeActivity.this, "Web Service Error", Toast.LENGTH_SHORT).show(); + }*/ + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu, menu); + menu.findItem(R.id.action_feedback) + .setVisible(false); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + if (id == R.id.action_editProfile) { + Intent itthomeToEditProfile = new Intent(PMHomeActivity.this, PMEditProfileActivity.class); + // itthomeToEditProfile.putExtra("ManagerId",MDId); + startActivity(itthomeToEditProfile); + return true; + } + + if( id == R.id.changepwd){ + final Dialog dialog = new Dialog(PMHomeActivity.this); + + + dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); + dialog.setContentView(R.layout.change_pwd); + dialog.setCancelable(false); + + + Button forgotpasswordcancel_bt = (Button) dialog.findViewById(R.id.forgotpasswordcancel_bt); + Button forgotpasswordsubmit_bt = (Button) dialog.findViewById(R.id.forgotpasswordsubmit_bt); + dialognewpwd_et=(EditText) dialog.findViewById(R.id.dialognewpwd_et); + dialogconfpwd_et=(EditText)dialog.findViewById(R.id.dialogconfpwd_et); + + forgotpasswordcancel_bt.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) + { + dialog.dismiss(); + + } + }); + + forgotpasswordsubmit_bt.setOnClickListener(new View.OnClickListener() { + + @Override + public void onClick(View arg0) + { + + internetDectector = new Class_InternetDectector(getApplicationContext()); + isInternetPresent = internetDectector.isConnectingToInternet(); + + if (isInternetPresent) + { + + str_newPwd=dialognewpwd_et.getText().toString(); + String str_confPwd=dialogconfpwd_et.getText().toString(); + if(str_newPwd.equalsIgnoreCase(str_confPwd)){ + ChangePassword changePassword=new ChangePassword(PMHomeActivity.this); + changePassword.execute(); + } + + dialog.dismiss(); + + } + else{ + Toast.makeText(PMHomeActivity.this, "Kindly connect to internet", Toast.LENGTH_SHORT).show(); + } + + + + + } + }); + + + dialog.show(); + } + + if (id == R.id.action_logout) { + editor_LoginTrack = shardprefLoginTrack_obj.edit(); + editor_LoginTrack.putString(PrefID_WhereToGo, config_obj.packagename + "LoginActivity"); + editor_LoginTrack.commit(); + + Intent itthomeToLogin = new Intent(PMHomeActivity.this, LoginActivity.class); + startActivity(itthomeToLogin); + return true; + } + + if (id == R.id.notification) { + Intent itthomeToNotification = new Intent(PMHomeActivity.this, PMNotificationHistoryActivity.class); + startActivity(itthomeToNotification); + return true; + } + + if (id == R.id.action_request) { + Intent itthomeTorequest = new Intent(PMHomeActivity.this, PMRequestActivity.class); + startActivity(itthomeTorequest); + return true; + } + return super.onOptionsItemSelected(item); + } + + @SuppressLint("NewApi") + @Override + public void onBackPressed() { + // Do Here what ever you want do on back press; + //finish(); + + // finish(); + /*if (doubleBackToExitPressedOnce) { + //super.onBackPressed(); + //return; + finishAffinity(); + System.exit(0); + } + + this.doubleBackToExitPressedOnce = true; + Toast.makeText(this, "Please press back again to exit", Toast.LENGTH_SHORT).show(); + + new Handler().postDelayed(new Runnable() { + @Override + public void run() { + doubleBackToExitPressedOnce=false; + } + }, 2000);*/ + + Intent startMain = new Intent(Intent.ACTION_MAIN); + startMain.addCategory(Intent.CATEGORY_HOME); + startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(startMain); + } + + + public class GetLoginDetails extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + //private ProgressBar progressBar; + + + GetLoginDetails(Context ctx) { + context = ctx; + progressDialog_pmswiperefresh = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(String... params) { + //String mobilenum = (String) params [0]; + // String leadid = (String) params[1]; + //String versionCode = (String) params[2]; + + SoapObject response = getLoginDetails(); + + + return response; + } + + @Override + protected void onPreExecute() { +/* progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + + progressDialog_pmswiperefresh.setMessage("Loading"); + progressDialog_pmswiperefresh.setCanceledOnTouchOutside(false); + progressDialog_pmswiperefresh.show(); + + } + + @Override + protected void onPostExecute(SoapObject result) { + //progressBar.setVisibility(View.GONE); + progressDialog_pmswiperefresh.dismiss(); + + + String finalResult = result.toString(); + String finals = finalResult.replace("anyType{}", ""); + Log.d("Finals is", finals); + + + SoapPrimitive status = (SoapPrimitive) result.getProperty("Status"); + //Log.d("Status is:",status.toString()); + + + if (status.toString().equals("Invalid Username or Password")) { + Toast.makeText(getApplicationContext(), "Invalid Username or Password", Toast.LENGTH_SHORT).show(); + //progressDialog.dismiss(); + } + + if (status.toString().equals("Success")) { + SoapPrimitive role = (SoapPrimitive) result.getProperty("Role"); + Log.d("Role is:", role.toString()); + + if (role.toString().equals("Manager")) { + + /*AsyncCallFCM task = new AsyncCallFCM(LoginActivity.this); + task.execute();*/ + + Str_FCMName = result.getProperty("Username").toString().toString(); + Str_Manager_Id = result.getProperty("ManagerId").toString(); + Str_ManagerName = result.getProperty("Name").toString(); + Str_PMEmailId = result.getProperty("MailId").toString(); + Str_PM_Mobile = result.getProperty("MobileNo").toString(); + Str_PMLocation = result.getProperty("Location").toString(); + Str_PMImageURL = result.getProperty("UserImage").toString(); + Log.i("tag", "PMImageURL=" + Str_PMImageURL); + + String Imagestring = Str_PMImageURL; + String Str_PMImgUrl = null; + if (Imagestring.equals("null") || Imagestring.equals("anyType{}")) { + Str_PMImgUrl = "null"; + } else { + String arr[] = Imagestring.split("/", 2); + + String firstWord = arr[0]; //the + String secondWord = arr[1]; + + Str_PMImgUrl = serverPath + secondWord; + Log.i("tag", "firstWord=" + firstWord + " secondWord=" + secondWord); + + Log.i("tag", "PMImage1=" + Str_PMImageURL); + Log.i("tag", "PMImgUrl=" + Str_PMImgUrl); + } + + + ManagerId = Integer.parseInt(Str_Manager_Id); + + + editor_PM = shardprefPM_obj.edit(); + editor_PM.putString(PrefID_PMID, Str_Manager_Id); + Log.d("ManagerIdis", Str_Manager_Id); + editor_PM.putString(PrefID_pmName, Str_ManagerName); + editor_PM.putString(PrefID_PMEMailID, Str_PMEmailId); + editor_PM.putString(PrefID_PMMobile, Str_PM_Mobile); + editor_PM.putString(PrefID_pmlocation, Str_PMLocation); + editor_PM.putString(PrefID_pmimageurl, Str_PMImgUrl); + + editor_PM.putString(PrefID_pm_username, str_pm_username.toString()); + editor_PM.putString(PrefID_pm_password, str_pm_password.toString()); + + + Log.d("ManagerIds:", Str_Manager_Id); + Log.d("ManagerNames:", Str_ManagerName); + Log.d("ManagerEmailIds:", Str_PMEmailId); + Log.d("ManagerMobiles:", Str_PM_Mobile); + Log.d("Managerlocations:", Str_PMLocation); + Log.d("ManagerURLs:", Str_PMImgUrl); + + + editor_PM.commit(); + + /*editor_S = shardpref_S_obj.edit(); + editor_S.putString(PrefID_Role,role.toString()); + editor_S.commit();*/ + + Intent ittLoginToEditProfile = new Intent(PMHomeActivity.this, PMHomeActivity.class); + startActivity(ittLoginToEditProfile); + + // add + } + } else { + Log.d("Status is: ", status.toString()); + } + + + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + + private SoapObject getLoginDetails() { + + String METHOD_NAME = "ValidateLogin"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/ValidateLogin"; + + try { + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + String username = str_pm_username.toString(); + String password = str_pm_password.toString(); + request.addProperty("Username", username); + request.addProperty("Password", password); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Login.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapObject response = (SoapObject) envelope.getResponse(); + // str_loginresponse = (String)response.getProperty("Status"); + Log.d("soap responseyyyyyyy", response.toString()); + + return response; + + } catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + } catch (Exception t) { + Log.d("exception outside", t.getMessage().toString()); + } + return null; + + + } + + + public class ChangePassword extends AsyncTask { + + Context context; + //AlertDialog alertDialog; + + //private ProgressBar progressBar; + + private ProgressDialog progressDialog; + + ChangePassword(Context ctx) { + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapPrimitive doInBackground(String... params) { + + SoapPrimitive response = ChangePassword(); + + //Log.d("ResponseCommitsss", response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressDialog.setMessage("Loading"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + + + + // String str_result=result.getProperty("Status").toString(); + if(result.toString().equalsIgnoreCase("Success")){ + // dialog.dismiss(); + progressDialog.dismiss(); + + AlertDialog.Builder dialog = new AlertDialog.Builder(PMHomeActivity.this); + dialog.setCancelable(false); + dialog.setTitle(R.string.alert); + + + dialog.setMessage(" Password is updated \n Thank you."); + + dialog.setPositiveButton("Ok", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) { + dialog.dismiss(); + } + }); + + + final AlertDialog alert = dialog.create(); + alert.setOnShowListener(new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface arg0) { + alert.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#004D40")); + } + }); + alert.show(); + + } + else{ + + progressDialog.dismiss(); + Toast toast = Toast.makeText(getApplicationContext(), "Unable to change password", Toast.LENGTH_LONG); + TextView toastMessage = (TextView) toast.getView().findViewById(android.R.id.message); + toastMessage.setTextColor(Color.RED); + toast.show(); + } + + } + + } + private SoapPrimitive ChangePassword() + { + + String METHOD_NAME = "Change_Password"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/Change_Password"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + request.addProperty("User_Id", str_regId);//string + request.addProperty("User_Type",str_role); + request.addProperty("New_Password",str_newPwd);//string + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Login.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + // SendStudentRequestforManager{Lead_Id=MF00993; Email_id=testing; Student_MobileNo=9689240475; Message=testing; } + + Log.e("tag","Request Change_Password="+request.toString()); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + // Log.d("soapResponseyyyyyyy",envelope.getResponse().toString()); + + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + Log.d("tag","soapRespons Change_Password="+response.toString()); + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.d("exception outside",t.getMessage().toString()); + } + return null; + + + } + + + private class AsyncCallFCM extends AsyncTask { + + ProgressDialog dialog; + + Context context; + + @Override + protected void onPreExecute() { + Log.i("Leadmis", "onPreExecute---tab2"); + /* dialog.setMessage("Please wait.."); + dialog.setCanceledOnTouchOutside(false); + dialog.show();*/ + + } + + @Override + protected void onProgressUpdate(Void... values) { + Log.i("Leadmis", "onProgressUpdate---tab2"); + } + + public AsyncCallFCM(PMHomeActivity activity) { + context = activity; + // dialog = new ProgressDialog(activity); + } + + @Override + protected Void doInBackground(String... params) { + Log.i("Leadmis", "doInBackground"); + + + setGCM1(); + setGCM1(); + + + return null; + } + + @Override + protected void onPostExecute(Void result) { + /*if (dialog.isShowing()) { + dialog.dismiss(); + + }*/ + // Log.i(TAG, "onPostExecute"); + + /* if(versionval) + { }else{alerts();}*/ + + + } + }//end of AsynTask + + + /* public void setGCM1() { + + +// + + // Fetch Device info + + *//* final TelephonyManager tm = (TelephonyManager) getBaseContext() + .getSystemService(Context.TELEPHONY_SERVICE);*//* + + tm1 = (TelephonyManager) getBaseContext() + .getSystemService(Context.TELEPHONY_SERVICE); + + // final String tmDevice, tmSerial, androidId; + String NetworkType; + //TelephonyManager telephonyManager = ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE)); + simOperatorName = tm1.getSimOperatorName(); + Log.v("Operator", "" + simOperatorName); + NetworkType = "GPRS"; + + + int simSpeed = tm1.getNetworkType(); + if (simSpeed == 1) + NetworkType = "Gprs"; + else if (simSpeed == 4) + NetworkType = "Edge"; + else if (simSpeed == 8) + NetworkType = "HSDPA"; + else if (simSpeed == 13) + NetworkType = "LTE"; + else if (simSpeed == 3) + NetworkType = "UMTS"; + else + NetworkType = "Unknown"; + + Log.v("SIM_INTERNET_SPEED", "" + NetworkType); + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q){ + tmDevice = UUID.randomUUID().toString(); + }else { + tmDevice = "" + tm1.getDeviceId(); + } + Log.v("DeviceIMEI", "" + tmDevice); + if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.READ_SMS) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, android.Manifest.permission.READ_PHONE_NUMBERS) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, android.Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) { + // TODO: Consider calling + // ActivityCompat#requestPermissions + // here to request the missing permissions, and then overriding + // public void onRequestPermissionsResult(int requestCode, String[] permissions, + // int[] grantResults) + // to handle the case where the user grants the permission. See the documentation + // for ActivityCompat#requestPermissions for more details. + return; + } + mobileNumber = "" + tm1.getLine1Number(); + Log.v("getLine1Number value", "" + mobileNumber); + + String mobileNumber1 = "" + tm1.getPhoneType(); + Log.v("getPhoneType value", "" + mobileNumber1); + tmSerial = "" + tm1.getSimSerialNumber(); + // Log.v("GSM devices Serial Number[simcard] ", "" + tmSerial); + androidId = "" + android.provider.Settings.Secure.getString(getContentResolver(), + android.provider.Settings.Secure.ANDROID_ID); + Log.v("androidId CDMA devices", "" + androidId); + UUID deviceUuid = new UUID(androidId.hashCode(), + ((long) tmDevice.hashCode() << 32) | tmSerial.hashCode()); + deviceId = deviceUuid.toString(); + // Log.v("deviceIdUUID universally unique identifier", "" + deviceId); + + + deviceModelName = Build.MODEL; + Log.v("Model Name", "" + deviceModelName); + deviceUSER = Build.USER; + Log.v("Name USER", "" + deviceUSER); + devicePRODUCT = Build.PRODUCT; + Log.v("PRODUCT", "" + devicePRODUCT); + deviceHARDWARE = Build.HARDWARE; + Log.v("HARDWARE", "" + deviceHARDWARE); + deviceBRAND = Build.BRAND; + Log.v("BRAND", "" + deviceBRAND); + myVersion = Build.VERSION.RELEASE; + Log.v("VERSION.RELEASE", "" + myVersion); + sdkVersion = Build.VERSION.SDK_INT; + Log.v("VERSION.SDK_INT", "" + sdkVersion); + sdkver = Integer.toString(sdkVersion); + // Get display details + + Measuredwidth = 0; + Measuredheight = 0; + Point size = new Point(); + WindowManager w = getWindowManager(); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + // w.getDefaultDisplay().getSize(size); + Measuredwidth = w.getDefaultDisplay().getWidth();//size.x; + Measuredheight = w.getDefaultDisplay().getHeight();//size.y; + } else { + Display d = w.getDefaultDisplay(); + Measuredwidth = d.getWidth(); + Measuredheight = d.getHeight(); + } + + Log.v("SCREEN_Width", "" + Measuredwidth); + Log.v("SCREEN_Height", "" + Measuredheight); + + + regId = FirebaseInstanceId.getInstance().getToken(); + + + + Log.e("regId_DeviceID", "" + regId); + +*//*string + string + string + string + string + string + string + string + string + string + string + string*//* + + //if (!regId.equals("")){ + if (2>1){ + String SOAP_ACTION1 = "http://mis.leadcampus.org/SaveDeviceDetails"; + String METHOD_NAME1 = "SaveDeviceDetails"; + String MAIN_NAMESPACE = "http://mis.leadcampus.org/"; + String URI = Class_URL.URL_Login.toString().trim(); + + + SoapObject request = new SoapObject(MAIN_NAMESPACE, METHOD_NAME1); + + // request.addProperty("LeadId", Password1); + request.addProperty("username",Str_FCMName ); + + request.addProperty("DeviceId", regId); + request.addProperty("OSVersion", myVersion); + request.addProperty("Manufacturer", deviceBRAND); + request.addProperty("ModelNo", deviceModelName); + request.addProperty("SDKVersion", sdkver); + request.addProperty("DeviceSrlNo", tmDevice); + request.addProperty("ServiceProvider", simOperatorName); + request.addProperty("SIMSrlNo", tmSerial); + request.addProperty("DeviceWidth", Measuredwidth); + request.addProperty("DeviceHeight", Measuredheight); + request.addProperty("AppVersion", versioncode); + //request.addProperty("AppVersion","4.0"); + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( + SoapEnvelope.VER11); + envelope.dotNet = true; + // Set output SOAP object + envelope.setOutputSoapObject(request); + Log.e("deviceDetails Request","deviceDetail"+request.toString()); + // Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URI); + + try { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + + System.out.println("Device Res"+response); + + Log.i("sending device detail", response.toString()); + + } catch (Exception e) { + e.printStackTrace(); + Log.i("err",e.toString()); + } + } + + + + + + + }//end of GCM()*/ + + + + public void setGCM1() { + + +// + + // Fetch Device info + + /* final TelephonyManager tm = (TelephonyManager) getBaseContext() + .getSystemService(Context.TELEPHONY_SERVICE);*/ + + tm1 = (TelephonyManager) getBaseContext() + .getSystemService(Context.TELEPHONY_SERVICE); + + // final String tmDevice, tmSerial, androidId; + String NetworkType; + //TelephonyManager telephonyManager = ((TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE)); + simOperatorName = tm1.getSimOperatorName(); + Log.v("Operator", "" + simOperatorName); + NetworkType = "GPRS"; + + + int simSpeed = tm1.getNetworkType(); + if (simSpeed == 1) + NetworkType = "Gprs"; + else if (simSpeed == 4) + NetworkType = "Edge"; + else if (simSpeed == 8) + NetworkType = "HSDPA"; + else if (simSpeed == 13) + NetworkType = "LTE"; + else if (simSpeed == 3) + NetworkType = "UMTS"; + else + NetworkType = "Unknown"; + + Log.v("SIM_INTERNET_SPEED", "" + NetworkType); + if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) { + // TODO: Consider calling + // ActivityCompat#requestPermissions + // here to request the missing permissions, and then overriding + // public void onRequestPermissionsResult(int requestCode, String[] permissions, + // int[] grantResults) + // to handle the case where the user grants the permission. See the documentation + // for ActivityCompat#requestPermissions for more details. + return; + } + //tmDevice = "" + tm1.getDeviceId(); + String tmDevice = Settings.Secure.getString(this.getContentResolver(), Settings.Secure.ANDROID_ID); + Log.v("DeviceIMEI", "" + tmDevice); + mobileNumber = "" + tm1.getLine1Number(); + Log.v("getLine1Number value", "" + mobileNumber); + + String mobileNumber1 = "" + tm1.getPhoneType(); + Log.v("getPhoneType value", "" + mobileNumber1); + // tmSerial = "" + tm1.getSimSerialNumber(); + TelephonyManager tMgr = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE); + try { + tmSerial = "" + tMgr.getSimSerialNumber(); + }catch(Exception ex) + { + tmSerial="inaccessible"; + } + + + + // Log.v("GSM devices Serial Number[simcard] ", "" + tmSerial); + androidId = "" + Settings.Secure.getString(getContentResolver(), + Settings.Secure.ANDROID_ID); + Log.v("androidId CDMA devices", "" + androidId); + UUID deviceUuid = new UUID(androidId.hashCode(), + ((long) tmDevice.hashCode() << 32) | tmSerial.hashCode()); + deviceId = deviceUuid.toString(); + Log.v("deviceIdUUID", "" + deviceId); + + + deviceModelName = Build.MODEL; + Log.v("Model Name", "" + deviceModelName); + deviceUSER = Build.USER; + Log.v("Name USER", "" + deviceUSER); + devicePRODUCT = Build.PRODUCT; + Log.v("PRODUCT", "" + devicePRODUCT); + deviceHARDWARE = Build.HARDWARE; + Log.v("HARDWARE", "" + deviceHARDWARE); + deviceBRAND = Build.BRAND; + Log.v("BRAND", "" + deviceBRAND); + myVersion = Build.VERSION.RELEASE; + Log.v("VERSION.RELEASE", "" + myVersion); + sdkVersion = Build.VERSION.SDK_INT; + Log.v("VERSION.SDK_INT", "" + sdkVersion); + sdkver = Integer.toString(sdkVersion); + // Get display details + + Measuredwidth = 0; + Measuredheight = 0; + Point size = new Point(); + // WindowManager w = getWindowManager(); + + DisplayMetrics displaymetrics = new DisplayMetrics(); + this.getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); + /*int screenWidth = displaymetrics.widthPixels; + int screenHeight = displaymetrics.heightPixels;*/ + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + // w.getDefaultDisplay().getSize(size); + /* Measuredwidth = w.getDefaultDisplay().getWidth();//size.x; + Measuredheight = w.getDefaultDisplay().getHeight();//size.y;*/ + + Measuredwidth = displaymetrics.widthPixels;//size.x; + Measuredheight = displaymetrics.heightPixels;//size.y; + } else { + // Display d = w.getDefaultDisplay(); + /*Measuredwidth = d.getWidth(); + Measuredheight = d.getHeight();*/ + Measuredwidth = displaymetrics.widthPixels;//size.x; + Measuredheight = displaymetrics.heightPixels;//size.y; + } + + Log.v("SCREEN_Width", "" + Measuredwidth); + Log.v("SCREEN_Height", "" + Measuredheight); + + + regId = FirebaseInstanceId.getInstance().getToken(); + + + + Log.e("regId_DeviceID", "" + regId); + +/*string + string + string + string + string + string + string + string + string + string + string + string*/ + + //if (!regId.equals("")){ + if (2>1){ + // String WEBSERVICE_NAME = "http://dfhrms.cloudapp.net/PMSservice.asmx?WSDL"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/SaveDeviceDetails"; + String METHOD_NAME1 = "SaveDeviceDetails"; + String MAIN_NAMESPACE = "http://mis.leadcampus.org/"; + String URI = Class_URL.URL_Login.toString().trim(); + + + SoapObject request = new SoapObject(MAIN_NAMESPACE, METHOD_NAME1); + + // request.addProperty("LeadId", Password1); + request.addProperty("username",Str_FCMName ); + + request.addProperty("DeviceId", regId); + request.addProperty("OSVersion", myVersion); + request.addProperty("Manufacturer", deviceBRAND); + request.addProperty("ModelNo", deviceModelName); + request.addProperty("SDKVersion", sdkver); + request.addProperty("DeviceSrlNo", tmDevice); + request.addProperty("ServiceProvider", simOperatorName); + request.addProperty("SIMSrlNo", tmSerial); + request.addProperty("DeviceWidth", Measuredwidth); + request.addProperty("DeviceHeight", Measuredheight); + request.addProperty("AppVersion", versioncode); + //request.addProperty("AppVersion","4.0"); + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( + SoapEnvelope.VER11); + envelope.dotNet = true; + // Set output SOAP object + envelope.setOutputSoapObject(request); + Log.e("deviceDetails Request","deviceDetail"+request.toString()); + // Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URI); + + try { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + + System.out.println("Device Res"+response); + + Log.i("sending device detail", response.toString()); + + } catch (Exception e) { + e.printStackTrace(); + Log.i("err",e.toString()); + } + } + + + + + + + }//end of GCM() + + + +}// end of class diff --git a/app/src/main/java/com/leadcampusapp/PMNotificationHistoryActivity.java b/app/src/main/java/com/leadcampusapp/PMNotificationHistoryActivity.java new file mode 100644 index 0000000..d845bd7 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/PMNotificationHistoryActivity.java @@ -0,0 +1,301 @@ +package com.leadcampusapp; + +import android.app.AlertDialog; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.AsyncTask; +import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; +import android.util.Log; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.ListView; +import android.widget.ProgressBar; +import android.widget.Toast; + +import com.leadcampusapp.module.NotificationActivityModel; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.util.ArrayList; + +public class PMNotificationHistoryActivity extends AppCompatActivity { + + String[] mobileArray = {"Android","IPhone","WindowsMobile","Blackberry", + "WebOS","Ubuntu","Windows7","Max OS X"}; + + + Class_URL config_obj= new Class_URL(); + public static final String PREFBook_LoginTrack= "prefbook_logintrack"; + public static final String PrefID_WhereToGo = "prefid_wheretogo"; // + SharedPreferences shardprefLoginTrack_obj; + SharedPreferences.Editor editor_LoginTrack; + + private Context context; + + public static final String PREFBook_Stud= "prefbook_stud"; //sharedpreference Book + public static final String PrefID_RegID = "prefid_regid"; // + public static final String PrefID_SLeadID = "prefid_sleadid"; // + private SharedPreferences shardpref_S_obj; + private String str_leadId; + + public static final String PREFBook_PM= "prefbook_pm"; + public static final String PrefID_PMID = "prefid_pmid"; + SharedPreferences shardprefPM_obj; + SharedPreferences.Editor editor_PM; + String str_MangerID; + Integer MDId; + + private ArrayList originalList = null; + private ArrayList notifList; + private NotificationCustomAdapter adapter; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_notification_history); + + context = this; + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + + notifList = new ArrayList(); + + shardprefPM_obj= getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MangerID = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + Log.d("str_MangerID:",str_MangerID); + // Toast.makeText(this,"LeadId: "+str_MangerID,Toast.LENGTH_LONG).show(); + MDId=Integer.parseInt(str_MangerID); + + // ArrayAdapter adapter = new ArrayAdapter(this, + // R.layout.notification_list, mobileArray); + // AnimateBell(); + ListView listView = (ListView) findViewById(R.id.mobile_list); + // listView.setAdapter(adapter); + // listView.setAdapter(new NotificationCustomAdapter(this, prgmNameList,prgmImages)); + adapter = new NotificationCustomAdapter(this,notifList); + listView.setAdapter(adapter); + + GetNotificationDetails getNotificationDetails = new GetNotificationDetails(this); + getNotificationDetails.execute(); + } + + /* public void AnimateBell() { + Animation shake = AnimationUtils.loadAnimation(this, R.anim.shakeanimation); + ImageView imgBell= (ImageView) findViewById(R.id.notification); + imgBell.setImageResource(R.drawable.baseline_notifications_white_24); + imgBell.setAnimation(shake); + }*/ + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu, menu); + MenuItem action_request = menu.findItem(R.id.action_request); + action_request.setVisible(false); + MenuItem action_feedback = menu.findItem(R.id.action_feedback); + action_feedback.setVisible(false); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + + if (id == R.id.action_editProfile) { + Intent itthomeToEditProfile = new Intent(PMNotificationHistoryActivity.this ,PMEditProfileActivity.class); + startActivity(itthomeToEditProfile); + return true; + } + + + if (id == R.id.action_logout) { + + editor_LoginTrack = shardprefLoginTrack_obj.edit(); + editor_LoginTrack.putString(PrefID_WhereToGo, config_obj.packagename+"LoginActivity"); + editor_LoginTrack.commit(); + + //deleteCache(context); + + Intent itthomeToLogin = new Intent(PMNotificationHistoryActivity.this ,LoginActivity.class); + startActivity(itthomeToLogin); + return true; + } + + /*if (id == R.id.notification) { + Intent itthomeToNotification = new Intent(NotificationHistoryActivity.this ,NotificationHistoryActivity.class); + startActivity(itthomeToNotification); + return true; + }*/ + + return super.onOptionsItemSelected(item); + } + + public class GetNotificationDetails extends AsyncTask { + + AlertDialog alertDialog; + private ProgressBar progressBar; + + GetNotificationDetails (Context ctx){ + context = ctx; + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapObject response = getProjectDtls(); + + //Log.d("Soapresponseissssss",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); + } + + @Override + protected void onPostExecute(SoapObject result) { + notifList.clear(); + if (result != null) { + + SoapPrimitive S_Notification_Type, S_Notification_Message, S_Notification_Date, S_ProjectStatus, S_Rating, S_ProjectId, S_Status; + Object O_Notification_Type, O_Notification_Message, O_Notification_Date, O_ProjectStatus, O_Rating, O_ProjectId, O_Status; + String str_Notification_Type = null, str_Notification_Message = null, str_Notification_Date = null, str_ProjectStatus = null, str_Rating = null, str_projectId = null, str_Status = null; + + for (int i = 0; i < result.getPropertyCount(); i++) { + SoapObject list = (SoapObject) result.getProperty(i); + + Log.d("Result", list.toString()); + + O_Status = list.getProperty("Status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) list.getProperty("Status"); + Log.d("Status:", S_Status.toString()); + str_Status = S_Status.toString(); + } + + if (str_Status.equalsIgnoreCase("Success")) { + + O_Notification_Type = list.getProperty("Notification_Type"); + if (!O_Notification_Type.toString().equals("anyType{}") && !O_Notification_Type.toString().equals(null)) { + S_Notification_Type = (SoapPrimitive) list.getProperty("Notification_Type"); + Log.d("Notification_Type", S_Notification_Type.toString()); + str_Notification_Type = S_Notification_Type.toString(); + } + + O_Notification_Message = list.getProperty("Notification_Message"); + if (!O_Notification_Message.toString().equals("anyType{}") && !O_Notification_Message.toString().equals(null)) { + S_Notification_Message = (SoapPrimitive) list.getProperty("Notification_Message"); + Log.d("Notification_Message", S_Notification_Message.toString()); + str_Notification_Message = S_Notification_Message.toString(); + } + + O_Notification_Date = list.getProperty("Notification_Date"); + if (!O_Notification_Date.toString().equals("anyType{}") && !O_Notification_Date.toString().equals(null)) { + S_Notification_Date = (SoapPrimitive) list.getProperty("Notification_Date"); + Log.d("Notification_Date", S_Notification_Date.toString()); + str_Notification_Date = S_Notification_Date.toString(); + } + + NotificationActivityModel item; + + item = new NotificationActivityModel(str_Notification_Type, str_Notification_Message, str_Notification_Date); + notifList.add(item); + } + } + + + + + originalList = new ArrayList(); + originalList.addAll(notifList); + + adapter.notifyDataSetChanged(); + + } + progressBar.setVisibility(View.GONE); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapObject getProjectDtls() { + String METHOD_NAME = "GetTopTenManagerNotificationList"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetTopTenManagerNotificationList"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + request.addProperty("ManagerId",MDId); + // request.addProperty("PDId",mapProjectIdProject.get(selectedProject)); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + envelope.setOutputSoapObject(request); + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Login.toString().trim()); + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + SoapObject response = (SoapObject) envelope.getResponse(); + Log.e("soapcompletionxxxx",response.toString()); + return response; + + } + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(PMNotificationHistoryActivity.this,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(PMNotificationHistoryActivity.this,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + //getActivity().finish(); + } + } + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(PMNotificationHistoryActivity.this,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(PMNotificationHistoryActivity.this,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + + } +} diff --git a/app/src/main/java/com/leadcampusapp/PMProjectDetailActivity.java b/app/src/main/java/com/leadcampusapp/PMProjectDetailActivity.java new file mode 100644 index 0000000..0c781aa --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/PMProjectDetailActivity.java @@ -0,0 +1,318 @@ +package com.leadcampusapp; + +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.graphics.Color; +import android.os.Bundle; +//import android.support.design.widget.TabLayout; +import androidx.viewpager.widget.ViewPager; +import androidx.appcompat.app.AppCompatActivity; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.TextView; + +import com.google.android.material.tabs.TabLayout; + +//import com.android.sripad.leadnew_22_6_2018.R; + + +public class PMProjectDetailActivity extends AppCompatActivity implements ConnectivityReceiver.ConnectivityReceiverListener{ + + // Integer ManagerId; + // String ManagerName,PMEmailId,PM_Mobile,PMLocation,PMImgUrl; + + public int pageCount=0; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_pmproject_detail); + + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + //getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background)); + + View actionBarView = getSupportActionBar().getCustomView(); + TextView actionBarTV = (TextView) actionBarView.findViewById(R.id.txt_actionBar); + actionBarTV.setText("Project Details"); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); + + /* Intent intent = getIntent(); + String ManagerIdstr=intent.getStringExtra("ManagerId"); + Log.i("tag","MangerID PMProjectDetails="+ManagerIdstr); + if(ManagerId.equals("null")){ + ManagerId=1; + }else + { + ManagerId = Integer.parseInt(ManagerIdstr); + + } + ManagerId = getIntent().getExtras().getInt("ManagerId"); + Log.i("tag","MangerID PMProjectDetails="+ManagerId); + + Intent intent = getIntent(); + ManagerName = intent.getStringExtra("ManagerName"); + PMEmailId= intent.getStringExtra("PMEmailId"); + PM_Mobile= intent.getStringExtra("PM_Mobile"); + PMLocation= intent.getStringExtra("PMLocation"); + PMImgUrl=intent.getStringExtra("PMImgUrl"); + + + Log.i("Tag","PMImgUrl=="+PMImgUrl);*/ + + + //PMUnapproved_DetailsActivity.java + + //PMUnapprovedFragment.java + //PMApprovedFragments.java + //PMComplitionFragment.java + //PMFundAmountFragment.java + // + View view1; + LayoutInflater inflater1 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view1 = inflater1.inflate(R.layout.unapprovedtablayout, null); + + View view4; + LayoutInflater inflater4 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view4 = inflater4.inflate(R.layout.approvedtablayout, null); + + View view3; + LayoutInflater inflater3 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view3 = inflater3.inflate(R.layout.pmcomplitionprojecttablayout, null); + + View view2; + LayoutInflater inflater2 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view2 = inflater2.inflate(R.layout.fundamounttablayout, null); + + + TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layoutPD); + tabLayout.addTab(tabLayout.newTab().setCustomView(view1)); + tabLayout.addTab(tabLayout.newTab().setCustomView(view4)); + tabLayout.addTab(tabLayout.newTab().setCustomView(view3)); + tabLayout.addTab(tabLayout.newTab().setCustomView(view2)); + + pageCount = getIntent().getExtras().getInt("pageCount"); + Log.i("tag","pageCount PMProjectDetails="+pageCount); + + TabLayout.Tab tab = null; + if(pageCount==0) { + TabLayout.Tab selectedTab = tabLayout.getTabAt(0); + View view = selectedTab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.PMtexttitleunapproved); + selectedText.setTextColor(Color.parseColor("#000000")); + }else if(pageCount==1){ + TabLayout.Tab selectedTab = tabLayout.getTabAt(1); + View view = selectedTab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.PMtexttitleApproved); + selectedText.setTextColor(Color.parseColor("#000000")); + }else if(pageCount==2){ + TabLayout.Tab selectedTab = tabLayout.getTabAt(2); + View view = selectedTab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.PMtexttitlecomplition); + selectedText.setTextColor(Color.parseColor("#000000")); + }else if(pageCount==3){ + TabLayout.Tab selectedTab = tabLayout.getTabAt(3); + View view = selectedTab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.PMtexttitlefund); + selectedText.setTextColor(Color.parseColor("#000000")); + } + /* float myTabLayoutSize = 360; + if (DeviceInfo.getWidthDP(this) >= myTabLayoutSize ){ + tabLayout.setTabMode(TabLayout.MODE_FIXED); + } else {*/ + tabLayout.setTabMode(TabLayout.MODE_SCROLLABLE); + //} + //tabLayout.addTab(tabLayout.newTab().setText("Tab 3")); + //tabLayout.setTabGravity(TabLayout.GRAVITY_FILL); + + final ViewPager viewPager = (ViewPager) findViewById(R.id.pager1); + + final PMProjectDetailsAdapter adapter = new PMProjectDetailsAdapter(getSupportFragmentManager(), tabLayout.getTabCount()); + viewPager.setAdapter(adapter); + viewPager.setCurrentItem(pageCount); + // Fragment.SavedState savedState = getFragmentManager().saveFragmentInstanceState(); + viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); + tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { + @Override + public void onTabSelected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + if(tab.getPosition()==0) { + TextView selectedText = (TextView) view.findViewById(R.id.PMtexttitleunapproved); + selectedText.setTextColor(Color.parseColor("#000000")); + }else if(tab.getPosition()==1){ + TextView selectedText = (TextView) view.findViewById(R.id.PMtexttitleApproved); + selectedText.setTextColor(Color.parseColor("#000000")); + }else if(tab.getPosition()==2){ + TextView selectedText = (TextView) view.findViewById(R.id.PMtexttitlecomplition); + selectedText.setTextColor(Color.parseColor("#000000")); + }else if(tab.getPosition()==3){ + TextView selectedText = (TextView) view.findViewById(R.id.PMtexttitlefund); + selectedText.setTextColor(Color.parseColor("#000000")); + } + viewPager.setCurrentItem(tab.getPosition()); + } + + @Override + public void onTabUnselected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + if(tab.getPosition()==0) { + TextView selectedText = (TextView) view.findViewById(R.id.PMtexttitleunapproved); + selectedText.setTextColor(Color.parseColor("#000000")); + }else if(tab.getPosition()==1){ + TextView selectedText = (TextView) view.findViewById(R.id.PMtexttitleApproved); + selectedText.setTextColor(Color.parseColor("#000000")); + }else if(tab.getPosition()==2){ + TextView selectedText = (TextView) view.findViewById(R.id.PMtexttitlecomplition); + selectedText.setTextColor(Color.parseColor("#000000")); + }else if(tab.getPosition()==3){ + TextView selectedText = (TextView) view.findViewById(R.id.PMtexttitlefund); + selectedText.setTextColor(Color.parseColor("#000000")); + } + // TextView selectedText = (TextView) view.findViewById(R.id.PMtexttitle); + // selectedText.setTextColor(Color.parseColor("#000000")); + // viewPager.setCurrentItem(tab.getPosition()); + } + + @Override + public void onTabReselected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + if(tab.getPosition()==0) { + TextView selectedText = (TextView) view.findViewById(R.id.PMtexttitleunapproved); + selectedText.setTextColor(Color.parseColor("#000000")); + }else if(tab.getPosition()==1){ + TextView selectedText = (TextView) view.findViewById(R.id.PMtexttitleApproved); + selectedText.setTextColor(Color.parseColor("#000000")); + }else if(tab.getPosition()==2){ + TextView selectedText = (TextView) view.findViewById(R.id.PMtexttitlecomplition); + selectedText.setTextColor(Color.parseColor("#000000")); + }else if(tab.getPosition()==3){ + TextView selectedText = (TextView) view.findViewById(R.id.PMtexttitlefund); + selectedText.setTextColor(Color.parseColor("#000000")); + } + // TextView selectedText = (TextView) view.findViewById(R.id.PMtexttitle); + //selectedText.setTextColor(Color.parseColor("#FFFFFF")); + } + }); + + } + + @Override + protected void onResume() { + super.onResume(); + + // register connection status listener + MyApplication.getInstance().setConnectivityListener(this); + } + + @Override + public void onNetworkConnectionChanged(boolean isConnected) { + showSnack(isConnected); + } + + private void showSnack(boolean isConnected) { + + if (!isConnected) { + + AlertDialog.Builder adb = new AlertDialog.Builder(PMProjectDetailActivity.this); + //adb.setView(alertDialogView); + + adb.setTitle("Sorry! Not connected to the internet"); + + adb.setIcon(android.R.drawable.ic_dialog_alert); + + adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + + adb.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + adb.setCancelable(true); + adb.show(); + } + +/* String message; + int color; + if (isConnected) { + message = "Good! Connected to Internet"; + color = Color.WHITE; + } else { + message = "Sorry! Not connected to internet"; + color = Color.RED; + } + + Snackbar snackbar = Snackbar + .make(findViewById(R.id.coordinator_layout), message, Snackbar.LENGTH_LONG); + + View sbView = snackbar.getView(); + TextView textView = (TextView) sbView.findViewById(android.support.design.R.id.snackbar_text); + textView.setTextColor(color); + snackbar.show();*/ + } + + + + + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_main, menu); + MenuItem action_editProfile = menu.findItem(R.id.action_editProfile); + action_editProfile.setVisible(false); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + + /* if (id == R.id.action_editProfile) { + Intent itthomeToEditProfile = new Intent(PMProjectDetailActivity.this ,PMEditProfileActivity.class); + itthomeToEditProfile.putExtra("ManagerId",ManagerId); + startActivity(itthomeToEditProfile); + return true; + }*/ + + + if (id == R.id.action_logout) { + Intent itthomeToLogin = new Intent(PMProjectDetailActivity.this ,LoginActivity.class); + startActivity(itthomeToLogin); + return true; + } + + if (id == android.R.id.home) { + Intent ittProjDtlsToHome = new Intent(PMProjectDetailActivity.this ,PMHomeActivity.class); + /* ittProjDtlsToHome.putExtra("ManagerId",ManagerId); + ittProjDtlsToHome.putExtra("ManagerName",ManagerName); + ittProjDtlsToHome.putExtra("PMEmailId",PMEmailId); + ittProjDtlsToHome.putExtra("PM_Mobile",PM_Mobile); + ittProjDtlsToHome.putExtra("PMLocation",PMLocation); + ittProjDtlsToHome.putExtra("PMImgUrl",PMImgUrl);*/ + startActivity(ittProjDtlsToHome); + return true; + } + + return super.onOptionsItemSelected(item); + } + + @Override + public void onBackPressed() { + Intent ittProjDtlsToHome = new Intent(PMProjectDetailActivity.this ,PMHomeActivity.class); + startActivity(ittProjDtlsToHome); + } +} diff --git a/app/src/main/java/com/leadcampusapp/PMProjectDetailsAdapter.java b/app/src/main/java/com/leadcampusapp/PMProjectDetailsAdapter.java new file mode 100644 index 0000000..03f10b3 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/PMProjectDetailsAdapter.java @@ -0,0 +1,48 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 22-06-2018. + */ + +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentStatePagerAdapter; + +public class PMProjectDetailsAdapter extends FragmentStatePagerAdapter { + int mNumOfTabs; + int pageCount; + + + public PMProjectDetailsAdapter(FragmentManager fm, int NumOfTabs) { + super(fm); + this.mNumOfTabs = NumOfTabs; + // this.pageCount=pageCount; + } + + @Override + public Fragment getItem(int position) { + + switch (position) { + case 0: + PMUnapprovedFragment tab1 = new PMUnapprovedFragment(); + return tab1; + case 1: + PMApprovedFragment tab2 = new PMApprovedFragment(); + return tab2; + case 2: + PMComplitionFragment tab3 = new PMComplitionFragment(); + return tab3; + case 3: + PMFundAmountFragment tab4 = new PMFundAmountFragment(); + return tab4; + default: + return null; + } + } + + @Override + public int getCount() { + return mNumOfTabs; + } + +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/PMRequestActivity.java b/app/src/main/java/com/leadcampusapp/PMRequestActivity.java new file mode 100644 index 0000000..28befda --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/PMRequestActivity.java @@ -0,0 +1,172 @@ +package com.leadcampusapp; + +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.graphics.Color; +import android.os.Bundle; +//import android.support.design.widget.TabLayout; +import androidx.viewpager.widget.ViewPager; +import androidx.appcompat.app.AppCompatActivity; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.TextView; + +import com.google.android.material.tabs.TabLayout; + +public class PMRequestActivity extends AppCompatActivity implements ConnectivityReceiver.ConnectivityReceiverListener{ + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_pmrequest); + + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + // getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background)); + + + View actionBarView = getSupportActionBar().getCustomView(); + TextView actionBarTV = (TextView) actionBarView.findViewById(R.id.txt_actionBar); + actionBarTV.setText("Request Module"); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); + + View view1; + LayoutInflater inflater1 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view1 = inflater1.inflate(R.layout.tablayoutopen_req, null); + + View view2; + LayoutInflater inflater2 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view2 = inflater2.inflate(R.layout.tablayoutclose_req, null); + + TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); + tabLayout.addTab(tabLayout.newTab().setCustomView(view1)); + tabLayout.addTab(tabLayout.newTab().setCustomView(view2)); + + TabLayout.Tab selectedTab = tabLayout.getTabAt(0); + View view = selectedTab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.txt_req); + selectedText.setTextColor(Color.parseColor("#000000")); + + final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); + + final PMRequestAdapter adapter = new PMRequestAdapter(getSupportFragmentManager(), tabLayout.getTabCount()); + viewPager.setAdapter(adapter); + + + viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); + tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { + @Override + public void onTabSelected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.txt_req); + selectedText.setTextColor(Color.parseColor("#000000")); + viewPager.setCurrentItem(tab.getPosition()); + } + + @Override + public void onTabUnselected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.txt_req); + selectedText.setTextColor(Color.parseColor("#000000")); + } + + @Override + public void onTabReselected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.txt_req); + selectedText.setTextColor(Color.parseColor("#000000")); + } + }); + } + + @Override + protected void onResume() { + super.onResume(); + + // register connection status listener + MyApplication.getInstance().setConnectivityListener(this); + } + + @Override + public void onNetworkConnectionChanged(boolean isConnected) { + showSnack(isConnected); + } + + private void showSnack(boolean isConnected) { + + if (!isConnected) { + + AlertDialog.Builder adb = new AlertDialog.Builder(PMRequestActivity.this); + //adb.setView(alertDialogView); + + adb.setTitle("Sorry! Not connected to the internet"); + + adb.setIcon(android.R.drawable.ic_dialog_alert); + + adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + + adb.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + adb.setCancelable(true); + adb.show(); + + //finish(); + } + } + @Override + public void onBackPressed() + { + Intent i = new Intent(this,PMHomeActivity.class); + startActivity(i); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_main, menu); + MenuItem action_editProfile = menu.findItem(R.id.action_editProfile); + action_editProfile.setVisible(false); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + + /* if (id == R.id.action_editProfile) { + Intent itthomeToEditProfile = new Intent(PMComplitionProjectActivity.this ,PMEditProfileActivity.class); + startActivity(itthomeToEditProfile); + return true; + }*/ + + + if (id == R.id.action_logout) { + Intent itthomeToLogin = new Intent(PMRequestActivity.this ,LoginActivity.class); + startActivity(itthomeToLogin); + return true; + } + + if (id == android.R.id.home) { + Intent ittProjDtlsToHome = new Intent(PMRequestActivity.this ,PMHomeActivity.class); + startActivity(ittProjDtlsToHome); + return true; + } + + return super.onOptionsItemSelected(item); + } +} diff --git a/app/src/main/java/com/leadcampusapp/PMRequestAdapter.java b/app/src/main/java/com/leadcampusapp/PMRequestAdapter.java new file mode 100644 index 0000000..bea03aa --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/PMRequestAdapter.java @@ -0,0 +1,37 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 22-06-2018. + */ +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentStatePagerAdapter; + +public class PMRequestAdapter extends FragmentStatePagerAdapter { + int mNumOfTabs; + + public PMRequestAdapter(FragmentManager fm, int NumOfTabs) { + super(fm); + this.mNumOfTabs = NumOfTabs; + } + + @Override + public Fragment getItem(int position) { + + switch (position) { + case 0: + ReqOpenFragment tab1 = new ReqOpenFragment(); + return tab1; + case 1: + ReqCloseFragment tab2 = new ReqCloseFragment(); + return tab2; + default: + return null; + } + } + + @Override + public int getCount() { + return mNumOfTabs; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/PMUnapprovedAdapter.java b/app/src/main/java/com/leadcampusapp/PMUnapprovedAdapter.java new file mode 100644 index 0000000..3d8d816 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/PMUnapprovedAdapter.java @@ -0,0 +1,181 @@ +package com.leadcampusapp; + +import android.app.Activity; +import android.graphics.Color; +import android.graphics.PorterDuff; +import android.graphics.drawable.Drawable; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.ImageView; +import android.widget.RatingBar; +import android.widget.TextView; + +import java.util.ArrayList; +import java.util.Locale; + +//import com.android.sripad.leadnew_22_6_2018.R; + +/** + * Created by Admin on 28-05-2018. + */ + +public class PMUnapprovedAdapter extends BaseAdapter{ + + public ArrayList projList; + Activity activity; + private ArrayList mDisplayedValues = null; + + public PMUnapprovedAdapter(Activity activity, ArrayList projList) { + super(); + this.activity = activity; + this.projList = projList; + this.mDisplayedValues = projList; + } + + @Override + public int getCount() { + //return projList.size(); + return mDisplayedValues.size(); + } + + @Override + public PMUnapprovedFragmentModel getItem(int position) { + + //return projList.get(position); + return mDisplayedValues.get(position); + } + + @Override + public long getItemId(int position) { + return position; + } + + private class ViewHolder { + TextView mproject_name; + TextView mcollege; + TextView mproject_title; + TextView mbudget; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + + ViewHolder holder; + LayoutInflater inflater = activity.getLayoutInflater(); + + if (convertView == null) { + convertView = inflater.inflate(R.layout.pmunapproved_listrow, null); + holder = new ViewHolder(); + + holder.mproject_name = (TextView) convertView.findViewById(R.id.txt_projName); + + holder.mproject_title = (TextView) convertView.findViewById(R.id.txt_projTitle); + + holder.mcollege = (TextView) convertView.findViewById(R.id.txt_college); + holder.mbudget = (TextView) convertView.findViewById(R.id.txt_budget); + + convertView.setTag(holder); + } else { + holder = (ViewHolder) convertView.getTag(); + } + + /* Date date = new Date(); + String modifiedDate= new SimpleDateFormat("dd/MM/yyyy").format(date); + Log.d("Modified date is xxxx",modifiedDate);*/ + + PMUnapprovedFragmentModel item = projList.get(position); + + Log.d("StudeNamesssssssssssss",item.getName().toString()); + Log.d("ProjectTitlessssssss",item.getProject_title().toString()); + Log.d("CollegeNamesssssss",item.getCollege().toString()); + Log.d("Budgetissssssssssss",item.getBudget().toString()); + + + holder.mproject_name.setText(item.getName().toString()); + holder.mproject_title.setText(item.getProject_title().toString()); + holder.mcollege.setText(item.getCollege().toString()); + holder.mbudget.setText(item.getBudget().toString()); + + return convertView; + } + +/* @Override + public Filter getFilter() { + Filter filter = new Filter() { + + @SuppressWarnings("unchecked") + @Override + protected void publishResults(CharSequence constraint,FilterResults results) { + + mDisplayedValues = (ArrayList) results.values; // has the filtered values + notifyDataSetChanged(); // notifies the data with new filtered values + } + + @Override + protected FilterResults performFiltering(CharSequence constraint) { + FilterResults results = new FilterResults(); // Holds the results of a filtering operation in values + ArrayList FilteredArrList = new ArrayList(); + + if (mOriginalValues == null) { + mOriginalValues = new ArrayList(mDisplayedValues); // saves the original data in mOriginalValues + } + + *//******** + * + * If constraint(CharSequence that is received) is null returns the mOriginalValues(Original) values + * else does the Filtering and returns FilteredArrList(Filtered) + * + ********//* + if (constraint == null || constraint.length() == 0) { + + // set the Original result to return + results.count = mOriginalValues.size(); + results.values = mOriginalValues; + } else { + constraint = constraint.toString().toLowerCase(); + //Log.d("constraintisssss",constraint.toString()); + for (int i = 0; i < mOriginalValues.size(); i++) { + String data = mOriginalValues.get(i).getProject_name(); + + if (data.toLowerCase().startsWith(constraint.toString())) { + Log.d("dataisssss",data); + FilteredArrList.add(new ProjectStatusActivityModel2(mOriginalValues.get(i).getProject_name(),mOriginalValues.get(i).getApproved_amt(),mOriginalValues.get(i).getStatus(),mOriginalValues.get(i).getDispersed_amt(),mOriginalValues.get(i).getRating(),mOriginalValues.get(i).isCompletedFlag(),mOriginalValues.get(i).getProjectId())); + } + } + // set the Filtered result to return + results.count = FilteredArrList.size(); + results.values = FilteredArrList; + } + return results; + } + }; + return filter; + }*/ + + + public void filter(String charText,ArrayList projectList) { + charText = charText.toLowerCase(Locale.getDefault()); + this.mDisplayedValues.clear(); + + if(charText!=null) { + if(projectList!=null) { + if (charText.isEmpty() || charText.length() == 0) { + this.mDisplayedValues.addAll(projectList); + } else { + for (PMUnapprovedFragmentModel wp : projectList) { + if (wp.getName().toLowerCase(Locale.getDefault()).contains(charText) || wp.getProject_title().toLowerCase(Locale.getDefault()).contains(charText) || wp.getCollege().toLowerCase(Locale.getDefault()).contains(charText) || wp.getBudget().toLowerCase(Locale.getDefault()).contains(charText)) { + this.mDisplayedValues.add(wp); + } + } + } + notifyDataSetChanged(); + } + } + } + + + +} diff --git a/app/src/main/java/com/leadcampusapp/PMUnapprovedFragment.java b/app/src/main/java/com/leadcampusapp/PMUnapprovedFragment.java new file mode 100644 index 0000000..67b0261 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/PMUnapprovedFragment.java @@ -0,0 +1,591 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 22-06-2018. + */ + +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.AsyncTask; +import android.os.Bundle; +import androidx.fragment.app.Fragment; +import android.text.Editable; +import android.text.TextWatcher; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.EditText; +import android.widget.ListAdapter; +import android.widget.ListView; +import android.widget.ProgressBar; +import android.widget.SimpleAdapter; +import android.widget.TextView; + +//import com.android.sripad.leadnew_22_6_2018.R; +import com.leadcampusapp.module.UnapprovedProjectList; +import com.leadcampusapp.module.UnapprovedProjectListModule; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Locale; + +public class PMUnapprovedFragment extends Fragment { + + // private ArrayList> list; + public static final String FIRST_COLUMN="First"; + public static final String SECOND_COLUMN="Second"; + public static final String THIRD_COLUMN="Third"; + public static final String FOURTH_COLUMN="Fourth"; + + ListView list,list_head; + ArrayList> mylist, mylist_title; + ListAdapter adapter_title,adapter,adapter2; + HashMap map1, map2; + + String[] LeadId= {"MG10441","MG10442","MG10443","MG10444"}; + String[] Names = {"Pramod. K","Akshatha. K","Shiva. S","Shripad. A"}; + String[] Colleges = {"BVB","KLE","BVB","KLE"}; + String[] ProjectTittle = {"Food","Books","Food","Books"}; + String[] Budget = {"100","200","300","400"}; + + UnapprovedProjectListModule unapprovedProjectListObj; + ArrayList unapprovedProjectListModules; + private ProgressBar progressBar; + // UnapprovedListAdapter adapter1 ; + UnapprovedProjectListModule[] unapprovedInfosarr; + ArrayList arrayList= new ArrayList(); + + int responseCount=0; + int i=0; + Integer ManagerId; + + public static final String PREFBook_PM= "prefbook_pm"; //sharedpreference Book + public static final String PrefID_PMID = "prefid_pmid"; // + SharedPreferences shardprefPM_obj; + String str_MangerID; + Integer MDId; + + private EditText etSearch; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + + View view=inflater.inflate(R.layout.pmunapproved_fragment, container, false); + + progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + + list = (ListView) view.findViewById(R.id.lv_PMunapproved); + list_head = (ListView) view.findViewById(R.id.listView1); + + mylist = new ArrayList>(); + mylist_title = new ArrayList>(); + + shardprefPM_obj= getActivity().getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MangerID = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + Log.d("str_leadId:",str_MangerID); + // Toast.makeText(this,"LeadId: "+str_MangerID,Toast.LENGTH_LONG).show(); + MDId=Integer.parseInt(str_MangerID); + + unapprovedProjectListObj = new UnapprovedProjectListModule(); + + etSearch = (EditText) view.findViewById(R.id.etSearch); + /* etSearch.addTextChangedListener(new TextWatcher() { + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + // Call back the Adapter with current character to Filter + } + + @Override + public void beforeTextChanged(CharSequence s, int start, int count,int after) { + } + ; + @Override + public void afterTextChanged(Editable s) { + //adapter.getFilter().filter(s.toString()); + String text = etSearch.getText().toString().toLowerCase(Locale.getDefault()); + ((SimpleAdapter) adapter).getFilter().filter(text); + ((SimpleAdapter) adapter).notifyDataSetChanged(); + + *//* if(adapter!=null && text!=null) { + ((SimpleAdapter) adapter).getFilter().filter(text); + }*//* + } + });*/ + + + + + /* Intent intent = getActivity().getIntent(); + String MangerID=intent.getStringExtra("ManagerId"); + Log.i("tag","MangerID unapproved="+MangerID); + if(MangerID.equals("null")){ + ManagerId=1; + }else + { + ManagerId = Integer.parseInt(MangerID); + + }*/ +/* ManagerId = getActivity().getIntent().getExtras().getInt("ManagerId"); + Log.i("tag","MangerID PMProjectDetails="+ManagerId); +*/ + GetUnapprovedProjectDetails getUnapprovedProjectDetails = new GetUnapprovedProjectDetails(getActivity()); + getUnapprovedProjectDetails.execute(MDId); + + return view; + } + + + + public boolean unapprovedproject(int MDId) { + String mailresponse="flag"; + int verInt=0; + String URL=Class_URL.URL_Manager.toString().trim(); //xml code + String METHOD_NAMEMail = "GetUnaprrovedProjectList"; + String NamespaceMail="http://mis.leadcampus.org/", SOAPACTIONMail="http://mis.leadcampus.org/GetUnaprrovedProjectList";//namespace+methodname + + /*try{*/ + + SoapObject request = new SoapObject(NamespaceMail, METHOD_NAMEMail); + + request.addProperty("ManagerId", ManagerId);//S + + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try + { + androidHttpTransport.call(SOAPACTIONMail, envelope); + + SoapObject response = (SoapObject) envelope.getResponse(); + Log.i("Tag","string value at response="+response.toString()); + + + String object2string = response.getProperty(0).toString(); + + mailresponse=object2string.toString(); + verInt=Integer.valueOf(object2string); + + //Toast.makeText(getApplicationContext(), "hi"+object2string, Toast.LENGTH_LONG).show(); + Log.i("Tag","string value at response"+object2string.toString()); + } + catch (Throwable t) { + + Log.e("request fail", "> " + t.getMessage()); + } + + /*}catch (Throwable t) { + Log.e("UnRegister Receiver Error", "> " + t.getMessage()); + + }*/ + return true; + } + public void showActivity1() { + + mylist = new ArrayList>(); + mylist_title = new ArrayList>(); + + /**********Display the headings************/ + + + map1 = new HashMap(); + + // map1.put("slno", "Lead Id"); + map1.put("one", " Name"); + map1.put("two", " College"); + map1.put("three","Project Tittle"); + map1.put("four","Budget"); + mylist_title.add(map1); + + + try { + adapter_title = new SimpleAdapter(getContext(), mylist_title, R.layout.pmunapproved_list, + new String[]{ "one", "two","three","four"}, new int[]{ + R.id.Name, R.id.College, R.id.ProjectTittle, R.id.Budget}); + list_head.setAdapter(adapter_title); + } catch (Exception e) { + + } + + /********************************************************/ + + + /**********Display the contents************/ + + /* for (int i = 0; i < Names.length; i++) { + map2 = new HashMap(); + + // map2.put("slno", LeadId[i]); + map2.put("one", Names[i]); + map2.put("two", Colleges[i]); + map2.put("three", ProjectTittle[i]); + map2.put("four", Budget[i]); + mylist.add(map2); + }*/ + map2 = new HashMap(); + + map2.put("one", "Madhu"); + map2.put("two", "College"); + map2.put("three", "ProjectTittle"); + map2.put("four", "Budget"); + mylist.add(map2); + + try { + adapter = new SimpleAdapter(getContext(), mylist, R.layout.pmunapproved_list, + new String[]{"one", "two","three","four"}, new int[]{ + R.id.Name, R.id.College, R.id.ProjectTittle, R.id.Budget}); + list.setDividerHeight(1); + list.setAdapter(adapter); + } catch (Exception e) { + + } + + list.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + // String item = ((TextView)view).getText().toString(); + // String selectedItem = (String) parent.getItemAtPosition(position); + Object o = list.getItemAtPosition(position); + String name = ((TextView) view.findViewById(R.id.Name)).getText().toString(); + + // Toast.makeText(getContext(), "item"+name, Toast.LENGTH_LONG).show(); + Intent i= new Intent(getContext(), PMUnapproved_DetailsActivity.class); + i.putExtra("name",name); + startActivity(i); + } + + }); + } + + + + + + public void showActivity() + { + + mylist = new ArrayList>(); + mylist_title = new ArrayList>(); + + /**********Display the headings************/ + + + map1 = new HashMap(); + + // map1.put("slno", "Lead Id"); + map1.put("one", " Name"); + map1.put("two", " College"); + map1.put("three","Project Title"); + map1.put("four","Budget"); + mylist_title.add(map1); + + + try { + adapter_title = new SimpleAdapter(getContext(), mylist_title, R.layout.pmunapproved_listhead, + new String[]{ "one", "two","three","four"}, new int[]{ + R.id.Name, R.id.College, R.id.ProjectTittle, R.id.Budget}); + list_head.setAdapter(adapter_title); + } catch (Exception e) { + + } + + /********************************************************/ + + Log.i("Tag","unapprovedProjectListObj="+unapprovedProjectListObj.getStudent_name()); + Log.i("Tag","UnapprovedProjectList.listview_arr.size="+ UnapprovedProjectList.listview_arr.size()); + Log.i("Tag","UnapprovedProjectListModule.listview_arr.size="+ UnapprovedProjectListModule.listview_arr.size()); + + + //Log.e("Tag","Streamname="+ UnapprovedProjectListModule.listview_arr.get(0).getstreamname().toString()); + /**********Display the contents************/ + for (int i = 0; i < UnapprovedProjectList.listview_arr.size(); i++) + { + String Collegestring = UnapprovedProjectList.listview_arr.get(i).getCollege_name(); + String firstWord=""; + String secondWord; + + if(Collegestring.equals("anyType{}")){ + //Toast.makeText(getContext(), "College Name Not Found", Toast.LENGTH_SHORT).show(); + }else { + String arr[] = Collegestring.split(" "); + + //the + // secondWord = arr[1]; + if(arr.length==1){ + firstWord = arr[0]; + } + else{ + firstWord = arr[0]; + } + Log.i("tag", "firstWord=" + firstWord );//+ " secondWord=" + secondWord); + + /* map2 = new HashMap(); + map2.put("one", UnapprovedProjectList.listview_arr.get(i).getStudent_name()); + map2.put("two", firstWord); + map2.put("three", UnapprovedProjectList.listview_arr.get(i).getProject_tittle()); + map2.put("four", UnapprovedProjectList.listview_arr.get(i).getAmount()); + mylist.add(map2);*/ + } + + + map2 = new HashMap(); + map2.put("one", UnapprovedProjectList.listview_arr.get(i).getStudent_name()); + map2.put("two", firstWord); + map2.put("three", UnapprovedProjectList.listview_arr.get(i).getProject_tittle()); + map2.put("four", UnapprovedProjectList.listview_arr.get(i).getAmount()); + + map2.put("five",UnapprovedProjectList.listview_arr.get(i).getLead_id()); + map2.put("six",UnapprovedProjectList.listview_arr.get(i).getProject_Id()); + map2.put("seven",UnapprovedProjectList.listview_arr.get(i).getMobileNo()); + map2.put("eight",UnapprovedProjectList.listview_arr.get(i).getstream_name()); + Log.e("streamname",UnapprovedProjectList.listview_arr.get(i).getstream_name().toString()); + /* map2.put("eight",UnapprovedProjectList.listview_arr.get(i).getcollegename()); + map2.put("nine",UnapprovedProjectList.listview_arr.get(i).getstreamname());*/ + mylist.add(map2); + } + + + try { + adapter = new SimpleAdapter(getContext(), mylist, R.layout.pmunapproved_list, + new String[]{"one", "two","three","four","five","six","seven","eight"}, new int[] + { + R.id.Name, R.id.College, R.id.ProjectTittle, R.id.Budget, R.id.lead_id,R.id.proj_id,R.id.mobile_no, + R.id.streamname_list_tv}); + + //((SimpleAdapter) adapter).getFilter().filter("title35"); + list.setAdapter(adapter); + } + + catch (Exception e) { + Log.e("Exceptioniss:",e.toString()); + } + + list.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) + { + // String item = ((TextView)view).getText().toString(); + // String selectedItem = (String) parent.getItemAtPosition(position); + Object o = list.getItemAtPosition(position); + Log.i("Tag","o=="+o.toString()); + Log.i("Tag","position=="+position); + + String name = ((TextView) view.findViewById(R.id.Name)).getText().toString(); + String Lead_id = ((TextView) view.findViewById(R.id.lead_id)).getText().toString(); + String Project_id = ((TextView) view.findViewById(R.id.proj_id)).getText().toString(); + String MobileNo = ((TextView) view.findViewById(R.id.mobile_no)).getText().toString(); + String collegename=((TextView) view.findViewById(R.id.College)).getText().toString(); + String streamname=((TextView) view.findViewById(R.id.streamname_list_tv)).getText().toString(); + + Log.e("stream_name",streamname); + + /* String collegename=((TextView) view.findViewById(R.id.collegename_list_tv)).getText().toString(); + String streamname=((TextView) view.findViewById(R.id.streamname_list_tv)).getText().toString(); +*/ + + /*String Lead_id= UnapprovedProjectList.listview_arr.get(position).getLead_id(); + String Project_id= UnapprovedProjectList.listview_arr.get(position).getProject_Id(); + String MobileNo= UnapprovedProjectList.listview_arr.get(position).getMobileNo();*/ + // Toast.makeText(getContext(), "item="+name, Toast.LENGTH_LONG).show(); + Log.e("Tag","Lead_idUnApproved="+position+"=="+Lead_id); + Log.e("Tag","Project_idUnApproved="+position+"=="+Project_id); + /* Toast.makeText(getContext(), "Lead_id="+Lead_id, Toast.LENGTH_LONG).show(); + Toast.makeText(getContext(), "Project_type="+Project_type+"Action_plan="+Action_plan, Toast.LENGTH_LONG).show(); + Toast.makeText(getContext(), "Benficiaries="+Benficiaries+"Objectivies="+Objectivies, Toast.LENGTH_LONG).show();*/ + Intent i= new Intent(getContext(), PMUnapproved_DetailsActivity.class); + i.putExtra("name",name); + i.putExtra("lead_id",Lead_id); + i.putExtra("Project_id",Project_id); + i.putExtra("MobileNo",MobileNo); + i.putExtra("collegename",collegename); + i.putExtra("streamname",streamname); + /*i.putExtra("collegename",collegename); + i.putExtra("streamname",streamname);*/ + startActivity(i); + } + + }); + + etSearch.addTextChangedListener(new TextWatcher() { + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + // Call back the Adapter with current character to Filter + } + + @Override + public void beforeTextChanged(CharSequence s, int start, int count,int after) { + } + ; + @Override + public void afterTextChanged(Editable s) { + //adapter.getFilter().filter(s.toString()); + String text = etSearch.getText().toString().toLowerCase(Locale.getDefault()); + ((SimpleAdapter) adapter).getFilter().filter(text); + //((SimpleAdapter) adapter).notifyDataSetChanged(); + } + }); + + } + + public class GetUnapprovedProjectDetails extends AsyncTask { + + Context context; + + GetUnapprovedProjectDetails (Context ctx){ + context = ctx; + } + + + @Override + protected SoapObject doInBackground(Integer... params) { + Integer ManagerId = (Integer) params [0]; + //SoapObject response = getStudDtls(leadid); + + //unapprovedProjectListObj = new UnapprovedProjectListModule(); + unapprovedProjectListModules = new ArrayList(); + + String METHOD_NAME = "GetUnaprrovedProjectList"; + String NamespaceMail="http://mis.leadcampus.org/", SOAP_ACTION1="http://mis.leadcampus.org/GetUnaprrovedProjectList";//namespace+methodname + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + request.addProperty("ManagerId", ManagerId); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapObject response = (SoapObject) envelope.getResponse(); + Log.d("Tag","soap response Unapproved"+response.toString()); + + responseCount = response.getPropertyCount(); + + + Log.d("count", String.valueOf(response.getPropertyCount())); + + UnapprovedProjectListModule.listview_arr.clear(); + UnapprovedProjectList.listview_arr.clear(); + ArrayList innerObj_Class_centers = null; + if(responseCount>0) { + //complitionProjectListModules = new ArrayList(); + // ArrayList arrayList = new ArrayList(); + unapprovedInfosarr=new UnapprovedProjectListModule[responseCount]; + for (i = 0; i < responseCount; i++) + { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + unapprovedProjectListObj.setStudent_name(response_soapobj.getProperty("StudentName").toString());//StudentName + unapprovedProjectListObj.setCollege_name(response_soapobj.getProperty("College_name").toString()); + unapprovedProjectListObj.setProject_tittle(response_soapobj.getProperty("Title").toString()); + unapprovedProjectListObj.setAmount(response_soapobj.getProperty("Amount").toString()); + unapprovedProjectListObj.setLead_id(response_soapobj.getProperty("Lead_Id").toString()); + unapprovedProjectListObj.setProjectId(response_soapobj.getProperty("PDId").toString()); + + unapprovedProjectListObj.setcollegename(response_soapobj.getProperty("College_name").toString());//Lalbhai Dalpatbhai + unapprovedProjectListObj.setstreamname(response_soapobj.getProperty("StreamCode").toString());//Engineering + /* unapprovedProjectListObj.setProject_type(response_soapobj.getProperty("Theme").toString()); + unapprovedProjectListObj.setAction_plan(response_soapobj.getProperty("ActionPlan").toString()); + unapprovedProjectListObj.setBenficiaries(response_soapobj.getProperty("BeneficiaryNo").toString()); + unapprovedProjectListObj.setObjectivies(response_soapobj.getProperty("Objectives").toString()); + */ + unapprovedProjectListModules.add(unapprovedProjectListObj); + + // innerObj_Class_centers = new ArrayList(); + // innerObj_Class_centers.add(response_soapobj.getProperty("StudentName").toString()); //1 + Log.d("tag","unapprovedProjectListModules.get(i)="+unapprovedProjectListModules.get(i).getStudent_name()); + Log.d("tag","unapprovedProjectListModules="+unapprovedProjectListModules.size()); + Log.d("tag","unapprovedProjectListModules="+unapprovedProjectListObj.getStudent_name()); + + String Sname=response_soapobj.getProperty("StudentName").toString(); + String College=response_soapobj.getProperty("College_name").toString(); + String ProjectTittle=response_soapobj.getProperty("Title").toString(); + String Amount=response_soapobj.getProperty("Amount").toString(); + String ProjectId=response_soapobj.getProperty("PDId").toString(); + String Lead_id=response_soapobj.getProperty("Lead_Id").toString(); + String MobileNo=response_soapobj.getProperty("MobileNo").toString(); + String collegename=response_soapobj.getProperty("College_name").toString(); + String streamname=response_soapobj.getProperty("StreamCode").toString(); + /* String Project_type=response_soapobj.getProperty("ThemeName").toString(); + String ActionPlan=response_soapobj.getProperty("ActionPlan").toString(); + String BeneficiaryNo=response_soapobj.getProperty("BeneficiaryNo").toString(); + String Objectives=response_soapobj.getProperty("Objectives").toString(); +*/ + unapprovedInfosarr[i]=unapprovedProjectListObj; + + // UnapprovedProjectList.listview_arr.add(new UnapprovedProjectList(Sname, College,ProjectTittle, Amount,Lead_id,ProjectId,MobileNo,collegename,streamname)); + + UnapprovedProjectList.listview_arr.add(new UnapprovedProjectList(Sname, College,ProjectTittle,Amount,Lead_id,ProjectId,MobileNo,streamname)); + + Log.i("Tag","UnapprovedProjectListModule.getAmt="+ UnapprovedProjectList.listview_arr.size()); + } + } + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.d("exception outside",t.getMessage().toString()); + } + + return null; + } + + @Override + protected void onPreExecute() { + + progressBar.setVisibility(View.VISIBLE); + } + + @Override + protected void onPostExecute(SoapObject result) { + progressBar.setVisibility(View.GONE); + + + /*Log.i("Tag","unapprovedInfosarr==="+unapprovedInfosarr); + Log.i("Tag","unapprovedInfosarr.length==="+unapprovedInfosarr.length);*/ + if(result!=null) + { + showActivity(); + } + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + +} diff --git a/app/src/main/java/com/leadcampusapp/PMUnapprovedFragmentModel.java b/app/src/main/java/com/leadcampusapp/PMUnapprovedFragmentModel.java new file mode 100644 index 0000000..ca07fa0 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/PMUnapprovedFragmentModel.java @@ -0,0 +1,84 @@ +package com.leadcampusapp; + +import com.leadcampusapp.module.UnapprovedProjectListModule; + +import java.util.ArrayList; + +public class PMUnapprovedFragmentModel { + private String Name; + private String college; + private String project_title; + private String budget; + private String lead_id; + private String proj_id; + private String MobileNo; + + public static ArrayList listview_arrs=new ArrayList(); + + + public PMUnapprovedFragmentModel(String name, String college, String project_title, String budget,String lead_id,String proj_id,String mobileNo) { + Name = name; + this.college = college; + this.project_title = project_title; + this.budget = budget; + this.lead_id = lead_id; + this.proj_id = proj_id; + this.MobileNo = mobileNo; + } + + public String getName() { + return Name; + } + + public void setName(String name) { + Name = name; + } + + public String getCollege() { + return college; + } + + public void setCollege(String college) { + this.college = college; + } + + public String getProject_title() { + return project_title; + } + + public void setProject_title(String project_title) { + this.project_title = project_title; + } + + public String getBudget() { + return budget; + } + + public void setBudget(String budget) { + this.budget = budget; + } + + public String getLead_id() { + return lead_id; + } + + public void setLead_id(String lead_id) { + this.lead_id = lead_id; + } + + public String getProj_id() { + return proj_id; + } + + public void setProj_id(String proj_id) { + this.proj_id = proj_id; + } + + public String getMobileNo() { + return MobileNo; + } + + public void setMobileNo(String mobileNo) { + MobileNo = mobileNo; + } +} diff --git a/app/src/main/java/com/leadcampusapp/PMUnapproved_DetailsActivity.java b/app/src/main/java/com/leadcampusapp/PMUnapproved_DetailsActivity.java new file mode 100644 index 0000000..710c516 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/PMUnapproved_DetailsActivity.java @@ -0,0 +1,2838 @@ +package com.leadcampusapp; + +import android.annotation.SuppressLint; +import android.app.ActionBar.LayoutParams; +import android.app.AlertDialog; +import android.app.DatePickerDialog; +import android.app.Dialog; +import android.app.DialogFragment; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.Color; +import android.graphics.Typeface; +import android.net.Uri; +import android.os.AsyncTask; +import android.os.Bundle; +import androidx.core.content.ContextCompat; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.AppCompatSpinner; +import android.text.Editable; +import android.text.Html; +import android.text.TextWatcher; +import android.util.Log; +import android.view.Gravity; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.DatePicker; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.ProgressBar; +import android.widget.TableLayout; +import android.widget.TableRow; +import android.widget.TextView; +import android.widget.Toast; + +//import com.android.sripad.leadnew_22_6_2018.R; + +import org.joda.time.Days; +import org.joda.time.LocalDate; +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.HashMap; +import java.util.Set; + + +public class PMUnapproved_DetailsActivity extends AppCompatActivity implements ConnectivityReceiver.ConnectivityReceiverListener{ + + private static final String TAG = "Tag"; + + String material[]={"Books","Digital camera","Pen","Mouse","xyz"}; + String cost[]={"100","200","300","400"}; + String LeadId,ProjectId; + Integer Lead_Id,Project_Id; + // private AppCompatSpinner spin_projtype; + + private ArrayList lstMaterialName = new ArrayList(); + private ArrayList lstMaterialCost = new ArrayList(); + + private ArrayList lstMemberName = new ArrayList(); + private ArrayList lstMemberEmail = new ArrayList<>(); + + private String projectId = null; + private String str_totalCost = null; + private HashMap hashProjTypeId = new HashMap(); + + private int flag=1; + + Context context; + AppCompatSpinner spin_projectType; + EditText edt_projectType; + EditText edt_title; + EditText edt_noOfBeneficiaries,edt_whoareBeneficiaries; + EditText edt_objectives; + EditText edt_actionPlan; + EditText edt_pmcomment; + EditText edt_amount,edt_resources,edt_CurrentSituation; + EditText edt_placeofImp; + TextView txt_PMComments; + TextView txt_TotalCost,txt_mobileno; + ImageView btn_save,btn_approve,btn_reapply,btn_cancle,btn_reject,img_student; + Integer ManagerId; + String str_ProjectTitle = null,str_ThemeName = null,str_whoareBeneficiaries=null,str_BeneficiaryNo = null,str_Objective = null,str_actionPlan = null,str_imageUrl=null,str_MobileNo=null,str_ManagerComments=null,str_materialName=null,str_memberName=null,str_materialCost=null,str_memberEmail=null,str_placeofImp=null,str_CurrentSituation=null; + String str_collegename="", str_streamname=""; + String str_Resource=null; + String PMImgUrl; + private String serverPath = Class_URL.ServerPath.toString().trim(); + + + + + + static TextView clickstart_pmunapproved_editdate_tv; + static TextView clickend_pmunapproved_editdate_tv; + static String yyyyMMdd_pmstartdate = ""; + static String yyyyMMdd_pmenddate = ""; + + private static TextView pm_numberofdays_tv; + LinearLayout pm_datelabel_linerlayout,pm_date_linerlayout; + + static LinearLayout pm_days_linearlayout; + + TextView pmunapproved_streamname_tv,pmunapproved_collegename_tv; + CheckBox pmunapprov_impactproject_cb; + public Button pm_chat_txt; + int int_impactproject=0; + @Override + protected void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + setContentView(R.layout.pmactivity_unapproved__details); + + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + //getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background)); + + View actionBarView = getSupportActionBar().getCustomView(); + TextView actionBarTV = (TextView) actionBarView.findViewById(R.id.txt_actionBar); + actionBarTV.setText("Pending Approval"); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); + + Intent intent = getIntent(); + String Name = intent.getStringExtra("name"); + LeadId = intent.getStringExtra("lead_id"); + ProjectId= intent.getStringExtra("Project_id"); + str_MobileNo=intent.getStringExtra("MobileNo"); + str_collegename=intent.getStringExtra("collegename"); + str_streamname=intent.getStringExtra("streamname"); + Log.e(TAG,"name="+Name); + Log.e(TAG,"lead_id="+LeadId); + Log.e(TAG,"Project_id="+ProjectId); + Log.e(TAG,"streamname="+intent.getStringExtra("streamname")); + + /* ManagerId = getIntent().getExtras().getInt("ManagerId"); + Log.i("tag","MangerID PMProjectDetails="+ManagerId); +*/ + // Lead_Id=Integer.parseInt(LeadId); + Project_Id=Integer.parseInt(ProjectId); + //spin_projtype = (AppCompatSpinner) findViewById(R.id.spin_projectType); + + pmunapproved_collegename_tv=(TextView)findViewById(R.id.pmunapproved_collegename_tv); + pmunapproved_streamname_tv=(TextView)findViewById(R.id.pmunapproved_streamname_tv); + spin_projectType = (AppCompatSpinner) findViewById(R.id.spin_projectType); + // edt_projectType = (EditText) findViewById(R.id.edt_projectType); + edt_noOfBeneficiaries = (EditText) findViewById(R.id.edt_noOfBeneficiaries); + edt_objectives = (EditText) findViewById(R.id.edt_objective); + edt_actionPlan = (EditText) findViewById(R.id.edt_actionplan); + edt_title = (EditText) findViewById(R.id.edt_title); + edt_whoareBeneficiaries =(EditText) findViewById(R.id.edt_whoareBeneficiaries); + // txt_TotalCost=(TextView) findViewById(R.id.totalCost); + edt_pmcomment=(EditText) findViewById(R.id.edt_pmcomment); + edt_amount=(EditText) findViewById(R.id.edt_amount); + btn_save=(ImageView) findViewById(R.id.btn_save); + btn_approve=(ImageView) findViewById(R.id.btn_approval); + btn_reapply=(ImageView)findViewById(R.id.btn_reapply); + btn_cancle=(ImageView)findViewById(R.id.btn_cancle); + btn_reject=(ImageView) findViewById(R.id.btn_reject); + img_student=(ImageView) findViewById(R.id.img_student); + edt_placeofImp=(EditText) findViewById(R.id.edt_placeOfImpl); + edt_CurrentSituation=(EditText) findViewById(R.id.edt_CurrentSituation); + clickstart_pmunapproved_editdate_tv = (TextView) findViewById(R.id.clickstart_pmunapproved_editdate_TV); + clickend_pmunapproved_editdate_tv = (TextView) findViewById(R.id.clickend_pmunapproved_editdate_TV); + + + pm_numberofdays_tv=(TextView) findViewById(R.id.pm_numberofdays_tv); + pm_datelabel_linerlayout=(LinearLayout) findViewById(R.id.pm_datelabel_linerlayout); + pm_date_linerlayout=(LinearLayout) findViewById(R.id.pm_date_linerlayout); + pm_days_linearlayout=(LinearLayout) findViewById(R.id.pm_days_linearlayout); + pmunapprov_impactproject_cb=(CheckBox)findViewById(R.id.pmunapprov_impactproject_cb); + + pm_chat_txt=(Button) findViewById(R.id.pm_chat_txt); + + + // edt_resources=(EditText) findViewById(R.id.edt_resources); + + txt_mobileno =(TextView) findViewById(R.id.txt_mobileno); + TextView name_tv= (TextView) findViewById(R.id.txt_name); + name_tv.setText(Name); + + TextView leadId_tv=(TextView) findViewById(R.id.txt_lead_id); + leadId_tv.setText(LeadId); + txt_mobileno.setText(str_MobileNo); + + txt_mobileno.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(Intent.ACTION_DIAL); + intent.setData(Uri.parse("tel:"+txt_mobileno.getText().toString())); + startActivity(intent); + } + }); + //setProjectTypeSpinner(); + + pmunapproved_collegename_tv.setText(str_collegename); + pmunapproved_streamname_tv.setText(str_streamname); + + + + + getProjectType(); + + btn_save.setVisibility(View.GONE); + btn_cancle.setVisibility(View.GONE); + // btn_cancle.setEnabled(false); + + Log.i("tag","edt_title.hasFocus()=="+edt_title.hasFocus()); + Log.i("tag","edt_title.hasFocusable()=="+edt_title.hasFocusable()); + + /* edt_title.addTextChangedListener(loginTextWatcher); + edt_objectives.addTextChangedListener(loginTextWatcher); + edt_noOfBeneficiaries.addTextChangedListener(loginTextWatcher); + edt_actionPlan.addTextChangedListener(loginTextWatcher); +*/ + btn_save.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if(validation_Save()) { + SubmitSaveDetails submitSaveDetails = new SubmitSaveDetails(context); + submitSaveDetails.execute(); + } + } + }); + btn_approve.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (validation_Approval()) { + SubmitApproveDetails submitApproveDetails = new SubmitApproveDetails(context); + submitApproveDetails.execute(); + } + } + }); + btn_reapply.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (validation_ReApply()){ + SubmitReApplyDetails reApplyDetails = new SubmitReApplyDetails(context); + reApplyDetails.execute(); + } + } + }); + btn_reject.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if(validation_ReApply()) { + SubmitCancelDetails submitCancelDetails = new SubmitCancelDetails(context); + submitCancelDetails.execute(); + } + } + }); + btn_cancle.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + getProjectType_cancel(); + btn_save.setVisibility(View.GONE); + btn_cancle.setVisibility(View.GONE); + } + }); + pm_chat_txt.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Log.e("tag","ProjectId chat=="+ProjectId); + Intent i=new Intent(PMUnapproved_DetailsActivity.this,ChatActivity.class); + i.putExtra("projectStatus","pending"); + i.putExtra("projectId",ProjectId); + i.putExtra("userType","Manager"); + startActivity(i); + } + }); + + edt_title.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + + } + + @Override + public void afterTextChanged(Editable s) { + + if(edt_title.getText().toString().equals(str_ProjectTitle)){ + + } + else { + btn_save.setVisibility(View.VISIBLE); + btn_cancle.setVisibility(View.VISIBLE); + } + } + }); + + edt_noOfBeneficiaries.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + + } + + @Override + public void afterTextChanged(Editable s) { + + if(edt_noOfBeneficiaries.getText().toString().equals(str_BeneficiaryNo)){ + + } + else { + btn_save.setVisibility(View.VISIBLE); + btn_cancle.setVisibility(View.VISIBLE); + } + } + }); + + edt_objectives.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + + } + + @Override + public void afterTextChanged(Editable s) { + + if(edt_objectives.getText().toString().equals(str_Objective)){ + + } + else { + btn_save.setVisibility(View.VISIBLE); + btn_cancle.setVisibility(View.VISIBLE); + } + } + }); + + edt_actionPlan.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + + } + + @Override + public void afterTextChanged(Editable s) { + + if(edt_actionPlan.getText().toString().equals(str_actionPlan)){ + + } + else { + btn_save.setVisibility(View.VISIBLE); + btn_cancle.setVisibility(View.VISIBLE); + } + } + }); + + edt_whoareBeneficiaries.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + + } + + @Override + public void afterTextChanged(Editable s) { + + if(edt_whoareBeneficiaries.getText().toString().equals(str_whoareBeneficiaries)){ + + } + else { + btn_save.setVisibility(View.VISIBLE); + btn_cancle.setVisibility(View.VISIBLE); + } + } + }); + + edt_placeofImp.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + + } + + @Override + public void afterTextChanged(Editable s) { + + if(edt_placeofImp.getText().toString().equals(str_placeofImp)){ + + } + else { + btn_save.setVisibility(View.VISIBLE); + btn_cancle.setVisibility(View.VISIBLE); + } + } + }); + + //-----------------added by madhu 17/9/18 + edt_CurrentSituation.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + + } + + @Override + public void afterTextChanged(Editable s) { + + if(edt_CurrentSituation.getText().toString().equals(str_CurrentSituation)){ + + } + else { + btn_save.setVisibility(View.VISIBLE); + btn_cancle.setVisibility(View.VISIBLE); + } + } + }); + + Log.i("tag","pin_projectType.getSelectedItem()="+spin_projectType.getSelectedItem()); + spin_projectType.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected(AdapterView arg0, View arg1, + int arg2, long arg3) { + // TODO Auto-generated method stub + String msupplier=spin_projectType.getSelectedItem().toString(); + Log.e("Selected item : ",msupplier+"str_ThemeName="+str_ThemeName); + if(spin_projectType.getSelectedItem().equals(str_ThemeName)){ + Log.e("str_ThemeName : ",str_ThemeName); + }else{ + btn_save.setVisibility(View.VISIBLE); + btn_cancle.setVisibility(View.VISIBLE); + } + } + + @Override + public void onNothingSelected(AdapterView arg0) { + // TODO Auto-generated method stub + + } + }); + /* if (spin_projectType.getSelectedItem().equals(str_ThemeName)) { + Log.i("tag","str_ThemeName equal="+str_ThemeName); + }else{ + Log.i("tag","str_ThemeName not equal="+str_ThemeName); + }*/ + + + + + + clickstart_pmunapproved_editdate_tv.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + btn_save.setVisibility(View.VISIBLE); + btn_cancle.setVisibility(View.VISIBLE); + DialogFragment fromdateFragment = new DatePickerFragmentFromDate(); + fromdateFragment.show(getFragmentManager(), "Date Picker"); + } + }); + + + clickend_pmunapproved_editdate_tv.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + btn_save.setVisibility(View.VISIBLE); + btn_cancle.setVisibility(View.VISIBLE); + // settodate(); + DialogFragment dFragment = new DatePickerFragmentEndDate(); + // Show the date picker dialog fragment + dFragment.show(getFragmentManager(), "Date Picker"); + } + }); + + + + + pmunapprov_impactproject_cb.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) + { + + if(pmunapprov_impactproject_cb.isChecked()) + { + int_impactproject=1; + //Toast.makeText(getApplicationContext(),"Yes",Toast.LENGTH_SHORT).show(); + } + else{ + int_impactproject=0; + // Toast.makeText(getApplicationContext(),"No",Toast.LENGTH_SHORT).show(); + } + } + }); + + + + + + + }// end of Oncreate() + + + @Override + protected void onResume() { + super.onResume(); + + // register connection status listener + MyApplication.getInstance().setConnectivityListener(this); + } + + @Override + public void onNetworkConnectionChanged(boolean isConnected) { + showSnack(isConnected); + } + + private void showSnack(boolean isConnected) { + + if (!isConnected) { + + AlertDialog.Builder adb = new AlertDialog.Builder(PMUnapproved_DetailsActivity.this); + //adb.setView(alertDialogView); + + adb.setTitle("Sorry! Not connected to the internet"); + + adb.setIcon(android.R.drawable.ic_dialog_alert); + + adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + + adb.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + adb.setCancelable(true); + adb.show(); + } + +/* String message; + int color; + if (isConnected) { + message = "Good! Connected to Internet"; + color = Color.WHITE; + } else { + message = "Sorry! Not connected to internet"; + color = Color.RED; + } + + Snackbar snackbar = Snackbar + .make(findViewById(R.id.coordinator_layout), message, Snackbar.LENGTH_LONG); + + View sbView = snackbar.getView(); + TextView textView = (TextView) sbView.findViewById(android.support.design.R.id.snackbar_text); + textView.setTextColor(color); + snackbar.show();*/ + } + + /* private TextWatcher loginTextWatcher = new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + + } + + @Override + public void afterTextChanged(Editable s) { + /* if (edt_title.getText().toString().equals(str_ProjectTitle)) { + } else { + btn_save.setVisibility(View.VISIBLE); + btn_cancle.setVisibility(View.VISIBLE); + }*/ + /* Log.i("tag","edt_objectives.getText()=="+edt_objectives.getText().toString()); + Log.i("tag","str_Objective=="+str_Objective); + + if (edt_objectives.getText().toString().equals(str_Objective)) { + + } else { + btn_save.setVisibility(View.VISIBLE); + btn_cancle.setVisibility(View.VISIBLE); + } + } + };*/ + + private void getProjectType_cancel() { + ProjectTypeCancel projectTypeCancel = new ProjectTypeCancel(getApplicationContext()); + projectTypeCancel.execute(); + } + + public class ProjectTypeCancel extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + private ProgressBar progressBar; + + ProjectTypeCancel (Context ctx){ + context = ctx; + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + String METHOD_NAME = "GetThemeList"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetThemeList"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Login.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapObject response = (SoapObject) envelope.getResponse(); + //Log.d("soap responseyyyyyyy",response.toString()); + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.d("exception outside",t.getMessage().toString()); + } + + return null; + + + //Log.d("Soap response is",response.toString()); + + //return response; + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); + } + + @Override + protected void onPostExecute(SoapObject result) { + progressBar.setVisibility(View.GONE); + + if(result!=null) { + + String finalResult = result.toString(); + String finals = finalResult.replace("anyType", ""); + Log.d("Finals is", finals); + + ArrayList projectTypeList = new ArrayList(); + + Log.d("finalResultsssss", finalResult); + + for (int i = 0; i < result.getPropertyCount(); i++) { + SoapObject list = (SoapObject) result.getProperty(i); + SoapPrimitive S_ThemeId, S_ThemeName, S_Status; + Object O_ThemeId, O_ThemeName, O_Status; + + int projectTypeId = 0; + + String str_ProjectTypeId = null, str_ProjectType = null, str_status = null; + + O_ThemeId = list.getProperty("ThemeId"); + if (!O_ThemeId.toString().equals("anyType") && !O_ThemeId.toString().equals("anyType{}") && !O_ThemeId.toString().equals(null)) { + S_ThemeId = (SoapPrimitive) list.getProperty("ThemeId"); + Log.d("ProjectId", S_ThemeId.toString()); + str_ProjectTypeId = O_ThemeId.toString(); + projectTypeId = Integer.valueOf(str_ProjectTypeId); + } + + O_ThemeName = list.getProperty("ThemeName"); + if (!O_ThemeName.toString().equals("anyType") && !O_ThemeName.toString().equals("anyType{}") && !O_ThemeName.toString().equals(null)) { + S_ThemeName = (SoapPrimitive) list.getProperty("ThemeName"); + Log.d("ProjectType Name", S_ThemeName.toString()); + str_ProjectType = O_ThemeName.toString(); + + projectTypeList.add(str_ProjectType); + + hashProjTypeId.put(str_ProjectType, projectTypeId); + } + + } + + ViewProjectCancel viewProjectCancel = new ViewProjectCancel(context); + viewProjectCancel.execute(); + } + + //setProjectTypeSpinner(projectTypeList); + + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private void getProjectType() { + ProjectType projType = new ProjectType(getApplicationContext()); + projType.execute(); + } + + public class ViewProjectCancel extends AsyncTask { + + AlertDialog alertDialog; + private ProgressBar progressBar; + + ViewProjectCancel (Context ctx){ + context = ctx; + } + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapObject response = getProjectDetails(); + + //SoapPrimitive response =getProjectDetails(); + //Log.d("Soap response is",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); + } + + @Override + protected void onPostExecute(SoapObject result) { + SoapPrimitive S_ProjectTitle, S_ThemeName, S_BeneficiaryNo, S_Placeofimplement, S_Objective, S_actionPlan, S_MobileNo, S_ManagerComments, S_MemberEmail, S_MembersName, S_MaterialName, S_MaterialCost, S_TotalCost, S_StudImage,S_BeneficiariesList,S_CurrentSituation,S_Resource; + Object O_ProjectTitle, O_ThemeName, O_BeneficiaryNo, O_Placeofimplement, O_Objective, O_actionPlan,O_MobileNo, O_ManagerComments, O_MemberEmail, O_MembersName, O_MaterialName, O_MaterialCost, O_TotalCost, O_StudImage,O_BeneficiariesList,O_CurrentSituation,O_Resource; + SoapObject SO_ThemeName; + // if(flag==0) { + O_ProjectTitle = result.getProperty("Title"); + if (!O_ProjectTitle.toString().equals("anyType") && !O_ProjectTitle.toString().equals("anyType{}") && !O_ProjectTitle.toString().equals(null)) { + S_ProjectTitle = (SoapPrimitive) result.getProperty("Title"); + Log.d("Titlesssssss", S_ProjectTitle.toString()); + str_ProjectTitle = S_ProjectTitle.toString(); + } + + O_ThemeName = result.getProperty("ThemeName"); + if (O_ThemeName.toString().equals("anyType") && O_ThemeName.toString().equals("anyType{}") && O_ThemeName.toString().equals(null)) { + SO_ThemeName = (SoapObject) result.getProperty("ThemeName"); + Log.d("ThemeNamessss", SO_ThemeName.toString()); + str_ThemeName = SO_ThemeName.toString(); + // spin_projectType.setSelection(0); + } + if (!O_ThemeName.toString().equals("anyType") && !O_ThemeName.toString().equals("anyType{}") && !O_ThemeName.toString().equals(null)) { + S_ThemeName = (SoapPrimitive) result.getProperty("ThemeName"); + Log.d("ThemeNamessss", S_ThemeName.toString()); + str_ThemeName = S_ThemeName.toString(); + // spin_projectType.setSelection(0); + } + + O_BeneficiaryNo = result.getProperty("BeneficiaryNo"); + if (!O_BeneficiaryNo.toString().equals("anyType") && !O_BeneficiaryNo.toString().equals("anyType{}") && !O_BeneficiaryNo.toString().equals(null)) { + S_BeneficiaryNo = (SoapPrimitive) result.getProperty("BeneficiaryNo"); + Log.d("BeneficiaryNo", S_BeneficiaryNo.toString()); + str_BeneficiaryNo = S_BeneficiaryNo.toString(); + } + + O_Placeofimplement= result.getProperty("Placeofimplement"); + if (!O_Placeofimplement.toString().equals("anyType") && !O_Placeofimplement.toString().equals("anyType{}") && !O_Placeofimplement.toString().equals(null)) { + S_Placeofimplement = (SoapPrimitive) result.getProperty("Placeofimplement"); + Log.d("Placeofimplement", S_Placeofimplement.toString()); + str_placeofImp = S_Placeofimplement.toString(); + } + + O_Objective = result.getProperty("Objectives"); + if (!O_Objective.toString().equals("anyType") && !O_Objective.toString().equals("anyType{}") && !O_Objective.toString().equals(null)) { + S_Objective = (SoapPrimitive) result.getProperty("Objectives"); + Log.d("Objectivess", S_Objective.toString()); + str_Objective = S_Objective.toString(); + } + + O_actionPlan = result.getProperty("ActionPlan"); + if (!O_actionPlan.toString().equals("anyType") && !O_actionPlan.toString().equals("anyType{}") && !O_actionPlan.toString().equals(null)) { + S_actionPlan = (SoapPrimitive) result.getProperty("ActionPlan"); + Log.d("ActionPlansss", S_actionPlan.toString()); + str_actionPlan = S_actionPlan.toString(); + } + + O_StudImage = result.getProperty("Student_Image_Path"); + if (!O_StudImage.toString().equals("anyType") && !O_StudImage.toString().equals(null) && !O_StudImage.toString().equals("anyType{}")) { + S_StudImage = (SoapPrimitive) result.getProperty("Student_Image_Path"); + Log.d("Image Url", S_StudImage.toString()); + str_imageUrl = S_StudImage.toString(); + } +//-----------------added by madhu 17/9/18 + O_CurrentSituation= result.getProperty("CurrentSituation"); + if (!O_CurrentSituation.toString().equals("anyType") && !O_CurrentSituation.toString().equals("anyType{}") && !O_CurrentSituation.toString().equals(null)) { + S_CurrentSituation = (SoapPrimitive) result.getProperty("CurrentSituation"); + Log.d("CurrentSituation", S_CurrentSituation.toString()); + str_CurrentSituation = S_CurrentSituation.toString(); + } + + /* O_Resource= result.getProperty("Resource"); + if (!O_Resource.toString().equals("anyType") && !O_Resource.toString().equals("anyType{}") && !O_Resource.toString().equals(null)) { + S_Resource = (SoapPrimitive) result.getProperty("Resource"); + Log.d("Resource", S_Resource.toString()); + str_Resource = S_Resource.toString(); + } +*/ + /* O_MobileNo = result.getProperty("MobileNo"); + if (!O_MobileNo.toString().equals("anyType") && !O_MobileNo.toString().equals(null) && !O_MobileNo.toString().equals("anyType{}")) { + S_MobileNo = (SoapPrimitive) result.getProperty("MobileNo"); + Log.d("MobileNo", S_MobileNo.toString()); + str_MobileNo = S_MobileNo.toString(); + }*/ + + O_BeneficiariesList = result.getProperty("BeneficiariesList"); + if (!O_BeneficiariesList.toString().equals("anyType") && !O_BeneficiariesList.toString().equals("anyType{}") && !O_BeneficiariesList.toString().equals(null)) { + S_BeneficiariesList = (SoapPrimitive) result.getProperty("BeneficiariesList"); + Log.d("BeneficiariesList", S_BeneficiariesList.toString()); + str_whoareBeneficiaries = S_BeneficiariesList.toString(); + } + + String Imagestring = str_imageUrl; + if (Imagestring.equals("null") || Imagestring.equals("anyType{}")) { + // PMImgUrl="null"; + img_student.setImageResource(R.drawable.devanand); + } else { + String arr[] = Imagestring.split("/", 2); + + String firstWord = arr[0]; //the + String secondWord = arr[1]; + + PMImgUrl = serverPath + secondWord; + + Log.i("tag", "firstWord=" + firstWord + " secondWord=" + secondWord); + LoadGalleryImage loadGalleryImage = new LoadGalleryImage(PMUnapproved_DetailsActivity.this); + loadGalleryImage.execute(); + } + /* O_ManagerComments = result.getProperty("ManagerComments"); + if (!O_ManagerComments.toString().equals("anyType") && !O_ManagerComments.toString().equals(null)) { + S_ManagerComments = (SoapPrimitive) result.getProperty("ManagerComments"); + Log.d("Manager Comments", S_ManagerComments.toString()); + str_ManagerComments = S_ManagerComments.toString(); + }*/ + + O_TotalCost = result.getProperty("Amount"); + if (!O_TotalCost.toString().equals("anyType") && !O_TotalCost.toString().equals("anyType{}") && !O_TotalCost.toString().equals(null)) { + S_TotalCost = (SoapPrimitive) result.getProperty("Amount"); + Log.d("Total Cost", S_TotalCost.toString()); + str_totalCost = S_TotalCost.toString(); + } + + if (str_totalCost.equals("0")) { + edt_amount.setText("0"); + edt_amount.setEnabled(false); + } + + /* edt_projectType.setText(str_ThemeName); + edt_projectType.setFocusable(false); + edt_projectType.setInputType(0); + edt_projectType.setTextSize(15); +*/ + + + + + + + + + edt_title.setText(str_ProjectTitle); + // edt_title.setFocusable(true); + //edt_title.setInputType(0); + edt_title.setTextSize(15); + + edt_noOfBeneficiaries.setText(str_BeneficiaryNo); + // edt_noOfBeneficiaries.setFocusable(true); + // edt_noOfBeneficiaries.setInputType(0); + edt_noOfBeneficiaries.setTextSize(15); + + edt_objectives.setText(str_Objective); + // edt_objectives.setFocusable(true); + // edt_objectives.setInputType(0); + edt_objectives.setTextSize(15); + + edt_actionPlan.setText(str_actionPlan); + // edt_actionPlan.setFocusable(true); + // edt_actionPlan.setInputType(0); + edt_actionPlan.setTextSize(15); + edt_whoareBeneficiaries.setText(str_whoareBeneficiaries); + edt_whoareBeneficiaries.setTextSize(15); + + edt_placeofImp.setText(str_placeofImp); + edt_placeofImp.setTextSize(15); + +//-----------------added by madhu 17/9/18 + edt_CurrentSituation.setText(str_CurrentSituation); + edt_CurrentSituation.setTextSize(15); + + /* edt_resources.setText(str_Resource); + edt_resources.setTextSize(15);*/ +// txt_PMComments.setText(str_ManagerComments); + + SoapObject materialList = (SoapObject) result.getProperty("materials"); + for (int i = 0; i < materialList.getPropertyCount(); i++) { + SoapObject vmmateriallist = (SoapObject) materialList.getProperty(i); + + O_MaterialName = vmmateriallist.getProperty("MeterialName"); + if (!O_MaterialName.toString().equals("anyType") && !O_MaterialName.toString().equals("anyType{}") && !O_MaterialName.toString().equals(null)) { + S_MaterialName = (SoapPrimitive) vmmateriallist.getProperty("MeterialName"); + Log.d("MaterialNamesssss", S_MaterialName.toString()); + str_materialName = S_MaterialName.toString(); + + lstMaterialName.add(str_materialName); + } + + O_MaterialCost = vmmateriallist.getProperty("MeterialCost"); + if (!O_MaterialCost.toString().equals("anyType") && !O_MaterialCost.toString().equals("anyType{}") && !O_MaterialCost.toString().equals(null)) { + S_MaterialCost = (SoapPrimitive) vmmateriallist.getProperty("MeterialCost"); + Log.d("MaterialCostsssss", S_MaterialCost.toString()); + str_materialCost = S_MaterialCost.toString(); + + lstMaterialCost.add(str_materialCost); + } + } + + SoapObject MembersList = (SoapObject) result.getProperty("Members"); + for (int i = 0; i < MembersList.getPropertyCount(); i++) { + SoapObject vmmemberlist = (SoapObject) MembersList.getProperty(i); + + O_MembersName = vmmemberlist.getProperty("MemberName"); + if (!O_MembersName.toString().equals("anyType") && !O_MembersName.toString().equals("anyType{}") && !O_MembersName.toString().equals(null)) { + S_MembersName = (SoapPrimitive) vmmemberlist.getProperty("MemberName"); + Log.d("MemberNamesssss", S_MembersName.toString()); + str_memberName = S_MembersName.toString(); + + lstMemberName.add(str_memberName); + } + + O_MemberEmail = vmmemberlist.getProperty("MemberEmail"); + if (!O_MemberEmail.toString().equals("anyType") && !O_MemberEmail.toString().equals("anyType{}") && !O_MemberEmail.toString().equals(null)) { + S_MemberEmail = (SoapPrimitive) vmmemberlist.getProperty("MemberEmail"); + Log.d("MemberEmail", S_MemberEmail.toString()); + str_memberEmail = S_MemberEmail.toString(); + + lstMemberEmail.add(str_memberEmail); + } + } + // inintMembers(); + initProjectTypeSpinner(str_ThemeName); + progressBar.setVisibility(View.GONE); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + public boolean validation_Save(){ + + Boolean bfarmername=true,baddress=true,blocation=true,bimageview=true,bnetwork=true,bfees=true,bcluster=true; + Boolean datevalidationresult1=true,datevalidationresult2=true; + + /* if( edt_pmcomment.getText().toString().length() == 0 ){ + edt_pmcomment.setError( "Manager comments required!" );bfarmername=false;} + + if( edt_amount.getText().toString().length() == 0 ){ + edt_amount.setError( "Approved Amount required!" );baddress=false;}*/ + + if( edt_title.getText().toString().length() == 0 ){ + edt_title.setError( "Title required!" );blocation=false;} + + if( edt_actionPlan.getText().toString().length() == 0 ){ + edt_actionPlan.setError( "Action Plan required!" );blocation=false;} + + if( edt_noOfBeneficiaries.getText().toString().length() == 0 ){ + edt_noOfBeneficiaries.setError( "No of Beneficiaries required!" );blocation=false;} + + if( edt_whoareBeneficiaries.getText().toString().length() == 0){ + edt_whoareBeneficiaries.setError("Who are the beneficiaries required!");blocation=false; + } + if( edt_objectives.getText().toString().length() == 0 ){ + edt_objectives.setError( "Objectives required!" );blocation=false;} + + /*if(imageview.getDrawable() == null){ + Toast.makeText(MainActivity.this, "Image is not taken", Toast.LENGTH_LONG).show();bimageview= false;} +*/ + /*if(spin_bg.getSelectedItemPosition()==0){ + TextView errorText = (TextView) spin_bg.getSelectedView(); + errorText.setError("Select Fees"); + bfees=false; + } + if(cluster.getSelectedItemPosition() ==0){ + TextView errorText = (TextView) cluster.getSelectedView(); + errorText.setError("Select Cluster"); + bcluster=false; + }*/ + + + if(clickstart_pmunapproved_editdate_tv.getText().toString().length()==0||clickend_pmunapproved_editdate_tv.toString().length()==0 + ||clickstart_pmunapproved_editdate_tv.getText().toString().equalsIgnoreCase("0000-00-00") + ||clickend_pmunapproved_editdate_tv.getText().toString().equalsIgnoreCase("0000-00-00")) + { + Toast.makeText(getApplicationContext(), "Kindly enter the date", Toast.LENGTH_SHORT).show(); + datevalidationresult1=false; + } + + + + + if(clickstart_pmunapproved_editdate_tv.getText().toString().equalsIgnoreCase("Click for calendar")|| + clickend_pmunapproved_editdate_tv.getText().toString().equalsIgnoreCase("Click for calendar")) + { + Toast.makeText(getApplicationContext(), "Kindly enter the date", Toast.LENGTH_SHORT).show(); + datevalidationresult1=false; + } + + + /* if((yyyyMMdd_pmstartdate.toString().length()!=0)&&(yyyyMMdd_pmenddate.toString().length()!=0) ) + {*/ + /*if(date1.compareTo(date2)<0){ //0 comes when two date are same, + //1 comes when date1 is higher then date2 + //-1 comes when date1 is lower then date2 }*/ + + + if( !(clickstart_pmunapproved_editdate_tv.getText().toString().length()==0) + &&!(clickend_pmunapproved_editdate_tv.getText().toString().length()==0) + &&!(clickstart_pmunapproved_editdate_tv.getText().toString().equalsIgnoreCase("0000-00-00")) + &&!(clickend_pmunapproved_editdate_tv.getText().toString().equalsIgnoreCase("0000-00-00"))) + { + + + + SimpleDateFormat mdyFormat = new SimpleDateFormat("yyyy-MM-dd"); //2017-06-22 + + try { + Date fromdate = mdyFormat.parse(clickstart_pmunapproved_editdate_tv.getText().toString()); + Date todate = mdyFormat.parse(clickend_pmunapproved_editdate_tv.getText().toString()); + + if(fromdate.compareTo(todate)<=0) + { + datevalidationresult2=true; + } + else{ + Toast.makeText(getApplicationContext(), "Kindly enter valid date", Toast.LENGTH_SHORT).show(); + datevalidationresult2=false; + } + + + } catch (ParseException e) { + e.printStackTrace(); + } + }//end of if + + + if(bfarmername&&baddress&&blocation&&bimageview&&bnetwork&&bfees&&bcluster + &&datevalidationresult1&&datevalidationresult2) { + return true; + }else{return false;} + } + + public boolean validation_Approval(){ + + Boolean bfarmername=true,baddress=true,blocation=true,bimageview=true,bnetwork=true,bfees=true,bcluster=true; + Boolean datevalidationresult1=true,datevalidationresult2=true; + + if( edt_pmcomment.getText().toString().length() == 0 ){ + edt_pmcomment.setError( "Manager comments required!" );bfarmername=false;} + + if( edt_amount.getText().toString().length() == 0 ){ + edt_amount.setError( "Approved Amount required!" );baddress=false;} + + if( edt_title.getText().toString().length() == 0 ){ + edt_title.setError( "Title required!" );blocation=false;} + + if( edt_actionPlan.getText().toString().length() == 0 ){ + edt_actionPlan.setError( "Action Plan required!" );blocation=false;} + + if( edt_noOfBeneficiaries.getText().toString().length() == 0 ){ + edt_noOfBeneficiaries.setError( "No of Beneficiaries required!" );blocation=false;} + + if( edt_objectives.getText().toString().length() == 0 ){ + edt_objectives.setError( "Objectives required!" );blocation=false;} + + if( edt_whoareBeneficiaries.getText().toString().length() == 0){ + edt_whoareBeneficiaries.setError("Who are the beneficiaries required!");blocation=false; + } + /*if(imageview.getDrawable() == null){ + Toast.makeText(MainActivity.this, "Image is not taken", Toast.LENGTH_LONG).show();bimageview= false;} +*/ + /*if(spin_bg.getSelectedItemPosition()==0){ + TextView errorText = (TextView) spin_bg.getSelectedView(); + errorText.setError("Select Fees"); + bfees=false; + } + if(cluster.getSelectedItemPosition() ==0){ + TextView errorText = (TextView) cluster.getSelectedView(); + errorText.setError("Select Cluster"); + bcluster=false; + }*/ + + + /* if(yyyyMMdd_pmstartdate.toString().length()==0||yyyyMMdd_pmenddate.toString().length()==0 + ||yyyyMMdd_pmstartdate.equalsIgnoreCase("0000-00-00") + ||yyyyMMdd_pmenddate.equalsIgnoreCase("0000-00-00")) + { + Toast.makeText(getApplicationContext(), "Kindly enter the date", Toast.LENGTH_SHORT).show(); + datevalidationresult1=false; + }*/ + + + if(clickstart_pmunapproved_editdate_tv.getText().toString().length()==0||clickend_pmunapproved_editdate_tv.getText().toString().length()==0 + ||clickstart_pmunapproved_editdate_tv.getText().toString().equalsIgnoreCase("0000-00-00") + ||clickend_pmunapproved_editdate_tv.getText().toString().equalsIgnoreCase("0000-00-00")) + { + Toast.makeText(getApplicationContext(), "Kindly enter the date", Toast.LENGTH_SHORT).show(); + datevalidationresult1=false; + } + + if(clickstart_pmunapproved_editdate_tv.getText().toString().equalsIgnoreCase("Click for calendar")|| + clickend_pmunapproved_editdate_tv.getText().toString().equalsIgnoreCase("Click for calendar")) + { + Toast.makeText(getApplicationContext(), "Kindly enter the date", Toast.LENGTH_SHORT).show(); + datevalidationresult1=false; + } + + //if((yyyyMMdd_pmstartdate.toString().length()!=0)&&(yyyyMMdd_pmenddate.toString().length()!=0) ) + if( !(clickstart_pmunapproved_editdate_tv.getText().toString().length()==0) + &&!(clickend_pmunapproved_editdate_tv.getText().toString().length()==0) + &&!(clickstart_pmunapproved_editdate_tv.getText().toString().equalsIgnoreCase("0000-00-00")) + &&!(clickend_pmunapproved_editdate_tv.getText().toString().equalsIgnoreCase("0000-00-00"))) + { + /*if(date1.compareTo(date2)<0){ //0 comes when two date are same, + //1 comes when date1 is higher then date2 + //-1 comes when date1 is lower then date2 }*/ + + SimpleDateFormat mdyFormat = new SimpleDateFormat("yyyy-MM-dd"); //2017-06-22 + + try { + Date fromdate = mdyFormat.parse(clickstart_pmunapproved_editdate_tv.getText().toString()); + Date todate = mdyFormat.parse(clickend_pmunapproved_editdate_tv.getText().toString()); + + if(fromdate.compareTo(todate)<=0) + { + datevalidationresult2=true; + } + else{ + Toast.makeText(getApplicationContext(), "Kindly enter valid date", Toast.LENGTH_SHORT).show(); + datevalidationresult2=false; + } + + + } catch (ParseException e) { + e.printStackTrace(); + } + }//end of if + + + if(bfarmername&&baddress&&blocation&&bimageview&&bnetwork&&bfees&&bcluster&&datevalidationresult1 + &&datevalidationresult2) { + return true; + }else{return false;} + } + + public boolean validation_ReApply() + { + + Boolean bpmcomments=true; + + + if( edt_pmcomment.getText().toString().length() == 0 ){ + edt_pmcomment.setError( "Manager comments required!" );bpmcomments=false;} + + /*if( edt_amount.getText().toString().length() == 0 ){ + edt_amount.setError( "Approved Amount required!" );bamount=false;} +*/ + if(bpmcomments) { + return true; + }else{return false;} + } + + public class ProjectType extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + private ProgressBar progressBar; + + ProjectType (Context ctx){ + context = ctx; + } + + + @Override + protected SoapObject doInBackground(Void... params) { + + String METHOD_NAME = "GetThemeList"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetThemeList"; + + try{ + + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Login.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapObject response = (SoapObject) envelope.getResponse(); + //Log.d("soap responseyyyyyyy",response.toString()); + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.d("exception outside",t.getMessage().toString()); + } + + return null; + + + //Log.d("Soap response is",response.toString()); + + //return response; + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); + } + + @Override + protected void onPostExecute(SoapObject result) { + progressBar.setVisibility(View.GONE); + + + String finalResult = result.toString(); + String finals = finalResult.replace("anyType",""); + Log.d("Finals is",finals); + + ArrayList projectTypeList = new ArrayList(); + + Log.d("finalResultsssss",finalResult); + + for(int i=0;i < result.getPropertyCount();i++){ + SoapObject list = (SoapObject) result.getProperty(i); + SoapPrimitive S_ThemeId,S_ThemeName,S_Status; + Object O_ThemeId,O_ThemeName,O_Status; + + int projectTypeId=0; + + String str_ProjectTypeId=null,str_ProjectType=null,str_status=null; + + O_ThemeId = list.getProperty("ThemeId"); + if(!O_ThemeId.toString().equals("anyType") && !O_ThemeId.toString().equals("anyType{}") && !O_ThemeId.toString().equals(null)){ + S_ThemeId = (SoapPrimitive) list.getProperty("ThemeId"); + Log.d("ProjectId",S_ThemeId.toString()); + str_ProjectTypeId = O_ThemeId.toString(); + projectTypeId = Integer.valueOf(str_ProjectTypeId); + } + + O_ThemeName = list.getProperty("ThemeName"); + if(!O_ThemeName.toString().equals("anyType") && !O_ThemeName.toString().equals("anyType{}") && !O_ThemeName.toString().equals(null)){ + S_ThemeName = (SoapPrimitive) list.getProperty("ThemeName"); + Log.d("ProjectType Name",S_ThemeName.toString()); + str_ProjectType = O_ThemeName.toString(); + + projectTypeList.add(str_ProjectType); + + hashProjTypeId.put(str_ProjectType,projectTypeId); + } + + } + + ViewProject viewProject = new ViewProject(context); + viewProject.execute(); + + //setProjectTypeSpinner(projectTypeList); + + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapObject getProjectDetails() { + String METHOD_NAME = "GetUnapprovedProjectDetails"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetUnapprovedProjectDetails"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + request.addProperty("leadId",LeadId); + request.addProperty("PDId",Project_Id); + + Log.d("projectIdsssss",ProjectId); + //users.ad + //request.add + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + // Log.d("soap response1xxxx",envelope.getResponse().toString()); + + + SoapObject response = (SoapObject) envelope.getResponse(); + //SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + Log.e("soap responseyyyyyyy",response.toString()); + + //return null; + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + } + return null; + + } + + public class ViewProject extends AsyncTask { + + AlertDialog alertDialog; + private ProgressBar progressBar; + + ViewProject (Context ctx){ + context = ctx; + } + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapObject response = getProjectDetails(); + + //SoapPrimitive response =getProjectDetails(); + //Log.d("Soap response is",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); + } + + @Override + protected void onPostExecute(SoapObject result) { + SoapPrimitive S_ProjectTitle,S_ThemeName,S_BeneficiaryNo, S_Placeofimplement,S_Objective,S_actionPlan,S_ManagerComments,S_MembersName,S_MemberEmail,S_MaterialName,S_MaterialCost,S_TotalCost,S_StudImage,S_BeneficiariesList,S_CurrentSituation; + Object O_ProjectTitle,O_ThemeName,O_BeneficiaryNo, O_Placeofimplement,O_Objective,O_actionPlan,O_ManagerComments,O_MembersName,O_MemberEmail,O_MaterialName,O_MaterialCost,O_TotalCost,O_StudImage,O_BeneficiariesList,O_CurrentSituation; + SoapObject SO_ThemeName; + + SoapPrimitive S_startdate_pm,S_enddate_pm; + Object O_startdate_pm,O_enddate_pm = null; + String str_startdate_pm,str_enddate_pm; + + + // if(flag==0) { + O_ProjectTitle = result.getProperty("Title"); + if (!O_ProjectTitle.toString().equals("anyType{}") && !O_ProjectTitle.toString().equals(null)) { + S_ProjectTitle = (SoapPrimitive) result.getProperty("Title"); + Log.d("Titlesssssss", S_ProjectTitle.toString()); + str_ProjectTitle = S_ProjectTitle.toString(); + } + + O_ThemeName = result.getProperty("ThemeName"); + if (O_ThemeName.toString().equals("anyType{}") && O_ThemeName.toString().equals(null)) { + SO_ThemeName = (SoapObject) result.getProperty("ThemeName"); + Log.d("ThemeNamessss", SO_ThemeName.toString()); + str_ThemeName = SO_ThemeName.toString(); + // spin_projectType.setSelection(0); + } + if (!O_ThemeName.toString().equals("anyType{}") && !O_ThemeName.toString().equals(null)) { + S_ThemeName = (SoapPrimitive) result.getProperty("ThemeName"); + Log.d("ThemeNamessss", S_ThemeName.toString()); + str_ThemeName = S_ThemeName.toString(); + // spin_projectType.setSelection(0); + } + + O_BeneficiaryNo = result.getProperty("BeneficiaryNo"); + if (!O_BeneficiaryNo.toString().equals("anyType{}") && !O_BeneficiaryNo.toString().equals(null)) { + S_BeneficiaryNo = (SoapPrimitive) result.getProperty("BeneficiaryNo"); + Log.d("BeneficiaryNo", S_BeneficiaryNo.toString()); + str_BeneficiaryNo = S_BeneficiaryNo.toString(); + } + + O_Placeofimplement= result.getProperty("Placeofimplement"); + if (!O_Placeofimplement.toString().equals("anyType") && !O_Placeofimplement.toString().equals("anyType{}") && !O_Placeofimplement.toString().equals(null)) { + S_Placeofimplement = (SoapPrimitive) result.getProperty("Placeofimplement"); + Log.d("Placeofimplement", S_Placeofimplement.toString()); + str_placeofImp = S_Placeofimplement.toString(); + } + + O_Objective = result.getProperty("Objectives"); + if (!O_Objective.toString().equals("anyType{}") && !O_Objective.toString().equals(null)) { + S_Objective = (SoapPrimitive) result.getProperty("Objectives"); + Log.d("Objectivess", S_Objective.toString()); + str_Objective = S_Objective.toString(); + } + + O_actionPlan = result.getProperty("ActionPlan"); + if (!O_actionPlan.toString().equals("anyType{}") && !O_actionPlan.toString().equals(null)) { + S_actionPlan = (SoapPrimitive) result.getProperty("ActionPlan"); + Log.d("ActionPlansss", S_actionPlan.toString()); + str_actionPlan = S_actionPlan.toString(); + } + +//-----------------added by madhu 17/9/18 + O_CurrentSituation= result.getProperty("CurrentSituation"); + if (!O_CurrentSituation.toString().equals("anyType") && !O_CurrentSituation.toString().equals("anyType{}") && !O_CurrentSituation.toString().equals(null)) { + S_CurrentSituation = (SoapPrimitive) result.getProperty("CurrentSituation"); + Log.d("CurrentSituation", S_CurrentSituation.toString()); + str_CurrentSituation = S_CurrentSituation.toString(); + } +//------- + O_StudImage = result.getProperty("Student_Image_Path"); + if (!O_StudImage.toString().equals("anyType{}") && !O_StudImage.toString().equals(null)) { + S_StudImage = (SoapPrimitive) result.getProperty("Student_Image_Path"); + Log.d("Image Url", S_StudImage.toString()); + str_imageUrl = S_StudImage.toString(); + } + + O_BeneficiariesList = result.getProperty("BeneficiariesList"); + if (!O_BeneficiariesList.toString().equalsIgnoreCase("anyType") && !O_BeneficiariesList.toString().equals(null) && !O_BeneficiariesList.toString().equalsIgnoreCase("anyType{}")) { + S_BeneficiariesList = (SoapPrimitive) result.getProperty("BeneficiariesList"); + Log.d("BeneficiariesList", S_BeneficiariesList.toString()); + str_whoareBeneficiaries = S_BeneficiariesList.toString(); + } + + + O_startdate_pm= result.getProperty("ProjectStartDate"); + Log.e("startDate",O_startdate_pm.toString()); + + if (O_startdate_pm.toString().equalsIgnoreCase("anyType") + ||O_startdate_pm.toString().equals("0000-00-00") + ||O_startdate_pm.toString().equalsIgnoreCase("anyType{}")) + { + str_startdate_pm = "Click for Calendar"; + }else{ + + S_startdate_pm = (SoapPrimitive) result.getProperty("ProjectStartDate"); + + Log.e("startDate",S_startdate_pm.toString()); + str_startdate_pm = S_startdate_pm.toString(); + yyyyMMdd_pmstartdate=str_startdate_pm.toString(); + + + } + + // Toast.makeText(context,""+O_startdate.toString(),Toast.LENGTH_LONG).show(); + clickstart_pmunapproved_editdate_tv.setText(str_startdate_pm.toString()); + + + O_enddate_pm= result.getProperty("ProjectEndDate"); + if (O_enddate_pm.toString().equalsIgnoreCase("anyType") + ||O_enddate_pm.toString().equals("0000-00-00") + ||O_enddate_pm.toString().equalsIgnoreCase("anyType{}")) + { + str_enddate_pm = "Click for Calendar"; + + }else{ + + S_enddate_pm = (SoapPrimitive) result.getProperty("ProjectEndDate"); + + Log.e("endDate",S_enddate_pm.toString()); + str_enddate_pm = S_enddate_pm.toString(); + yyyyMMdd_pmenddate=str_enddate_pm.toString(); + + + } + clickend_pmunapproved_editdate_tv.setText(str_enddate_pm.toString()); + +//vijay + + + + if(str_startdate_pm.toString().equals("anyType{}") + || str_startdate_pm.toString().equals(null) + ||str_startdate_pm.toString().equals("0000-00-00") + ||str_startdate_pm.toString().equalsIgnoreCase("Click for Calendar") + ||str_enddate_pm.toString().equals("anyType{}") + ||str_enddate_pm.toString().equals(null) + ||str_enddate_pm.toString().equals("0000-00-00") + ||str_enddate_pm.toString().equalsIgnoreCase("Click for Calendar")) + { + pm_days_linearlayout.setVisibility(View.GONE); + + }else + { + + + try{ + int days_count = Days.daysBetween(new LocalDate(str_startdate_pm), new LocalDate(str_enddate_pm)).getDays(); + int int_days=days_count+1; + Log.e("days",String.valueOf(int_days)); + pm_numberofdays_tv.setText("Number of Days: "+String.valueOf(int_days)); + }catch(Throwable t) + { + pm_numberofdays_tv.setText(" "); + } + } + + + + + + + + + + Log.i("tag","str_imageUrl="+str_imageUrl); + String Imagestring = str_imageUrl; + if(Imagestring==null||Imagestring.equals("anyType{}")||Imagestring.equals("null")){ + // PMImgUrl="null"; + img_student.setImageResource(R.drawable.devanand); + }else { + String arr[] = Imagestring.split("/", 2); + + String firstWord = arr[0]; //the + String secondWord = arr[1]; + + PMImgUrl = serverPath + secondWord; + + Log.i("tag", "firstWord=" + firstWord + " secondWord=" + secondWord); + LoadGalleryImage loadGalleryImage=new LoadGalleryImage(PMUnapproved_DetailsActivity.this); + loadGalleryImage.execute(); + } + /* O_ManagerComments = result.getProperty("ManagerComments"); + if (!O_ManagerComments.toString().equals("anyType") && !O_ManagerComments.toString().equals(null)) { + S_ManagerComments = (SoapPrimitive) result.getProperty("ManagerComments"); + Log.d("Manager Comments", S_ManagerComments.toString()); + str_ManagerComments = S_ManagerComments.toString(); + }*/ + + O_TotalCost = result.getProperty("Amount"); + if (!O_TotalCost.toString().equals("anyType{}") && !O_TotalCost.toString().equals(null)) { + S_TotalCost = (SoapPrimitive) result.getProperty("Amount"); + Log.d("Total Cost", S_TotalCost.toString()); + str_totalCost = S_TotalCost.toString(); + } + + if(str_totalCost.equals("0")){ + edt_amount.setText("0"); + edt_amount.setEnabled(false); + } + + /* edt_projectType.setText(str_ThemeName); + edt_projectType.setFocusable(false); + edt_projectType.setInputType(0); + edt_projectType.setTextSize(15); +*/ + edt_title.setText(str_ProjectTitle); + // edt_title.setFocusable(true); + //edt_title.setInputType(0); + edt_title.setTextSize(15); + + edt_noOfBeneficiaries.setText(str_BeneficiaryNo); + // edt_noOfBeneficiaries.setFocusable(true); + // edt_noOfBeneficiaries.setInputType(0); + edt_noOfBeneficiaries.setTextSize(15); + + edt_objectives.setText(str_Objective); + // edt_objectives.setFocusable(true); + // edt_objectives.setInputType(0); + edt_objectives.setTextSize(15); + + edt_actionPlan.setText(str_actionPlan); + // edt_actionPlan.setFocusable(true); + // edt_actionPlan.setInputType(0); + edt_actionPlan.setTextSize(15); + + edt_whoareBeneficiaries.setText(str_whoareBeneficiaries); + edt_whoareBeneficiaries.setTextSize(15); + + edt_placeofImp.setText(str_placeofImp); + edt_placeofImp.setTextSize(15); + + //-----------------added by madhu 17/9/18 + edt_CurrentSituation.setText(str_CurrentSituation); + edt_CurrentSituation.setTextSize(15); +// txt_PMComments.setText(str_ManagerComments); + + SoapObject materialList = (SoapObject) result.getProperty("materials"); + for (int i = 0; i < materialList.getPropertyCount(); i++) { + SoapObject vmmateriallist = (SoapObject) materialList.getProperty(i); + + O_MaterialName = vmmateriallist.getProperty("MeterialName"); + if (!O_MaterialName.toString().equals("anyType") && !O_MaterialName.toString().equals("anyType{}") && !O_MaterialName.toString().equals(null)) { + S_MaterialName = (SoapPrimitive) vmmateriallist.getProperty("MeterialName"); + Log.d("MaterialNamesssss", S_MaterialName.toString()); + str_materialName = S_MaterialName.toString(); + + lstMaterialName.add(str_materialName); + } + O_MaterialCost = vmmateriallist.getProperty("MeterialCost"); + if (!O_MaterialCost.toString().equals("anyType") && !O_MaterialCost.toString().equals("anyType{}") && !O_MaterialCost.toString().equals(null)) { + S_MaterialCost = (SoapPrimitive) vmmateriallist.getProperty("MeterialCost"); + Log.d("MaterialCostsssss", S_MaterialCost.toString()); + str_materialCost = S_MaterialCost.toString(); + + lstMaterialCost.add(str_materialCost); + } + + + } + + SoapObject MembersList = (SoapObject) result.getProperty("Members"); + for (int i = 0; i < MembersList.getPropertyCount(); i++) { + SoapObject vmmemberlist = (SoapObject) MembersList.getProperty(i); + + O_MembersName = vmmemberlist.getProperty("MemberName"); + if (!O_MembersName.toString().equals("anyType") && !O_MembersName.toString().equals(null) && !O_MembersName.toString().equals("anyType{}")) { + S_MembersName = (SoapPrimitive) vmmemberlist.getProperty("MemberName"); + Log.d("MemberNamesssss", S_MembersName.toString()); + str_memberName = S_MembersName.toString(); + + lstMemberName.add(str_memberName); + } + + O_MemberEmail = vmmemberlist.getProperty("MemberEmail"); + if (!O_MemberEmail.toString().equals("anyType") && !O_MemberEmail.toString().equals("anyType{}") && !O_MemberEmail.toString().equals(null)) { + S_MemberEmail = (SoapPrimitive) vmmemberlist.getProperty("MemberEmail"); + Log.d("MemberEmail", S_MemberEmail.toString()); + str_memberEmail = S_MemberEmail.toString(); + + lstMemberEmail.add(str_memberEmail); + } + + } + initMaterials(); + initMembers(); + initProjectTypeSpinner(str_ThemeName); + + progressBar.setVisibility(View.GONE); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + public class LoadGalleryImage extends AsyncTask { + + private Context context; + // private ProgressBar progressBar; + + LoadGalleryImage (Context context){ + this.context = context; + } + + @Override + protected void onPreExecute() { + // progressBar = (ProgressBar) findViewById(R.id.progressBar); + // progressBar.setVisibility(View.VISIBLE); + + } + + @Override + protected Bitmap doInBackground(Void... params) { + ArrayList bitmapLst=null; + Bitmap bitmaplogo=null; + + try { + URL url= new URL(PMImgUrl); + Log.d("Urlssssssssssss",url.toString()); + bitmaplogo = BitmapFactory.decodeStream(url.openStream()); + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return bitmaplogo; + } + + @Override + protected void onPostExecute(Bitmap bitmap) { + // bitmapList.add(bitmap); + img_student.setImageBitmap(bitmap); + // progressBar.setVisibility(GONE); + } + } + + public class SubmitSaveDetails extends AsyncTask { + + AlertDialog alertDialog; + private ProgressBar progressBar; + + SubmitSaveDetails (Context ctx){ + context = ctx; + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapPrimitive response = updateProjectDetails(); + + //Log.d("Soap response issssss",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + if(result.toString().equals("Error")){ + Toast.makeText(context,"Error occured while saving to database",Toast.LENGTH_LONG).show(); + } + else{ + Toast.makeText(context,"Project Updated Successfully",Toast.LENGTH_LONG).show(); + finish(); + Intent ittEditProjToProjStatus = new Intent(PMUnapproved_DetailsActivity.this,PMProjectDetailActivity.class); + ittEditProjToProjStatus.putExtra("pageCount",0); + startActivity(ittEditProjToProjStatus); + } + progressBar.setVisibility(View.GONE); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapPrimitive updateProjectDetails() + { + String METHOD_NAME = "SaveUnapprovedprojectDetails1"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/SaveUnapprovedprojectDetails1"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + // long projectIds = (long) Integer.valueOf(projectId); + request.addProperty("PDId",Project_Id); + Log.d("PDIdssssssxxxx","hi"); + Log.d("PDIdssssssxxxx", String.valueOf(projectId)); + request.addProperty("Lead_Id",LeadId); + request.addProperty("Title",edt_title.getText().toString()); + Log.d("Titlesssssxxxx",edt_title.getText().toString()); + int themeId = hashProjTypeId.get(spin_projectType.getSelectedItem().toString()); + Log.d("themeidsssssxxxx", String.valueOf(themeId)); + request.addProperty("Theme",String.valueOf(themeId)); + long beneficiaryNo = (long) Integer.valueOf(edt_noOfBeneficiaries.getText().toString()); + Log.d("beneficiaryNosssxxxx", String.valueOf(beneficiaryNo)); + request.addProperty("BeneficiaryNo",beneficiaryNo); + Log.d("objectivesxxxxxx",edt_objectives.getText().toString()); + request.addProperty("Objectives",edt_objectives.getText().toString()); + Log.d("actionplansxxxxxx",edt_actionPlan.getText().toString()); + request.addProperty("ActionPlan",edt_actionPlan.getText().toString()); + request.addProperty("Beneficiaries",edt_whoareBeneficiaries.getText().toString()); + request.addProperty("Placeofimplement",edt_placeofImp.getText().toString()); + request.addProperty("CurrentSituation",edt_CurrentSituation.getText().toString()); + + + request.addProperty("ProjectStartDate",yyyyMMdd_pmstartdate.toString()); + request.addProperty("ProjectEndDate",yyyyMMdd_pmenddate.toString()); + + request.addProperty("ProjectEndDate",yyyyMMdd_pmenddate.toString()); + + Log.d("Requestisxxxxx",request.toString()); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapObject response = (SoapObject) envelope.getResponse(); + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + //Log.e("soapupdateProjectDtlsss",envelope.getResponse().toString()); + + //return null; + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + } + return null; + + } + + public class SubmitApproveDetails extends AsyncTask { + + AlertDialog alertDialog; + private ProgressBar progressBar; + + SubmitApproveDetails (Context ctx){ + context = ctx; + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapPrimitive response = updateApproveProjectDetails(); + + //Log.d("Soap response issssss",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + if(result.toString().equals("Error")){ + Toast.makeText(context,"Error occured while saving to database",Toast.LENGTH_LONG).show(); + } + else{ + Toast.makeText(context,"Project Approved Successfully",Toast.LENGTH_LONG).show(); + finish(); + Intent ittEditProjToProjStatus = new Intent(PMUnapproved_DetailsActivity.this,PMProjectDetailActivity.class); + ittEditProjToProjStatus.putExtra("pageCount",0); + startActivity(ittEditProjToProjStatus); + } + progressBar.setVisibility(View.GONE); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapPrimitive updateApproveProjectDetails() + { + String METHOD_NAME = "UpdateUnApprovedprojectDetails1"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/UpdateUnApprovedprojectDetails1"; + + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + // long projectIds = (long) Integer.valueOf(projectId); + request.addProperty("PDId",Project_Id); + Log.d("PDIdssssssxxxx","hi"); + Log.d("PDIdssssssxxxx", String.valueOf(projectId)); + request.addProperty("Lead_Id",LeadId); + request.addProperty("Title",edt_title.getText().toString()); + Log.d("Titlesssssxxxx",edt_title.getText().toString()); + int themeId = hashProjTypeId.get(spin_projectType.getSelectedItem().toString()); + Log.d("themeidsssssxxxx", String.valueOf(themeId)); + request.addProperty("Theme",String.valueOf(themeId)); + long beneficiaryNo = (long) Integer.valueOf(edt_noOfBeneficiaries.getText().toString()); + Log.d("beneficiaryNosssxxxx", String.valueOf(beneficiaryNo)); + request.addProperty("BeneficiaryNo",beneficiaryNo); + Log.d("objectivesxxxxxx",edt_objectives.getText().toString()); + request.addProperty("Objectives",edt_objectives.getText().toString()); + Log.d("actionplansxxxxxx",edt_actionPlan.getText().toString()); + request.addProperty("ActionPlan",edt_actionPlan.getText().toString()); + Log.d("actionplansxxxxxx",edt_amount.getText().toString()); + request.addProperty("SanctionAmount",edt_amount.getText().toString()); + Log.d("actionplansxxxxxx",edt_pmcomment.getText().toString()); + request.addProperty("ManagerComments",edt_pmcomment.getText().toString()); + request.addProperty("ProjectStatus","Approved"); + request.addProperty("Beneficiaries",edt_whoareBeneficiaries.getText().toString()); + request.addProperty("Placeofimplement",edt_placeofImp.getText().toString()); + request.addProperty("CurrentSituation",edt_CurrentSituation.getText().toString()); + + + + request.addProperty("ProjectStartDate",yyyyMMdd_pmstartdate.toString()); + request.addProperty("ProjectEndDate",yyyyMMdd_pmenddate.toString()); + request.addProperty("IsImpactProject",int_impactproject);//int + + Log.d("ReqPMunapprove",request.toString()); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + // Log.d("soap response1xxxx",envelope.getResponse().toString()); + + + //SoapObject response = (SoapObject) envelope.getResponse(); + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + //Log.e("soapupdateProjectDtlsss",envelope.getResponse().toString()); + + //return null; + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + } + return null; + + } + + public class SubmitReApplyDetails extends AsyncTask { + + AlertDialog alertDialog; + private ProgressBar progressBar; + + SubmitReApplyDetails (Context ctx){ + context = ctx; + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapPrimitive response = ReApplyProjectDetails(); + + // SoapObject response = ReApplyProjectDetails(); + //Log.d("Soap response issssss",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + if(result.toString().equals("Error")){ + Toast.makeText(context,"Error occured while saving to database",Toast.LENGTH_LONG).show(); + } + else{ + Toast.makeText(context,"Project Sent for Re-Apply",Toast.LENGTH_LONG).show(); + finish(); + Intent ittEditProjToProjStatus = new Intent(PMUnapproved_DetailsActivity.this,PMProjectDetailActivity.class); + ittEditProjToProjStatus.putExtra("pageCount",0); + startActivity(ittEditProjToProjStatus); + } + progressBar.setVisibility(View.GONE); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + private SoapPrimitive ReApplyProjectDetails() { + String METHOD_NAME = "ReApplayProject"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/ReApplayProject"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + // long projectIds = (long) Integer.valueOf(projectId); + request.addProperty("PDId",Project_Id); + Log.d("PDIdssssssxxxx","hi"); + Log.d("PDIdssssssxxxx", String.valueOf(projectId)); + + request.addProperty("ProjectStatus","RequestForModification"); + Log.d("actionplansxxxxxx",edt_pmcomment.getText().toString()); + request.addProperty("ManagerComments",edt_pmcomment.getText().toString()); + Log.d("Requestisxxxxx",request.toString()); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + // Log.d("soap response1xxxx",envelope.getResponse().toString()); + + // SoapObject response = (SoapObject) envelope.getResponse(); + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + //Log.e("soapupdateProjectDtlsss",envelope.getResponse().toString()); + + //return null; + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + } + return null; + + } + + public class SubmitCancelDetails extends AsyncTask { + + AlertDialog alertDialog; + private ProgressBar progressBar; + + SubmitCancelDetails (Context ctx){ + context = ctx; + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapPrimitive response = CancelProjectDetails(); + + // SoapObject response = ReApplyProjectDetails(); + //Log.d("Soap response issssss",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + if(result.toString().equals("Error")){ + Toast.makeText(context,"Error occured while saving to database",Toast.LENGTH_LONG).show(); + } + else{ + Toast.makeText(context,"Project Rejected Successfully",Toast.LENGTH_LONG).show(); + finish(); + Intent ittEditProjToProjStatus = new Intent(PMUnapproved_DetailsActivity.this,PMProjectDetailActivity.class); + ittEditProjToProjStatus.putExtra("pageCount",0); + startActivity(ittEditProjToProjStatus); + } + progressBar.setVisibility(View.GONE); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + private SoapPrimitive CancelProjectDetails() { + String METHOD_NAME = "RejectProject"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/RejectProject"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + // long projectIds = (long) Integer.valueOf(projectId); + request.addProperty("PDId",Project_Id); + Log.d("PDIdssssssxxxx","hi"); + Log.d("PDIdssssssxxxx", String.valueOf(projectId)); + request.addProperty("ProjectStatus","Rejected"); + Log.d("actionplansxxxxxx",edt_pmcomment.getText().toString()); + request.addProperty("ManagerComments",edt_pmcomment.getText().toString()); + Log.d("Requestisxxxxx",request.toString()); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + // Log.d("soap response1xxxx",envelope.getResponse().toString()); + + // SoapObject response = (SoapObject) envelope.getResponse(); + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + //Log.e("soapupdateProjectDtlsss",envelope.getResponse().toString()); + + //return null; + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + } + return null; + + } + + + + + // start of from date + @SuppressLint("ValidFragment") + public static class DatePickerFragmentFromDate extends DialogFragment + implements DatePickerDialog.OnDateSetListener{ + + @Override + public Dialog onCreateDialog(Bundle savedInstanceState) { + final Calendar c = Calendar.getInstance(); + int year = c.get(Calendar.YEAR); + int month = c.get(Calendar.MONTH); + int day = c.get(Calendar.DAY_OF_MONTH); + + + + DatePickerDialog dialog = new DatePickerDialog(getActivity(), + this, year, month, day); + + + /* dialog.getDatePicker().setMinDate(c.getTimeInMillis()); + dialog.getDatePicker().setMaxDate(c.getTimeInMillis()); +*/ + + /* dialog.getDatePicker().setMinDate(c.getTimeInMillis()); + c.add(Calendar.DAY_OF_MONTH,150); + dialog.getDatePicker().setMaxDate(c.getTimeInMillis()); +*/ + return dialog; + + + } + public void onDateSet(DatePicker view, int year, int month, int day) { + Calendar cal = new GregorianCalendar(year, month, day); + setDate(cal); + } + + public void setDate(final Calendar calendar) { + final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM); + //((TextView) findViewById(R.id.showDate)).setText(dateFormat.format(calendar.getTime())); + + + + + // SimpleDateFormat mdyFormat = new SimpleDateFormat("MM/dd/yyyy");//2017-06-22 + + SimpleDateFormat mdyFormat = new SimpleDateFormat("yyyy-MM-dd"); + yyyyMMdd_pmstartdate = mdyFormat.format(calendar.getTime()); + + + clickstart_pmunapproved_editdate_tv.setText(mdyFormat.format(calendar.getTime())); + // System.out.println("From date:"+ yyyyMMdd_fromdate); + } + + } + + + + + + public static class DatePickerFragmentEndDate extends DialogFragment + implements DatePickerDialog.OnDateSetListener{ + + @Override + public Dialog onCreateDialog(Bundle savedInstanceState) { + final Calendar c = Calendar.getInstance(); + int year = c.get(Calendar.YEAR); + int month = c.get(Calendar.MONTH); + int day = c.get(Calendar.DAY_OF_MONTH); + + + DatePickerDialog dialog = new DatePickerDialog(getActivity(), + this, year, month, day); + + // dialog.getDatePicker().setMaxDate(c.getTimeInMillis()); // this will set maximum date validation + //dialog.getDatePicker().setMinDate(System.currentTimeMillis() - 1000); + //dialog.getDatePicker().setMaxDate(c.getTimeInMillis()); + + // dialog.getDatePicker().setMaxDate(c.getTimeInMillis()+((1000*60*60*24*90)));//Error:fromDate: Sun Jun 18 12:50:44 GMT+05:30 2017 does not precede toDate: Fri Jun 09 02:45:11 GMT+05:30 2017 + + + /* dialog.getDatePicker().setMinDate(c.getTimeInMillis()); + c.add(Calendar.DAY_OF_MONTH,150); + dialog.getDatePicker().setMaxDate(c.getTimeInMillis());*/ + + return dialog; + + + } + public void onDateSet(DatePicker view, int year, int month, int day) { + Calendar cal = new GregorianCalendar(year, month, day); + setDate(cal); + } + + public void setDate(final Calendar calendar) { + final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM); + //((TextView) findViewById(R.id.showDate)).setText(dateFormat.format(calendar.getTime())); + + + + SimpleDateFormat mdyFormat = new SimpleDateFormat("yyyy-MM-dd"); //2017-06-22 + + yyyyMMdd_pmenddate = mdyFormat.format(calendar.getTime()); + + + clickend_pmunapproved_editdate_tv.setText(mdyFormat.format(calendar.getTime())); + + // System.out.println("To Date:"+ yyyyMMdd_todate); + + int days_count = Days.daysBetween(new LocalDate(yyyyMMdd_pmstartdate), new LocalDate(yyyyMMdd_pmenddate)).getDays(); + int int_days=days_count+1; + System.out.println ("Days: "+int_days); + pm_days_linearlayout.setVisibility(View.VISIBLE); + + pm_numberofdays_tv.setText("Number of days:"+String.valueOf(int_days)); + + /* if((int_days<=6)) + { + } + else{ + //alerts_dialog_fortodate(); + }*/ + + + } + + } + + +//----------------------------date------------------------------------ + + + + + + + + + + + + + + + + + + + + + + + + + + + + @SuppressLint("RestrictedApi") + private void setProjectTypeSpinner() { + final ArrayList liststate = new ArrayList(); + liststate.add("Select"); + liststate.add("Education"); + liststate.add("Health Care"); + liststate.add("Sports"); + + ArrayAdapter dataAdapterState = new ArrayAdapter(getApplicationContext(), R.layout.simple_spinner_items, liststate); + + // Drop down layout style - list view with radio button + dataAdapterState.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + + // attaching data adapter to spinner + // spin_projtype.setAdapter(dataAdapterState); + // spin_projtype.setSupportBackgroundTintList(ContextCompat.getColorStateList(getApplicationContext(), R.color.colorWhite)); + } + + public void init() { + TableLayout stk = (TableLayout) findViewById(R.id.table_main); + TableRow tbrow0 = new TableRow(this); + tbrow0.setPadding(40, 1, 1, 1); + + TextView tv0 = new TextView(this); + tv0.setText(" Material Name "); + tv0.setTextColor(Color.WHITE); + tv0.setGravity(Gravity.LEFT); + tv0.setTypeface(null, Typeface.BOLD); + tv0.setPadding(5, 10, 5, 5); + tbrow0.addView(tv0); + TextView tv1 = new TextView(this); + tv1.setText(" Cost "); + tv1.setTextColor(Color.WHITE); + tv1.setGravity(Gravity.CENTER); + tv1.setTypeface(null, Typeface.BOLD); + tv1.setPadding(50, 10, 0, 5); + tbrow0.addView(tv1); + stk.addView(tbrow0); + for (int i = 0; i < 4; i++) { + TableRow tbrow = new TableRow(this); + tbrow.setPadding(40, 1, 1, 1); + + tbrow.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); + TextView t1v = new TextView(this); + // t1v.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); + t1v.setWidth(700); + t1v.setText(material[i]); + t1v.setTextColor(Color.WHITE); + t1v.setGravity(Gravity.LEFT); + t1v.setPadding(5, 5, 5, 5); + + tbrow.addView(t1v); + TextView t2v = new TextView(this); + t2v.setText(cost[i]); + t2v.setTextColor(Color.WHITE); + t2v.setGravity(Gravity.CENTER); + t2v.setWidth(100); + t2v.setPadding(50, 5, 0, 5); + tbrow.addView(t2v); + stk.addView(tbrow); + } + + } + + @SuppressLint("RestrictedApi") + private void initProjectTypeSpinner(String projectTypeName) { + ArrayList projType = new ArrayList(); + + Set projTypeList = hashProjTypeId.keySet(); + + Log.i("tag","projectTypeName"+projectTypeName); + + for(String key: projTypeList){ + Log.d("Key is",key); + projType.add(key); + } + +/* projType.add("Education"); + projType.add("Health Care"); + projType.add("Sports");*/ + + ArrayAdapter dataAdapter2 = new ArrayAdapter(getApplicationContext(), R.layout.simple_spinner_items, projType); + + dataAdapter2.setDropDownViewResource(R.layout.spinnercustomstyle); + // Drop down layout style - list view with radio button + // dataAdapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + + // attaching data adapter to spinner + spin_projectType.setAdapter(dataAdapter2); + //spin_projectType.getBackground().setColorFilter(getResources().getColor(R.color.colorAccent), PorterDuff.Mode.SRC_ATOP); + + //spin_projectType.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorWhite)); + // spin_projectType.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorWhite)); + if(projectTypeName!="" || projectTypeName!=null) { + for (int i = 0; i < spin_projectType.getCount(); i++) { + if (spin_projectType.getItemAtPosition(i).equals(projectTypeName)) { + spin_projectType.setSelection(i); + break; + } + } + } + + + } + + /* public void initMaterials() { + TableLayout stk = (TableLayout) findViewById(R.id.table_material); + TableRow tbrow0 = new TableRow(this); + TextView tv0 = new TextView(this); + String matrl_name = " Material Name "; + tv0.setText(Html.fromHtml(matrl_name)); + tv0.setTextColor(Color.WHITE); + tv0.setGravity(Gravity.CENTER); + // tv0.setWidth(500); + tv0.setTypeface(null, Typeface.BOLD); + tv0.setPadding(5, 10, 5, 5); + tbrow0.addView(tv0); + TextView tv1 = new TextView(this); + String matrl_cost = " Cost "; + tv1.setText(Html.fromHtml(matrl_cost)); + tv1.setTextColor(Color.WHITE); + tv1.setGravity(Gravity.CENTER); + tv1.setTypeface(null, Typeface.BOLD); + // tv1.setWidth(300); + tv1.setPadding(70, 10, 0, 5); + tbrow0.addView(tv1); + stk.addView(tbrow0); + for (int i = 0; i < lstMaterialName.size() && i < lstMaterialCost.size(); i++) { + TableRow tbrow = new TableRow(this); + TextView t1v = new TextView(this); + t1v.setText(lstMaterialName.get(i)); + t1v.setTextColor(Color.WHITE); + t1v.setGravity(Gravity.CENTER); + // t1v.setWidth(500); + t1v.setPadding(5, 5, 5, 5); + tbrow.addView(t1v); + + TextView t2v = new TextView(this); + t2v.setText(lstMaterialCost.get(i)); + t2v.setTextColor(Color.WHITE); + t2v.setGravity(Gravity.CENTER); + // t2v.setWidth(100); + t2v.setPadding(70, 5, 0, 5); + tbrow.addView(t2v); + + stk.addView(tbrow); + } + + TableRow tbrow = new TableRow(this); + TextView t1v = new TextView(this); + t1v.setText("Total"); + t1v.setTypeface(null, Typeface.BOLD); + t1v.setTextColor(Color.WHITE); + t1v.setGravity(Gravity.CENTER); + // t1v.setWidth(700); + t1v.setPadding(5, 5, 5, 5); + tbrow.addView(t1v); + + TextView t2v = new TextView(this); + t2v.setText(str_totalCost); + t2v.setTextColor(Color.WHITE); + t2v.setTypeface(null, Typeface.BOLD); + t2v.setGravity(Gravity.CENTER); + //t2v.setWidth(100); + t2v.setPadding(70, 5, 0, 5); + tbrow.addView(t2v); + stk.addView(tbrow); + + // txt_TotalCost.setText(str_totalCost); + }*/ + + public void initMaterials() { + TableLayout stk = (TableLayout) findViewById(R.id.table_material); + TableRow tbrow0 = new TableRow(this); + TextView tv0 = new TextView(this); + String matrl_name = " Material Name "; + tv0.setText(Html.fromHtml(matrl_name)); + tv0.setTextColor(Color.BLACK); + tv0.setGravity(Gravity.CENTER); + tv0.setTypeface(null, Typeface.BOLD); + tv0.setPadding(5, 10, 5, 5); + tbrow0.addView(tv0); + TextView tv1 = new TextView(this); + String matrl_cost = " Cost "; + tv1.setText(Html.fromHtml(matrl_cost)); + tv1.setTextColor(Color.BLACK); + tv1.setGravity(Gravity.CENTER); + tv1.setTypeface(null, Typeface.BOLD); + tv1.setPadding(50, 10, 0, 5); + tbrow0.addView(tv1); + stk.addView(tbrow0); + for (int i = 0; i < lstMaterialName.size() && i < lstMaterialCost.size(); i++) { + TableRow tbrow = new TableRow(this); + TextView t1v = new TextView(this); + t1v.setText(lstMaterialName.get(i)); + t1v.setTextColor(Color.BLACK); + t1v.setGravity(Gravity.LEFT); + t1v.setPadding(5, 5, 5, 5); + tbrow.addView(t1v); + + TextView t2v = new TextView(this); + t2v.setText(lstMaterialCost.get(i)); + t2v.setTextColor(Color.BLACK); + t2v.setGravity(Gravity.CENTER); + t2v.setPadding(50, 5, 0, 5); + tbrow.addView(t2v); + + stk.addView(tbrow); + } + + TableRow tbrow = new TableRow(this); + TextView t1v = new TextView(this); + t1v.setText("Total"); + t1v.setTypeface(null, Typeface.BOLD); + t1v.setTextColor(Color.BLACK); + t1v.setGravity(Gravity.LEFT); + t1v.setPadding(5, 5, 5, 5); + tbrow.addView(t1v); + + TextView t2v = new TextView(this); + t2v.setText(str_totalCost); + t2v.setTextColor(Color.BLACK); + t2v.setTypeface(null, Typeface.BOLD); + t2v.setGravity(Gravity.CENTER); + t2v.setPadding(50, 5, 0, 5); + tbrow.addView(t2v); + + stk.addView(tbrow); + } + + public void initMembers() { + TableLayout stk = (TableLayout) findViewById(R.id.table_main); + TableRow tbrow0 = new TableRow(this); + TextView tv0 = new TextView(this); + String member_name = " Member Name "; + tv0.setText(Html.fromHtml(member_name)); + tv0.setTextColor(Color.BLACK); + tv0.setGravity(Gravity.CENTER); + tv0.setTypeface(null, Typeface.BOLD); + tv0.setPadding(5, 10, 5, 5); + tbrow0.addView(tv0); + TextView tv1 = new TextView(this); + String member_MailId = " Mail Id "; + tv1.setText(Html.fromHtml(member_MailId)); + tv1.setTextColor(Color.BLACK); + tv1.setGravity(Gravity.CENTER); + tv1.setTypeface(null, Typeface.BOLD); + tv1.setPadding(50, 10, 0, 5); + tbrow0.addView(tv1); + stk.addView(tbrow0); + for (int i = 0; i < lstMemberName.size() && i < lstMemberEmail.size(); i++) { + TableRow tbrow = new TableRow(this); + TextView t1v = new TextView(this); + t1v.setText(lstMemberName.get(i)); + t1v.setTextColor(Color.BLACK); + t1v.setGravity(Gravity.LEFT); + t1v.setPadding(5, 5, 5, 5); + tbrow.addView(t1v); + + TextView t2v = new TextView(this); + t2v.setText(lstMemberEmail.get(i)); + t2v.setTextColor(Color.BLACK); + t2v.setGravity(Gravity.CENTER); + t2v.setPadding(50, 5, 0, 5); + tbrow.addView(t2v); + + stk.addView(tbrow); + } + + } + + + + //Date fragment + + + + + + + + + + + //Date Fragment + + + + + /* public void inintMembers() { + TableLayout stk = (TableLayout) findViewById(R.id.table_main); + TableRow tbrow0 = new TableRow(this); + TextView tv0 = new TextView(this); + String matrl_name = " Member Names "; + tv0.setText(Html.fromHtml(matrl_name)); + tv0.setTextColor(Color.WHITE); + tv0.setGravity(Gravity.CENTER); + // tv0.setWidth(500); + tv0.setTypeface(null, Typeface.BOLD); + tv0.setPadding(5, 10, 5, 5); + tbrow0.addView(tv0); + TextView tv1 = new TextView(this); + String matrl_cost = " Email "; + tv1.setText(Html.fromHtml(matrl_cost)); + tv1.setTextColor(Color.WHITE); + tv1.setGravity(Gravity.CENTER); + tv1.setTypeface(null, Typeface.BOLD); + // tv1.setWidth(300); + tv1.setPadding(70, 10, 0, 5); + tbrow0.addView(tv1); + stk.addView(tbrow0); + for (int i = 0; i < lstMemberName.size() && i < lstMemberEmail.size(); i++) { + TableRow tbrow = new TableRow(this); + TextView t1v = new TextView(this); + t1v.setText(lstMemberName.get(i)); + t1v.setTextColor(Color.WHITE); + t1v.setGravity(Gravity.CENTER); + // t1v.setWidth(500); + t1v.setPadding(5, 5, 5, 5); + tbrow.addView(t1v); + + TextView t2v = new TextView(this); + t2v.setText(lstMemberEmail.get(i)); + t2v.setTextColor(Color.WHITE); + t2v.setGravity(Gravity.CENTER); + // t2v.setWidth(100); + t2v.setPadding(70, 5, 0, 5); + tbrow.addView(t2v); + + stk.addView(tbrow); + } + + *//* TableRow tbrow = new TableRow(this); + TextView t1v = new TextView(this); + t1v.setText("Total"); + t1v.setTypeface(null, Typeface.BOLD); + t1v.setTextColor(Color.WHITE); + t1v.setGravity(Gravity.CENTER); + // t1v.setWidth(700); + t1v.setPadding(5, 5, 5, 5); + tbrow.addView(t1v); + + TextView t2v = new TextView(this); + t2v.setText(str_totalCost); + t2v.setTextColor(Color.WHITE); + t2v.setTypeface(null, Typeface.BOLD); + t2v.setGravity(Gravity.CENTER); + //t2v.setWidth(100); + t2v.setPadding(70, 5, 0, 5); + tbrow.addView(t2v); + stk.addView(tbrow); +*//* + // txt_TotalCost.setText(str_totalCost); + } +*/ + /* @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_main, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + + if (id == R.id.action_editProfile) { + Intent itthomeToEditProfile = new Intent(PMUnapproved_DetailsActivity.this ,PMEditProfileActivity.class); + startActivity(itthomeToEditProfile); + return true; + } + + if (id == R.id.action_logout) { + Intent itthomeToLogin = new Intent(PMUnapproved_DetailsActivity.this ,LoginActivity.class); + startActivity(itthomeToLogin); + return true; + } + + return super.onOptionsItemSelected(item); + } + */ + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_main, menu); + MenuItem action_editProfile = menu.findItem(R.id.action_editProfile); + action_editProfile.setVisible(false); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + + /* if (id == R.id.action_editProfile) { + Intent ittProjDtlsToEditProfile = new Intent(PMUnapproved_DetailsActivity.this ,PMEditProfileActivity.class); + ittProjDtlsToEditProfile.putExtra("ManagerId",ManagerId); + startActivity(ittProjDtlsToEditProfile); + return true; + } + */ + + if (id == R.id.action_logout) { + Intent ittProjDtlsToLogin = new Intent(PMUnapproved_DetailsActivity.this ,LoginActivity.class); + startActivity(ittProjDtlsToLogin); + return true; + } + + if (id == android.R.id.home) { + Intent ittProjDtlsToHome = new Intent(PMUnapproved_DetailsActivity.this ,PMProjectDetailActivity.class); + ittProjDtlsToHome.putExtra("pageCount",0); + startActivity(ittProjDtlsToHome); + return true; + } + + + + return super.onOptionsItemSelected(item); + } +} diff --git a/app/src/main/java/com/leadcampusapp/PM_Project_FundMain.java b/app/src/main/java/com/leadcampusapp/PM_Project_FundMain.java new file mode 100644 index 0000000..5d9a44b --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/PM_Project_FundMain.java @@ -0,0 +1,514 @@ +package com.leadcampusapp; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.AppCompatSpinner; +import androidx.core.content.ContextCompat; + +import android.annotation.SuppressLint; +import android.app.DatePickerDialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.os.AsyncTask; +import android.os.Bundle; +import android.util.Log; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.DatePicker; +import android.widget.EditText; +import android.widget.ListView; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; + +public class PM_Project_FundMain extends AppCompatActivity { + + AppCompatSpinner spin_ticketStatus; + Class_Project_FundMain obj_Class_Project_FundMain; + String str_ticketSlno,str_ticketStatus,str_Status; + int ticketStatusCount; + Class_Project_FundMain[] arrayObj_Class_TicketStatus; + ArrayAdapter adapter_ticketStatus; + + EditText edt_fromdate,edt_todate,fromdateseterror_TV,todateseterror_TV; + private int mYear, mMonth, mDay; + private int cYear, cMonth, cDay; + Class_FromToDate[] arrayObj_Class_FromToDate; + String FromDate,ToDate; + String str_FromToDateStatus; + int From_ToDateCount; + String yearID,str_yearID; + ListView lv_summary; + + @SuppressLint("RestrictedApi") + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_project_fund_main); + + spin_ticketStatus= (AppCompatSpinner) findViewById(R.id.spin_ticketStatus); + edt_fromdate = (EditText) findViewById(R.id.edt_fromdate); + fromdateseterror_TV = (EditText) findViewById(R.id.fromdateseterror_TV); + edt_todate = (EditText) findViewById(R.id.edt_todate); + todateseterror_TV = (EditText) findViewById(R.id.todateseterror_TV); + + lv_summary = (ListView) findViewById(R.id.lv_summary); + + // TicketStatusAsyncCallWS ticketStatusAsyncCallWS=new TicketStatusAsyncCallWS(getApplicationContext()); + // ticketStatusAsyncCallWS.execute(); + GetFromToDateAsyncCallWS getFromToDateAsyncCallWS=new GetFromToDateAsyncCallWS(getApplicationContext()); + getFromToDateAsyncCallWS.execute(); + + ArrayList arrayList = new ArrayList<>(); + arrayList.add("Pending"); + arrayList.add("Manager Reject"); + arrayList.add("Accontent Reject"); + + + adapter_ticketStatus = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayList); + //dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + adapter_ticketStatus.setDropDownViewResource(R.layout.spinnercustomstyle); + // districtsearch_ATV.setAdapter(dataAdapter_district); + spin_ticketStatus.setAdapter(adapter_ticketStatus); + spin_ticketStatus.setSupportBackgroundTintList(ContextCompat.getColorStateList(getApplicationContext(), R.color.colorBlack)); + + spin_ticketStatus.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected (AdapterView < ? > parent, View view, + int position, long id){ + // TODO Auto-generated method stub + // obj_Class_Project_FundMain = (Class_Project_FundMain) spin_ticketStatus.getSelectedItem(); + + String ticketStatus = parent.getItemAtPosition(position).toString(); + + if(ticketStatus.equalsIgnoreCase("Manager Reject")){ + str_ticketStatus="MR"; + }else if(ticketStatus.equalsIgnoreCase("Accontent Reject")){ + str_ticketStatus="AR"; + }else if(ticketStatus.equalsIgnoreCase("Pending")){ + str_ticketStatus="Pending"; + } +// str_ticketSlno = obj_Class_Project_FundMain.getSlno().toString(); + // str_ticketStatus = obj_Class_Project_FundMain.getTicket_Status().toString(); + + Log.e("tag","str_ticketStatus="+str_ticketStatus); + + // Toast.makeText(getApplicationContext(),"str_Programsid: "+str_programid,Toast.LENGTH_SHORT).show(); + } + + @Override + public void onNothingSelected (AdapterView < ? > parent){ + // TODO Auto-generated method stub + } + }); + + edt_fromdate.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + final Calendar c = Calendar.getInstance(); + + mYear = c.get(Calendar.YEAR); + mMonth = c.get(Calendar.MONTH); + mDay = c.get(Calendar.DAY_OF_MONTH); + + DatePickerDialog datePickerDialog = new DatePickerDialog(getApplicationContext(), R.style.DatePickerTheme, + new DatePickerDialog.OnDateSetListener() { + + @Override + public void onDateSet(DatePicker view, int year, + int monthOfYear, int dayOfMonth) { + + cDay = dayOfMonth; + cMonth = monthOfYear; + cYear = year; + + // String date =dayOfMonth + "/" + (monthOfYear + 1) + "/" + year; + // String date =year + "-" + (monthOfYear + 1) + "-" + dayOfMonth; + String date =dayOfMonth + "-" + (monthOfYear + 1) + "-" + year; + + + SimpleDateFormat dateFormat= new SimpleDateFormat("dd-MM-yyyy"); + // SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd"); + + try { + Date d=dateFormat.parse(date); + System.out.println("Formated from"+dateFormat.format(d)); + fromdateseterror_TV.setVisibility(View.GONE); + edt_fromdate.setText(dateFormat.format(d).toString()); + + } + catch(Exception e) { + //java.text.ParseException: Unparseable date: Geting error + System.out.println("Excep"+e); + } + //TextView txtExactDate = (TextView) findViewById(R.id.txt_exactDate); + + + //txtDate.edita + } + }, mYear, mMonth, mDay); + + datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()); + //datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()-(1000 * 60 * 60 * 24 * 365 * 14)); + // - (1000 * 60 * 60 * 24 * 365.25 * 14) +//------ + + datePickerDialog.show(); + // originalList.clear(); + spin_ticketStatus.setSelection(0); + //adapter.notifyDataSetChanged(); + } + }); + edt_todate.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + final Calendar c = Calendar.getInstance(); + + mYear = c.get(Calendar.YEAR); + mMonth = c.get(Calendar.MONTH); + mDay = c.get(Calendar.DAY_OF_MONTH); + + DatePickerDialog datePickerDialog = new DatePickerDialog(getApplicationContext(), R.style.DatePickerTheme, + new DatePickerDialog.OnDateSetListener() { + + @Override + public void onDateSet(DatePicker view, int year, + int monthOfYear, int dayOfMonth) { + + cDay = dayOfMonth; + cMonth = monthOfYear; + cYear = year; + + // String date =dayOfMonth + "/" + (monthOfYear + 1) + "/" + year; + // String date =year + "-" + (monthOfYear + 1) + "-" + dayOfMonth; + String date =dayOfMonth + "-" + (monthOfYear + 1) + "-" + year; + + + SimpleDateFormat dateFormat= new SimpleDateFormat("dd-MM-yyyy"); + // SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd"); + + try { + Date d=dateFormat.parse(date); + System.out.println("Formated to"+dateFormat.format(d)); + todateseterror_TV.setVisibility(View.GONE); + edt_todate.setText(dateFormat.format(d).toString()); + + } + catch(Exception e) { + //java.text.ParseException: Unparseable date: Geting error + System.out.println("Excep"+e); + } + //TextView txtExactDate = (TextView) findViewById(R.id.txt_exactDate); + + + //txtDate.edita + } + }, mYear, mMonth, mDay); + + datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()); + //datePickerDialog.getDatePicker().setMaxDate(System.currentTimeMillis()-(1000 * 60 * 60 * 24 * 365 * 14)); + // - (1000 * 60 * 60 * 24 * 365.25 * 14) +//------ + + datePickerDialog.show(); + //originalList.clear(); + spin_ticketStatus.setSelection(0); + //adapter.notifyDataSetChanged(); + } + }); + + } + + private class TicketStatusAsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + /* dialog.setMessage("Please wait,District Loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show();*/ + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetFeesCatglist(); // get the District list + return null; + } + + public TicketStatusAsyncCallWS(Context activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + + //dialog.dismiss(); + + /*uploadfromDB_Statelist(); + uploadfromDB_Districtlist(); + setSpinner();*/ + // uploadfromDB_Districtlist(); + + + if(str_Status.equals("Success")) + { + + + adapter_ticketStatus = new ArrayAdapter(getApplicationContext(), R.layout.spinnercustomstyle, arrayObj_Class_TicketStatus); + //dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + adapter_ticketStatus.setDropDownViewResource(R.layout.spinnercustomstyle); + // districtsearch_ATV.setAdapter(dataAdapter_district); + spin_ticketStatus.setAdapter(adapter_ticketStatus); + spin_ticketStatus.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorBlack)); + // } + } + + + }//end of onPostExecute + }// end Async task + + public void GetFeesCatglist() + { + + String URL = Class_URL.URL_Manager.toString().trim(); + String METHOD_NAME = "Get_Master_Ticket_Status"; + String Namespace="http://mis.leadcampus.org/", SOAPACTION="http://mis.leadcampus.org/Get_Master_Ticket_Status"; + + + + //for final + + + try { +//vijay district + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + + // request.addProperty("distid", Long.parseLong(str_Sids));//Long + + // request.addProperty("distid", 17);//Long + + //request.addProperty("stateId", 17);//Long + // long + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + // Log.i(TAG, "GetAllLoginDetails is running"); + // result1 = (Vector) envelope.getResponse(); + + // response = (SoapPrimitive) envelope.getResponse(); + + // SoapPrimitive res =(SoapPrimitive)envelope.getResponse(); + + SoapObject response = (SoapObject ) envelope.getResponse(); + Log.e("response TicketStatus",response.toString()); + ticketStatusCount = response.getPropertyCount(); + SoapObject districtresponse=(SoapObject)response.getProperty(0); + str_Status=districtresponse.getProperty("Status").toString(); + Log.d("ticketStatusCount", String.valueOf(response.getPropertyCount())); + + + if(str_Status.equals("Success")) { + if (ticketStatusCount > 0) { + arrayObj_Class_TicketStatus = new Class_Project_FundMain[ticketStatusCount]; + for (int i = 0; i < ticketStatusCount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + + Class_Project_FundMain innerObj_Class_Project_FundMain = new Class_Project_FundMain(); + innerObj_Class_Project_FundMain.setSlno(response_soapobj.getProperty("Slno").toString()); //1 + innerObj_Class_Project_FundMain.setTicket_Status(response_soapobj.getProperty("Ticket_Status").toString()); //Hubballi + innerObj_Class_Project_FundMain.setAccount_Alert_Days(response_soapobj.getProperty("Manager_Alert_Days").toString());// HB + innerObj_Class_Project_FundMain.setManager_Alert_Days(response_soapobj.getProperty("Account_Alert_Days").toString());// <1 + innerObj_Class_Project_FundMain.setStatus(response_soapobj.getProperty("Status").toString());// <1 + + str_Status = response_soapobj.getProperty("Status").toString(); + + arrayObj_Class_TicketStatus[i] = innerObj_Class_Project_FundMain; + + }//end for loop + + }//end of if + + } + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + // internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + } + + private class GetFromToDateAsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + /* dialog.setMessage("Please wait,District Loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show();*/ + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetFromToDate(); // get the District list + return null; + } + + public GetFromToDateAsyncCallWS(Context activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @SuppressLint("RestrictedApi") + @Override + protected void onPostExecute(Void result) { + + + if(str_FromToDateStatus.equals("Success")) { + Log.e("tag","arrayObj_Class_FromToDate="+arrayObj_Class_FromToDate.length); + for (int j=0;jlong + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + + SoapObject response = (SoapObject ) envelope.getResponse(); + Log.e("response datelist",response.toString()); + From_ToDateCount = response.getPropertyCount(); + SoapObject summaryresponse=(SoapObject)response.getProperty(0); + str_FromToDateStatus=summaryresponse.getProperty("Status").toString(); + Log.d("datelistcount", String.valueOf(response.getPropertyCount())); + + + if(str_FromToDateStatus.equals("Success")) { + if (From_ToDateCount > 0) { + arrayObj_Class_FromToDate = new Class_FromToDate[From_ToDateCount]; + for (int i = 0; i < From_ToDateCount; i++) { + + SoapObject response_soapobj = (SoapObject) response.getProperty(i); //resp starts from zero + + + Class_FromToDate innerObj_Class_fromtodate = new Class_FromToDate(); + innerObj_Class_fromtodate.setAcademic_Code(response_soapobj.getProperty("Academic_Code").toString()); //1 + innerObj_Class_fromtodate.setAcademic_Id(response_soapobj.getProperty("Academic_Id").toString()); //Hubballi + innerObj_Class_fromtodate.setFrom_Date(response_soapobj.getProperty("From_Date").toString());// HB + innerObj_Class_fromtodate.setTo_Date(response_soapobj.getProperty("To_Date").toString());// <1 + innerObj_Class_fromtodate.setStatus(response_soapobj.getProperty("Status").toString());// <1 + innerObj_Class_fromtodate.setYear_Code(response_soapobj.getProperty("Year_Code").toString());// <1 + + str_FromToDateStatus = response_soapobj.getProperty("Status").toString(); + + arrayObj_Class_FromToDate[i] = innerObj_Class_fromtodate; + + }//end for loop + + }//end of if + + } + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + // internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + } +} + diff --git a/app/src/main/java/com/leadcampusapp/PastEventsFragment.java b/app/src/main/java/com/leadcampusapp/PastEventsFragment.java new file mode 100644 index 0000000..dc385c1 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/PastEventsFragment.java @@ -0,0 +1,483 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 22-06-2018. + */ + +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.AsyncTask; +import android.os.Bundle; +import androidx.fragment.app.Fragment; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.ListView; +import android.widget.TextView; + +//import com.android.sripad.leadnew_22_6_2018.R; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.io.ByteArrayOutputStream; +import java.net.URL; +import java.util.Vector; + +public class PastEventsFragment extends Fragment +{ + + private LinearLayout pasteventsfragment_ViewLayout; + Context context; + + private String serverPath = Class_URL.ServerPath.toString().trim(); + + byte[] imageBytes={0}; + + int noOfobjects = 0; + int noOfPastObject; + int count1; + ImageView Image1; + byte[] imageInByte; + Bitmap mIcon11; + + + byte[] x; + Class_PastEvents[] class_pastevents_arrayObj,class_pastevents_arrayObj1; + private ListView listView; + Bitmap bitmap1; + + Class_PastEvents class_passtevents_obj; + + + + String str_pastevent,str_imageurl,str_applyurl,str_pasturlevent; + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) + { + + pasteventsfragment_ViewLayout = (LinearLayout) inflater.inflate(R.layout.pastevents_fragment, container, false); + + context =pasteventsfragment_ViewLayout.getContext(); + + listView = (ListView) pasteventsfragment_ViewLayout.findViewById(R.id.pastevent_listview); + + // Getting application context + context = getActivity(); + + AsyncCallWS_pastevents task = new AsyncCallWS_pastevents(context); + task.execute(); + return pasteventsfragment_ViewLayout; + + }//end of Oncreate + + + + + + + +private class AsyncCallWS_pastevents extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + dialog.setMessage("Please wait.."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("LeadMIS", "doInBackground"); + // GetAllEvents(); + + PastEvents(); // call of past events direct hit + + + return null; + } + + public AsyncCallWS_pastevents(Context context1) { + context = context1; + dialog = new ProgressDialog(context1); + } + + @Override + protected void onPostExecute(Void result) + { + dialog.dismiss(); + + System.out.println("Reached the onPostExecute"); + + if (class_pastevents_arrayObj != null) + { + CustomAdapter adapter = new CustomAdapter(); + listView.setAdapter(adapter); + + int x1 = class_pastevents_arrayObj.length; + + System.out.println("Inside the if list adapter" + x1); + } else { + Log.d("onPostExecute", "leavelist == null"); + } + + + }//end of onPostExecute +}// end Async task + + + + + + + public void PastEvents() + { + Vector result1 = null; + + //URL + String URL = Class_URL.URL_Projects.toString().trim(); + String METHOD_NAME = "GetEvents"; + String Namespace = "http://mis.leadcampus.org/", SOAPACTION = "http://mis.leadcampus.org/GetEvents"; + //URL + + + try { + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + + // request.addProperty("currentevents", "0"); + + + /*long +string +string +string +string +string +string +string + int +string*/ + + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + androidHttpTransport.call(SOAPACTION, envelope); + SoapObject response = (SoapObject) envelope.getResponse(); + //Log.e("pastevents response", response.toString()); + count1 = response.getPropertyCount(); // number of count in array in response 6,0-5,5 + noOfobjects = count1; + Log.e("Events","events count"+Integer.toString(noOfobjects)); + + + noOfPastObject=0; + for (int i = 0; i < count1; i++) + { + SoapObject soapobject_response = (SoapObject) response.getProperty(i); + SoapPrimitive soapobject_pastorcurrent; + soapobject_pastorcurrent= (SoapPrimitive) soapobject_response.getProperty("EventStatus"); + if(soapobject_pastorcurrent.toString().equals("0")) + { noOfPastObject++;} + } + + + + Log.e("pasteventcount","noOfPastObject"+noOfPastObject); + class_pastevents_arrayObj= new Class_PastEvents[noOfPastObject]; + for (int i = 0,j=0; i < count1; i++) + { + SoapObject soapobject_response = (SoapObject) response.getProperty(i); + SoapPrimitive soapobject_eventapplyurl, soapobject_pasteventurl, soapobject_imageURL,soapobject_pastevent,soapobject_status; + String str_soapimageURL; + + /* soapobject_eventapplyurl=(SoapPrimitive) soapobject_response.getProperty("EventApplyURL");// + soapobject_eventurl=(SoapPrimitive)soapobject_response.getProperty("EventURL"); //imageclickURL + soapobject_imageURL =(SoapPrimitive) soapobject_response.getProperty("Image_Path");*/ + soapobject_pastevent= (SoapPrimitive) soapobject_response.getProperty("EventStatus"); + soapobject_status = (SoapPrimitive) soapobject_response.getProperty("Status"); + str_soapimageURL =(String) soapobject_response.getProperty("Image_Path").toString(); + + soapobject_pasteventurl=(SoapPrimitive)soapobject_response.getProperty("EventURL"); //imageclickURL + + + if(soapobject_pastevent.toString().equals("0")) + { + Class_PastEvents innerObj = new Class_PastEvents(); + /* innerObj.setEventApplyURL(soapobject_eventapplyurl.toString()); + innerObj.setEventURL(soapobject_eventurl.toString());*/ + innerObj.setPastorCurrent(soapobject_pastevent.toString()); + innerObj.setStatus(soapobject_status.toString()); + innerObj.setPastEventURL(soapobject_pasteventurl.toString()); + + + String arr[] = str_soapimageURL.split("/", 2); + + String firstWord = arr[0]; //the + String secondWord = arr[1]; + + String Str_actualImgUrl = serverPath + secondWord; + Log.i("tag", "firstWord=" + firstWord + " secondWord=" + secondWord); + Log.e("student URL", "" + Str_actualImgUrl); + + // java.net.URL url = new URL(Str_actualImgUrl.toString().trim()); + + /*try { + InputStream in = new java.net.URL(Str_actualImgUrl).openStream(); + mIcon11 = BitmapFactory.decodeStream(in); + Log.e("Error Image conversion", "e.getMessage()"); + } catch (Exception e) { + Log.e("Error Image conversion", e.getMessage()); + e.printStackTrace(); + }*/ + + java.net.URL url = new URL(Str_actualImgUrl.toString().trim()); + mIcon11 = BitmapFactory.decodeStream(url.openConnection().getInputStream()); + + + ByteArrayOutputStream stream1 = new ByteArrayOutputStream(); + mIcon11.compress(Bitmap.CompressFormat.JPEG, 100, stream1); + imageInByte = stream1.toByteArray(); + + innerObj.setEventImage(imageInByte); + + class_pastevents_arrayObj[j] = innerObj; + j++; + + } + + }//end of For Loop + + + + + } catch (Throwable t) { + //Toast.makeText(MainActivity.this, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail Past", "> " + t.getMessage()); + } + } catch (Throwable t) { + Log.e("UnRegister Error", "> " + t.getMessage()); + + } + + + + + + }//end of newsandEvents + + + + + //Holder for customAdapter + private class Holder { + ImageView holder_image; + /*TextView holder_imageclickurl_tv; + Button holder_applybutton_bt; + TextView holder_applybuttonurl_tv;*/ + TextView holder_passevent_tv; + TextView holder_nopastevents_tv; + TextView holder_pastevent_imageurl_tv; + } + //End of Holder + + + public class CustomAdapter extends BaseAdapter + { + + + public CustomAdapter() { + + super(); + Log.d("Inside CustomAdapter()", "Inside CustomAdapter()"); + } + + @Override + public int getCount() { + + String x = Integer.toString(class_pastevents_arrayObj.length); + Log.d("class_arrayObj.length", x); + return class_pastevents_arrayObj.length; + + } + + @Override + public Object getItem(int position) { + String x = Integer.toString(position); + System.out.println("getItem position" + x); + Log.d("getItem position", "x"); + return class_pastevents_arrayObj[position]; + } + + @Override + public long getItemId(int position) { + String x = Integer.toString(position); + System.out.println("getItemId position" + x); + Log.d("getItemId position", x); + return position; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) + { + + final Holder holder; + + Log.d("CustomAdapter", "position: " + position); + // holder = new Holder(); + if (convertView == null) { + holder = new Holder(); + convertView = LayoutInflater.from(getActivity()).inflate(R.layout.row_item_pastevents, parent, false); + + /* holder.date = (TextView) convertView.findViewById(R.id.approved_on2); + holder.days = (TextView) convertView.findViewById(R.id.days2); //durationofdays_TV + holder.fromView = (TextView) convertView.findViewById(R.id.from2);//Fdate_TV + holder.toView = (TextView) convertView.findViewById(R.id.to2);//Tdate_TV + holder.reason = (TextView) convertView.findViewById(R.id.reason2);// + holder.status = (TextView) convertView.findViewById(R.id.status2);//statusofleave_TV + */ + + // holder.cancel = (TextView) convertView.findViewById(R.id.cancelLeave_TV); + + //Typeface facebold = Typeface.createFromAsset(getResources().getAssets(), "fonts/centurygothic.ttf"); + //durationlabel_TV + + holder.holder_image=(ImageView) convertView.findViewById(R.id.pasteventsimagedisplay_IV); + //holder_passevent_tv + holder.holder_nopastevents_tv=(TextView) convertView.findViewById(R.id.nopastevent_TV); + holder.holder_pastevent_imageurl_tv =(TextView)convertView.findViewById(R.id.pastevent_imageurl_TV); + Log.d("Inside If convertView", "Inside If convertView"); + + convertView.setTag(holder); + } else { + holder = (Holder) convertView.getTag(); + Log.d("Inside else convertView", "Inside else convertView"); + } + + + + class_passtevents_obj =(Class_PastEvents) getItem(position); + + // Class_CurrentEvents[] details =(Class_CurrentEvents) getItem(position); + + + + if(class_passtevents_obj!=null) + { + + + + x = class_passtevents_obj.getEventImage(); + str_pastevent =class_passtevents_obj.getPastorCurrent(); + str_pasturlevent =class_passtevents_obj.getPastEventURL(); + /* str_imageurl = detail.getEventURL(); + Log.e("imageURL","URL"+str_imageurl); + str_applyurl= detail.getEventApplyURL();*/ + if(x!=null) + { + if(str_pastevent.equals("0")) + { + // holder.holder_image.setVisibility(View.VISIBLE); + bitmap1 = BitmapFactory.decodeByteArray(x, 0, x.length); + holder.holder_image.setImageBitmap(bitmap1); + holder.holder_pastevent_imageurl_tv.setText(str_pasturlevent); + + + holder.holder_image.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) + { + try { + + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(holder.holder_pastevent_imageurl_tv.getText().toString())); + startActivity(browserIntent); + } + catch (Exception e) + { + // Toast.makeText(getActivity(),"WS:error",Toast.LENGTH_SHORT).show(); + } + } + }); + + + }//end of pastorcurrent + } else + { + + + //holder.holder_image.setVisibility(View.GONE); + + // holder.holder_nopastevents_tv.setVisibility(View.VISIBLE); + // Toast.makeText(getActivity(),"No Past",Toast.LENGTH_SHORT).show(); + } + + } + else{ + holder.holder_image.setVisibility(View.GONE); + // holder.holder_nopastevents_tv.setVisibility(View.VISIBLE); + //Toast.makeText(getActivity(),"No Past",Toast.LENGTH_SHORT).show(); + } + + + + + return convertView; + + + } + + + }//End of CustomAdapter + + + + + + + + + + + + + + + + +}//end of class + + + + + + + + diff --git a/app/src/main/java/com/leadcampusapp/PrincipleCollegeAdapter.java b/app/src/main/java/com/leadcampusapp/PrincipleCollegeAdapter.java new file mode 100644 index 0000000..ad71e6d --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/PrincipleCollegeAdapter.java @@ -0,0 +1,91 @@ +package com.leadcampusapp; + +import android.app.Activity; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.EditText; +import android.widget.TextView; + +import java.util.ArrayList; + +//import com.android.sripad.leadnew_22_6_2018.R; + +/** + * Created by Admin on 28-05-2018. + */ + +public class PrincipleCollegeAdapter extends BaseAdapter{ + + public ArrayList principleCollegeList; + Activity activity; + EditText userInputDialogEditText; + String str_requestId,str_reson; + + public PrincipleCollegeAdapter(Activity activity, ArrayList principleCollegeList) { + super(); + this.activity = activity; + this.principleCollegeList = principleCollegeList; + } + + @Override + public int getCount() { + //return projList.size(); + return principleCollegeList.size(); + } + + @Override + public PrincipleCollegeModule getItem(int position) { + + //return projList.get(position); + return principleCollegeList.get(position); + } + + @Override + public long getItemId(int position) { + return position; + } + + class ViewHolder { + TextView mstudName; + TextView mleadId; + TextView mprojTitle; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + + final ViewHolder holder; + final String[] userInput = new String[1]; + + LayoutInflater inflater = activity.getLayoutInflater(); + + if (convertView == null) { + convertView = inflater.inflate(R.layout.principle_college_listrow, null); + holder = new ViewHolder(); + + holder.mstudName = (TextView) convertView.findViewById(R.id.txt_studName); + holder.mleadId = (TextView) convertView.findViewById(R.id.txt_leadId); + holder.mprojTitle = (TextView) convertView.findViewById(R.id.txt_projTitle); + convertView.setTag(holder); + } else { + holder = (ViewHolder) convertView.getTag(); + } + + PrincipleCollegeModule item = principleCollegeList.get(position); + + if(item.getStudentName()!=null) { + holder.mstudName.setText(item.getStudentName().toString()); + } + if(item.getLeadId()!=null) { + holder.mleadId.setText(item.getLeadId().toString()); + } + if(item.getProjectTitle()!=null) { + holder.mprojTitle.setText(item.getProjectTitle().toString()); + } + + return convertView; + } + +} diff --git a/app/src/main/java/com/leadcampusapp/PrincipleCollegeModule.java b/app/src/main/java/com/leadcampusapp/PrincipleCollegeModule.java new file mode 100644 index 0000000..5ea161b --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/PrincipleCollegeModule.java @@ -0,0 +1,75 @@ +package com.leadcampusapp; + +/** + * Created by User on 14-Jun-19. + */ + +public class PrincipleCollegeModule { + /*private ArrayList LeadId; + private ArrayList StudentName; + private ArrayList ProjectTitle; + + public PrincipleCollegeModule(ArrayList leadId, ArrayList studentName, ArrayList projectTitle) { + LeadId = leadId; + StudentName = studentName; + ProjectTitle = projectTitle; + } + + public ArrayList getLeadId() { + return LeadId; + } + + public void setLeadId(ArrayList leadId) { + LeadId = leadId; + } + + public ArrayList getStudentName() { + return StudentName; + } + + public void setStudentName(ArrayList studentName) { + StudentName = studentName; + } + + public ArrayList getProjectTitle() { + return ProjectTitle; + } + + public void setProjectTitle(ArrayList projectTitle) { + ProjectTitle = projectTitle; + }*/ + + private String LeadId; + private String StudentName; + private String ProjectTitle; + + public PrincipleCollegeModule(String leadId, String studentName, String projectTitle) { + LeadId = leadId; + StudentName = studentName; + ProjectTitle = projectTitle; + } + + public String getLeadId() { + return LeadId; + } + + public void setLeadId(String leadId) { + LeadId = leadId; + } + + public String getStudentName() { + return StudentName; + } + + public void setStudentName(String studentName) { + StudentName = studentName; + } + + public String getProjectTitle() { + return ProjectTitle; + } + + public void setProjectTitle(String projectTitle) { + ProjectTitle = projectTitle; + } +} diff --git a/app/src/main/java/com/leadcampusapp/PrincipleHomeActivity.java b/app/src/main/java/com/leadcampusapp/PrincipleHomeActivity.java new file mode 100644 index 0000000..3cfbc9d --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/PrincipleHomeActivity.java @@ -0,0 +1,113 @@ +package com.leadcampusapp; + +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import androidx.appcompat.app.AppCompatActivity; +import android.os.Bundle; +import android.util.Log; +import android.view.Menu; +import android.view.MenuItem; +import android.widget.GridView; +import android.widget.TextView; + +public class PrincipleHomeActivity extends AppCompatActivity { + + SharedPreferences shardprefPrinciple_info; + SharedPreferences.Editor editor_Principle_info; + public static final String PREBook_Principle_info="prefbook_principle_info"; + public static final String PrefID_CollgeName="prefid_CollgName"; + public static final String PrefID_AcademicId="prefid_AcademicId"; + public static final String PrefID_PMailId="prefid_PMailId"; + public static final String PrefID_PWhatsapp="prefid_PWhatsapp"; + public static final String PrefID_PMobileNo="prefid_PMobileNo"; + public static final String PrefID_PName="prefid_PName"; + + public static final String PREFBook_LoginTrack= "prefbook_logintrack"; + public static final String PrefID_WhereToGo = "prefid_wheretogo"; // + SharedPreferences shardprefLoginTrack_obj; + SharedPreferences.Editor editor_LoginTrack; + Class_URL config_obj= new Class_URL(); + + TextView txt_Name,txt_CollgName,txt_MailId,txt_mobile; + String CollegeName,MailId,WhatsApp_No,Name; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_principle_home); + + + shardprefLoginTrack_obj =this.getSharedPreferences(PREFBook_LoginTrack,Context.MODE_PRIVATE); + editor_LoginTrack = shardprefLoginTrack_obj.edit(); + editor_LoginTrack.putString(PrefID_WhereToGo,config_obj.packagename+"PrincipleHomeActivity"); + editor_LoginTrack.commit(); + + txt_Name=(TextView) findViewById(R.id.txt_Name); + txt_CollgName=(TextView) findViewById(R.id.txt_CollgName); + txt_MailId=(TextView) findViewById(R.id.txt_MailId); + txt_mobile=(TextView) findViewById(R.id.txt_mobile); + + shardprefPrinciple_info=getSharedPreferences(PREBook_Principle_info, Context.MODE_PRIVATE); + + shardprefPrinciple_info.getString(PrefID_CollgeName, "").trim(); + CollegeName = shardprefPrinciple_info.getString(PrefID_CollgeName, "").trim(); + Log.e("tag","CollegeName:"+CollegeName); + + shardprefPrinciple_info.getString(PrefID_PWhatsapp, "").trim(); + WhatsApp_No = shardprefPrinciple_info.getString(PrefID_PWhatsapp, "").trim(); + Log.e("tag","WhatsApp_No:"+WhatsApp_No); + + shardprefPrinciple_info.getString(PrefID_PName, "").trim(); + Name = shardprefPrinciple_info.getString(PrefID_PName, "").trim(); + Log.e("tag","Name:"+Name); + + shardprefPrinciple_info.getString(PrefID_PMailId, "").trim(); + MailId = shardprefPrinciple_info.getString(PrefID_PMailId, "").trim(); + Log.e("tag","MailId:"+MailId); + + txt_Name.setText(Name); + txt_CollgName.setText(CollegeName); + txt_mobile.setText(WhatsApp_No); + txt_MailId.setText(MailId); + + GridView gridView = (GridView) findViewById(R.id.gridview); + gridView.setAdapter(new GridAdapterPrinciple(this)); + GridView gridViewSecond = (GridView) findViewById(R.id.gridview1); + gridViewSecond.setAdapter(new GridAdapterSecond(this)); //GridAdapterSecond.java + + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_main_pm, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + if (id == R.id.action_logout) { + + + editor_LoginTrack = shardprefLoginTrack_obj.edit(); + editor_LoginTrack.putString(PrefID_WhereToGo, config_obj.packagename+"LoginActivity"); + editor_LoginTrack.commit(); + + Intent ittFeesToLogin = new Intent(PrincipleHomeActivity.this ,LoginActivity.class); + startActivity(ittFeesToLogin); + return true; + } + + return super.onOptionsItemSelected(item); + } + + @Override + public void onBackPressed() + { + Intent startMain = new Intent(Intent.ACTION_MAIN); + startMain.addCategory(Intent.CATEGORY_HOME); + startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(startMain); + } +} diff --git a/app/src/main/java/com/leadcampusapp/PrincipleLoginActivity.java b/app/src/main/java/com/leadcampusapp/PrincipleLoginActivity.java new file mode 100644 index 0000000..718fa0a --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/PrincipleLoginActivity.java @@ -0,0 +1,382 @@ +package com.leadcampusapp; + +import android.app.AlertDialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.SharedPreferences; +import android.os.AsyncTask; +import android.os.Bundle; +import androidx.core.content.ContextCompat; +import androidx.appcompat.app.AppCompatActivity; +import android.util.Log; +import android.view.View; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.LinearLayout; +import android.widget.ListView; +import android.widget.ProgressBar; +import android.widget.Spinner; +import android.widget.TextView; +import android.widget.Toast; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.util.ArrayList; +import java.util.HashMap; + +public class PrincipleLoginActivity extends AppCompatActivity { + + + Spinner year_spin; + String[] arraySpin_year = new String[] { + "2019", "2018", "2017", "2016" + }; + + private ProgressDialog progressDialog; + TextView txt_registration,txt_projCount,txt_FundedAmount,collg_name; + ArrayList collegeList; + PrincipleCollegeModule collegeListObj; + ListView list,list_head; + private ProgressBar progressBar; + + private PrincipleCollegeAdapter adapter_collg; + PrincipleCollegeModule item; + ArrayList arr_leadId=new ArrayList<>(); + ArrayList arr_studName=new ArrayList<>(); + ArrayList arr_projectTitle=new ArrayList<>(); + + SharedPreferences shardprefPrinciple_info; + SharedPreferences.Editor editor_Principle_info; + public static final String PREBook_Principle_info="prefbook_principle_info"; + public static final String PrefID_CollgeName="prefid_CollgName"; + public static final String PrefID_AcademicId="prefid_AcademicId"; + public static final String PrefID_PCollegeId="prefid_PCollegeId"; + public static final String PrefID_PMailId="prefid_PMailId"; + public static final String PrefID_PWhatsapp="prefid_PWhatsapp"; + public static final String PrefID_PMobileNo="prefid_PMobileNo"; + public static final String PrefID_PName="prefid_PName"; + + String CollegeName,AcademicId,CollegeId; + String selected_year="2019",AcademicId_new; + LinearLayout main_layout_principle; + private HashMap mapYearCode; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_principle_login); + + progressBar = (ProgressBar) findViewById(R.id.progressBar); + + main_layout_principle=(LinearLayout) findViewById(R.id.main_layout_principle); + year_spin = (Spinner) findViewById(R.id.year_spin); + txt_registration = (TextView) findViewById(R.id.txt_registration); + txt_projCount = (TextView) findViewById(R.id.txt_projCount); + txt_FundedAmount =(TextView) findViewById(R.id.txt_FundedAmount); + list = (ListView) findViewById(R.id.lv_stud_list); + collg_name=(TextView) findViewById(R.id.collg_name); + + shardprefPrinciple_info=getSharedPreferences(PREBook_Principle_info, Context.MODE_PRIVATE); + + shardprefPrinciple_info.getString(PrefID_CollgeName, "").trim(); + CollegeName = shardprefPrinciple_info.getString(PrefID_CollgeName, "").trim(); + Log.e("tag","CollegeName:"+CollegeName); + + shardprefPrinciple_info.getString(PrefID_AcademicId, "").trim(); + AcademicId = shardprefPrinciple_info.getString(PrefID_AcademicId, "").trim(); + Log.e("tag","AcademicId:"+AcademicId); + + shardprefPrinciple_info.getString(PrefID_PCollegeId, "").trim(); + CollegeId = shardprefPrinciple_info.getString(PrefID_PCollegeId, "").trim(); + Log.e("tag","CollegeId:"+CollegeId); + + collegeList = new ArrayList(); + /*ArrayAdapter adapter = new ArrayAdapter(this, + android.R.layout.simple_spinner_item, arraySpin_year); + adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + year_spin.setAdapter(adapter);*/ + + collg_name.setText(CollegeName); + mapYearCode = new HashMap(); + /* adapter_collg = new PrincipleCollegeAdapter(this,collegeList); + list.setAdapter(adapter_collg);*/ + initializeSpinnerYear(); + + year_spin.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected (AdapterView < ? > parent, View view, int position, long id){ + // TODO Auto-generated method stub + selected_year = year_spin.getSelectedItem().toString(); + if(selected_year!="Select Year"){ + GetPrincipleDetails getPrincipleDetails = new GetPrincipleDetails(PrincipleLoginActivity.this); + getPrincipleDetails.execute(); + } + // Toast.makeText(getApplicationContext(),"Blood:"+str_bloodgroup,Toast.LENGTH_SHORT).show(); + } + @Override + public void onNothingSelected (AdapterView < ? > parent){ + // TODO Auto-generated method stub + + } + }); + /*if(selected_year.equalsIgnoreCase("2019")){ + AcademicId_new="6"; + }else if(selected_year.equalsIgnoreCase("2018")){ + AcademicId_new="5"; + }else if(selected_year.equalsIgnoreCase("2017")){ + AcademicId_new="4"; + }else if(selected_year.equalsIgnoreCase("2016")){ + AcademicId_new="3"; + }else if(selected_year.equalsIgnoreCase("2015")){ + AcademicId_new="2"; + }else if(selected_year.equalsIgnoreCase("2014")){ + AcademicId_new="1"; + } + + GetPrincipleDetails getPrincipleDetails = new GetPrincipleDetails(PrincipleLoginActivity.this); + getPrincipleDetails.execute();*/ + + } + + private void initializeSpinnerYear() { + final ArrayList listYear = new ArrayList(); + + // listYear.add("Select Year"); + listYear.add("2019-2020"); + listYear.add("2018-2019"); + listYear.add("2017-2018"); + listYear.add("2016-2017"); + listYear.add("2015-2016"); + listYear.add("2014-2015"); + listYear.add("Below 2014"); + + mapYearCode.put("Below 2014",0); + mapYearCode.put("2014-2015",1); + mapYearCode.put("2015-2016",2); + mapYearCode.put("2016-2017",3); + mapYearCode.put("2017-2018",4); + mapYearCode.put("2018-2019",5); + mapYearCode.put("2019-2020",6); + + ArrayAdapter dataAdapterListYear = new ArrayAdapter(getApplicationContext(), R.layout.simple_spinner_items, listYear); + dataAdapterListYear.setDropDownViewResource(R.layout.spinnercustomstyle); + + year_spin.setAdapter(dataAdapterListYear); + // year_spin.setSupportBackgroundTintList(ContextCompat.getColorStateList(getApplicationContext(), R.color.colorBlack)); + + } + + + + public class GetPrincipleDetails extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + //private ProgressBar progressBar; + + GetPrincipleDetails (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + String METHOD_NAME = "GetCollegeCountSummary"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetCollegeCountSummary"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + // String collgId="302",AcadId="5"; + Log.e("tag","principle CollegeId="+CollegeId+"AcademicId="+AcademicId_new); + int yearId = mapYearCode.get(selected_year); + + request.addProperty("CollegeId",CollegeId); + request.addProperty("AcademicId",String.valueOf(yearId)); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + Log.e("tag","request principle="+request); + envelope.setOutputSoapObject(request); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Login.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + SoapObject response = (SoapObject) envelope.getResponse(); + Log.d("Principle list:",response.toString()); + + SoapObject soapObj = (SoapObject) response.getProperty("ProjectList"); + + if (!soapObj.toString().equals("anyType{}") && !soapObj.toString().equals(null)) { + + SoapPrimitive S_Lead_Id,S_StudentName,S_ProjectTitle; + Object O_Lead_Id,O_StudentName,O_ProjectTitle; + String str_Lead_Id = null, str_StudentName = null,str_ProjectTitle = null; + //count2 = soapObj.getPropertyCount(); + collegeList.clear(); + Log.e("tag","soapObj.getPropertyCount()=="+soapObj.getPropertyCount()); + // Log.e("tag","soapObj.getPropertyCount()-1=="+soapObj.getPropertyCount()-1); + + for (int count1 = 0; count1 < soapObj.getPropertyCount(); count1++) { + SoapObject ProjectList = (SoapObject) soapObj.getProperty(count1); + Log.d("doclist", ProjectList.toString()); + + if(count1!=0) { + O_Lead_Id = ProjectList.getProperty("Lead_Id"); + Log.e("tag", "Lead_Id==" + O_Lead_Id); + if (!O_Lead_Id.toString().equals("anyType{}") && !O_Lead_Id.toString().equals(null)) { + S_Lead_Id = (SoapPrimitive) ProjectList.getProperty("Lead_Id"); + str_Lead_Id = S_Lead_Id.toString(); + Log.e("tag", "str_Lead_Id==" + str_Lead_Id); + } + O_StudentName = ProjectList.getProperty("StudentName"); + Log.e("tag", "StudentName==" + O_StudentName); + if (!O_StudentName.toString().equals("anyType{}") && !O_StudentName.toString().equals(null)) { + S_StudentName = (SoapPrimitive) ProjectList.getProperty("StudentName"); + str_StudentName = S_StudentName.toString(); + Log.e("tag", "str_StudentName==" + str_StudentName); + } + O_ProjectTitle = ProjectList.getProperty("ProjectTitle"); + Log.e("tag", "ProjectTitle==" + O_ProjectTitle); + if (!O_ProjectTitle.toString().equals("anyType{}") && !O_ProjectTitle.toString().equals(null)) { + S_ProjectTitle = (SoapPrimitive) ProjectList.getProperty("ProjectTitle"); + str_ProjectTitle = S_ProjectTitle.toString(); + Log.e("tag", "str_ProjectTitle==" + str_ProjectTitle); + } + + arr_leadId.add(str_Lead_Id); + arr_studName.add(str_StudentName); + arr_projectTitle.add(str_ProjectTitle); + Log.e("tag", "arr_leadId=" + arr_leadId); + + + item = new PrincipleCollegeModule(str_Lead_Id, str_StudentName, str_ProjectTitle); + collegeList.add(item); + } + } + + + // adapter_collg.notifyDataSetChanged(); + } + + Log.e("tag","collegeList="+collegeList); + + return response; + + } + + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(PrincipleLoginActivity.this,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + + t.printStackTrace(); + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(PrincipleLoginActivity.this,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(PrincipleLoginActivity.this,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + + catch (Exception t) { + Log.d("exception outside",t.getMessage().toString()); + + t.printStackTrace(); + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(PrincipleLoginActivity.this,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + + return null; + + + //Log.d("Soap response is",response.toString()); + + //return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + + progressDialog.setMessage("Loading"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapObject result) { + /* progressBar.setVisibility(View.GONE);*/ + progressDialog.dismiss(); + + if(result!=null) { + String finalResult = result.toString(); + String finals = finalResult.replace("anyType", ""); + Log.d("Finals is", finals); + String regCount = String.valueOf(result.getProperty("Registration_Count")); + Log.d("regCount is=", regCount); + txt_registration.setText(regCount); + String prjCount = String.valueOf(result.getProperty("Project_Count")); + Log.d("prjCount is=", prjCount); + txt_projCount.setText(prjCount); + String fundCount = String.valueOf(result.getProperty("Funded_Amount")); + txt_FundedAmount.setText(fundCount); + + } + + /* for(int i=0;i { + + Context context; + AlertDialog alertDialog; + + private ProgressBar progressBar; + + GetStudentDetails (Context ctx){ + context = ctx; + } + + + @Override + protected SoapObject doInBackground(String... params) { + String mobilenum = (String) params [0]; + String leadid = (String) params[1]; + //String versionCode = (String) params[2]; + + SoapObject response = getLoginDetails(mobilenum,leadid); + + //Log.d("Soap response is",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); + + } + + @Override + protected void onPostExecute(SoapObject result) { + progressBar.setVisibility(View.GONE); + + String finalResult = result.toString(); + String finals = finalResult.replace("anyType",""); + Log.d("Finals is",finals); + + + SoapPrimitive status = (SoapPrimitive) result.getProperty("Status"); + //Log.d("Status is:",status.toString()); + + + + + if(status.toString().equals("Success")) { + SoapPrimitive role = (SoapPrimitive) result.getProperty("Role"); + Log.d("Role is:", role.toString()); + + SoapPrimitive isProfileEdited =(SoapPrimitive)result.getProperty("isProfileEdit"); + + + + if(role.toString().equals("Student")) + { + + str_regid = result.getProperty("RegistrationId").toString(); //1 + str_sname = result.getProperty("Name").toString().toString();//name + str_s_pmname = result.getProperty("ManagerName").toString();//Abbhinandan + str_s_leadid = result.getProperty("Lead_Id").toString();//MHOO + str_s_emailID =result.getProperty("MailId").toString();// mailid@ + str_s_cellno = result.getProperty("MobileNo").toString(); + + str_s_collegeName = result.getProperty("College_Name").toString(); + + Str_PMImageURL = result.getProperty("Manager_Image_Path").toString(); + + + editor_S = shardpref_S_obj.edit(); + + editor_S.putString(PrefID_RegID,str_regid); + editor_S.putString(PrefID_SName,str_sname); + + editor_S.putString(PrefID_SLeadID,str_s_leadid); + + + + editor_S.putString(PrefID_SCollegeName,str_s_collegeName); + + editor_S.putString(PrefID_Role,role.toString()); + + + + editor_S.putString(PrefID_PM_SName,str_s_pmname); + editor_S.putString(PrefID_PM_SEmailID,str_s_emailID); + editor_S.putString(PrefID_SCellNo,str_s_cellno); + + + String Imagestrings = Str_PMImageURL; + String Str_PMImgUrl = null; + if(Imagestrings.equals("null")||Imagestrings.equals("anyType{}")){ + Str_PMImgUrl="null"; + }else { + String arr[] = Imagestrings.split("/", 2); + + String firstWord = arr[0]; //the + String secondWord = arr[1]; + + Str_PMImgUrl = serverPath + secondWord; + Log.i("tag", "firstWord=" + firstWord + " secondWord=" + secondWord); + + Log.i("tag", "PMImage1=" + Str_PMImageURL); + Log.i("tag", "PMImgUrl=" + Str_PMImgUrl); + } + + editor_S.putString(PrefID_pmimageurl,Str_PMImgUrl); + + + if(isProfileEdited.toString().equals("0"))// first time user + { + Intent ittLoginToEditProfile = new Intent(LoginActivity.this,EditProfileActivity.class); + ittLoginToEditProfile.putExtra("leadid",leadid); + ittLoginToEditProfile.putExtra("isProfileEdit","0"); + startActivity(ittLoginToEditProfile); + } + else + { + //Added by Sripad + Intent i = new Intent(LoginActivity.this,HomeActivity.class); + startActivity(i); + + str_studImgUrl = result.getProperty("UserImage").toString(); + + String Imagestring = str_studImgUrl; + String Str_StudImgUrl = null; + if(Imagestring.equals("null")||Imagestring.equals("anyType{}")){ + Str_StudImgUrl="null"; + }else { + String arr[] = Imagestring.split("/", 2); + + String firstWord = arr[0]; //the + String secondWord = arr[1]; + + Str_StudImgUrl = serverPath + secondWord; + Log.i("tag", "firstWord=" + firstWord + " secondWord=" + secondWord); + + Log.i("tag", "StudentImage1=" + str_studImgUrl); + Log.i("tag", "StudentImage2=" + Str_StudImgUrl); + } + + + + + + editor_S.putString(PrefID_SImageUrl,Str_StudImgUrl); + + } + + editor_S.commit(); + + } + if(role.toString().equals("Manager")) + { + + + Str_Manager_Id=result.getProperty("ManagerId").toString(); + Str_ManagerName=result.getProperty("Name").toString(); + Str_PMEmailId=result.getProperty("MailId").toString(); + Str_PM_Mobile=result.getProperty("MobileNo").toString(); + Str_PMLocation=result.getProperty("Location").toString(); + Str_PMImageURL=result.getProperty("UserImage").toString(); + Log.i("tag","PMImageURL="+Str_PMImageURL); + + String Imagestring = Str_PMImageURL; + String Str_PMImgUrl = null; + if(Imagestring.equals("null")||Imagestring.equals("anyType{}")){ + Str_PMImgUrl="null"; + }else { + String arr[] = Imagestring.split("/", 2); + + String firstWord = arr[0]; //the + String secondWord = arr[1]; + + Str_PMImgUrl = serverPath + secondWord; + Log.i("tag", "firstWord=" + firstWord + " secondWord=" + secondWord); + + Log.i("tag", "PMImage1=" + Str_PMImageURL); + Log.i("tag", "PMImgUrl=" + Str_PMImgUrl); + } + + + + + + + ManagerId=Integer.parseInt(Str_Manager_Id); + Intent ittLoginToEditProfile = new Intent(LoginActivity.this,PMHomeActivity.class); + ittLoginToEditProfile.putExtra("ManagerId",ManagerId); + ittLoginToEditProfile.putExtra("ManagerName",Str_ManagerName); + ittLoginToEditProfile.putExtra("PMEmailId",Str_PMEmailId); + ittLoginToEditProfile.putExtra("PM_Mobile",Str_PM_Mobile); + ittLoginToEditProfile.putExtra("PMLocation",Str_PMLocation); + ittLoginToEditProfile.putExtra("PMImgUrl",Str_PMImgUrl); + + editor_PM = shardprefPM_obj.edit(); + editor_PM.putString(PrefID_PMID,Str_Manager_Id); + editor_PM.putString(PrefID_pmName,Str_ManagerName); + editor_PM.putString(PrefID_PMEMailID,Str_PMEmailId); + editor_PM.putString(PrefID_PMMobile,Str_PM_Mobile); + editor_PM.putString(PrefID_pmlocation,Str_PMLocation); + editor_PM.putString(PrefID_pmimageurl,Str_PMImgUrl); + + + Log.d("ManagerIds:",Str_Manager_Id); + Log.d("ManagerNames:",Str_ManagerName); + Log.d("ManagerEmailIds:",Str_PMEmailId); + Log.d("ManagerMobiles:",Str_PM_Mobile); + Log.d("Managerlocations:",Str_PMLocation); + Log.d("ManagerURLs:",Str_PMImgUrl); + + + editor_PM.commit(); + + editor_S = shardpref_S_obj.edit(); + editor_S.putString(PrefID_Role,role.toString()); + editor_S.commit(); + + + + + + startActivity(ittLoginToEditProfile); + } + }else{ + Log.d("Status is: ",status.toString()); + } + + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + }*/ +} diff --git a/app/src/main/java/com/leadcampusapp/ProjectDetailsAdapter.java b/app/src/main/java/com/leadcampusapp/ProjectDetailsAdapter.java new file mode 100644 index 0000000..51b32b6 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ProjectDetailsAdapter.java @@ -0,0 +1,43 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 22-06-2018. + */ +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentStatePagerAdapter; + +public class ProjectDetailsAdapter extends FragmentStatePagerAdapter { + int mNumOfTabs; + + public ProjectDetailsAdapter(FragmentManager fm, int NumOfTabs) { + super(fm); + this.mNumOfTabs = NumOfTabs; + } + + @Override + public Fragment getItem(int position) { + + switch (position) { + case 0: + ProjectStatusFragment tab1 = new ProjectStatusFragment(); + return tab1; + case 1: + AddProjectFragment tab2 = new AddProjectFragment(); + + //CompletionProjectFragment tab2 = new CompletionProjectFragment(); + return tab2; + case 2: + //CompletionProjectFragment tab3 = new CompletionProjectFragment(); + CompletionProjectFragmentWPercent tab3 = new CompletionProjectFragmentWPercent(); + return tab3; + default: + return null; + } + } + + @Override + public int getCount() { + return mNumOfTabs; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/ProjectFundMainActivity.java b/app/src/main/java/com/leadcampusapp/ProjectFundMainActivity.java new file mode 100644 index 0000000..ae81c36 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ProjectFundMainActivity.java @@ -0,0 +1,14 @@ +package com.leadcampusapp; + +import androidx.appcompat.app.AppCompatActivity; + +import android.os.Bundle; + +public class ProjectFundMainActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_project_fund_main); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/ProjectStatusActivityModel.java b/app/src/main/java/com/leadcampusapp/ProjectStatusActivityModel.java new file mode 100644 index 0000000..e6c375a --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ProjectStatusActivityModel.java @@ -0,0 +1,151 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 28-05-2018. + */ + +public class ProjectStatusActivityModel { + private String project_name; + private String project_type; + private String approved_amt; + private String dispersed_amt; + //private String amt_app; + private int status; + private String completion_amt; + + public ProjectStatusActivityModel(String project_name, String project_type, String approved_amt, String dispersed_amt, int status, String completion_amt) { + this.project_name = project_name; + this.project_type = project_type; + this.approved_amt = approved_amt; + this.dispersed_amt = dispersed_amt; + this.status = status; + this.completion_amt = completion_amt; + } + + public String getProject_name() { + return project_name; + } + + public void setProject_name(String project_name) { + this.project_name = project_name; + } + + public String getProject_type() { + return project_type; + } + + public void setProject_type(String project_type) { + this.project_type = project_type; + } + + public String getApproved_amt() { + return approved_amt; + } + + public void setApproved_amt(String approved_amt) { + this.approved_amt = approved_amt; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public String getDispersed_amt() { + return dispersed_amt; + } + + public void setDispersed_amt(String dispersed_amt) { + this.dispersed_amt = dispersed_amt; + } + + public String getCompletion_amt() { + return completion_amt; + } + + public void setCompletion_amt(String completion_amt) { + this.completion_amt = completion_amt; + } + //private String leadFundedStatus; + +/* public ProjectStatusActivityModel(String sNo, String typeOfSeasonal, String documentation, String assurance, String duedate) { + this.sNo = sNo; + this.typeOfSeasonal = typeOfSeasonal; + this.documentation = documentation; + this.assurance = assurance; + this.duedate = duedate; + } + + public String getsNo() { + return sNo; + } + + public String getTypeOfSeasonal() { + return typeOfSeasonal; + } + + public String getDocumentation() { + return documentation; + } + + public String getAssurance() { + return assurance; + } + + public String getDuedate() { + return duedate; + }*/ + + + + /* public ProjectStatusActivityModel(String project_name, String project_type, String amt_app, int status, String leadFundedStatus) { + this.project_name = project_name; + this.project_type = project_type; + this.amt_app = amt_app; + this.status = status; + this.leadFundedStatus = leadFundedStatus; + } + + public String getProject_name() { + return project_name; + } + + public void setProject_name(String project_name) { + this.project_name = project_name; + } + + public String getProject_type() { + return project_type; + } + + public void setProject_type(String project_type) { + this.project_type = project_type; + } + + public String getAmt_app() { + return amt_app; + } + + public void setAmt_app(String amt_app) { + this.amt_app = amt_app; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public String getLeadFundedStatus() { + return leadFundedStatus; + } + + public void setLeadFundedStatus(String leadFundedStatus) { + this.leadFundedStatus = leadFundedStatus; + }*/ +} diff --git a/app/src/main/java/com/leadcampusapp/ProjectStatusActivityModel2.java b/app/src/main/java/com/leadcampusapp/ProjectStatusActivityModel2.java new file mode 100644 index 0000000..3fcd136 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ProjectStatusActivityModel2.java @@ -0,0 +1,81 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 28-05-2018. + */ + +public class ProjectStatusActivityModel2 { + private String project_name; + private String approved_amt; + private int status; + private String dispersed_amt; + private String rating; + private boolean isCompletedFlag; + private String projectId; + + public String getProjectId() { + return projectId; + } + + public void setProjectId(String projectId) { + this.projectId = projectId; + } + + public ProjectStatusActivityModel2(String project_name, String approved_amt, int status, String dispersed_amt, String rating, boolean isCompletedFlag, String projectId) { + this.project_name = project_name; + this.approved_amt = approved_amt; + this.status = status; + this.dispersed_amt = dispersed_amt; + this.rating = rating; + this.isCompletedFlag = isCompletedFlag; + this.projectId = projectId; + } + + public String getProject_name() { + return project_name; + } + + public void setProject_name(String project_name) { + this.project_name = project_name; + } + + public String getApproved_amt() { + return approved_amt; + } + + public void setApproved_amt(String approved_amt) { + this.approved_amt = approved_amt; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public String getDispersed_amt() { + return dispersed_amt; + } + + public void setDispersed_amt(String dispersed_amt) { + this.dispersed_amt = dispersed_amt; + } + + public String getRating() { + return rating; + } + + public void setRating(String rating) { + this.rating = rating; + } + + public boolean isCompletedFlag() { + return isCompletedFlag; + } + + public void setCompletedFlag(boolean completedFlag) { + isCompletedFlag = completedFlag; + } +} diff --git a/app/src/main/java/com/leadcampusapp/ProjectStatusAdapter.java b/app/src/main/java/com/leadcampusapp/ProjectStatusAdapter.java new file mode 100644 index 0000000..c33cfad --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ProjectStatusAdapter.java @@ -0,0 +1,246 @@ +package com.leadcampusapp; + +import android.app.Activity; +import android.graphics.Color; +import android.graphics.PorterDuff; +import android.graphics.drawable.Drawable; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.ImageView; +import android.widget.RatingBar; +import android.widget.TextView; + +//import com.android.sripad.leadnew_22_6_2018.R; + +import java.util.ArrayList; +import java.util.Locale; + +/** + * Created by Admin on 28-05-2018. + */ + +public class ProjectStatusAdapter extends BaseAdapter{ + + public ArrayList projList; + Activity activity; + private ArrayList mDisplayedValues = null; + + public ProjectStatusAdapter(Activity activity, ArrayList projList) { + super(); + this.activity = activity; + this.projList = projList; + this.mDisplayedValues = projList; + } + + @Override + public int getCount() { + //return projList.size(); + return mDisplayedValues.size(); + } + + @Override + public ProjectStatusActivityModel2 getItem(int position) { + + //return projList.get(position); + return mDisplayedValues.get(position); + } + + @Override + public long getItemId(int position) { + return position; + } + + private class ViewHolder { + TextView mproject_name; + TextView mapproved_amt; + ImageView mstatus; + TextView mdispersed_amt; + RatingBar mrating_bar; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + + ViewHolder holder; + LayoutInflater inflater = activity.getLayoutInflater(); + + if (convertView == null) { + convertView = inflater.inflate(R.layout.projectstatus_listrow, null); + holder = new ViewHolder(); + + holder.mproject_name = (TextView) convertView.findViewById(R.id.txt_projName); + + holder.mrating_bar = (RatingBar) convertView.findViewById(R.id.ratingBar1); + /* holder.mproject_type = (TextView) convertView.findViewById(R.id.txt_projType);*/ + //holder.mamt_app = (TextView) convertView.findViewById(R.id.txt_amountApp); + //holder.mapproved_amt = + + holder.mapproved_amt = (TextView) convertView.findViewById(R.id.txt_approvedamt); + holder.mdispersed_amt = (TextView) convertView.findViewById(R.id.txt_dispersedamt); + holder.mstatus = (ImageView) convertView.findViewById(R.id.img_projStatus); + /* holder.mcompletion_amt = (TextView) convertView.findViewById(R.id.txt_completionamt);*/ + //holder.mleadFundedStatus = (TextView) convertView.findViewById(R.id.txt_leadFundedStatus); + convertView.setTag(holder); + } else { + holder = (ViewHolder) convertView.getTag(); + } + + /* Date date = new Date(); + String modifiedDate= new SimpleDateFormat("dd/MM/yyyy").format(date); + Log.d("Modified date is xxxx",modifiedDate);*/ + + ProjectStatusActivityModel2 item = projList.get(position); + + holder.mproject_name.setText(item.getProject_name().toString()); +/* holder.mproject_type.setText(item.getProject_type().toString());*/ + //holder.mamt_app.setText(item.getAmt_app().toString()); + holder.mapproved_amt.setText(item.getApproved_amt().toString()); + holder.mdispersed_amt.setText(item.getDispersed_amt().toString()); + + if(item.isCompletedFlag()==true){ + holder.mstatus.setVisibility(View.GONE); + holder.mrating_bar.setVisibility(View.VISIBLE); + holder.mrating_bar.setRating(Float.parseFloat(item.getRating())); + Drawable drawable = holder.mrating_bar.getProgressDrawable(); + drawable.setColorFilter(Color.parseColor("#FFC300"), PorterDuff.Mode.SRC_ATOP); + }else { + holder.mstatus.setVisibility(View.VISIBLE); + holder.mrating_bar.setVisibility(View.GONE); + holder.mstatus.setImageResource(item.getStatus()); + } + /*holder.mcompletion_amt.setText(item.getCompletion_amt().toString());*/ + //holder.mleadFundedStatus.setText(item.getLeadFundedStatus().toString()); + + /* SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + Date date1=null; + Date date2=null; + + try { + date1 = sdf.parse(item.getDuedate().toString()); + date2 = sdf.parse(modifiedDate); + } catch (ParseException e) { + e.printStackTrace(); + }*/ + //date2 = sdf.parse("2010-01-31"); + +/* if(date1.compareTo(date2) > 0 ){ + holder.mSNo.setText(item.getsNo().toString()); + holder.mtypeOfSeason.setText(item.getTypeOfSeasonal().toString()); + holder.mdocumentation.setText(item.getDocumentation().toString()); + holder.massurance.setText(item.getAssurance().toString()); + holder.mduedate.setText(item.getDuedate().toString()); + //holder.mduedate.setTextColor(Color.RED); + } + if(date1.compareTo(date2) < 0){ + holder.mSNo.setText(item.getsNo().toString()); + holder.mtypeOfSeason.setText(item.getTypeOfSeasonal().toString()); + holder.mdocumentation.setText(item.getDocumentation().toString()); + holder.massurance.setText(item.getAssurance().toString()); + holder.mduedate.setText(item.getDuedate().toString()); + holder.mduedate.setTextColor(Color.RED); + } + if(date1.compareTo(date2) == 0){ + holder.mSNo.setText(item.getsNo().toString()); + holder.mtypeOfSeason.setText(item.getTypeOfSeasonal().toString()); + holder.mdocumentation.setText(item.getDocumentation().toString()); + holder.massurance.setText(item.getAssurance().toString()); + holder.mduedate.setText(item.getDuedate().toString()); + holder.mduedate.setTypeface(Typeface.DEFAULT_BOLD); + // holder.mduedate.setTextColor(Color.YELLOW); + holder.mduedate.setTextColor(Color.parseColor("#FFD12A")); + } + + int diffInDays = (int) ((date1.getTime() - date2.getTime()) / (1000 * 60 * 60 * 24)); + if(diffInDays==1 || diffInDays==2 || diffInDays==3 || diffInDays==4 || diffInDays==5 || diffInDays==6 || diffInDays==7){ + holder.mSNo.setText(item.getsNo().toString()); + holder.mtypeOfSeason.setText(item.getTypeOfSeasonal().toString()); + holder.mdocumentation.setText(item.getDocumentation().toString()); + holder.massurance.setText(item.getAssurance().toString()); + holder.mduedate.setText(item.getDuedate().toString()); + holder.mduedate.setTypeface(Typeface.DEFAULT_BOLD); + // holder.mduedate.setTextColor(Color.YELLOW); + holder.mduedate.setTextColor(Color.parseColor("#FFD12A")); + }*/ + + return convertView; + } + +/* @Override + public Filter getFilter() { + Filter filter = new Filter() { + + @SuppressWarnings("unchecked") + @Override + protected void publishResults(CharSequence constraint,FilterResults results) { + + mDisplayedValues = (ArrayList) results.values; // has the filtered values + notifyDataSetChanged(); // notifies the data with new filtered values + } + + @Override + protected FilterResults performFiltering(CharSequence constraint) { + FilterResults results = new FilterResults(); // Holds the results of a filtering operation in values + ArrayList FilteredArrList = new ArrayList(); + + if (mOriginalValues == null) { + mOriginalValues = new ArrayList(mDisplayedValues); // saves the original data in mOriginalValues + } + + *//******** + * + * If constraint(CharSequence that is received) is null returns the mOriginalValues(Original) values + * else does the Filtering and returns FilteredArrList(Filtered) + * + ********//* + if (constraint == null || constraint.length() == 0) { + + // set the Original result to return + results.count = mOriginalValues.size(); + results.values = mOriginalValues; + } else { + constraint = constraint.toString().toLowerCase(); + //Log.d("constraintisssss",constraint.toString()); + for (int i = 0; i < mOriginalValues.size(); i++) { + String data = mOriginalValues.get(i).getProject_name(); + + if (data.toLowerCase().startsWith(constraint.toString())) { + Log.d("dataisssss",data); + FilteredArrList.add(new ProjectStatusActivityModel2(mOriginalValues.get(i).getProject_name(),mOriginalValues.get(i).getApproved_amt(),mOriginalValues.get(i).getStatus(),mOriginalValues.get(i).getDispersed_amt(),mOriginalValues.get(i).getRating(),mOriginalValues.get(i).isCompletedFlag(),mOriginalValues.get(i).getProjectId())); + } + } + // set the Filtered result to return + results.count = FilteredArrList.size(); + results.values = FilteredArrList; + } + return results; + } + }; + return filter; + }*/ + + + public void filter(String charText,ArrayList projectList) { + charText = charText.toLowerCase(Locale.getDefault()); + this.mDisplayedValues.clear(); + + if(charText!=null) { + if(projectList!=null) { + if (charText.isEmpty() || charText.length() == 0) { + this.mDisplayedValues.addAll(projectList); + } else { + for (ProjectStatusActivityModel2 wp : projectList) { + if (wp.getProject_name().toLowerCase(Locale.getDefault()).contains(charText.toLowerCase())) { + this.mDisplayedValues.add(wp); + } + } + } + notifyDataSetChanged(); + } + } + } + + + +} diff --git a/app/src/main/java/com/leadcampusapp/ProjectStatusFragment.java b/app/src/main/java/com/leadcampusapp/ProjectStatusFragment.java new file mode 100644 index 0000000..2fea181 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ProjectStatusFragment.java @@ -0,0 +1,536 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 22-06-2018. + */ + +import android.app.AlertDialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.AsyncTask; +import android.os.Bundle; +import androidx.fragment.app.Fragment; +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; +import android.text.Editable; +import android.text.TextWatcher; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.Button; +import android.widget.EditText; +import android.widget.ListView; +import android.widget.Toast; + +//import com.android.sripad.leadnew_22_6_2018.R; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + + +import java.util.ArrayList; +import java.util.Locale; + +//public class ProjectStatusFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener{ +public class ProjectStatusFragment extends Fragment{ + + private ArrayList projList; + private View view; + private boolean isCompletedflag=false; + private int projectStatusIcon; + private ProjectStatusAdapter adapter; + + public static final String PREFBook_Stud= "prefbook_stud"; //sharedpreference Book + public static final String PrefID_RegID = "prefid_regid"; // + public static final String PrefID_SName = "prefid_sname"; // + public static final String PrefID_PM_SName = "prefid_pmsname"; // + public static final String PrefID_SLeadID = "prefid_sleadid"; // + public static final String PrefID_PM_SEmailID = "prefid_pm_semailid"; // + public static final String PrefID_SCellNo = "prefid_scellno"; // + + private SharedPreferences shardpref_S_obj; + private String str_leadId,str_RegistrationId; + private ProgressDialog progressDialog; + + private EditText etSearch; + + private ListView lview; + private ArrayList originalList = null; + + private int countProposed=0; + private int countReapply=0; + private int countRequestForCompletion=0; + private int countApproved=0; + private int countRejected=0; + private int countCompleted=0; + + private Button btn_generateReport; + + private SwipeRefreshLayout swipeLayout; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + + view = inflater.inflate(R.layout.projectstatus_fragment, container, false); + + shardpref_S_obj=getActivity().getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + str_leadId = shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + Log.d("str_leadId:",str_leadId); + //Toast.makeText(getActivity(),"LeadId: "+str_leadId,Toast.LENGTH_LONG).show(); + + shardpref_S_obj.getString(PrefID_RegID, "").trim(); + str_RegistrationId = shardpref_S_obj.getString(PrefID_RegID, "").trim(); + Log.d("str_RegistrationId:",str_RegistrationId); + + /* swipeLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipe_container); + swipeLayout.setOnRefreshListener(this); + swipeLayout.setColorScheme(android.R.color.holo_blue_bright, + android.R.color.holo_green_light, + android.R.color.holo_orange_light, + android.R.color.holo_red_light);*/ + + + + + initializeViews(); + + + + /* btn_generateReport = (Button) view.findViewById(R.id.btn_generateReport); + + btn_generateReport.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent ittPSToPSPieChart = new Intent(getActivity(),ProjectStatusReport.class); + ittPSToPSPieChart.putExtra("Pending",countProposed); + ittPSToPSPieChart.putExtra("Reapply",countReapply); + ittPSToPSPieChart.putExtra("Approved",countApproved); + ittPSToPSPieChart.putExtra("Rejected",countRejected); + ittPSToPSPieChart.putExtra("RequestForCompletion",countRequestForCompletion); + ittPSToPSPieChart.putExtra("Completed",countCompleted); + startActivity(ittPSToPSPieChart); + } + });*/ + + + + + + + return view; + } + + private void initializeViews() { + /* shardpref_S_obj=getActivity().getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + str_leadId = shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + Log.d("str_leadId:",str_leadId); + //Toast.makeText(getActivity(),"LeadId: "+str_leadId,Toast.LENGTH_LONG).show(); + + shardpref_S_obj.getString(PrefID_RegID, "").trim(); + str_RegistrationId = shardpref_S_obj.getString(PrefID_RegID, "").trim(); + Log.d("str_RegistrationId:",str_RegistrationId);*/ + //Toast.makeText(getActivity(),"RegistrationId: "+str_RegistrationId,Toast.LENGTH_LONG).show(); + + + + projList = new ArrayList(); + + etSearch = (EditText) view.findViewById(R.id.etSearch); + + + lview = (ListView) view.findViewById(R.id.listview); + adapter = new ProjectStatusAdapter(getActivity(),projList); + lview.setAdapter(adapter); + //lview.setTextFilterEnabled(true); + + + + + + + + + + + populateList(); + + + + //adapter.notifyDataSetChanged(); + + lview.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + //Toast.makeText(getActivity(),"Item clickedsss" ,Toast.LENGTH_LONG).show(); + + if(projList.get(position).getStatus()==R.drawable.pendinghome_new){ + Intent ittPrjStatToEdtProj = new Intent(getActivity(), EditProjectActivity.class); + ittPrjStatToEdtProj.putExtra("projstatus","pending"); + ittPrjStatToEdtProj.putExtra("projectId",projList.get(position).getProjectId()); + startActivity(ittPrjStatToEdtProj); + } + + if(projList.get(position).getStatus()==R.drawable.reapply){ + Intent ittPrjStatToEdtProj = new Intent(getActivity(), EditProjectActivity.class); + ittPrjStatToEdtProj.putExtra("projstatus","reapply"); + ittPrjStatToEdtProj.putExtra("projectId",projList.get(position).getProjectId()); + startActivity(ittPrjStatToEdtProj); + } + if(projList.get(position).getStatus()==R.drawable.completed){ + Intent ittPrjStatToEdtProj = new Intent(getActivity(), EditProjectActivity.class); + ittPrjStatToEdtProj.putExtra("projstatus","completed"); + ittPrjStatToEdtProj.putExtra("projectId",projList.get(position).getProjectId()); + startActivity(ittPrjStatToEdtProj); + + } + + if(projList.get(position).getStatus()==R.drawable.approveneww){ + Intent ittPrjStatToEdtProj = new Intent(getActivity(), EditProjectActivity.class); + ittPrjStatToEdtProj.putExtra("projstatus","approved"); + ittPrjStatToEdtProj.putExtra("projectId",projList.get(position).getProjectId()); + startActivity(ittPrjStatToEdtProj); + } + + if(projList.get(position).getStatus()==R.drawable.rejectnew){ + Intent ittPrjStatToEdtProj = new Intent(getActivity(), EditProjectActivity.class); + ittPrjStatToEdtProj.putExtra("projstatus","rejected"); + ittPrjStatToEdtProj.putExtra("projectId",projList.get(position).getProjectId()); + startActivity(ittPrjStatToEdtProj); + + } + + if(projList.get(position).getStatus()==R.drawable.requestedneww){ + Intent ittPrjStatToEdtProj = new Intent(getActivity(), EditProjectActivity.class); + ittPrjStatToEdtProj.putExtra("projstatus","requested"); + ittPrjStatToEdtProj.putExtra("projectId",projList.get(position).getProjectId()); + startActivity(ittPrjStatToEdtProj); + } + + + } + }); + + + etSearch.addTextChangedListener(new TextWatcher() { + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + // Call back the Adapter with current character to Filter + } + + @Override + public void beforeTextChanged(CharSequence s, int start, int count,int after) { + } + ; + @Override + public void afterTextChanged(Editable s) { + //adapter.getFilter().filter(s.toString()); + String text = etSearch.getText().toString().toLowerCase(Locale.getDefault()); + adapter.filter(text,originalList); + } + }); + } + + private void populateList() { + + ProjectStatusTask projStatTask = new ProjectStatusTask(getActivity()); + projStatTask.execute(); + + /* ProjectStatusActivityModel item1, item2, item3, item4, item5; + + item1 = new ProjectStatusActivityModel("Student Awareness", "Education", "1000","800",R.drawable.approve, "200"); + projList.add(item1); + + item2 = new ProjectStatusActivityModel("Health Camp", "Medical", "1000","800" ,R.drawable.completed,"200"); + projList.add(item2); + + item3 = new ProjectStatusActivityModel("Shirts Distribution", "Social", "5000","1000",R.drawable.pending,"4000"); + projList.add(item3); + + item4 = new ProjectStatusActivityModel("Food Distribution", "Social", "6000", "4000" , R.drawable.reapply, "2000"); + projList.add(item4);*/ + + } + +/* @Override + public void onRefresh() { + initializeViews(); + swipeLayout.setRefreshing(false); + }*/ + + + public class ProjectStatusTask extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + //private ProgressBar progressBar; + + ProjectStatusTask (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapObject response = getProjectStatus(); + + //Log.d("Soap response is",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + progressDialog.setMessage("Loading"); + progressDialog.setProgressStyle(android.R.attr.progressBarStyleSmall); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapObject result) { + + + + /* String finalResult = result.toString(); + String finals = finalResult.replace("anyType",""); + Log.d("Finals is",finals); + + + SoapPrimitive status = (SoapPrimitive) result.getProperty("Status"); + //Log.d("Status is:",status.toString()); + + if(status.toString().equals("Success")) { + SoapPrimitive role = (SoapPrimitive) result.getProperty("Role"); + Log.d("Role is:", role.toString()); + + if(role.toString().equals("Student")){ + *//* Intent ittLoginToEditProfile = new Intent(LoginActivity.this,EditProfileActivity.class); + ittLoginToEditProfile.putExtra("leadid",leadid); + startActivity(ittLoginToEditProfile);*//* + } + }else{ + Log.d("Status is: ",status.toString()); + }*/ + + if(result!=null){ + + SoapPrimitive S_ApprovedAmount, S_ReleasedAmount, S_ProjectTitle, S_ProjectStatus, S_Rating,S_ProjectId,S_Status; + Object O_ApprovedAmount, O_ReleasedAmount, O_ProjectTitle, O_ProjectStatus, O_Rating,O_ProjectId,O_Status; + String str_ApprovedAmount = null, str_ReleasedAmount = null, str_ProjectTitle = null, str_ProjectStatus = null, str_Rating=null,str_projectId=null,str_Status=null; + + for (int i = 0; i < result.getPropertyCount(); i++) { + SoapObject list = (SoapObject) result.getProperty(i); + + Log.d("DistrictResult", list.toString()); + + O_Status = list.getProperty("status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) list.getProperty("status"); + Log.d("Status:", S_Status.toString()); + str_Status = S_Status.toString(); + } + + if (str_Status.equalsIgnoreCase("success")) { + + O_ProjectTitle = list.getProperty("Title"); + if (!O_ProjectTitle.toString().equals("anyType{}") && !O_ProjectTitle.toString().equals(null)) { + S_ProjectTitle = (SoapPrimitive) list.getProperty("Title"); + Log.d("Titlesssssss", S_ProjectTitle.toString()); + str_ProjectTitle = S_ProjectTitle.toString(); + } + + O_ApprovedAmount = list.getProperty("SanctionAmount"); + if (!O_ApprovedAmount.toString().equals("anyType{}") && !O_ApprovedAmount.toString().equals(null)) { + S_ApprovedAmount = (SoapPrimitive) list.getProperty("SanctionAmount"); + Log.d("Approved Amountssss", S_ApprovedAmount.toString()); + str_ApprovedAmount = S_ApprovedAmount.toString(); + } + + O_ProjectStatus = list.getProperty("ProjectStatus"); + if (!O_ProjectStatus.toString().equals("anyType{}") && !O_ProjectStatus.toString().equals(null)) { + S_ProjectStatus = (SoapPrimitive) list.getProperty("ProjectStatus"); + Log.d("ProjectStatusss", S_ProjectStatus.toString()); + str_ProjectStatus = S_ProjectStatus.toString(); + } + + O_ReleasedAmount = list.getProperty("giventotal"); + if (!O_ReleasedAmount.toString().equals("anyType{}") && !O_ReleasedAmount.toString().equals(null)) { + S_ReleasedAmount = (SoapPrimitive) list.getProperty("giventotal"); + Log.d("ReleasedAmountssss", S_ReleasedAmount.toString()); + str_ReleasedAmount = S_ReleasedAmount.toString(); + } + + O_ProjectId = list.getProperty("PDId"); + if (!O_ProjectId.toString().equals("anyType{}") && !O_ProjectId.toString().equals(null)) { + S_ProjectId = (SoapPrimitive) list.getProperty("PDId"); + Log.d("ReleasedAmountssss", S_ProjectId.toString()); + str_projectId = S_ProjectId.toString(); + } + + + if (str_ProjectStatus.equals("Completed")) { + O_Rating = list.getProperty("Rating"); + if (!O_Rating.toString().equals("anyType{}") && !O_Rating.toString().equals(null)) { + S_Rating = (SoapPrimitive) list.getProperty("Rating"); + Log.d("Ratingsssss", S_Rating.toString()); + str_Rating = S_Rating.toString(); + } + + isCompletedflag = true; + + projectStatusIcon = R.drawable.completed; + countCompleted++; + + + } else { + + if (str_ProjectStatus.equals("Proposed")) { + projectStatusIcon = R.drawable.pendinghome_new; + countProposed++; + } + if (str_ProjectStatus.equals("RequestForModification")) { + projectStatusIcon = R.drawable.reapply; + countReapply++; + } + if (str_ProjectStatus.equals("Approved")) { + projectStatusIcon = R.drawable.approveneww; + countApproved++; + } + if (str_ProjectStatus.equals("Draft")){ + projectStatusIcon = R.drawable.approveneww; + countApproved++; + } + if (str_ProjectStatus.equals("Rejected")) { + projectStatusIcon = R.drawable.rejectnew; + countRejected++; + } + if (str_ProjectStatus.equals("RequestForCompletion")) { + projectStatusIcon = R.drawable.requestedneww; + countRequestForCompletion++; + } + + + isCompletedflag = false; + str_Rating = "0"; + } + + ProjectStatusActivityModel2 item; + + item = new ProjectStatusActivityModel2(str_ProjectTitle, str_ApprovedAmount, projectStatusIcon, str_ReleasedAmount, str_Rating, isCompletedflag, str_projectId); + projList.add(item); + } + } + + + + originalList = new ArrayList(); + originalList.addAll(projList); + + adapter.notifyDataSetChanged(); + } + //progressBar.setVisibility(View.GONE); + progressDialog.dismiss(); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapObject getProjectStatus() { + String METHOD_NAME = "GetprojectstatusList"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetprojectstatusList"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + request.addProperty("Lead_id",str_leadId); + //users.ad + //request.add + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Projects.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + // Log.d("soap response1xxxx",envelope.getResponse().toString()); + + + SoapObject response = (SoapObject) envelope.getResponse(); + Log.e("soap responseyyyyyyy",response.toString()); + + //return null; + + return response; + + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + + } +} diff --git a/app/src/main/java/com/leadcampusapp/ProjectStatusReport.java b/app/src/main/java/com/leadcampusapp/ProjectStatusReport.java new file mode 100644 index 0000000..4dff9c6 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ProjectStatusReport.java @@ -0,0 +1,160 @@ +package com.leadcampusapp; + +import android.graphics.Color; +import androidx.appcompat.app.AppCompatActivity; +import android.os.Bundle; +import android.util.Log; + +//import com.android.sripad.leadnew_22_6_2018.R; +import com.github.mikephil.charting.charts.PieChart; +import com.github.mikephil.charting.data.Entry; +import com.github.mikephil.charting.data.PieData; +import com.github.mikephil.charting.data.PieDataSet; +import com.github.mikephil.charting.formatter.PercentFormatter; +import com.github.mikephil.charting.highlight.Highlight; +import com.github.mikephil.charting.listener.OnChartValueSelectedListener; +import com.github.mikephil.charting.utils.ColorTemplate; + + +import java.util.ArrayList; + +public class ProjectStatusReport extends AppCompatActivity implements OnChartValueSelectedListener { + + private int countProposed=0; + private int countReapply=0; + private int countRequestForCompletion=0; + private int countApproved=0; + private int countRejected=0; + private int countCompleted=0; + private int total = 0; + private float percentProposed=0; + private float percentReapply=0; + private float percentRequestForCompletion=0; + private float percentApproved=0; + private float percentRejected=0; + private float percentCompleted=0; + + private int count = 0; + + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_project_status_report); + + countProposed = getIntent().getIntExtra("Pending",0); + countReapply = getIntent().getIntExtra("Reapply",0); + countApproved = getIntent().getIntExtra("Approved",0); + countRejected = getIntent().getIntExtra("Rejected",0); + countRequestForCompletion = getIntent().getIntExtra("RequestForCompletion",0); + countCompleted = getIntent().getIntExtra("Completed",0); + + Log.d("countProposed", String.valueOf(countProposed)); + Log.d("countReapply", String.valueOf(countReapply)); + Log.d("countApproved", String.valueOf(countApproved)); + Log.d("countRejected", String.valueOf(countRejected)); + Log.d("countReqstcompln", String.valueOf(countRequestForCompletion)); + Log.d("countCompleted", String.valueOf(countCompleted)); + + total = countProposed + countReapply + countApproved + countRejected + countRequestForCompletion + countCompleted; + + Log.d("total is", String.valueOf(total)); + + ArrayList yvalues = new ArrayList(); + ArrayList xVals = new ArrayList(); + + if(countProposed != 0) { + percentProposed = (total / countProposed) * 100; + yvalues.add(new Entry(countProposed,0)); + xVals.add("Proposed"); + } + if(countReapply!=0) { + percentReapply = (total / countReapply ) * 100; + yvalues.add(new Entry(countReapply, 1)); + xVals.add("Reapplied"); + } + if(countApproved!=0) { + percentApproved = (total / countApproved) * 100; + yvalues.add(new Entry(countApproved, 2)); + xVals.add("Approved"); + } + if(countRejected!=0) { + percentRejected = (total / countRejected) * 100; + yvalues.add(new Entry(countRejected, 3)); + xVals.add("Rejected"); + } + if(countRequestForCompletion!=0) { + percentRequestForCompletion = (total / countRequestForCompletion) * 100; + yvalues.add(new Entry(countRequestForCompletion, 4)); + xVals.add("RequestForCompletion"); + } + if(countCompleted!=0) { + percentCompleted = (total / countCompleted) * 100; + yvalues.add(new Entry(countCompleted, 5)); + xVals.add("Completed"); + } + + + PieChart pieChart = (PieChart) findViewById(R.id.piechart); + pieChart.setUsePercentValues(true); + + // IMPORTANT: In a PieChart, no values (Entry) should have the same + // xIndex (even if from different DataSets), since no values can be + // drawn above each other. + + + /* yvalues.add(new Entry(percentReapply, 1)); + yvalues.add(new Entry(percentApproved, 2)); + yvalues.add(new Entry(percentRejected, 3)); + yvalues.add(new Entry(percentRequestForCompletion, 4)); + yvalues.add(new Entry(percentCompleted, 5));*/ + + PieDataSet dataSet = new PieDataSet(yvalues, "Project Overall"); + + + + PieData data = new PieData(xVals, dataSet); + data.setValueFormatter(new PercentFormatter()); + pieChart.setData(data); + // pieChart.setDescription("This is Pie Chart"); + + pieChart.setDrawHoleEnabled(true); + pieChart.setTransparentCircleRadius(25f); + pieChart.setHoleRadius(25f); + + dataSet.setColors(ColorTemplate.VORDIPLOM_COLORS); + data.setValueTextSize(13f); + data.setValueTextColor(Color.DKGRAY); + pieChart.setOnChartValueSelectedListener(this); + + pieChart.animateXY(1400, 1400); + + } + + /* @Override + public void onValueSelected(Entry e, Highlight h) { + + if (e == null) + return; + Log.i("VAL SELECTED", + "Value: " + e.getXIndex() + ", xIndex: " + e.getX() + + ", DataSet index: " + h.getDataSetIndex()); + } +*/ + @Override + public void onValueSelected(Entry e, int dataSetIndex, Highlight h) { + if (e == null) + return; + Log.i("VAL SELECTED", + "Value: " + e.getVal() + ", xIndex: " + e.getXIndex() + + ", DataSet index: " + dataSetIndex); + } + @Override + public void onNothingSelected() { + Log.i("PieChart", "nothing selected"); + } +} + + + diff --git a/app/src/main/java/com/leadcampusapp/ReqCloseAdapter.java b/app/src/main/java/com/leadcampusapp/ReqCloseAdapter.java new file mode 100644 index 0000000..23e08dc --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ReqCloseAdapter.java @@ -0,0 +1,164 @@ +package com.leadcampusapp; + +import android.app.Activity; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.EditText; +import android.widget.TextView; + +import java.util.ArrayList; + +//import com.android.sripad.leadnew_22_6_2018.R; + +/** + * Created by Admin on 28-05-2018. + */ + +public class ReqCloseAdapter extends BaseAdapter{ + + public ArrayList ReqCloseList; + Activity activity; + EditText userInputDialogEditText; + String str_requestId,str_reson; + + public ReqCloseAdapter(Activity activity, ArrayList ReqCloseList) { + super(); + this.activity = activity; + this.ReqCloseList = ReqCloseList; + } + + @Override + public int getCount() { + //return projList.size(); + return ReqCloseList.size(); + } + + @Override + public ReqCloseModule getItem(int position) { + + //return projList.get(position); + return ReqCloseList.get(position); + } + + @Override + public long getItemId(int position) { + return position; + } + + class ViewHolder { + TextView txt_ticketno; + TextView txt_reqDate; + TextView txt_lead_id; + TextView txt_studName; + TextView txt_mobileno; + TextView txt_reqType; + TextView txt_reqMsg; + TextView txt_resMsg; + TextView txt_priority; + TextView txt_resDate; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + + final ViewHolder holder; + final String[] userInput = new String[1]; + + LayoutInflater inflater = activity.getLayoutInflater(); + + if (convertView == null) { + convertView = inflater.inflate(R.layout.reqclose_listrow, null); + holder = new ViewHolder(); + + holder.txt_ticketno = (TextView) convertView.findViewById(R.id.txt_ticketno); + holder.txt_reqDate = (TextView) convertView.findViewById(R.id.txt_reqDate); + holder.txt_lead_id = (TextView) convertView.findViewById(R.id.txt_lead_id); + holder.txt_studName = (TextView) convertView.findViewById(R.id.txt_studName); + holder.txt_mobileno = (TextView) convertView.findViewById(R.id.txt_mobileno); + holder.txt_reqType = (TextView) convertView.findViewById(R.id.txt_reqType); + holder.txt_reqMsg = (TextView) convertView.findViewById(R.id.txt_reqMsg); + holder.txt_resMsg = (TextView) convertView.findViewById(R.id.txt_resMsg); + holder.txt_priority = (TextView) convertView.findViewById(R.id.txt_priority); + holder.txt_resDate = (TextView) convertView.findViewById(R.id.txt_resDate); + + convertView.setTag(holder); + } else { + holder = (ViewHolder) convertView.getTag(); + } + + ReqCloseModule item = ReqCloseList.get(position); + + if(item.getTicket_No()!=null) { + holder.txt_ticketno.setText(item.getTicket_No().toString()); + } + if(item.getRequest_Date()!=null) { + holder.txt_reqDate.setText(item.getRequest_Date().toString()); + } + if(item.getLead_Id()!=null) { + holder.txt_lead_id.setText(item.getLead_Id().toString()); + } + if(item.getStudent_Name()!=null) { + holder.txt_studName.setText(item.getStudent_Name().toString()); + } + if(item.getMobileNo()!=null) { + holder.txt_mobileno.setText(item.getMobileNo().toString()); + } + if(item.getRequest_type()!=null) { + holder.txt_reqType.setText(item.getRequest_type().toString()); + } + if(item.getRequest_Message()!=null) { + holder.txt_reqMsg.setText(item.getRequest_Message().toString()); + } + if(item.getResponse_Message()!=null) { + holder.txt_resMsg.setText(item.getResponse_Message().toString()); + } + if(item.getRequest_Priority()!=null) { + holder.txt_priority.setText(item.getRequest_Priority().toString()); + } + if(item.getRespond_Date()!=null) { + holder.txt_resDate.setText(item.getRespond_Date().toString()); + } + + + return convertView; + } + +/* public void filter(String charText,ArrayList reqOpenList,String selectedCollegeName) { + //charText = charText.toLowerCase(Locale.getDefault()); + //Log.d("charTextissss",charText); + this.ReqOpenList.clear(); + + *//* for(FeesUnpaidModel feesUnpaidModel : feesList){ + String stdName = feesUnpaidModel.getStudent_name().toString(); + //Log.d("StudeNameissssss",stdName); + }*//* + + if(charText!=null) { + if(reqOpenList!=null) { + if (charText.isEmpty() || charText.length() == 0) { + this.ReqOpenList.addAll(reqOpenList); + } else { + for (ReqOpenModule wp : reqOpenList) { + //Log.d("GetCollegeNameissss",wp.getCollege_name().toLowerCase((Locale.getDefault()))); + *//* if (wp.getCollege_name().toLowerCase(Locale.getDefault()).contains(charText) || wp.getLead_id().toLowerCase(Locale.getDefault()).contains(charText) || wp.getPhone_number().toLowerCase(Locale.getDefault()).contains(charText) || wp.getStudent_name().toLowerCase(Locale.getDefault()).contains(charText) || wp.getPhone_number().toLowerCase(Locale.getDefault()).contains(charText)) { + this.feesUnPaidList.add(wp); + }*//* + if(selectedCollegeName == null) { + if ((wp.getCollege_name()!=null && wp.getCollege_name().toLowerCase().contains(charText.toLowerCase())) || ( wp.getLead_id()!=null && wp.getLead_id().toLowerCase().contains(charText.toLowerCase())) || ( wp.getPhone_number()!=null && wp.getPhone_number().toLowerCase().contains(charText.toLowerCase())) || ( wp.getStudent_name()!=null && wp.getStudent_name().toLowerCase().contains(charText.toLowerCase()) ) || ( wp.getPhone_number()!=null && wp.getPhone_number().toLowerCase().contains(charText.toLowerCase()))) { + this.ReqOpenList.add(wp); + } + }else{ + if ((wp.getCollege_name()!=null && wp.getCollege_name().equals(selectedCollegeName)) && ((wp.getCollege_name()!=null && wp.getCollege_name().toLowerCase().contains(charText.toLowerCase())) || (wp.getLead_id()!=null && wp.getLead_id().toLowerCase().contains(charText.toLowerCase())) || (wp.getPhone_number()!=null && wp.getPhone_number().toLowerCase().contains(charText.toLowerCase())) || (wp.getStudent_name()!=null && wp.getStudent_name().toLowerCase().contains(charText.toLowerCase())) || (wp.getPhone_number()!=null && wp.getPhone_number().toLowerCase().contains(charText.toLowerCase())))) { + this.ReqOpenList.add(wp); + } + } + + } + } + notifyDataSetChanged(); + } + } + }*/ +} diff --git a/app/src/main/java/com/leadcampusapp/ReqCloseFragment.java b/app/src/main/java/com/leadcampusapp/ReqCloseFragment.java new file mode 100644 index 0000000..caf68b8 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ReqCloseFragment.java @@ -0,0 +1,366 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 22-06-2018. + */ + +import android.app.AlertDialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.SharedPreferences; +import android.os.AsyncTask; +import android.os.Bundle; +import androidx.fragment.app.Fragment; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ListView; +import android.widget.Toast; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.util.ArrayList; + +//import com.android.sripad.leadnew_22_6_2018.R; + +public class ReqCloseFragment extends Fragment{ + + private ArrayList projList; + private View view; + + public static final String PREFBook_Stud= "prefbook_stud"; //sharedpreference Book + public static final String PrefID_RegID = "prefid_regid"; // + public static final String PrefID_SName = "prefid_sname"; // + public static final String PrefID_PM_SName = "prefid_pmsname"; // + public static final String PrefID_SLeadID = "prefid_sleadid"; // + public static final String PrefID_PM_SEmailID = "prefid_pm_semailid"; // + public static final String PrefID_SCellNo = "prefid_scellno"; // + + private SharedPreferences shardpref_S_obj; + private String str_leadId,str_RegistrationId; + private ProgressDialog progressDialog; + + ReqCloseModule reqCloseModule_item; + ArrayList reqCloseModulesList; + private ReqCloseAdapter adapter_reqClose; + + private ListView lview; + + public static final String PrefID_PMID = "prefid_pmid"; // + public static final String PREFBook_PM= "prefbook_pm"; + SharedPreferences shardprefPM_obj; + public String str_MangerID; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + + view = inflater.inflate(R.layout.fragment_req_open, container, false); + + shardpref_S_obj=getActivity().getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + str_leadId = shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + Log.d("str_leadId:",str_leadId); + + shardpref_S_obj.getString(PrefID_RegID, "").trim(); + str_RegistrationId = shardpref_S_obj.getString(PrefID_RegID, "").trim(); + Log.d("str_RegistrationId:",str_RegistrationId); + + shardprefPM_obj= getActivity().getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MangerID = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + + Log.d("str_MangerID:",str_MangerID); + reqCloseModulesList = new ArrayList(); + + lview = (ListView) view.findViewById(R.id.lv_openreq); + + GetReqCloselist getReqqOpenlist = new GetReqCloselist(getActivity()); + getReqqOpenlist.execute(); + + return view; + } + + public class GetReqCloselist extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + //private ProgressBar progressBar; + + GetReqCloselist (Context ctx){ + context = ctx; + // progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapObject response = getReqCloselist(); + + //Log.d("Soap response is",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + /* progressDialog.setMessage("Loading"); + progressDialog.setProgressStyle(android.R.attr.progressBarStyleSmall); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show();*/ + } + + @Override + protected void onPostExecute(SoapObject result1) { + + Log.d("Resultisssss:",result1.toString()); + /* anyType{vmManagerOpenRequest=anyType{Ticket_No=13; Request_Date=26-06-2019 12:54:08 PM; Lead_Id=MH05102; + Student_Name=Madhu Tech; MobileNo=8904674048; RequestHead_Id=4; Project_Id=0; Request_type=Funding; + Request_Message=testing; Request_Priority=High; College_Name=Lalbhai Dalpatbhai ; Status=Success; };*/ + reqCloseModulesList.clear(); + if(result1 != null) { + + SoapPrimitive S_Ticket_No,S_Request_Date, S_Lead_Id, S_Student_Name, S_MobileNo,S_RequestHead_Id,S_Project_Id,S_Request_type,S_Request_Message,S_Request_Priority,S_Response_Message,S_College_Name,S_Status,S_Respond_Date; + Object O_Ticket_No, O_Request_Date, O_Lead_Id, O_Student_Name, O_MobileNo, O_RequestHead_Id, O_Project_Id, O_Request_type, O_Request_Message, O_Request_Priority,O_Response_Message,O_College_Name,O_Status,O_Respond_Date; + String str_Ticket_No = null, str_Request_Date = null, str_Lead_Id = null, str_Student_Name = null, str_MobileNo = null, str_RequestHead_Id = null,str_Project_Id = null,str_Request_type = null,str_Request_Message = null,str_Response_Message=null,str_Request_Priority = null,str_College_Name = null,str_status = null,str_Respond_Date=null; + + for (int i = 0; i < result1.getPropertyCount(); i++) { + SoapObject result = (SoapObject) result1.getProperty(i); + + Log.d("soap O_Status list:",result.toString()); + + O_Status = result.getProperty("Status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) result.getProperty("Status"); + Log.d("S_Status:", S_Status.toString()); + str_status = S_Status.toString(); + } + if (str_status.equalsIgnoreCase("Success")) { + O_Ticket_No = result.getProperty("Ticket_No"); + if (!O_Ticket_No.toString().equals("anyType{}") && !O_Ticket_No.toString().equals(null)) { + S_Ticket_No = (SoapPrimitive) result.getProperty("Ticket_No"); + Log.d("S_Ticket_No:", S_Ticket_No.toString()); + str_Ticket_No = S_Ticket_No.toString(); + + //txt_assignedSmall.setText(str_allotedS); + } + + O_Request_Date = result.getProperty("Request_Date"); + if (!O_Request_Date.toString().equals("anyType{}") && !O_Request_Date.toString().equals(null)) { + S_Request_Date = (SoapPrimitive) result.getProperty("Request_Date"); + Log.d("S_AllotedM:", S_Request_Date.toString()); + str_Request_Date = S_Request_Date.toString(); + + //txt_assignedMedium.setText(str_allotedM); + } + + O_Lead_Id = result.getProperty("Lead_Id"); + if (!O_Lead_Id.toString().equals("anyType{}") && !O_Lead_Id.toString().equals(null)) { + S_Lead_Id = (SoapPrimitive) result.getProperty("Lead_Id"); + str_Lead_Id = S_Lead_Id.toString(); + Log.d("S_Lead_Id:", str_Lead_Id); + + //txt_assignedLarge.setText(str_allotedL); + } + + O_Student_Name = result.getProperty("Student_Name"); + if (!O_Student_Name.toString().equals("anyType{}") && !O_Student_Name.toString().equals(null)) { + S_Student_Name = (SoapPrimitive) result.getProperty("Student_Name"); + Log.d("S_AllotedXL", S_Student_Name.toString()); + str_Student_Name = S_Student_Name.toString(); + Log.d("S_Student_Name", str_Student_Name); + + //txt_assignedXL.setText(str_allotedXL); + } + + O_MobileNo = result.getProperty("MobileNo"); + if (!O_MobileNo.toString().equals("anyType{}") && !O_MobileNo.toString().equals(null)) { + S_MobileNo = (SoapPrimitive) result.getProperty("MobileNo"); + Log.d("S_MobileNo", S_MobileNo.toString()); + str_MobileNo = S_MobileNo.toString(); + Log.d("str_allotedXXL", str_MobileNo); + + // txt_assignedXXL.setText(str_allotedXXL); + } + + + O_RequestHead_Id = result.getProperty("RequestHead_Id"); + if (!O_RequestHead_Id.toString().equals("anyType{}") && !O_RequestHead_Id.toString().equals(null)) { + S_RequestHead_Id = (SoapPrimitive) result.getProperty("RequestHead_Id"); + Log.d("S_RequestHead_Id:", S_RequestHead_Id.toString()); + str_RequestHead_Id = S_RequestHead_Id.toString(); + + // txt_balSmall.setText(str_usedS); + } + + O_Project_Id = result.getProperty("Project_Id"); + if (!O_Project_Id.toString().equals("anyType{}") && !O_Project_Id.toString().equals(null)) { + S_Project_Id = (SoapPrimitive) result.getProperty("Project_Id"); + Log.d("S_Project_Id:", S_Project_Id.toString()); + str_Project_Id = S_Project_Id.toString(); + + // txt_balMedium.setText(str_usedM); + } + + O_Request_type = result.getProperty("Request_type"); + if (!O_Request_type.toString().equals("anyType{}") && !O_Request_type.toString().equals(null)) { + S_Request_type = (SoapPrimitive) result.getProperty("Request_type"); + Log.d("S_Request_type:", S_Request_type.toString()); + str_Request_type = S_Request_type.toString(); + + // txt_balLarge.setText(str_usedL); + } + + O_Request_Message = result.getProperty("Request_Message"); + if (!O_Request_Message.toString().equals("anyType{}") && !O_Request_Message.toString().equals(null)) { + S_Request_Message = (SoapPrimitive) result.getProperty("Request_Message"); + Log.d("S_Request_Message:", S_Request_Message.toString()); + str_Request_Message = S_Request_Message.toString(); + } + + O_Response_Message = result.getProperty("Response_Message"); + if (!O_Response_Message.toString().equals("anyType{}") && !O_Response_Message.toString().equals(null)) { + S_Response_Message = (SoapPrimitive) result.getProperty("Response_Message"); + Log.d("S_Response_Message:", S_Response_Message.toString()); + str_Response_Message = S_Response_Message.toString(); + } + + O_Request_Priority = result.getProperty("Request_Priority"); + if (!O_Request_Priority.toString().equals("anyType{}") && !O_Request_Priority.toString().equals(null)) { + S_Request_Priority = (SoapPrimitive) result.getProperty("Request_Priority"); + Log.d("O_Request_Priority:", S_Request_Priority.toString()); + str_Request_Priority = S_Request_Priority.toString(); + + } + + O_College_Name = result.getProperty("College_Name"); + if (!O_College_Name.toString().equals("anyType{}") && !O_College_Name.toString().equals(null)) { + S_College_Name = (SoapPrimitive) result.getProperty("College_Name"); + Log.d("O_College_Name:", S_College_Name.toString()); + str_College_Name = S_College_Name.toString(); + + } + O_Respond_Date = result.getProperty("Respond_Date"); + if (!O_Respond_Date.toString().equals("anyType{}") && !O_Respond_Date.toString().equals(null)) { + S_Respond_Date = (SoapPrimitive) result.getProperty("Respond_Date"); + Log.d("O_Respond_Date:", S_Respond_Date.toString()); + str_Respond_Date = S_Respond_Date.toString(); + + } + + + reqCloseModule_item = new ReqCloseModule(str_Ticket_No, str_Request_Date,str_Respond_Date, str_Lead_Id, str_Student_Name, str_MobileNo, str_RequestHead_Id, str_Project_Id, str_Request_type, str_Request_Message, str_Response_Message, str_Request_Priority, str_College_Name); + reqCloseModulesList.add(reqCloseModule_item); + + } else { + Toast.makeText(getActivity(), "There is no tshirt", Toast.LENGTH_LONG).show(); + } + } + + + } + + adapter_reqClose = new ReqCloseAdapter(getActivity(), reqCloseModulesList); + lview.setAdapter(adapter_reqClose); + +// progressDialog.dismiss(); + + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapObject getReqCloselist() { + String METHOD_NAME = "GetClosedRequest"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetClosedRequest"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + + request.addProperty("ManagerId",str_MangerID); + //users.ad + //request.add + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + Log.d("soapresponse1xxxx:",envelope.getResponse().toString()); + + + SoapObject response = (SoapObject) envelope.getResponse(); + Log.e("soapresponseyyyyyyy:",response.toString()); + + //return null; + + return response; + + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + + } +} diff --git a/app/src/main/java/com/leadcampusapp/ReqCloseModule.java b/app/src/main/java/com/leadcampusapp/ReqCloseModule.java new file mode 100644 index 0000000..e447471 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ReqCloseModule.java @@ -0,0 +1,168 @@ +package com.leadcampusapp; + +/** + * Created by User on 14-Jun-19. + */ + +public class ReqCloseModule { + private String Ticket_No; + private String Request_Date; + private String Respond_Date; + private String Lead_Id; + private String Student_Name; + private String MobileNo; + private String RequestHead_Id; + private String Project_Id; + private String Request_type; + private String Request_Message; + private String Response_Message; + private String Request_Priority; + private String College_Name; + private String Status; + + public ReqCloseModule(String ticket_No, String request_Date, String response_Date, String lead_Id, String student_Name, String mobileNo, String requestHead_Id, String project_Id, String request_type, String request_Message, String response_Message, String request_Priority, String college_Name) { + Ticket_No = ticket_No; + Request_Date = request_Date; + Respond_Date= response_Date; + Lead_Id = lead_Id; + Student_Name = student_Name; + MobileNo = mobileNo; + RequestHead_Id = requestHead_Id; + Project_Id = project_Id; + Request_type = request_type; + Request_Message = request_Message; + Response_Message = response_Message; + Request_Priority = request_Priority; + College_Name = college_Name; + } + + public String getTicket_No() { + return Ticket_No; + } + + public void setTicket_No(String ticket_No) { + Ticket_No = ticket_No; + } + + public String getRequest_Date() { + return Request_Date; + } + + public void setRequest_Date(String request_Date) { + Request_Date = request_Date; + } + + public String getLead_Id() { + return Lead_Id; + } + + public void setLead_Id(String lead_Id) { + Lead_Id = lead_Id; + } + + public String getStudent_Name() { + return Student_Name; + } + + public void setStudent_Name(String student_Name) { + Student_Name = student_Name; + } + + public String getMobileNo() { + return MobileNo; + } + + public void setMobileNo(String mobileNo) { + MobileNo = mobileNo; + } + + public String getRequestHead_Id() { + return RequestHead_Id; + } + + public void setRequestHead_Id(String requestHead_Id) { + RequestHead_Id = requestHead_Id; + } + + public String getProject_Id() { + return Project_Id; + } + + public void setProject_Id(String project_Id) { + Project_Id = project_Id; + } + + public String getRequest_type() { + return Request_type; + } + + public void setRequest_type(String request_type) { + Request_type = request_type; + } + + public String getRequest_Message() { + return Request_Message; + } + + public void setRequest_Message(String request_Message) { + Request_Message = request_Message; + } + + public String getResponse_Message() { + return Response_Message; + } + + public void setResponse_Message(String response_Message) { + Response_Message = response_Message; + } + + public String getRequest_Priority() { + return Request_Priority; + } + + public void setRequest_Priority(String request_Priority) { + Request_Priority = request_Priority; + } + + public String getCollege_Name() { + return College_Name; + } + + public void setCollege_Name(String college_Name) { + College_Name = college_Name; + } + + public String getStatus() { + return Status; + } + + public void setStatus(String status) { + Status = status; + } + + public String getRespond_Date() { + return Respond_Date; + } + + public void setRespond_Date(String respond_Date) { + Respond_Date = respond_Date; + } + +/* string + string + string + string + string + string + string + string + string + string + string + string + string*/ + + + + +} diff --git a/app/src/main/java/com/leadcampusapp/ReqOpenAdapter.java b/app/src/main/java/com/leadcampusapp/ReqOpenAdapter.java new file mode 100644 index 0000000..a46e9ee --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ReqOpenAdapter.java @@ -0,0 +1,238 @@ +package com.leadcampusapp; + +import android.app.Activity; +import android.content.Intent; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.Button; +import android.widget.EditText; +import android.widget.TextView; + +import java.util.ArrayList; + +//import com.android.sripad.leadnew_22_6_2018.R; + +/** + * Created by Admin on 28-05-2018. + */ + +public class ReqOpenAdapter extends BaseAdapter{ + + public ArrayList ReqOpenList; + Activity activity; + EditText userInputDialogEditText; + String str_requestId,str_reson; + + public ReqOpenAdapter(Activity activity, ArrayList ReqOpenList) { + super(); + this.activity = activity; + this.ReqOpenList = ReqOpenList; + } + + @Override + public int getCount() { + //return projList.size(); + return ReqOpenList.size(); + } + + @Override + public ReqOpenModule getItem(int position) { + + //return projList.get(position); + return ReqOpenList.get(position); + } + + @Override + public long getItemId(int position) { + return position; + } + + class ViewHolder { + TextView txt_ticketno; + TextView txt_reqDate; + TextView txt_lead_id; + TextView txt_studName; + TextView txt_mobileno; + TextView txt_reqType; + TextView txt_collgName; + TextView txt_reqMsg; + + Button priority_btn; + + TextView txt_projectName; + TextView txt_mailId; + TextView txt_manager_MailId; + TextView txt_reqHeadId; + TextView txt_mobNo; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + + final ViewHolder holder; + final String[] userInput = new String[1]; + + LayoutInflater inflater = activity.getLayoutInflater(); + + if (convertView == null) { + convertView = inflater.inflate(R.layout.reqopen_listrow, null); + holder = new ViewHolder(); + + holder.txt_ticketno = (TextView) convertView.findViewById(R.id.txt_ticketno); + holder.txt_reqDate = (TextView) convertView.findViewById(R.id.txt_reqDate); + holder.txt_lead_id = (TextView) convertView.findViewById(R.id.txt_lead_id); + holder.txt_studName = (TextView) convertView.findViewById(R.id.txt_studName); + holder.txt_mobileno = (TextView) convertView.findViewById(R.id.txt_mobileno); + holder.txt_reqType = (TextView) convertView.findViewById(R.id.txt_reqType); + holder.txt_reqMsg = (TextView) convertView.findViewById(R.id.txt_reqMsg); + holder.txt_collgName = (TextView) convertView.findViewById(R.id.txt_collgName); + holder.priority_btn = (Button) convertView.findViewById(R.id.priority_btn); + + holder.txt_projectName = (TextView) convertView.findViewById(R.id.txt_projectName); + holder.txt_mailId = (TextView) convertView.findViewById(R.id.txt_mailid); + holder.txt_manager_MailId = (TextView) convertView.findViewById(R.id.txt_managerMailId); + holder.txt_reqHeadId = (TextView) convertView.findViewById(R.id.txt_reqHeadId); + holder.txt_mobNo = (TextView) convertView.findViewById(R.id.txt_mobNo); + + convertView.setTag(holder); + } else { + holder = (ViewHolder) convertView.getTag(); + } + + ReqOpenModule item = ReqOpenList.get(position); + + if(item.getTicket_No()!=null) { + holder.txt_ticketno.setText(item.getTicket_No().toString()); + } + if(item.getRequest_Date()!=null) { + holder.txt_reqDate.setText(item.getRequest_Date().toString()); + } + if(item.getLead_Id()!=null) { + holder.txt_lead_id.setText(item.getLead_Id().toString()); + } + if(item.getStudent_Name()!=null) { + holder.txt_studName.setText(item.getStudent_Name().toString()); + } + if(item.getMobileNo()!=null) { + holder.txt_mobileno.setText(item.getMobileNo().toString()); + } + if(item.getRequest_type()!=null) { + holder.txt_reqType.setText(item.getRequest_type().toString()); + } + if(item.getRequest_Message()!=null) { + holder.txt_reqMsg.setText(item.getRequest_Message().toString()); + } + if(item.getCollege_Name()!=null) { + holder.txt_collgName.setText(item.getCollege_Name().toString()); + } + if(item.getRequest_Priority()!=null) { + holder.priority_btn.setText(item.getRequest_Priority().toString()); + } + + if(item.getProject_Name()!=null) { + holder.txt_projectName.setText(item.getProject_Name().toString()); + } + if(item.getMailId()!=null) { + holder.txt_mailId.setText(item.getMailId().toString()); + } + if(item.getProg_MailID()!=null) { + holder.txt_manager_MailId.setText(item.getProg_MailID().toString()); + } + if(item.getRequestHead_Id()!=null) { + holder.txt_reqHeadId.setText(item.getRequestHead_Id().toString()); + } + if(item.getMobileNo()!=null) { + holder.txt_mobileno.setText(item.getMobileNo().toString()); + } + + if(item.getRequest_Priority().equals("Medium")) { + holder.priority_btn.setBackgroundColor( holder.priority_btn.getContext().getResources().getColor(R.color.priority_medium)); + }else if(item.getRequest_Priority().equals("High")) { + holder.priority_btn.setBackgroundColor( holder.priority_btn.getContext().getResources().getColor(R.color.priority_high)); + }else if(item.getRequest_Priority().equals("Low")) { + holder.priority_btn.setBackgroundColor( holder.priority_btn.getContext().getResources().getColor(R.color.priority_low)); + } + + + holder.txt_projectName.setVisibility(View.GONE); + holder.priority_btn.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + String str_ticketId=holder.txt_ticketno.getText().toString(); + String str_leadId=holder.txt_lead_id.getText().toString(); + String str_reqMsg=holder.txt_reqMsg.getText().toString(); + String str_studName=holder.txt_studName.getText().toString(); + String str_collgName=holder.txt_collgName.getText().toString(); + String str_projectName=holder.txt_projectName.getText().toString(); + String str_mailId=holder.txt_mailId.getText().toString(); + String str_manager_mailID=holder.txt_manager_MailId.getText().toString(); + String str_reqHeadId=holder.txt_reqHeadId.getText().toString(); + String str_mobNo=holder.txt_mobileno.getText().toString(); + String str_reqDate=holder.txt_reqDate.getText().toString(); + String str_reqType=holder.txt_reqType.getText().toString(); + + + + Intent intent = new Intent(activity,ReqOpenDetailActivity.class); + intent.putExtra("str_ticketId",str_ticketId); + intent.putExtra("str_leadId",str_leadId); + intent.putExtra("str_reqMsg",str_reqMsg); + intent.putExtra("str_studName",str_studName); + intent.putExtra("str_collgName",str_collgName); + intent.putExtra("str_projectName",str_projectName); + intent.putExtra("str_mailId",str_mailId); + intent.putExtra("str_manager_mailID",str_manager_mailID); + intent.putExtra("str_reqHeadId",str_reqHeadId); + intent.putExtra("str_mobNo",str_mobNo); + intent.putExtra("str_reqDate",str_reqDate); + intent.putExtra("str_reqType",str_reqType); + + activity.startActivity(intent); + + + + } + }); + + return convertView; + } + +/* public void filter(String charText,ArrayList reqOpenList,String selectedCollegeName) { + //charText = charText.toLowerCase(Locale.getDefault()); + //Log.d("charTextissss",charText); + this.ReqOpenList.clear(); + + *//* for(FeesUnpaidModel feesUnpaidModel : feesList){ + String stdName = feesUnpaidModel.getStudent_name().toString(); + //Log.d("StudeNameissssss",stdName); + }*//* + + if(charText!=null) { + if(reqOpenList!=null) { + if (charText.isEmpty() || charText.length() == 0) { + this.ReqOpenList.addAll(reqOpenList); + } else { + for (ReqOpenModule wp : reqOpenList) { + //Log.d("GetCollegeNameissss",wp.getCollege_name().toLowerCase((Locale.getDefault()))); + *//* if (wp.getCollege_name().toLowerCase(Locale.getDefault()).contains(charText) || wp.getLead_id().toLowerCase(Locale.getDefault()).contains(charText) || wp.getPhone_number().toLowerCase(Locale.getDefault()).contains(charText) || wp.getStudent_name().toLowerCase(Locale.getDefault()).contains(charText) || wp.getPhone_number().toLowerCase(Locale.getDefault()).contains(charText)) { + this.feesUnPaidList.add(wp); + }*//* + if(selectedCollegeName == null) { + if ((wp.getCollege_name()!=null && wp.getCollege_name().toLowerCase().contains(charText.toLowerCase())) || ( wp.getLead_id()!=null && wp.getLead_id().toLowerCase().contains(charText.toLowerCase())) || ( wp.getPhone_number()!=null && wp.getPhone_number().toLowerCase().contains(charText.toLowerCase())) || ( wp.getStudent_name()!=null && wp.getStudent_name().toLowerCase().contains(charText.toLowerCase()) ) || ( wp.getPhone_number()!=null && wp.getPhone_number().toLowerCase().contains(charText.toLowerCase()))) { + this.ReqOpenList.add(wp); + } + }else{ + if ((wp.getCollege_name()!=null && wp.getCollege_name().equals(selectedCollegeName)) && ((wp.getCollege_name()!=null && wp.getCollege_name().toLowerCase().contains(charText.toLowerCase())) || (wp.getLead_id()!=null && wp.getLead_id().toLowerCase().contains(charText.toLowerCase())) || (wp.getPhone_number()!=null && wp.getPhone_number().toLowerCase().contains(charText.toLowerCase())) || (wp.getStudent_name()!=null && wp.getStudent_name().toLowerCase().contains(charText.toLowerCase())) || (wp.getPhone_number()!=null && wp.getPhone_number().toLowerCase().contains(charText.toLowerCase())))) { + this.ReqOpenList.add(wp); + } + } + + } + } + notifyDataSetChanged(); + } + } + }*/ +} diff --git a/app/src/main/java/com/leadcampusapp/ReqOpenDetailActivity.java b/app/src/main/java/com/leadcampusapp/ReqOpenDetailActivity.java new file mode 100644 index 0000000..f056d46 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ReqOpenDetailActivity.java @@ -0,0 +1,557 @@ +package com.leadcampusapp; + +import android.app.AlertDialog; +import android.app.DatePickerDialog; +import android.app.Dialog; +import android.app.DialogFragment; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.AsyncTask; +import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; +import android.util.Log; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.DatePicker; +import android.widget.EditText; +import android.widget.LinearLayout; +import android.widget.ProgressBar; +import android.widget.TextView; +import android.widget.Toast; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; + +public class ReqOpenDetailActivity extends AppCompatActivity { + + TextView ticketNo_TV,lead_id_TV,StudName_TV,MobNo_TV,MailId_TV,CollgName_TV,ReqDate_TV,ReqType_TV,projTitle_TV; + EditText req_msg_ET,Res_msg_ET; + CheckBox generate_doc_cb; + String str_ticketId,str_leadId,str_reqMsg,str_studName,str_collgName,str_projectName,str_mailId,str_reqDate,str_reqType,str_manager_mailID,str_reqHeadId,str_mobNo; + static TextView clickfromdate_tv, clicktodate_tv; + Button close_ticket_btn; + LinearLayout proj_letter_lv1,proj_letter_lv2,proj_letter_lv3,proj_letter_lv4; + + static String yyyyMMdd_fromdate = ""; + static String yyyyMMdd_todate = ""; + + Context context; + + public static final String PrefID_PMID = "prefid_pmid"; // + public static final String PREFBook_PM= "prefbook_pm"; + SharedPreferences shardprefPM_obj; + public String str_MangerID; + + boolean generate_doc=false; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_req_open_detail); + + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + // getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background)); + + + View actionBarView = getSupportActionBar().getCustomView(); + TextView actionBarTV = (TextView) actionBarView.findViewById(R.id.txt_actionBar); + actionBarTV.setText("Request Module"); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); + + ticketNo_TV = (TextView) findViewById(R.id.ticketNo_TV); + lead_id_TV = (TextView) findViewById(R.id.lead_id_TV); + StudName_TV = (TextView) findViewById(R.id.StudName_TV); + MobNo_TV = (TextView) findViewById(R.id.MobNo_TV); + MailId_TV = (TextView) findViewById(R.id.MailId_TV); + CollgName_TV = (TextView) findViewById(R.id.CollgName_TV); + ReqDate_TV = (TextView) findViewById(R.id.ReqDate_TV); + ReqType_TV = (TextView) findViewById(R.id.ReqType_TV); + projTitle_TV = (TextView) findViewById(R.id.projTitle_TV); + + req_msg_ET = (EditText) findViewById(R.id.req_msg_ET); + Res_msg_ET = (EditText)findViewById(R.id.Res_msg_ET); + + clickfromdate_tv=(TextView) findViewById(R.id.clickfromdate_TV); + clicktodate_tv=(TextView) findViewById(R.id.clicktodate_TV); + + generate_doc_cb = (CheckBox) findViewById(R.id.generate_doc_cb); + + close_ticket_btn = (Button) findViewById(R.id.close_ticket_btn); + + proj_letter_lv1 = (LinearLayout) findViewById(R.id.proj_letter_lv1); + proj_letter_lv2 = (LinearLayout) findViewById(R.id.proj_letter_lv2); + proj_letter_lv3 = (LinearLayout) findViewById(R.id.proj_letter_lv3); + proj_letter_lv4 = (LinearLayout) findViewById(R.id.proj_letter_lv4); + + + shardprefPM_obj= getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MangerID = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + + Log.d("str_MangerID:",str_MangerID); + + Intent intent = getIntent(); + str_ticketId = intent.getStringExtra("str_ticketId"); + str_leadId = intent.getStringExtra("str_leadId"); + str_reqMsg = intent.getStringExtra("str_reqMsg"); + str_studName =intent.getStringExtra("str_studName"); + str_collgName =intent.getStringExtra("str_collgName"); + str_projectName =intent.getStringExtra("str_projectName"); + str_mailId =intent.getStringExtra("str_mailId"); + str_manager_mailID =intent.getStringExtra("str_manager_mailID"); + str_reqHeadId =intent.getStringExtra("str_reqHeadId"); + str_mobNo=intent.getStringExtra("str_mobNo"); + str_reqDate=intent.getStringExtra("str_reqDate"); + str_reqType=intent.getStringExtra("str_reqType"); + + ticketNo_TV.setText(str_ticketId); + lead_id_TV.setText(str_leadId); + req_msg_ET.setText(str_reqMsg); + StudName_TV.setText(str_studName); + MobNo_TV.setText(str_mobNo); + MailId_TV.setText(str_mailId); + CollgName_TV.setText(str_collgName); + projTitle_TV.setText(str_projectName); + ReqDate_TV.setText(str_reqDate); + ReqType_TV.setText(str_reqType); + + req_msg_ET.setEnabled(false); + req_msg_ET.setFocusable(false); + // Res_msg_ET.setFocusable(false); + + if(str_reqHeadId.equals("1")){ + proj_letter_lv1.setVisibility(View.VISIBLE); + proj_letter_lv2.setVisibility(View.VISIBLE); + if(generate_doc_cb.isChecked()) + { + // true,do the task + generate_doc=true; + proj_letter_lv3.setVisibility(View.VISIBLE); + proj_letter_lv4.setVisibility(View.VISIBLE); + + }else{ + generate_doc=false; + proj_letter_lv3.setVisibility(View.GONE); + proj_letter_lv4.setVisibility(View.GONE); + } + // proj_letter_lv3.setVisibility(View.VISIBLE); + //proj_letter_lv4.setVisibility(View.VISIBLE); + + } + + clickfromdate_tv.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + DialogFragment fromdateFragment = new DatePickerFragmentFromDate(); + fromdateFragment.show(getFragmentManager(), "Date Picker"); + } + }); + + clicktodate_tv.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + // settodate(); + DialogFragment dFragment = new DatePickerFragment(); + // Show the date picker dialog fragment + dFragment.show(getFragmentManager(), "Date Picker"); + + + } + }); + + generate_doc_cb.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + checkbox_clicked(v); + } + + }); + + close_ticket_btn.setOnClickListener(new View.OnClickListener(){ + + @Override + public void onClick(View v) { + if(checkValidation()) { + SubmitReqData submitReqData = new SubmitReqData(ReqOpenDetailActivity.this); + submitReqData.execute(); + } + } + }); + } + + public void checkbox_clicked(View v) + { + + if(generate_doc_cb.isChecked()) + { + // true,do the task + generate_doc=true; + proj_letter_lv3.setVisibility(View.VISIBLE); + proj_letter_lv4.setVisibility(View.VISIBLE); + + } + else + { + generate_doc=false; + proj_letter_lv3.setVisibility(View.GONE); + proj_letter_lv4.setVisibility(View.GONE); + } + + } + + public class SubmitReqData extends AsyncTask { + + AlertDialog alertDialog; + private ProgressBar progressBar; + + SubmitReqData (Context ctx){ + context = ctx; + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapPrimitive response = SubmitReqData(); + + // SoapObject response = ReApplyProjectDetails(); + Log.d("tag","Soap response="+response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + if(result!=null) { + if (result.toString().equals("Error")) { + Toast.makeText(getApplicationContext(), "Error occured while saving to database", Toast.LENGTH_LONG).show(); + } else { + Toast.makeText(getApplicationContext(), "successfully closed ticket", Toast.LENGTH_LONG).show(); + finish(); + Intent intent = new Intent(ReqOpenDetailActivity.this, PMRequestActivity.class); + startActivity(intent); + } + } + progressBar.setVisibility(View.GONE); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + private SoapPrimitive SubmitReqData() { + String METHOD_NAME = "Update_Manager_CloseTicket"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/Update_Manager_CloseTicket"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + // long projectIds = (long) Integer.valueOf(projectId); + + Log.e("tag","from date:"+clickfromdate_tv.getText().toString()); + Log.e("tag","To date:"+clicktodate_tv.getText().toString()); + + request.addProperty("Ticket_Id",str_ticketId); + request.addProperty("Lead_Id",str_leadId); + request.addProperty("Request_Message",str_reqMsg); + request.addProperty("Response_Message",Res_msg_ET.getText().toString()); + request.addProperty("ManagerId",str_MangerID); + request.addProperty("Head_Id",str_reqHeadId); + request.addProperty("IsDocCreate",generate_doc); + request.addProperty("ValidFromDate",yyyyMMdd_fromdate); + request.addProperty("ValidToDate",yyyyMMdd_todate); + request.addProperty("StudentName",str_studName); + request.addProperty("CollegeName",str_collgName); + request.addProperty("MailId",str_mailId); + request.addProperty("ProjectTitle",str_projectName); + request.addProperty("Manager_Mailid",str_manager_mailID); + Log.d("Requestisxxxxx",request.toString()); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + // Log.d("soap response1xxxx",envelope.getResponse().toString()); + + // SoapObject response = (SoapObject) envelope.getResponse(); + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + Log.e("soap response: ",envelope.getResponse().toString()); + + //return null; + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + } + return null; + + } + + public static class DatePickerFragment extends DialogFragment + implements DatePickerDialog.OnDateSetListener { + + @Override + public Dialog onCreateDialog(Bundle savedInstanceState) { + final Calendar c = Calendar.getInstance(); + int year = c.get(Calendar.YEAR); + int month = c.get(Calendar.MONTH); + int day = c.get(Calendar.DAY_OF_MONTH); + + + /*return new DatePickerDialog(getActivity(),(DatePickerDialog.OnDateSetListener) + getActivity(), year, month, day);*/ + + + DatePickerDialog dialog = new DatePickerDialog(getActivity(), R.style.DatePickerTheme, + this, year, month, day); + + + return dialog; + + + } + + public void onDateSet(DatePicker view, int year, int month, int day) { + Calendar cal = new GregorianCalendar(year, month, day); + setDate(cal); + } + + public void setDate(final Calendar calendar) { + final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM); + //((TextView) findViewById(R.id.showDate)).setText(dateFormat.format(calendar.getTime())); + clicktodate_tv.setText(dateFormat.format(calendar.getTime())); + + SimpleDateFormat mdyFormat = new SimpleDateFormat("yyyy-MM-dd"); //2017-06-22 + + yyyyMMdd_todate = mdyFormat.format(calendar.getTime()); + + // System.out.println("To Date:"+ yyyyMMdd_todate); + + + + } + + } + + + public static class DatePickerFragmentFromDate extends DialogFragment + implements DatePickerDialog.OnDateSetListener { + + @Override + public Dialog onCreateDialog(Bundle savedInstanceState) { + final Calendar c = Calendar.getInstance(); + int year = c.get(Calendar.YEAR); + int month = c.get(Calendar.MONTH); + int day = c.get(Calendar.DAY_OF_MONTH); + + + /*return new DatePickerDialog(getActivity(),(DatePickerDialog.OnDateSetListener) + getActivity(), year, month, day);*/ + + + DatePickerDialog dialog = new DatePickerDialog(getActivity(), R.style.DatePickerTheme, + this, year, month, day); + + + /* dialog.getDatePicker().setMinDate(c.getTimeInMillis()); + dialog.getDatePicker().setMaxDate(c.getTimeInMillis()); +*/ + + /* dialog.getDatePicker().setMinDate(c.getTimeInMillis()); + c.add(Calendar.DAY_OF_MONTH,150); + dialog.getDatePicker().setMaxDate(c.getTimeInMillis()); +*/ + return dialog; + + + } + + public void onDateSet(DatePicker view, int year, int month, int day) { + Calendar cal = new GregorianCalendar(year, month, day); + setDate(cal); + } + + public void setDate(final Calendar calendar) { + final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM); + //((TextView) findViewById(R.id.showDate)).setText(dateFormat.format(calendar.getTime())); + + + clickfromdate_tv.setText(dateFormat.format(calendar.getTime())); + + // SimpleDateFormat mdyFormat = new SimpleDateFormat("MM/dd/yyyy");//2017-06-22 + + SimpleDateFormat mdyFormat = new SimpleDateFormat("yyyy-MM-dd"); + yyyyMMdd_fromdate = mdyFormat.format(calendar.getTime()); + + Calendar c = Calendar.getInstance(); + DateFormat outputFormat = new SimpleDateFormat("dd-MMM-yyyy"); + + clicktodate_tv.setText("Click for Calendar"); + // paternityerror_tv.setVisibility(View.GONE); + + + // System.out.println("From date:"+ yyyyMMdd_fromdate); + } + + } + + public boolean checkValidation() { + Log.e("tag","clickfromdate_tv ="+clickfromdate_tv.getText().toString()); + Log.e("tag","clicktodate_tv ="+clicktodate_tv.getText().toString()); + + boolean validationresult = true; + boolean b_resMes, datevalidationresult1, datevalidationresult2, datevalidationresult3, datevalidationresult4, b_account1, b_account2, b_iifscode1, b_iifscode2; + boolean b_state, b_district, b_city, b_college, b_course, b_sem, b_programid, b_mytalent; + + b_resMes = datevalidationresult1 = datevalidationresult2 = datevalidationresult3 = datevalidationresult4 = true; + b_state = b_district = b_city = b_college = b_course = b_sem = b_programid = b_mytalent = true; + + if (Res_msg_ET.getText().toString().length() == 0 || Res_msg_ET.getText().toString().trim().length() == 0) { + Res_msg_ET.setError("Empty not allowed"); + Res_msg_ET.requestFocus(); + b_resMes = false; + } + + // if (str_reqType.equals("Project Approval Letter")) { + if( generate_doc==true){ + if (clickfromdate_tv.getText().toString().length() == 0 || clicktodate_tv.toString().length() == 0 + || clickfromdate_tv.getText().toString().equalsIgnoreCase("0000-00-00") + || clicktodate_tv.getText().toString().equalsIgnoreCase("0000-00-00")) { + Toast.makeText(getApplicationContext(), "Kindly enter the date", Toast.LENGTH_SHORT).show(); + datevalidationresult1 = false; + } + + if (yyyyMMdd_todate.toString().length() == 0 || yyyyMMdd_todate.equalsIgnoreCase("0000-00-00")) { + clicktodate_tv.setError("Kindly enter the date"); + clicktodate_tv.requestFocus(); + Toast.makeText(getApplicationContext(), "Kindly enter the date", Toast.LENGTH_SHORT).show(); + datevalidationresult3 = false; + } + + if (yyyyMMdd_fromdate.toString().length() == 0 || yyyyMMdd_fromdate.equalsIgnoreCase("0000-00-00")) { + clickfromdate_tv.setError("Kindly enter the date"); + clickfromdate_tv.requestFocus(); + Toast.makeText(getApplicationContext(), "Kindly enter the date", Toast.LENGTH_SHORT).show(); + datevalidationresult4 = false; + + } + + + if ((yyyyMMdd_fromdate.toString().length() != 0) && (yyyyMMdd_todate.toString().length() != 0)) { + /*if(date1.compareTo(date2)<0){ //0 comes when two date are same, + //1 comes when date1 is higher then date2 + //-1 comes when date1 is lower then date2 }*/ + + SimpleDateFormat mdyFormat = new SimpleDateFormat("yyyy-MM-dd"); //2017-06-22 + + try { + Date fromdate = mdyFormat.parse(yyyyMMdd_fromdate); + Date todate = mdyFormat.parse(yyyyMMdd_todate); + + if (fromdate.compareTo(todate) <= 0) { + datevalidationresult2 = true; + } else { + Toast.makeText(getApplicationContext(), "Kindly enter valid date", Toast.LENGTH_SHORT).show(); + datevalidationresult2 = false; + } + + + } catch (ParseException e) { + e.printStackTrace(); + } + }//end of if + + } + return (b_resMes&&datevalidationresult1&&datevalidationresult2&&datevalidationresult3&&datevalidationresult4); + } + + @Override + public void onBackPressed() + { + Intent i = new Intent(this,PMRequestActivity.class); + startActivity(i); + } + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_main, menu); + MenuItem action_editProfile = menu.findItem(R.id.action_editProfile); + action_editProfile.setVisible(false); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + + /* if (id == R.id.action_editProfile) { + Intent itthomeToEditProfile = new Intent(PMComplitionProjectActivity.this ,PMEditProfileActivity.class); + startActivity(itthomeToEditProfile); + return true; + }*/ + + + if (id == R.id.action_logout) { + Intent itthomeToLogin = new Intent(ReqOpenDetailActivity.this ,LoginActivity.class); + startActivity(itthomeToLogin); + return true; + } + + if (id == android.R.id.home) { + Intent ittProjDtlsToHome = new Intent(ReqOpenDetailActivity.this ,PMRequestActivity.class); + startActivity(ittProjDtlsToHome); + return true; + } + + return super.onOptionsItemSelected(item); + } + +} diff --git a/app/src/main/java/com/leadcampusapp/ReqOpenFragment.java b/app/src/main/java/com/leadcampusapp/ReqOpenFragment.java new file mode 100644 index 0000000..e40d3b8 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ReqOpenFragment.java @@ -0,0 +1,376 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 22-06-2018. + */ + +import android.app.AlertDialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.SharedPreferences; +import android.os.AsyncTask; +import android.os.Bundle; +import androidx.fragment.app.Fragment; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ListView; +import android.widget.Toast; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.util.ArrayList; + +//import com.android.sripad.leadnew_22_6_2018.R; + +public class ReqOpenFragment extends Fragment{ + + private ArrayList projList; + private View view; + + public static final String PREFBook_Stud= "prefbook_stud"; //sharedpreference Book + public static final String PrefID_RegID = "prefid_regid"; // + public static final String PrefID_SName = "prefid_sname"; // + public static final String PrefID_PM_SName = "prefid_pmsname"; // + public static final String PrefID_SLeadID = "prefid_sleadid"; // + public static final String PrefID_PM_SEmailID = "prefid_pm_semailid"; // + public static final String PrefID_SCellNo = "prefid_scellno"; // + + private SharedPreferences shardpref_S_obj; + private String str_leadId,str_RegistrationId; + private ProgressDialog progressDialog; + + private ListView lview; + + public static final String PrefID_PMID = "prefid_pmid"; // + public static final String PREFBook_PM= "prefbook_pm"; + SharedPreferences shardprefPM_obj; + public String str_MangerID; + + ReqOpenModule reqOpenModule_item; + ArrayList reqOpenModulesList; + private ReqOpenAdapter adapter_reqopen; + + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + + view = inflater.inflate(R.layout.fragment_req_open, container, false); + + shardpref_S_obj=getActivity().getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + str_leadId = shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + Log.d("str_leadId:",str_leadId); + + shardpref_S_obj.getString(PrefID_RegID, "").trim(); + str_RegistrationId = shardpref_S_obj.getString(PrefID_RegID, "").trim(); + Log.d("str_RegistrationId:",str_RegistrationId); + + shardprefPM_obj= getActivity().getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MangerID = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + + Log.d("str_MangerID:",str_MangerID); + reqOpenModulesList = new ArrayList(); + + lview = (ListView) view.findViewById(R.id.lv_openreq); + + GetReqqOpenlist getReqqOpenlist = new GetReqqOpenlist(getActivity()); + getReqqOpenlist.execute(); + return view; + } + + public class GetReqqOpenlist extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + //private ProgressBar progressBar; + + GetReqqOpenlist (Context ctx){ + context = ctx; + // progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapObject response = getReqqOpenlist(); + + //Log.d("Soap response is",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + /* progressDialog.setMessage("Loading"); + progressDialog.setProgressStyle(android.R.attr.progressBarStyleSmall); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show();*/ + } + + @Override + protected void onPostExecute(SoapObject result1) { + + Log.d("Resultisssss:",result1.toString()); + /* anyType{vmManagerOpenRequest=anyType{Ticket_No=13; Request_Date=26-06-2019 12:54:08 PM; Lead_Id=MH05102; + Student_Name=Madhu Tech; MobileNo=8904674048; RequestHead_Id=4; Project_Id=0; Request_type=Funding; + Request_Message=testing; Request_Priority=High; College_Name=Lalbhai Dalpatbhai ; Status=Success; };*/ + reqOpenModulesList.clear(); + if(result1 != null) { + + SoapPrimitive S_Ticket_No,S_Request_Date, S_Lead_Id, S_Student_Name, S_MobileNo,S_RequestHead_Id,S_Project_Id,S_Request_type,S_Request_Message,S_Request_Priority,S_College_Name,S_Project_Name,S_MailId,S_Prog_MailId,S_Status; + Object O_Ticket_No, O_Request_Date, O_Lead_Id, O_Student_Name, O_MobileNo, O_RequestHead_Id, O_Project_Id, O_Request_type, O_Request_Message, O_Request_Priority,O_College_Name,O_Project_Name,O_MailId,O_Prog_MailId,O_Status; + String str_Ticket_No = null, str_Request_Date = null, str_Lead_Id = null, str_Student_Name = null, str_MobileNo = null, str_RequestHead_Id = null,str_Project_Id = null,str_Request_type = null,str_Request_Message = null,str_Request_Priority = null,str_College_Name = null,str_Project_Name = null,str_MailId = null,str_Prog_MailId= null,str_status = null; + + for (int i = 0; i < result1.getPropertyCount(); i++) { + SoapObject result = (SoapObject) result1.getProperty(i); + + Log.d("soap O_Status list:",result.toString()); + + O_Status = result.getProperty("Status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) result.getProperty("Status"); + Log.d("S_Status:", S_Status.toString()); + str_status = S_Status.toString(); + } + if (str_status.equalsIgnoreCase("Success")) { + O_Ticket_No = result.getProperty("Ticket_No"); + if (!O_Ticket_No.toString().equals("anyType{}") && !O_Ticket_No.toString().equals(null)) { + S_Ticket_No = (SoapPrimitive) result.getProperty("Ticket_No"); + Log.d("S_Ticket_No:", S_Ticket_No.toString()); + str_Ticket_No = S_Ticket_No.toString(); + + //txt_assignedSmall.setText(str_allotedS); + } + + O_Request_Date = result.getProperty("Request_Date"); + if (!O_Request_Date.toString().equals("anyType{}") && !O_Request_Date.toString().equals(null)) { + S_Request_Date = (SoapPrimitive) result.getProperty("Request_Date"); + Log.d("S_AllotedM:", S_Request_Date.toString()); + str_Request_Date = S_Request_Date.toString(); + + //txt_assignedMedium.setText(str_allotedM); + } + + O_Lead_Id = result.getProperty("Lead_Id"); + if (!O_Lead_Id.toString().equals("anyType{}") && !O_Lead_Id.toString().equals(null)) { + S_Lead_Id = (SoapPrimitive) result.getProperty("Lead_Id"); + str_Lead_Id = S_Lead_Id.toString(); + Log.d("S_Lead_Id:", str_Lead_Id); + + //txt_assignedLarge.setText(str_allotedL); + } + + O_Student_Name = result.getProperty("Student_Name"); + if (!O_Student_Name.toString().equals("anyType{}") && !O_Student_Name.toString().equals(null)) { + S_Student_Name = (SoapPrimitive) result.getProperty("Student_Name"); + Log.d("Student_Name", S_Student_Name.toString()); + str_Student_Name = S_Student_Name.toString(); + Log.d("S_Student_Name", str_Student_Name); + + //txt_assignedXL.setText(str_allotedXL); + } + + O_MobileNo = result.getProperty("MobileNo"); + if (!O_MobileNo.toString().equals("anyType{}") && !O_MobileNo.toString().equals(null)) { + S_MobileNo = (SoapPrimitive) result.getProperty("MobileNo"); + Log.d("S_MobileNo", S_MobileNo.toString()); + str_MobileNo = S_MobileNo.toString(); + Log.d("str_allotedXXL", str_MobileNo); + + // txt_assignedXXL.setText(str_allotedXXL); + } + + + O_RequestHead_Id = result.getProperty("RequestHead_Id"); + if (!O_RequestHead_Id.toString().equals("anyType{}") && !O_RequestHead_Id.toString().equals(null)) { + S_RequestHead_Id = (SoapPrimitive) result.getProperty("RequestHead_Id"); + Log.d("S_RequestHead_Id:", S_RequestHead_Id.toString()); + str_RequestHead_Id = S_RequestHead_Id.toString(); + + // txt_balSmall.setText(str_usedS); + } + + O_Project_Id = result.getProperty("Project_Id"); + if (!O_Project_Id.toString().equals("anyType{}") && !O_Project_Id.toString().equals(null)) { + S_Project_Id = (SoapPrimitive) result.getProperty("Project_Id"); + Log.d("S_Project_Id:", S_Project_Id.toString()); + str_Project_Id = S_Project_Id.toString(); + + // txt_balMedium.setText(str_usedM); + } + + O_Request_type = result.getProperty("Request_type"); + if (!O_Request_type.toString().equals("anyType{}") && !O_Request_type.toString().equals(null)) { + S_Request_type = (SoapPrimitive) result.getProperty("Request_type"); + Log.d("S_Request_type:", S_Request_type.toString()); + str_Request_type = S_Request_type.toString(); + + // txt_balLarge.setText(str_usedL); + } + + O_Request_Message = result.getProperty("Request_Message"); + if (!O_Request_Message.toString().equals("anyType{}") && !O_Request_Message.toString().equals(null)) { + S_Request_Message = (SoapPrimitive) result.getProperty("Request_Message"); + Log.d("S_Request_Message:", S_Request_Message.toString()); + str_Request_Message = S_Request_Message.toString(); + } + + O_Request_Priority = result.getProperty("Request_Priority"); + if (!O_Request_Priority.toString().equals("anyType{}") && !O_Request_Priority.toString().equals(null)) { + S_Request_Priority = (SoapPrimitive) result.getProperty("Request_Priority"); + Log.d("O_Request_Priority:", S_Request_Priority.toString()); + str_Request_Priority = S_Request_Priority.toString(); + + } + + O_College_Name = result.getProperty("College_Name"); + if (!O_College_Name.toString().equals("anyType{}") && !O_College_Name.toString().equals(null)) { + S_College_Name = (SoapPrimitive) result.getProperty("College_Name"); + Log.d("O_College_Name:", S_College_Name.toString()); + str_College_Name = S_College_Name.toString(); + + } + + O_Project_Name = result.getProperty("ProjectName"); + if (!O_Project_Name.toString().equals("anyType{}") && !O_Project_Name.toString().equals(null)) { + S_Project_Name = (SoapPrimitive) result.getProperty("ProjectName"); + Log.d("O_Project_Name:", S_Project_Name.toString()); + str_Project_Name = S_Project_Name.toString(); + + } + + O_MailId = result.getProperty("MailId"); + if (!O_MailId.toString().equals("anyType{}") && !O_MailId.toString().equals(null)) { + S_MailId = (SoapPrimitive) result.getProperty("MailId"); + Log.d("O_MailId:", S_MailId.toString()); + str_MailId = S_MailId.toString(); + + } + + O_Prog_MailId = result.getProperty("Manager_MailId"); + if (!O_Prog_MailId.toString().equals("anyType{}") && !O_Prog_MailId.toString().equals(null)) { + S_Prog_MailId = (SoapPrimitive) result.getProperty("Manager_MailId"); + Log.d("O_Prog_MailId:", S_Prog_MailId.toString()); + str_Prog_MailId = S_Prog_MailId.toString(); + + } + + + reqOpenModule_item = new ReqOpenModule(str_Ticket_No, str_Request_Date, str_Lead_Id, str_Student_Name, str_MobileNo, str_RequestHead_Id, str_Project_Id, str_Request_type, str_Request_Message, str_Request_Priority, str_College_Name,str_Project_Name,str_MailId,str_Prog_MailId); + reqOpenModulesList.add(reqOpenModule_item); + + } else { + Toast.makeText(getActivity(), "There is no tshirt", Toast.LENGTH_LONG).show(); + } + } + + + } + + adapter_reqopen = new ReqOpenAdapter(getActivity(), reqOpenModulesList); + lview.setAdapter(adapter_reqopen); + +// progressDialog.dismiss(); + + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapObject getReqqOpenlist() { + String METHOD_NAME = "GetOpenRequest"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetOpenRequest"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + + request.addProperty("ManagerId",str_MangerID); + //users.ad + //request.add + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + Log.d("soapresponse1xxxxFees",envelope.getResponse().toString()); + + + SoapObject response = (SoapObject) envelope.getResponse(); + Log.e("soapresponseyyyyyyyFees",response.toString()); + + //return null; + + return response; + + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + + } +} diff --git a/app/src/main/java/com/leadcampusapp/ReqOpenModule.java b/app/src/main/java/com/leadcampusapp/ReqOpenModule.java new file mode 100644 index 0000000..cfa6a5c --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/ReqOpenModule.java @@ -0,0 +1,183 @@ +package com.leadcampusapp; + +/** + * Created by User on 14-Jun-19. + */ + +public class ReqOpenModule { + private String Ticket_No; + private String Request_Date; + private String Lead_Id; + private String Student_Name; + private String MobileNo; + private String RequestHead_Id; + private String Project_Id; + private String Request_type; + private String Request_Message; + private String Response_Message; + private String Request_Priority; + private String College_Name; + private String Project_Name; + private String MailId; + private String Prog_MailID; + private String Status; + + public ReqOpenModule(String ticket_No, String request_Date, String lead_Id, String student_Name, String mobileNo, String requestHead_Id, String project_Id, String request_type, String request_Message, String request_Priority, String college_Name,String project_Name,String mailId,String prog_MailId) { + Ticket_No = ticket_No; + Request_Date = request_Date; + Lead_Id = lead_Id; + Student_Name = student_Name; + MobileNo = mobileNo; + RequestHead_Id = requestHead_Id; + Project_Id = project_Id; + Request_type = request_type; + Request_Message = request_Message; + Request_Priority = request_Priority; + College_Name = college_Name; + Project_Name = project_Name; + MailId = mailId; + Prog_MailID = prog_MailId; + } + + public String getTicket_No() { + return Ticket_No; + } + + public void setTicket_No(String ticket_No) { + Ticket_No = ticket_No; + } + + public String getRequest_Date() { + return Request_Date; + } + + public void setRequest_Date(String request_Date) { + Request_Date = request_Date; + } + + public String getLead_Id() { + return Lead_Id; + } + + public void setLead_Id(String lead_Id) { + Lead_Id = lead_Id; + } + + public String getStudent_Name() { + return Student_Name; + } + + public void setStudent_Name(String student_Name) { + Student_Name = student_Name; + } + + public String getMobileNo() { + return MobileNo; + } + + public void setMobileNo(String mobileNo) { + MobileNo = mobileNo; + } + + public String getRequestHead_Id() { + return RequestHead_Id; + } + + public void setRequestHead_Id(String requestHead_Id) { + RequestHead_Id = requestHead_Id; + } + + public String getProject_Id() { + return Project_Id; + } + + public void setProject_Id(String project_Id) { + Project_Id = project_Id; + } + + public String getRequest_type() { + return Request_type; + } + + public void setRequest_type(String request_type) { + Request_type = request_type; + } + + public String getRequest_Message() { + return Request_Message; + } + + public void setRequest_Message(String request_Message) { + Request_Message = request_Message; + } + + public String getResponse_Message() { + return Response_Message; + } + + public void setResponse_Message(String response_Message) { + Response_Message = response_Message; + } + + public String getRequest_Priority() { + return Request_Priority; + } + + public void setRequest_Priority(String request_Priority) { + Request_Priority = request_Priority; + } + + public String getCollege_Name() { + return College_Name; + } + + public void setCollege_Name(String college_Name) { + College_Name = college_Name; + } + + public String getStatus() { + return Status; + } + + public void setStatus(String status) { + Status = status; + } + /* string + string + string + string + string + string + string + string + string + string + string + string + string*/ + + + public String getProject_Name() { + return Project_Name; + } + + public void setProject_Name(String project_Name) { + Project_Name = project_Name; + } + + public String getMailId() { + return MailId; + } + + public void setMailId(String mailId) { + MailId = mailId; + } + + public String getProg_MailID() { + return Prog_MailID; + } + + public void setProg_MailID(String prog_MailID) { + Prog_MailID = prog_MailID; + } +} diff --git a/app/src/main/java/com/leadcampusapp/RequestActivity.java b/app/src/main/java/com/leadcampusapp/RequestActivity.java new file mode 100644 index 0000000..1f6856c --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/RequestActivity.java @@ -0,0 +1,213 @@ +package com.leadcampusapp; + +import android.app.AlertDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.graphics.Color; +import android.os.Bundle; +//import android.support.design.widget.TabLayout; +import androidx.viewpager.widget.ViewPager; +import androidx.appcompat.app.AppCompatActivity; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.ImageButton; +import android.widget.TextView; + +import com.google.android.material.tabs.TabLayout; + +//import com.android.sripad.leadnew_22_6_2018.R; + +public class RequestActivity extends AppCompatActivity implements ConnectivityReceiver.ConnectivityReceiverListener{ + + ImageButton img_eventsBack; + + public static final String PREFBook_Stud= "prefbook_stud"; + private SharedPreferences shardpref_S_obj; + public static final String PrefID_Role = "prefid_role"; + public String str_role = null; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_request); + + shardpref_S_obj=RequestActivity.this.getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + shardpref_S_obj.getString(PrefID_Role, "").trim(); + str_role = shardpref_S_obj.getString(PrefID_Role, "").trim(); + + + /* img_eventsBack = (ImageButton) findViewById(R.id.img_eventsBack);*/ + + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + //getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background)); + + View actionBarView = getSupportActionBar().getCustomView(); + TextView actionBarTV = (TextView) actionBarView.findViewById(R.id.txt_actionBar); + actionBarTV.setText("Masters/Ambssadors"); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); + + + View view1; + LayoutInflater inflater1 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view1 = inflater1.inflate(R.layout.pm_masterleadertablayout, null); + + View view2; + LayoutInflater inflater2 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view2 = inflater2.inflate(R.layout.pm_ambassadortablayout, null); + + TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); + tabLayout.addTab(tabLayout.newTab().setCustomView(view1)); + tabLayout.addTab(tabLayout.newTab().setCustomView(view2)); + + TabLayout.Tab selectedTab = tabLayout.getTabAt(0); + View view = selectedTab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.txt_requesttabtitle); + selectedText.setTextColor(Color.parseColor("#000000")); + + + //tabLayout.addTab(tabLayout.newTab().setText("Tab 3")); + //tabLayout.setTabGravity(TabLayout.GRAVITY_FILL); + + final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); + final RequestAdapter adapter = new RequestAdapter(getSupportFragmentManager(), tabLayout.getTabCount()); + viewPager.setAdapter(adapter); + viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); + tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { + @Override + public void onTabSelected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.txt_requesttabtitle); + selectedText.setTextColor(Color.parseColor("#000000")); + viewPager.setCurrentItem(tab.getPosition()); + } + + @Override + public void onTabUnselected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.txt_requesttabtitle); + selectedText.setTextColor(Color.parseColor("#000000")); + } + + @Override + public void onTabReselected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.txt_requesttabtitle); + selectedText.setTextColor(Color.parseColor("#000000")); + } + }); + + /*img_eventsBack.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + finish(); + } + });*/ + } + + @Override + protected void onResume() { + super.onResume(); + + // register connection status listener + MyApplication.getInstance().setConnectivityListener(this); + } + + @Override + public void onNetworkConnectionChanged(boolean isConnected) { + showSnack(isConnected); + } + + private void showSnack(boolean isConnected) { + + if (!isConnected) { + + AlertDialog.Builder adb = new AlertDialog.Builder(RequestActivity.this); + //adb.setView(alertDialogView); + + adb.setTitle("Sorry! Not connected to the internet"); + + adb.setIcon(android.R.drawable.ic_dialog_alert); + + adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + + adb.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + adb.setCancelable(true); + adb.show(); + } + +/* String message; + int color; + if (isConnected) { + message = "Good! Connected to Internet"; + color = Color.WHITE; + } else { + message = "Sorry! Not connected to internet"; + color = Color.RED; + } + + Snackbar snackbar = Snackbar + .make(findViewById(R.id.coordinator_layout), message, Snackbar.LENGTH_LONG); + + View sbView = snackbar.getView(); + TextView textView = (TextView) sbView.findViewById(android.support.design.R.id.snackbar_text); + textView.setTextColor(color); + snackbar.show();*/ + } + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_main, menu); + MenuItem action_editProfile = menu.findItem(R.id.action_editProfile); + action_editProfile.setVisible(false); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + + /* if (id == R.id.action_editProfile) { + Intent ittEventsToEditProfile = new Intent(EventsActivity.this ,EditProfileActivity.class); + startActivity(ittEventsToEditProfile); + return true; + }*/ + + if (id == R.id.action_logout) { + Intent ittEventsToLogin = new Intent(RequestActivity.this ,LoginActivity.class); + startActivity(ittEventsToLogin); + return true; + } + + if (id == android.R.id.home) { + + if(str_role.equals("Student")) { + Intent ittEventsToStudHome = new Intent(RequestActivity.this, HomeActivity.class); + startActivity(ittEventsToStudHome); + }else{ + Intent ittEventsToPMHome = new Intent(RequestActivity.this, PMHomeActivity.class); + startActivity(ittEventsToPMHome); + } + return true; + } + return super.onOptionsItemSelected(item); + } +} diff --git a/app/src/main/java/com/leadcampusapp/RequestAdapter.java b/app/src/main/java/com/leadcampusapp/RequestAdapter.java new file mode 100644 index 0000000..5e719ca --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/RequestAdapter.java @@ -0,0 +1,37 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 22-06-2018. + */ +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentStatePagerAdapter; + +public class RequestAdapter extends FragmentStatePagerAdapter { + int mNumOfTabs; + + public RequestAdapter(FragmentManager fm, int NumOfTabs) { + super(fm); + this.mNumOfTabs = NumOfTabs; + } + + @Override + public Fragment getItem(int position) { + + switch (position) { + case 0: + MasterRequestFragment tab1 = new MasterRequestFragment(); + return tab1; + case 1: + AmbassadorRequestFragment tab2 = new AmbassadorRequestFragment(); + return tab2; + default: + return null; + } + } + + @Override + public int getCount() { + return mNumOfTabs; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/Result.java b/app/src/main/java/com/leadcampusapp/Result.java new file mode 100644 index 0000000..07b3aa7 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Result.java @@ -0,0 +1,46 @@ +package com.leadcampusapp; + +import android.graphics.Bitmap; + +/** + * Created by Shripad on 16-07-2018. + */ + +public class Result { + String studresult=null; + Bitmap studbitmap=null; + String mgrresult=null; + Bitmap mgrbitmap=null; + + public String getStudresult() { + return studresult; + } + + public void setStudresult(String studresult) { + this.studresult = studresult; + } + + public Bitmap getStudbitmap() { + return studbitmap; + } + + public void setStudbitmap(Bitmap studbitmap) { + this.studbitmap = studbitmap; + } + + public String getMgrresult() { + return mgrresult; + } + + public void setMgrresult(String mgrresult) { + this.mgrresult = mgrresult; + } + + public Bitmap getMgrbitmap() { + return mgrbitmap; + } + + public void setMgrbitmap(Bitmap mgrbitmap) { + this.mgrbitmap = mgrbitmap; + } +} diff --git a/app/src/main/java/com/leadcampusapp/SerializeModule.java b/app/src/main/java/com/leadcampusapp/SerializeModule.java new file mode 100644 index 0000000..9daf7bc --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/SerializeModule.java @@ -0,0 +1,64 @@ +package com.leadcampusapp; + +import org.ksoap2.serialization.KvmSerializable; +import org.ksoap2.serialization.PropertyInfo; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Vector; + +/** + * Created by User on 10/16/2018. + */ + +public class SerializeModule extends Vector implements KvmSerializable { + + private String fileName; + private byte[] fileData; + private ArrayList fileInt; + + public ArrayList getFileInt() { + return fileInt; + } + + public void setFileInt(ArrayList fileInt) { + this.fileInt = fileInt; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public byte[] getFileData() { + return fileData; + } + + public void setFileData(byte[] fileData) { + this.fileData = fileData; + } + + @Override + public Object getProperty(int i) { + return null; + } + + @Override + public int getPropertyCount() { + return 0; + } + + @Override + public void setProperty(int i, Object o) { + + } + + @Override + public void getPropertyInfo(int i, Hashtable hashtable, PropertyInfo propertyInfo) { + + } +} diff --git a/app/src/main/java/com/leadcampusapp/SplashActivity.java b/app/src/main/java/com/leadcampusapp/SplashActivity.java new file mode 100644 index 0000000..eadc465 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/SplashActivity.java @@ -0,0 +1,439 @@ +package com.leadcampusapp; + +import android.app.AlertDialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.pm.PackageManager; +import android.graphics.Color; +import android.net.Uri; +import android.os.AsyncTask; +import androidx.appcompat.app.AppCompatActivity; +import android.os.Bundle; +import android.util.Log; +import android.webkit.WebView; +import android.os.Handler; +import android.widget.Toast; + +//import com.android.sripad.leadnew_22_6_2018.R; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +public class SplashActivity extends AppCompatActivity { + + + WebView webview_splashscreen; + Handler handler; + + + + public static final String PREFBook_LoginTrack= "prefbook_logintrack"; //sharedpreference Book + public static final String PrefID_WhereToGo = "prefid_wheretogo"; // + SharedPreferences shardprefLoginTrack_obj; + SharedPreferences.Editor editor_LoginTrack; + String str_wheretogo; + Intent intent = null; + + String Str_status,o_versionresponse,o_versioncode; + float soapprimitive_versionfloat,versionCodes; + int soapprimitive_versionInteger,versionCodes_int; + + + public static final String PREFBook_generalbook= "prefbook_generalbook"; //sharedpreference Book + SharedPreferences shardprefgeneralbook_obj; + SharedPreferences.Editor editor_generalbook; + String str_misscallno; + + Class_InternetDectector internetDectector, internetDectector2; + Boolean isInternetPresent = false; + Class_URL config_obj = new Class_URL(); + + + @Override + protected void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_splash); + webview_splashscreen = (WebView)findViewById(R.id.splashscreen_WEBVIEW); + + + shardprefLoginTrack_obj=getSharedPreferences(PREFBook_LoginTrack, Context.MODE_PRIVATE); + str_wheretogo = shardprefLoginTrack_obj.getString(PrefID_WhereToGo, "").trim(); + Log.e("tag","str_wheretogo="+str_wheretogo); + + + if(str_wheretogo.contains("HomeActivity")){ + str_wheretogo=config_obj.packagename + "Activity_pinlogin"; + Log.e("tag","str_wheretogo="+str_wheretogo); + }else if(str_wheretogo.contains("PMHomeActivity")){ + str_wheretogo=config_obj.packagename + "Activity_pinlogin"; + Log.e("tag","str_wheretogo="+str_wheretogo); + }else if(str_wheretogo.contains("PrincipleHomeActivity")){ + str_wheretogo=config_obj.packagename + "Activity_pinlogin"; + Log.e("tag","str_wheretogo="+str_wheretogo); + } + + shardprefgeneralbook_obj=getSharedPreferences(PREFBook_generalbook, Context.MODE_PRIVATE); + + // if(str_wheretogo!="" || str_wheretogo!=null || !(str_wheretogo.trim().length()==0)) { + + + + + try { + versionCodes = Float.parseFloat(getPackageManager().getPackageInfo(getPackageName(), 0).versionName); + } catch (PackageManager.NameNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + + try { + versionCodes_int = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode; + } catch (PackageManager.NameNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + + // versionCodes_int=555; + // Toast.makeText(getApplicationContext(),"versioncode"+Float.toString(versionCodes),Toast.LENGTH_LONG).show(); + + + + internetDectector = new Class_InternetDectector(getApplicationContext()); + isInternetPresent = internetDectector.isConnectingToInternet(); + + if (isInternetPresent) + { + VersionCheckAsyncCallWS task = new VersionCheckAsyncCallWS(SplashActivity.this); + task.execute(); + } + else + { + Toast.makeText(getApplicationContext(),"No Internet Connected",Toast.LENGTH_LONG).show(); + finish(); + } + + + + + /* if(!(str_wheretogo.trim().length()==0)) + { + // Toast.makeText(getApplicationContext(),"whereToGo:"+str_wheretogo.toString(),Toast.LENGTH_SHORT).show(); + webview_splashscreen.loadUrl("file:///android_asset/lead4_14mb.gif"); + webview_splashscreen.getSettings().setLoadWithOverviewMode(true); + webview_splashscreen.getSettings().setUseWideViewPort(true); + handler = new Handler(); + + handler.postDelayed(new Runnable() { + @Override + public void run() + { + try { + Class classname = Class.forName(str_wheretogo); + Intent intent = new Intent(SplashActivity.this, classname); + startActivity(intent); + finish(); + } catch (ClassNotFoundException ignored) { + } + } + }, 4500); + + + + + } else + { + webview_splashscreen.loadUrl("file:///android_asset/lead4_14mb.gif"); + webview_splashscreen.getSettings().setLoadWithOverviewMode(true); + webview_splashscreen.getSettings().setUseWideViewPort(true); + handler = new Handler(); + handler.postDelayed(new Runnable() { + @Override + public void run() { + Intent intent = new Intent(SplashActivity.this, LoginActivity.class); + startActivity(intent); + finish(); + } + }, 4500); + //},50); + + }*/ + }// end of Oncreate + + + + + + + + private class VersionCheckAsyncCallWS extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + /*dialog.setMessage("Please wait,State Loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); +*/ + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + GetAppReleasedDetails(); // get the App Release Details + return null; + } + + public VersionCheckAsyncCallWS(SplashActivity activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @Override + protected void onPostExecute(Void result) { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + dialog.dismiss(); + + //if(result!=null) { + + if (Str_status.equals("Success")) { + + if (soapprimitive_versionInteger == 555) { + alerts_dialogMaintenance(); + } else { + + + if (versionCodes_int >= soapprimitive_versionInteger) //9>=10 + { + + if (!(str_wheretogo.trim().length() == 0)) + { + // Toast.makeText(getApplicationContext(),"whereToGo:"+str_wheretogo.toString(),Toast.LENGTH_SHORT).show(); + webview_splashscreen.loadUrl("file:///android_asset/lead4_14mb.gif"); + webview_splashscreen.getSettings().setLoadWithOverviewMode(true); + webview_splashscreen.getSettings().setUseWideViewPort(true); + handler = new Handler(); + + handler.postDelayed(new Runnable() { + @Override + public void run() { + try { + Class classname = Class.forName(str_wheretogo); + Intent intent = new Intent(SplashActivity.this, classname); + startActivity(intent); + finish(); + } catch (ClassNotFoundException ignored) { + } + } + }, 4500); + + + } else { + webview_splashscreen.loadUrl("file:///android_asset/lead4_14mb.gif"); + webview_splashscreen.getSettings().setLoadWithOverviewMode(true); + webview_splashscreen.getSettings().setUseWideViewPort(true); + handler = new Handler(); + + handler.postDelayed(new Runnable() { + @Override + public void run() { + Intent intent = new Intent(SplashActivity.this, LoginActivity.class); + startActivity(intent); + finish(); + } + }, 4500); + //},50); + + } + + + } else { + //alerts(); + alerts_dialog(); + } + + + } + } + + //} + + + + + } + + + public void GetAppReleasedDetails() + { + String URL = Class_URL.URL_Login.toString().trim(); + String METHOD_NAME = "GetAppReleasedDetails"; + String Namespace = "http://mis.leadcampus.org/", SOAPACTION = "http://mis.leadcampus.org/GetAppReleasedDetails"; + + try { + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + // request.addProperty("stateid", "0");//long + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + + /*string + string + string*/ + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + // Log.i(TAG, "GetAllLoginDetails is running"); + // result1 = (Vector) envelope.getResponse(); + + // response = (SoapPrimitive) envelope.getResponse(); + + // SoapPrimitive res =(SoapPrimitive)envelope.getResponse(); + + SoapObject response = (SoapObject) envelope.getResponse(); + Log.e("response",response.toString()); + + o_versionresponse = response.getProperty("AppVersion").toString(); + o_versioncode = response.getProperty("versionCode").toString(); + str_misscallno=response.getProperty("MissCallNumber").toString(); + Str_status = response.getProperty("Status").toString(); //Success + + soapprimitive_versionfloat = Float.parseFloat(o_versionresponse); + soapprimitive_versionInteger =Integer.parseInt(o_versioncode); + + + editor_generalbook=shardprefgeneralbook_obj.edit(); + editor_generalbook.putString(PREFBook_generalbook, str_misscallno); + editor_generalbook.commit(); + +//AppVersion + Log.e("version", o_versioncode.toString()); + + + } catch (Throwable t) { + //Toast.makeText(context, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + //internet_issue = "slow internet"; + } + } catch (Throwable t) { + //Toast.makeText(context, "UnRegister Receiver Error " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("UnRegister Error", "> " + t.getMessage()); + } + + + } + } + + + + + + + + + + public void alerts_dialog() + { + + AlertDialog.Builder dialog = new AlertDialog.Builder(SplashActivity.this); + dialog.setCancelable(false); + dialog.setTitle("LEADCampus"); + dialog.setMessage("Kindly update from playstore"); + + dialog.setPositiveButton("Update", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) + { + Intent intent = new Intent(android.content.Intent.ACTION_VIEW); + intent.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.leadcampusapp")); + startActivity(intent); + } + }); + + + final AlertDialog alert = dialog.create(); + alert.setOnShowListener( new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface arg0) { + alert.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#004D40")); + } + }); + alert.show(); + + } + + + + + public void alerts_dialogMaintenance() + { + + AlertDialog.Builder dialog = new AlertDialog.Builder(SplashActivity.this); + dialog.setCancelable(false); + dialog.setTitle("LEADCampus"); + dialog.setMessage("Sorry for inconvenience LEADCampus is under maintenance!"); + dialog.setPositiveButton("OK", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) + { + finish(); + } + }); + + + final AlertDialog alert = dialog.create(); + alert.setOnShowListener( new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface arg0) { + alert.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(Color.parseColor("#004D40")); + } + }); + alert.show(); + + + } + + + + + + + + + + + + + + + +}//end of class diff --git a/app/src/main/java/com/leadcampusapp/StoryBlogActivity.java b/app/src/main/java/com/leadcampusapp/StoryBlogActivity.java new file mode 100644 index 0000000..2c8e48a --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/StoryBlogActivity.java @@ -0,0 +1,92 @@ +package com.leadcampusapp; + +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.content.Intent; +import androidx.appcompat.app.AppCompatActivity; +import android.os.Bundle; +import android.util.Log; +import android.webkit.WebSettings; +import android.webkit.WebView; + +//import com.android.sripad.leadnew_22_6_2018.R; + +public class StoryBlogActivity extends AppCompatActivity implements ConnectivityReceiver.ConnectivityReceiverListener{ + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_story_blog); + + WebView webView = (WebView) findViewById(R.id.webview_story); + + Intent intent = getIntent(); + String Story_Blog = intent.getStringExtra("Story_Blog"); + + Log.i("tag","Story_Blog="+Story_Blog); + WebSettings webSettings = webView.getSettings(); + webSettings.setJavaScriptEnabled(true); + + webView.loadUrl(Story_Blog); + } + + @Override + protected void onResume() { + super.onResume(); + + // register connection status listener + MyApplication.getInstance().setConnectivityListener(this); + } + + @Override + public void onNetworkConnectionChanged(boolean isConnected) { + showSnack(isConnected); + } + + private void showSnack(boolean isConnected) { + + if (!isConnected) { + + AlertDialog.Builder adb = new AlertDialog.Builder(StoryBlogActivity.this); + //adb.setView(alertDialogView); + + adb.setTitle("Sorry! Not connected to the internet"); + + adb.setIcon(android.R.drawable.ic_dialog_alert); + + adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + + adb.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + adb.setCancelable(true); + adb.show(); + } + +/* String message; + int color; + if (isConnected) { + message = "Good! Connected to Internet"; + color = Color.WHITE; + } else { + message = "Sorry! Not connected to internet"; + color = Color.RED; + } + + Snackbar snackbar = Snackbar + .make(findViewById(R.id.coordinator_layout), message, Snackbar.LENGTH_LONG); + + View sbView = snackbar.getView(); + TextView textView = (TextView) sbView.findViewById(android.support.design.R.id.snackbar_text); + textView.setTextColor(color); + snackbar.show();*/ + } +} diff --git a/app/src/main/java/com/leadcampusapp/StudReqProject_TitleClass.java b/app/src/main/java/com/leadcampusapp/StudReqProject_TitleClass.java new file mode 100644 index 0000000..c667bb0 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/StudReqProject_TitleClass.java @@ -0,0 +1,49 @@ +package com.leadcampusapp; + +public class StudReqProject_TitleClass { + + int ID; + String pdid; + String proTitle; + String proStatus; + + public StudReqProject_TitleClass(){ + + } + public StudReqProject_TitleClass(int ID, String pdid, String proTitle, String proStatus) { + this.ID = ID; + this.pdid = pdid; + this.proTitle = proTitle; + this.proStatus = proStatus; + } + + public StudReqProject_TitleClass(String pdid, String proTitle, String proStatus) { + this.pdid = pdid; + this.proTitle = proTitle; + this.proStatus = proStatus; + } + + public String getPdid() { + return pdid; + } + + public void setPdid(String pdid) { + this.pdid = pdid; + } + + public String getProTitle() { + return proTitle; + } + + public void setProTitle(String proTitle) { + this.proTitle = proTitle; + } + + public String getProStatus() { + return proStatus; + } + + public void setProStatus(String proStatus) { + this.proStatus = proStatus; + } +} diff --git a/app/src/main/java/com/leadcampusapp/StudentApplyRequest_fragment.java b/app/src/main/java/com/leadcampusapp/StudentApplyRequest_fragment.java new file mode 100644 index 0000000..51a1d8a --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/StudentApplyRequest_fragment.java @@ -0,0 +1,692 @@ +package com.leadcampusapp; + +import android.app.ProgressDialog; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.AsyncTask; +import android.os.Bundle; +import androidx.fragment.app.Fragment; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.EditText; +import android.widget.ScrollView; +import android.widget.Spinner; +import android.widget.TextView; +import android.widget.Toast; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.util.ArrayList; + + +public class StudentApplyRequest_fragment extends Fragment { + + + private ScrollView lLayoutFrgEmpresas; + Context context; + Spinner requesttype_sp, priority_sp, projectTitle_sp; + EditText msg_et; + Button go_bt; + String[] priority_spinnerdropdown = {"Select","Low", "Medium", "High"}; + String str_RequestStatus, selected_requestType, selected_requestStatus; + int requestcount, requestcount_projectTitle; + StudentRequestClass[] array_requestclasses; + StudentRequestClass obj_requestclass; + ArrayList arrayList_reqName = new ArrayList(); + ArrayList arrayList_reqId = new ArrayList(); + ArrayList arrayList_reqStatus = new ArrayList(); + ArrayList arrayList_reqClass; + + ArrayList arrayList_reqClass2; + String reqid, reqtype, reqstatus, selected_requestTypeID = ""; + + //ProjectTitle + StudReqProject_TitleClass project_titleClass; + StudReqProject_TitleClass[] ProjecTitlearray; + ArrayList arrayList_proTitleClass; + ArrayList arrayList_protitle = new ArrayList(); + ArrayList arrayList_proId = new ArrayList(); + ArrayList arrayList_proStatus = new ArrayList(); + String selected_priority="",internet_issue = "empty",str_pdid, str_protitle, str_prostatus, selected_protitle, selected_prodid; + TextView projectTitleLabel_tv; + + Class_InternetDectector internetDectector; + Boolean isInternetPresent = false; + SoapPrimitive response_submit; + + + public static final String PREFBook_Stud= "prefbook_stud"; //sharedpreference Book + public static final String PrefID_RegID = "prefid_regid"; // + public static final String PrefID_SName = "prefid_sname"; // + public static final String PrefID_PM_SName = "prefid_pmsname"; // + public static final String PrefID_SLeadID = "prefid_sleadid"; // + public static final String PrefID_PM_SEmailID = "prefid_pm_semailid"; // + public static final String PrefID_SCellNo = "prefid_scellno"; // + + private SharedPreferences shardpref_S_obj; + + private String str_leadId,str_RegistrationId; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) + { + + lLayoutFrgEmpresas = (ScrollView) inflater.inflate(R.layout.fragment_applyrequest, container, false); + + context = lLayoutFrgEmpresas.getContext(); + arrayList_reqClass = new ArrayList(); + arrayList_proTitleClass = new ArrayList(); + requesttype_sp = (Spinner) lLayoutFrgEmpresas.findViewById(R.id.requesttype_SP); + priority_sp = (Spinner) lLayoutFrgEmpresas.findViewById(R.id.priority_SP); + projectTitle_sp = (Spinner) lLayoutFrgEmpresas.findViewById(R.id.projectTitle_SP); + msg_et = (EditText) lLayoutFrgEmpresas.findViewById(R.id.msg_ET); + go_bt = (Button) lLayoutFrgEmpresas.findViewById(R.id.go_BT); + projectTitleLabel_tv = (TextView) lLayoutFrgEmpresas.findViewById(R.id.projectTitleLabel_TV); + + shardpref_S_obj=getActivity().getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + str_leadId = shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + + internetDectector = new Class_InternetDectector(getActivity()); + isInternetPresent = internetDectector.isConnectingToInternet(); + + if (isInternetPresent) { + Requestdropdown_AsyncTask task1 = new Requestdropdown_AsyncTask(context); + task1.execute(); + } else { + Toast.makeText(getActivity(), "No internet", Toast.LENGTH_LONG).show(); + } + + ArrayAdapter priority_adapter = new ArrayAdapter(getActivity().getBaseContext(), R.layout.simple_spinner_item, priority_spinnerdropdown); + priority_adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + priority_sp.setAdapter(priority_adapter); + + priority_sp.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView parent, View view, int position, long id) { + selected_priority = priority_sp.getSelectedItem().toString(); + Log.i("selected_priority", " : " + selected_priority); + + } + + @Override + public void onNothingSelected(AdapterView parent) { + + } + }); + requesttype_sp.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() + { + + @Override + public void onItemSelected(AdapterView parent, View view, + int position, long id) + { + // TODO Auto-generated method stub + + + selected_requestType = requesttype_sp.getSelectedItem().toString(); + + // selected_requestTypeID = arrayList_reqClass.get(position).getRequestid(); + + selected_requestTypeID = arrayList_reqId.get(position); + + + + Log.i("selected_requestType", " : " + selected_requestType); + Log.i("selected_requestTypeID", " : " + selected_requestTypeID); + + if (selected_requestTypeID.equals("") || selected_requestTypeID.equals("null")) + { + System.out.println("selected_requestTypeID..null.." + selected_requestTypeID); + + } else { + if (selected_requestTypeID.equals("1")) + { + System.out.println("Entered selected_requestTypeID=1"); + projectTitle_sp.setVisibility(View.VISIBLE); + projectTitleLabel_tv.setVisibility(View.VISIBLE); + } else { + projectTitle_sp.setVisibility(View.GONE); + projectTitleLabel_tv.setVisibility(View.GONE); + } + } + + + } + + @Override + public void onNothingSelected(AdapterView parent) { + // TODO Auto-generated method stub + + } + }); + + + projectTitle_sp.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + @Override + public void onItemSelected(AdapterView parent, View view, + int position, long id) { + // TODO Auto-generated method stub + + + + selected_protitle = projectTitle_sp.getSelectedItem().toString(); + selected_prodid = arrayList_proTitleClass.get(position).getPdid(); + + + + Log.i("selected_protitle", " : " + selected_protitle); + Log.i("selected_prodid", " : " + selected_prodid); + + + } + + @Override + public void onNothingSelected(AdapterView parent) { + // TODO Auto-generated method stub + + } + }); + + + go_bt.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + + selected_priority = priority_sp.getSelectedItem().toString(); + selected_requestType = requesttype_sp.getSelectedItem().toString(); + + if (Validation()) { + + internetDectector = new Class_InternetDectector(getActivity()); + isInternetPresent = internetDectector.isConnectingToInternet(); + + if (isInternetPresent) { + AsyncCall_submit task = new AsyncCall_submit(context); + task.execute(); + } else { + Toast.makeText(getActivity(), "No internet", Toast.LENGTH_LONG).show(); + } + + } + } + }); + return lLayoutFrgEmpresas; + + + } + + + private class Requestdropdown_AsyncTask extends AsyncTask { + ProgressDialog dialog; + + Context context; + + @Override + protected void onPreExecute() { + Log.i("TAG", "onPreExecute---tab2"); + dialog.setMessage("Please wait.."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + + } + + @Override + protected void onProgressUpdate(Void... values) { + Log.i("", "onProgressUpdate---tab2"); + } + + public Requestdropdown_AsyncTask(Context context1) { + context = context1; + dialog = new ProgressDialog(context1); + } + + @Override + protected Void doInBackground(String... params) { + Log.i("TAG", "doInBackground---tab5"); + + RequestSummary(); + + + return null; + } + + @Override + protected void onPostExecute(Void result) { + Log.i("TAG", "onPostExecute---tab5"); + + if (dialog.isShowing()) { + dialog.dismiss(); + + + if (requestcount <= 0) + { + Toast.makeText(context, "No Request Types", Toast.LENGTH_SHORT).show(); + } else + { + System.out.println("selected_requestTypeID..null.." + selected_requestTypeID); + + Log.e("tag", "arrayList_reqClass.size: " + arrayList_reqClass.size()); + + + + + + + + + for (int k = 0; k < arrayList_reqClass.size(); k++) + { + if(k==0) + { + arrayList_reqId.add("-1"); + arrayList_reqName.add("Select"); + arrayList_reqStatus.add("Sucess"); + + arrayList_reqId.add(array_requestclasses[k].requestid); + arrayList_reqName.add(array_requestclasses[k].requestname); + arrayList_reqStatus.add(array_requestclasses[k].requeststatus); + + } + else { + arrayList_reqId.add(array_requestclasses[k].requestid); + arrayList_reqName.add(array_requestclasses[k].requestname); + arrayList_reqStatus.add(array_requestclasses[k].requeststatus); + + Log.e("tag", "arrayList_reqClass=" + arrayList_reqClass.get(k).getRequestname()); + + } + + + + + } + ArrayAdapter dataAdapter = new ArrayAdapter(context, R.layout.simple_spinner_item, arrayList_reqName); + dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + requesttype_sp.setAdapter(dataAdapter); + + + if (requestcount_projectTitle > 0) + { + + // projectTitle_sp.setVisibility(View.VISIBLE); + for (int k = 0; k < arrayList_proTitleClass.size(); k++) { + arrayList_proId.add(ProjecTitlearray[k].pdid); + arrayList_protitle.add(ProjecTitlearray[k].proTitle); + arrayList_proStatus.add(ProjecTitlearray[k].proStatus); + Log.e("tag", "arrayList_proTitleClass=" + arrayList_proTitleClass.get(k).getProTitle()); + + } + ArrayAdapter dataAdapter1 = new ArrayAdapter(context, R.layout.simple_spinner_item, arrayList_protitle); + dataAdapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + projectTitle_sp.setAdapter(dataAdapter1); + + } + } + } + + +// if (requestcount <= 0) { +// Toast.makeText(context, "No Request Types", Toast.LENGTH_SHORT).show(); +// } else { +// +// if(selected_requestTypeID.equals("") || selected_requestTypeID.equals("null")) { +// System.out.println("selected_requestTypeID..null.." + selected_requestTypeID); +// +// Log.e("tag", "arrayList_reqClass.size" + arrayList_reqClass.size()); +// +// for (int k = 0; k < arrayList_reqClass.size(); k++) { +// arrayList_reqId.add(array_requestclasses[k].requestid); +// arrayList_reqName.add(array_requestclasses[k].requestname); +// arrayList_reqStatus.add(array_requestclasses[k].requeststatus); +// Log.e("tag", "arrayList_reqClass=" + arrayList_reqClass.get(k).getRequestname()); +// +// } +// ArrayAdapter dataAdapter = new ArrayAdapter(context, R.layout.simple_spinner_item, arrayList_reqName); +// dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); +// request_sp.setAdapter(dataAdapter); +// +// +// }else { +// System.out.println("selected_requestTypeID.." + selected_requestTypeID + requestcount_projectTitle); +// if (selected_requestTypeID.equals("1")) { +// if (requestcount_projectTitle>0) { +// +// // projectTitle_sp.setVisibility(View.VISIBLE); +// for (int k = 0; k < arrayList_proTitleClass.size(); k++) { +// arrayList_proId.add(ProjecTitlearray[k].pdid); +// arrayList_protitle.add(ProjecTitlearray[k].proTitle); +// arrayList_proStatus.add(ProjecTitlearray[k].proStatus); +// Log.e("tag", "arrayList_proTitleClass=" + arrayList_proTitleClass.get(k).getProTitle()); +// +// } +// ArrayAdapter dataAdapter1 = new ArrayAdapter(context, R.layout.simple_spinner_item, arrayList_protitle); +// dataAdapter1.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); +// projectTitle_sp.setAdapter(dataAdapter1); +// +// } +// } +// +// +// +// } +// } +// + + + } + + }//End + + public void RequestSummary() { + + + String URL = Class_URL.URL_Projects.toString(); + String METHOD_NAME = "Get_Student_Request_Head"; + String Namespace = "http://mis.leadcampus.org/", SOAPACTION = "http://mis.leadcampus.org/Get_Student_Request_Head"; + + + try { + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + request.addProperty("Lead_Id", str_leadId);//MH05102,MH08103 + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + + SoapObject response = (SoapObject) envelope.getResponse(); + Log.i("resp ", response.toString()); + + SoapObject soapObjectReqHead = (SoapObject) response.getProperty("RequestHead"); + Log.e("soapobj", soapObjectReqHead.toString()); + + requestcount = soapObjectReqHead.getPropertyCount(); + System.out.println("soapObjectReqHead.getPropertyCount().." + soapObjectReqHead.getPropertyCount()); + + if (requestcount > 0) + { + array_requestclasses = new StudentRequestClass[requestcount]; + + + arrayList_reqClass.clear(); + + + + for (int j = 0; j < soapObjectReqHead.getPropertyCount(); j++) + { + SoapObject soapObject = (SoapObject) soapObjectReqHead.getProperty(j); + Log.e("soapobj iner", soapObject.toString()); + + StudentRequestClass inner_requestSummaryobject = new StudentRequestClass(); + inner_requestSummaryobject.setRequestid(soapObject.getProperty("slno").toString()); + inner_requestSummaryobject.setRequestname(soapObject.getProperty("Head_Name").toString()); + inner_requestSummaryobject.setRequeststatus(soapObject.getProperty("Status").toString()); + + array_requestclasses[j] = inner_requestSummaryobject; + + reqid = soapObject.getProperty("slno").toString(); + reqtype = soapObject.getProperty("Head_Name").toString(); + reqstatus = soapObject.getProperty("Status").toString(); + + Log.e("tag", "reqid==" + reqid + reqtype + reqstatus); + Log.e("class", array_requestclasses[j].getRequestid().toString()); + + obj_requestclass = new StudentRequestClass(reqid, reqtype, reqstatus); + + arrayList_reqClass.add(obj_requestclass); + + System.out.println("arrayList_reqClass..inside forloop." + arrayList_reqClass.get(j)); + + } + //Log.e("arrayList_reqClass", arrayList_reqClass.toString()); + + Log.e("array size", String.valueOf(arrayList_reqClass.size())); + + } + + //*--------------------------------------------------// + // ProjectTitle + SoapObject soapObjectProjectTitle = (SoapObject) response.getProperty("Projects"); + Log.e("soapObjectProjectTitle", soapObjectProjectTitle.toString()); + + requestcount_projectTitle = soapObjectProjectTitle.getPropertyCount(); + System.out.println("soapObjectProjectTitle.getPropertyCount().." + soapObjectProjectTitle.getPropertyCount()); + + + if (requestcount_projectTitle > 0) { + ProjecTitlearray = new StudReqProject_TitleClass[requestcount_projectTitle]; + + for (int j = 0; j < soapObjectProjectTitle.getPropertyCount(); j++) { + SoapObject soapObject = (SoapObject) soapObjectProjectTitle.getProperty(j); + Log.e("soapobj iner1", soapObject.toString()); + StudReqProject_TitleClass inner_requestSummaryobject = new StudReqProject_TitleClass(); + inner_requestSummaryobject.setPdid(soapObject.getProperty("PDID").toString()); + inner_requestSummaryobject.setProTitle(soapObject.getProperty("ProjectTitle").toString()); + inner_requestSummaryobject.setProStatus(soapObject.getProperty("Status").toString()); + ProjecTitlearray[j] = inner_requestSummaryobject; + + str_pdid = soapObject.getProperty("PDID").toString(); + str_protitle = soapObject.getProperty("ProjectTitle").toString(); + str_prostatus = soapObject.getProperty("Status").toString(); + Log.e("tag", "str_pdid==" + str_pdid + str_protitle + str_prostatus); + Log.e("class", ProjecTitlearray[j].getPdid().toString()); + project_titleClass = new StudReqProject_TitleClass(str_pdid, str_protitle, str_prostatus); + arrayList_proTitleClass.add(project_titleClass); + System.out.println("arrayList_proTitleClass..inside forloop." + arrayList_proTitleClass.get(j)); + + } + + + } + } catch (Throwable t) { + + Log.e("request fail", "> " + t.getMessage()); + //str_RequestStatus = t.getMessage().toString(); + } + } catch (Throwable t) { + Log.e("UnRegister Error", "> " + t.getMessage()); + // str_RequestStatus = t.getMessage().toString(); + + } + + } + + + // Submit Async request + private class AsyncCall_submit extends AsyncTask { + + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + + dialog.setMessage("Please wait.."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + + } + + @Override + protected void onProgressUpdate(Void... values) { + + } + + @Override + protected Void doInBackground(String... params) { + Log.i("DF", "doInBackground"); + + + + applyRequest(); + + + return null; + } + + public AsyncCall_submit(Context context1) { + context = context1; + dialog = new ProgressDialog(context1); + } + + @Override + protected void onPostExecute(Void result) { + if (dialog.isShowing()) { + dialog.dismiss(); + System.out.println("response_submit.."+response_submit); + if (response_submit.toString().equals("success")) { + + Toast.makeText(context, "Applied", Toast.LENGTH_LONG).show(); + + Intent i=new Intent(getActivity(),StudentRequest.class); + i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); + startActivity(i); + }else{ + Toast.makeText(context, " "+response_submit.toString(), Toast.LENGTH_LONG).show(); + + } + } + + } + }// End of AsyncCall_submit + + + + public void applyRequest() { + + String URL = Class_URL.URL_Projects.toString(); + String METHOD_NAME = "Student_Submit_Request_ToManager"; + String Namespace = "http://mis.leadcampus.org/", SOAPACTION = "http://mis.leadcampus.org/Student_Submit_Request_ToManager"; + + try { + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + + + if (selected_requestTypeID.equals("") || selected_requestTypeID.equals("null")) { + System.out.println("selected_requestTypeID..null.." + selected_requestTypeID); + + } else { + System.out.println("selected_requestTypeID...." + selected_requestTypeID); + + if(selected_requestTypeID.equals("1")) { + + request.addProperty("Lead_Id", str_leadId); + request.addProperty("Request_type",selected_requestTypeID); + request.addProperty("Priority",selected_priority); + request.addProperty("PDID",selected_prodid); + request.addProperty("Request_message",msg_et.getText().toString()); + request.addProperty("RequestedId", ""); + }else{ + request.addProperty("Lead_Id", str_leadId); + request.addProperty("Request_type",selected_requestTypeID); + request.addProperty("Priority",selected_priority); + request.addProperty("PDID",""); + request.addProperty("Request_message", msg_et.getText().toString()); + request.addProperty("RequestedId",""); + } + } + + Log.i("string value request", request.toString()); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + response_submit = (SoapPrimitive) envelope.getResponse(); + Log.i("string value atsponse", response_submit.toString()); + + } catch (Throwable t) { + + Log.e("request fail", "> " + t.getMessage()); + internet_issue = "slow internet"; + } + } catch (Throwable t) { + + Log.e("UnRegister Recei Error", "> " + t.getMessage()); + + } + + }//End + + + + public boolean Validation() + { + boolean b_validationmessage1, b_validationmessage2,b_validation_priorityspinner,b_validation_requesttypespinner; + + b_validationmessage1=b_validationmessage2=b_validation_priorityspinner=b_validation_requesttypespinner=true; + + + if (msg_et.getText().toString().length()== 0) + { + msg_et.setError("Empty not allowed!"); + msg_et.requestFocus(); + b_validationmessage1 = false; + } + + if(msg_et.getText().toString().length()<=5) + { + msg_et.setError("Minimum character is 10"); + msg_et.requestFocus(); + b_validationmessage2 = false; + } + + + + if(priority_sp.getSelectedItem().toString().equalsIgnoreCase("Select")) + { + Toast.makeText(getActivity(), "Select the Priority", Toast.LENGTH_LONG).show(); + b_validation_priorityspinner=false; + } + + + if( requesttype_sp.getSelectedItem().toString().equalsIgnoreCase("Select")) + { + + Toast.makeText(getActivity(), "Select the RequestType", Toast.LENGTH_LONG).show(); + b_validation_requesttypespinner=false; + } + + //vijay + + + if (b_validationmessage1&&b_validationmessage2&&b_validation_priorityspinner + &&b_validation_requesttypespinner) { + return true; + } else { + return false; + } + + }//end of validation + + + +} diff --git a/app/src/main/java/com/leadcampusapp/StudentCompletedProject_Activity.java b/app/src/main/java/com/leadcampusapp/StudentCompletedProject_Activity.java new file mode 100644 index 0000000..d5080b5 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/StudentCompletedProject_Activity.java @@ -0,0 +1,21 @@ +package com.leadcampusapp; + +import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; + +public class StudentCompletedProject_Activity extends AppCompatActivity { + + + @Override + protected void onCreate(Bundle savedInstanceState) { + + + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_edit_project); + + + + } + + +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/StudentPMImageBitmap.java b/app/src/main/java/com/leadcampusapp/StudentPMImageBitmap.java new file mode 100644 index 0000000..4f0379d --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/StudentPMImageBitmap.java @@ -0,0 +1,47 @@ +package com.leadcampusapp; + +import android.graphics.Bitmap; + +/** + * Created by Shripad on 26-07-2018. + */ + +public class StudentPMImageBitmap { + public static Bitmap studBitmap; + public static Bitmap pmBitmap; + + public static byte[] studByteArray; + public static byte[] pmByteArray; + + public static byte[] getStudByteArray() { + return studByteArray; + } + + public static void setStudByteArray(byte[] studByteArray) { + StudentPMImageBitmap.studByteArray = studByteArray; + } + + public static byte[] getPmByteArray() { + return pmByteArray; + } + + public static void setPmByteArray(byte[] pmByteArray) { + StudentPMImageBitmap.pmByteArray = pmByteArray; + } + + public static Bitmap getStudBitmap() { + return studBitmap; + } + + public static void setStudBitmap(Bitmap studBitmap) { + StudentPMImageBitmap.studBitmap = studBitmap; + } + + public static Bitmap getPmBitmap() { + return pmBitmap; + } + + public static void setPmBitmap(Bitmap pmBitmap) { + StudentPMImageBitmap.pmBitmap = pmBitmap; + } +} diff --git a/app/src/main/java/com/leadcampusapp/StudentRequest.java b/app/src/main/java/com/leadcampusapp/StudentRequest.java new file mode 100644 index 0000000..1f7cb8a --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/StudentRequest.java @@ -0,0 +1,149 @@ +package com.leadcampusapp; + + +import android.content.Intent; +import android.graphics.Color; +import android.graphics.drawable.ColorDrawable; +import android.os.Bundle; +//import android.support.design.widget.TabLayout; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentPagerAdapter; +import androidx.viewpager.widget.ViewPager; +import androidx.appcompat.app.AppCompatActivity; +import android.view.Menu; +import android.view.MenuItem; + +import com.google.android.material.tabs.TabLayout; + +public class StudentRequest extends AppCompatActivity { + TabLayout tablayout_compoff; + + + + public final static String COLOR = "#3F51B5"; + + // Titles of the individual pages (displayed in tabs) + private final String[] PAGE_TITLES = new String[]{ + "APPLY REQUEST", + "HISTORY" + }; + + // The fragments that are used as the individual pages + private final Fragment[] PAGES = new Fragment[]{ + new StudentApplyRequest_fragment(), + new Student_history() + }; + + + // The ViewPager is responsible for sliding pages (fragments) in and out upon user input + private ViewPager mViewPager; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.student_request); + + mViewPager = (ViewPager) findViewById(R.id.compoff_viewpager); + mViewPager.setAdapter(new MyPagerAdapter(getSupportFragmentManager())); + + + tablayout_compoff = (TabLayout) findViewById(R.id.compoff_tablayout); + tablayout_compoff.setupWithViewPager(mViewPager); + + getSupportActionBar().setBackgroundDrawable( + new ColorDrawable(Color.parseColor(COLOR))); + + getSupportActionBar().setDisplayUseLogoEnabled(false); + getSupportActionBar().setDisplayShowHomeEnabled(true); + getSupportActionBar().setHomeButtonEnabled(true); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowTitleEnabled(true); + // getSupportActionBar().setHomeAsUpIndicator( + // R.drawable.lef); + + }// end of Oncreate + + + public class MyPagerAdapter extends FragmentPagerAdapter { + + public MyPagerAdapter(FragmentManager fragmentManager) { + super(fragmentManager); + } + + + @Override + public Fragment getItem(int position) { + + switch (position) { + case 0: + + return new StudentApplyRequest_fragment(); + case 1: + + return new Student_history(); + + } + return null; + } + + @Override + public int getCount() { + return PAGES.length; + } + + @Override + public CharSequence getPageTitle(int position) { + + + return PAGE_TITLES[position]; + } + + }// end of MyPagerAdapter + + + @Override + public void onBackPressed() + { + Intent i = new Intent(this,HomeActivity.class); + startActivity(i); + } + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_main, menu); + MenuItem action_editProfile = menu.findItem(R.id.action_editProfile); + action_editProfile.setVisible(false); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + + /* if (id == R.id.action_editProfile) { + Intent itthomeToEditProfile = new Intent(PMComplitionProjectActivity.this ,PMEditProfileActivity.class); + startActivity(itthomeToEditProfile); + return true; + }*/ + + + if (id == R.id.action_logout) { + Intent itthomeToLogin = new Intent(StudentRequest.this ,LoginActivity.class); + startActivity(itthomeToLogin); + return true; + } + + if (id == android.R.id.home) { + Intent ittProjDtlsToHome = new Intent(StudentRequest.this ,HomeActivity.class); + startActivity(ittProjDtlsToHome); + return true; + } + + return super.onOptionsItemSelected(item); + } + + + + +} diff --git a/app/src/main/java/com/leadcampusapp/StudentRequestClass.java b/app/src/main/java/com/leadcampusapp/StudentRequestClass.java new file mode 100644 index 0000000..da749e9 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/StudentRequestClass.java @@ -0,0 +1,49 @@ +package com.leadcampusapp; + +public class StudentRequestClass { + int id; + String requestid; + String requestname; + String requeststatus; + + public StudentRequestClass(){ + + } + + public StudentRequestClass(int id, String requestid, String requestname, String requeststatus) { + this.id = id; + this.requestid = requestid; + this.requestname = requestname; + this.requeststatus = requeststatus; + } + + public StudentRequestClass(String requestid, String requestname, String requeststatus) { + this.requestid = requestid; + this.requestname = requestname; + this.requeststatus = requeststatus; + } + + public String getRequestid() { + return requestid; + } + + public void setRequestid(String requestid) { + this.requestid = requestid; + } + + public String getRequestname() { + return requestname; + } + + public void setRequestname(String requestname) { + this.requestname = requestname; + } + + public String getRequeststatus() { + return requeststatus; + } + + public void setRequeststatus(String requeststatus) { + this.requeststatus = requeststatus; + } +} diff --git a/app/src/main/java/com/leadcampusapp/StudentRequestHisoryDetails.java b/app/src/main/java/com/leadcampusapp/StudentRequestHisoryDetails.java new file mode 100644 index 0000000..c97aa15 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/StudentRequestHisoryDetails.java @@ -0,0 +1,144 @@ +package com.leadcampusapp; + +class StudentRequestHisoryDetails { + + int id; + String req_id; + String req_date; + String req_msg; + String req_priority; + String req_status; + String headid; + String req_type; + String pro_id; + String pro_title; + String resp_date; + String resp_msg; + String status; + + public StudentRequestHisoryDetails(){} + public StudentRequestHisoryDetails(int id, String req_id, String req_date, String req_msg, String req_priority, String req_status, String headid, String req_type, String pro_id, String pro_title, String resp_date, String resp_msg, String status) { + this.id = id; + this.req_id = req_id; + this.req_date = req_date; + this.req_msg = req_msg; + this.req_priority = req_priority; + this.req_status = req_status; + this.headid = headid; + this.req_type = req_type; + this.pro_id = pro_id; + this.pro_title = pro_title; + this.resp_date = resp_date; + this.resp_msg = resp_msg; + this.status = status; + } + + public StudentRequestHisoryDetails(String req_date, String req_msg, String req_priority, String headid, String req_type, String pro_id, String pro_title, String resp_date, String resp_msg, String status) { + this.req_date = req_date; + this.req_msg = req_msg; + this.req_priority = req_priority; + this.headid = headid; + this.req_type = req_type; + this.pro_id = pro_id; + this.pro_title = pro_title; + this.resp_date = resp_date; + this.resp_msg = resp_msg; + this.status = status; + } + + public String getReq_id() { + return req_id; + } + + public void setReq_id(String req_id) { + this.req_id = req_id; + } + + public String getReq_date() { + return req_date; + } + + public void setReq_date(String req_date) { + this.req_date = req_date; + } + + public String getReq_msg() { + return req_msg; + } + + public void setReq_msg(String req_msg) { + this.req_msg = req_msg; + } + + public String getReq_priority() { + return req_priority; + } + + public void setReq_priority(String req_priority) { + this.req_priority = req_priority; + } + + public String getReq_status() { + return req_status; + } + + public void setReq_status(String req_status) { + this.req_status = req_status; + } + + public String getHeadid() { + return headid; + } + + public void setHeadid(String headid) { + this.headid = headid; + } + + public String getReq_type() { + return req_type; + } + + public void setReq_type(String req_type) { + this.req_type = req_type; + } + + public String getPro_id() { + return pro_id; + } + + public void setPro_id(String pro_id) { + this.pro_id = pro_id; + } + + public String getPro_title() { + return pro_title; + } + + public void setPro_title(String pro_title) { + this.pro_title = pro_title; + } + + public String getResp_date() { + return resp_date; + } + + public void setResp_date(String resp_date) { + this.resp_date = resp_date; + } + + public String getResp_msg() { + return resp_msg; + } + + public void setResp_msg(String resp_msg) { + this.resp_msg = resp_msg; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } +} diff --git a/app/src/main/java/com/leadcampusapp/Student_history.java b/app/src/main/java/com/leadcampusapp/Student_history.java new file mode 100644 index 0000000..80a2341 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/Student_history.java @@ -0,0 +1,561 @@ +package com.leadcampusapp; + +import android.app.ProgressDialog; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.res.Resources; +import android.os.AsyncTask; +import android.os.Bundle; +import androidx.fragment.app.Fragment; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.ListView; +import android.widget.TextView; +import android.widget.Toast; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.util.Vector; + +public class Student_history extends Fragment { + LinearLayout Request_history_LL, noRequesthistory_LL; + LinearLayout linearLayoutmain; + private LinearLayout linearLayout; + ListView listView; + Context context; + Resources resource; + Class_InternetDectector internetDectector; + Boolean isInternetPresent = false; + StudentRequestHisoryDetails[] studentRequestHisoryDetailslist; + StudentRequestHisoryDetails studentRequestHisoryDetails; + int count1; + SoapPrimitive response_delete; + String internet_issue = "empty",str_requestedid,str_pdid; + String str_requestid, str_requestdate,str_requestmsg,str_requestpriority, + str_requeststatus,str_requestheadid,str_requestType,str_projid, + str_projTitle,str_resdate,str_resmsg,str_status; + + CustomAdapter adapter; + + public static final String PREFBook_Stud= "prefbook_stud"; //sharedpreference Book + public static final String PrefID_RegID = "prefid_regid"; // + public static final String PrefID_SName = "prefid_sname"; // + public static final String PrefID_PM_SName = "prefid_pmsname"; // + public static final String PrefID_SLeadID = "prefid_sleadid"; // + public static final String PrefID_PM_SEmailID = "prefid_pm_semailid"; // + public static final String PrefID_SCellNo = "prefid_scellno"; // + + private SharedPreferences shardpref_S_obj; + + private String str_leadId,str_RegistrationId; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + + + linearLayout = (LinearLayout) inflater.inflate(R.layout.stud_req_history, container, false); + + linearLayoutmain = (LinearLayout) linearLayout.findViewById(R.id.RequestHistorymain_LL); + + adapter = new CustomAdapter(); + listView = (ListView) linearLayout.findViewById(R.id.customlistview_requesthistory); + context = linearLayout.getContext(); + resource = context.getResources(); + + + shardpref_S_obj=getActivity().getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + str_leadId = shardpref_S_obj.getString(PrefID_SLeadID, "").trim(); + + internetDectector = new Class_InternetDectector(getActivity()); + isInternetPresent = internetDectector.isConnectingToInternet(); + + if (isInternetPresent) { + + AsyncCall_history task = new AsyncCall_history(context); + task.execute(); + } else { + Toast.makeText(getActivity(), "No internet", Toast.LENGTH_LONG).show(); + + } + + return linearLayout; + + } + + private class AsyncCall_history extends AsyncTask { + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + dialog.setMessage("Please wait.."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("Ashraf", "doInBackground"); + Reqesthistory_details(); + return null; + } + + public AsyncCall_history(Context context1) { + context = context1; + dialog = new ProgressDialog(context1); + } + + @Override + protected void onPostExecute(Void result) { + + + dialog.dismiss(); + + if (studentRequestHisoryDetailslist != null) { + // CustomAdapter adapter = new CustomAdapter(); + listView.setAdapter(adapter); + + int x = studentRequestHisoryDetailslist.length; + + + } else { + Log.d("onPostExecute", "list == null"); + } + + System.out.println("Reached the onPostExecute"); + + }//end of onPostExecute + }// end Async task + + + + public void Reqesthistory_details() { + Vector result1 = null; + + String URL = Class_URL.URL_Projects.toString(); + String METHOD_NAME = "Get_Student_Request_History"; + String Namespace = "http://mis.leadcampus.org/", SOAPACTION = "http://mis.leadcampus.org/Get_Student_Request_History"; + + try { + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + request.addProperty("Lead_Id", str_leadId);//MH08103,MI00001 + + Log.i("getHistoryDetails", request.toString()); + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + + + androidHttpTransport.call(SOAPACTION, envelope); + + SoapObject response = (SoapObject) envelope.getResponse(); + Log.i("value at response", response.toString()); + count1 = response.getPropertyCount(); // number of count in array in response 6,0-5,5 + + Log.i("number of rows", "" + count1); + //studentRequestHisoryDetailslist=new StudentRequestHisoryDetails[0]; + // studentRequestHisoryDetailslist=null; + + studentRequestHisoryDetailslist = new StudentRequestHisoryDetails[count1]; + + for (int i = 0; i < count1; i++) { + System.out.println("abcd"); + + + SoapObject list = (SoapObject) response.getProperty(i); +// String str_requestid, str_requestdate,str_requestmsg,str_requestpriority, +// str_requeststatus,str_requestheadid,str_requestType,str_projid, +// str_projTitle,str_resdate,str_resmsg,str_status; + + System.out.println("list..........." + list); + + str_requestid = list.getProperty("request_Id").toString(); + str_requestdate = list.getProperty("Request_Date").toString(); + str_requestmsg = list.getProperty("Request_Message").toString(); + str_requestpriority = list.getProperty("Request_Priority").toString(); + str_requeststatus = list.getProperty("Request_Status").toString(); + str_requestheadid = list.getProperty("HeadId").toString(); + str_requestType = list.getProperty("HeadName").toString(); + str_projid = list.getProperty("Project_Id").toString(); + str_projTitle = list.getProperty("Project_Title").toString(); + str_resdate = list.getProperty("Response_Date").toString(); + str_resmsg = list.getProperty("Response_Message").toString(); + str_status = list.getProperty("Status").toString(); + + + + StudentRequestHisoryDetails innercompoffobj = new StudentRequestHisoryDetails(); + Log.i("value at name premitive", str_status); + innercompoffobj.setPro_id(str_projid); + innercompoffobj.setPro_title(str_projTitle); + innercompoffobj.setReq_date(str_requestdate); + innercompoffobj.setReq_msg(str_requestmsg); + innercompoffobj.setReq_priority(str_requestpriority); + innercompoffobj.setReq_status(str_requeststatus); + innercompoffobj.setReq_type(str_requestType); + innercompoffobj.setResp_date(str_resdate); + innercompoffobj.setResp_msg(str_resmsg); + innercompoffobj.setStatus(str_status); + innercompoffobj.setHeadid(str_requestheadid); + innercompoffobj.setReq_id(str_requestid); + + studentRequestHisoryDetailslist[i] = innercompoffobj; + + + + }// End of for loop + + + } catch (Throwable t) { + Log.e("request fail", "> " + t.getMessage()); + } + } catch (Throwable t) { + Log.e("UnRegister Error", "> " + t.getMessage()); + + } + + }//End of method + + + + //Holder for customAdapter + private class Holder { + TextView holder_headid_TV,holder_reqmsg_TV, holder_reqtype_TV,holder_resmsg_TV,holder_reqdate_TV, + holder_reqid_TV,holder_reqstatus_TV,holder_respdate_TV,holder_projID_TV,holder_projTitle_TV,holder_status_TV; + Button delete_bt; + LinearLayout protitle_LL,respdate_LL,respmsg_LL; + + } + //End of Holder + + public class CustomAdapter extends BaseAdapter { + + + + + + + public CustomAdapter() { + + super(); + Log.d("Inside CustomAdapter()", "Inside CustomAdapter()"); + } + + @Override + public int getCount() { + + String x = Integer.toString(studentRequestHisoryDetailslist.length); + Log.d("Student_history.length", x); + return studentRequestHisoryDetailslist.length; + + } + + @Override + public Object getItem(int position) { + String x = Integer.toString(position); + System.out.println("getItem position" + x); + Log.d("getItem position", "x"); + return studentRequestHisoryDetailslist[position]; + } + + @Override + public long getItemId(int position) { + String x = Integer.toString(position); + System.out.println("getItemId position" + x); + Log.d("getItemId position", x); + return position; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + + final Holder holder; + + Log.d("CustomAdapter", "position: " + position); + + if (convertView == null) { + holder = new Holder(); + convertView = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_childlayout, parent, false); + + + Request_history_LL = (LinearLayout) convertView.findViewById(R.id.req_history_LL); + noRequesthistory_LL = (LinearLayout) convertView.findViewById(R.id.nohistory_LL); + holder.protitle_LL = (LinearLayout) convertView.findViewById(R.id.protitle_ll); + holder.respdate_LL = (LinearLayout) convertView.findViewById(R.id.respdate_ll); + holder.respmsg_LL = (LinearLayout) convertView.findViewById(R.id.respmsg_ll); + + + + holder.holder_reqmsg_TV = (TextView) convertView.findViewById(R.id.requestmsg_TV); + holder.holder_reqtype_TV = (TextView) convertView.findViewById(R.id.requestType_TV); + holder.holder_resmsg_TV = (TextView) convertView.findViewById(R.id.ResponseMsg_TV); + holder.holder_reqdate_TV = (TextView) convertView.findViewById(R.id.request_dateaction_TV); + holder.holder_respdate_TV = (TextView) convertView.findViewById(R.id.resp_dateaction_TV); + holder.holder_projID_TV = (TextView) convertView.findViewById(R.id.projectid_TV); + holder.holder_projTitle_TV = (TextView) convertView.findViewById(R.id.projectTitle_TV); + holder.holder_status_TV = (TextView) convertView.findViewById(R.id.Status_TV); + holder.holder_reqid_TV = (TextView) convertView.findViewById(R.id.reqid_TV); + holder.holder_reqstatus_TV = (TextView) convertView.findViewById(R.id.reqstatus_TV); + holder.holder_headid_TV = (TextView) convertView.findViewById(R.id.headid_TV); + + + + holder.delete_bt = (Button) convertView.findViewById(R.id.delete_BT); + holder.delete_bt.setVisibility(View.GONE); +// respdate_LL.setVisibility(View.GONE); +// respmsg_LL.setVisibility(View.GONE); +// protitle_LL.setVisibility(View.GONE); + + //font_change_row_item_new(); + + + + + + Log.d("Inside If convertView", "Inside If convertView"); + + convertView.setTag(holder); + } else { + holder = (Holder) convertView.getTag(); + Log.d("Inside else convertView", "Inside else convertView"); + } + + studentRequestHisoryDetails = (StudentRequestHisoryDetails) getItem(position); + if (count1 == 0) { + Request_history_LL.setVisibility(View.GONE); + noRequesthistory_LL.setVisibility(View.VISIBLE); + } else { + + if (studentRequestHisoryDetails != null) { + holder.holder_reqmsg_TV.setText(studentRequestHisoryDetails.getReq_msg()); + holder.holder_reqtype_TV.setText(studentRequestHisoryDetails.getReq_type()); + holder.holder_reqdate_TV.setText(studentRequestHisoryDetails.getReq_date()); + holder.holder_reqid_TV.setText(studentRequestHisoryDetails.getReq_id()); + holder.holder_status_TV.setText(studentRequestHisoryDetails.getStatus()); + holder.holder_reqstatus_TV.setText(studentRequestHisoryDetails.getReq_status()); + holder.holder_headid_TV.setText(studentRequestHisoryDetails.getHeadid()); + + + + + + + String headid=holder.holder_headid_TV.getText().toString(); + System.out.println("studentRequestHisoryDetails.headid.().."+ studentRequestHisoryDetails.getHeadid()); + + if (studentRequestHisoryDetails.getHeadid().equals("1")) { + holder.protitle_LL.setVisibility(View.VISIBLE); + holder.holder_projID_TV.setText(studentRequestHisoryDetails.getPro_id()); + holder.holder_projTitle_TV.setText(studentRequestHisoryDetails.getPro_title()); + } else { + holder.protitle_LL.setVisibility(View.GONE); + } + + + + if (studentRequestHisoryDetails.getReq_status().equals("2")) { + holder.delete_bt.setVisibility(View.GONE); + holder.respmsg_LL.setVisibility(View.VISIBLE); + holder.respdate_LL.setVisibility(View.VISIBLE); + holder.holder_resmsg_TV.setText(studentRequestHisoryDetails.getResp_msg()); + holder.holder_respdate_TV.setText(studentRequestHisoryDetails.getResp_date()); + + } else { + holder.delete_bt.setVisibility(View.VISIBLE); + holder.respdate_LL.setVisibility(View.GONE); + holder.respmsg_LL.setVisibility(View.GONE); + } + + + + holder.delete_bt.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + + + str_requestedid=holder.holder_reqid_TV.getText().toString(); + System.out.println("str_requestedid..onclick."+str_requestedid); + str_pdid=holder.holder_projID_TV.getText().toString(); + System.out.println("str_pdid ..onclick..."+str_pdid); + + internetDectector = new Class_InternetDectector(getActivity()); + isInternetPresent = internetDectector.isConnectingToInternet(); + + if (isInternetPresent) { + DeleteHistory_AsyncTask task1 = new DeleteHistory_AsyncTask(context); + task1.execute(); + } else { + Toast.makeText(getActivity(), "No internet", Toast.LENGTH_LONG).show(); + } + + } + }); + + }// end of if + + + + } + + + + + + return convertView; + + + } + + + }//End of CustomAdapter + + // Submit Async request + private class DeleteHistory_AsyncTask extends AsyncTask { + + ProgressDialog dialog; + + Context context; + + protected void onPreExecute() { + + dialog.setMessage("Please wait.."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + + } + + @Override + protected void onProgressUpdate(Void... values) { + + } + + @Override + protected Void doInBackground(String... params) { + Log.i("DF", "doInBackground"); + + + deleteHistory(); + + + return null; + } + + public DeleteHistory_AsyncTask(Context context1) { + context = context1; + dialog = new ProgressDialog(context1); + } + + @Override + protected void onPostExecute(Void result) { + if (dialog.isShowing()) { + dialog.dismiss(); + if (response_delete != null) { + System.out.println("response_delete.." + response_delete); + if (response_delete.toString().equals("success")) { + + Toast.makeText(context, "Deleted successfully", Toast.LENGTH_LONG).show(); + + + Intent i=new Intent(getActivity(),StudentRequest.class); + i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); + startActivity(i); + + } else { + Toast.makeText(context, "Sorry,could not be Deleted", Toast.LENGTH_LONG).show(); + + } + } + } + } + }// End of AsyncCall_submit + + public void deleteHistory() { + + String URL = Class_URL.URL_Projects.toString(); + String METHOD_NAME = "Student_Submit_Request_ToManager"; + String Namespace = "http://mis.leadcampus.org/", SOAPACTION = "http://mis.leadcampus.org/Student_Submit_Request_ToManager"; + + try { + + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + + + System.out.println("str_requestedid...." + str_requestedid); + + if(str_requestedid.equals("1")) { + + request.addProperty("Lead_Id", ""); + request.addProperty("Request_type",""); + request.addProperty("Priority",""); + request.addProperty("PDID",str_pdid); + request.addProperty("Request_message",""); + request.addProperty("RequestedId", str_requestedid); + }else{ + request.addProperty("Lead_Id", ""); + request.addProperty("Request_type",""); + request.addProperty("Priority",""); + request.addProperty("PDID",""); + request.addProperty("Request_message", ""); + request.addProperty("RequestedId",str_requestedid); + } + + + Log.i("string value request", request.toString()); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + + androidHttpTransport.call(SOAPACTION, envelope); + response_delete = (SoapPrimitive) envelope.getResponse(); + Log.i("string value atsponse", response_delete.toString()); + + } catch (Throwable t) { + + Log.e("request fail", "> " + t.getMessage()); + internet_issue = "slow internet"; + } + } catch (Throwable t) { + + Log.e("UnRegister Recei Error", "> " + t.getMessage()); + + } + + }//End + + + +} diff --git a/app/src/main/java/com/leadcampusapp/TShirtAdapter.java b/app/src/main/java/com/leadcampusapp/TShirtAdapter.java new file mode 100644 index 0000000..594e6d9 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/TShirtAdapter.java @@ -0,0 +1,43 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 22-06-2018. + */ +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentStatePagerAdapter; + +public class TShirtAdapter extends FragmentStatePagerAdapter { + int mNumOfTabs; + + public TShirtAdapter(FragmentManager fm, int NumOfTabs) { + super(fm); + this.mNumOfTabs = NumOfTabs; + } + + @Override + public Fragment getItem(int position) { + + switch (position) { + case 0: + TShirtUnpaidFragment tab1 = new TShirtUnpaidFragment(); + return tab1; + /* case 1: + ChartStud_CollgCountFragment tab2 = new ChartStud_CollgCountFragment(); + return tab2;*/ + case 1: + TShirtPaidFragment tab3 = new TShirtPaidFragment(); + return tab3; + /* case 2: + ChartFundAmtCountFragment tab4 = new ChartFundAmtCountFragment(); + return tab4;*/ + default: + return null; + } + } + + @Override + public int getCount() { + return mNumOfTabs; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/TShirtPaidAckAdapter.java b/app/src/main/java/com/leadcampusapp/TShirtPaidAckAdapter.java new file mode 100644 index 0000000..2b3d443 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/TShirtPaidAckAdapter.java @@ -0,0 +1,391 @@ +package com.leadcampusapp; + +import android.app.Activity; +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.content.Intent; +import android.net.Uri; +import android.text.InputType; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.BaseAdapter; +import android.widget.Button; +import android.widget.EditText; +import android.widget.Spinner; +import android.widget.TextView; +import android.widget.Toast; + +import java.util.ArrayList; + +//import com.android.sripad.leadnew_22_6_2018.R; + +/** + * Created by Admin on 28-05-2018. + */ + +public class TShirtPaidAckAdapter extends BaseAdapter{ + + public ArrayList tshirtPaidList; + Activity activity; + + public TShirtPaidAckAdapter(Activity activity, ArrayList tshirtPaidList) { + super(); + this.activity = activity; + this.tshirtPaidList = tshirtPaidList; + } + + @Override + public int getCount() { + //return projList.size(); + return tshirtPaidList.size(); + } + + @Override + public TshirtPaidModel getItem(int position) { + + //return projList.get(position); + return tshirtPaidList.get(position); + } + + @Override + public long getItemId(int position) { + return position; + } + + class ViewHolder { + TextView mstudName; + TextView mleadId; + TextView mTShirtSize; + TextView mCollegeName; + TextView mPhoneNumber; + TextView mProjectCount; + TextView mRequestedId; + Button mUnapprove; + Button mExchange; + // CheckBox mStatus; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + + final ViewHolder holder; + final Spinner[] reson_spin = new Spinner[1]; + final Spinner[] resize_spin = new Spinner[1]; + LayoutInflater inflater = activity.getLayoutInflater(); + + if (convertView == null) { + convertView = inflater.inflate(R.layout.tshirt_paid_listrow, null); + holder = new ViewHolder(); + + holder.mstudName = (TextView) convertView.findViewById(R.id.txt_studName); + holder.mleadId = (TextView) convertView.findViewById(R.id.txt_leadId); + holder.mTShirtSize = (TextView) convertView.findViewById(R.id.txt_tShirtSize); + holder.mProjectCount = (TextView) convertView.findViewById(R.id.txt_projCount); + holder.mRequestedId = (TextView) convertView.findViewById(R.id.txt_requestedId); + //holder.mRegistrationDate = (TextView) convertView.findViewById(R.id.txt_registeredDateTxt); + holder.mCollegeName = (TextView) convertView.findViewById(R.id.txt_collegeName); + holder.mPhoneNumber = (TextView) convertView.findViewById(R.id.txt_phoneNumber); + holder.mUnapprove = (Button) convertView.findViewById(R.id.unapprove); + holder.mExchange = (Button) convertView.findViewById(R.id.exchange); + // holder.mStatus = (CheckBox) convertView.findViewById(R.id.check_status); + + convertView.setTag(holder); + } else { + holder = (ViewHolder) convertView.getTag(); + } + + TshirtPaidModel item = tshirtPaidList.get(position); + + if(item.getStudent_name()!=null) { + holder.mstudName.setText(item.getStudent_name().toString()); + } + if(item.getPhone_number()!=null) { + holder.mPhoneNumber.setText(item.getPhone_number().toString()); + } + if(item.getCollege_name()!=null) { + holder.mCollegeName.setText(item.getCollege_name().toString()); + } + if(item.getLead_id()!=null) { + holder.mleadId.setText(item.getLead_id().toString()); + } + if(item.getRequestedId()!=null) { + holder.mRequestedId.setText(item.getRequestedId().toString()); + } + if(item.getTshirtSize()!=null) { + holder.mTShirtSize.setText(item.getTshirtSize().toString()); + } + + holder.mProjectCount.setText(item.getProjectcount()); + holder.mRequestedId.setVisibility(View.INVISIBLE); + + + /* if(item.getProj_count()!=null) { + holder.mProjectCount.setText(item.getProj_count()); + }*/ + /*else{ + holder.mRegistrationDate.setText(""); + }*/ + + /* if(item.getStatus().toString().equals("1")) { + holder.mStatus.setChecked(true); + //holder.mStatus.setSelected(true); + } + if(item.getStatus().toString().equals("0")) { + holder.mStatus.setChecked(false); + //holder.mStatus.setSelected(false); + }*/ + + holder.mPhoneNumber.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(Intent.ACTION_DIAL); + intent.setData(Uri.parse("tel:"+holder.mPhoneNumber.getText().toString())); + v.getContext().startActivity(intent); + } + }); + /* holder.mStatus.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Log.d("insidelistview","listview clicked"); + notifyDataSetChanged(); + } + });*/ + + //final CheckBox checkboxSelected = holder.mStatus; + /* final int pos = position; + holder.mStatus.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + Log.d("insidelistview","listview clicked"); + + if(isChecked) { + Log.d("ischhecked","true"); + holder.mStatus.setChecked(true); + //holder.mStatus.setEnabled(true); + tshirtPaidList.get(pos).setStatus("1"); + }else{ + Log.d("ischhecked","false"); + holder.mStatus.setChecked(false); + tshirtPaidList.get(pos).setStatus("0"); + } + //notifyDataSetChanged(); + //holder.mStatus.setChecked(true); + //holder.mStatus.setSelected(true); + + } + }); +*/ + + + + /* Button btn_selectAll; + btn_selectAll = (Button) + btn_selectAll.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Log.d("lview.getCount()iss", String.valueOf(lview.getCount())); + for (int i = 0; i < lview.getCount(); i++) { + View vw = lview.getAdapter().getView(i,null,null); + CheckBox checkBox = (CheckBox) vw.findViewById(R.id.check_status); + Log.d("checkboxstatusissss", String.valueOf(checkBox.isChecked())); + checkBox.setChecked(true); + Log.d("checkboxstatusissss2", String.valueOf(checkBox.isChecked())); + lview.setAdapter(adapter); + adapter.notifyDataSetChanged(); + } + } + });*/ + + holder.mUnapprove.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + String str_requestId=holder.mRequestedId.getText().toString(); + String str_size=holder.mTShirtSize.getText().toString(); + String str_leadId=holder.mleadId.getText().toString(); + TShirtUnpaidFragment.SubmitUnapprove submitUnapprove = new TShirtUnpaidFragment.SubmitUnapprove(activity); + submitUnapprove.execute(str_requestId,str_size,str_leadId); + + /*LayoutInflater layoutInflaterAndroid = LayoutInflater.from(activity); + View mView = layoutInflaterAndroid.inflate(R.layout.pmfund_prompt, null); + AlertDialog.Builder alertDialogBuilderUserInput = new AlertDialog.Builder(activity); + alertDialogBuilderUserInput.setView(mView); + + final TextView headerText = (TextView) mView.findViewById(R.id.textView1); + final EditText userInputDialogEditText = (EditText) mView.findViewById(R.id.fundamtPromt_et); + headerText.setText("Enter Reson for T-shirt Unapproved"); + headerText.setTextSize(14); + userInputDialogEditText.setInputType(InputType.TYPE_CLASS_TEXT); + alertDialogBuilderUserInput + .setCancelable(false) + .setPositiveButton("Send", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialogBox, int id) { + // ToDo get user input here + String str_requestId=holder.mRequestedId.getText().toString(); + String str_size=holder.mTShirtSize.getText().toString(); + String str_leadId=holder.mleadId.getText().toString(); + TShirtUnpaidFragment.SubmitUnapprove submitUnapprove = new TShirtUnpaidFragment.SubmitUnapprove(activity); + submitUnapprove.execute(str_requestId,str_size,str_leadId); + Toast.makeText(activity,userInputDialogEditText.getText().toString()+",,"+holder.mleadId.getText().toString(),Toast.LENGTH_LONG).show(); + } + }) + + .setNegativeButton("Cancel", + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialogBox, int id) { + dialogBox.cancel(); + } + }); + + AlertDialog alertDialogAndroid = alertDialogBuilderUserInput.create(); + alertDialogAndroid.show();*/ + } + }); + + holder.mExchange.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + // Toast.makeText(activity,"Exchange: ",Toast.LENGTH_LONG).show(); + LayoutInflater layoutInflaterAndroid = LayoutInflater.from(activity); + View mView = layoutInflaterAndroid.inflate(R.layout.pmtshirtexchange_prompt, null); + AlertDialog.Builder alertDialogBuilderUserInput = new AlertDialog.Builder(activity); + alertDialogBuilderUserInput.setView(mView); + + reson_spin[0] = (Spinner) mView.findViewById(R.id.reson_spin); + resize_spin[0] = (Spinner) mView.findViewById(R.id.resize_spin); + setResonSpinner(); + setResizeSpinner(); + /* final TextView headerText = (TextView) mView.findViewById(R.id.textView1); + final EditText userInputDialogEditText = (EditText) mView.findViewById(R.id.fundamtPromt_et); + headerText.setText("Enter Reson for T-shirt Exchange"); + headerText.setTextSize(14); + userInputDialogEditText.setInputType(InputType.TYPE_CLASS_TEXT);*/ + alertDialogBuilderUserInput + .setCancelable(false) + .setPositiveButton("Send", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialogBox, int id) { + // ToDo get user input here + String str_reson = reson_spin[0].getSelectedItem().toString(); + String str_resize = resize_spin[0].getSelectedItem().toString(); + String str_requestId=holder.mRequestedId.getText().toString(); + String str_size=holder.mTShirtSize.getText().toString(); + String str_leadId=holder.mleadId.getText().toString(); + String str_resizenew = null; + if(str_resize.equals("S - Small")){ + str_resizenew="S"; + } + if(str_resize.equals("M - Medium")){ + str_resizenew="M"; + } + if(str_resize.equals("L - Large")){ + str_resizenew="L"; + } + if(str_resize.equals("XL - Extra Large")){ + str_resizenew="XL"; + } + if(str_resize.equals("XXL - Double Extra Large")){ + str_resizenew="XXL"; + } + Log.i("tag","str_resizenew=="+str_resizenew+" str_resize=="+str_resize); + TShirtUnpaidFragment.SubmitExchangeDetails submitExchangeDetails = new TShirtUnpaidFragment.SubmitExchangeDetails(activity); + submitExchangeDetails.execute(str_leadId,str_requestId,str_size,str_resizenew,str_reson); + + // Toast.makeText(activity,userInputDialogEditText.getText().toString(),Toast.LENGTH_LONG).show(); + } + }) + + .setNegativeButton("Cancel", + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialogBox, int id) { + dialogBox.cancel(); + } + }); + + AlertDialog alertDialogAndroid = alertDialogBuilderUserInput.create(); + alertDialogAndroid.show(); + } + private void setResonSpinner() { + final ArrayList listBg = new ArrayList(); + listBg.add("Size Variation"); + listBg.add("Low Printing Quality"); + listBg.add("Teared"); + listBg.add("Dusty"); + listBg.add("Old Stock"); + + //ArrayAdapter dataAdapterSem = new ArrayAdapter(context, R.layout.simple_spinner_semester, listsemester); + ArrayAdapter dataAdapterBg = new ArrayAdapter(activity, R.layout.simple_spinner_items, listBg); + + // Drop down layout style - list view with radio button + dataAdapterBg.setDropDownViewResource(R.layout.spinnercustomstyle); + + // attaching data adapter to spinner + reson_spin[0].setAdapter(dataAdapterBg); + //spin_bg.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorWhite)); + } + private void setResizeSpinner() { + final ArrayList listBg = new ArrayList(); + listBg.add("S - Small"); + listBg.add("M - Medium"); + listBg.add("L - Large"); + listBg.add("XL - Extra Large"); + listBg.add("XXL - Double Extra Large"); + + //ArrayAdapter dataAdapterSem = new ArrayAdapter(context, R.layout.simple_spinner_semester, listsemester); + ArrayAdapter dataAdapterBg = new ArrayAdapter(activity, R.layout.simple_spinner_items, listBg); + + // Drop down layout style - list view with radio button + dataAdapterBg.setDropDownViewResource(R.layout.spinnercustomstyle); + + // attaching data adapter to spinner + resize_spin[0].setAdapter(dataAdapterBg); + //spin_bg.setSupportBackgroundTintList(ContextCompat.getColorStateList(context, R.color.colorWhite)); + } + + }); + + + + return convertView; + } + + + + public void filter(String charText,ArrayList feesList,String selectedCollegeName) { + //charText = charText.toLowerCase(Locale.getDefault()); + //Log.d("charTextissss",charText); + this.tshirtPaidList.clear(); + + /* for(FeesUnpaidModel feesUnpaidModel : feesList){ + String stdName = feesUnpaidModel.getStudent_name().toString(); + //Log.d("StudeNameissssss",stdName); + }*/ + + if(charText!=null) { + if(feesList!=null) { + if (charText.isEmpty() || charText.length() == 0) { + this.tshirtPaidList.addAll(feesList); + } else { + for (TshirtPaidModel wp : feesList) { + //Log.d("GetCollegeNameissss",wp.getCollege_name().toLowerCase((Locale.getDefault()))); + /* if (wp.getCollege_name().toLowerCase(Locale.getDefault()).contains(charText) || wp.getLead_id().toLowerCase(Locale.getDefault()).contains(charText) || wp.getPhone_number().toLowerCase(Locale.getDefault()).contains(charText) || wp.getStudent_name().toLowerCase(Locale.getDefault()).contains(charText) || wp.getPhone_number().toLowerCase(Locale.getDefault()).contains(charText)) { + this.feesUnPaidList.add(wp); + }*/ + if(selectedCollegeName == null) { + if ((wp.getCollege_name()!=null && wp.getCollege_name().toLowerCase().contains(charText.toLowerCase())) || ( wp.getLead_id()!=null && wp.getLead_id().toLowerCase().contains(charText.toLowerCase())) || ( wp.getPhone_number()!=null && wp.getPhone_number().toLowerCase().contains(charText.toLowerCase())) || ( wp.getStudent_name()!=null && wp.getStudent_name().toLowerCase().contains(charText.toLowerCase()) ) || ( wp.getPhone_number()!=null && wp.getPhone_number().toLowerCase().contains(charText.toLowerCase()))) { + this.tshirtPaidList.add(wp); + } + }else{ + if ((wp.getCollege_name()!=null && wp.getCollege_name().equals(selectedCollegeName)) && ((wp.getCollege_name()!=null && wp.getCollege_name().toLowerCase().contains(charText.toLowerCase())) || (wp.getLead_id()!=null && wp.getLead_id().toLowerCase().contains(charText.toLowerCase())) || (wp.getPhone_number()!=null && wp.getPhone_number().toLowerCase().contains(charText.toLowerCase())) || (wp.getStudent_name()!=null && wp.getStudent_name().toLowerCase().contains(charText.toLowerCase())) || (wp.getPhone_number()!=null && wp.getPhone_number().toLowerCase().contains(charText.toLowerCase())))) { + this.tshirtPaidList.add(wp); + } + } + + } + } + notifyDataSetChanged(); + } + } + } +} diff --git a/app/src/main/java/com/leadcampusapp/TShirtPaidAcknowledgedAdapter.java b/app/src/main/java/com/leadcampusapp/TShirtPaidAcknowledgedAdapter.java new file mode 100644 index 0000000..e7ab267 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/TShirtPaidAcknowledgedAdapter.java @@ -0,0 +1,158 @@ +package com.leadcampusapp; + +import android.app.Activity; +import android.content.Intent; +import android.net.Uri; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.CheckBox; +import android.widget.TextView; + +import java.util.ArrayList; + +//import com.android.sripad.leadnew_22_6_2018.R; + +/** + * Created by Admin on 28-05-2018. + */ + +public class TShirtPaidAcknowledgedAdapter extends BaseAdapter{ + + public ArrayList feesPaidList; + Activity activity; + + public TShirtPaidAcknowledgedAdapter(Activity activity, ArrayList feesPaidList) { + super(); + this.activity = activity; + this.feesPaidList = feesPaidList; + } + + @Override + public int getCount() { + //return projList.size(); + return feesPaidList.size(); + } + + @Override + public FeesUnpaidModel getItem(int position) { + + //return projList.get(position); + return feesPaidList.get(position); + } + + @Override + public long getItemId(int position) { + return position; + } + + class ViewHolder { + TextView mstudName; + TextView mleadId; + TextView mRegistrationDate; + TextView mCollegeName; + TextView mPhoneNumber; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + + final ViewHolder holder; + LayoutInflater inflater = activity.getLayoutInflater(); + + if (convertView == null) { + convertView = inflater.inflate(R.layout.fees_paid_listrow, null); + holder = new ViewHolder(); + + holder.mstudName = (TextView) convertView.findViewById(R.id.txt_studName); + holder.mleadId = (TextView) convertView.findViewById(R.id.txt_leadId); + holder.mRegistrationDate = (TextView) convertView.findViewById(R.id.txt_registeredDateTxt); + holder.mCollegeName = (TextView) convertView.findViewById(R.id.txt_collegeName); + holder.mPhoneNumber = (TextView) convertView.findViewById(R.id.txt_phoneNumber); + + convertView.setTag(holder); + } else { + holder = (ViewHolder) convertView.getTag(); + } + + FeesUnpaidModel item = feesPaidList.get(position); + + if(item.getStudent_name()!=null) { + holder.mstudName.setText(item.getStudent_name().toString()); + } + if(item.getPhone_number()!=null) { + holder.mPhoneNumber.setText(item.getPhone_number().toString()); + } + if(!item.getCollege_name().equals(null)) { + holder.mCollegeName.setText(item.getCollege_name().toString()); + } + if(item.getLead_id()!=null) { + holder.mleadId.setText(item.getLead_id().toString()); + } + if(item.getRegistration_date()!=null) { + holder.mRegistrationDate.setText(item.getRegistration_date().toString()); + } + + if(item.getPhone_number()!=null) { + holder.mPhoneNumber.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(Intent.ACTION_DIAL); + intent.setData(Uri.parse("tel:" + holder.mPhoneNumber.getText().toString())); + v.getContext().startActivity(intent); + } + }); + } + + return convertView; + } + + + public void filter(String charText,ArrayList feesList,String selectedCollegeName) { + //charText = charText.toLowerCase(Locale.getDefault()); + //Log.d("charTextissss",charText); + this.feesPaidList.clear(); + + /* for(FeesUnpaidModel feesUnpaidModel : feesList){ + String stdName = feesUnpaidModel.getStudent_name().toString(); + //Log.d("StudeNameissssss",stdName); + }*/ + + if(charText!=null) { + if(feesList!=null) { + if (charText.isEmpty() || charText.length() == 0) { + this.feesPaidList.addAll(feesList); + } else { + for (FeesUnpaidModel wp : feesList) { + //Log.d("GetCollegeNameissss",wp.getCollege_name().toLowerCase((Locale.getDefault()))); + /* if (wp.getCollege_name().toLowerCase(Locale.getDefault()).contains(charText) || wp.getLead_id().toLowerCase(Locale.getDefault()).contains(charText) || wp.getPhone_number().toLowerCase(Locale.getDefault()).contains(charText) || wp.getStudent_name().toLowerCase(Locale.getDefault()).contains(charText) || wp.getPhone_number().toLowerCase(Locale.getDefault()).contains(charText)) { + this.feesUnPaidList.add(wp); + }*/ + /* if(selectedCollegeName == null) { + if (wp.getCollege_name().contains(charText) || wp.getLead_id().contains(charText) || wp.getPhone_number().contains(charText) || wp.getStudent_name().contains(charText) || wp.getPhone_number().contains(charText)) { + this.feesPaidList.add(wp); + } + }else{ + if (wp.getCollege_name().equals(selectedCollegeName) && (wp.getCollege_name().contains(charText) || wp.getLead_id().contains(charText) || wp.getPhone_number().contains(charText) || wp.getStudent_name().contains(charText) || wp.getPhone_number().contains(charText))) { + this.feesPaidList.add(wp); + } + }*/ + + if(selectedCollegeName == null) { + if ((wp.getCollege_name()!=null && wp.getCollege_name().toLowerCase().contains(charText.toLowerCase())) || ( wp.getLead_id()!=null && wp.getLead_id().toLowerCase().contains(charText.toLowerCase())) || ( wp.getPhone_number()!=null && wp.getPhone_number().toLowerCase().contains(charText.toLowerCase())) || ( wp.getStudent_name()!=null && wp.getStudent_name().toLowerCase().contains(charText.toLowerCase()) ) || ( wp.getPhone_number()!=null && wp.getPhone_number().toLowerCase().contains(charText.toLowerCase()))) { + this.feesPaidList.add(wp); + } + }else{ + if ((wp.getCollege_name()!=null && wp.getCollege_name().equals(selectedCollegeName)) && ((wp.getCollege_name()!=null && wp.getCollege_name().toLowerCase().contains(charText.toLowerCase())) || (wp.getLead_id()!=null && wp.getLead_id().toLowerCase().contains(charText.toLowerCase())) || (wp.getPhone_number()!=null && wp.getPhone_number().toLowerCase().contains(charText.toLowerCase())) || (wp.getStudent_name()!=null && wp.getStudent_name().toLowerCase().contains(charText.toLowerCase())) || (wp.getPhone_number()!=null && wp.getPhone_number().toLowerCase().contains(charText.toLowerCase())))) { + this.feesPaidList.add(wp); + } + } + + } + } + notifyDataSetChanged(); + } + } + } +} diff --git a/app/src/main/java/com/leadcampusapp/TShirtPaidActivity.java b/app/src/main/java/com/leadcampusapp/TShirtPaidActivity.java new file mode 100644 index 0000000..bc007c8 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/TShirtPaidActivity.java @@ -0,0 +1,607 @@ +package com.leadcampusapp; + +import android.app.AlertDialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.graphics.Color; +import android.os.AsyncTask; +//import android.support.design.widget.TabLayout; +import androidx.viewpager.widget.ViewPager; +import androidx.appcompat.app.AppCompatActivity; +import android.os.Bundle; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuItem; +import android.view.View; +import android.widget.ImageButton; +import android.widget.TextView; +import android.widget.Toast; + +import com.google.android.material.tabs.TabLayout; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +public class TShirtPaidActivity extends AppCompatActivity implements ConnectivityReceiver.ConnectivityReceiverListener{ + ImageButton img_eventsBack; + + public static final String PREFBook_Stud= "prefbook_stud"; + private SharedPreferences shardpref_S_obj; + public static final String PrefID_Role = "prefid_role"; + public String str_role = null; + private ProgressDialog progressDialog; + private Context context; + private TextView txt_assignedTotal; + private TextView txt_assignedSmall; + private TextView txt_assignedMedium; + private TextView txt_assignedLarge; + private TextView txt_assignedXL; + private TextView txt_assignedXXL; + private TextView txt_balTotal; + private TextView txt_balSmall; + private TextView txt_balMedium; + private TextView txt_balLarge; + private TextView txt_balXL; + private TextView txt_balXXL; + public String str_MangerID; + public static final String PrefID_PMID = "prefid_pmid"; + SharedPreferences shardprefPM_obj; + public static final String PREFBook_PM= "prefbook_pm"; + + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_tshirt_paid); + + + context = TShirtPaidActivity.this; + + shardpref_S_obj=TShirtPaidActivity.this.getSharedPreferences(PREFBook_Stud, Context.MODE_PRIVATE); + shardpref_S_obj.getString(PrefID_Role, "").trim(); + str_role = shardpref_S_obj.getString(PrefID_Role, "").trim(); + + shardprefPM_obj= getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MangerID = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + Log.d("str_MangerID:",str_MangerID); + + Log.d("tag","AssignedTShirtListissss:"+str_MangerID); + + + /* img_eventsBack = (ImageButton) findViewById(R.id.img_eventsBack);*/ + + getSupportActionBar().setDisplayShowCustomEnabled(true); + getSupportActionBar().setCustomView(R.layout.actionbar_layout); + //getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.background)); + + View actionBarView = getSupportActionBar().getCustomView(); + TextView actionBarTV = (TextView) actionBarView.findViewById(R.id.txt_actionBar); + actionBarTV.setText("TShirt Approval Details"); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); + +/* + View view1; + LayoutInflater inflater1 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view1 = inflater1.inflate(R.layout.pm_tshirt_tablayout, null); + + View view2; + LayoutInflater inflater2 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view2 = inflater2.inflate(R.layout.pm_tshirt_acknowledged_tablayout, null);*/ + +/* View view3; + LayoutInflater inflater3 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view3 = inflater3.inflate(R.layout.pm_themeproject_tablayout, null); + + View view4; + LayoutInflater inflater4 = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view4 = inflater4.inflate(R.layout.pm_fundamt_tablayout, null);*/ + + + + /* TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); + tabLayout.addTab(tabLayout.newTab().setCustomView(view1)); + tabLayout.addTab(tabLayout.newTab().setCustomView(view2)); + + TabLayout.Tab selectedTab = tabLayout.getTabAt(0); + View view = selectedTab.getCustomView(); + + TextView selectedText = (TextView) view.findViewById(R.id.txt_pmTshirtReceived); + selectedText.setTextColor(Color.parseColor("#000000")); + + + //tabLayout.addTab(tabLayout.newTab().setText("Tab 3")); + //tabLayout.setTabGravity(TabLayout.GRAVITY_FILL); + + final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); + final TShirtAdapter adapter = new TShirtAdapter(getSupportFragmentManager(), tabLayout.getTabCount()); + viewPager.setAdapter(adapter); + viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); + tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { + @Override + public void onTabSelected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.txt_pmTshirtReceived); + selectedText.setTextColor(Color.parseColor("#000000")); + viewPager.setCurrentItem(tab.getPosition()); + } + + @Override + public void onTabUnselected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.txt_pmTshirtReceived); + selectedText.setTextColor(Color.parseColor("#000000")); + } + + @Override + public void onTabReselected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.txt_pmTshirtReceived); + selectedText.setTextColor(Color.parseColor("#000000")); + } + });*/ + + View view1; + LayoutInflater inflater1 = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view1 = inflater1.inflate(R.layout.pm_tshirt_tablayout, null); + + View view2; + LayoutInflater inflater2 = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); + view2 = inflater2.inflate(R.layout.pm_tshirt_acknowledged_tablayout, null); + + TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout); + tabLayout.addTab(tabLayout.newTab().setCustomView(view1)); + tabLayout.addTab(tabLayout.newTab().setCustomView(view2)); + + TabLayout.Tab selectedTab = tabLayout.getTabAt(0); + View view = selectedTab.getCustomView(); + + TextView selectedText = (TextView) view.findViewById(R.id.txt_pmTshirtReceived); + selectedText.setTextColor(Color.parseColor("#000000")); + + + //tabLayout.addTab(tabLayout.newTab().setText("Tab 3")); + //tabLayout.setTabGravity(TabLayout.GRAVITY_FILL); + + final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); + final TShirtAdapter adapter = new TShirtAdapter(getSupportFragmentManager(), tabLayout.getTabCount()); + viewPager.setAdapter(adapter); + viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout)); + tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { + @Override + public void onTabSelected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.txt_pmTshirtReceived); + selectedText.setTextColor(Color.parseColor("#000000")); + viewPager.setCurrentItem(tab.getPosition()); + } + + @Override + public void onTabUnselected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.txt_pmTshirtReceived); + selectedText.setTextColor(Color.parseColor("#000000")); + } + + @Override + public void onTabReselected(TabLayout.Tab tab) { + View view = tab.getCustomView(); + TextView selectedText = (TextView) view.findViewById(R.id.txt_pmTshirtReceived); + selectedText.setTextColor(Color.parseColor("#000000")); + } + }); + + loadUpperTable(); + + } + + private void loadUpperTable() { + initializeAssignedBalance(); + + GetAssignedTShirtlist getAssignedTShirtlist = new GetAssignedTShirtlist(context); + getAssignedTShirtlist.execute(); + } + + private void initializeAssignedBalance() { + txt_assignedTotal = (TextView) findViewById(R.id.txt_assignedTotal); + txt_assignedSmall = (TextView) findViewById(R.id.txt_assignedSmall); + txt_assignedMedium = (TextView) findViewById(R.id.txt_assignedMedium); + txt_assignedLarge = (TextView) findViewById(R.id.txt_assignedLarge); + txt_assignedXL = (TextView) findViewById(R.id.txt_assignedXL); + txt_assignedXXL = (TextView) findViewById(R.id.txt_assignedXXL); + + txt_balTotal = (TextView) findViewById(R.id.txt_balTotal); + txt_balSmall = (TextView) findViewById(R.id.txt_balSmall); + txt_balMedium = (TextView) findViewById(R.id.txt_balMedium); + txt_balLarge = (TextView) findViewById(R.id.txt_balLarge); + txt_balXL = (TextView) findViewById(R.id.txt_balXL); + txt_balXXL = (TextView) findViewById(R.id.txt_balXXL); + } + + public class GetAssignedTShirtlist extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + //private ProgressBar progressBar; + + GetAssignedTShirtlist (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapObject response = getAssignedTShirtList(); + + //Log.d("Soap response is",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + progressDialog.setMessage("Loading"); + progressDialog.setProgressStyle(android.R.attr.progressBarStyleSmall); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapObject result) { + + Log.d("Resultisssss:",result.toString()); + + + if(result != null) { + + SoapPrimitive S_AllotedS,S_AllotedM, S_AllotedL, S_AllotedXL, S_AllotedXXL,S_UsedS,S_UsedM,S_UsedL,S_UsedXL,S_UsedXXL,S_Status; + Object O_AllotedS, O_AllotedM, O_AllotedL, O_AllotedXL, O_AllotedXXL, O_UsedS, O_UsedM, O_UsedL, O_UsedXL, O_UsedXXL,O_Status; + String str_allotedS = null, str_allotedM = null, str_allotedL = null, str_allotedXL = null, str_allotedXXL = null, str_usedS = null, str_usedM = null, str_usedL = null, str_usedXL = null, str_usedXXL = null, str_status = null; + + + + O_Status = result.getProperty("Status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) result.getProperty("Status"); + Log.d("S_Status:", S_Status.toString()); + str_status = S_Status.toString(); + } + + Log.d("tag","Str_StatusinTShirtPaidActivityisss:"+str_status); + + + if (str_status.equalsIgnoreCase("Success")) { + + O_AllotedS = result.getProperty("AllotedS"); + if (!O_AllotedS.toString().equals("anyType{}") && !O_AllotedS.toString().equals(null)) { + S_AllotedS = (SoapPrimitive) result.getProperty("AllotedS"); + Log.d("S_AllotedS:", S_AllotedS.toString()); + str_allotedS = S_AllotedS.toString(); + + txt_assignedSmall.setText(str_allotedS); + } + + O_AllotedM = result.getProperty("AllotedM"); + if (!O_AllotedM.toString().equals("anyType{}") && !O_AllotedM.toString().equals(null)) { + S_AllotedM = (SoapPrimitive) result.getProperty("AllotedM"); + Log.d("S_AllotedM:", S_AllotedM.toString()); + str_allotedM = S_AllotedM.toString(); + + txt_assignedMedium.setText(str_allotedM); + } + + O_AllotedL = result.getProperty("AllotedL"); + if (!O_AllotedL.toString().equals("anyType{}") && !O_AllotedL.toString().equals(null)) { + S_AllotedL = (SoapPrimitive) result.getProperty("AllotedL"); + str_allotedL = S_AllotedL.toString(); + Log.d("S_AllotedL:", str_allotedL); + + txt_assignedLarge.setText(str_allotedL); + } + + O_AllotedXL = result.getProperty("AllotedXL"); + if (!O_AllotedXL.toString().equals("anyType{}") && !O_AllotedXL.toString().equals(null)) { + S_AllotedXL = (SoapPrimitive) result.getProperty("AllotedXL"); + Log.d("S_AllotedXL", S_AllotedXL.toString()); + str_allotedXL = S_AllotedXL.toString(); + Log.d("str_allotedXL", str_allotedXL); + + txt_assignedXL.setText(str_allotedXL); + } + + O_AllotedXXL = result.getProperty("AllotedXXL"); + if (!O_AllotedXXL.toString().equals("anyType{}") && !O_AllotedXXL.toString().equals(null)) { + S_AllotedXXL = (SoapPrimitive) result.getProperty("AllotedXXL"); + Log.d("S_AllotedXXL", S_AllotedXXL.toString()); + str_allotedXXL = S_AllotedXXL.toString(); + Log.d("str_allotedXXL", str_allotedXXL); + + txt_assignedXXL.setText(str_allotedXXL); + } + + + O_UsedS = result.getProperty("UsedS"); + if (!O_UsedS.toString().equals("anyType{}") && !O_UsedS.toString().equals(null)) { + S_UsedS = (SoapPrimitive) result.getProperty("UsedS"); + Log.d("S_UsedS:", S_UsedS.toString()); + str_usedS = S_UsedS.toString(); + + txt_balSmall.setText(str_usedS); + } + + O_UsedM = result.getProperty("UsedM"); + if (!O_UsedM.toString().equals("anyType{}") && !O_UsedM.toString().equals(null)) { + S_UsedM = (SoapPrimitive) result.getProperty("UsedM"); + Log.d("S_UsedM:", S_UsedM.toString()); + str_usedM = S_UsedM.toString(); + + txt_balMedium.setText(str_usedM); + } + + O_UsedL = result.getProperty("UsedL"); + if (!O_UsedL.toString().equals("anyType{}") && !O_UsedL.toString().equals(null)) { + S_UsedL = (SoapPrimitive) result.getProperty("UsedL"); + Log.d("S_UsedL:", S_UsedL.toString()); + str_usedL = S_UsedL.toString(); + + txt_balLarge.setText(str_usedL); + } + + O_UsedXL = result.getProperty("UsedXL"); + if (!O_UsedXL.toString().equals("anyType{}") && !O_UsedXL.toString().equals(null)) { + S_UsedXL = (SoapPrimitive) result.getProperty("UsedXL"); + Log.d("S_UsedXL:", S_UsedXL.toString()); + str_usedXL = S_UsedXL.toString(); + + txt_balXL.setText(str_usedXL); + } + + O_UsedXXL = result.getProperty("UsedXXL"); + if (!O_UsedXXL.toString().equals("anyType{}") && !O_UsedXXL.toString().equals(null)) { + S_UsedXXL = (SoapPrimitive) result.getProperty("UsedXXL"); + Log.d("S_UsedXXL:", S_UsedXXL.toString()); + str_usedXXL = S_UsedXXL.toString(); + + txt_balXXL.setText(str_usedXXL); + } + + Integer allotedS_int=Integer.parseInt(str_allotedS); + Integer allotedM_int=Integer.parseInt(str_allotedM); + Integer allotedL_int=Integer.parseInt(str_allotedL); + Integer allotedXL_int=Integer.parseInt(str_allotedXL); + Integer allotedXXL_int=Integer.parseInt(str_allotedXXL); + + Integer TotalAlloted_Int=allotedS_int+allotedM_int+allotedL_int+allotedXL_int+allotedXXL_int; + Log.i("tag","TotalAlloted_Int="+TotalAlloted_Int); + txt_assignedTotal.setText(TotalAlloted_Int.toString()); + + + Integer UsedS_Int=Integer.parseInt(str_usedS); + Integer UsedM_Int=Integer.parseInt(str_usedM); + Integer UsedL_Int=Integer.parseInt(str_usedL); + Integer UsedXL_Int=Integer.parseInt(str_usedXL); + Integer UsedXXL_Int=Integer.parseInt(str_usedXXL); + + Integer TotalUsed_Int=UsedS_Int+UsedM_Int+UsedL_Int+UsedXL_Int+UsedXXL_Int; + Log.i("tag","TotalUsed_Int="+TotalUsed_Int); + txt_balTotal.setText(TotalUsed_Int.toString()); + } + + else{ + Toast.makeText(TShirtPaidActivity.this,"There is no tshirt",Toast.LENGTH_LONG).show(); + } + + + } + + progressDialog.dismiss(); + + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapObject getAssignedTShirtList() { + String METHOD_NAME = "GetAssignedTshirtlist"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetAssignedTshirtlist"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + + + + + + request.addProperty("ManagerId",str_MangerID); + //users.ad + //request.add + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + Log.d("soapresponse1xxxxFees",envelope.getResponse().toString()); + + + SoapObject response = (SoapObject) envelope.getResponse(); + Log.e("soapresponseyyyyyyyFees",response.toString()); + + //return null; + + return response; + + } + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + + } + + + + + + + + + @Override + protected void onResume() { + super.onResume(); + + // register connection status listener + MyApplication.getInstance().setConnectivityListener(this); + } + + @Override + public void onNetworkConnectionChanged(boolean isConnected) { + showSnack(isConnected); + } + + private void showSnack(boolean isConnected) { + + if (!isConnected) { + + AlertDialog.Builder adb = new AlertDialog.Builder(TShirtPaidActivity.this); + //adb.setView(alertDialogView); + + adb.setTitle("Sorry! Not connected to the internet"); + + adb.setIcon(android.R.drawable.ic_dialog_alert); + + adb.setPositiveButton("OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + + adb.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + //startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); + } + }); + + adb.setCancelable(true); + adb.show(); + } + +/* String message; + int color; + if (isConnected) { + message = "Good! Connected to Internet"; + color = Color.WHITE; + } else { + message = "Sorry! Not connected to internet"; + color = Color.RED; + } + + Snackbar snackbar = Snackbar + .make(findViewById(R.id.coordinator_layout), message, Snackbar.LENGTH_LONG); + + View sbView = snackbar.getView(); + TextView textView = (TextView) sbView.findViewById(android.support.design.R.id.snackbar_text); + textView.setTextColor(color); + snackbar.show();*/ + } + + + + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.menu_main, menu); + MenuItem action_editProfile = menu.findItem(R.id.action_editProfile); + action_editProfile.setVisible(false); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + + if (id == android.R.id.home) { + Intent ittFeesPaidToHome = new Intent(TShirtPaidActivity.this ,PMHomeActivity.class); + startActivity(ittFeesPaidToHome); + return true; + } + + + if (id == R.id.action_logout) { + Intent ittFeesToLogin = new Intent(TShirtPaidActivity.this ,LoginActivity.class); + startActivity(ittFeesToLogin); + return true; + } + + return super.onOptionsItemSelected(item); + } +} diff --git a/app/src/main/java/com/leadcampusapp/TShirtPaidAdapter.java b/app/src/main/java/com/leadcampusapp/TShirtPaidAdapter.java new file mode 100644 index 0000000..d06831c --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/TShirtPaidAdapter.java @@ -0,0 +1,35 @@ +package com.leadcampusapp; + +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.fragment.app.FragmentStatePagerAdapter; +import androidx.appcompat.app.AppCompatActivity; + +public class TShirtPaidAdapter extends FragmentStatePagerAdapter { + int mNumOfTabs; + + public TShirtPaidAdapter(FragmentManager fm, int NumOfTabs) { + super(fm); + this.mNumOfTabs = NumOfTabs; + } + + @Override + public Fragment getItem(int position) { + + switch (position) { + case 0: + FeesUnpaidFragment tab1 = new FeesUnpaidFragment(); + return tab1; + case 1: + ChartThemeProjCountFragment tab3 = new ChartThemeProjCountFragment(); + return tab3; + default: + return null; + } + } + + @Override + public int getCount() { + return mNumOfTabs; + } +} \ No newline at end of file diff --git a/app/src/main/java/com/leadcampusapp/TShirtPaidFragment.java b/app/src/main/java/com/leadcampusapp/TShirtPaidFragment.java new file mode 100644 index 0000000..ac00452 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/TShirtPaidFragment.java @@ -0,0 +1,588 @@ +package com.leadcampusapp; /** + * Created by Admin on 20-07-2018. + */ + +import android.app.AlertDialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.SharedPreferences; +import android.os.AsyncTask; +import android.os.Bundle; +import androidx.fragment.app.Fragment; +import androidx.core.content.ContextCompat; +import androidx.appcompat.widget.AppCompatSpinner; +import android.text.Editable; +import android.text.TextWatcher; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.EditText; +import android.widget.ListView; +import android.widget.TextView; +import android.widget.Toast; + +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.util.ArrayList; +import java.util.LinkedHashSet; + +//import com.android.sripad.leadnew_22_6_2018.R; + +public class TShirtPaidFragment extends Fragment +{ + private ListView lview; + private ArrayList paidList; + private TShirtPaidAckAdapter adapter; + private SharedPreferences shardprefPM_obj; + private String str_MangerID; + private static final String PREFBook_PM= "prefbook_pm"; + private static final String PrefID_PMID = "prefid_pmid"; + private LinkedHashSet collegeNameLst; + private ArrayList collegeNameArrLst; + private AppCompatSpinner spin_college; + private ArrayList originalList = null; + private ProgressDialog progressDialog; + private EditText etSearch; + private TextView txt_studRegistered,txt_feesPaidStudents; + private TextView txt_actualTotalCounts; + private int counter=0; + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + + View view=inflater.inflate(R.layout.frag_tshirt_paid_acknowledged, container, false); + + lview = (NonScrollListView) view.findViewById(R.id.listview_fees_paid_acknowledged); + txt_actualTotalCounts = (TextView) view.findViewById(R.id.txt_actualTotalCount); + + paidList = new ArrayList(); + adapter = new TShirtPaidAckAdapter(getActivity(),paidList); + lview.setAdapter(adapter); + + + + shardprefPM_obj = getActivity().getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MangerID = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + Log.d("str_MangerID:",str_MangerID); + + collegeNameLst = new LinkedHashSet(); + collegeNameLst.add("Select College"); + collegeNameArrLst = new ArrayList(); + + spin_college = (AppCompatSpinner) view.findViewById(R.id.spin_college); + + txt_studRegistered = (TextView) view.findViewById(R.id.txt_studRegistered); + txt_feesPaidStudents = (TextView) view.findViewById(R.id.txt_feesPaidStudents); + + // populateGetFeesRegistered(); + + populateList(); + + etSearch = (EditText) view.findViewById(R.id.etSearch); + etSearch.addTextChangedListener(new TextWatcher() { + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + // Call back the Adapter with current character to Filter + String selectedCollege = spin_college.getSelectedItem().toString(); + + if(!selectedCollege.equals("Select College")) { + String text = etSearch.getText().toString(); + adapter.filter(text, originalList, selectedCollege); + }else{ + String text = etSearch.getText().toString(); + adapter.filter(text, originalList, null); + } + + } + + @Override + public void beforeTextChanged(CharSequence s, int start, int count,int after) { + } + + @Override + public void afterTextChanged(Editable s) { + //adapter.getFilter().filter(s.toString()); + /* String text = etSearch.getText().toString().toLowerCase(Locale.getDefault()); + adapter.filter(text,originalList);*/ + + String text2 = s.toString(); + if(text2.equals("")) { + String text = spin_college.getSelectedItem().toString(); + if(text!="Select College") { + adapter.filter(text, originalList, null); + } + } + } + }); + + spin_college.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView parent, View view, int position, long id) { + /* String collegeName = spin_college.getSelectedItem().toString(); + adapter.filter(collegeName,originalList);*/ + + String collegeName = spin_college.getSelectedItem().toString(); + //adapter.filter(collegeName, originalList); + if(!collegeName.equals("Select College")) { + adapter.filter(collegeName, originalList,null); + }else{ + counter++; + collegeName = ""; + adapter.filter(collegeName, originalList,null); + + /* if(counter!=1){ + collegeName = ""; + adapter.filter(collegeName, originalList); + }*/ + } + Log.d("tag","Totalcountssssonselectchange:"+ String.valueOf(lview.getCount())); + txt_actualTotalCounts.setText(String.valueOf(lview.getCount())); + } + + @Override + public void onNothingSelected(AdapterView parent) { + + } + }); + + + + // showActivity(); + return view; + } + + private void populateGetFeesRegistered() { + GetFeesRegistered getFeesRegistered = new GetFeesRegistered(getActivity()); + getFeesRegistered.execute(); + } + + private void populateList() { + + GetSanctionTshirtList getSanctionTshirtList = new GetSanctionTshirtList(getActivity()); + getSanctionTshirtList.execute(); + + } + + public class GetSanctionTshirtList extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + //private ProgressBar progressBar; + + GetSanctionTshirtList (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapObject response = GetSanctionTshirtList(); + + //Log.d("Soap response is",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + progressDialog.setMessage("Loading"); + progressDialog.setProgressStyle(android.R.attr.progressBarStyleSmall); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapObject result) { + + if(result != null){ + SoapPrimitive S_LeadId, S_StudentName, S_TshirtSize, S_CollegeName, S_MobileNo, S_IsFeesPaid, S_Status,S_projectcount, S_RequestedId; + Object O_LeadId, O_StudentName, O_TshirtSize, O_CollegeName, O_MobileNo, O_IsFeesPaid, O_Status, O_projectcount, O_RequestedId; + String str_leadid = null, str_studentName = null, str_TshirtSize = null, str_collegeName = null, str_MobileNo = null, str_IsFeesPaid = null, str_Status = null, str_projectcount = null,str_RequestedId = null; + + for (int i = 0; i < result.getPropertyCount(); i++) { + SoapObject list = (SoapObject) result.getProperty(i); + + //Log.d("DistrictResult", list.toString()); + + O_Status = list.getProperty("Status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) list.getProperty("Status"); + Log.d("Status:", S_Status.toString()); + str_Status = S_Status.toString(); + } + + if (str_Status.equalsIgnoreCase("Success")) { + + O_StudentName = list.getProperty("StudentName"); + if (!O_StudentName.toString().equals("anyType{}") && !O_StudentName.toString().equals(null)) { + S_StudentName = (SoapPrimitive) list.getProperty("StudentName"); + str_studentName = S_StudentName.toString(); + Log.d("StudentNameissss", str_studentName); + } + + O_LeadId = list.getProperty("Lead_id"); + if (!O_LeadId.toString().equals("anyType{}") && !O_LeadId.toString().equals(null)) { + S_LeadId = (SoapPrimitive) list.getProperty("Lead_id"); + str_leadid = S_LeadId.toString(); + Log.d("str_leadidisss", str_leadid); + } + + O_TshirtSize = list.getProperty("TshirtSize"); + if (!O_TshirtSize.toString().equals("anyType{}") && !O_TshirtSize.toString().equals(null)) { + S_TshirtSize = (SoapPrimitive) list.getProperty("TshirtSize"); + Log.d("S_RegistrationDate", S_TshirtSize.toString()); + str_TshirtSize = S_TshirtSize.toString(); + Log.d("str_TshirtSize", str_TshirtSize); + } + + O_CollegeName = list.getProperty("CollegeName"); + if (!O_CollegeName.toString().equals("anyType{}") && !O_CollegeName.toString().equals(null)) { + S_CollegeName = (SoapPrimitive) list.getProperty("CollegeName"); + Log.d("S_CollegeName", S_CollegeName.toString()); + str_collegeName = S_CollegeName.toString(); + Log.d("str_collegeName", str_collegeName); + + collegeNameLst.add(str_collegeName); + + } + if (O_CollegeName.toString().equals("anyType{}") || O_CollegeName.toString().equals(null)) { + str_collegeName = ""; + //collegeNameLst.add(str_collegeName); + } + + O_MobileNo = list.getProperty("MobileNo"); + if (!O_MobileNo.toString().equals("anyType{}") && !O_MobileNo.toString().equals(null)) { + S_MobileNo = (SoapPrimitive) list.getProperty("MobileNo"); + Log.d("S_MobileNo", S_MobileNo.toString()); + str_MobileNo = S_MobileNo.toString(); + } + + O_IsFeesPaid = list.getProperty("isFeePaid"); + if (!O_IsFeesPaid.toString().equals("anyType{}") && !O_IsFeesPaid.toString().equals(null)) { + S_IsFeesPaid = (SoapPrimitive) list.getProperty("isFeePaid"); + Log.d("S_IsFeesPaid", S_IsFeesPaid.toString()); + str_IsFeesPaid = S_IsFeesPaid.toString(); + } + O_projectcount = list.getProperty("projectcount"); + if (!O_projectcount.toString().equals("anyType{}") && !O_projectcount.toString().equals(null)) { + S_projectcount = (SoapPrimitive) list.getProperty("projectcount"); + Log.d("S_projectcount", S_projectcount.toString()); + str_projectcount = S_projectcount.toString(); + } + O_RequestedId = list.getProperty("RequestedId"); + if (!O_RequestedId.toString().equals("anyType{}") && !O_RequestedId.toString().equals(null)) { + S_RequestedId = (SoapPrimitive) list.getProperty("RequestedId"); + Log.d("S_RequestedId", S_RequestedId.toString()); + str_RequestedId = S_RequestedId.toString(); + } + + TshirtPaidModel item = null; + if (!str_collegeName.isEmpty()) { + item = new TshirtPaidModel(str_studentName, str_leadid, str_collegeName, str_MobileNo,str_TshirtSize , str_projectcount, str_RequestedId, str_Status); + paidList.add(item); + } + + + } + + } + + originalList = new ArrayList(); + originalList.addAll(paidList); + + adapter.notifyDataSetChanged(); + + Log.d("Totalcountssss:", String.valueOf(lview.getCount())); + txt_actualTotalCounts.setText(String.valueOf(lview.getCount())); + + initCollegeSpinner(); + } + progressDialog.dismiss(); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapObject GetSanctionTshirtList() { + String METHOD_NAME = "GetSanctionTshirtList"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetSanctionTshirtList"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + request.addProperty("ManagerId",str_MangerID); + //users.ad + //request.add + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + // HttpTransportSE androidHttpTransport = new HttpTransportSE("http://testbed.dfindia.org/leadws/Managerws.asmx?WSDL"); + + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + Log.d("tag","soapresponse1xxxx GetSanctionTshirtList"+envelope.getResponse().toString()); + + + SoapObject response = (SoapObject) envelope.getResponse(); + Log.e("tag","soapresponse GetSanctionTshirtList"+response.toString()); + + //return null; + + return response; + + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + + } + + + private void initCollegeSpinner() { + collegeNameArrLst.addAll(collegeNameLst); + ArrayAdapter dataAdapter2 = new ArrayAdapter(getActivity(), R.layout.simple_spinner_items, collegeNameArrLst); + dataAdapter2.setDropDownViewResource(R.layout.spinnercustomstyle); + // attaching data adapter to spinner + spin_college.setAdapter(dataAdapter2); + //spin_college.setSupportBackgroundTintList(ContextCompat.getColorStateList(getActivity(), R.color.colorWhite)); + + } + + public class GetFeesRegistered extends AsyncTask { + + Context context; + AlertDialog alertDialog; + ProgressDialog progressDialgs; + + //private ProgressBar progressBar; + + GetFeesRegistered (Context ctx){ + context = ctx; + progressDialgs = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapObject response = getFeesRegistered(); + + //Log.d("Soap response is",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + progressDialgs.setMessage("Loading"); + progressDialgs.setProgressStyle(android.R.attr.progressBarStyleSmall); + progressDialgs.setCanceledOnTouchOutside(false); + progressDialgs.show(); + } + + @Override + protected void onPostExecute(SoapObject result) { + + if(result!=null){ + + SoapPrimitive S_TotalRegistrn, S_FeePaiedStudent, S_Status; + Object O_TotalRegistrn, O_FeePaiedStudent, O_Status; + String str_TotalRegistrn = null, str_FeePaiedStudent = null, str_Status = null; + + Log.d("Resultssssiss", result.toString()); + + + for (int i = 0; i < result.getPropertyCount(); i++) { + SoapObject list = (SoapObject) result.getProperty(i); + + //Log.d("DistrictResult", list.toString()); + + O_Status = list.getProperty("Status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) list.getProperty("Status"); + Log.d("Status:", S_Status.toString()); + str_Status = S_Status.toString(); + } + + if (str_Status.equalsIgnoreCase("Success")) { + O_TotalRegistrn = list.getProperty("TotalRegistration"); + if (!O_TotalRegistrn.toString().equals("anyType{}") && !O_TotalRegistrn.toString().equals(null)) { + S_TotalRegistrn = (SoapPrimitive) list.getProperty("TotalRegistration"); + Log.d("TotalRegistration:", S_TotalRegistrn.toString()); + str_TotalRegistrn = S_TotalRegistrn.toString(); + txt_studRegistered.setText(str_TotalRegistrn); + } + + O_FeePaiedStudent = list.getProperty("FeePaiedStudent"); + if (!O_FeePaiedStudent.toString().equals("anyType{}") && !O_FeePaiedStudent.toString().equals(null)) { + S_FeePaiedStudent = (SoapPrimitive) list.getProperty("FeePaiedStudent"); + Log.d("SFeePaiedStudent:", S_FeePaiedStudent.toString()); + str_FeePaiedStudent = S_FeePaiedStudent.toString(); + txt_feesPaidStudents.setText(str_FeePaiedStudent); + } + + + } + } + } + + progressDialgs.dismiss(); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapObject getFeesRegistered() { + String METHOD_NAME = "GetStudntRegAndPaiedStudentconts"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetStudntRegAndPaiedStudentconts"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + request.addProperty("ManagerId",str_MangerID); + //users.ad + //request.add + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + //Log.d("soapresponse1xxxxFees",envelope.getResponse().toString()); + + + SoapObject response = (SoapObject) envelope.getResponse(); + //Log.e("soapresponseyyyyyyyFees",response.toString()); + + //return null; + + return response; + + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + + } + +}//end of fragment class diff --git a/app/src/main/java/com/leadcampusapp/TShirtSizeAdapter.java b/app/src/main/java/com/leadcampusapp/TShirtSizeAdapter.java new file mode 100644 index 0000000..ce5298c --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/TShirtSizeAdapter.java @@ -0,0 +1,317 @@ +package com.leadcampusapp; + +import android.app.Activity; +import android.app.AlertDialog; +import android.app.Dialog; +import android.content.DialogInterface; +import android.content.Intent; +import android.net.Uri; +import android.text.InputType; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.CompoundButton; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; + +import java.util.ArrayList; + + +public class TShirtSizeAdapter extends BaseAdapter{ + + public ArrayList feesUnPaidList; + Activity activity; + EditText userInputDialogEditText; + String str_requestId,str_reson; + + public TShirtSizeAdapter(Activity activity, ArrayList feesUnPaidList) { + super(); + this.activity = activity; + this.feesUnPaidList = feesUnPaidList; + } + + @Override + public int getCount() { + //return projList.size(); + return feesUnPaidList.size(); + } + + @Override + public TShirtSizeModel getItem(int position) { + + //return projList.get(position); + return feesUnPaidList.get(position); + } + + @Override + public long getItemId(int position) { + return position; + } + + class ViewHolder { + TextView mstudName; + TextView mleadId; + TextView mTShirtSize; + TextView mCollegeName; + TextView mPhoneNumber; + TextView mProjectCount; + TextView mRequestedId; + ImageView mReject; + CheckBox mStatus; + LinearLayout ll_requestedId; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + + final ViewHolder holder; + LayoutInflater inflater = activity.getLayoutInflater(); + + if (convertView == null) { + convertView = inflater.inflate(R.layout.tshirt_unpaid_listrow, null); + holder = new ViewHolder(); + + holder.mstudName = (TextView) convertView.findViewById(R.id.txt_studName); + holder.mleadId = (TextView) convertView.findViewById(R.id.txt_leadId); + holder.mTShirtSize = (TextView) convertView.findViewById(R.id.txt_tShirtSize); + holder.mProjectCount = (TextView) convertView.findViewById(R.id.txt_projCount); + holder.mRequestedId = (TextView) convertView.findViewById(R.id.txt_requestedId); + //holder.mRegistrationDate = (TextView) convertView.findViewById(R.id.txt_registeredDateTxt); + holder.mCollegeName = (TextView) convertView.findViewById(R.id.txt_collegeName); + holder.mPhoneNumber = (TextView) convertView.findViewById(R.id.txt_phoneNumber); + holder.ll_requestedId =(LinearLayout) convertView.findViewById(R.id.ll_requestedId); + holder.mReject = (ImageView) convertView.findViewById(R.id.reject); + holder.mStatus = (CheckBox) convertView.findViewById(R.id.check_status); + + convertView.setTag(holder); + } else { + holder = (ViewHolder) convertView.getTag(); + } + + TShirtSizeModel item = feesUnPaidList.get(position); + + if(item.getStudent_name()!=null) { + holder.mstudName.setText(item.getStudent_name().toString()); + } + if(item.getPhone_number()!=null) { + holder.mPhoneNumber.setText(item.getPhone_number().toString()); + } + if(item.getCollege_name()!=null) { + holder.mCollegeName.setText(item.getCollege_name().toString()); + } + if(item.getLead_id()!=null) { + holder.mleadId.setText(item.getLead_id().toString()); + } + if(item.getRequested_id()!=null) { + holder.mRequestedId.setText(item.getRequested_id().toString()); + } + if(item.getTshirt_size()!=null) { + holder.mTShirtSize.setText(item.getTshirt_size().toString()); + } + + holder.mProjectCount.setText(item.getProj_count()); + + holder.ll_requestedId.setVisibility(View.GONE); + + /* if(item.getProj_count()!=null) { + holder.mProjectCount.setText(item.getProj_count()); + }*/ + /*else{ + holder.mRegistrationDate.setText(""); + }*/ + + if(item.getStatus().toString().equals("1")) { + holder.mStatus.setChecked(true); + //holder.mStatus.setSelected(true); + } + if(item.getStatus().toString().equals("0")) { + holder.mStatus.setChecked(false); + //holder.mStatus.setSelected(false); + } + + holder.mPhoneNumber.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(Intent.ACTION_DIAL); + intent.setData(Uri.parse("tel:"+holder.mPhoneNumber.getText().toString())); + v.getContext().startActivity(intent); + } + }); + holder.mReject.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + LayoutInflater layoutInflaterAndroid = LayoutInflater.from(activity); + View mView = layoutInflaterAndroid.inflate(R.layout.pmfund_prompt, null); + AlertDialog.Builder alertDialogBuilderUserInput = new AlertDialog.Builder(activity); + alertDialogBuilderUserInput.setView(mView); + + final TextView headerText = (TextView) mView.findViewById(R.id.textView1); + userInputDialogEditText = (EditText) mView.findViewById(R.id.fundamtPromt_et); + headerText.setText("Enter Reson for T-shirt Reject"); + headerText.setTextSize(14); + str_requestId = holder.mRequestedId.getText().toString(); + // str_reson = userInputDialogEditText.getText().toString(); + userInputDialogEditText.setInputType(InputType.TYPE_CLASS_TEXT); + alertDialogBuilderUserInput + .setCancelable(false) + .setPositiveButton("Send", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialogBox, int id) { + // ToDo get user input here + // userInput[0] =userInputDialogEditText.getText().toString(); + + // TShirtUnpaidFragment.SubmitRejectDetails submitRejectDetails = new TShirtUnpaidFragment.SubmitRejectDetails(activity); + // submitRejectDetails.execute(str_requestId, str_reson); + // Toast.makeText(activity, userInputDialogEditText.getText().toString() + ",," + holder.mleadId.getText().toString(), Toast.LENGTH_LONG).show(); + } + }) + + .setNegativeButton("Cancel", + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialogBox, int id) { + dialogBox.cancel(); + } + }); + + // AlertDialog alertDialogAndroid = alertDialogBuilderUserInput.create(); + //alertDialogAndroid.show(); + AlertDialog alertDialog = alertDialogBuilderUserInput.create(); + alertDialog.show(); + + Button theButton = alertDialog.getButton(DialogInterface.BUTTON_POSITIVE); + theButton.setOnClickListener(new CustomListener(alertDialog)); + } + }); + + /* holder.mStatus.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Log.d("insidelistview","listview clicked"); + notifyDataSetChanged(); + } + });*/ + + //final CheckBox checkboxSelected = holder.mStatus; + final int pos = position; + holder.mStatus.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + Log.d("insidelistview","listview clicked"); + + if(isChecked) { + Log.d("ischhecked","true"); + holder.mStatus.setChecked(true); + //holder.mStatus.setEnabled(true); + feesUnPaidList.get(pos).setStatus("1"); + }else{ + Log.d("ischhecked","false"); + holder.mStatus.setChecked(false); + feesUnPaidList.get(pos).setStatus("0"); + } + //notifyDataSetChanged(); + //holder.mStatus.setChecked(true); + //holder.mStatus.setSelected(true); + + } + }); + + + + + /* Button btn_selectAll; + btn_selectAll = (Button) + btn_selectAll.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Log.d("lview.getCount()iss", String.valueOf(lview.getCount())); + for (int i = 0; i < lview.getCount(); i++) { + View vw = lview.getAdapter().getView(i,null,null); + CheckBox checkBox = (CheckBox) vw.findViewById(R.id.check_status); + Log.d("checkboxstatusissss", String.valueOf(checkBox.isChecked())); + checkBox.setChecked(true); + Log.d("checkboxstatusissss2", String.valueOf(checkBox.isChecked())); + lview.setAdapter(adapter); + adapter.notifyDataSetChanged(); + } + } + });*/ + + + return convertView; + } + class CustomListener implements View.OnClickListener { + private final Dialog dialog; + public CustomListener(Dialog dialog) { + this.dialog = dialog; + } + @Override + public void onClick(View v) { + // put your code here + // String mValue = userInput.getText().toString(); + if(validation()) { + // dialog.dismiss(); + str_reson=userInputDialogEditText.getText().toString(); + TShirtUnpaidFragment.SubmitRejectDetails submitRejectDetails = new TShirtUnpaidFragment.SubmitRejectDetails(activity); + submitRejectDetails.execute(str_requestId, str_reson); + // Toast.makeText(activity, userInputDialogEditText.getText().toString()+","+str_requestId+","+str_reson , Toast.LENGTH_LONG).show(); + + + } + } + } + + public boolean validation(){ + + Boolean bpmcomments=true,bamount=true; + + + if( userInputDialogEditText.length() == 0 ){ + userInputDialogEditText.setError( "Reason field should not be empty!" );bpmcomments=false;} + + if(bpmcomments&&bamount) { + return true; + }else{return false;} + } + + public void filter(String charText,ArrayList feesList,String selectedCollegeName) { + //charText = charText.toLowerCase(Locale.getDefault()); + //Log.d("charTextissss",charText); + this.feesUnPaidList.clear(); + + /* for(FeesUnpaidModel feesUnpaidModel : feesList){ + String stdName = feesUnpaidModel.getStudent_name().toString(); + //Log.d("StudeNameissssss",stdName); + }*/ + + if(charText!=null) { + if(feesList!=null) { + if (charText.isEmpty() || charText.length() == 0) { + this.feesUnPaidList.addAll(feesList); + } else { + for (TShirtSizeModel wp : feesList) { + //Log.d("GetCollegeNameissss",wp.getCollege_name().toLowerCase((Locale.getDefault()))); + /* if (wp.getCollege_name().toLowerCase(Locale.getDefault()).contains(charText) || wp.getLead_id().toLowerCase(Locale.getDefault()).contains(charText) || wp.getPhone_number().toLowerCase(Locale.getDefault()).contains(charText) || wp.getStudent_name().toLowerCase(Locale.getDefault()).contains(charText) || wp.getPhone_number().toLowerCase(Locale.getDefault()).contains(charText)) { + this.feesUnPaidList.add(wp); + }*/ + if(selectedCollegeName == null) { + if ((wp.getCollege_name()!=null && wp.getCollege_name().toLowerCase().contains(charText.toLowerCase())) || ( wp.getLead_id()!=null && wp.getLead_id().toLowerCase().contains(charText.toLowerCase())) || ( wp.getPhone_number()!=null && wp.getPhone_number().toLowerCase().contains(charText.toLowerCase())) || ( wp.getStudent_name()!=null && wp.getStudent_name().toLowerCase().contains(charText.toLowerCase()) ) || ( wp.getPhone_number()!=null && wp.getPhone_number().toLowerCase().contains(charText.toLowerCase()))) { + this.feesUnPaidList.add(wp); + } + }else{ + if ((wp.getCollege_name()!=null && wp.getCollege_name().equals(selectedCollegeName)) && ((wp.getCollege_name()!=null && wp.getCollege_name().toLowerCase().contains(charText.toLowerCase())) || (wp.getLead_id()!=null && wp.getLead_id().toLowerCase().contains(charText.toLowerCase())) || (wp.getPhone_number()!=null && wp.getPhone_number().toLowerCase().contains(charText.toLowerCase())) || (wp.getStudent_name()!=null && wp.getStudent_name().toLowerCase().contains(charText.toLowerCase())) || (wp.getPhone_number()!=null && wp.getPhone_number().toLowerCase().contains(charText.toLowerCase())))) { + this.feesUnPaidList.add(wp); + } + } + + } + } + notifyDataSetChanged(); + } + } + } +} diff --git a/app/src/main/java/com/leadcampusapp/TShirtSizeModel.java b/app/src/main/java/com/leadcampusapp/TShirtSizeModel.java new file mode 100644 index 0000000..931a19c --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/TShirtSizeModel.java @@ -0,0 +1,103 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 28-05-2018. + */ + +public class TShirtSizeModel { + private String student_name; + private String lead_id; + private String tshirt_size; + //private String registration_date; + private String college_name; + private String phone_number; + private String status; + private String proj_count; + private String requested_id; + + public String getStudent_name() { + return student_name; + } + + public void setStudent_name(String student_name) { + this.student_name = student_name; + } + + public String getLead_id() { + return lead_id; + } + + public void setLead_id(String lead_id) { + this.lead_id = lead_id; + } + +/* public String getRegistration_date() { + return registration_date; + } + + public void setRegistration_date(String registration_date) { + this.registration_date = registration_date; + }*/ + + public String getCollege_name() { + return college_name; + } + + public void setCollege_name(String college_name) { + this.college_name = college_name; + } + + public String getPhone_number() { + return phone_number; + } + + public void setPhone_number(String phone_number) { + this.phone_number = phone_number; + } + + public String getStatus() { + return status; + } + + public String getTshirt_size() { + return tshirt_size; + } + + public void setTshirt_size(String tshirt_size) { + this.tshirt_size = tshirt_size; + } + + public String getProj_count() { + return proj_count; + } + + public void setProj_count(String proj_count) { + this.proj_count = proj_count; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getRequested_id() { + return requested_id; + } + + public void setRequested_id(String requested_id) { + this.requested_id = requested_id; + } + + //public TShirtUnpaidModel(String student_name, String lead_id, String registration_date, String college_name, String phone_number, String status) { + public TShirtSizeModel(String student_name, String lead_id, String tshirt_size, String college_name, String phone_number, String status, String proj_count, String requestedId) { + this.student_name = student_name; + this.lead_id = lead_id; + //this.registration_date = registration_date; + this.tshirt_size = tshirt_size; + this.college_name = college_name; + this.phone_number = phone_number; + this.status = status; + this.proj_count = proj_count; + this.requested_id = requestedId; + + } +} diff --git a/app/src/main/java/com/leadcampusapp/TShirtUnpaidAdapter.java b/app/src/main/java/com/leadcampusapp/TShirtUnpaidAdapter.java new file mode 100644 index 0000000..a924114 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/TShirtUnpaidAdapter.java @@ -0,0 +1,325 @@ +package com.leadcampusapp; + +import android.app.Activity; +import android.app.AlertDialog; +import android.app.Dialog; +import android.content.DialogInterface; +import android.content.Intent; +import android.graphics.Color; +import android.graphics.PorterDuff; +import android.graphics.drawable.Drawable; +import android.net.Uri; +import android.text.InputType; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.CompoundButton; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.RatingBar; +import android.widget.TextView; +import android.widget.Toast; + +import java.util.ArrayList; +import java.util.Locale; + +//import com.android.sripad.leadnew_22_6_2018.R; + +/** + * Created by Admin on 28-05-2018. + */ + +public class TShirtUnpaidAdapter extends BaseAdapter{ + + public ArrayList feesUnPaidList; + Activity activity; + EditText userInputDialogEditText; + String str_requestId,str_reson; + + public TShirtUnpaidAdapter(Activity activity, ArrayList feesUnPaidList) { + super(); + this.activity = activity; + this.feesUnPaidList = feesUnPaidList; + } + + @Override + public int getCount() { + //return projList.size(); + return feesUnPaidList.size(); + } + + @Override + public TShirtUnpaidModel getItem(int position) { + + //return projList.get(position); + return feesUnPaidList.get(position); + } + + @Override + public long getItemId(int position) { + return position; + } + + class ViewHolder { + TextView mstudName; + TextView mleadId; + TextView mTShirtSize; + TextView mCollegeName; + TextView mPhoneNumber; + TextView mProjectCount; + TextView mRequestedId; + ImageView mReject; + CheckBox mStatus; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + + final ViewHolder holder; + final String[] userInput = new String[1]; + + LayoutInflater inflater = activity.getLayoutInflater(); + + if (convertView == null) { + convertView = inflater.inflate(R.layout.tshirt_unpaid_listrow, null); + holder = new ViewHolder(); + + holder.mstudName = (TextView) convertView.findViewById(R.id.txt_studName); + holder.mleadId = (TextView) convertView.findViewById(R.id.txt_leadId); + holder.mTShirtSize = (TextView) convertView.findViewById(R.id.txt_tShirtSize); + holder.mProjectCount = (TextView) convertView.findViewById(R.id.txt_projCount); + holder.mRequestedId = (TextView) convertView.findViewById(R.id.txt_requestedId); + holder.mReject = (ImageView) convertView.findViewById(R.id.reject); + holder.mCollegeName = (TextView) convertView.findViewById(R.id.txt_collegeName); + holder.mPhoneNumber = (TextView) convertView.findViewById(R.id.txt_phoneNumber); + holder.mStatus = (CheckBox) convertView.findViewById(R.id.check_status); + + convertView.setTag(holder); + } else { + holder = (ViewHolder) convertView.getTag(); + } + + TShirtUnpaidModel item = feesUnPaidList.get(position); + + if(item.getStudent_name()!=null) { + holder.mstudName.setText(item.getStudent_name().toString()); + } + if(item.getPhone_number()!=null) { + holder.mPhoneNumber.setText(item.getPhone_number().toString()); + } + if(item.getCollege_name()!=null) { + holder.mCollegeName.setText(item.getCollege_name().toString()); + } + if(item.getLead_id()!=null) { + holder.mleadId.setText(item.getLead_id().toString()); + } + if(item.getRequested_id()!=null) { + holder.mRequestedId.setText(item.getRequested_id().toString()); + } + if(item.getTshirt_size()!=null) { + holder.mTShirtSize.setText(item.getTshirt_size().toString()); + } + + holder.mProjectCount.setText(item.getProj_count()); + + holder.mRequestedId.setVisibility(View.INVISIBLE); + + /* if(item.getProj_count()!=null) { + holder.mProjectCount.setText(item.getProj_count()); + }*/ + /*else{ + holder.mRegistrationDate.setText(""); + }*/ + + if(item.getStatus().toString().equals("1")) { + holder.mStatus.setChecked(true); + //holder.mStatus.setSelected(true); + } + if(item.getStatus().toString().equals("0")) { + holder.mStatus.setChecked(false); + //holder.mStatus.setSelected(false); + } + + holder.mPhoneNumber.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(Intent.ACTION_DIAL); + intent.setData(Uri.parse("tel:"+holder.mPhoneNumber.getText().toString())); + v.getContext().startActivity(intent); + } + }); + holder.mReject.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + LayoutInflater layoutInflaterAndroid = LayoutInflater.from(activity); + View mView = layoutInflaterAndroid.inflate(R.layout.pmfund_prompt, null); + AlertDialog.Builder alertDialogBuilderUserInput = new AlertDialog.Builder(activity); + alertDialogBuilderUserInput.setView(mView); + + final TextView headerText = (TextView) mView.findViewById(R.id.textView1); + userInputDialogEditText = (EditText) mView.findViewById(R.id.fundamtPromt_et); + headerText.setText("Enter Reson for T-shirt Reject"); + headerText.setTextSize(14); + str_requestId = holder.mRequestedId.getText().toString(); + // str_reson = userInputDialogEditText.getText().toString(); + userInputDialogEditText.setInputType(InputType.TYPE_CLASS_TEXT); + alertDialogBuilderUserInput + .setCancelable(false) + .setPositiveButton("Send", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialogBox, int id) { + // ToDo get user input here + // userInput[0] =userInputDialogEditText.getText().toString(); + + // TShirtUnpaidFragment.SubmitRejectDetails submitRejectDetails = new TShirtUnpaidFragment.SubmitRejectDetails(activity); + // submitRejectDetails.execute(str_requestId, str_reson); + // Toast.makeText(activity, userInputDialogEditText.getText().toString() + ",," + holder.mleadId.getText().toString(), Toast.LENGTH_LONG).show(); + } + }) + + .setNegativeButton("Cancel", + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialogBox, int id) { + dialogBox.cancel(); + } + }); + + // AlertDialog alertDialogAndroid = alertDialogBuilderUserInput.create(); + //alertDialogAndroid.show(); + AlertDialog alertDialog = alertDialogBuilderUserInput.create(); + alertDialog.show(); + + Button theButton = alertDialog.getButton(DialogInterface.BUTTON_POSITIVE); + theButton.setOnClickListener(new CustomListener(alertDialog)); + } + }); + + + /* holder.mStatus.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Log.d("insidelistview","listview clicked"); + notifyDataSetChanged(); + } + });*/ + + //final CheckBox checkboxSelected = holder.mStatus; + final int pos = position; + holder.mStatus.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + Log.d("insidelistview","listview clicked"); + + if(isChecked) { + Log.d("ischhecked","true"); + holder.mStatus.setChecked(true); + //holder.mStatus.setEnabled(true); + feesUnPaidList.get(pos).setStatus("1"); + }else{ + Log.d("ischhecked","false"); + holder.mStatus.setChecked(false); + feesUnPaidList.get(pos).setStatus("0"); + } + //notifyDataSetChanged(); + //holder.mStatus.setChecked(true); + //holder.mStatus.setSelected(true); + + } + }); + + + + + /* Button btn_selectAll; + btn_selectAll = (Button) + btn_selectAll.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Log.d("lview.getCount()iss", String.valueOf(lview.getCount())); + for (int i = 0; i < lview.getCount(); i++) { + View vw = lview.getAdapter().getView(i,null,null); + CheckBox checkBox = (CheckBox) vw.findViewById(R.id.check_status); + Log.d("checkboxstatusissss", String.valueOf(checkBox.isChecked())); + checkBox.setChecked(true); + Log.d("checkboxstatusissss2", String.valueOf(checkBox.isChecked())); + lview.setAdapter(adapter); + adapter.notifyDataSetChanged(); + } + } + });*/ + + + return convertView; + } + class CustomListener implements View.OnClickListener { + private final Dialog dialog; + public CustomListener(Dialog dialog) { + this.dialog = dialog; + } + @Override + public void onClick(View v) { + // put your code here + // String mValue = userInput.getText().toString(); + if(validation()) { + // dialog.dismiss(); + str_reson=userInputDialogEditText.getText().toString(); + TShirtUnpaidFragment.SubmitRejectDetails submitRejectDetails = new TShirtUnpaidFragment.SubmitRejectDetails(activity); + submitRejectDetails.execute(str_requestId, str_reson); + // Toast.makeText(activity, userInputDialogEditText.getText().toString()+","+str_requestId+","+str_reson , Toast.LENGTH_LONG).show(); + + + } + } + } + public boolean validation(){ + + Boolean bpmcomments=true,bamount=true; + + + if( userInputDialogEditText.length() == 0 ){ + userInputDialogEditText.setError( "Reason field should not be empty!" );bpmcomments=false;} + + if(bpmcomments&&bamount) { + return true; + }else{return false;} + } + public void filter(String charText,ArrayList feesList,String selectedCollegeName) { + //charText = charText.toLowerCase(Locale.getDefault()); + //Log.d("charTextissss",charText); + this.feesUnPaidList.clear(); + + /* for(FeesUnpaidModel feesUnpaidModel : feesList){ + String stdName = feesUnpaidModel.getStudent_name().toString(); + //Log.d("StudeNameissssss",stdName); + }*/ + + if(charText!=null) { + if(feesList!=null) { + if (charText.isEmpty() || charText.length() == 0) { + this.feesUnPaidList.addAll(feesList); + } else { + for (TShirtUnpaidModel wp : feesList) { + //Log.d("GetCollegeNameissss",wp.getCollege_name().toLowerCase((Locale.getDefault()))); + /* if (wp.getCollege_name().toLowerCase(Locale.getDefault()).contains(charText) || wp.getLead_id().toLowerCase(Locale.getDefault()).contains(charText) || wp.getPhone_number().toLowerCase(Locale.getDefault()).contains(charText) || wp.getStudent_name().toLowerCase(Locale.getDefault()).contains(charText) || wp.getPhone_number().toLowerCase(Locale.getDefault()).contains(charText)) { + this.feesUnPaidList.add(wp); + }*/ + if(selectedCollegeName == null) { + if ((wp.getCollege_name()!=null && wp.getCollege_name().toLowerCase().contains(charText.toLowerCase())) || ( wp.getLead_id()!=null && wp.getLead_id().toLowerCase().contains(charText.toLowerCase())) || ( wp.getPhone_number()!=null && wp.getPhone_number().toLowerCase().contains(charText.toLowerCase())) || ( wp.getStudent_name()!=null && wp.getStudent_name().toLowerCase().contains(charText.toLowerCase()) ) || ( wp.getPhone_number()!=null && wp.getPhone_number().toLowerCase().contains(charText.toLowerCase()))) { + this.feesUnPaidList.add(wp); + } + }else{ + if ((wp.getCollege_name()!=null && wp.getCollege_name().equals(selectedCollegeName)) && ((wp.getCollege_name()!=null && wp.getCollege_name().toLowerCase().contains(charText.toLowerCase())) || (wp.getLead_id()!=null && wp.getLead_id().toLowerCase().contains(charText.toLowerCase())) || (wp.getPhone_number()!=null && wp.getPhone_number().toLowerCase().contains(charText.toLowerCase())) || (wp.getStudent_name()!=null && wp.getStudent_name().toLowerCase().contains(charText.toLowerCase())) || (wp.getPhone_number()!=null && wp.getPhone_number().toLowerCase().contains(charText.toLowerCase())))) { + this.feesUnPaidList.add(wp); + } + } + + } + } + notifyDataSetChanged(); + } + } + } +} diff --git a/app/src/main/java/com/leadcampusapp/TShirtUnpaidFragment.java b/app/src/main/java/com/leadcampusapp/TShirtUnpaidFragment.java new file mode 100644 index 0000000..28bab73 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/TShirtUnpaidFragment.java @@ -0,0 +1,2838 @@ +package com.leadcampusapp; + +import android.app.AlertDialog; +import android.app.ProgressDialog; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.AsyncTask; +import android.os.Bundle; +import androidx.fragment.app.Fragment; +import androidx.core.content.ContextCompat; +import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; +import androidx.appcompat.widget.AppCompatSpinner; + +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.CompoundButton; +import android.widget.EditText; +import android.widget.LinearLayout; +import android.widget.ListView; +import android.widget.TextView; +import android.widget.Toast; + +import org.json.JSONObject; +import org.ksoap2.SoapEnvelope; +import org.ksoap2.serialization.SoapObject; +import org.ksoap2.serialization.SoapPrimitive; +import org.ksoap2.serialization.SoapSerializationEnvelope; +import org.ksoap2.transport.HttpTransportSE; + +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.List; + +//import com.android.sripad.leadnew_22_6_2018.R; + +public class TShirtUnpaidFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener +{ + int count=0; + + private ArrayList feesList; + private ArrayList sizeSList; + private ArrayList sizeMList; + private ArrayList sizeLList; + private ArrayList sizeXLList; + private ArrayList sizeXXLList; + private View view; + private boolean isCompletedflag=false; + private int projectStatusIcon; + private TShirtUnpaidAdapter adapter; + private TShirtSizeAdapter adapterSize; + + public static final String PREFBook_Stud= "prefbook_stud"; //sharedpreference Book + public static final String PrefID_RegID = "prefid_regid"; // + public static final String PrefID_SName = "prefid_sname"; // + public static final String PrefID_PM_SName = "prefid_pmsname"; // + public static final String PrefID_SLeadID = "prefid_sleadid"; // + public static final String PrefID_PM_SEmailID = "prefid_pm_semailid"; // + public static final String PrefID_SCellNo = "prefid_scellno"; // + + private SharedPreferences shardpref_S_obj; + private String str_leadId,str_RegistrationId; + private ProgressDialog progressDialog; + + private EditText etSearch; + + private ListView lview; + private ArrayList originalList = null; + + private int countProposed=0; + private int countReapply=0; + private int countRequestForCompletion=0; + private int countApproved=0; + private int countRejected=0; + private int countCompleted=0; + + private Button btn_generateReport; + public static final String PrefID_PMID = "prefid_pmid"; // + public static final String PREFBook_PM= "prefbook_pm"; + SharedPreferences shardprefPM_obj; + public String str_MangerID; + public static String str_MdID; + private AppCompatSpinner spin_college; + private TextView txt_selectAll; + private LinkedHashSet collegeNameLst; + private ArrayList collegeNameArrLst; + + private LinkedHashSet tshirtSizeLst; + private ArrayList tshirtSizeArrLst; + + private Button btn_selectAll,btn_selectNone,btn_submit; + private CheckBox chk_selectAll; + private static Context context; + private ArrayList arrLstLeadIds; + private String str_leadIdOverall=""; + + private static ArrayList arrLstLeadIds_static; + private static ArrayList arrLstreqId_static; + //private String + private int counts=0; + private int counter=0; + private ArrayList arrayLeadId; + private ArrayList arrLstreqId; + private ArrayList arrLstSize; + + private String str_requestedIdOverall=""; + private ArrayList arrayreqId; + private SwipeRefreshLayout swipeLayout; + private TextView txt_actualTotalCounts; + + int SCount,MCount,LCount,XLCount,XXLCount; + TextView textCartTSCount,textCartTMCount,textCartTLCount,textCartTXLCount,textCartTXXLCount; + LinearLayout small_tshirt,medium_tshirt,large_tshirt,xlarge_tshirt,xxlarge_tshirt; + + String SizeSelected,RequestIdSelected; + String str_allotedS = null, str_allotedM = null, str_allotedL = null, str_allotedXL = null, str_allotedXXL = null, str_usedS = null, str_usedM = null, str_usedL = null, str_usedXL = null, str_usedXXL = null, str_status = null; + boolean smallBoolean=false,mediumBoolean=false,largeBoolean=false,feesBoolean=false,XlargeBoolean=false,XXlargeBoolean=false; + Integer allotedS_int; + Integer allotedM_int; + Integer allotedL_int; + Integer allotedXL_int; + Integer allotedXXL_int; + Integer UsedS_Int; + Integer UsedM_Int; + Integer UsedL_Int; + Integer UsedXL_Int; + Integer UsedXXL_Int; + + static Integer finalCount_S,finalCount_M,finalCount_L,finalCount_XL,finalCount_XXL; + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + + view=inflater.inflate(R.layout.frag_tshirt_unpaid, container, false); + + swipeLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipe_container); + swipeLayout.setOnRefreshListener(this); + /* swipeLayout.setColorScheme(android.R.color.holo_blue_bright, + android.R.color.holo_green_light, + android.R.color.holo_orange_light, + android.R.color.holo_red_light);*/ + textCartTSCount = (TextView) view.findViewById(R.id.cart_badge_S); + textCartTMCount=(TextView) view.findViewById(R.id.cart_badge_M); + textCartTLCount=(TextView) view.findViewById(R.id.cart_badge_L); + textCartTXLCount=(TextView) view.findViewById(R.id.cart_badge_XL); + textCartTXXLCount=(TextView) view.findViewById(R.id.cart_badge_XXL); + txt_actualTotalCounts = (TextView) view.findViewById(R.id.txt_actualTotalCount); + + small_tshirt = (LinearLayout) view.findViewById(R.id.small_tshirt); + medium_tshirt = (LinearLayout) view.findViewById(R.id.medium_tshirt); + large_tshirt = (LinearLayout) view.findViewById(R.id.large_tshirt); + xlarge_tshirt = (LinearLayout) view.findViewById(R.id.x_large_tshirt); + xxlarge_tshirt = (LinearLayout) view.findViewById(R.id.xx_large_tshirt); + + initializeviews(); + + if (SCount == 0) { + if (textCartTSCount.getVisibility() != View.GONE) { + textCartTSCount.setVisibility(View.GONE); + } + } + if (MCount == 0) { + if (textCartTMCount.getVisibility() != View.GONE) { + textCartTMCount.setVisibility(View.GONE); + } + } + if (LCount == 0) { + if (textCartTLCount.getVisibility() != View.GONE) { + textCartTLCount.setVisibility(View.GONE); + } + } + if (XLCount == 0) { + if (textCartTXLCount.getVisibility() != View.GONE) { + textCartTXLCount.setVisibility(View.GONE); + } + } + if (XXLCount == 0) { + if (textCartTXXLCount.getVisibility() != View.GONE) { + textCartTXXLCount.setVisibility(View.GONE); + } + } + + GetAssignedTShirtlist getAssignedTShirtlist = new GetAssignedTShirtlist(context); + getAssignedTShirtlist.execute(); + /*lview = (NonScrollListView) view.findViewById(R.id.listview_feesUnpaid); + + arrLstLeadIds = new ArrayList(); + + feesList = new ArrayList(); + adapter = new FeesUnpaidAdapter(getActivity(),feesList); + lview.setAdapter(adapter); + + arrayLeadId = new ArrayList(); + + + shardprefPM_obj= getActivity().getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MangerID = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + Log.d("str_MangerID:",str_MangerID); + + collegeNameLst = new LinkedHashSet(); + collegeNameLst.add("Select College"); + collegeNameArrLst = new ArrayList(); + + spin_college = (AppCompatSpinner) view.findViewById(R.id.spin_college); + + btn_submit = (Button) view.findViewById(R.id.btn_submit); + + chk_selectAll = (CheckBox) view.findViewById(R.id.chk_selectAll); + + txt_selectAll = (TextView) view.findViewById(R.id.txt_selectAll); + + populateList(); + + etSearch = (EditText) view.findViewById(R.id.etSearch); + etSearch.addTextChangedListener(new TextWatcher() { + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + String selectedCollege = spin_college.getSelectedItem().toString(); + + if(!selectedCollege.equals("Select College")) { + String text = etSearch.getText().toString(); + adapter.filter(text, originalList, selectedCollege); + }else{ + String text = etSearch.getText().toString(); + adapter.filter(text, originalList, null); + } + + } + + @Override + public void beforeTextChanged(CharSequence s, int start, int count,int after) { + } + + @Override + public void afterTextChanged(Editable s) { + String text2 = s.toString(); + if(text2.equals("")) { + String text = spin_college.getSelectedItem().toString(); + if(!text.equals("Select College")) { + adapter.filter(text, originalList,null); + } + } + } + }); + + spin_college.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView parent, View view, int position, long id) { + String collegeName = spin_college.getSelectedItem().toString(); + + chk_selectAll.setChecked(false); + int size = feesList.size(); + for(int i=0;i parent) { + + } + }); + + chk_selectAll.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + + if(isChecked){ + Log.d("Checkedtruesssss","truesssss"); + int size = feesList.size(); + for(int i=0;i(); + arrLstreqId = new ArrayList(); + arrLstSize = new ArrayList(); + arrLstLeadIds_static =new ArrayList<>(); + arrLstreqId_static = new ArrayList<>(); + + feesList = new ArrayList(); + adapter = new TShirtUnpaidAdapter(getActivity(),feesList); + lview.setAdapter(adapter); + + sizeSList = new ArrayList(); + sizeMList = new ArrayList(); + sizeLList = new ArrayList(); + sizeXLList = new ArrayList(); + sizeXXLList = new ArrayList(); + + sizeSList.clear(); + sizeMList.clear(); + sizeLList.clear(); + sizeXLList.clear(); + sizeXXLList.clear(); + SCount=0; + MCount=0; + LCount=0; + XLCount=0; + XXLCount=0; + + arrayLeadId = new ArrayList(); + arrayreqId = new ArrayList(); + + shardprefPM_obj= getActivity().getSharedPreferences(PREFBook_PM, Context.MODE_PRIVATE); + shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MangerID = shardprefPM_obj.getString(PrefID_PMID, "").trim(); + str_MdID=str_MangerID; + Log.d("str_MangerID:",str_MangerID); + + collegeNameLst = new LinkedHashSet(); + collegeNameLst.add("All"); + collegeNameArrLst = new ArrayList(); + + tshirtSizeLst = new LinkedHashSet(); + tshirtSizeArrLst =new ArrayList(); + + spin_college = (AppCompatSpinner) view.findViewById(R.id.spin_college); + + /* btn_selectAll = (Button) view.findViewById(R.id.btn_selectAll); + + btn_selectNone = (Button) view.findViewById(R.id.btn_selectNone);*/ + + btn_submit = (Button) view.findViewById(R.id.btn_submit); + + chk_selectAll = (CheckBox) view.findViewById(R.id.chk_selectAll); + + txt_selectAll = (TextView) view.findViewById(R.id.txt_selectAll); + + txt_selectAll.setVisibility(View.GONE); + chk_selectAll.setVisibility(View.GONE); + //initCollegeSpinner(); + + populateList(); + + + /* etSearch = (EditText) view.findViewById(R.id.etSearch); + etSearch.addTextChangedListener(new TextWatcher() { + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + // Call back the Adapter with current character to Filter + String selectedCollege = spin_college.getSelectedItem().toString(); + + if(!selectedCollege.equals("All")) { + String text = etSearch.getText().toString(); + adapter.filter(text, originalList, selectedCollege); + }else{ + String text = etSearch.getText().toString(); + adapter.filter(text, originalList, null); + } + + } + + @Override + public void beforeTextChanged(CharSequence s, int start, int count,int after) { + } + + @Override + public void afterTextChanged(Editable s) { + //adapter.getFilter().filter(s.toString()); + *//* String text = etSearch.getText().toString().toLowerCase(Locale.getDefault()); + adapter.filter(text,originalList);*//* + + String text2 = s.toString(); + if(text2.equals("")) { + String text = spin_college.getSelectedItem().toString(); + if(!text.equals("All")) { + adapter.filter(text, originalList,null); + } + } + } + });*/ + + spin_college.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView parent, View view, int position, long id) { + String collegeName = spin_college.getSelectedItem().toString(); + //adapter.filter(collegeName, originalList); + /* feesBoolean=true; + chk_selectAll.setChecked(false); + int size = feesList.size(); + for(int i=0;i parent) { + + } + }); + + chk_selectAll.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + + /* if(feesBoolean) { + if (isChecked) { + Log.d("Checkedtruesssss", "truesssss"); + int size = feesList.size(); + for (int i = 0; i < size; i++) { + TShirtUnpaidModel feesUnpaidModel = feesList.get(i); + feesUnpaidModel.setStatus("1"); + } + adapter.notifyDataSetChanged(); + } else { + Log.d("Checkedfalsessssssss", "falsessss"); + int size = feesList.size(); + for (int i = 0; i < size; i++) { + TShirtUnpaidModel feesUnpaidModel = feesList.get(i); + feesUnpaidModel.setStatus("0"); + } + adapter.notifyDataSetChanged(); + } + }*/ + + if(smallBoolean) { + Log.d("smallBoolean", "true"); + if (isChecked) { + Log.d("Checkedtruesssss", "truesssss"); + + int size = sizeSList.size(); + for (int i = 0; i < size; i++) { + TShirtSizeModel tShirtSizeModel = sizeSList.get(i); + tShirtSizeModel.setStatus("1"); + } + adapterSize.notifyDataSetChanged(); + } else{ + Log.d("Checkedfalsessssssss","falsessss"); + int size = sizeSList.size(); + for(int i=0;i0 && counter= allotedS_int) { + s_status = false; + } else { + s_status = true; + } + }else{ + s_status=true; + }*/ + // Toast.makeText(getActivity(), "S-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + + /* if(count_m!=0) { + if (UsedM_Int == allotedM_int) { + m_status = false; + } else if (allotedM_int == 0 || count_m >= allotedM_int || count_m>allotedM_int) { + m_status = false; + } else { + m_status = true; + } + }else{ + m_status=true; + }*/ + + /* if(count_l!=0) { + if (UsedL_Int == allotedL_int) { + l_status = false; + } else if (allotedL_int == 0 || count_l == allotedL_int || count_l>allotedL_int) { + l_status = false; + } else { + l_status = true; + } + }else{ + l_status=true; + } + + if(count_xl!=0) { + if (UsedXL_Int == allotedXL_int) { + xl_status = false; + } else if (allotedXL_int == 0 || count_xl >= allotedXL_int) { + xl_status = false; + } else { + xl_status = true; + } + }else{ + xl_status=true; + } + if(count_xxl!=0) { + if (UsedXXL_Int == allotedXXL_int) { + xxl_status = false; + } else if (allotedXXL_int == 0 || count_xxl >= allotedXXL_int) { + xxl_status = false; + } else { + xxl_status = true; + } + }else{ + xxl_status=true; + }*/ + if( count_s!=0) { + if (count_s <= finalCount_S) { + s_status = true; + } else { + s_status = false; + } + }else { + s_status = true; + } + if(count_m!=0) { + if (count_m <= finalCount_M) { + m_status = true; + } else { + m_status = false; + } + }else { + m_status = true; + } + if(count_l!=0) { + if (count_l <= finalCount_L) { + l_status = true; + } else { + l_status = false; + } + }else { + l_status = true; + } + if(count_xl!=0) { + if (count_xl <= finalCount_XL) { + xl_status = true; + } else { + xl_status = false; + } + }else{ + xl_status = true; + } + if(count_xxl!=0) { + if (count_xxl <= finalCount_XXL) { + xxl_status = true; + } else { + xxl_status = false; + } + }else{ + xxl_status = true; + } + if(s_status==false) { + Toast.makeText(getActivity(), "S-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } + else if (m_status==false) { + Toast.makeText(getActivity(), "M-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } + else if (l_status==false) { + Toast.makeText(getActivity(), "L-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } + else if (xl_status==false) { + Toast.makeText(getActivity(), "XL-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } + else if (xxl_status==false) { + Toast.makeText(getActivity(), "XXL-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } + + if(s_status==true&&m_status==true&&l_status==true&&xl_status==true&&xxl_status==true){ + SubmitAcknowledgements submitAcknowledgements = new SubmitAcknowledgements(getActivity()); + submitAcknowledgements.execute(); + } + + + /* if(count_s > allotedS_int ){ + Toast.makeText(getActivity(), "S-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } + else if( count_m > allotedM_int){ + Toast.makeText(getActivity(), "M-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } + else if ( count_l > allotedL_int) { + Toast.makeText(getActivity(), "L-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } + else if (count_xl > allotedXL_int) { + Toast.makeText(getActivity(), "XL-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } + else if ( count_xxl > allotedXXL_int) { + Toast.makeText(getActivity(), "XXL-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } + else { + if(UsedS_Int == allotedS_int){ + Toast.makeText(getActivity(), "S-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } + else if(UsedM_Int == allotedM_int){ + Toast.makeText(getActivity(), "M-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } + else if (UsedL_Int == allotedL_int) { + Toast.makeText(getActivity(), "L-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } + else if (UsedXL_Int == allotedXL_int) { + Toast.makeText(getActivity(), "XL-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } + else if (UsedXXL_Int == allotedXXL_int) { + Toast.makeText(getActivity(), "XXL-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } + else { + SubmitAcknowledgements submitAcknowledgements = new SubmitAcknowledgements(getActivity()); + submitAcknowledgements.execute(); + } + }*/ + /* if(UsedS_Int == allotedS_int || allotedS_int == 0 || count_s > allotedS_int){ + Toast.makeText(getActivity(), "S-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } + else if(UsedM_Int == allotedM_int || allotedM_int == 0 || count_m > allotedM_int){ + Toast.makeText(getActivity(), "M-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } + else if (UsedL_Int == allotedL_int || allotedL_int == 0 || count_l > allotedL_int) { + Toast.makeText(getActivity(), "L-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } + else if (UsedXL_Int == allotedXL_int || allotedXL_int == 0 || count_xl > allotedXL_int) { + Toast.makeText(getActivity(), "XL-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } + else if (UsedXXL_Int == allotedXXL_int || allotedXXL_int == 0 || count_xxl > allotedXXL_int) { + Toast.makeText(getActivity(), "XXL-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } + else { + SubmitAcknowledgements submitAcknowledgements = new SubmitAcknowledgements(getActivity()); + submitAcknowledgements.execute(); + }*/ + /* if (SizeSelected.equals("S")) { + if (UsedS_Int == allotedS_int || allotedS_int == 0) { + Toast.makeText(getActivity(), "S-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } else { + SubmitAcknowledgements submitAcknowledgements = new SubmitAcknowledgements(getActivity()); + submitAcknowledgements.execute(); + } + } else if (SizeSelected.equals("M")) { + if (UsedM_Int == allotedM_int || allotedM_int == 0) { + Toast.makeText(getActivity(), "M-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } else { + SubmitAcknowledgements submitAcknowledgements = new SubmitAcknowledgements(getActivity()); + submitAcknowledgements.execute(); + } + } else if (SizeSelected.equals("L")) { + if (UsedL_Int == allotedL_int || allotedL_int == 0) { + Toast.makeText(getActivity(), "L-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } else { + SubmitAcknowledgements submitAcknowledgements = new SubmitAcknowledgements(getActivity()); + submitAcknowledgements.execute(); + } + } else if (SizeSelected.equals("XL")) { + if (UsedXL_Int == allotedXL_int || allotedXL_int == 0) { + Toast.makeText(getActivity(), "XL-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } else { + SubmitAcknowledgements submitAcknowledgements = new SubmitAcknowledgements(getActivity()); + submitAcknowledgements.execute(); + } + } else if (SizeSelected.equals("XXL")) { + if (UsedXXL_Int == allotedXXL_int || allotedXXL_int == 0) { + Toast.makeText(getActivity(), "XXL-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } else { + SubmitAcknowledgements submitAcknowledgements = new SubmitAcknowledgements(getActivity()); + submitAcknowledgements.execute(); + } + }*/ + //Toast.makeText(getActivity(),"Selected one student",Toast.LENGTH_LONG).show(); + /* counter = 0; + getActivity().finish(); + startActivity(getActivity().getIntent());*/ + + }else{ + Toast.makeText(getActivity(),"You have not selected any Tshirt",Toast.LENGTH_LONG).show(); + } + + + /*if(lview.getCount()==0 && collegeNameLst.size()==1){ + txt_selectAll.setVisibility(View.GONE); + chk_selectAll.setVisibility(View.GONE); + }else{ + txt_selectAll.setVisibility(View.VISIBLE); + chk_selectAll.setVisibility(View.VISIBLE); + }*/ + } + }); + + + + //lview.setClickable(true); + + /* lview.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Log.d("insidelistview","listview clicked"); + } + });*/ + +/* lview.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView parent, View view, int position, long id) { + Log.d("insidelistview","listview clicked"); + } + + @Override + public void onNothingSelected(AdapterView parent) { + + } + });*/ + + /* lview.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView adapterView, View view, int itemIndex, long l) { + //CheckBox itemCheckbox = (CheckBox) view.findViewById(R.id.check_status); + Log.d("insidelistview","listview clicked"); + } + });*/ + +/* if(spin_college.getSelectedItem()!=null){ + if(collegeNameArrLst.size()==1 && spin_college.getSelectedItem().toString().equals("Select College")){ + txt_selectAll.setVisibility(View.GONE); + chk_selectAll.setVisibility(View.GONE); + } + }else{ + txt_selectAll.setVisibility(View.GONE); + chk_selectAll.setVisibility(View.GONE); + }*/ + + Log.d("countisssss", String.valueOf(lview.getCount())); + + /* if(lview.getCount()==0){ + txt_selectAll.setVisibility(View.GONE); + chk_selectAll.setVisibility(View.GONE); + }else{ + txt_selectAll.setVisibility(View.VISIBLE); + chk_selectAll.setVisibility(View.VISIBLE); + }*/ + + Log.d("ListviewCountissssss", String.valueOf(lview.getCount())); + //txt_actualTotalCount.setText(lview.getCount()); + + + } + + /* private void loadCollegeSpinner() { + + }*/ + + private void populateList() { + + /*GetFeesUnpaid getFeesUnpaid = new GetFeesUnpaid(getActivity()); + getFeesUnpaid.execute();*/ + + GetTShirtUnpaid getTShirtUnpaid = new GetTShirtUnpaid(getActivity()); + getTShirtUnpaid.execute(); + + } + + @Override + public void onRefresh() { + initializeviews(); + swipeLayout.setRefreshing(false); + } + + public class SubmitAcknowledgements extends AsyncTask { + + AlertDialog alertDialog; + //private ProgressBar progressBar; + private ProgressDialog progressDialog; + + SubmitAcknowledgements (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapPrimitive doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapPrimitive response = submitArrLystLeadIds(); + + Log.d("Soap response issssss",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + + progressDialog.setMessage("Submitting"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + progressDialog.dismiss(); + /* if(result!=null) { + Log.i("result=",result.toString()); + SoapPrimitive S_Status; + Object O_Status; + String str_Status = null; + + *//* for (int i = 0; i < result.getPropertyCount(); i++) { + SoapObject list = (SoapObject) result.getProperty(i); + + //Log.d("DistrictResult", list.toString()); + + // O_Status = list.equals("Status"); + O_Status = list.getProperty("Status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) list.getProperty("Status"); + Log.d("Status:", S_Status.toString()); + str_Status = S_Status.toString(); + } + + if (str_Status.equalsIgnoreCase("Success")) { + + // if (result.toString().equals("Success")) { + Toast.makeText(context, "T-Shirt Issued successfully", Toast.LENGTH_LONG).show(); + //counter = 0; + getActivity().finish(); + startActivity(getActivity().getIntent()); + } else { + Toast.makeText(context, "Error occured while saving to database", Toast.LENGTH_LONG).show(); + } + }*//* + O_Status = result.getProperty("Status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) result.getProperty("Status"); + Log.d("S_Status:", S_Status.toString()); + str_Status = S_Status.toString(); + } + + Log.d("tag", "Str_StatusinTShirtPaidActivityisss:" + str_Status); + + + if (str_Status.equalsIgnoreCase("Success")) { + Toast.makeText(context, "T-Shirt Issued successfully", Toast.LENGTH_LONG).show(); + getActivity().finish(); + startActivity(getActivity().getIntent()); + } + }*/ + if(result.toString().equals("Success")){ + Toast.makeText(context,"T-Shirt Issued Successfully",Toast.LENGTH_LONG).show(); + getActivity().finish(); + startActivity(getActivity().getIntent()); + } + else{ + Toast.makeText(context,"Error occured while saving to database",Toast.LENGTH_LONG).show(); + } + //progressBar.setVisibility(View.GONE); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapPrimitive submitArrLystLeadIds() { + String METHOD_NAME = "ApproveForTShirt"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/ApproveForTShirt"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + JSONObject jsonObject = new JSONObject(); + /*for(int k=0;k"); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + // Log.d("soap response1xxxx",envelope.getResponse().toString()); + + + // SoapObject response = (SoapObject) envelope.getResponse(); + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + Log.e("Responseissss",envelope.getResponse().toString()); + + //return null; + + return response; + + }catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + + } + + public class GetAssignedTShirtlist extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + //private ProgressBar progressBar; + + GetAssignedTShirtlist (Context ctx){ + context = ctx; + // progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapObject response = getAssignedTShirtList(); + + //Log.d("Soap response is",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + /* progressDialog.setMessage("Loading"); + progressDialog.setProgressStyle(android.R.attr.progressBarStyleSmall); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show();*/ + } + + @Override + protected void onPostExecute(SoapObject result) { + + Log.d("Resultisssss:",result.toString()); + + + if(result != null) { + + SoapPrimitive S_AllotedS,S_AllotedM, S_AllotedL, S_AllotedXL, S_AllotedXXL,S_UsedS,S_UsedM,S_UsedL,S_UsedXL,S_UsedXXL,S_Status; + Object O_AllotedS, O_AllotedM, O_AllotedL, O_AllotedXL, O_AllotedXXL, O_UsedS, O_UsedM, O_UsedL, O_UsedXL, O_UsedXXL,O_Status; + + + + O_Status = result.getProperty("Status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) result.getProperty("Status"); + Log.d("S_Status:", S_Status.toString()); + str_status = S_Status.toString(); + } + + Log.d("tag","Str_StatusinTShirtPaidActivityisss:"+str_status); + + + if (str_status.equalsIgnoreCase("Success")) { + + O_AllotedS = result.getProperty("AllotedS"); + if (!O_AllotedS.toString().equals("anyType{}") && !O_AllotedS.toString().equals(null)) { + S_AllotedS = (SoapPrimitive) result.getProperty("AllotedS"); + Log.d("S_AllotedS:", S_AllotedS.toString()); + str_allotedS = S_AllotedS.toString(); + + //txt_assignedSmall.setText(str_allotedS); + } + + O_AllotedM = result.getProperty("AllotedM"); + if (!O_AllotedM.toString().equals("anyType{}") && !O_AllotedM.toString().equals(null)) { + S_AllotedM = (SoapPrimitive) result.getProperty("AllotedM"); + Log.d("S_AllotedM:", S_AllotedM.toString()); + str_allotedM = S_AllotedM.toString(); + + //txt_assignedMedium.setText(str_allotedM); + } + + O_AllotedL = result.getProperty("AllotedL"); + if (!O_AllotedL.toString().equals("anyType{}") && !O_AllotedL.toString().equals(null)) { + S_AllotedL = (SoapPrimitive) result.getProperty("AllotedL"); + str_allotedL = S_AllotedL.toString(); + Log.d("S_AllotedL:", str_allotedL); + + //txt_assignedLarge.setText(str_allotedL); + } + + O_AllotedXL = result.getProperty("AllotedXL"); + if (!O_AllotedXL.toString().equals("anyType{}") && !O_AllotedXL.toString().equals(null)) { + S_AllotedXL = (SoapPrimitive) result.getProperty("AllotedXL"); + Log.d("S_AllotedXL", S_AllotedXL.toString()); + str_allotedXL = S_AllotedXL.toString(); + Log.d("str_allotedXL", str_allotedXL); + + //txt_assignedXL.setText(str_allotedXL); + } + + O_AllotedXXL = result.getProperty("AllotedXXL"); + if (!O_AllotedXXL.toString().equals("anyType{}") && !O_AllotedXXL.toString().equals(null)) { + S_AllotedXXL = (SoapPrimitive) result.getProperty("AllotedXXL"); + Log.d("S_AllotedXXL", S_AllotedXXL.toString()); + str_allotedXXL = S_AllotedXXL.toString(); + Log.d("str_allotedXXL", str_allotedXXL); + + // txt_assignedXXL.setText(str_allotedXXL); + } + + + O_UsedS = result.getProperty("UsedS"); + if (!O_UsedS.toString().equals("anyType{}") && !O_UsedS.toString().equals(null)) { + S_UsedS = (SoapPrimitive) result.getProperty("UsedS"); + Log.d("S_UsedS:", S_UsedS.toString()); + str_usedS = S_UsedS.toString(); + + // txt_balSmall.setText(str_usedS); + } + + O_UsedM = result.getProperty("UsedM"); + if (!O_UsedM.toString().equals("anyType{}") && !O_UsedM.toString().equals(null)) { + S_UsedM = (SoapPrimitive) result.getProperty("UsedM"); + Log.d("S_UsedM:", S_UsedM.toString()); + str_usedM = S_UsedM.toString(); + + // txt_balMedium.setText(str_usedM); + } + + O_UsedL = result.getProperty("UsedL"); + if (!O_UsedL.toString().equals("anyType{}") && !O_UsedL.toString().equals(null)) { + S_UsedL = (SoapPrimitive) result.getProperty("UsedL"); + Log.d("S_UsedL:", S_UsedL.toString()); + str_usedL = S_UsedL.toString(); + + // txt_balLarge.setText(str_usedL); + } + + O_UsedXL = result.getProperty("UsedXL"); + if (!O_UsedXL.toString().equals("anyType{}") && !O_UsedXL.toString().equals(null)) { + S_UsedXL = (SoapPrimitive) result.getProperty("UsedXL"); + Log.d("S_UsedXL:", S_UsedXL.toString()); + str_usedXL = S_UsedXL.toString(); + + // txt_balXL.setText(str_usedXL); + } + + O_UsedXXL = result.getProperty("UsedXXL"); + if (!O_UsedXXL.toString().equals("anyType{}") && !O_UsedXXL.toString().equals(null)) { + S_UsedXXL = (SoapPrimitive) result.getProperty("UsedXXL"); + Log.d("S_UsedXXL:", S_UsedXXL.toString()); + str_usedXXL = S_UsedXXL.toString(); + + //txt_balXXL.setText(str_usedXXL); + } + + allotedS_int=Integer.parseInt(str_allotedS); + allotedM_int=Integer.parseInt(str_allotedM); + allotedL_int=Integer.parseInt(str_allotedL); + allotedXL_int=Integer.parseInt(str_allotedXL); + allotedXXL_int=Integer.parseInt(str_allotedXXL); + + Integer TotalAlloted_Int=allotedS_int+allotedM_int+allotedL_int+allotedXL_int+allotedXXL_int; + Log.i("tag","TotalAlloted_Int="+TotalAlloted_Int); + // txt_assignedTotal.setText(TotalAlloted_Int.toString()); + + + UsedS_Int=Integer.parseInt(str_usedS); + UsedM_Int=Integer.parseInt(str_usedM); + UsedL_Int=Integer.parseInt(str_usedL); + UsedXL_Int=Integer.parseInt(str_usedXL); + UsedXXL_Int=Integer.parseInt(str_usedXXL); + + finalCount_S=allotedS_int-UsedS_Int; + finalCount_M=allotedM_int-UsedM_Int; + finalCount_L=allotedL_int-UsedL_Int; + finalCount_XL=allotedXL_int-UsedXL_Int; + finalCount_XXL=allotedXXL_int-UsedXXL_Int; + + Integer TotalUsed_Int=UsedS_Int+UsedM_Int+UsedL_Int+UsedXL_Int+UsedXXL_Int; + Log.i("tag","TotalUsed_Int="+TotalUsed_Int); + // txt_balTotal.setText(TotalUsed_Int.toString()); + } + + else{ + Toast.makeText(getActivity(),"There is no tshirt",Toast.LENGTH_LONG).show(); + } + + + } + +// progressDialog.dismiss(); + + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapObject getAssignedTShirtList() { + String METHOD_NAME = "GetAssignedTshirtlist"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetAssignedTshirtlist"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + + + + + + request.addProperty("ManagerId",str_MangerID); + //users.ad + //request.add + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + Log.d("soapresponse1xxxxFees",envelope.getResponse().toString()); + + + SoapObject response = (SoapObject) envelope.getResponse(); + Log.e("soapresponseyyyyyyyFees",response.toString()); + + //return null; + + return response; + + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(context,"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + + } + public static class SubmitExchangeDetails extends AsyncTask { + + AlertDialog alertDialog; + //private ProgressBar progressBar; + private ProgressDialog progressDialog; + String str_resize; + SubmitExchangeDetails (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapPrimitive doInBackground(String... params) + { + String str_leadId = (String) params[0]; + String str_requestId = (String) params[1]; + String str_size = (String) params[2]; + str_resize = (String) params[3]; + String str_reson = (String) params[4]; + +/* +Integer Scount=0,Mcount=0,Lcount=0,XLcount=0,XXLcount=0; +boolean exchange=true; +if(str_resize.equals("S")){ + Scount=Scount+1; +}else if(str_resize.equals("M")){ + Mcount=Mcount+1; +}else if(str_resize.equals("L")){ + Lcount=Lcount+1; +}else if(str_resize.equals("XL")){ + XLcount=XLcount+1; +}else if(str_resize.equals("XXL")){ + XXLcount=XXLcount+1; +} +*/ + + +/* + if (finalCount_S >= Scount) { + exchange=false; + Toast.makeText(context, "S-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } else if (finalCount_M >= Mcount) { + exchange=false; + Toast.makeText(context, "M-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } else if (finalCount_XL >= XLcount) { + exchange=false; + Toast.makeText(context, "XL-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } else if (finalCount_L >= Lcount) { + exchange=false; + Toast.makeText(context, "L-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } else if (finalCount_XXL >= XXLcount) { + exchange=false; + Toast.makeText(context, "XXL-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + } else{ + exchange=true; + } + + if(exchange==true) {*/ + SoapPrimitive response = SubmitExchangeDetailsFun(str_leadId, str_requestId, str_size, str_resize, str_reson); + + Log.d("Soap response issssss", response.toString()); + + return response; + /* }else{ + if(isCancelled()){ + } + }*/ + + /*} + else{ + String s="fail"; + SoapPrimitive response="fail"; + + }*/ + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + + progressDialog.setMessage("Submitting"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + progressDialog.dismiss(); + /*if(result!=null) { + Log.i("result=", result.toString()); + SoapPrimitive S_Status; + Object O_Status; + String str_Status = null; + + *//*for (int i = 0; i < result.getPropertyCount(); i++) { + SoapObject list = (SoapObject) result.getProperty(i); + + //Log.d("DistrictResult", list.toString()); + + // O_Status = list.equals("Status"); + O_Status = list.getProperty("Status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) list.getProperty("Status"); + Log.d("Status:", S_Status.toString()); + str_Status = S_Status.toString(); + } + + if (str_Status.equalsIgnoreCase("Success")) { + + // if (result.toString().equals("Success")) { + Toast.makeText(context, "T-Shirt Issued successfully", Toast.LENGTH_LONG).show(); + //counter = 0; + + + } else { + Toast.makeText(context, "Error occured while saving to database", Toast.LENGTH_LONG).show(); + } + }*//* + O_Status = result.getProperty("Status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) result.getProperty("Status"); + Log.d("S_Status:", S_Status.toString()); + str_Status = S_Status.toString(); + } + + Log.d("tag", "Str_StatusinTShirtPaidActivityisss:" + str_Status); + + + if (str_Status.equalsIgnoreCase("Success")) { + Toast.makeText(context, "T-Shirt Exchanged successfully", Toast.LENGTH_LONG).show(); + Intent ittFeesPaidToHome = new Intent(context ,TShirtPaidActivity.class); + context.startActivity(ittFeesPaidToHome); } + }*/ + if(result.toString().equals("Success")){ + Toast.makeText(context,"T-Shirt Exchanged Successfully",Toast.LENGTH_LONG).show(); + Intent ittEditProjToProjStatus = new Intent(context,TShirtPaidActivity.class); + // ittEditProjToProjStatus.putExtra("pageCount",0); + context.startActivity(ittEditProjToProjStatus); + } + else if(result.toString().equals("unable to exchange the t-shirt")){ + Toast.makeText(context, str_resize+"-Size Tshirt is out of stock", Toast.LENGTH_LONG).show(); + Intent ittEditProjToProjStatus = new Intent(context,TShirtPaidActivity.class); + // ittEditProjToProjStatus.putExtra("pageCount",0); + context.startActivity(ittEditProjToProjStatus); + } + else{ + Toast.makeText(context,"Error occured while saving to database",Toast.LENGTH_LONG).show(); + } + //progressBar.setVisibility(View.GONE); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private static SoapPrimitive SubmitExchangeDetailsFun(String str_leadId,String str_requestId, String str_size, String str_resize, String str_reson) { + String METHOD_NAME = "ExchangeForTShirt"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/ExchangeForTShirt"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + JSONObject jsonObject = new JSONObject(); + /* for(int k=0;k"); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + // Log.d("soap response1xxxx",envelope.getResponse().toString()); + + + // SoapObject response = (SoapObject) envelope.getResponse(); + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + Log.e("Responseissss",envelope.getResponse().toString()); + + //return null; + + return response; + + }catch(OutOfMemoryError ex){ + /* getActivity().runOnUiThread(new Runnable() { + public void run() {*/ + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); +// } +// }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + /* getActivity().runOnUiThread(new Runnable() { + public void run() {*/ + Toast.makeText(context,"Web Service Error", Toast.LENGTH_LONG).show(); + /* } + });*/ + } + } + catch(OutOfMemoryError ex){ + /* getActivity().runOnUiThread(new Runnable() { + public void run() {*/ + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + /* } + });*/ + } + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + /* getActivity().runOnUiThread(new Runnable() { + public void run() {*/ + Toast.makeText(context,"Web Service Error", Toast.LENGTH_LONG).show(); + /* } + });*/ + } + return null; + + } + public static class SubmitRejectDetails extends AsyncTask { + + AlertDialog alertDialog; + // private ProgressBar progressBar; + + SubmitRejectDetails (Context ctx){ + context = ctx; + } + + + @Override + protected SoapPrimitive doInBackground(String... params) { + String str_request_id = (String) params[0]; + String str_reson=(String) params[1]; + // String str_MdId= + Log.d("str_request_id=",str_request_id+"str_reson="+str_reson); + + SoapPrimitive response = CancelProjectDetails(str_request_id,str_reson); + + // SoapObject response = ReApplyProjectDetails(); + + return response; + } + + @Override + protected void onPreExecute() { + // progressBar = (ProgressBar) findViewById(R.id.progressBar); + // progressBar.setVisibility(View.VISIBLE); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + if(result.toString().equals("Success")){ + Toast.makeText(context,"T-Shirt Rejected Successfully",Toast.LENGTH_LONG).show(); + Intent ittEditProjToProjStatus = new Intent(context,TShirtPaidActivity.class); + // ittEditProjToProjStatus.putExtra("pageCount",0); + context.startActivity(ittEditProjToProjStatus); + } + else{ + Toast.makeText(context,"Error occured while saving to database",Toast.LENGTH_LONG).show(); + } + // progressBar.setVisibility(View.GONE); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + private static SoapPrimitive CancelProjectDetails(String str_request_id, String str_reson) { + String METHOD_NAME = "RejectForTshirt"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/RejectForTshirt"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject("http://mis.leadcampus.org/", METHOD_NAME); + + request.addProperty("ManagerId",str_MdID); + Log.d("str_MangerID", String.valueOf(str_MdID)); + request.addProperty("RequestId",str_request_id); + Log.d("Remark",str_reson); + request.addProperty("Remark",str_reson); + Log.d("Requestisxxxxx",request.toString()); + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + // HttpTransportSE androidHttpTransport = new HttpTransportSE("http://testbed.dfindia.org/leadws/Managerws.asmx"); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + // Log.d("soap response1xxxx",envelope.getResponse().toString()); + + // SoapObject response = (SoapObject) envelope.getResponse(); + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + Log.e("soap response rejected==",envelope.getResponse().toString()); + + //return null; + + return response; + + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + } + }catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + } + return null; + + } + + public static class SubmitUnapprove extends AsyncTask { + + AlertDialog alertDialog; + //private ProgressBar progressBar; + private ProgressDialog progressDialog; + + SubmitUnapprove (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapPrimitive doInBackground(String... params) { + String str_requestId = (String) params[0]; + String str_size = (String) params[1]; + String str_leadId = (String) params[2]; + + SoapPrimitive response = SubmitUnapproveFun(str_requestId,str_size,str_leadId); + + Log.d("Soap response issssss",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + + progressDialog.setMessage("Submitting"); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapPrimitive result) { + progressDialog.dismiss(); + /* if(result!=null) { + Log.i("result=",result.toString()); + SoapPrimitive S_Status; + Object O_Status; + String str_Status = null; + + *//* for (int i = 0; i < result.getPropertyCount(); i++) { + SoapObject list = (SoapObject) result.getProperty(i); + + //Log.d("DistrictResult", list.toString()); + + // O_Status = list.equals("Status"); + O_Status = list.getProperty("Status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) list.getProperty("Status"); + Log.d("Status:", S_Status.toString()); + str_Status = S_Status.toString(); + } + + if (str_Status.equalsIgnoreCase("Success")) { + + // if (result.toString().equals("Success")) { + Toast.makeText(context, "T-Shirt Issued successfully", Toast.LENGTH_LONG).show(); + //counter = 0; + getActivity().finish(); + startActivity(getActivity().getIntent()); + } else { + Toast.makeText(context, "Error occured while saving to database", Toast.LENGTH_LONG).show(); + } + }*//* + O_Status = result.getProperty("Status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) result.getProperty("Status"); + Log.d("S_Status:", S_Status.toString()); + str_Status = S_Status.toString(); + } + + Log.d("tag", "Str_StatusinTShirtPaidActivityisss:" + str_Status); + + + if (str_Status.equalsIgnoreCase("Success")) { + Toast.makeText(context, "T-Shirt Issued successfully", Toast.LENGTH_LONG).show(); + getActivity().finish(); + startActivity(getActivity().getIntent()); + } + }*/ + if(result.toString().equals("Success")){ + Toast.makeText(context,"T-Shirt Unapproved Successfully",Toast.LENGTH_LONG).show(); + /*getActivity().finish(); + startActivity(getActivity().getIntent());*/ + /*Intent ittEditProjToProjStatus = new Intent(context,TShirtPaidActivity.class); + // ittEditProjToProjStatus.putExtra("pageCount",0); + context.startActivity(ittEditProjToProjStatus);*/ + Intent ittEditProjToProjStatus = new Intent(context,TShirtPaidActivity.class); + // ittEditProjToProjStatus.putExtra("pageCount",0); + context.startActivity(ittEditProjToProjStatus); + } + else{ + Toast.makeText(context,"Error occured while saving to database",Toast.LENGTH_LONG).show(); + } + //progressBar.setVisibility(View.GONE); + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private static SoapPrimitive SubmitUnapproveFun(String str_requestId,String str_size,String str_leadId) { + String METHOD_NAME = "ApproveForTShirt"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/ApproveForTShirt"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + JSONObject jsonObject = new JSONObject(); + /*for(int k=0;k"); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + // Log.d("soap response1xxxx",envelope.getResponse().toString()); + + + // SoapObject response = (SoapObject) envelope.getResponse(); + SoapPrimitive response = (SoapPrimitive) envelope.getResponse(); + Log.e("Responseissss",envelope.getResponse().toString()); + + //return null; + + return response; + + }catch(OutOfMemoryError ex){ + /* getActivity().runOnUiThread(new Runnable() { + public void run() {*/ + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + /*} + });*/ + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + /* getActivity().runOnUiThread(new Runnable() { + public void run() {*/ + Toast.makeText(context,"Web Service Error", Toast.LENGTH_LONG).show(); + /* } + });*/ + } + } + catch(OutOfMemoryError ex){ + /*getActivity().runOnUiThread(new Runnable() { + public void run() {*/ + Toast.makeText(context,"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + /*} + });*/ + } + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + + final String exceptionStr = t.getMessage().toString(); + /* getActivity().runOnUiThread(new Runnable() { + public void run() {*/ + Toast.makeText(context,"Web Service Error", Toast.LENGTH_LONG).show(); + /*} + });*/ + } + return null; + + } + + + + public class GetTShirtUnpaid extends AsyncTask { + + Context context; + AlertDialog alertDialog; + + //private ProgressBar progressBar; + + GetTShirtUnpaid (Context ctx){ + context = ctx; + progressDialog = new ProgressDialog(context); + } + + + @Override + protected SoapObject doInBackground(Void... params) { + //String versionCode = (String) params[2]; + + SoapObject response = getTShirtUnpaid(); + + //Log.d("Soap response is",response.toString()); + + return response; + } + + @Override + protected void onPreExecute() { + /* progressBar = (ProgressBar) view.findViewById(R.id.progressBar); + progressBar.setVisibility(View.VISIBLE);*/ + progressDialog.setMessage("Loading"); + progressDialog.setProgressStyle(android.R.attr.progressBarStyleSmall); + progressDialog.setCanceledOnTouchOutside(false); + progressDialog.show(); + } + + @Override + protected void onPostExecute(SoapObject result) { + + String finalResult = result.toString(); + //String finals = finalResult.replace("anyType",""); + Log.d("Finalresultissis",finalResult); + + + /* String finalResult = result.toString(); + String finals = finalResult.replace("anyType",""); + Log.d("Finals is",finals); + + + SoapPrimitive status = (SoapPrimitive) result.getProperty("Status"); + //Log.d("Status is:",status.toString()); + + if(status.toString().equals("Success")) { + SoapPrimitive role = (SoapPrimitive) result.getProperty("Role"); + Log.d("Role is:", role.toString()); + + if(role.toString().equals("Student")){ + *//* Intent ittLoginToEditProfile = new Intent(LoginActivity.this,EditProfileActivity.class); + ittLoginToEditProfile.putExtra("leadid",leadid); + startActivity(ittLoginToEditProfile);*//* + } + }else{ + Log.d("Status is: ",status.toString()); + }*/ + + if(result != null) { + + SoapPrimitive S_LeadId, S_StudentName, S_CollegeName, S_MobileNo, S_Status,S_TShirtSize,S_ProjectCount,S_RequestedId; + Object O_LeadId, O_StudentName, O_CollegeName, O_MobileNo, O_Status, O_TShirtSize,O_ProjectCount,O_RequestedId; + String str_leadid = null, str_studentName = null, str_registrationDate = null, str_collegeName = null, str_MobileNo = null, str_Status = null, str_tshirtSize = null,str_projectCount = null,str_requestedId=null; + + for (int i = 0; i < result.getPropertyCount(); i++) { + SoapObject list = (SoapObject) result.getProperty(i); + + //Log.d("DistrictResult", list.toString()); + + O_Status = list.getProperty("Status"); + if (!O_Status.toString().equals("anyType{}") && !O_Status.toString().equals(null)) { + S_Status = (SoapPrimitive) list.getProperty("Status"); + Log.d("Status:", S_Status.toString()); + str_Status = S_Status.toString(); + } + + if (str_Status.equalsIgnoreCase("Success")) { + + O_StudentName = list.getProperty("StudentName"); + if (!O_StudentName.toString().equals("anyType{}") && !O_StudentName.toString().equals(null)) { + S_StudentName = (SoapPrimitive) list.getProperty("StudentName"); + str_studentName = S_StudentName.toString(); + Log.d("StudentNameissss", str_studentName); + } + + O_LeadId = list.getProperty("Lead_id"); + if (!O_LeadId.toString().equals("anyType{}") && !O_LeadId.toString().equals(null)) { + S_LeadId = (SoapPrimitive) list.getProperty("Lead_id"); + str_leadid = S_LeadId.toString(); + Log.d("str_leadidisss", str_leadid); + } + + /* O_RegistrationDate = list.getProperty("RegistrationDate"); + if (!O_RegistrationDate.toString().equals("anyType{}") && !O_RegistrationDate.toString().equals(null)) { + S_RegistrationDate = (SoapPrimitive) list.getProperty("RegistrationDate"); + Log.d("S_RegistrationDate", S_RegistrationDate.toString()); + str_registrationDate = S_RegistrationDate.toString(); + Log.d("str_registrationDate", str_registrationDate); + }*/ + + O_TShirtSize = list.getProperty("TshirtSize"); + if (!O_TShirtSize.toString().equals("anyType{}") && !O_TShirtSize.toString().equals(null)) { + S_TShirtSize = (SoapPrimitive) list.getProperty("TshirtSize"); + Log.d("S_TShirtSize", S_TShirtSize.toString()); + str_tshirtSize = S_TShirtSize.toString(); + Log.d("str_TShirtSize", str_tshirtSize); + + tshirtSizeLst.add(str_tshirtSize); + } + + O_CollegeName = list.getProperty("CollegeName"); + if (!O_CollegeName.toString().equals("anyType{}") && !O_CollegeName.toString().equals(null)) { + S_CollegeName = (SoapPrimitive) list.getProperty("CollegeName"); + Log.d("S_CollegeName", S_CollegeName.toString()); + str_collegeName = S_CollegeName.toString(); + Log.d("str_collegeName", str_collegeName); + + collegeNameLst.add(str_collegeName); + + } + + O_MobileNo = list.getProperty("MobileNo"); + if (!O_MobileNo.toString().equals("anyType{}") && !O_MobileNo.toString().equals(null)) { + S_MobileNo = (SoapPrimitive) list.getProperty("MobileNo"); + Log.d("S_MobileNo", S_MobileNo.toString()); + str_MobileNo = S_MobileNo.toString(); + } + + O_ProjectCount = list.getProperty("projectcount"); + if (!O_ProjectCount.toString().equals("anyType{}") && !O_ProjectCount.toString().equals(null)) { + S_ProjectCount = (SoapPrimitive) list.getProperty("projectcount"); + Log.d("S_ProjectCount", S_ProjectCount.toString()); + str_projectCount = S_ProjectCount.toString(); + } + + Log.d("tag","StringProjectCountisss: "+str_projectCount); + + O_RequestedId = list.getProperty("RequestedId"); + if (!O_RequestedId.toString().equals("anyType{}") && !O_RequestedId.toString().equals(null)) { + S_RequestedId = (SoapPrimitive) list.getProperty("RequestedId"); + Log.d("S_RequestedId", S_RequestedId.toString()); + str_requestedId = S_RequestedId.toString(); + } + + Log.d("RequestedIdisss",str_requestedId); + + + + + + + + + + /* O_IsFeesPaid = list.getProperty("isFeePaid"); + if (!O_IsFeesPaid.toString().equals("anyType{}") && !O_IsFeesPaid.toString().equals(null)) { + S_IsFeesPaid = (SoapPrimitive) list.getProperty("isFeePaid"); + Log.d("S_IsFeesPaid", S_IsFeesPaid.toString()); + str_IsFeesPaid = S_IsFeesPaid.toString(); + } +*/ + TShirtUnpaidModel item; + + item = new TShirtUnpaidModel(str_studentName, str_leadid,str_tshirtSize,str_collegeName, str_MobileNo, str_Status,str_projectCount,str_requestedId); + feesList.add(item); + } + + } + + originalList = new ArrayList(); + originalList.addAll(feesList); + + adapter.notifyDataSetChanged(); + //progressBar.setVisibility(View.GONE); + + Log.d("Totalcountssss:", String.valueOf(lview.getCount())); + txt_actualTotalCounts.setText(String.valueOf(lview.getCount())); + + initCollegeSpinner(); + + //initTshirtSize(); + } + + progressDialog.dismiss(); + + + + } + + @Override + protected void onProgressUpdate(Void... values) { + super.onProgressUpdate(values); + } + } + + private SoapObject getTShirtUnpaid() { + String METHOD_NAME = "GetApplyTshirtRequestlist"; + String SOAP_ACTION1 = "http://mis.leadcampus.org/GetApplyTshirtRequestlist"; + String NAMESPACE = "http://mis.leadcampus.org/"; + + try{ + //mis.leadcampus.org + + SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); + + //SoapObject users = new SoapObject("http://mis.leadcampus.org/", "users"); + request.addProperty("ManagerId",str_MangerID); + //users.ad + //request.add + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + //SoapSerializationEnvelope evp = new SoapSoapEnvelope.XSD; + + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + + //envelope.addMapping(NAMESPACE, "MediSenseLog",new MediSenseLog().getClass()); + //Create HTTP call object + //envelope.encodingStyle = SoapSerializationEnvelope.XSD; + HttpTransportSE androidHttpTransport = new HttpTransportSE(Class_URL.URL_Manager.toString().trim()); + // HttpTransportSE androidHttpTransport = new HttpTransportSE("http://testbed.dfindia.org/leadws/Managerws.asmx?WSDL"); + //androidHttpTransport.setXmlVersionTag(""); + + try + { + androidHttpTransport.call(SOAP_ACTION1, envelope); + + //SoapPrimitive response1 = (SoapPrimitive) envelope.getResponse(); + Log.d("tag","soapresponse1xxxxTShirtUnpaid"+envelope.getResponse().toString()); + + + SoapObject response = (SoapObject) envelope.getResponse(); + Log.e("tag","soapresponseyyyyyyyTShirtUnpaid"+response.toString()); + + //return null; + + return response; + + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("request fail", "> " + t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + } + catch(OutOfMemoryError ex){ + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Slow Internet or Internet Dropped", Toast.LENGTH_LONG).show(); + } + }); + } + catch (Exception t) { + Log.e("exception outside",t.getMessage().toString()); + final String exceptionStr = t.getMessage().toString(); + getActivity().runOnUiThread(new Runnable() { + public void run() { + Toast.makeText(getActivity(),"Web Service Error", Toast.LENGTH_LONG).show(); + } + }); + } + return null; + + } + + + private void initTshirtSize(){ + + tshirtSizeArrLst.addAll(tshirtSizeLst); + Log.i("tag","tshirtSizeArrLst size="+tshirtSizeArrLst.size()); + Log.i("tag","tshirtSizeArrLst string="+tshirtSizeArrLst.toString()); + List tshirt= tshirtSizeArrLst; + List allList = feesList; + String student_name; + String lead_id; + String tshirt_size; + //private String registration_date; + String college_name; + String phone_number; + String status; + String proj_count; + String requested_id; + Log.i("tag","tshirt string="+tshirt); + Log.i("tag","feesList.size="+feesList.size()); + SCount=0;MCount=0;LCount=0;XLCount=0;XXLCount=0; + setupS();setupM();setupL();setupXL();setupXXL(); + sizeSList.clear(); sizeMList.clear();sizeLList.clear();sizeXLList.clear();sizeXXLList.clear(); + + adapter = new TShirtUnpaidAdapter(getActivity(),feesList); + lview.setAdapter(adapter); + + for(int i=0;i { + ProgressDialog dialog; + Context context; + + protected void onPreExecute() { + // Log.i(TAG, "onPreExecute---tab2"); + dialog.setMessage("Please wait,Updating Details loading..."); + dialog.setCanceledOnTouchOutside(false); + dialog.show(); + + } + + @Override + protected void onProgressUpdate(Void... values) { + //Log.i(TAG, "onProgressUpdate---tab2"); + } + + + @Override + protected Void doInBackground(String... params) { + Log.i("df", "doInBackground"); + + CurrentEvents(); // + return null; + } + + public AsyncCallWS_currentevents(TestActivity2 activity) { + context = activity; + dialog = new ProgressDialog(activity); + } + + @Override + protected void onPostExecute(Void result) { + + /* if ((this.dialog != null) && this.dialog.isShowing()) { + dialog.dismiss(); + + }*/ + + dialog.dismiss(); + } + + } + + + public void CurrentEvents() + { + + + + String URL=Class_URL.URL_Projects.toString().trim(); + String METHOD_NAME = "UpdatePorjectCompletionwithBytes"; + String Namespace = "http://mis.leadcampus.org/", SOAPACTION = "http://mis.leadcampus.org/UpdatePorjectCompletionwithBytes"; + + + //Toast.makeText(getActivity(),"test image",Toast.LENGTH_SHORT).show(); + + + for(int i=0;i<3;i++){ + byte[] data = baos.toByteArray(); + imageBytesJagged[i] = data; + } + + + try { + // String versioncode = this.getPackageManager() + // .getPackageInfo(this.getPackageName(), 0).versionName; + SoapObject request = new SoapObject(Namespace, METHOD_NAME); + + request.addProperty("RegistrationId", 58); + request.addProperty("leadId", "mg06"); + request.addProperty("ProjectId", 242); + request.addProperty("Placeofimplement", "testing"); + request.addProperty("FundsRaised", 100); + request.addProperty("Challenge", "testing"); + request.addProperty("Learning", "testing"); + request.addProperty("AsAStory", "testing"); + request.addProperty("imgs", imageBytesJagged); + + request.addProperty("docFile", null); + request.addProperty("extension", null); + + + /*request.addProperty("docFile", imageBytes); + request.addProperty("doccount", 0);*/ + + + + /*long + string + long + string + float + string + string + string + + base64Binary + base64Binary + + base64Binary + string + */ + + + + + SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); + new MarshalBase64().register(envelope); + envelope.dotNet = true; + //Set output SOAP object + envelope.setOutputSoapObject(request); + //Create HTTP call object + HttpTransportSE androidHttpTransport = new HttpTransportSE(URL); + + try { + androidHttpTransport.call(SOAPACTION, envelope); + SoapObject response = (SoapObject) envelope.getResponse(); + //Log.e("currentevents response", response.toString()); + + + + } catch (Throwable t) { + //Toast.makeText(MainActivity.this, "Request failed: " + t.toString(), + // Toast.LENGTH_LONG).show(); + Log.e("request fail", "> " + t.getMessage()); + } + } catch (Throwable t) { + Log.e("UnRegister Error", "> " + t.getMessage()); + + } + + }//end of newsandEvents + + + + + + + + + + + +}//end of class diff --git a/app/src/main/java/com/leadcampusapp/TicketCheckBoxAdapter.java b/app/src/main/java/com/leadcampusapp/TicketCheckBoxAdapter.java new file mode 100644 index 0000000..0a4532e --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/TicketCheckBoxAdapter.java @@ -0,0 +1,227 @@ +package com.leadcampusapp; + +import android.app.Activity; +import android.app.AlertDialog; +import android.app.Dialog; +import android.content.DialogInterface; +import android.content.Intent; +import android.net.Uri; +import android.text.InputType; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.CompoundButton; +import android.widget.EditText; +import android.widget.ImageView; +import android.widget.TextView; + +import java.util.ArrayList; + +//import com.android.sripad.leadnew_22_6_2018.R; + +/** + * Created by Admin on 28-05-2018. + */ + +public class TicketCheckBoxAdapter extends BaseAdapter{ + + public ArrayList feesUnPaidList; + Activity activity; + EditText userInputDialogEditText; + String str_requestId,str_reson; + + public TicketCheckBoxAdapter(Activity activity, ArrayList feesUnPaidList) { + super(); + this.activity = activity; + this.feesUnPaidList = feesUnPaidList; + } + + @Override + public int getCount() { + //return projList.size(); + return feesUnPaidList.size(); + } + + @Override + public Class_Fund_Details getItem(int position) { + + //return projList.get(position); + return feesUnPaidList.get(position); + } + + @Override + public long getItemId(int position) { + return position; + } + + class ViewHolder { + TextView ProjectTittle; + TextView tv_Requested; + TextView tv_Sanctioned; + TextView tv_Released; + TextView tv_Balance; + CheckBox check_status; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + + final ViewHolder holder; + final String[] userInput = new String[1]; + + LayoutInflater inflater = activity.getLayoutInflater(); + + if (convertView == null) { + convertView = inflater.inflate(R.layout.pmticket_fund_list, null); + holder = new ViewHolder(); + + holder.ProjectTittle = (TextView) convertView.findViewById(R.id.ProjectTittle); + holder.tv_Requested = (TextView) convertView.findViewById(R.id.tv_Requested); + holder.tv_Sanctioned = (TextView) convertView.findViewById(R.id.tv_Sanctioned); + holder.tv_Released = (TextView) convertView.findViewById(R.id.tv_Released); + holder.tv_Balance = (TextView) convertView.findViewById(R.id.tv_Balance); + /* holder.mReject = (ImageView) convertView.findViewById(R.id.reject); + holder.mCollegeName = (TextView) convertView.findViewById(R.id.txt_collegeName); + holder.mPhoneNumber = (TextView) convertView.findViewById(R.id.txt_phoneNumber);*/ + holder.check_status = (CheckBox) convertView.findViewById(R.id.check_status); + + convertView.setTag(holder); + } else { + holder = (ViewHolder) convertView.getTag(); + } + + Class_Fund_Details item = feesUnPaidList.get(position); + + if(item.getProject_Title()!=null) { + holder.ProjectTittle.setText(item.getProject_Title().toString()); + } + if(item.getRequested_Amount()!=null) { + holder.tv_Requested.setText(item.getRequested_Amount().toString()); + } + if(item.getSantioned_Amount()!=null) { + holder.tv_Sanctioned.setText(item.getSantioned_Amount().toString()); + } + if(item.getBalance_Amount()!=null) { + holder.tv_Balance.setText(item.getBalance_Amount().toString()); + } + if(item.getReleased_Amount()!=null) { + holder.tv_Released.setText(item.getReleased_Amount().toString()); + } + + /* if(item.getProj_count()!=null) { + holder.mProjectCount.setText(item.getProj_count()); + }*/ + /*else{ + holder.mRegistrationDate.setText(""); + }*/ + + if(item.getStatus().toString().equals("1")) { + holder.check_status.setChecked(true); + //holder.mStatus.setSelected(true); + } + if(item.getStatus().toString().equals("0")) { + holder.check_status.setChecked(false); + //holder.mStatus.setSelected(false); + } + final int pos = position; + holder.check_status.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + Log.d("insidelistview","listview clicked"); + + if(isChecked) { + Log.d("ischhecked","true"); + holder.check_status.setChecked(true); + //holder.mStatus.setEnabled(true); + feesUnPaidList.get(pos).setStatus("1"); + }else{ + Log.d("ischhecked","false"); + holder.check_status.setChecked(false); + feesUnPaidList.get(pos).setStatus("0"); + } + } + }); + + + + return convertView; + } + class CustomListener implements View.OnClickListener { + private final Dialog dialog; + public CustomListener(Dialog dialog) { + this.dialog = dialog; + } + @Override + public void onClick(View v) { + // put your code here + // String mValue = userInput.getText().toString(); + if(validation()) { + // dialog.dismiss(); + str_reson=userInputDialogEditText.getText().toString(); + TShirtUnpaidFragment.SubmitRejectDetails submitRejectDetails = new TShirtUnpaidFragment.SubmitRejectDetails(activity); + submitRejectDetails.execute(str_requestId, str_reson); + // Toast.makeText(activity, userInputDialogEditText.getText().toString()+","+str_requestId+","+str_reson , Toast.LENGTH_LONG).show(); + + + } + } + } + public boolean validation(){ + + Boolean bpmcomments=true,bamount=true; + + + if( userInputDialogEditText.length() == 0 ){ + userInputDialogEditText.setError( "Reason field should not be empty!" );bpmcomments=false;} + + if(bpmcomments&&bamount) { + return true; + }else{return false;} + } +/* + public void filter(String charText,ArrayList feesList,String selectedCollegeName) { + //charText = charText.toLowerCase(Locale.getDefault()); + //Log.d("charTextissss",charText); + this.feesUnPaidList.clear(); + + */ +/* for(FeesUnpaidModel feesUnpaidModel : feesList){ + String stdName = feesUnpaidModel.getStudent_name().toString(); + //Log.d("StudeNameissssss",stdName); + }*//* + + + if(charText!=null) { + if(feesList!=null) { + if (charText.isEmpty() || charText.length() == 0) { + this.feesUnPaidList.addAll(feesList); + } else { + for (TShirtUnpaidModel wp : feesList) { + //Log.d("GetCollegeNameissss",wp.getCollege_name().toLowerCase((Locale.getDefault()))); + */ +/* if (wp.getCollege_name().toLowerCase(Locale.getDefault()).contains(charText) || wp.getLead_id().toLowerCase(Locale.getDefault()).contains(charText) || wp.getPhone_number().toLowerCase(Locale.getDefault()).contains(charText) || wp.getStudent_name().toLowerCase(Locale.getDefault()).contains(charText) || wp.getPhone_number().toLowerCase(Locale.getDefault()).contains(charText)) { + this.feesUnPaidList.add(wp); + }*//* + + if(selectedCollegeName == null) { + if ((wp.getCollege_name()!=null && wp.getCollege_name().toLowerCase().contains(charText.toLowerCase())) || ( wp.getLead_id()!=null && wp.getLead_id().toLowerCase().contains(charText.toLowerCase())) || ( wp.getPhone_number()!=null && wp.getPhone_number().toLowerCase().contains(charText.toLowerCase())) || ( wp.getStudent_name()!=null && wp.getStudent_name().toLowerCase().contains(charText.toLowerCase()) ) || ( wp.getPhone_number()!=null && wp.getPhone_number().toLowerCase().contains(charText.toLowerCase()))) { + this.feesUnPaidList.add(wp); + } + }else{ + if ((wp.getCollege_name()!=null && wp.getCollege_name().equals(selectedCollegeName)) && ((wp.getCollege_name()!=null && wp.getCollege_name().toLowerCase().contains(charText.toLowerCase())) || (wp.getLead_id()!=null && wp.getLead_id().toLowerCase().contains(charText.toLowerCase())) || (wp.getPhone_number()!=null && wp.getPhone_number().toLowerCase().contains(charText.toLowerCase())) || (wp.getStudent_name()!=null && wp.getStudent_name().toLowerCase().contains(charText.toLowerCase())) || (wp.getPhone_number()!=null && wp.getPhone_number().toLowerCase().contains(charText.toLowerCase())))) { + this.feesUnPaidList.add(wp); + } + } + + } + } + notifyDataSetChanged(); + } + } + } +*/ +} diff --git a/app/src/main/java/com/leadcampusapp/TshirtPaidModel.java b/app/src/main/java/com/leadcampusapp/TshirtPaidModel.java new file mode 100644 index 0000000..73d7acb --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/TshirtPaidModel.java @@ -0,0 +1,99 @@ +package com.leadcampusapp; + +/** + * Created by Admin on 28-05-2018. + */ + +public class TshirtPaidModel { + private String student_name; + private String lead_id; + private String college_name; + private String phone_number; + private String TshirtSize; + private String projectcount; + private String RequestedId; + private String status; + + public String getTshirtSize() { + return TshirtSize; + } + + public void setTshirtSize(String tshirtSize) { + TshirtSize = tshirtSize; + } + + public String getProjectcount() { + return projectcount; + } + + public void setProjectcount(String projectcount) { + this.projectcount = projectcount; + } + + public String getRequestedId() { + return RequestedId; + } + + public void setRequestedId(String requestedId) { + RequestedId = requestedId; + } + + public String getStudent_name() { + return student_name; + } + + public void setStudent_name(String student_name) { + this.student_name = student_name; + } + + public String getLead_id() { + return lead_id; + } + + public void setLead_id(String lead_id) { + this.lead_id = lead_id; + } + + public String getCollege_name() { + return college_name; + } + + public void setCollege_name(String college_name) { + this.college_name = college_name; + } + + public String getPhone_number() { + return phone_number; + } + + public void setPhone_number(String phone_number) { + this.phone_number = phone_number; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + /* public TshirtPaidModel(String student_name, String lead_id, String college_name, String phone_number, String status) { + this.student_name = student_name; + this.lead_id = lead_id; + this.college_name = college_name; + this.phone_number = phone_number; + this.status = status; + }*/ + + public TshirtPaidModel(String student_name, String lead_id, String college_name, String phone_number, String tshirtSize, String projectcount, String requestedId, String status) { + this.student_name = student_name; + this.lead_id = lead_id; + this.college_name = college_name; + this.phone_number = phone_number; + TshirtSize = tshirtSize; + this.projectcount = projectcount; + RequestedId = requestedId; + this.status = status; + } +} diff --git a/app/src/main/java/com/leadcampusapp/VerticalViewPager.java b/app/src/main/java/com/leadcampusapp/VerticalViewPager.java new file mode 100644 index 0000000..f688fd3 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/VerticalViewPager.java @@ -0,0 +1,101 @@ +package com.leadcampusapp; + +import android.content.Context; +import androidx.viewpager.widget.ViewPager; +import android.util.AttributeSet; +import android.view.MotionEvent; +import android.view.View; + + +/** + * Created by jrizvan on 12/13/16. + */ + +public class VerticalViewPager extends ViewPager { + + public VerticalViewPager(Context context) { + super(context); + init(); + } + + public VerticalViewPager(Context context, AttributeSet attrs) { + super(context, attrs); + init(); + } + + private void init() { + // The majority of the magic happens here + setPageTransformer(true, new VerticalPageTransformer()); + // The easiest way to get rid of the overscroll drawing that happens on the left and right + setOverScrollMode(OVER_SCROLL_NEVER); + // setOverScrollMode(); + } + + private class VerticalPageTransformer implements ViewPager.PageTransformer { + private static final float MIN_SCALE = 0.75f; + @Override + public void transformPage(View view, float position) { + + if (position < -1) { // [-Infinity,-1) + // This page is way off-screen to the left. + view.setAlpha(0); + + } else if (position <= 0) { // [-1,0] + // Use the default slide transition when moving to the left page + view.setAlpha(1); + // Counteract the default slide transition + view.setTranslationX(view.getWidth() * -position); + + //set Y position to swipe in from top + float yPosition = position * view.getHeight(); + view.setTranslationY(yPosition); + view.setScaleX(1); + view.setScaleY(1); + + } else if (position <= 1) { // [0,1] + view.setAlpha(1); + + // Counteract the default slide transition + view.setTranslationX(view.getWidth() * -position); + + + // Scale the page down (between MIN_SCALE and 1) + float scaleFactor = MIN_SCALE + + (1 - MIN_SCALE) * (1 - Math.abs(position)); + view.setScaleX(scaleFactor); + view.setScaleY(scaleFactor); + + } else { // (1,+Infinity] + // This page is way off-screen to the right. + view.setAlpha(0); + } + } + } + + /** + * Swaps the X and Y coordinates of your touch event. + */ + private MotionEvent swapXY(MotionEvent ev) { + float width = getWidth(); + float height = getHeight(); + + float newX = (ev.getY() / height) * width; + float newY = (ev.getX() / width) * height; + + ev.setLocation(newX, newY); + + return ev; + } + + @Override + public boolean onInterceptTouchEvent(MotionEvent ev){ + boolean intercepted = super.onInterceptTouchEvent(swapXY(ev)); + swapXY(ev); // return touch coordinates to original reference frame for any child views + return intercepted; + } + + @Override + public boolean onTouchEvent(MotionEvent ev) { + return super.onTouchEvent(swapXY(ev)); + } +} diff --git a/app/src/main/java/com/leadcampusapp/VerticlePagerAdapter.java b/app/src/main/java/com/leadcampusapp/VerticlePagerAdapter.java new file mode 100644 index 0000000..c120aee --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/VerticlePagerAdapter.java @@ -0,0 +1,1059 @@ +package com.leadcampusapp; + +import android.content.Context; +import android.content.Intent; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.graphics.Canvas; +import android.graphics.Color; +import android.graphics.drawable.Drawable; +import android.media.MediaScannerConnection; +import android.net.Uri; +import android.os.AsyncTask; +import android.os.Build; +import android.os.Environment; + +import androidx.annotation.RequiresApi; +import androidx.cardview.widget.CardView; +import androidx.fragment.app.FragmentActivity; +import androidx.viewpager.widget.PagerAdapter; +//import androidx.appcompat.widget.CardView; +import android.util.DisplayMetrics; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.webkit.WebChromeClient; +import android.webkit.WebSettings; +import android.webkit.WebView; +import android.widget.FrameLayout; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.RelativeLayout; +import android.widget.TextView; +import android.widget.VideoView; + +//import com.android.sripad.leadnew_22_6_2018.R; +import com.codesgood.views.JustifiedTextView; +//import com.google.android.youtube.player.YouTubePlayerFragment; +import com.google.android.youtube.player.YouTubePlayerSupportFragment; +import com.leadcampusapp.module.LeadStoryList; +import com.bumptech.glide.Glide; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; + +/** + * Created by rizvan on 12/13/16. + */ + +public class VerticlePagerAdapter extends PagerAdapter {//implements YouTubePlayer.OnInitializedListener { + + String mResources[] = {"Rally for rivers is a campaign launched by Isha Foundation in 2017 to tackle the scarcity of water cross rivers. Sadhguru launched the campaign on 3rd September from Isha Yoga " + + "centre, Coimbatore. On October 3, a river revitalization " + + "draft proposal was presented by Sadhguru to Narendra " + + "Modi. Six states( Karnataka, Assam, Chhattisgarh, Punjab, " + + "Maharashtra and Gujarat) signed Memorandums of " + + "Understanding(MoU) with Isha Foundation to plant trees...", + "Iron Man is a 2008 American superhero film based on the Marvel Comics character of the same name, produced by Marvel Studios and distributed by Paramount Pictures.1 It is the first film in the Marvel Cinematic Universe. The film was directed by Jon Favreau, with a screenplay by Mark Fergus & Hawk Ostby and Art Marcum & Matt Holloway. It stars Robert Downey Jr., Terrence Howard, Jeff Bridges, Shaun Toub and Gwyneth Paltrow. In Iron Man, Tony Stark, an industrialist and master engineer, builds a powered exoskeleton and becomes the technologically advanced superhero Iron Man.\n" + + "\n"}; + + public static final String API_KEY = "AIzaSyCe6tORd9Ch4lx-9Ku5SQ476uS9OtZYsWA"; + public static final String VIDEO_ID = "xtyTAjUz5aQ"; + public YouTubePlayerSupportFragment myContext; + VideoView videoView; + // RelativeLayout video_frag; + YouTubePlayerSupportFragment frag; + Context mContext; + LayoutInflater mLayoutInflater; + private String serverPath = Class_URL.ServerPath.toString().trim(); + String PMImgUrl; + ImageView imageView,fullimageView; + TextView btn_readMore; + String Story_Blog,Story_Type; + File pictureFileDir; + + public static final String TAG = "bottom_sheet"; + + private File pictureFile; + private String picString; + private String idCardImgEncodedString=null; + + private static int NUM_ITEMS = 0; + + public ArrayList leadStoryLists; + + int flag =0; + + + /* public VerticlePagerAdapter(Context context,ArrayList leadStoryLists) { + mContext = context; + mLayoutInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + leadStoryLists = leadStoryLists; + }*/ + + public VerticlePagerAdapter(Context mContext, ArrayList leadStoryLists) { + this.mContext = mContext; + this.mLayoutInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + this.leadStoryLists = leadStoryLists; + } + + /*public VerticlePagerAdapter(LeadStoryFragment mcontext, ArrayList listview_arr) { + this.mLayoutInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + this.leadStoryLists = leadStoryLists; + }*/ + + @Override + public int getCount() { + + int xcount=leadStoryLists.size(); + // Log.i("tag","count=1="+count); + + int x=xcount; + //return leadStoryLists.size(); + return xcount; + } + + @Override + public boolean isViewFromObject(View view, Object object) { + return view == ((LinearLayout) object); + } + + /* @Override + public int getCount() { + // count=LeadStoryList.listview_arr.size(); + return LeadStoryList.listview_arr.size(); + }*/ + + @Override + public Object instantiateItem(ViewGroup container, final int position) { + View itemView = mLayoutInflater.inflate(R.layout.content_main, container, false); + CardView card_view=(CardView) itemView.findViewById(R.id.card_view); + TextView txt_story=(TextView) itemView.findViewById(R.id.txt_story); + + Log.d("insideyyyyy","instantiateItemssssssss"); + + JustifiedTextView label = (JustifiedTextView) itemView.findViewById(R.id.textView); + + imageView = (ImageView) itemView.findViewById(R.id.imageView); + + //TextView btn_readMore = (TextView) itemView.findViewById(R.id.btn_readMore); + + fullimageView =(ImageView) itemView.findViewById(R.id.fullimageView); + WebView mWebView =(WebView) itemView.findViewById(R.id.webview_youtube); + + final RelativeLayout share_images=(RelativeLayout) itemView.findViewById(R.id.share_images); + // videoView =(VideoView) itemView.findViewById(R.id.videoView); + /// video_frag =(RelativeLayout) itemView.findViewById(R.id.video_frag); + /*frag = YouTubePlayerSupportFragment.newInstance(); + ((Activity) mContext).getFragmentManager().findFragmentById(R.id.youtube_fragment); + frag.initialize(API_KEY, this);*/ + + // frag = (YouTubePlayerFragment) myContext.getFragmentManager().findFragmentById(R.id.youtube_fragment); + //frag.initialize(API_KEY,this); + // final RelativeLayout bottom_full=(RelativeLayout) itemView.findViewById(R.id.bottom_full); + + //ImageView btn_share=(ImageView) itemView.findViewById(R.id.shareit); + + // final RelativeLayout share_half=(RelativeLayout) itemView.findViewById(R.id.share_half); + final RelativeLayout share_half_image =(RelativeLayout) itemView.findViewById(R.id.share_half_image); + // ImageView btn_share1=(ImageView) itemView.findViewById(R.id.shareit1); + //TextView btn_readMore1=(TextView) itemView.findViewById(R.id.btn_readMore1); + Story_Type=LeadStoryList.listview_arr.get(position).getStory_Type(); + Log.i("tag","Story_Type1="+Story_Type); + fullimageView.setVisibility(View.GONE); + share_images.setVisibility(View.GONE); + mWebView.setVisibility(View.GONE); + // videoView.setVisibility(View.GONE); + // btn_share1.setVisibility(View.GONE); + share_half_image.setVisibility(View.GONE); + // btn_share.setVisibility(View.GONE); + // btn_readMore.setVisibility(View.GONE); +/// share_half.setVisibility(View.GONE); + imageView.setVisibility(View.GONE); + txt_story.setVisibility(View.GONE); + label.setVisibility(View.GONE); + //bottom_full.setVisibility(View.GONE); + // btn_readMore1.setVisibility(View.GONE); + // makeTextViewResizable(label, 6, "View More", true); + + /* share_half_image.setVisibility(View.GONE); + imageView.setVisibility(View.GONE); + btn_readMore.setVisibility(View.GONE); + label.setVisibility(View.GONE); + txt_story.setVisibility(View.GONE); + share_half.setVisibility(View.GONE); + btn_share.setVisibility(View.GONE);*/ + + + + + /* if(flag == 1){ + mWebView.clearFormData(); + mWebView.clearView(); + mWebView.destroy(); + }*/ + + + + if(Story_Type.equals("3")) + { + // Toast.makeText(mContext,"Inside 3",Toast.LENGTH_LONG).show(); + + /* mWebView.clearFormData(); + mWebView.clearView(); + mWebView.destroy();*/ + + //mWebView.removeJavascriptInterface(); + + + fullimageView.setVisibility(View.VISIBLE); + share_images.setVisibility(View.VISIBLE); + // btn_share1.setVisibility(View.VISIBLE); + // bottom_full.setVisibility(View.VISIBLE); + // videoView.setVisibility(View.GONE); + mWebView.setVisibility(View.GONE); + imageView.setVisibility(View.GONE); + // btn_readMore.setVisibility(View.GONE); + label.setVisibility(View.GONE); + txt_story.setVisibility(View.GONE); + // btn_share.setVisibility(View.GONE); + // share_half.setVisibility(View.GONE); + // share_half_image.setVisibility(View.GONE); + // Story_Blog=LeadStoryList.listview_arr.get(position).getURL_Link(); + + if (position % 2 != 0) + { + // label.setText(LeadStoryList.listview_arr.get(position).getStory_Description()); + String Image_Path=LeadStoryList.listview_arr.get(position).getCard_Image_Path(); + // txt_story.setText(LeadStoryList.listview_arr.get(position).getStory_Title()); + String Imagestring = Image_Path; + if(Imagestring.equals("null")||Imagestring.equals("anyType{}") || Imagestring.equals("")){ + // PMImgUrl="null"; + fullimageView.setImageResource(R.drawable.n1); + }else { + String arr[] = Imagestring.split("/", 2); + + String firstWord = arr[0]; //the + String secondWord = arr[1]; + + PMImgUrl = serverPath + secondWord; + + Log.i("tag", "firstWord=" + firstWord + " secondWord=" + secondWord); + try + { + Glide.with(mContext) + .load(PMImgUrl) + .asBitmap() + .into(fullimageView); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + /* LoadGalleryFullImage loadGalleryImage=new LoadGalleryFullImage(); + loadGalleryImage.execute();*/ + } + Story_Blog = LeadStoryList.listview_arr.get(position).getURL_Link(); + + /* if (Story_Blog.equals("") || Story_Blog.equals("anyType{}") || Story_Blog.equals("null") || Story_Blog.equals("")) { + // Toast.makeText(mContext,"URL Not Found",Toast.LENGTH_LONG).show(); + btn_readMore1.setVisibility(View.GONE); + } else { + btn_readMore1.setVisibility(View.VISIBLE); + btn_readMore1.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + + Story_Blog = LeadStoryList.listview_arr.get(position).getURL_Link(); + *//* Intent i = new Intent(mContext, StoryBlogActivity.class); + i.putExtra("Story_Blog",Story_Blog); + mContext.startActivity(i);*//* + + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(Story_Blog)); + mContext.startActivity(browserIntent); + } + }); + }*/ + } + else { + //txt_story.setText(LeadStoryList.listview_arr.get(position).getStory_Title()); + // label.setText(LeadStoryList.listview_arr.get(position).getStory_Description()); + String Image_Path = LeadStoryList.listview_arr.get(position).getCard_Image_Path(); + String Imagestring = Image_Path; + if (Imagestring.equals("null") || Imagestring.equals("anyType{}") || Imagestring.equals("")) { + // PMImgUrl="null"; + fullimageView.setImageResource(R.drawable.n1); + } else { + String arr[] = Imagestring.split("/", 2); + + String firstWord = arr[0]; //the + String secondWord = arr[1]; + + PMImgUrl = serverPath + secondWord; + + Log.i("tag", "firstWord=" + firstWord + " secondWord=" + secondWord); + try + { + Glide.with(mContext) + .load(PMImgUrl) + .asBitmap() + .into(fullimageView); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + /* LoadGalleryFullImage loadGalleryImage = new LoadGalleryFullImage(); + loadGalleryImage.execute();*/ + } + /*fullimageView.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + + Story_Blog = LeadStoryList.listview_arr.get(position).getURL_Link(); + + if (Story_Blog.equals("") || Story_Blog.equals("anyType{}") || Story_Blog.equals("null") || Story_Blog.equals("")) { + // Toast.makeText(mContext,"URL Not Found",Toast.LENGTH_LONG).show(); + } else { + *//* Intent i = new Intent(mContext, StoryBlogActivity.class); + i.putExtra("Story_Blog",Story_Blog); + mContext.startActivity(i);*//* + + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(Story_Blog)); + mContext.startActivity(browserIntent); + } + } + });*/ + Story_Blog = LeadStoryList.listview_arr.get(position).getURL_Link(); + +// if (Story_Blog.equals("") || Story_Blog.equals("anyType{}") || Story_Blog.equals("null") || Story_Blog.equals("")) { +// // Toast.makeText(mContext,"URL Not Found",Toast.LENGTH_LONG).show(); +// btn_readMore1.setVisibility(View.GONE); +// } else { +// btn_readMore1.setVisibility(View.VISIBLE); +// btn_readMore1.setOnClickListener(new View.OnClickListener() { +// public void onClick(View v) { +// +// Story_Blog = LeadStoryList.listview_arr.get(position).getURL_Link(); +// /* Intent i = new Intent(mContext, StoryBlogActivity.class); +// i.putExtra("Story_Blog",Story_Blog); +// mContext.startActivity(i);*/ +// +// Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(Story_Blog)); +// mContext.startActivity(browserIntent); +// } +// }); +// } + } + + /* if(Story_Type.equals("3")) { + + }else{ + fullimageView.setEnabled(false); + } +*/ + + /* btn_share1.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + File file = saveBitMap(mContext, share_images); + if (file != null) { + Log.i("TAG", "Drawing saved to the gallery!"); + } else { + Log.i("TAG", "Oops! Image could not be saved."); + } + shareImage(); + + // shareImage_fullimg(); + // shareIt(); + *//* Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); + sharingIntent.setType("text/plain"); + for (int i=0; i<=position;i++) { + sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Leader Story"); + sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, LeadStoryList.listview_arr.get(position).getStory_Description()); + } + mContext.startActivity(Intent.createChooser(sharingIntent, "Share via"));*//* + } + });*/ + + //mWebView.stopLoading(); + //mWebView.reload(); + + + } + else if(Story_Type.equals("4")){ + flag = 1; + + // Toast.makeText(mContext,"Inside 4",Toast.LENGTH_LONG).show(); + + fullimageView.setVisibility(View.GONE); + share_images.setVisibility(View.GONE); + share_half_image.setVisibility(View.VISIBLE); + // share_half.setVisibility(View.VISIBLE); + imageView.setVisibility(View.GONE); + // videoView.setVisibility(View.VISIBLE); + mWebView.setVisibility(View.VISIBLE); + label.setVisibility(View.VISIBLE); + txt_story.setVisibility(View.VISIBLE); + + String item = "http://www.youtube.com/embed/"; + + String ss = LeadStoryList.listview_arr.get(position).getVideo_Story_URL(); //"5PUC9yGS4RI"; + // String ss = "5PUC9yGS4RI"; + // ss = ss.substring(ss.indexOf("v=") + 2); + item += ss; + + DisplayMetrics metrics = mContext.getResources().getDisplayMetrics(); + int w1 = (int) (metrics.widthPixels / metrics.density), h1 = w1 * 3 / 5; + mWebView.getSettings().setJavaScriptEnabled(true); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { + mWebView.getSettings().setMediaPlaybackRequiresUserGesture(false); + } + // WebViewClient mWebViewClient = new WebViewClient(); + // mWebView.setWebViewClient(mWebViewClient); + // mWebView.setWebViewClient(WebView);// + mWebView.setWebChromeClient(chromeClient); + mWebView.getSettings().setPluginState(WebSettings.PluginState.ON); + // mWebView.getSettings().setPluginsEnabled(true); + String frameVideo1 = "Youtube video ..
"; + + String frameVideo = "Youtube video ..
"; + // String video = " "; + String video = " "; + + try { + Log.i("tag","item="+item); + + mWebView.loadData(video, "text/html", "utf-8"); + /* mWebView.loadData( + "", + "text/html5", "utf-8");*/ + } catch (Exception e) { + e.printStackTrace(); + } + + //mWebView.stopLoading(); + + + label.setText(LeadStoryList.listview_arr.get(position).getStory_Description()); + txt_story.setText(LeadStoryList.listview_arr.get(position).getStory_Title()); + /*String videoPath = "http://mis.leadcampus.org/Documents/Videos/1.mp4"; + Uri uri = Uri.parse(videoPath); + videoView.setVideoURI(uri); + videoView.start(); + MediaController mediaController = new MediaController(mContext); + videoView.setMediaController(mediaController); + mediaController.setAnchorView(videoView); + + label.setText(LeadStoryList.listview_arr.get(position).getStory_Description()); + txt_story.setText(LeadStoryList.listview_arr.get(position).getStory_Title());*/ + } + else { + +// Toast.makeText(mContext,"Inside else",Toast.LENGTH_LONG).show(); + + /*mWebView.clearFormData(); + mWebView.clearView(); + mWebView.destroy();*/ + + /* imageView.setVisibility(View.VISIBLE); + btn_readMore.setVisibility(View.VISIBLE); + label.setVisibility(View.VISIBLE); + txt_story.setVisibility(View.VISIBLE); + share_half.setVisibility(View.VISIBLE); + share_half_image.setVisibility(View.VISIBLE); + btn_share.setVisibility(View.VISIBLE);*/ + + String Story_Type=LeadStoryList.listview_arr.get(position).getStory_Type(); + fullimageView.setVisibility(View.GONE); + share_images.setVisibility(View.GONE); + // videoView.setVisibility(View.GONE); + mWebView.setVisibility(View.GONE); + // btn_share1.setVisibility(View.GONE); + //bottom_full.setVisibility(View.GONE); + + /* if(Story_Type.equals("1")) + { + btn_readMore.setVisibility(View.GONE); + } + else{ + btn_readMore.setVisibility(View.VISIBLE); + }*/ + // btn_share.setVisibility(View.VISIBLE); + share_half_image.setVisibility(View.VISIBLE); + // share_half.setVisibility(View.VISIBLE); + imageView.setVisibility(View.VISIBLE); + label.setVisibility(View.VISIBLE); + txt_story.setVisibility(View.VISIBLE); + + + imageView.setClickable(false); + imageView.setFocusable(false); + imageView.setEnabled(false); + + label.setClickable(false); + label.setFocusable(false); + label.setEnabled(false); + fullimageView.setEnabled(false); + txt_story.setFocusable(false); + txt_story.setClickable(false); + txt_story.setEnabled(false); + + if (position % 2 != 0) + { + label.setText(LeadStoryList.listview_arr.get(position).getStory_Description()); + String Image_Path=LeadStoryList.listview_arr.get(position).getImage_Path(); + txt_story.setText(LeadStoryList.listview_arr.get(position).getStory_Title()); + String Imagestring = Image_Path; + if(Imagestring.equals("null")||Imagestring.equals("anyType{}") || Imagestring.equals("")){ + // PMImgUrl="null"; + imageView.setImageResource(R.drawable.n1); + }else { + String arr[] = Imagestring.split("/", 2); + + String firstWord = arr[0]; //the + String secondWord = arr[1]; + + PMImgUrl = serverPath + secondWord; + + Log.i("tag", "firstWord=" + firstWord + " secondWord=" + secondWord); + try + { + Glide.with(mContext) + .load(PMImgUrl) + .asBitmap() + .into(imageView); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + /* LoadGalleryImage loadGalleryImage=new LoadGalleryImage(); + loadGalleryImage.execute();*/ + }} + else + { + txt_story.setText(LeadStoryList.listview_arr.get(position).getStory_Title()); + label.setText(LeadStoryList.listview_arr.get(position).getStory_Description()); + String Image_Path = LeadStoryList.listview_arr.get(position).getImage_Path(); + String Imagestring = Image_Path; + if (Imagestring.equals("null") || Imagestring.equals("anyType{}") || Imagestring.equals("")){ + // PMImgUrl="null"; + imageView.setImageResource(R.drawable.n1); + } else { + String arr[] = Imagestring.split("/", 2); + + String firstWord = arr[0]; //the + String secondWord = arr[1]; + + PMImgUrl = serverPath + secondWord; + + Log.i("tag", "firstWord=" + firstWord + " secondWord=" + secondWord); + try + { + Glide.with(mContext) + .load(PMImgUrl) + .asBitmap() + .into(imageView); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + /* LoadGalleryImage loadGalleryImage = new LoadGalleryImage(); + loadGalleryImage.execute();*/ + } + } + + + + /* btn_share.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + + File file = saveBitMap(mContext, share_half_image); + if (file != null) { + Log.i("TAG", "Drawing saved to the gallery!"); + } else { + Log.i("TAG", "Oops! Image could not be saved."); + } + + shareImage(); + } + });*/ + + //mWebView.stopLoading(); + //mWebView.clearFormData(); + //mWebView.reload(); + + } + + + + + /* btn_readMore.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + + Story_Blog=LeadStoryList.listview_arr.get(position).getURL_Link(); + if(Story_Blog.equals("") || Story_Blog.equals("anyType{}") || Story_Blog.equals("null") || Story_Blog.equals("")){ + Toast.makeText(mContext,"URL Not Found",Toast.LENGTH_LONG).show(); + }else { + *//* Intent i = new Intent(mContext, StoryBlogActivity.class); + i.putExtra("Story_Blog",Story_Blog); + mContext.startActivity(i);*//* + + Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(Story_Blog)); + mContext.startActivity(browserIntent); + } + } + });*/ + + + + Log.i("Tag","position="+position); + + // count=LeadStoryList.listview_arr.size(); + // Log.i("Tag","count="+count); + + // for (i + // + // + // nt j=0;j 0 && tv.getLineCount() >= maxLine) { + lineEndIndex = tv.getLayout().getLineEnd(maxLine - 1); + text = tv.getText().subSequence(0, lineEndIndex - expandText.length() + 1) + " " + expandText; + } else { + lineEndIndex = tv.getLayout().getLineEnd(tv.getLayout().getLineCount() - 1); + text = tv.getText().subSequence(0, lineEndIndex) + " " + expandText; + } + tv.setText(text); + tv.setMovementMethod(LinkMovementMethod.getInstance()); + tv.setText( + addClickablePartTextViewResizable( Html.fromHtml(tv.getText().toString()), tv, lineEndIndex, expandText, + viewMore), TextView.BufferType.SPANNABLE); + } + }); + + } + + private static SpannableStringBuilder addClickablePartTextViewResizable(final Spanned strSpanned, final TextView tv, + final int maxLine, final String spanableText, final boolean viewMore) { + String str = strSpanned.toString(); + SpannableStringBuilder ssb = new SpannableStringBuilder(strSpanned); + + if (str.contains(spanableText)) { + ssb.setSpan(new ClickableSpan() { + + @Override + public void onClick(View widget) { + tv.setLayoutParams(tv.getLayoutParams()); + tv.setText(tv.getTag().toString(), TextView.BufferType.SPANNABLE); + tv.invalidate(); + if (viewMore) { + makeTextViewResizable(tv, -1, "View Less", false); + } else { + makeTextViewResizable(tv, 6, "View More", true); + } + + } + }, str.indexOf(spanableText), str.indexOf(spanableText) + spanableText.length(), 0); + + } + return ssb; + + }*/ + public class LoadGalleryImage extends AsyncTask { + + private Context context; + // private ProgressBar progressBar; + + /* LoadGalleryImage (Context context){ + this.context = context; + }*/ + + @Override + protected void onPreExecute() { + // progressBar = (ProgressBar) findViewById(R.id.progressBar); + // progressBar.setVisibility(View.VISIBLE); + + } + + @Override + protected Bitmap doInBackground(Void... params) { + ArrayList bitmapLst=null; + Bitmap bitmaplogo=null; + + try { + URL url= new URL(PMImgUrl); + Log.d("Urlssssssssssss",url.toString()); + bitmaplogo = BitmapFactory.decodeStream(url.openStream()); + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return bitmaplogo; + } + + @Override + protected void onPostExecute(Bitmap bitmap) { + // bitmapList.add(bitmap); + imageView.setImageBitmap(bitmap); + // progressBar.setVisibility(GONE); + } + } + + public class LoadGalleryFullImage extends AsyncTask { + + private Context cxt; + // private ProgressBar progressBar; + + /* LoadGalleryFullImage (Context context){ + this.cxt = context; + } + + public LoadGalleryFullImage() { + + }*/ + + @Override + protected void onPreExecute() { + // progressBar = (ProgressBar) findViewById(R.id.progressBar); + // progressBar.setVisibility(View.VISIBLE); + + } + + @Override + protected Bitmap doInBackground(Void... params) { + ArrayList bitmapLst=null; + Bitmap bitmaplogo=null; + + try { + URL url= new URL(PMImgUrl); + Log.d("Urlssssssssssss",url.toString()); + bitmaplogo = BitmapFactory.decodeStream(url.openStream()); + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return bitmaplogo; + } + + @Override + protected void onPostExecute(Bitmap bitmap) { + // bitmapList.add(bitmap); + fullimageView.setImageBitmap(bitmap); + // progressBar.setVisibility(GONE); + } + } + + /* private void shareIt() { +//sharing implementation here + Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); + sharingIntent.setType("text/plain"); + sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Leader Story"); + sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT,mResources[i]); + mContext.startActivity(Intent.createChooser(sharingIntent, "Share via")); + }*/ + + @Override + public void destroyItem(ViewGroup container, int position, Object object) { + container.removeView((LinearLayout) object); + } + +} diff --git a/app/src/main/java/com/leadcampusapp/YoutubeActivity.java b/app/src/main/java/com/leadcampusapp/YoutubeActivity.java new file mode 100644 index 0000000..4b516d7 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/YoutubeActivity.java @@ -0,0 +1,86 @@ +package com.leadcampusapp; + +import android.os.Bundle; +import android.widget.Toast; + +import com.google.android.youtube.player.YouTubeBaseActivity; +import com.google.android.youtube.player.YouTubeInitializationResult; +import com.google.android.youtube.player.YouTubePlayer; +import com.google.android.youtube.player.YouTubePlayer.ErrorReason; +import com.google.android.youtube.player.YouTubePlayer.PlaybackEventListener; +import com.google.android.youtube.player.YouTubePlayer.PlayerStateChangeListener; +import com.google.android.youtube.player.YouTubePlayer.Provider; +import com.google.android.youtube.player.YouTubePlayerView; + +public class YoutubeActivity {//extends YouTubeBaseActivity implements YouTubePlayer.OnInitializedListener { + + /*public static final String API_KEY = "AIzaSyCe6tORd9Ch4lx-9Ku5SQ476uS9OtZYsWA"; + public static final String VIDEO_ID = "xtyTAjUz5aQ"; +*/ + /* @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_youtube); + + *//** Initializing YouTube Player View **//* + YouTubePlayerView youTubePlayerView = (YouTubePlayerView) findViewById(R.id.youtube_player); + youTubePlayerView.initialize(API_KEY, this); + } + + @Override + public void onInitializationFailure(Provider provider, YouTubeInitializationResult result) { + Toast.makeText(this, "Failured to Initialize!", Toast.LENGTH_LONG).show(); + } + + @Override + public void onInitializationSuccess(Provider provider, YouTubePlayer player, boolean wasRestored) { + *//** add listeners to YouTubePlayer instance **//* + player.setPlayerStateChangeListener(playerStateChangeListener); + player.setPlaybackEventListener(playbackEventListener); + + *//** Start buffering **//* + if (!wasRestored) { + player.cueVideo(VIDEO_ID); + } + } + + private PlaybackEventListener playbackEventListener = new PlaybackEventListener() { + @Override + public void onBuffering(boolean arg0) { + } + @Override + public void onPaused() { + } + @Override + public void onPlaying() { + } + @Override + public void onSeekTo(int arg0) { + } + @Override + public void onStopped() { + } + }; + + private PlayerStateChangeListener playerStateChangeListener = new PlayerStateChangeListener() { + @Override + public void onAdStarted() { + } + @Override + public void onError(ErrorReason arg0) { + } + @Override + public void onLoaded(String arg0) { + } + @Override + public void onLoading() { + } + @Override + public void onVideoEnded() { + } + @Override + public void onVideoStarted() { + } + };*/ + +} diff --git a/app/src/main/java/com/leadcampusapp/module/AmbassadorRequestList.java b/app/src/main/java/com/leadcampusapp/module/AmbassadorRequestList.java new file mode 100644 index 0000000..deb6d70 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/module/AmbassadorRequestList.java @@ -0,0 +1,68 @@ +package com.leadcampusapp.module; + + +import java.util.ArrayList; + +/** + * Created by User on 10/13/2017. + */ + +public class AmbassadorRequestList { + + String Lead_Id; + String StudentName; + String isApply_MasterLeader; + String isApply_LeadAmbassador; + String Student_Type; + String Status; + + public static ArrayList listview_arr=new ArrayList(); + + public AmbassadorRequestList(String lead_Id, String studentName, String isApply_MasterLeader, String isApply_LeadAmbassador, String student_Type) { + Lead_Id = lead_Id; + StudentName = studentName; + this.isApply_MasterLeader = isApply_MasterLeader; + this.isApply_LeadAmbassador = isApply_LeadAmbassador; + Student_Type = student_Type; + } + + public String getLead_Id() { + return Lead_Id; + } + + public void setLead_Id(String lead_Id) { + Lead_Id = lead_Id; + } + + public String getStudentName() { + return StudentName; + } + + public void setStudentName(String studentName) { + StudentName = studentName; + } + + public String getIsApply_MasterLeader() { + return isApply_MasterLeader; + } + + public void setIsApply_MasterLeader(String isApply_MasterLeader) { + this.isApply_MasterLeader = isApply_MasterLeader; + } + + public String getIsApply_LeadAmbassador() { + return isApply_LeadAmbassador; + } + + public void setIsApply_LeadAmbassador(String isApply_LeadAmbassador) { + this.isApply_LeadAmbassador = isApply_LeadAmbassador; + } + + public String getStudent_Type() { + return Student_Type; + } + + public void setStudent_Type(String student_Type) { + Student_Type = student_Type; + } +} diff --git a/app/src/main/java/com/leadcampusapp/module/AmbassadorRequestListModule.java b/app/src/main/java/com/leadcampusapp/module/AmbassadorRequestListModule.java new file mode 100644 index 0000000..be30961 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/module/AmbassadorRequestListModule.java @@ -0,0 +1,71 @@ +package com.leadcampusapp.module; + + +import java.util.ArrayList; + +/** + * Created by User on 10/13/2017. + */ + +public class AmbassadorRequestListModule { + + String Lead_Id; + String StudentName; + String isApply_MasterLeader; + String isApply_LeadAmbassador; + String Student_Type; + String Status; + + public static ArrayList listview_arr=new ArrayList(); + + public AmbassadorRequestListModule() { + } + + public AmbassadorRequestListModule(String lead_Id, String studentName, String isApply_MasterLeader, String isApply_LeadAmbassador, String student_Type) { + Lead_Id = lead_Id; + StudentName = studentName; + this.isApply_MasterLeader = isApply_MasterLeader; + this.isApply_LeadAmbassador = isApply_LeadAmbassador; + Student_Type = student_Type; + } + + public String getLead_Id() { + return Lead_Id; + } + + public void setLead_Id(String lead_Id) { + Lead_Id = lead_Id; + } + + public String getStudentName() { + return StudentName; + } + + public void setStudentName(String studentName) { + StudentName = studentName; + } + + public String getIsApply_MasterLeader() { + return isApply_MasterLeader; + } + + public void setIsApply_MasterLeader(String isApply_MasterLeader) { + this.isApply_MasterLeader = isApply_MasterLeader; + } + + public String getIsApply_LeadAmbassador() { + return isApply_LeadAmbassador; + } + + public void setIsApply_LeadAmbassador(String isApply_LeadAmbassador) { + this.isApply_LeadAmbassador = isApply_LeadAmbassador; + } + + public String getStudent_Type() { + return Student_Type; + } + + public void setStudent_Type(String student_Type) { + Student_Type = student_Type; + } +} diff --git a/app/src/main/java/com/leadcampusapp/module/ApprovedProjectList.java b/app/src/main/java/com/leadcampusapp/module/ApprovedProjectList.java new file mode 100644 index 0000000..521961e --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/module/ApprovedProjectList.java @@ -0,0 +1,129 @@ +package com.leadcampusapp.module; + + +import java.util.ArrayList; + +/** + * Created by User on 10/13/2017. + */ + +public class ApprovedProjectList { + + String Student_name; + String Project_tittle; + String Approved_amount; + String Disperse_amount; + String Balance_amount; + String LeadId; + String PDId; + String MobileNo; + String Student_Image_Path; + String PMAppr_collegename; + String PMAppr_streamname; + + public static ArrayList listview_arr=new ArrayList(); + + public ApprovedProjectList(){ + + } + + + public ApprovedProjectList(String student_name, String project_tittle, String approved_amount, String disperse_amount, String balance_amount, String leadId, String PDId,String MobileNo,String Student_Image_Path, + String pmappr_college_name,String pmappr_stream_name) { + Student_name = student_name; + Project_tittle = project_tittle; + Approved_amount = approved_amount; + Disperse_amount = disperse_amount; + Balance_amount = balance_amount; + LeadId = leadId; + PMAppr_collegename=pmappr_college_name; + PMAppr_streamname=pmappr_stream_name; + + this.PDId = PDId; + this.MobileNo=MobileNo; + + this.Student_Image_Path=Student_Image_Path; + } + + public String getMobileNo() { + return MobileNo; + } + + public String getStudent_Image_Path() { + return Student_Image_Path; + } + + public String getLeadId() { + return LeadId; + } + + public void setLeadId(String leadId) { + LeadId = leadId; + } + + public String getPDId() { + return PDId; + } + + public void setPDId(String PDId) { + this.PDId = PDId; + } + + public String getStudent_name() { + return Student_name; + } + + public void setStudent_name(String student_name) { + Student_name = student_name; + } + + public String getProject_tittle() { + return Project_tittle; + } + + public void setProject_tittle(String project_tittle) { + Project_tittle = project_tittle; + } + + public String getApproved_amount() { + return Approved_amount; + } + + public void setApproved_amount(String approved_amount) { + Approved_amount = approved_amount; + } + + public String getDisperse_amount() { + return Disperse_amount; + } + + public void setDisperse_amount(String disperse_amount) { + Disperse_amount = disperse_amount; + } + + public String getBalance_amount() { + return Balance_amount; + } + + public void setBalance_amount(String balance_amount) { + Balance_amount = balance_amount; + } + + + + public String getpmappr_collegename() { + return PMAppr_collegename; + } + public void setpmappr_collegename(String pmappr_college_name) { + PMAppr_collegename = pmappr_college_name; + } + + + public String getpmappr_streamname() { + return PMAppr_streamname; + } + + public void setpmappr_streamname(String pmappr_stream_name) { + this.PMAppr_streamname = pmappr_stream_name; + } +} diff --git a/app/src/main/java/com/leadcampusapp/module/ApprovedProjectListModule.java b/app/src/main/java/com/leadcampusapp/module/ApprovedProjectListModule.java new file mode 100644 index 0000000..eb97d01 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/module/ApprovedProjectListModule.java @@ -0,0 +1,113 @@ +package com.leadcampusapp.module; + + +import java.util.ArrayList; + +/** + * Created by User on 10/13/2017. + */ + +public class ApprovedProjectListModule { + + String Student_name; + String Project_tittle; + String Approved_amount; + String Disperse_amount; + String Balance_amount; + String LeadId; + String PDId; + String PMAppr_collegename; + String PMAppr_streamname; + public static ArrayList listview_arr=new ArrayList(); + + public ApprovedProjectListModule(){ + + } + + public ApprovedProjectListModule(String student_name, String project_tittle, String approved_amount, String disperse_amount, String balance_amount, String leadId, String PDId, + String pmappr_college_name,String pmappr_stream_name ) { + Student_name = student_name; + Project_tittle = project_tittle; + Approved_amount = approved_amount; + Disperse_amount = disperse_amount; + Balance_amount = balance_amount; + LeadId = leadId; + PMAppr_collegename=pmappr_college_name; + PMAppr_streamname=pmappr_stream_name; + this.PDId = PDId; + } + + public String getLeadId() { + return LeadId; + } + + public void setLeadId(String leadId) { + LeadId = leadId; + } + + public String getPDId() { + return PDId; + } + + public void setPDId(String PDId) { + this.PDId = PDId; + } + + public String getStudent_name() { + return Student_name; + } + + public void setStudent_name(String student_name) { + Student_name = student_name; + } + + public String getProject_tittle() { + return Project_tittle; + } + + public void setProject_tittle(String project_tittle) { + Project_tittle = project_tittle; + } + + public String getApproved_amount() { + return Approved_amount; + } + + public void setApproved_amount(String approved_amount) { + Approved_amount = approved_amount; + } + + public String getDisperse_amount() { + return Disperse_amount; + } + + public void setDisperse_amount(String disperse_amount) { + Disperse_amount = disperse_amount; + } + + public String getBalance_amount() { + return Balance_amount; + } + + public void setBalance_amount(String balance_amount) { + Balance_amount = balance_amount; + } + + + + public String getpmappr_collegename() { + return PMAppr_collegename; + } + public void setpmappr_collegename(String pmappr_college_name) { + PMAppr_collegename = pmappr_college_name; + } + + + public String getpmappr_streamname() { + return PMAppr_streamname; + } + + public void setpmappr_streamname(String pmappr_stream_name) { + this.PMAppr_streamname = pmappr_stream_name; + } +} diff --git a/app/src/main/java/com/leadcampusapp/module/ComplitedProjectList.java b/app/src/main/java/com/leadcampusapp/module/ComplitedProjectList.java new file mode 100644 index 0000000..f7c722a --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/module/ComplitedProjectList.java @@ -0,0 +1,132 @@ +package com.leadcampusapp.module; + + +import java.util.ArrayList; + +/** + * Created by User on 10/13/2017. + */ + +public class ComplitedProjectList { + + int id; + + String Student_name; + String College_name; + String Project_tittle; + String Sanction_amount; + String LeadId; + String ProjectId; + String MobileNo; + String Student_Image_Path; + String PMcomp_collegename; + String PMcomp_stream_name; + + String Is_ImpactProject; + + public String getLeadId() { + return LeadId; + } + + public void setLeadId(String leadId) { + LeadId = leadId; + } + + public String getProjectId() { + return ProjectId; + } + + public void setProjectId(String projectId) { + ProjectId = projectId; + } + + + public String get_is_impactproject() { + return Is_ImpactProject; + } + + public void set_is_impactproject(String impactproject) { + Is_ImpactProject = impactproject; + } + + + public ComplitedProjectList(){ + + } + + public String getMobileNo() { + return MobileNo; + } + + public String getStudent_Image_Path() { + return Student_Image_Path; + } + + public ComplitedProjectList(String student_name, String college_name, String project_tittle, String sanction_amount, String leadId, String projectId, String MobileNo, String Student_Image_Path, + String pmcomp_collegename,String pmcomp_streamname,String impactproject) { + Student_name = student_name; + College_name = college_name; + Project_tittle = project_tittle; + Sanction_amount = sanction_amount; + LeadId = leadId; + ProjectId = projectId; + PMcomp_collegename=pmcomp_collegename; + PMcomp_stream_name=pmcomp_streamname; + this.MobileNo=MobileNo; + this.Student_Image_Path=Student_Image_Path; + this.Is_ImpactProject=impactproject; + } + + public static ArrayList listview_arr=new ArrayList(); + + + public String getStudent_name() { + return Student_name; + } + + public void setStudent_name(String student_name) { + Student_name = student_name; + } + + public String getCollege_name() { + return College_name; + } + + public void setCollege_name(String college_name) { + College_name = college_name; + } + + public String getProject_tittle() { + return Project_tittle; + } + + public void setProject_tittle(String project_tittle) { + Project_tittle = project_tittle; + } + + public String getAmount() { + return Sanction_amount; + } + + public void setAmount(String amount) { + Sanction_amount = amount; + } + + + + public String getpmcomp_collegename() { + return PMcomp_collegename; + } + + public void setpmcomp_collegename(String pmcomp_collegename) { + this.PMcomp_collegename = pmcomp_collegename; + } + + public String getpmcomp_stream_name() { + return PMcomp_stream_name; + } + + public void setpmcomp_stream_name(String pmcomp_stream_name) { + this.PMcomp_stream_name = pmcomp_stream_name; + } +} diff --git a/app/src/main/java/com/leadcampusapp/module/ComplitionProjectListModule.java b/app/src/main/java/com/leadcampusapp/module/ComplitionProjectListModule.java new file mode 100644 index 0000000..7103916 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/module/ComplitionProjectListModule.java @@ -0,0 +1,118 @@ +package com.leadcampusapp.module; + + +import java.util.ArrayList; + +/** + * Created by User on 10/13/2017. + */ + +public class ComplitionProjectListModule { + + int id; + + String Student_name; + String College_name; + String Project_tittle; + String Sanction_amount; + + String LeadId; + String ProjectId; + String PMcomp_collegename; + String PMcomp_stream_name; + String Is_ImpactProject; + public ComplitionProjectListModule() + { + + } + + public String getLeadId() { + return LeadId; + } + + public void setLeadId(String leadId) { + LeadId = leadId; + } + + public String getProjectId() { + return ProjectId; + } + + public void setProjectId(String projectId) { + ProjectId = projectId; + } + + public String get_is_impactproject() { + return Is_ImpactProject; + } + + public void set_is_impactproject(String impactproject) { + Is_ImpactProject = impactproject; + } + + + + public ComplitionProjectListModule(String student_name, String college_name, String project_tittle, String amount, + String pmcomp_collegename,String pmcomp_streamname,String impactproject) { + Student_name = student_name; + College_name = college_name; + Project_tittle = project_tittle; + Sanction_amount = amount; + PMcomp_collegename=pmcomp_collegename; + PMcomp_stream_name=pmcomp_streamname; + Is_ImpactProject=impactproject; + } + + public static ArrayList listview_arr=new ArrayList(); + + + public String getStudent_name() { + return Student_name; + } + + public void setStudent_name(String student_name) { + Student_name = student_name; + } + + public String getCollege_name() { + return College_name; + } + + public void setCollege_name(String college_name) { + College_name = college_name; + } + + public String getProject_tittle() { + return Project_tittle; + } + + public void setProject_tittle(String project_tittle) { + Project_tittle = project_tittle; + } + + + public void setSanction_amount(String sanction_amount) { + Sanction_amount = sanction_amount; + } + + public String getSanction_amount() { + return Sanction_amount; + } + + + public String getpmcomp_collegename() { + return PMcomp_collegename; + } + + public void setpmcomp_collegename(String pmcomp_collegename) { + this.PMcomp_collegename = pmcomp_collegename; + } + + public String getpmcomp_stream_name() { + return PMcomp_stream_name; + } + + public void setpmcomp_stream_name(String pmcomp_stream_name) { + this.PMcomp_stream_name = pmcomp_stream_name; + } +} diff --git a/app/src/main/java/com/leadcampusapp/module/FundProjectList.java b/app/src/main/java/com/leadcampusapp/module/FundProjectList.java new file mode 100644 index 0000000..5b81bbe --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/module/FundProjectList.java @@ -0,0 +1,94 @@ +package com.leadcampusapp.module; + + +import java.util.ArrayList; + +/** + * Created by User on 10/13/2017. + */ + +public class FundProjectList { + + int id; + String Lead_id; + String Project_id; + String Student_name; + String Project_tittle; + String SanctionAmount; + String giventotal; + String balanceAmount; + + + public String getLead_id() { + return Lead_id; + } + + public void setLead_id(String lead_id) { + Lead_id = lead_id; + } + public FundProjectList(){ + + } + + public String getBalanceAmount() { + return balanceAmount; + } + + public void setBalanceAmount(String balanceAmount) { + this.balanceAmount = balanceAmount; + } + + public FundProjectList(String lead_id, String project_id, String student_name, String project_tittle, String sanctionAmount, String giventotal, String balanceAmount) { + Lead_id = lead_id; + Project_id = project_id; + Student_name = student_name; + Project_tittle = project_tittle; + SanctionAmount = sanctionAmount; + this.giventotal = giventotal; + this.balanceAmount = balanceAmount; + } + + public String getGiventotal() { + return giventotal; + } + + public void setGiventotal(String giventotal) { + this.giventotal = giventotal; + } + + public String getProject_id() { + return Project_id; + } + + public void setProject_id(String project_id) { + Project_id = project_id; + } + + public String getSanctionAmount() { + return SanctionAmount; + } + + public void setSanctionAmount(String sanctionAmount) { + SanctionAmount = sanctionAmount; + } + + public static ArrayList listview_arr=new ArrayList(); + + + public String getStudent_name() { + return Student_name; + } + + public void setStudent_name(String student_name) { + Student_name = student_name; + } + + public String getProject_tittle() { + return Project_tittle; + } + + public void setProject_tittle(String project_tittle) { + Project_tittle = project_tittle; + } + + } diff --git a/app/src/main/java/com/leadcampusapp/module/FundProjectListModule.java b/app/src/main/java/com/leadcampusapp/module/FundProjectListModule.java new file mode 100644 index 0000000..f9e9188 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/module/FundProjectListModule.java @@ -0,0 +1,92 @@ +package com.leadcampusapp.module; + + +import java.util.ArrayList; + +/** + * Created by User on 10/13/2017. + */ + +public class FundProjectListModule { + + int id; + String Lead_id; + String Project_id; + String Student_name; + String Project_tittle; + String SanctionAmount; + String giventotal; + String balanceAmount; + + public String getBalanceAmount() { + return balanceAmount; + } + + public void setBalanceAmount(String balanceAmount) { + this.balanceAmount = balanceAmount; + } + + public String getLead_id() { + return Lead_id; + } + + public void setLead_id(String lead_id) { + Lead_id = lead_id; + } + public FundProjectListModule(){ + + } + + public String getGiventotal() { + return giventotal; + } + + public void setGiventotal(String giventotal) { + this.giventotal = giventotal; + } + + public FundProjectListModule(String lead_id, String project_id, String student_name, String project_tittle, String sanctionAmount, String giventotal, String balanceAmount) { + Lead_id = lead_id; + Project_id = project_id; + Student_name = student_name; + Project_tittle = project_tittle; + SanctionAmount = sanctionAmount; + this.giventotal = giventotal; + this.balanceAmount = balanceAmount; + } + + public String getSanctionAmount() { + return SanctionAmount; + } + + public void setSanctionAmount(String sanctionAmount) { + SanctionAmount = sanctionAmount; + } + + public static ArrayList listview_arr=new ArrayList(); + + public String getProject_id() { + return Project_id; + } + + public void setProject_id(String project_id) { + Project_id = project_id; + } + + public String getStudent_name() { + return Student_name; + } + + public void setStudent_name(String student_name) { + Student_name = student_name; + } + + public String getProject_tittle() { + return Project_tittle; + } + + public void setProject_tittle(String project_tittle) { + Project_tittle = project_tittle; + } + + } diff --git a/app/src/main/java/com/leadcampusapp/module/LeadStoryList.java b/app/src/main/java/com/leadcampusapp/module/LeadStoryList.java new file mode 100644 index 0000000..aa84966 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/module/LeadStoryList.java @@ -0,0 +1,112 @@ +package com.leadcampusapp.module; + + +import java.util.ArrayList; + +/** + * Created by User on 10/13/2017. + */ + +public class LeadStoryList { + + String slno; + String Story_Title; + String Story_Description; + String Image_Path; + String Story_Type; + String Card_Image_Path; + String URL_Link; + + String Created_Date; + String status; + String Video_Story_URL; + + public String getVideo_Story_URL() { + return Video_Story_URL; + } + + public LeadStoryList(String slno, String story_Title, String story_Description, String image_Path, String story_Type, String card_Image_Path, String URL_Link, String Video_Story_URL) { + this.slno = slno; + Story_Title = story_Title; + Story_Description = story_Description; + Image_Path = image_Path; + Story_Type = story_Type; + Card_Image_Path = card_Image_Path; + this.URL_Link = URL_Link; + this.Video_Story_URL=Video_Story_URL; + } + + public static ArrayList listview_arr=new ArrayList(); + + public String getStory_Type() { + return Story_Type; + } + + public void setStory_Type(String story_Type) { + Story_Type = story_Type; + } + + public String getCard_Image_Path() { + return Card_Image_Path; + } + + public void setCard_Image_Path(String card_Image_Path) { + Card_Image_Path = card_Image_Path; + } + + public String getURL_Link() { + return URL_Link; + } + + public void setURL_Link(String URL_Link) { + this.URL_Link = URL_Link; + } + + public String getSlno() { + return slno; + } + + public void setSlno(String slno) { + this.slno = slno; + } + + public String getStory_Title() { + return Story_Title; + } + + public void setStory_Title(String story_Title) { + Story_Title = story_Title; + } + + public String getStory_Description() { + return Story_Description; + } + + public void setStory_Description(String story_Description) { + Story_Description = story_Description; + } + + public String getImage_Path() { + return Image_Path; + } + + public void setImage_Path(String image_Path) { + Image_Path = image_Path; + } + + public String getCreated_Date() { + return Created_Date; + } + + public void setCreated_Date(String created_Date) { + Created_Date = created_Date; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } +} diff --git a/app/src/main/java/com/leadcampusapp/module/LeadStoryListModule.java b/app/src/main/java/com/leadcampusapp/module/LeadStoryListModule.java new file mode 100644 index 0000000..69f65ac --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/module/LeadStoryListModule.java @@ -0,0 +1,77 @@ +package com.leadcampusapp.module; + + +import java.util.ArrayList; + +/** + * Created by User on 10/13/2017. + */ + +public class LeadStoryListModule { + + String slno; + String Story_Title; + String Story_Description; + String Image_Path; + + String Created_Date; + String status; + + + public LeadStoryListModule(String slno, String story_Title, String story_Description, String image_Path) { + this.slno = slno; + Story_Title = story_Title; + Story_Description = story_Description; + Image_Path = image_Path; + } + + public static ArrayList listview_arr=new ArrayList(); + + public String getSlno() { + return slno; + } + + public void setSlno(String slno) { + this.slno = slno; + } + + public String getStory_Title() { + return Story_Title; + } + + public void setStory_Title(String story_Title) { + Story_Title = story_Title; + } + + public String getStory_Description() { + return Story_Description; + } + + public void setStory_Description(String story_Description) { + Story_Description = story_Description; + } + + public String getImage_Path() { + return Image_Path; + } + + public void setImage_Path(String image_Path) { + Image_Path = image_Path; + } + + public String getCreated_Date() { + return Created_Date; + } + + public void setCreated_Date(String created_Date) { + Created_Date = created_Date; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } +} diff --git a/app/src/main/java/com/leadcampusapp/module/ManagerDetails.java b/app/src/main/java/com/leadcampusapp/module/ManagerDetails.java new file mode 100644 index 0000000..4253d6d --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/module/ManagerDetails.java @@ -0,0 +1,64 @@ +package com.leadcampusapp.module; + + +/** + * Created by User on 10/13/2017. + */ + +public class ManagerDetails { + + String MName; + String Emailid; + String Gender; + String Bloodgrp; + String Address; + String Mobile; + + public String getMName() { + return MName; + } + + public void setMName(String MName) { + this.MName = MName; + } + + public String getEmailid() { + return Emailid; + } + + public void setEmailid(String emailid) { + Emailid = emailid; + } + + public String getGender() { + return Gender; + } + + public void setGender(String gender) { + Gender = gender; + } + + public String getBloodgrp() { + return Bloodgrp; + } + + public void setBloodgrp(String bloodgrp) { + Bloodgrp = bloodgrp; + } + + public String getAddress() { + return Address; + } + + public void setAddress(String address) { + Address = address; + } + + public String getMobile() { + return Mobile; + } + + public void setMobile(String mobile) { + Mobile = mobile; + } +} diff --git a/app/src/main/java/com/leadcampusapp/module/MasterRequestList.java b/app/src/main/java/com/leadcampusapp/module/MasterRequestList.java new file mode 100644 index 0000000..e9105de --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/module/MasterRequestList.java @@ -0,0 +1,68 @@ +package com.leadcampusapp.module; + + +import java.util.ArrayList; + +/** + * Created by User on 10/13/2017. + */ + +public class MasterRequestList { + + String Lead_Id; + String StudentName; + String isApply_MasterLeader; + String isApply_LeadAmbassador; + String Student_Type; + String Status; + + public static ArrayList listview_arr=new ArrayList(); + + public MasterRequestList(String lead_Id, String studentName, String isApply_MasterLeader, String isApply_LeadAmbassador, String student_Type) { + Lead_Id = lead_Id; + StudentName = studentName; + this.isApply_MasterLeader = isApply_MasterLeader; + this.isApply_LeadAmbassador = isApply_LeadAmbassador; + Student_Type = student_Type; + } + + public String getLead_Id() { + return Lead_Id; + } + + public void setLead_Id(String lead_Id) { + Lead_Id = lead_Id; + } + + public String getStudentName() { + return StudentName; + } + + public void setStudentName(String studentName) { + StudentName = studentName; + } + + public String getIsApply_MasterLeader() { + return isApply_MasterLeader; + } + + public void setIsApply_MasterLeader(String isApply_MasterLeader) { + this.isApply_MasterLeader = isApply_MasterLeader; + } + + public String getIsApply_LeadAmbassador() { + return isApply_LeadAmbassador; + } + + public void setIsApply_LeadAmbassador(String isApply_LeadAmbassador) { + this.isApply_LeadAmbassador = isApply_LeadAmbassador; + } + + public String getStudent_Type() { + return Student_Type; + } + + public void setStudent_Type(String student_Type) { + Student_Type = student_Type; + } +} diff --git a/app/src/main/java/com/leadcampusapp/module/MasterRequestListModule.java b/app/src/main/java/com/leadcampusapp/module/MasterRequestListModule.java new file mode 100644 index 0000000..f3fdc8c --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/module/MasterRequestListModule.java @@ -0,0 +1,71 @@ +package com.leadcampusapp.module; + + +import java.util.ArrayList; + +/** + * Created by User on 10/13/2017. + */ + +public class MasterRequestListModule { + + String Lead_Id; + String StudentName; + String isApply_MasterLeader; + String isApply_LeadAmbassador; + String Student_Type; + String Status; + + public static ArrayList listview_arr=new ArrayList(); + + public MasterRequestListModule() { + } + + public MasterRequestListModule(String lead_Id, String studentName, String isApply_MasterLeader, String isApply_LeadAmbassador, String student_Type) { + Lead_Id = lead_Id; + StudentName = studentName; + this.isApply_MasterLeader = isApply_MasterLeader; + this.isApply_LeadAmbassador = isApply_LeadAmbassador; + Student_Type = student_Type; + } + + public String getLead_Id() { + return Lead_Id; + } + + public void setLead_Id(String lead_Id) { + Lead_Id = lead_Id; + } + + public String getStudentName() { + return StudentName; + } + + public void setStudentName(String studentName) { + StudentName = studentName; + } + + public String getIsApply_MasterLeader() { + return isApply_MasterLeader; + } + + public void setIsApply_MasterLeader(String isApply_MasterLeader) { + this.isApply_MasterLeader = isApply_MasterLeader; + } + + public String getIsApply_LeadAmbassador() { + return isApply_LeadAmbassador; + } + + public void setIsApply_LeadAmbassador(String isApply_LeadAmbassador) { + this.isApply_LeadAmbassador = isApply_LeadAmbassador; + } + + public String getStudent_Type() { + return Student_Type; + } + + public void setStudent_Type(String student_Type) { + Student_Type = student_Type; + } +} diff --git a/app/src/main/java/com/leadcampusapp/module/NotificationActivityModel.java b/app/src/main/java/com/leadcampusapp/module/NotificationActivityModel.java new file mode 100644 index 0000000..cc907c9 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/module/NotificationActivityModel.java @@ -0,0 +1,50 @@ +package com.leadcampusapp.module; + +/** + * Created by Admin on 28-05-2018. + */ + +public class NotificationActivityModel { + private String Notification_Type; + private String Notification_Message; + private String Notification_Date; + private String Status; + + public NotificationActivityModel(String notification_Type, String notification_Message, String notification_Date) { + Notification_Type = notification_Type; + Notification_Message = notification_Message; + Notification_Date = notification_Date; + } + + public String getNotification_Type() { + return Notification_Type; + } + + public void setNotification_Type(String notification_Type) { + Notification_Type = notification_Type; + } + + public String getNotification_Message() { + return Notification_Message; + } + + public void setNotification_Message(String notification_Message) { + Notification_Message = notification_Message; + } + + public String getNotification_Date() { + return Notification_Date; + } + + public void setNotification_Date(String notification_Date) { + Notification_Date = notification_Date; + } + + public String getStatus() { + return Status; + } + + public void setStatus(String status) { + Status = status; + } +} diff --git a/app/src/main/java/com/leadcampusapp/module/UnapprovedProjectList.java b/app/src/main/java/com/leadcampusapp/module/UnapprovedProjectList.java new file mode 100644 index 0000000..7142e09 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/module/UnapprovedProjectList.java @@ -0,0 +1,141 @@ +package com.leadcampusapp.module; + + +import java.util.ArrayList; + +/** + * Created by User on 10/13/2017. + */ + +public class UnapprovedProjectList { + + int id; + + String Student_name; + String College_name; + String Project_tittle; + String Amount; + + String Lead_id; + String Project_Id; + String MobileNo; + String collegename; + String streamname; + + /* String Project_type; + String Benficiaries; + String Objectivies; + String Action_plan;*/ + + public UnapprovedProjectList(){ + + } + + //public UnapprovedProjectList(String student_name, String college_name, String project_tittle, String amount, String lead_id, String project_Id, String MobileNo,String collegenames, String stream_name) { + + public UnapprovedProjectList(String student_name, String college_name, String project_tittle, String amount, String lead_id, String project_Id, String MobileNo,String stream_name) { + Student_name = student_name; + College_name = college_name; + Project_tittle = project_tittle; + Amount = amount; + Lead_id = lead_id; + Project_Id = project_Id; + streamname=stream_name; + this.MobileNo=MobileNo; + /* collegename=collegenames; + streamname=stream_name;*/ + + } +/* public UnapprovedProjectList(String student_name, String college_name, String project_tittle, String amount, String lead_id,String Project_Id) { + Student_name = student_name; + College_name = college_name; + Project_tittle = project_tittle; + Amount = amount; + Lead_id = lead_id; + Project_Id= Project_Id; + }*/ + + /* public UnapprovedProjectList(String student_name, String college_name, String project_tittle, String amount) { + Student_name = student_name; + College_name = college_name; + Project_tittle = project_tittle; + Amount = amount; + }*/ + + public static ArrayList listview_arr=new ArrayList(); + + + + public String getstream_name() { + return streamname; + } + + public void setstream_name(String stream_name) { + streamname = stream_name; + } + + public String getProject_Id() { + return Project_Id; + } + + public String getStudent_name() { + return Student_name; + } + + public void setStudent_name(String student_name) { + Student_name = student_name; + } + + public String getCollege_name() { + return College_name; + } + + public void setCollege_name(String college_name) { + College_name = college_name; + } + + public String getProject_tittle() { + return Project_tittle; + } + + public void setProject_tittle(String project_tittle) { + Project_tittle = project_tittle; + } + + public String getAmount() { + return Amount; + } + + public void setAmount(String amount) { + Amount = amount; + } + + public String getLead_id() { + return Lead_id; + } + + public String getMobileNo() { + return MobileNo; + } + + + +/* + public String getcollegename() { + return collegename; + } + + public void setCollegename(String college_name) { + collegename = college_name; + } + + + public String getstreamname() { + return collegename; + } + + public void setstreamname(String stream_name) { + streamname = stream_name; + }*/ + +} diff --git a/app/src/main/java/com/leadcampusapp/module/UnapprovedProjectListModule.java b/app/src/main/java/com/leadcampusapp/module/UnapprovedProjectListModule.java new file mode 100644 index 0000000..80100ae --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/module/UnapprovedProjectListModule.java @@ -0,0 +1,143 @@ +package com.leadcampusapp.module; + + +import java.util.ArrayList; + +/** + * Created by User on 10/13/2017. + */ + +public class UnapprovedProjectListModule { + + int id; + + String Student_name; + String College_name; + String Project_tittle; + String Amount; + + String Lead_id; + String Project_type; + String Benficiaries; + String Objectivies; + String Action_plan; + String ProjectId; + String collegename; + String streamname; + + public String getProjectId() { + return ProjectId; + } + + public void setProjectId(String projectId) { + ProjectId = projectId; + } + + public String getLead_id() { + return Lead_id; + } + + public void setLead_id(String lead_id) { + Lead_id = lead_id; + } + + public String getProject_type() { + return Project_type; + } + + public void setProject_type(String project_type) { + Project_type = project_type; + } + + public String getBenficiaries() { + return Benficiaries; + } + + public void setBenficiaries(String benficiaries) { + Benficiaries = benficiaries; + } + + public String getObjectivies() { + return Objectivies; + } + + public void setObjectivies(String objectivies) { + Objectivies = objectivies; + } + + public String getAction_plan() { + return Action_plan; + } + + public void setAction_plan(String action_plan) { + Action_plan = action_plan; + } + + public UnapprovedProjectListModule(){ + + } + + public UnapprovedProjectListModule(String student_name, String college_name, String project_tittle, String amount,String stream_name) { + Student_name = student_name; + College_name = college_name; + Project_tittle = project_tittle; + Amount = amount; + streamname=stream_name; + } + + public static ArrayList listview_arr=new ArrayList(); + + + public String getStudent_name() { + return Student_name; + } + + public void setStudent_name(String student_name) { + Student_name = student_name; + } + + public String getCollege_name() { + return College_name; + } + + public void setCollege_name(String college_name) { + College_name = college_name; + } + + public String getProject_tittle() { + return Project_tittle; + } + + public void setProject_tittle(String project_tittle) { + Project_tittle = project_tittle; + } + + public String getAmount() { + return Amount; + } + + public void setAmount(String amount) { + Amount = amount; + } + + + + + public String getcollegename() { + return collegename; + } + + public void setcollegename(String college_name) { + collegename = college_name; + } + + + public String getstreamname() { + return streamname; + } + + public void setstreamname(String stream_name) { + streamname = stream_name; + } + +} diff --git a/app/src/main/java/com/leadcampusapp/remote/Class_ApiUtils.java b/app/src/main/java/com/leadcampusapp/remote/Class_ApiUtils.java new file mode 100644 index 0000000..1f4b80f --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/remote/Class_ApiUtils.java @@ -0,0 +1,13 @@ +package com.leadcampusapp.remote; + +public class Class_ApiUtils { + + public static final String BASE_URL = "https://www.dfindia.org:82/api/";// + + //https://www.dfindia.org:82/api/Authentication/getpaytmchecksumkey?OrderId=202103291320 + public static Interface_userservice getUserService() { + return Class_RetrofitClient.getClient(BASE_URL).create(Interface_userservice.class); + } + + +} diff --git a/app/src/main/java/com/leadcampusapp/remote/Class_RetrofitClient.java b/app/src/main/java/com/leadcampusapp/remote/Class_RetrofitClient.java new file mode 100644 index 0000000..281215a --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/remote/Class_RetrofitClient.java @@ -0,0 +1,48 @@ +package com.leadcampusapp.remote; + + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; + +import retrofit2.Retrofit; +import retrofit2.converter.gson.GsonConverterFactory; + + +public class Class_RetrofitClient { + + + public static Retrofit retrofit = null; + + + + public static Retrofit getClient(String url){ + if(retrofit == null){ + Gson gson = new GsonBuilder() + .setLenient() + .create(); + + retrofit = new Retrofit.Builder() + .baseUrl(url) + .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) + // .addConverterFactory(GsonConverterFactory.create(gson)) + .addConverterFactory(GsonConverterFactory.create()) + .build(); + + + + + /*retrofit = new Retrofit.Builder() + .baseUrl(url) + // .client(client) + .addConverterFactory(GsonConverterFactory.create(gson)) + .build();*/ + + + } + return retrofit; + } + + +} + diff --git a/app/src/main/java/com/leadcampusapp/remote/Interface_userservice.java b/app/src/main/java/com/leadcampusapp/remote/Interface_userservice.java new file mode 100644 index 0000000..85d212d --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/remote/Interface_userservice.java @@ -0,0 +1,28 @@ +package com.leadcampusapp.remote; + + + +import com.leadcampusapp.Class_token_response; + +import retrofit2.Call; +import retrofit2.Response; +import retrofit2.http.GET; +import retrofit2.http.Headers; +import retrofit2.http.Query; + + +public interface Interface_userservice { + + + + @Headers("Content-Type: application/json;charset=utf-8") + @GET("Authentication/getpaytmchecksumkey") + Callgetpaytmchecksumkey(@Query("OrderId") String Pond_ID); + + @Headers("Content-Type: application/json;charset=utf-8") + @GET("Authentication/getpaytmchecksumkey") + Callgetpaytmchecksumkey1(@Query("OrderId") String Pond_ID); + +//https://www.dfindia.org:82/api/Authentication/getpaytmchecksumkey?OrderId=202103291320 + +} diff --git a/app/src/main/java/com/leadcampusapp/vmmaterial.java b/app/src/main/java/com/leadcampusapp/vmmaterial.java new file mode 100644 index 0000000..b740de6 --- /dev/null +++ b/app/src/main/java/com/leadcampusapp/vmmaterial.java @@ -0,0 +1,72 @@ +package com.leadcampusapp; + +import org.ksoap2.serialization.KvmSerializable; +import org.ksoap2.serialization.PropertyInfo; + +import java.util.Hashtable; + +/** + * Created by Shripad on 08-07-2018. + */ + +class vmmaterial implements KvmSerializable{ + + + private long slno; + private String MeterialName; + private float MeterialCost; + + public vmmaterial(){ + + } + + public vmmaterial(long slno, String meterialName, float meterialCost) { + this.slno = slno; + MeterialName = meterialName; + MeterialCost = meterialCost; + } + + public long getSlno() { + return slno; + } + + public void setSlno(long slno) { + this.slno = slno; + } + + public String getMeterialName() { + return MeterialName; + } + + public void setMeterialName(String meterialName) { + MeterialName = meterialName; + } + + public float getMeterialCost() { + return MeterialCost; + } + + public void setMeterialCost(float meterialCost) { + MeterialCost = meterialCost; + } + + @Override + public Object getProperty(int i) { + return null; + } + + @Override + public int getPropertyCount() { + return 0; + } + + @Override + public void setProperty(int i, Object o) { + + } + + @Override + public void getPropertyInfo(int i, Hashtable hashtable, PropertyInfo propertyInfo) { + + } +} diff --git a/app/src/main/res/anim/blinking_animation.xml b/app/src/main/res/anim/blinking_animation.xml new file mode 100644 index 0000000..0dad3c9 --- /dev/null +++ b/app/src/main/res/anim/blinking_animation.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/anim/shakeanimation.xml b/app/src/main/res/anim/shakeanimation.xml new file mode 100644 index 0000000..2b165ee --- /dev/null +++ b/app/src/main/res/anim/shakeanimation.xml @@ -0,0 +1,9 @@ + + \ No newline at end of file diff --git a/app/src/main/res/drawable-hdpi/approve_home.png b/app/src/main/res/drawable-hdpi/approve_home.png new file mode 100644 index 0000000..7cae25e Binary files /dev/null and b/app/src/main/res/drawable-hdpi/approve_home.png differ diff --git a/app/src/main/res/drawable-hdpi/approved.png b/app/src/main/res/drawable-hdpi/approved.png new file mode 100644 index 0000000..c63481d Binary files /dev/null and b/app/src/main/res/drawable-hdpi/approved.png differ diff --git a/app/src/main/res/drawable-hdpi/badge_background.xml b/app/src/main/res/drawable-hdpi/badge_background.xml new file mode 100644 index 0000000..426c388 --- /dev/null +++ b/app/src/main/res/drawable-hdpi/badge_background.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-hdpi/completed_home.png b/app/src/main/res/drawable-hdpi/completed_home.png new file mode 100644 index 0000000..91aae54 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/completed_home.png differ diff --git a/app/src/main/res/drawable-hdpi/dflogo.png b/app/src/main/res/drawable-hdpi/dflogo.png new file mode 100644 index 0000000..1dd34c8 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/dflogo.png differ diff --git a/app/src/main/res/drawable-hdpi/fb.png b/app/src/main/res/drawable-hdpi/fb.png new file mode 100644 index 0000000..f03ddf9 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/fb.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_accessibility_black_18dp.png b/app/src/main/res/drawable-hdpi/ic_accessibility_black_18dp.png new file mode 100644 index 0000000..c9e421f Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_accessibility_black_18dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_add_black_36dp.png b/app/src/main/res/drawable-hdpi/ic_add_black_36dp.png new file mode 100644 index 0000000..bb8c846 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_add_black_36dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_add_white_36dp.png b/app/src/main/res/drawable-hdpi/ic_add_white_36dp.png new file mode 100644 index 0000000..8186da9 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_add_white_36dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_camera_alt_black_36dp.png b/app/src/main/res/drawable-hdpi/ic_camera_alt_black_36dp.png new file mode 100644 index 0000000..90d14af Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_camera_alt_black_36dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_camera_alt_red_900_18dp.png b/app/src/main/res/drawable-hdpi/ic_camera_alt_red_900_18dp.png new file mode 100644 index 0000000..bd678c4 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_camera_alt_red_900_18dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_camera_alt_red_900_24dp.png b/app/src/main/res/drawable-hdpi/ic_camera_alt_red_900_24dp.png new file mode 100644 index 0000000..e7b0afa Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_camera_alt_red_900_24dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_camera_alt_red_900_36dp.png b/app/src/main/res/drawable-hdpi/ic_camera_alt_red_900_36dp.png new file mode 100644 index 0000000..c6e9a3b Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_camera_alt_red_900_36dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_camera_alt_red_900_48dp.png b/app/src/main/res/drawable-hdpi/ic_camera_alt_red_900_48dp.png new file mode 100644 index 0000000..f14af35 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_camera_alt_red_900_48dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_delete_white_24dp.png b/app/src/main/res/drawable-hdpi/ic_delete_white_24dp.png new file mode 100644 index 0000000..5e89821 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_delete_white_24dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_delete_white_36dp.png b/app/src/main/res/drawable-hdpi/ic_delete_white_36dp.png new file mode 100644 index 0000000..5cc717a Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_delete_white_36dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_group_black_18dp.png b/app/src/main/res/drawable-hdpi/ic_group_black_18dp.png new file mode 100644 index 0000000..c098ddc Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_group_black_18dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_keyboard_arrow_down_black_24dp.png b/app/src/main/res/drawable-hdpi/ic_keyboard_arrow_down_black_24dp.png new file mode 100644 index 0000000..e331cd6 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_keyboard_arrow_down_black_24dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_keyboard_arrow_down_white_24dp.png b/app/src/main/res/drawable-hdpi/ic_keyboard_arrow_down_white_24dp.png new file mode 100644 index 0000000..71381b5 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_keyboard_arrow_down_white_24dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_keyboard_arrow_left_black_36dp.png b/app/src/main/res/drawable-hdpi/ic_keyboard_arrow_left_black_36dp.png new file mode 100644 index 0000000..d7286aa Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_keyboard_arrow_left_black_36dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_message_black_18dp.png b/app/src/main/res/drawable-hdpi/ic_message_black_18dp.png new file mode 100644 index 0000000..6348310 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_message_black_18dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_person_outline_black_18dp.png b/app/src/main/res/drawable-hdpi/ic_person_outline_black_18dp.png new file mode 100644 index 0000000..3fe619c Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_person_outline_black_18dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_photo_camera_red_900_18dp.png b/app/src/main/res/drawable-hdpi/ic_photo_camera_red_900_18dp.png new file mode 100644 index 0000000..bd678c4 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_photo_camera_red_900_18dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_star_yellow_700_36dp.png b/app/src/main/res/drawable-hdpi/ic_star_yellow_700_36dp.png new file mode 100644 index 0000000..f4ea5fc Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_star_yellow_700_36dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_sync_white_24dp.png b/app/src/main/res/drawable-hdpi/ic_sync_white_24dp.png new file mode 100644 index 0000000..e49f32a Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_sync_white_24dp.png differ diff --git a/app/src/main/res/drawable-hdpi/icon_launcher.png b/app/src/main/res/drawable-hdpi/icon_launcher.png new file mode 100644 index 0000000..648b555 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/icon_launcher.png differ diff --git a/app/src/main/res/drawable-hdpi/inst.png b/app/src/main/res/drawable-hdpi/inst.png new file mode 100644 index 0000000..03ae8aa Binary files /dev/null and b/app/src/main/res/drawable-hdpi/inst.png differ diff --git a/app/src/main/res/drawable-hdpi/logo_notification.png b/app/src/main/res/drawable-hdpi/logo_notification.png new file mode 100644 index 0000000..e205a18 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/logo_notification.png differ diff --git a/app/src/main/res/drawable-hdpi/n1.jpeg b/app/src/main/res/drawable-hdpi/n1.jpeg new file mode 100644 index 0000000..1be46c5 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/n1.jpeg differ diff --git a/app/src/main/res/drawable-hdpi/no_cash_bag.png b/app/src/main/res/drawable-hdpi/no_cash_bag.png new file mode 100644 index 0000000..82128c1 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/no_cash_bag.png differ diff --git a/app/src/main/res/drawable-hdpi/pending_home.png b/app/src/main/res/drawable-hdpi/pending_home.png new file mode 100644 index 0000000..429ff8c Binary files /dev/null and b/app/src/main/res/drawable-hdpi/pending_home.png differ diff --git a/app/src/main/res/drawable-hdpi/reapply_button.png b/app/src/main/res/drawable-hdpi/reapply_button.png new file mode 100644 index 0000000..90fa858 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/reapply_button.png differ diff --git a/app/src/main/res/drawable-hdpi/save.png b/app/src/main/res/drawable-hdpi/save.png new file mode 100644 index 0000000..0e19071 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/save.png differ diff --git a/app/src/main/res/drawable-hdpi/save_big.png b/app/src/main/res/drawable-hdpi/save_big.png new file mode 100644 index 0000000..55871f4 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/save_big.png differ diff --git a/app/src/main/res/drawable-hdpi/sharp_share_white_24.png b/app/src/main/res/drawable-hdpi/sharp_share_white_24.png new file mode 100644 index 0000000..aa878bb Binary files /dev/null and b/app/src/main/res/drawable-hdpi/sharp_share_white_24.png differ diff --git a/app/src/main/res/drawable-hdpi/sharp_vertical_align_top_white_24.png b/app/src/main/res/drawable-hdpi/sharp_vertical_align_top_white_24.png new file mode 100644 index 0000000..bae3272 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/sharp_vertical_align_top_white_24.png differ diff --git a/app/src/main/res/drawable-hdpi/tw.png b/app/src/main/res/drawable-hdpi/tw.png new file mode 100644 index 0000000..b6dc5f5 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/tw.png differ diff --git a/app/src/main/res/drawable-mdpi/button_selector.xml b/app/src/main/res/drawable-mdpi/button_selector.xml new file mode 100644 index 0000000..7b1d16b --- /dev/null +++ b/app/src/main/res/drawable-mdpi/button_selector.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-mdpi/buttonshapes.xml b/app/src/main/res/drawable-mdpi/buttonshapes.xml new file mode 100644 index 0000000..bf73b35 --- /dev/null +++ b/app/src/main/res/drawable-mdpi/buttonshapes.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-mdpi/downarrow.png b/app/src/main/res/drawable-mdpi/downarrow.png new file mode 100644 index 0000000..6ba4a9b Binary files /dev/null and b/app/src/main/res/drawable-mdpi/downarrow.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_accessibility_black_18dp.png b/app/src/main/res/drawable-mdpi/ic_accessibility_black_18dp.png new file mode 100644 index 0000000..a36504d Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_accessibility_black_18dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_add_black_36dp.png b/app/src/main/res/drawable-mdpi/ic_add_black_36dp.png new file mode 100644 index 0000000..08769ac Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_add_black_36dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_add_white_36dp.png b/app/src/main/res/drawable-mdpi/ic_add_white_36dp.png new file mode 100644 index 0000000..9999b98 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_add_white_36dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_camera_alt_black_36dp.png b/app/src/main/res/drawable-mdpi/ic_camera_alt_black_36dp.png new file mode 100644 index 0000000..3a7932a Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_camera_alt_black_36dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_camera_alt_red_900_18dp.png b/app/src/main/res/drawable-mdpi/ic_camera_alt_red_900_18dp.png new file mode 100644 index 0000000..220dfaa Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_camera_alt_red_900_18dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_camera_alt_red_900_24dp.png b/app/src/main/res/drawable-mdpi/ic_camera_alt_red_900_24dp.png new file mode 100644 index 0000000..88670cf Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_camera_alt_red_900_24dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_camera_alt_red_900_36dp.png b/app/src/main/res/drawable-mdpi/ic_camera_alt_red_900_36dp.png new file mode 100644 index 0000000..e7b0afa Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_camera_alt_red_900_36dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_camera_alt_red_900_48dp.png b/app/src/main/res/drawable-mdpi/ic_camera_alt_red_900_48dp.png new file mode 100644 index 0000000..7249c7c Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_camera_alt_red_900_48dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_delete_white_24dp.png b/app/src/main/res/drawable-mdpi/ic_delete_white_24dp.png new file mode 100644 index 0000000..8d48b83 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_delete_white_24dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_delete_white_36dp.png b/app/src/main/res/drawable-mdpi/ic_delete_white_36dp.png new file mode 100644 index 0000000..5e89821 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_delete_white_36dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_group_black_18dp.png b/app/src/main/res/drawable-mdpi/ic_group_black_18dp.png new file mode 100644 index 0000000..735614e Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_group_black_18dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_keyboard_arrow_down_black_24dp.png b/app/src/main/res/drawable-mdpi/ic_keyboard_arrow_down_black_24dp.png new file mode 100644 index 0000000..122613d Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_keyboard_arrow_down_black_24dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_keyboard_arrow_down_white_24dp.png b/app/src/main/res/drawable-mdpi/ic_keyboard_arrow_down_white_24dp.png new file mode 100644 index 0000000..d67a650 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_keyboard_arrow_down_white_24dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_keyboard_arrow_left_black_36dp.png b/app/src/main/res/drawable-mdpi/ic_keyboard_arrow_left_black_36dp.png new file mode 100644 index 0000000..4c91cfa Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_keyboard_arrow_left_black_36dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_message_black_18dp.png b/app/src/main/res/drawable-mdpi/ic_message_black_18dp.png new file mode 100644 index 0000000..8ba2c0c Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_message_black_18dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_person_outline_black_18dp.png b/app/src/main/res/drawable-mdpi/ic_person_outline_black_18dp.png new file mode 100644 index 0000000..0434e16 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_person_outline_black_18dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_photo_camera_red_900_18dp.png b/app/src/main/res/drawable-mdpi/ic_photo_camera_red_900_18dp.png new file mode 100644 index 0000000..220dfaa Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_photo_camera_red_900_18dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_star_yellow_700_36dp.png b/app/src/main/res/drawable-mdpi/ic_star_yellow_700_36dp.png new file mode 100644 index 0000000..1b321f7 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_star_yellow_700_36dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_sync_white_24dp.png b/app/src/main/res/drawable-mdpi/ic_sync_white_24dp.png new file mode 100644 index 0000000..56deec8 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_sync_white_24dp.png differ diff --git a/app/src/main/res/drawable-mdpi/icon_launcher.png b/app/src/main/res/drawable-mdpi/icon_launcher.png new file mode 100644 index 0000000..648b555 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/icon_launcher.png differ diff --git a/app/src/main/res/drawable-mdpi/icon_notification.png b/app/src/main/res/drawable-mdpi/icon_notification.png new file mode 100644 index 0000000..45bed92 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/icon_notification.png differ diff --git a/app/src/main/res/drawable-mdpi/login_button_rectangle.xml b/app/src/main/res/drawable-mdpi/login_button_rectangle.xml new file mode 100644 index 0000000..c8219ad --- /dev/null +++ b/app/src/main/res/drawable-mdpi/login_button_rectangle.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-mdpi/logo_notification.png b/app/src/main/res/drawable-mdpi/logo_notification.png new file mode 100644 index 0000000..e205a18 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/logo_notification.png differ diff --git a/app/src/main/res/drawable-mdpi/sharp_share_white_24.png b/app/src/main/res/drawable-mdpi/sharp_share_white_24.png new file mode 100644 index 0000000..a4befbf Binary files /dev/null and b/app/src/main/res/drawable-mdpi/sharp_share_white_24.png differ diff --git a/app/src/main/res/drawable-mdpi/sharp_vertical_align_top_white_24.png b/app/src/main/res/drawable-mdpi/sharp_vertical_align_top_white_24.png new file mode 100644 index 0000000..f8b15b4 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/sharp_vertical_align_top_white_24.png differ diff --git a/app/src/main/res/drawable-v21/ic_menu_camera.xml b/app/src/main/res/drawable-v21/ic_menu_camera.xml new file mode 100644 index 0000000..0d9ea10 --- /dev/null +++ b/app/src/main/res/drawable-v21/ic_menu_camera.xml @@ -0,0 +1,12 @@ + + + + diff --git a/app/src/main/res/drawable-v21/ic_menu_gallery.xml b/app/src/main/res/drawable-v21/ic_menu_gallery.xml new file mode 100644 index 0000000..f6872c4 --- /dev/null +++ b/app/src/main/res/drawable-v21/ic_menu_gallery.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable-v21/ic_menu_manage.xml b/app/src/main/res/drawable-v21/ic_menu_manage.xml new file mode 100644 index 0000000..c1be60b --- /dev/null +++ b/app/src/main/res/drawable-v21/ic_menu_manage.xml @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-v21/ic_menu_send.xml b/app/src/main/res/drawable-v21/ic_menu_send.xml new file mode 100644 index 0000000..00c668c --- /dev/null +++ b/app/src/main/res/drawable-v21/ic_menu_send.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable-v21/ic_menu_share.xml b/app/src/main/res/drawable-v21/ic_menu_share.xml new file mode 100644 index 0000000..a28fb9e --- /dev/null +++ b/app/src/main/res/drawable-v21/ic_menu_share.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable-v21/ic_menu_slideshow.xml b/app/src/main/res/drawable-v21/ic_menu_slideshow.xml new file mode 100644 index 0000000..209aa64 --- /dev/null +++ b/app/src/main/res/drawable-v21/ic_menu_slideshow.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-xhdpi/balance_amt.png b/app/src/main/res/drawable-xhdpi/balance_amt.png new file mode 100644 index 0000000..1bd0413 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/balance_amt.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_accessibility_black_18dp.png b/app/src/main/res/drawable-xhdpi/ic_accessibility_black_18dp.png new file mode 100644 index 0000000..1337311 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_accessibility_black_18dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_add_black_36dp.png b/app/src/main/res/drawable-xhdpi/ic_add_black_36dp.png new file mode 100644 index 0000000..b5732cd Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_add_black_36dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_add_white_36dp.png b/app/src/main/res/drawable-xhdpi/ic_add_white_36dp.png new file mode 100644 index 0000000..3a15191 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_add_white_36dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_camera_alt_black_36dp.png b/app/src/main/res/drawable-xhdpi/ic_camera_alt_black_36dp.png new file mode 100644 index 0000000..e8ae648 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_camera_alt_black_36dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_camera_alt_red_900_18dp.png b/app/src/main/res/drawable-xhdpi/ic_camera_alt_red_900_18dp.png new file mode 100644 index 0000000..e7b0afa Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_camera_alt_red_900_18dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_camera_alt_red_900_24dp.png b/app/src/main/res/drawable-xhdpi/ic_camera_alt_red_900_24dp.png new file mode 100644 index 0000000..7249c7c Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_camera_alt_red_900_24dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_camera_alt_red_900_36dp.png b/app/src/main/res/drawable-xhdpi/ic_camera_alt_red_900_36dp.png new file mode 100644 index 0000000..f14af35 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_camera_alt_red_900_36dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_camera_alt_red_900_48dp.png b/app/src/main/res/drawable-xhdpi/ic_camera_alt_red_900_48dp.png new file mode 100644 index 0000000..d13ca49 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_camera_alt_red_900_48dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_delete_white_24dp.png b/app/src/main/res/drawable-xhdpi/ic_delete_white_24dp.png new file mode 100644 index 0000000..3c9e171 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_delete_white_24dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_delete_white_36dp.png b/app/src/main/res/drawable-xhdpi/ic_delete_white_36dp.png new file mode 100644 index 0000000..5d2e8ea Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_delete_white_36dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_group_black_18dp.png b/app/src/main/res/drawable-xhdpi/ic_group_black_18dp.png new file mode 100644 index 0000000..792d67d Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_group_black_18dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_keyboard_arrow_down_black_24dp.png b/app/src/main/res/drawable-xhdpi/ic_keyboard_arrow_down_black_24dp.png new file mode 100644 index 0000000..19ea9b4 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_keyboard_arrow_down_black_24dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_keyboard_arrow_down_white_24dp.png b/app/src/main/res/drawable-xhdpi/ic_keyboard_arrow_down_white_24dp.png new file mode 100644 index 0000000..9ba3146 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_keyboard_arrow_down_white_24dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_keyboard_arrow_left_black_36dp.png b/app/src/main/res/drawable-xhdpi/ic_keyboard_arrow_left_black_36dp.png new file mode 100644 index 0000000..63bfd2d Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_keyboard_arrow_left_black_36dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_message_black_18dp.png b/app/src/main/res/drawable-xhdpi/ic_message_black_18dp.png new file mode 100644 index 0000000..2797792 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_message_black_18dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_person_outline_black_18dp.png b/app/src/main/res/drawable-xhdpi/ic_person_outline_black_18dp.png new file mode 100644 index 0000000..4361bdf Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_person_outline_black_18dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_photo_camera_red_900_18dp.png b/app/src/main/res/drawable-xhdpi/ic_photo_camera_red_900_18dp.png new file mode 100644 index 0000000..e7b0afa Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_photo_camera_red_900_18dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_star_yellow_700_36dp.png b/app/src/main/res/drawable-xhdpi/ic_star_yellow_700_36dp.png new file mode 100644 index 0000000..72035ef Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_star_yellow_700_36dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_sync_white_24dp.png b/app/src/main/res/drawable-xhdpi/ic_sync_white_24dp.png new file mode 100644 index 0000000..2c12bee Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_sync_white_24dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/icon_launcher.png b/app/src/main/res/drawable-xhdpi/icon_launcher.png new file mode 100644 index 0000000..648b555 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/icon_launcher.png differ diff --git a/app/src/main/res/drawable-xhdpi/logo_notification.png b/app/src/main/res/drawable-xhdpi/logo_notification.png new file mode 100644 index 0000000..e205a18 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/logo_notification.png differ diff --git a/app/src/main/res/drawable-xhdpi/sharp_share_white_24.png b/app/src/main/res/drawable-xhdpi/sharp_share_white_24.png new file mode 100644 index 0000000..1360551 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/sharp_share_white_24.png differ diff --git a/app/src/main/res/drawable-xhdpi/sharp_vertical_align_top_white_24.png b/app/src/main/res/drawable-xhdpi/sharp_vertical_align_top_white_24.png new file mode 100644 index 0000000..e82382f Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/sharp_vertical_align_top_white_24.png differ diff --git a/app/src/main/res/drawable-xxhdpi/badge_background1.xml b/app/src/main/res/drawable-xxhdpi/badge_background1.xml new file mode 100644 index 0000000..c8a57f4 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/badge_background1.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-xxhdpi/button_rectangle_blue.xml b/app/src/main/res/drawable-xxhdpi/button_rectangle_blue.xml new file mode 100644 index 0000000..23eb9ac --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/button_rectangle_blue.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-xxhdpi/button_rectangle_white.xml b/app/src/main/res/drawable-xxhdpi/button_rectangle_white.xml new file mode 100644 index 0000000..fd197a8 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/button_rectangle_white.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-xxhdpi/edittext_bottom_line_white.xml b/app/src/main/res/drawable-xxhdpi/edittext_bottom_line_white.xml new file mode 100644 index 0000000..9eb0513 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/edittext_bottom_line_white.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-xxhdpi/ic_accessibility_black_18dp.png b/app/src/main/res/drawable-xxhdpi/ic_accessibility_black_18dp.png new file mode 100644 index 0000000..7f50a98 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_accessibility_black_18dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_add_black_36dp.png b/app/src/main/res/drawable-xxhdpi/ic_add_black_36dp.png new file mode 100644 index 0000000..ad568eb Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_add_black_36dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_add_white_36dp.png b/app/src/main/res/drawable-xxhdpi/ic_add_white_36dp.png new file mode 100644 index 0000000..7d6875d Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_add_white_36dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_camera_alt_black_36dp.png b/app/src/main/res/drawable-xxhdpi/ic_camera_alt_black_36dp.png new file mode 100644 index 0000000..b7bad8b Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_camera_alt_black_36dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_camera_alt_red_900_18dp.png b/app/src/main/res/drawable-xxhdpi/ic_camera_alt_red_900_18dp.png new file mode 100644 index 0000000..c6e9a3b Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_camera_alt_red_900_18dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_camera_alt_red_900_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_camera_alt_red_900_24dp.png new file mode 100644 index 0000000..f14af35 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_camera_alt_red_900_24dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_camera_alt_red_900_36dp.png b/app/src/main/res/drawable-xxhdpi/ic_camera_alt_red_900_36dp.png new file mode 100644 index 0000000..975ef42 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_camera_alt_red_900_36dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_camera_alt_red_900_48dp.png b/app/src/main/res/drawable-xxhdpi/ic_camera_alt_red_900_48dp.png new file mode 100644 index 0000000..d23cbf2 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_camera_alt_red_900_48dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_delete_white_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_delete_white_24dp.png new file mode 100644 index 0000000..5d2e8ea Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_delete_white_24dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_delete_white_36dp.png b/app/src/main/res/drawable-xxhdpi/ic_delete_white_36dp.png new file mode 100644 index 0000000..f089966 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_delete_white_36dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_group_black_18dp.png b/app/src/main/res/drawable-xxhdpi/ic_group_black_18dp.png new file mode 100644 index 0000000..4fe1b2a Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_group_black_18dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_keyboard_arrow_down_black_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_keyboard_arrow_down_black_24dp.png new file mode 100644 index 0000000..994fdb1 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_keyboard_arrow_down_black_24dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_keyboard_arrow_down_white_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_keyboard_arrow_down_white_24dp.png new file mode 100644 index 0000000..527a9ee Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_keyboard_arrow_down_white_24dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_keyboard_arrow_left_black_36dp.png b/app/src/main/res/drawable-xxhdpi/ic_keyboard_arrow_left_black_36dp.png new file mode 100644 index 0000000..d583bc7 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_keyboard_arrow_left_black_36dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_message_black_18dp.png b/app/src/main/res/drawable-xxhdpi/ic_message_black_18dp.png new file mode 100644 index 0000000..c5b2f4c Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_message_black_18dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_person_outline_black_18dp.png b/app/src/main/res/drawable-xxhdpi/ic_person_outline_black_18dp.png new file mode 100644 index 0000000..01ce295 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_person_outline_black_18dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_photo_camera_red_900_18dp.png b/app/src/main/res/drawable-xxhdpi/ic_photo_camera_red_900_18dp.png new file mode 100644 index 0000000..c6e9a3b Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_photo_camera_red_900_18dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_star_yellow_700_36dp.png b/app/src/main/res/drawable-xxhdpi/ic_star_yellow_700_36dp.png new file mode 100644 index 0000000..fe3ad0e Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_star_yellow_700_36dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_sync_white_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_sync_white_24dp.png new file mode 100644 index 0000000..e2c2602 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_sync_white_24dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/icon_launcher.png b/app/src/main/res/drawable-xxhdpi/icon_launcher.png new file mode 100644 index 0000000..648b555 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_launcher.png differ diff --git a/app/src/main/res/drawable-xxhdpi/pplus.png b/app/src/main/res/drawable-xxhdpi/pplus.png new file mode 100644 index 0000000..5851bfb Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/pplus.png differ diff --git a/app/src/main/res/drawable-xxhdpi/sharp_share_white_24.png b/app/src/main/res/drawable-xxhdpi/sharp_share_white_24.png new file mode 100644 index 0000000..02cea48 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/sharp_share_white_24.png differ diff --git a/app/src/main/res/drawable-xxhdpi/spinnerarrow2.xml b/app/src/main/res/drawable-xxhdpi/spinnerarrow2.xml new file mode 100644 index 0000000..31f3036 --- /dev/null +++ b/app/src/main/res/drawable-xxhdpi/spinnerarrow2.xml @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-xxhdpi/studentjourneypplus.png b/app/src/main/res/drawable-xxhdpi/studentjourneypplus.png new file mode 100644 index 0000000..80a7c8d Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/studentjourneypplus.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/completion_drawable_photofolder.xml b/app/src/main/res/drawable-xxxhdpi/completion_drawable_photofolder.xml new file mode 100644 index 0000000..6321114 --- /dev/null +++ b/app/src/main/res/drawable-xxxhdpi/completion_drawable_photofolder.xml @@ -0,0 +1,12 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable-xxxhdpi/ic_accessibility_black_18dp.png b/app/src/main/res/drawable-xxxhdpi/ic_accessibility_black_18dp.png new file mode 100644 index 0000000..b60d52f Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_accessibility_black_18dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_add_black_36dp.png b/app/src/main/res/drawable-xxxhdpi/ic_add_black_36dp.png new file mode 100644 index 0000000..76b4edb Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_add_black_36dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_add_white_36dp.png b/app/src/main/res/drawable-xxxhdpi/ic_add_white_36dp.png new file mode 100644 index 0000000..944441d Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_add_white_36dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_camera_alt_black_36dp.png b/app/src/main/res/drawable-xxxhdpi/ic_camera_alt_black_36dp.png new file mode 100644 index 0000000..9102222 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_camera_alt_black_36dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_camera_alt_red_900_18dp.png b/app/src/main/res/drawable-xxxhdpi/ic_camera_alt_red_900_18dp.png new file mode 100644 index 0000000..f14af35 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_camera_alt_red_900_18dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_camera_alt_red_900_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_camera_alt_red_900_24dp.png new file mode 100644 index 0000000..d13ca49 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_camera_alt_red_900_24dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_camera_alt_red_900_36dp.png b/app/src/main/res/drawable-xxxhdpi/ic_camera_alt_red_900_36dp.png new file mode 100644 index 0000000..d23cbf2 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_camera_alt_red_900_36dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_camera_alt_red_900_48dp.png b/app/src/main/res/drawable-xxxhdpi/ic_camera_alt_red_900_48dp.png new file mode 100644 index 0000000..5afcd20 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_camera_alt_red_900_48dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_delete_white_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_delete_white_24dp.png new file mode 100644 index 0000000..e7b2514 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_delete_white_24dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_delete_white_36dp.png b/app/src/main/res/drawable-xxxhdpi/ic_delete_white_36dp.png new file mode 100644 index 0000000..b41f287 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_delete_white_36dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_group_black_18dp.png b/app/src/main/res/drawable-xxxhdpi/ic_group_black_18dp.png new file mode 100644 index 0000000..ba45085 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_group_black_18dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_keyboard_arrow_down_black_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_keyboard_arrow_down_black_24dp.png new file mode 100644 index 0000000..444b12b Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_keyboard_arrow_down_black_24dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_keyboard_arrow_down_white_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_keyboard_arrow_down_white_24dp.png new file mode 100644 index 0000000..2dfdb2c Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_keyboard_arrow_down_white_24dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_keyboard_arrow_left_black_36dp.png b/app/src/main/res/drawable-xxxhdpi/ic_keyboard_arrow_left_black_36dp.png new file mode 100644 index 0000000..00be036 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_keyboard_arrow_left_black_36dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_message_black_18dp.png b/app/src/main/res/drawable-xxxhdpi/ic_message_black_18dp.png new file mode 100644 index 0000000..ff82e73 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_message_black_18dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_person_outline_black_18dp.png b/app/src/main/res/drawable-xxxhdpi/ic_person_outline_black_18dp.png new file mode 100644 index 0000000..ff4ffa9 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_person_outline_black_18dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_photo_camera_red_900_18dp.png b/app/src/main/res/drawable-xxxhdpi/ic_photo_camera_red_900_18dp.png new file mode 100644 index 0000000..f14af35 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_photo_camera_red_900_18dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_star_yellow_700_36dp.png b/app/src/main/res/drawable-xxxhdpi/ic_star_yellow_700_36dp.png new file mode 100644 index 0000000..740ae95 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_star_yellow_700_36dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_sync_white_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_sync_white_24dp.png new file mode 100644 index 0000000..11880fe Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_sync_white_24dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/icon_launcher.png b/app/src/main/res/drawable-xxxhdpi/icon_launcher.png new file mode 100644 index 0000000..648b555 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/icon_launcher.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/sharp_share_white_24.png b/app/src/main/res/drawable-xxxhdpi/sharp_share_white_24.png new file mode 100644 index 0000000..f10300c Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/sharp_share_white_24.png differ diff --git a/app/src/main/res/drawable/about.png b/app/src/main/res/drawable/about.png new file mode 100644 index 0000000..cc1dbfa Binary files /dev/null and b/app/src/main/res/drawable/about.png differ diff --git a/app/src/main/res/drawable/about_new.png b/app/src/main/res/drawable/about_new.png new file mode 100644 index 0000000..0871500 Binary files /dev/null and b/app/src/main/res/drawable/about_new.png differ diff --git a/app/src/main/res/drawable/about_us.png b/app/src/main/res/drawable/about_us.png new file mode 100644 index 0000000..cc436e4 Binary files /dev/null and b/app/src/main/res/drawable/about_us.png differ diff --git a/app/src/main/res/drawable/aboutus.png b/app/src/main/res/drawable/aboutus.png new file mode 100644 index 0000000..4531d59 Binary files /dev/null and b/app/src/main/res/drawable/aboutus.png differ diff --git a/app/src/main/res/drawable/add_white.png b/app/src/main/res/drawable/add_white.png new file mode 100644 index 0000000..ea78104 Binary files /dev/null and b/app/src/main/res/drawable/add_white.png differ diff --git a/app/src/main/res/drawable/analytical.png b/app/src/main/res/drawable/analytical.png new file mode 100644 index 0000000..d237841 Binary files /dev/null and b/app/src/main/res/drawable/analytical.png differ diff --git a/app/src/main/res/drawable/applynow.png b/app/src/main/res/drawable/applynow.png new file mode 100644 index 0000000..c231198 Binary files /dev/null and b/app/src/main/res/drawable/applynow.png differ diff --git a/app/src/main/res/drawable/approve_new.png b/app/src/main/res/drawable/approve_new.png new file mode 100644 index 0000000..d5de50c Binary files /dev/null and b/app/src/main/res/drawable/approve_new.png differ diff --git a/app/src/main/res/drawable/approvedhome_new.png b/app/src/main/res/drawable/approvedhome_new.png new file mode 100644 index 0000000..8fab97b Binary files /dev/null and b/app/src/main/res/drawable/approvedhome_new.png differ diff --git a/app/src/main/res/drawable/approveneww.png b/app/src/main/res/drawable/approveneww.png new file mode 100644 index 0000000..46ad47d Binary files /dev/null and b/app/src/main/res/drawable/approveneww.png differ diff --git a/app/src/main/res/drawable/background.jpg b/app/src/main/res/drawable/background.jpg new file mode 100644 index 0000000..981b91e Binary files /dev/null and b/app/src/main/res/drawable/background.jpg differ diff --git a/app/src/main/res/drawable/background_login.jpg b/app/src/main/res/drawable/background_login.jpg new file mode 100644 index 0000000..9ff4a13 Binary files /dev/null and b/app/src/main/res/drawable/background_login.jpg differ diff --git a/app/src/main/res/drawable/background_round.xml b/app/src/main/res/drawable/background_round.xml new file mode 100644 index 0000000..dc93e4d --- /dev/null +++ b/app/src/main/res/drawable/background_round.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bankdocument.png b/app/src/main/res/drawable/bankdocument.png new file mode 100644 index 0000000..7a4ecca Binary files /dev/null and b/app/src/main/res/drawable/bankdocument.png differ diff --git a/app/src/main/res/drawable/baseline_keyboard_arrow_down_black_18dp.png b/app/src/main/res/drawable/baseline_keyboard_arrow_down_black_18dp.png new file mode 100644 index 0000000..a8f262f Binary files /dev/null and b/app/src/main/res/drawable/baseline_keyboard_arrow_down_black_18dp.png differ diff --git a/app/src/main/res/drawable/baseline_keyboard_arrow_right_black_18dp.png b/app/src/main/res/drawable/baseline_keyboard_arrow_right_black_18dp.png new file mode 100644 index 0000000..31f0a23 Binary files /dev/null and b/app/src/main/res/drawable/baseline_keyboard_arrow_right_black_18dp.png differ diff --git a/app/src/main/res/drawable/baseline_notifications_white_24.png b/app/src/main/res/drawable/baseline_notifications_white_24.png new file mode 100644 index 0000000..45c7ee0 Binary files /dev/null and b/app/src/main/res/drawable/baseline_notifications_white_24.png differ diff --git a/app/src/main/res/drawable/border_for_tshirt.xml b/app/src/main/res/drawable/border_for_tshirt.xml new file mode 100644 index 0000000..573426e --- /dev/null +++ b/app/src/main/res/drawable/border_for_tshirt.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/boy.png b/app/src/main/res/drawable/boy.png new file mode 100644 index 0000000..04f966b Binary files /dev/null and b/app/src/main/res/drawable/boy.png differ diff --git a/app/src/main/res/drawable/boy_new.png b/app/src/main/res/drawable/boy_new.png new file mode 100644 index 0000000..764926c Binary files /dev/null and b/app/src/main/res/drawable/boy_new.png differ diff --git a/app/src/main/res/drawable/bubble_chat.png b/app/src/main/res/drawable/bubble_chat.png new file mode 100644 index 0000000..08c6f09 Binary files /dev/null and b/app/src/main/res/drawable/bubble_chat.png differ diff --git a/app/src/main/res/drawable/call.png b/app/src/main/res/drawable/call.png new file mode 100644 index 0000000..454ec1a Binary files /dev/null and b/app/src/main/res/drawable/call.png differ diff --git a/app/src/main/res/drawable/cancle.png b/app/src/main/res/drawable/cancle.png new file mode 100644 index 0000000..6f8be04 Binary files /dev/null and b/app/src/main/res/drawable/cancle.png differ diff --git a/app/src/main/res/drawable/cash_bag.png b/app/src/main/res/drawable/cash_bag.png new file mode 100644 index 0000000..12754dc Binary files /dev/null and b/app/src/main/res/drawable/cash_bag.png differ diff --git a/app/src/main/res/drawable/cell_shape.xml b/app/src/main/res/drawable/cell_shape.xml new file mode 100644 index 0000000..bb00c21 --- /dev/null +++ b/app/src/main/res/drawable/cell_shape.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/chat_send.png b/app/src/main/res/drawable/chat_send.png new file mode 100644 index 0000000..a96815d Binary files /dev/null and b/app/src/main/res/drawable/chat_send.png differ diff --git a/app/src/main/res/drawable/chatbox.png b/app/src/main/res/drawable/chatbox.png new file mode 100644 index 0000000..230bf7f Binary files /dev/null and b/app/src/main/res/drawable/chatbox.png differ diff --git a/app/src/main/res/drawable/circle.xml b/app/src/main/res/drawable/circle.xml new file mode 100644 index 0000000..0ba622d --- /dev/null +++ b/app/src/main/res/drawable/circle.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/comhome_new.png b/app/src/main/res/drawable/comhome_new.png new file mode 100644 index 0000000..3f745ef Binary files /dev/null and b/app/src/main/res/drawable/comhome_new.png differ diff --git a/app/src/main/res/drawable/completed.png b/app/src/main/res/drawable/completed.png new file mode 100644 index 0000000..bc74bd1 Binary files /dev/null and b/app/src/main/res/drawable/completed.png differ diff --git a/app/src/main/res/drawable/contact.png b/app/src/main/res/drawable/contact.png new file mode 100644 index 0000000..cecc533 Binary files /dev/null and b/app/src/main/res/drawable/contact.png differ diff --git a/app/src/main/res/drawable/contact_new.png b/app/src/main/res/drawable/contact_new.png new file mode 100644 index 0000000..f7aff9e Binary files /dev/null and b/app/src/main/res/drawable/contact_new.png differ diff --git a/app/src/main/res/drawable/crown_man_1.png b/app/src/main/res/drawable/crown_man_1.png new file mode 100644 index 0000000..e8f0b30 Binary files /dev/null and b/app/src/main/res/drawable/crown_man_1.png differ diff --git a/app/src/main/res/drawable/crown_women_1.png b/app/src/main/res/drawable/crown_women_1.png new file mode 100644 index 0000000..bff2f2a Binary files /dev/null and b/app/src/main/res/drawable/crown_women_1.png differ diff --git a/app/src/main/res/drawable/custom_expandable.xml b/app/src/main/res/drawable/custom_expandable.xml new file mode 100644 index 0000000..3176271 --- /dev/null +++ b/app/src/main/res/drawable/custom_expandable.xml @@ -0,0 +1,17 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/custom_toggle.xml b/app/src/main/res/drawable/custom_toggle.xml new file mode 100644 index 0000000..3f880e7 --- /dev/null +++ b/app/src/main/res/drawable/custom_toggle.xml @@ -0,0 +1,10 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/date_search.png b/app/src/main/res/drawable/date_search.png new file mode 100644 index 0000000..c046603 Binary files /dev/null and b/app/src/main/res/drawable/date_search.png differ diff --git a/app/src/main/res/drawable/delete_img.png b/app/src/main/res/drawable/delete_img.png new file mode 100644 index 0000000..70063ca Binary files /dev/null and b/app/src/main/res/drawable/delete_img.png differ diff --git a/app/src/main/res/drawable/devanand.png b/app/src/main/res/drawable/devanand.png new file mode 100644 index 0000000..5f908c4 Binary files /dev/null and b/app/src/main/res/drawable/devanand.png differ diff --git a/app/src/main/res/drawable/doc.png b/app/src/main/res/drawable/doc.png new file mode 100644 index 0000000..f14245c Binary files /dev/null and b/app/src/main/res/drawable/doc.png differ diff --git a/app/src/main/res/drawable/edittext_bottom_line.xml b/app/src/main/res/drawable/edittext_bottom_line.xml new file mode 100644 index 0000000..6c6fc47 --- /dev/null +++ b/app/src/main/res/drawable/edittext_bottom_line.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/email.png b/app/src/main/res/drawable/email.png new file mode 100644 index 0000000..643de6a Binary files /dev/null and b/app/src/main/res/drawable/email.png differ diff --git a/app/src/main/res/drawable/event.png b/app/src/main/res/drawable/event.png new file mode 100644 index 0000000..630f50e Binary files /dev/null and b/app/src/main/res/drawable/event.png differ diff --git a/app/src/main/res/drawable/events_new.png b/app/src/main/res/drawable/events_new.png new file mode 100644 index 0000000..00aa0d3 Binary files /dev/null and b/app/src/main/res/drawable/events_new.png differ diff --git a/app/src/main/res/drawable/fb_001.png b/app/src/main/res/drawable/fb_001.png new file mode 100644 index 0000000..9f74c7c Binary files /dev/null and b/app/src/main/res/drawable/fb_001.png differ diff --git a/app/src/main/res/drawable/fb_new.png b/app/src/main/res/drawable/fb_new.png new file mode 100644 index 0000000..1860a87 Binary files /dev/null and b/app/src/main/res/drawable/fb_new.png differ diff --git a/app/src/main/res/drawable/fb_whit_001.png b/app/src/main/res/drawable/fb_whit_001.png new file mode 100644 index 0000000..5c2cecc Binary files /dev/null and b/app/src/main/res/drawable/fb_whit_001.png differ diff --git a/app/src/main/res/drawable/fees_new.png b/app/src/main/res/drawable/fees_new.png new file mode 100644 index 0000000..bbb1289 Binary files /dev/null and b/app/src/main/res/drawable/fees_new.png differ diff --git a/app/src/main/res/drawable/fund_ticketsinfo.png b/app/src/main/res/drawable/fund_ticketsinfo.png new file mode 100644 index 0000000..fa5fe84 Binary files /dev/null and b/app/src/main/res/drawable/fund_ticketsinfo.png differ diff --git a/app/src/main/res/drawable/girl.png b/app/src/main/res/drawable/girl.png new file mode 100644 index 0000000..fa1dd72 Binary files /dev/null and b/app/src/main/res/drawable/girl.png differ diff --git a/app/src/main/res/drawable/girl_new.png b/app/src/main/res/drawable/girl_new.png new file mode 100644 index 0000000..ff28600 Binary files /dev/null and b/app/src/main/res/drawable/girl_new.png differ diff --git a/app/src/main/res/drawable/ic_drawer.png b/app/src/main/res/drawable/ic_drawer.png new file mode 100644 index 0000000..fb681ba Binary files /dev/null and b/app/src/main/res/drawable/ic_drawer.png differ diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/icon_launcher.png b/app/src/main/res/drawable/icon_launcher.png new file mode 100644 index 0000000..45bed92 Binary files /dev/null and b/app/src/main/res/drawable/icon_launcher.png differ diff --git a/app/src/main/res/drawable/icons8_eye_24.png b/app/src/main/res/drawable/icons8_eye_24.png new file mode 100644 index 0000000..2c1d8d5 Binary files /dev/null and b/app/src/main/res/drawable/icons8_eye_24.png differ diff --git a/app/src/main/res/drawable/icons8_hide_24.png b/app/src/main/res/drawable/icons8_hide_24.png new file mode 100644 index 0000000..681b20e Binary files /dev/null and b/app/src/main/res/drawable/icons8_hide_24.png differ diff --git a/app/src/main/res/drawable/in_message_bg.9.png b/app/src/main/res/drawable/in_message_bg.9.png new file mode 100644 index 0000000..08c6f09 Binary files /dev/null and b/app/src/main/res/drawable/in_message_bg.9.png differ diff --git a/app/src/main/res/drawable/inst_001.png b/app/src/main/res/drawable/inst_001.png new file mode 100644 index 0000000..03d380e Binary files /dev/null and b/app/src/main/res/drawable/inst_001.png differ diff --git a/app/src/main/res/drawable/inst_new.png b/app/src/main/res/drawable/inst_new.png new file mode 100644 index 0000000..2759aab Binary files /dev/null and b/app/src/main/res/drawable/inst_new.png differ diff --git a/app/src/main/res/drawable/instwht_001.png b/app/src/main/res/drawable/instwht_001.png new file mode 100644 index 0000000..9608d32 Binary files /dev/null and b/app/src/main/res/drawable/instwht_001.png differ diff --git a/app/src/main/res/drawable/launch_icon_lead.png b/app/src/main/res/drawable/launch_icon_lead.png new file mode 100644 index 0000000..756453c Binary files /dev/null and b/app/src/main/res/drawable/launch_icon_lead.png differ diff --git a/app/src/main/res/drawable/lead_leader.png b/app/src/main/res/drawable/lead_leader.png new file mode 100644 index 0000000..94beada Binary files /dev/null and b/app/src/main/res/drawable/lead_leader.png differ diff --git a/app/src/main/res/drawable/lead_logo.jpg b/app/src/main/res/drawable/lead_logo.jpg new file mode 100644 index 0000000..0f035ac Binary files /dev/null and b/app/src/main/res/drawable/lead_logo.jpg differ diff --git a/app/src/main/res/drawable/lead_prayana.png b/app/src/main/res/drawable/lead_prayana.png new file mode 100644 index 0000000..7fb2d22 Binary files /dev/null and b/app/src/main/res/drawable/lead_prayana.png differ diff --git a/app/src/main/res/drawable/lead_profile.png b/app/src/main/res/drawable/lead_profile.png new file mode 100644 index 0000000..1b261fd Binary files /dev/null and b/app/src/main/res/drawable/lead_profile.png differ diff --git a/app/src/main/res/drawable/lead_profile_sele.png b/app/src/main/res/drawable/lead_profile_sele.png new file mode 100644 index 0000000..f7a5db8 Binary files /dev/null and b/app/src/main/res/drawable/lead_profile_sele.png differ diff --git a/app/src/main/res/drawable/leadmis.png b/app/src/main/res/drawable/leadmis.png new file mode 100644 index 0000000..cb96796 Binary files /dev/null and b/app/src/main/res/drawable/leadmis.png differ diff --git a/app/src/main/res/drawable/logo_notification.png b/app/src/main/res/drawable/logo_notification.png new file mode 100644 index 0000000..e205a18 Binary files /dev/null and b/app/src/main/res/drawable/logo_notification.png differ diff --git a/app/src/main/res/drawable/masters.png b/app/src/main/res/drawable/masters.png new file mode 100644 index 0000000..4ebe91a Binary files /dev/null and b/app/src/main/res/drawable/masters.png differ diff --git a/app/src/main/res/drawable/microsoft_office_excel.png b/app/src/main/res/drawable/microsoft_office_excel.png new file mode 100644 index 0000000..5dc3896 Binary files /dev/null and b/app/src/main/res/drawable/microsoft_office_excel.png differ diff --git a/app/src/main/res/drawable/microsoft_office_word.png b/app/src/main/res/drawable/microsoft_office_word.png new file mode 100644 index 0000000..3a46ba4 Binary files /dev/null and b/app/src/main/res/drawable/microsoft_office_word.png differ diff --git a/app/src/main/res/drawable/microsoft_pdf.png b/app/src/main/res/drawable/microsoft_pdf.png new file mode 100644 index 0000000..1c6f1cc Binary files /dev/null and b/app/src/main/res/drawable/microsoft_pdf.png differ diff --git a/app/src/main/res/drawable/mlal_new.png b/app/src/main/res/drawable/mlal_new.png new file mode 100644 index 0000000..803b6b8 Binary files /dev/null and b/app/src/main/res/drawable/mlal_new.png differ diff --git a/app/src/main/res/drawable/msexcel.png b/app/src/main/res/drawable/msexcel.png new file mode 100644 index 0000000..fdf1357 Binary files /dev/null and b/app/src/main/res/drawable/msexcel.png differ diff --git a/app/src/main/res/drawable/mswordicon.jpg b/app/src/main/res/drawable/mswordicon.jpg new file mode 100644 index 0000000..1f67889 Binary files /dev/null and b/app/src/main/res/drawable/mswordicon.jpg differ diff --git a/app/src/main/res/drawable/news.png b/app/src/main/res/drawable/news.png new file mode 100644 index 0000000..dc596ba Binary files /dev/null and b/app/src/main/res/drawable/news.png differ diff --git a/app/src/main/res/drawable/newsfeeds_new.png b/app/src/main/res/drawable/newsfeeds_new.png new file mode 100644 index 0000000..e067599 Binary files /dev/null and b/app/src/main/res/drawable/newsfeeds_new.png differ diff --git a/app/src/main/res/drawable/no_img_available.png b/app/src/main/res/drawable/no_img_available.png new file mode 100644 index 0000000..7be59db Binary files /dev/null and b/app/src/main/res/drawable/no_img_available.png differ diff --git a/app/src/main/res/drawable/out_message_bg.9.png b/app/src/main/res/drawable/out_message_bg.9.png new file mode 100644 index 0000000..4b8a7a0 Binary files /dev/null and b/app/src/main/res/drawable/out_message_bg.9.png differ diff --git a/app/src/main/res/drawable/pdficon.jpg b/app/src/main/res/drawable/pdficon.jpg new file mode 100644 index 0000000..8f42e7c Binary files /dev/null and b/app/src/main/res/drawable/pdficon.jpg differ diff --git a/app/src/main/res/drawable/pending.png b/app/src/main/res/drawable/pending.png new file mode 100644 index 0000000..b1f41ae Binary files /dev/null and b/app/src/main/res/drawable/pending.png differ diff --git a/app/src/main/res/drawable/pendinghome_new.png b/app/src/main/res/drawable/pendinghome_new.png new file mode 100644 index 0000000..cafd67b Binary files /dev/null and b/app/src/main/res/drawable/pendinghome_new.png differ diff --git a/app/src/main/res/drawable/pinbg.xml b/app/src/main/res/drawable/pinbg.xml new file mode 100644 index 0000000..0fe5c1f --- /dev/null +++ b/app/src/main/res/drawable/pinbg.xml @@ -0,0 +1,18 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/pplus.png b/app/src/main/res/drawable/pplus.png new file mode 100644 index 0000000..5851bfb Binary files /dev/null and b/app/src/main/res/drawable/pplus.png differ diff --git a/app/src/main/res/drawable/project.png b/app/src/main/res/drawable/project.png new file mode 100644 index 0000000..79b74d7 Binary files /dev/null and b/app/src/main/res/drawable/project.png differ diff --git a/app/src/main/res/drawable/project_new.png b/app/src/main/res/drawable/project_new.png new file mode 100644 index 0000000..055a372 Binary files /dev/null and b/app/src/main/res/drawable/project_new.png differ diff --git a/app/src/main/res/drawable/re__apply.png b/app/src/main/res/drawable/re__apply.png new file mode 100644 index 0000000..6619552 Binary files /dev/null and b/app/src/main/res/drawable/re__apply.png differ diff --git a/app/src/main/res/drawable/reapply.png b/app/src/main/res/drawable/reapply.png new file mode 100644 index 0000000..78e272a Binary files /dev/null and b/app/src/main/res/drawable/reapply.png differ diff --git a/app/src/main/res/drawable/reject_button.png b/app/src/main/res/drawable/reject_button.png new file mode 100644 index 0000000..7764d95 Binary files /dev/null and b/app/src/main/res/drawable/reject_button.png differ diff --git a/app/src/main/res/drawable/rejectnew.png b/app/src/main/res/drawable/rejectnew.png new file mode 100644 index 0000000..14072f8 Binary files /dev/null and b/app/src/main/res/drawable/rejectnew.png differ diff --git a/app/src/main/res/drawable/remove_white.png b/app/src/main/res/drawable/remove_white.png new file mode 100644 index 0000000..4820e24 Binary files /dev/null and b/app/src/main/res/drawable/remove_white.png differ diff --git a/app/src/main/res/drawable/report_new.png b/app/src/main/res/drawable/report_new.png new file mode 100644 index 0000000..8e099f8 Binary files /dev/null and b/app/src/main/res/drawable/report_new.png differ diff --git a/app/src/main/res/drawable/requestedneww.png b/app/src/main/res/drawable/requestedneww.png new file mode 100644 index 0000000..0c5848f Binary files /dev/null and b/app/src/main/res/drawable/requestedneww.png differ diff --git a/app/src/main/res/drawable/save.png b/app/src/main/res/drawable/save.png new file mode 100644 index 0000000..558570e Binary files /dev/null and b/app/src/main/res/drawable/save.png differ diff --git a/app/src/main/res/drawable/save_big.png b/app/src/main/res/drawable/save_big.png new file mode 100644 index 0000000..55871f4 Binary files /dev/null and b/app/src/main/res/drawable/save_big.png differ diff --git a/app/src/main/res/drawable/save_change.png b/app/src/main/res/drawable/save_change.png new file mode 100644 index 0000000..2b3ecbd Binary files /dev/null and b/app/src/main/res/drawable/save_change.png differ diff --git a/app/src/main/res/drawable/search.png b/app/src/main/res/drawable/search.png new file mode 100644 index 0000000..edb689f Binary files /dev/null and b/app/src/main/res/drawable/search.png differ diff --git a/app/src/main/res/drawable/shadow_background.xml b/app/src/main/res/drawable/shadow_background.xml new file mode 100644 index 0000000..a26a4c1 --- /dev/null +++ b/app/src/main/res/drawable/shadow_background.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/shadow_background2.xml b/app/src/main/res/drawable/shadow_background2.xml new file mode 100644 index 0000000..e418c2c --- /dev/null +++ b/app/src/main/res/drawable/shadow_background2.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/shadow_round.xml b/app/src/main/res/drawable/shadow_round.xml new file mode 100644 index 0000000..07049c1 --- /dev/null +++ b/app/src/main/res/drawable/shadow_round.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/shap.xml b/app/src/main/res/drawable/shap.xml new file mode 100644 index 0000000..e16fa66 --- /dev/null +++ b/app/src/main/res/drawable/shap.xml @@ -0,0 +1,19 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/sharp_vertical_align_top.png b/app/src/main/res/drawable/sharp_vertical_align_top.png new file mode 100644 index 0000000..bae3272 Binary files /dev/null and b/app/src/main/res/drawable/sharp_vertical_align_top.png differ diff --git a/app/src/main/res/drawable/side_nav_bar.xml b/app/src/main/res/drawable/side_nav_bar.xml new file mode 100644 index 0000000..6d81870 --- /dev/null +++ b/app/src/main/res/drawable/side_nav_bar.xml @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/sidebar_about_us.png b/app/src/main/res/drawable/sidebar_about_us.png new file mode 100644 index 0000000..cc436e4 Binary files /dev/null and b/app/src/main/res/drawable/sidebar_about_us.png differ diff --git a/app/src/main/res/drawable/sidebar_contact.png b/app/src/main/res/drawable/sidebar_contact.png new file mode 100644 index 0000000..034d859 Binary files /dev/null and b/app/src/main/res/drawable/sidebar_contact.png differ diff --git a/app/src/main/res/drawable/sidebar_events.png b/app/src/main/res/drawable/sidebar_events.png new file mode 100644 index 0000000..a08aba2 Binary files /dev/null and b/app/src/main/res/drawable/sidebar_events.png differ diff --git a/app/src/main/res/drawable/sidebar_news_feeds.png b/app/src/main/res/drawable/sidebar_news_feeds.png new file mode 100644 index 0000000..d96b462 Binary files /dev/null and b/app/src/main/res/drawable/sidebar_news_feeds.png differ diff --git a/app/src/main/res/drawable/sidebar_story.png b/app/src/main/res/drawable/sidebar_story.png new file mode 100644 index 0000000..0793b8d Binary files /dev/null and b/app/src/main/res/drawable/sidebar_story.png differ diff --git a/app/src/main/res/drawable/spinner_layout.xml b/app/src/main/res/drawable/spinner_layout.xml new file mode 100644 index 0000000..f11a4f9 --- /dev/null +++ b/app/src/main/res/drawable/spinner_layout.xml @@ -0,0 +1,19 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/star_nn.png b/app/src/main/res/drawable/star_nn.png new file mode 100644 index 0000000..13cd1d0 Binary files /dev/null and b/app/src/main/res/drawable/star_nn.png differ diff --git a/app/src/main/res/drawable/story.png b/app/src/main/res/drawable/story.png new file mode 100644 index 0000000..eee4cc9 Binary files /dev/null and b/app/src/main/res/drawable/story.png differ diff --git a/app/src/main/res/drawable/story_nw.png b/app/src/main/res/drawable/story_nw.png new file mode 100644 index 0000000..4899b0c Binary files /dev/null and b/app/src/main/res/drawable/story_nw.png differ diff --git a/app/src/main/res/drawable/story_wht.png b/app/src/main/res/drawable/story_wht.png new file mode 100644 index 0000000..9d3bd2c Binary files /dev/null and b/app/src/main/res/drawable/story_wht.png differ diff --git a/app/src/main/res/drawable/story_wht_nw.png b/app/src/main/res/drawable/story_wht_nw.png new file mode 100644 index 0000000..9d3bd2c Binary files /dev/null and b/app/src/main/res/drawable/story_wht_nw.png differ diff --git a/app/src/main/res/drawable/student_profile.png b/app/src/main/res/drawable/student_profile.png new file mode 100644 index 0000000..105e65e Binary files /dev/null and b/app/src/main/res/drawable/student_profile.png differ diff --git a/app/src/main/res/drawable/student_profile_sele.png b/app/src/main/res/drawable/student_profile_sele.png new file mode 100644 index 0000000..f8fc324 Binary files /dev/null and b/app/src/main/res/drawable/student_profile_sele.png differ diff --git a/app/src/main/res/drawable/studentjourneypplus.png b/app/src/main/res/drawable/studentjourneypplus.png new file mode 100644 index 0000000..80a7c8d Binary files /dev/null and b/app/src/main/res/drawable/studentjourneypplus.png differ diff --git a/app/src/main/res/drawable/submit.png b/app/src/main/res/drawable/submit.png new file mode 100644 index 0000000..b3f3aa4 Binary files /dev/null and b/app/src/main/res/drawable/submit.png differ diff --git a/app/src/main/res/drawable/t_shirt.png b/app/src/main/res/drawable/t_shirt.png new file mode 100644 index 0000000..1368209 Binary files /dev/null and b/app/src/main/res/drawable/t_shirt.png differ diff --git a/app/src/main/res/drawable/tshirt.png b/app/src/main/res/drawable/tshirt.png new file mode 100644 index 0000000..4d2dc6b Binary files /dev/null and b/app/src/main/res/drawable/tshirt.png differ diff --git a/app/src/main/res/drawable/tshirt1kb.png b/app/src/main/res/drawable/tshirt1kb.png new file mode 100644 index 0000000..d789207 Binary files /dev/null and b/app/src/main/res/drawable/tshirt1kb.png differ diff --git a/app/src/main/res/drawable/tshirt_d.png b/app/src/main/res/drawable/tshirt_d.png new file mode 100644 index 0000000..6047780 Binary files /dev/null and b/app/src/main/res/drawable/tshirt_d.png differ diff --git a/app/src/main/res/drawable/tw_001.png b/app/src/main/res/drawable/tw_001.png new file mode 100644 index 0000000..d0ef280 Binary files /dev/null and b/app/src/main/res/drawable/tw_001.png differ diff --git a/app/src/main/res/drawable/tw_new.png b/app/src/main/res/drawable/tw_new.png new file mode 100644 index 0000000..cdfd888 Binary files /dev/null and b/app/src/main/res/drawable/tw_new.png differ diff --git a/app/src/main/res/drawable/tw_wht001.png b/app/src/main/res/drawable/tw_wht001.png new file mode 100644 index 0000000..23c13c5 Binary files /dev/null and b/app/src/main/res/drawable/tw_wht001.png differ diff --git a/app/src/main/res/drawable/twotone_notifications_white_18dp.png b/app/src/main/res/drawable/twotone_notifications_white_18dp.png new file mode 100644 index 0000000..835e8fb Binary files /dev/null and b/app/src/main/res/drawable/twotone_notifications_white_18dp.png differ diff --git a/app/src/main/res/drawable/valedictory_new.png b/app/src/main/res/drawable/valedictory_new.png new file mode 100644 index 0000000..7c75655 Binary files /dev/null and b/app/src/main/res/drawable/valedictory_new.png differ diff --git a/app/src/main/res/drawable/whatsupnew.png b/app/src/main/res/drawable/whatsupnew.png new file mode 100644 index 0000000..52acf18 Binary files /dev/null and b/app/src/main/res/drawable/whatsupnew.png differ diff --git a/app/src/main/res/drawable/whatup_new.png b/app/src/main/res/drawable/whatup_new.png new file mode 100644 index 0000000..82bc89b Binary files /dev/null and b/app/src/main/res/drawable/whatup_new.png differ diff --git a/app/src/main/res/drawable/ys_new.png b/app/src/main/res/drawable/ys_new.png new file mode 100644 index 0000000..4642d93 Binary files /dev/null and b/app/src/main/res/drawable/ys_new.png differ diff --git a/app/src/main/res/layout-large/content_main.xml b/app/src/main/res/layout-large/content_main.xml new file mode 100644 index 0000000..7850363 --- /dev/null +++ b/app/src/main/res/layout-large/content_main.xml @@ -0,0 +1,264 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout-large/content_main_image.xml b/app/src/main/res/layout-large/content_main_image.xml new file mode 100644 index 0000000..ddbcb78 --- /dev/null +++ b/app/src/main/res/layout-large/content_main_image.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout-large/dashboard_activity.xml b/app/src/main/res/layout-large/dashboard_activity.xml new file mode 100644 index 0000000..80873a4 --- /dev/null +++ b/app/src/main/res/layout-large/dashboard_activity.xml @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_edit_project.xml b/app/src/main/res/layout/activity_edit_project.xml new file mode 100644 index 0000000..73c901a --- /dev/null +++ b/app/src/main/res/layout/activity_edit_project.xml @@ -0,0 +1,817 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_test2.xml b/app/src/main/res/layout/activity_test2.xml new file mode 100644 index 0000000..8c64f7f --- /dev/null +++ b/app/src/main/res/layout/activity_test2.xml @@ -0,0 +1,9 @@ + + + + diff --git a/app/src/main/res/layout/activity_tshirt_paid.xml b/app/src/main/res/layout/activity_tshirt_paid.xml new file mode 100644 index 0000000..faab09a --- /dev/null +++ b/app/src/main/res/layout/activity_tshirt_paid.xml @@ -0,0 +1,506 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_unapproved__details.xml b/app/src/main/res/layout/activity_unapproved__details.xml new file mode 100644 index 0000000..7e70e96 --- /dev/null +++ b/app/src/main/res/layout/activity_unapproved__details.xml @@ -0,0 +1,366 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/add_member_layout.xml b/app/src/main/res/layout/add_member_layout.xml new file mode 100644 index 0000000..17cf7bc --- /dev/null +++ b/app/src/main/res/layout/add_member_layout.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/addproject_fragment.xml b/app/src/main/res/layout/addproject_fragment.xml new file mode 100644 index 0000000..8c741a0 --- /dev/null +++ b/app/src/main/res/layout/addproject_fragment.xml @@ -0,0 +1,791 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/field_material.xml b/app/src/main/res/layout/field_material.xml new file mode 100644 index 0000000..1f62996 --- /dev/null +++ b/app/src/main/res/layout/field_material.xml @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/forgetdialog.xml b/app/src/main/res/layout/forgetdialog.xml new file mode 100644 index 0000000..6fd329f --- /dev/null +++ b/app/src/main/res/layout/forgetdialog.xml @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + +