diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser
index e5fc3fc..73ba050 100644
Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
index 8d1cd7e..2caceda 100644
--- a/.idea/jarRepositories.xml
+++ b/.idea/jarRepositories.xml
@@ -26,5 +26,10 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/GSKMTOrange/build.gradle b/GSKMTOrange/build.gradle
index 33eef1b..42c0765 100644
--- a/GSKMTOrange/build.gradle
+++ b/GSKMTOrange/build.gradle
@@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
android {
- compileSdkVersion 29
+ compileSdkVersion 30
buildToolsVersion '29.0.3'
useLibrary 'org.apache.http.legacy'
@@ -21,7 +21,7 @@ android {
defaultConfig {
applicationId "cpm.com.gskmtorange"
minSdkVersion 20
- targetSdkVersion 29
+ targetSdkVersion 30
/*//For Egypt
versionCode 31
@@ -32,8 +32,8 @@ android {
versionName "4.0"*/
//For Turkey
- versionCode 26
- versionName "3.8"
+ /* versionCode 26
+ versionName "3.8"*/
//For KSA
/* versionCode 28
@@ -43,11 +43,11 @@ android {
versionName "3.8"*/
//For SA
- /* versionCode 28
+ /* versionCode 28
versionName "3.9"*/
//sa
- /* versionCode 22
- versionName "3.4"*/
+ versionCode 23
+ versionName "3.5"
//Kenya
/* versionCode 2
@@ -79,25 +79,33 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
+ implementation 'com.google.firebase:firebase-auth:20.0.3'
testImplementation 'junit:junit:4.13.1'
implementation 'android.arch.navigation:navigation-fragment:1.0.0'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.github.bumptech.glide:glide:4.11.0'
- implementation platform('com.google.firebase:firebase-bom:25.12.0')
- implementation 'com.google.firebase:firebase-analytics'
+
+ implementation platform('com.google.firebase:firebase-bom:26.7.0')
+ // implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-crashlytics-ndk'
implementation 'com.google.firebase:firebase-messaging'
+
implementation 'com.google.android.gms:play-services-location:17.1.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
+
implementation 'com.kyanogen.signatureview:signature-view:1.0'
implementation 'com.android.support:multidex:1.0.3'
implementation files('libs/ksoap2-android-assembly-3.6.2-jar-with-dependencies.jar')
implementation 'com.squareup.retrofit2:retrofit:2.0.2'
implementation 'com.squareup.retrofit:converter-gson:2.0.0-beta1'
implementation 'com.squareup.retrofit2:converter-gson:2.0.2'
- implementation 'com.google.firebase:firebase-appindexing:19.1.0'
+ implementation 'com.google.android.gms:play-services-appindexing:8.3.0'
+ // Add the Firebase Crashlytics SDK.
+ implementation 'com.google.firebase:firebase-crashlytics:17.3.0'
+ // Recommended: Add the Google Analytics SDK.
+ implementation 'com.google.firebase:firebase-analytics:18.0.0'
}
apply plugin: 'com.google.gms.google-services'
diff --git a/GSKMTOrange/google-services.json b/GSKMTOrange/google-services.json
index e9ed9af..68d966a 100644
--- a/GSKMTOrange/google-services.json
+++ b/GSKMTOrange/google-services.json
@@ -1,33 +1,33 @@
{
"project_info": {
- "project_number": "28956372652",
- "project_id": "orangenew-48962",
- "storage_bucket": "orangenew-48962.appspot.com"
+ "project_number": "310038602345",
+ "project_id": "gskorangev2",
+ "storage_bucket": "gskorangev2.appspot.com"
},
"client": [
{
"client_info": {
- "mobilesdk_app_id": "1:28956372652:android:a70b27bfa2543c229f7909",
+ "mobilesdk_app_id": "1:310038602345:android:dab7010946bd056dd1f8f8",
"android_client_info": {
"package_name": "cpm.com.gskmtorange"
}
},
"oauth_client": [
{
- "client_id": "28956372652-fgiv0dvng874u5g11u1sv498ok02qsmf.apps.googleusercontent.com",
+ "client_id": "310038602345-ctmpg90bjppcgqam7jt4j3tn3e3hqtvr.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
- "current_key": "AIzaSyCcvobTX6bSIU9eSaQPuyYqFS5Q4Y-FDX4"
+ "current_key": "AIzaSyDg2pgsaB0sWKD9pAF7mb9DSk8ec5rX7uI"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
- "client_id": "28956372652-fgiv0dvng874u5g11u1sv498ok02qsmf.apps.googleusercontent.com",
+ "client_id": "310038602345-ctmpg90bjppcgqam7jt4j3tn3e3hqtvr.apps.googleusercontent.com",
"client_type": 3
}
]
diff --git a/GSKMTOrange/src/main/AndroidManifest.xml b/GSKMTOrange/src/main/AndroidManifest.xml
index eba9331..49da72b 100644
--- a/GSKMTOrange/src/main/AndroidManifest.xml
+++ b/GSKMTOrange/src/main/AndroidManifest.xml
@@ -20,6 +20,7 @@
+
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/Database/GSKOrangeDB.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/Database/GSKOrangeDB.java
index 52bf99e..ac62b6c 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/Database/GSKOrangeDB.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/Database/GSKOrangeDB.java
@@ -96,7 +96,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.TableBean;
*/
public class GSKOrangeDB extends SQLiteOpenHelper {
- public static final String DATABASE_NAME = "GSK_ORANGE_DB614";
+ public static final String DATABASE_NAME = "GSK_ORANGE_DB616";
public static final int DATABASE_VERSION = 15;
TableBean tableBean;
private SQLiteDatabase db;
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/GeoTag/GeoTagActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/GeoTag/GeoTagActivity.java
index e9cef20..86973ae 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/GeoTag/GeoTagActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/GeoTag/GeoTagActivity.java
@@ -54,7 +54,7 @@ import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
-import com.google.firebase.appindexing.Action;
+
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
@@ -92,7 +92,7 @@ import cpm.com.gskmtorange.xmlHandlers.FailureXMLHandler;
public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener {
-
+ private Context context;
String result, errormsg = "";
private ProgressBar pb;
private GoogleMap mMap;
@@ -143,7 +143,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
setSupportActionBar(toolbar);
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
username = preferences.getString(CommonString.KEY_USERNAME, null);
//storeid = preferences.getString(CommonString.KEY_STORE_ID, null);
@@ -161,7 +161,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
db = new GSKOrangeDB(GeoTagActivity.this);
db.open();
-
+ context = this;
//storeid = getIntent().getStringExtra("Storeid");
str = CommonString.FILE_PATH;
@@ -279,7 +279,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
}
}*/
- _pathforcheck = storeid + "GeoTag" + visitData.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ _pathforcheck = storeid + "GeoTag" + visitData.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck;
@@ -301,7 +301,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else {
- Toast.makeText(getApplicationContext(), getResources().getString(R.string.notsuppoted)
+ Toast.makeText(context, getResources().getString(R.string.notsuppoted)
, Toast.LENGTH_LONG)
.show();
finish();
@@ -427,7 +427,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
protected void onResume() {
super.onResume();
- CommonFunctions.updateLangResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context,preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getResources().getString(R.string.title_activity_store_geotag));
/* checkPlayServices();
@@ -520,7 +520,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path);
- outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file);
+ outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager();
@@ -591,7 +591,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
if (new File(str + _pathforcheck).exists()) {
- fabcarmabtn.setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.mipmap.camera_green));
+ fabcarmabtn.setImageDrawable(ContextCompat.getDrawable(context, R.mipmap.camera_green));
//fabcarmabtn.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#4DB6AC")));
@@ -990,7 +990,6 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
if (result.equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
- //Toast.makeText(getApplicationContext(),"GeoTag Uploaded ",Toast.LENGTH_LONG).show();
String Statustag = "U";
db.open();
@@ -1032,7 +1031,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
GeoTagActivity.this.finish();
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.success),Toast.LENGTH_LONG).show();
+ Toast.makeText(context,getResources().getString(R.string.success),Toast.LENGTH_LONG).show();
}
else if(!result.equals(CommonString.KEY_SUCCESS))
@@ -1042,7 +1041,7 @@ public class GeoTagActivity extends AppCompatActivity implements OnMapReadyCallb
GeoTagActivity.this, AlertMessage.MESSAGE_DATA_NOT
+ result, getResources().getString(R.string.failure), null);
message.showMessage();*/
- Toast.makeText(getApplicationContext(),getResources().getString(R.string.failure),Toast.LENGTH_LONG).show();
+ Toast.makeText(context,getResources().getString(R.string.failure),Toast.LENGTH_LONG).show();
Intent intent = new Intent(
GeoTagActivity.this,
StoreimageActivity.class);
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/GeoTag/GeoTagStoreList.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/GeoTag/GeoTagStoreList.java
index daee89a..1039172 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/GeoTag/GeoTagStoreList.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/GeoTag/GeoTagStoreList.java
@@ -55,6 +55,7 @@ public class GeoTagStoreList extends AppCompatActivity implements View.OnClickLi
FloatingActionButton fab;
Toolbar toolbar;
+ private Context context;
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
@@ -66,7 +67,7 @@ public class GeoTagStoreList extends AppCompatActivity implements View.OnClickLi
// nodata_linear = (LinearLayout) findViewById(R.id.no_data_lay);
//parent_linear = (LinearLayout) findViewById(R.id.parent_linear);
fab = (FloatingActionButton) findViewById(R.id.fab);
-
+ context = this;
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
@@ -75,7 +76,7 @@ public class GeoTagStoreList extends AppCompatActivity implements View.OnClickLi
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
date = preferences.getString(CommonString.KEY_DATE, null);
visit_status = preferences.getString(CommonString.KEY_STOREVISITED_STATUS, "");
@@ -86,7 +87,7 @@ public class GeoTagStoreList extends AppCompatActivity implements View.OnClickLi
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- Intent in = new Intent(getApplicationContext(), DownloadActivity.class);
+ Intent in = new Intent(context, DownloadActivity.class);
startActivity(in);
finish();
@@ -96,7 +97,7 @@ public class GeoTagStoreList extends AppCompatActivity implements View.OnClickLi
storelist = db.getStoreData(date, CommonString.KEY_JOURNEY_PLAN);
if (storelist.size() > 0) {
- adapter = new ValueAdapter(getApplicationContext(), storelist);
+ adapter = new ValueAdapter(context, storelist);
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
@@ -257,7 +258,7 @@ public class GeoTagStoreList extends AppCompatActivity implements View.OnClickLi
@Override
protected void onResume() {
super.onResume();
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getString(R.string.title_activity_store_geotag));
}
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/LoginActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/LoginActivity.java
index 4e3733f..9a316b0 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/LoginActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/LoginActivity.java
@@ -55,6 +55,7 @@ import com.google.android.gms.maps.model.LatLng;
import com.google.android.material.snackbar.Snackbar;
import com.google.firebase.analytics.FirebaseAnalytics;
+import com.google.firebase.crashlytics.FirebaseCrashlytics;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
@@ -162,16 +163,9 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
setContentView(R.layout.activity_login);
context = this;
- // Obtain the FirebaseAnalytics instance.
- // mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
-
- // Fabric.with(this, new Crashlytics());
-
TextView tv_version = (TextView) findViewById(R.id.tv_version_code);
-
try {
app_ver = String.valueOf(getPackageManager().getPackageInfo(getPackageName(), 0).versionName);
-
// login_version.setText("Parinaam Version " + app_ver);
} catch (PackageManager.NameNotFoundException e) {
// TODO Auto-generated catch block
@@ -222,9 +216,8 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
/* museridView.setText("testmer");
mPasswordView.setText("cpm123");*/
//sa
- /* museridView.setText("testsa");
- mPasswordView.setText("cpm123");
-*/
+ /* museridView.setText("testsa");
+ mPasswordView.setText("cpm123");*/
//Kenya
// museridView.setText("test.Kenya");
@@ -254,9 +247,11 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
} catch (PackageManager.NameNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
+ FirebaseCrashlytics.getInstance().recordException(e);
}
-
+ mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
+ FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(true);
museridSignInButton = (Button) findViewById(R.id.user_login_button);
museridSignInButton.setOnClickListener(new OnClickListener() {
@Override
@@ -521,12 +516,11 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
try {
- versionCode = getPackageManager().getPackageInfo(
- getPackageName(), 0).versionCode;
+ versionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
String userauth_xml = "[DATA]" + "[USER_DATA][USER_ID]"
+ userid + "[/USER_ID]" + "[PASSWORD]" + password
- + "[/PASSWORD]" + "[IN_TIME]" + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext())
+ + "[/PASSWORD]" + "[IN_TIME]" + CommonFunctions.getCurrentTimeWithLanguage(context)
+ "[/IN_TIME]" + "[LATITUDE]" + lat
+ "[/LATITUDE]" + "[LONGITUDE]" + lon
+ "[/LONGITUDE]" + "[APP_VERSION]" + app_ver
@@ -635,15 +629,11 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
editor.putString(CommonString.KEY_USERNAME, userid);
editor.putString(CommonString.KEY_PASSWORD, password);
editor.putString(CommonString.KEY_VERSION, lgs.getAPP_VERSION());
-
editor.putString(CommonString.KEY_PATH, lgs.getAPP_PATH());
-
editor.putString(CommonString.KEY_DATE, lgs.getCURRENTDATE());
//editor.putString(CommonString.KEY_DATE, "01/25/2019");
editor.putString(CommonString.KEY_COUNTRY_ID, lgs.getCOUNTRY_ID());
-
editor.commit();
-
setDataFromSharedPreferences(lgs);
Bundle bundle = new Bundle();
@@ -651,23 +641,16 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, CommonString.KEY_LOGIN_DATA);
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "Data");
bundle.putString(CommonString.KEY_LANGUAGE, preferences.getString(CommonString.KEY_LANGUAGE, ""));
- // mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
-
- // Crashlytics.setUserIdentifier(userid);
-
+ mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
+ FirebaseCrashlytics.getInstance().setUserId(userid.toLowerCase());
return CommonString.KEY_SUCCESS;
-
}
}
return "";
} catch (MalformedURLException e) {
-
- /* final AlertMessage message = new AlertMessage(
- LoginActivity.this, AlertMessage.MESSAGE_EXCEPTION,
- "acra_login", e);*/
-
+ FirebaseCrashlytics.getInstance().recordException(e);
runOnUiThread(new Runnable() {
@Override
@@ -678,6 +661,7 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
});
} catch (IOException e) {
+ FirebaseCrashlytics.getInstance().recordException(e);
/* final AlertMessage message = new AlertMessage(
LoginActivity.this,
AlertMessage.MESSAGE_SOCKETEXCEPTION, "socket_login", e);*/
@@ -697,6 +681,7 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
}
});
} catch (Exception e) {
+ FirebaseCrashlytics.getInstance().recordException(e);
/* final AlertMessage message = new AlertMessage(
LoginActivity.this, AlertMessage.MESSAGE_EXCEPTION,
"acra_login", e);*/
@@ -704,7 +689,6 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
// Crashlytics.logException(e.getCause());
// Crashlytics.logException(new Exception("My custom login Exception"));
runOnUiThread(new Runnable() {
-
@Override
public void run() {
showAlert(CommonString.MESSAGE_EXCEPTION);
@@ -717,9 +701,7 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
@Override
protected void onPostExecute(String result) {
-
super.onPostExecute(result);
-
//Stop performance trace
/// myTrace.stop();
@@ -742,10 +724,10 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
setLanguageDataFromSharedPreferences();
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
- Intent in = new Intent(getApplicationContext(), MPinActivity.class);
+ Intent in = new Intent(context, MPinActivity.class);
in.putExtra(CommonString.IS_PASSWORD_CHECK, false);
startActivity(in);
finish();
@@ -770,7 +752,7 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
setLanguageDataFromSharedPreferences();
- Intent in = new Intent(getApplicationContext(), MPinActivity.class);
+ Intent in = new Intent(context, MPinActivity.class);
in.putExtra(CommonString.IS_PASSWORD_CHECK, false);
startActivity(in);
finish();
@@ -932,10 +914,7 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
private void setDataFromSharedPreferences(LoginGetterSetter lgs) {
Gson gson = new Gson();
String jsonCurProduct = gson.toJson(lgs);
-
- //SharedPreferences sharedPref = getApplicationContext().getSharedPreferences(CommonString.KEY_LOOGIN_PREF, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
-
editor.putString(CommonString.KEY_LOOGIN_PREF, jsonCurProduct);
editor.commit();
}
@@ -987,13 +966,6 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
file_planogram.mkdir();
}
- /* if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(getApplicationContext(),
- android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
- ContextCompat.checkSelfPermission(getApplicationContext(),
- android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
- return;
- }*/
-
if (checkPlayServices()) {
// Building the GoogleApi client
buildGoogleApiClient();
@@ -1100,8 +1072,7 @@ public class LoginActivity extends AppCompatActivity implements GoogleApiClient.
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else {
- Toast.makeText(getApplicationContext(), getResources().getString(R.string.notsuppoted)
- , Toast.LENGTH_LONG)
+ Toast.makeText(context, getResources().getString(R.string.notsuppoted), Toast.LENGTH_LONG)
.show();
finish();
}
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/MainActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/MainActivity.java
index 5739cc4..c7f9730 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/MainActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/MainActivity.java
@@ -58,11 +58,10 @@ import cpm.com.gskmtorange.pharma_stores.PharmaActivityFragment;
import cpm.com.gskmtorange.upload.PreviousDataUploadActivity;
import cpm.com.gskmtorange.upload.UploadActivity;
import cpm.com.gskmtorange.xmlGetterSetter.ConfigurationMasterGetterSetter;
-//import io.fabric.sdk.android.Fabric;
public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
-
+ private Context context;
WebView webView;
ImageView imageView;
String date, visit_status;
@@ -92,13 +91,9 @@ public class MainActivity extends AppCompatActivity
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
preferences = PreferenceManager.getDefaultSharedPreferences(this);
+ context = this;
- // Crashlytics.setBool(CommonString.KEY_LOGIN_DONE, true);
- // Crashlytics.setString(CommonString.KEY_LANGUAGE, preferences.getString(CommonString.KEY_LANGUAGE, ""));
-
- //Fabric.with(this, new Crashlytics());
-
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
date = preferences.getString(CommonString.KEY_DATE, null);
imageView = (ImageView) findViewById(R.id.img_main);
@@ -109,9 +104,6 @@ public class MainActivity extends AppCompatActivity
user_name = preferences.getString(CommonString.KEY_USERNAME, null);
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, null);
- // Crashlytics.setString(CommonString.KEY_USER_ID, user_name);
- //user_type = preferences.getString(CommonString.KEY_USER_TYPE, null);
-
db = new GSKOrangeDB(MainActivity.this);
webView.setWebViewClient(new MyWebViewClient());
@@ -124,15 +116,6 @@ public class MainActivity extends AppCompatActivity
}
- /* FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
- 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();
- }
- });
-*/
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);
@@ -153,7 +136,7 @@ public class MainActivity extends AppCompatActivity
img_change_password.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- Intent in = new Intent(getApplicationContext(), ChangePasswordActivity.class);
+ Intent in = new Intent(context, ChangePasswordActivity.class);
startActivity(in);
}
});
@@ -170,7 +153,7 @@ public class MainActivity extends AppCompatActivity
super.onResume();
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getString(R.string.main_menu_activity_name));
db.open();
@@ -340,7 +323,6 @@ public class MainActivity extends AppCompatActivity
Snackbar.make(webView, getResources().getString(R.string.nonetwork), Snackbar.LENGTH_SHORT)
.setAction("Action", null).show();
- // Toast.makeText(getApplicationContext(), "No Network Available", Toast.LENGTH_SHORT).show();
}
}
})
@@ -828,7 +810,7 @@ public class MainActivity extends AppCompatActivity
.setPositiveButton(getResources().getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
- Intent in = new Intent(getApplicationContext(), PreviousDataUploadActivity.class);
+ Intent in = new Intent(context, PreviousDataUploadActivity.class);
startActivity(in);
//finish();
}
@@ -837,7 +819,7 @@ public class MainActivity extends AppCompatActivity
alert.show();
} else {
- Intent in = new Intent(getApplicationContext(), DownloadActivity.class);
+ Intent in = new Intent(context, DownloadActivity.class);
startActivity(in);
}
} else {
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/SelectLanguageActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/SelectLanguageActivity.java
index 0798b86..631f66c 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/SelectLanguageActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/SelectLanguageActivity.java
@@ -29,7 +29,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.LoginGetterSetter;
public class SelectLanguageActivity extends AppCompatActivity implements View.OnClickListener {
Button btn_lang_1, btn_lang_2;
-
+ private Context context;
private SharedPreferences preferences = null;
private SharedPreferences.Editor editor = null;
@@ -44,7 +44,7 @@ public class SelectLanguageActivity extends AppCompatActivity implements View.On
setContentView(R.layout.activity_select_language);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
-
+ context = this;
preferences = PreferenceManager.getDefaultSharedPreferences(this);
editor = preferences.edit();
@@ -81,7 +81,7 @@ public class SelectLanguageActivity extends AppCompatActivity implements View.On
startActivity(intent);
finish();*/
- Intent in = new Intent(getApplicationContext(), MPinActivity.class);
+ Intent in = new Intent(context, MPinActivity.class);
in.putExtra(CommonString.IS_PASSWORD_CHECK, false);
startActivity(in);
finish();
@@ -101,7 +101,7 @@ public class SelectLanguageActivity extends AppCompatActivity implements View.On
switch (id) {
case R.id.btn_language_one:
selected_flag = true;
- CommonFunctions.updateLangResources(getApplicationContext(), language.get(0));
+ CommonFunctions.updateLangResources(context, language.get(0));
btn_lang_1.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
btn_lang_2.setBackgroundColor(getResources().getColor(R.color.grey_background));
editor.putString(CommonString.KEY_LANGUAGE, language.get(0));
@@ -115,7 +115,7 @@ public class SelectLanguageActivity extends AppCompatActivity implements View.On
selected_flag = true;
- CommonFunctions.updateLangResources(getApplicationContext(), language.get(1));
+ CommonFunctions.updateLangResources(context, language.get(1));
btn_lang_1.setBackgroundColor(getResources().getColor(R.color.grey_background));
btn_lang_2.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
@@ -133,8 +133,6 @@ public class SelectLanguageActivity extends AppCompatActivity implements View.On
private void setDataFromSharedPreferences(LoginGetterSetter lgs) {
Gson gson = new Gson();
String jsonCurProduct = gson.toJson(lgs);
-
- //SharedPreferences sharedPref = getApplicationContext().getSharedPreferences(CommonString.KEY_LOOGIN_PREF, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putString(CommonString.KEY_LOOGIN_PREF, jsonCurProduct);
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/SplashScreenActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/SplashScreenActivity.java
index 288e23d..84a31f0 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/SplashScreenActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/SplashScreenActivity.java
@@ -1,5 +1,6 @@
package cpm.com.gskmtorange;
+import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.PixelFormat;
@@ -27,7 +28,7 @@ public class SplashScreenActivity extends AppCompatActivity {
private static int SPLASH_TIME_OUT = 3000;
LinearLayout linearLayout;
-
+ private Context context;
private SharedPreferences preferences = null;
public void onAttachedToWindow() {
@@ -44,7 +45,7 @@ public class SplashScreenActivity extends AppCompatActivity {
linearLayout = findViewById(R.id.lin_lay);
preferences = PreferenceManager.getDefaultSharedPreferences(this);
-
+ context = this;
StartAnimations();
sendToLogin();
@@ -137,14 +138,14 @@ public class SplashScreenActivity extends AppCompatActivity {
//after Mpin
String mpin = preferences.getString(CommonString.MPIN, null);
if(mpin!=null){
- Intent in = new Intent(getApplicationContext(), MPinActivity.class);
+ Intent in = new Intent(context, MPinActivity.class);
in.putExtra(CommonString.IS_PASSWORD_CHECK, true);
startActivity(in);
finish();
}
else {
- Intent i = new Intent(getApplicationContext(), LoginActivity.class);
+ Intent i = new Intent(context, LoginActivity.class);
startActivity(i);
finish();
}
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/autoupdate/AutoUpdateActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/autoupdate/AutoUpdateActivity.java
index e7260dd..8119126 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/autoupdate/AutoUpdateActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/autoupdate/AutoUpdateActivity.java
@@ -37,7 +37,7 @@ import cpm.com.gskmtorange.constant.CommonFunctions;
import cpm.com.gskmtorange.constant.CommonString;
public class AutoUpdateActivity extends AppCompatActivity {
-
+ private Context context;
String versionCode;
int length;
private Dialog dialog;
@@ -57,12 +57,13 @@ public class AutoUpdateActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
Intent intent = getIntent();
-
+ context = this;
path = intent.getStringExtra(CommonString.KEY_PATH);
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Parinaam");
@@ -253,20 +254,13 @@ public class AutoUpdateActivity extends AppCompatActivity {
dialog.dismiss();
if (result.equals(CommonString.KEY_SUCCESS)) {
- /* Intent i = new Intent(Intent.ACTION_VIEW);
- i.setDataAndType(FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", new File(Environment
- .getExternalStorageDirectory()
- + "/download/"
- + "app.apk")),
- "application/vnd.android.package-archive");
- startActivity(i);*/
File toInstall = new File(Environment.getExternalStorageDirectory()
+ "/download/"
+ "app.apk");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
- Uri apkUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", toInstall);
+ Uri apkUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", toInstall);
Intent intent = new Intent(Intent.ACTION_INSTALL_PACKAGE);
intent.setData(apkUri);
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/AdditionalPromoSKUwiseActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/AdditionalPromoSKUwiseActivity.java
index 9f14ff3..ce7cb96 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/AdditionalPromoSKUwiseActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/AdditionalPromoSKUwiseActivity.java
@@ -58,6 +58,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.SkuMasterGetterSetter;
public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener, View.OnClickListener{
+ private Context context;
GSKOrangeDB db;
String store_id, visit_date, username, intime, date;
String categoryName, categoryId;
@@ -107,7 +108,7 @@ public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements
img_cam = (ImageView) findViewById(R.id.img_promotion_add);
lin_parent = (LinearLayout) findViewById(R.id.lin_parent_promo);
btntoggle = (ToggleButton) findViewById(R.id.btntoggle);
-
+ context = this;
//preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this);
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
@@ -115,7 +116,7 @@ public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements
username = preferences.getString(CommonString.KEY_USERNAME, null);
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, null);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
//Intent data
categoryName = getIntent().getStringExtra("categoryName");
@@ -163,7 +164,7 @@ public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements
btntoggle.setChecked(isExists);
if(added_promo_list.size()>0){
- rec_added_promo.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
+ rec_added_promo.setLayoutManager(new LinearLayoutManager(context));
promoAdapter = new PromoAdapter(added_promo_list);
rec_added_promo.setAdapter(promoAdapter);
}
@@ -426,7 +427,7 @@ public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements
added_promo_list.add(promo);
- rec_added_promo.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
+ rec_added_promo.setLayoutManager(new LinearLayoutManager(context));
PromoAdapter gapAdapter = new PromoAdapter(added_promo_list);
rec_added_promo.setAdapter(gapAdapter);
@@ -462,7 +463,7 @@ public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements
case R.id.img_promotion_add:
_pathforcheck = "Additional_Promo_Skuwise_Image" + store_id + categoryId + visit_date.replace("/", "") + "_" +
- CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck;
@@ -486,7 +487,7 @@ public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements
fab_add.hide();//.setVisibility(View.GONE);
added_promo_list.clear();
- rec_added_promo.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
+ rec_added_promo.setLayoutManager(new LinearLayoutManager(context));
promoAdapter = new PromoAdapter(added_promo_list);
rec_added_promo.setAdapter(promoAdapter);
@@ -541,7 +542,7 @@ public class AdditionalPromoSKUwiseActivity extends AppCompatActivity implements
Log.i("Stock & Facing ", "startCameraActivity()");
File file = new File(_path);
- outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file);
+ outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager();
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/AdditionalVisibility.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/AdditionalVisibility.java
index 3652d93..d7d2d78 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/AdditionalVisibility.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/AdditionalVisibility.java
@@ -73,6 +73,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.SkuGetterSetter;
public class AdditionalVisibility extends AppCompatActivity implements View.OnClickListener, AdapterView.OnItemSelectedListener, DialogCallbackListener {
ArrayList list = new ArrayList();
+ private Context context;
ArrayList listdata = new ArrayList<>();
ArrayList listMain = new ArrayList();
ArrayList additionalVisibilitySkuList;
@@ -130,10 +131,8 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
setContentView(R.layout.additionalvisibilitylayout);
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
-
-
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
-
+ context = this;
preferences = PreferenceManager.getDefaultSharedPreferences(this);
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
camera_allow = preferences.getString(CommonString.KEY_CAMERA_ALLOW, "");
@@ -144,7 +143,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, "");
store_flag_str = preferences.getString(CommonString.KEY_STORE_FLAG, null);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
categoryName = getIntent().getStringExtra("categoryName");
categoryId = getIntent().getStringExtra("categoryId");
@@ -798,10 +797,10 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
btnimage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- _pathforcheck1 = store_id + categoryId + "AdditionalImage1" + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ _pathforcheck1 = store_id + categoryId + "AdditionalImage1" + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck1;
- intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext());
+ intime = CommonFunctions.getCurrentTimeWithLanguage(context);
startCameraActivity();
}
@@ -810,10 +809,10 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
btnimage1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- _pathforcheck2 = store_id + categoryId + "AdditionalImage2" + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ _pathforcheck2 = store_id + categoryId + "AdditionalImage2" + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck2;
- intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext());
+ intime = CommonFunctions.getCurrentTimeWithLanguage(context);
startCameraActivity();
}
@@ -822,10 +821,10 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
btnimage2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- _pathforcheck3 = store_id + categoryId + "AdditionalImage3" + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ _pathforcheck3 = store_id + categoryId + "AdditionalImage3" + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck3;
- intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext());
+ intime = CommonFunctions.getCurrentTimeWithLanguage(context);
startCameraActivity();
}
@@ -1213,7 +1212,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path);
- outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file);
+ outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager();
@@ -1872,7 +1871,7 @@ public class AdditionalVisibility extends AppCompatActivity implements View.OnCl
@Override
protected void onResume() {
super.onResume();
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getResources().getString(R.string.title_activity_Additional_visibility));
}
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/AuditActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/AuditActivity.java
index e788b83..6adb723 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/AuditActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/AuditActivity.java
@@ -56,7 +56,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityStockFacingGetterSett
import cpm.com.gskmtorange.xmlGetterSetter.T2PGetterSetter;
public class AuditActivity extends AppCompatActivity {
-
+ private Context context;
List checkHeaderArray = new ArrayList<>();
boolean checkflag = true;
private SharedPreferences preferences;
@@ -80,14 +80,12 @@ public class AuditActivity extends AppCompatActivity {
setContentView(R.layout.activity_audit);
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
-
+ context = this;
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
-
no_data_lay = (LinearLayout) findViewById(R.id.no_data_lay);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
-
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null);
date = preferences.getString(CommonString.KEY_DATE, null);
@@ -265,7 +263,7 @@ public class AuditActivity extends AppCompatActivity {
@Override
protected void onResume() {
super.onResume();
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getResources().getString(R.string.audit));
}
@@ -422,10 +420,10 @@ public class AuditActivity extends AppCompatActivity {
holder.img_cam.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- pathforcheck = store_id + "AuditAnsPic" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ pathforcheck = store_id + "AuditAnsPic" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + pathforcheck;
- intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext());
+ intime = CommonFunctions.getCurrentTimeWithLanguage(context);
child_position = position;
startCameraActivity(0);
}
@@ -434,10 +432,10 @@ public class AuditActivity extends AppCompatActivity {
holder.img_cam2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- pathforcheck = store_id + "AuditAnsPic2" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ pathforcheck = store_id + "AuditAnsPic2" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + pathforcheck;
- intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext());
+ intime = CommonFunctions.getCurrentTimeWithLanguage(context);
child_position = position;
startCameraActivity(1);
}
@@ -609,7 +607,7 @@ public class AuditActivity extends AppCompatActivity {
Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path);
- outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file);
+ outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager();
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/CategoryPicture.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/CategoryPicture.java
index b973f57..5626277 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/CategoryPicture.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/CategoryPicture.java
@@ -46,6 +46,7 @@ import cpm.com.gskmtorange.constant.CommonFunctions;
import cpm.com.gskmtorange.xmlGetterSetter.CategoryImagesAllowed;
public class CategoryPicture extends AppCompatActivity {
+ private Context context;
String _pathforcheck1, _pathforcheck2, _pathforcheck3, _pathforcheck4, Camerapath1, Camerapath2, _path, CaMpath, str, msg, categoryName, categoryId;
ImageView im1, im2, im3, im4;
ListView listview;
@@ -71,7 +72,7 @@ public class CategoryPicture extends AppCompatActivity {
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
-
+ context = this;
preferences = PreferenceManager.getDefaultSharedPreferences(this);
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
camera_allow = preferences.getString(CommonString.KEY_CAMERA_ALLOW, "");
@@ -80,7 +81,7 @@ public class CategoryPicture extends AppCompatActivity {
key_account_id = preferences.getString(CommonString.KEY_KEYACCOUNT_ID, "");
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, "");
store_flag_str = preferences.getString(CommonString.KEY_STORE_FLAG, null);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
categoryName = getIntent().getStringExtra("categoryName");
categoryId = getIntent().getStringExtra("categoryId");
@@ -214,10 +215,10 @@ public class CategoryPicture extends AppCompatActivity {
public void onClick(View view) {
- _pathforcheck1 = store_id + "CategoryPicture1" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ _pathforcheck1 = store_id + "CategoryPicture1" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck1;
- intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext());
+ intime = CommonFunctions.getCurrentTimeWithLanguage(context);
startCameraActivity();
}
@@ -227,10 +228,10 @@ public class CategoryPicture extends AppCompatActivity {
@Override
public void onClick(View view) {
- _pathforcheck2 = store_id + "CategoryPicture2" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ _pathforcheck2 = store_id + "CategoryPicture2" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck2;
- intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext());
+ intime = CommonFunctions.getCurrentTimeWithLanguage(context);
startCameraActivity();
@@ -240,10 +241,10 @@ public class CategoryPicture extends AppCompatActivity {
@Override
public void onClick(View view) {
- _pathforcheck3 = store_id + "CategoryPicture3" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ _pathforcheck3 = store_id + "CategoryPicture3" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck3;
- intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext());
+ intime = CommonFunctions.getCurrentTimeWithLanguage(context);
startCameraActivity();
@@ -253,10 +254,10 @@ public class CategoryPicture extends AppCompatActivity {
@Override
public void onClick(View view) {
- _pathforcheck4 = store_id + "CategoryPicture4" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ _pathforcheck4 = store_id + "CategoryPicture4" + categoryId + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck4;
- intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext());
+ intime = CommonFunctions.getCurrentTimeWithLanguage(context);
startCameraActivity();
@@ -299,7 +300,7 @@ public class CategoryPicture extends AppCompatActivity {
Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path);
- outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file);
+ outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager();
@@ -493,11 +494,11 @@ public class CategoryPicture extends AppCompatActivity {
@Override
public void onClick(View v) {
- Camerapath1 = store_id + "CategoryPicture" + list.get(position1).getSUB_CATEGORY_ID().toString() + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ Camerapath1 = store_id + "CategoryPicture" + list.get(position1).getSUB_CATEGORY_ID().toString() + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
Adapterposition = position1;
_path = CommonString.FILE_PATH + Camerapath1;
- intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext());
+ intime = CommonFunctions.getCurrentTimeWithLanguage(context);
startCameraActivity();
listview.invalidateViews();
@@ -516,10 +517,10 @@ public class CategoryPicture extends AppCompatActivity {
Snackbar.make(listview,R.string.first_click_compulsory_image,Snackbar.LENGTH_LONG).show();
}
else {
- Camerapath2 = store_id + "CategoryPicture" + list.get(position1).getSUB_CATEGORY_ID().toString() + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ Camerapath2 = store_id + "CategoryPicture" + list.get(position1).getSUB_CATEGORY_ID().toString() + date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
Adapterposition = position1;
_path = CommonString.FILE_PATH + Camerapath2;
- intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext());
+ intime = CommonFunctions.getCurrentTimeWithLanguage(context);
startCameraActivity();
listview.invalidateViews();
}
@@ -670,7 +671,7 @@ public class CategoryPicture extends AppCompatActivity {
@Override
protected void onResume() {
super.onResume();
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getResources().getString(R.string.title_activity_category_picture));
}
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/CheckoutActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/CheckoutActivity.java
index 671745d..2d71017 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/CheckoutActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/CheckoutActivity.java
@@ -37,7 +37,7 @@ import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.download.DownloadActivity;
public class CheckoutActivity extends AppCompatActivity {
-
+ private Context context;
private Dialog dialog;
private ProgressBar pb;
private TextView percentage, message;
@@ -62,12 +62,12 @@ public class CheckoutActivity extends AppCompatActivity {
db = new GSKOrangeDB(this);
db.open();
-
+ context = this;
preferences = PreferenceManager.getDefaultSharedPreferences(this);
visit_date = preferences.getString(CommonString.KEY_DATE, null);
username = preferences.getString(CommonString.KEY_USERNAME, null);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = getIntent().getStringExtra(CommonString.KEY_STORE_ID);
store_flag_str = getIntent().getStringExtra(CommonString.KEY_STORE_FLAG);
@@ -135,7 +135,7 @@ public class CheckoutActivity extends AppCompatActivity {
+ "[LATITUDE]" + lat + "[/LATITUDE]"
+ "[LOGITUDE]" + lon + "[/LOGITUDE]"
+ "[CHECKOUT_DATE]" + visit_date + "[/CHECKOUT_DATE]"
- + "[CHECK_OUTTIME]" + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()) + "[/CHECK_OUTTIME]"
+ + "[CHECK_OUTTIME]" + CommonFunctions.getCurrentTimeWithLanguage(context) + "[/CHECK_OUTTIME]"
+ "[CHECK_INTIME]" + coverageBean.getInTime() + "[/CHECK_INTIME]"
+ "[CREATED_BY]" + username + "[/CREATED_BY]"
+ "[/STORE_CHECK_OUT_STATUS]";
@@ -185,7 +185,7 @@ public class CheckoutActivity extends AppCompatActivity {
if (result.toString().equalsIgnoreCase(CommonString.KEY_SUCCESS)) {
- db.updateCheckoutOuttime(store_id, CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()), CommonString.KEY_Y, checkOutImagePath);
+ db.updateCheckoutOuttime(store_id, CommonFunctions.getCurrentTimeWithLanguage(context), CommonString.KEY_Y, checkOutImagePath);
SharedPreferences.Editor editor = preferences.edit();
editor.putString(CommonString.KEY_STORE_ID, "");
@@ -295,7 +295,7 @@ public class CheckoutActivity extends AppCompatActivity {
CheckOutStoreActivity.this, CommonString1.ERROR + result, "success", null);
message.showMessage();*/
- Toast.makeText(getApplicationContext(), "Network Error Try Again", Toast.LENGTH_SHORT).show();
+ Toast.makeText(context, "Network Error Try Again", Toast.LENGTH_SHORT).show();
finish();
}
@@ -312,7 +312,7 @@ public class CheckoutActivity extends AppCompatActivity {
@Override
protected void onResume() {
super.onResume();
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getResources().getString(R.string.title_activity_checkout));
}
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/CoachingVisitActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/CoachingVisitActivity.java
index e073806..d2be365 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/CoachingVisitActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/CoachingVisitActivity.java
@@ -2,6 +2,7 @@ package cpm.com.gskmtorange.dailyentry;
import android.annotation.SuppressLint;
import android.content.ActivityNotFoundException;
+import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
@@ -47,6 +48,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.SupervisorListGetterSetter;
public class CoachingVisitActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener, View.OnClickListener {
+ private Context context;
private GSKOrangeDB database;
ArrayList supervisorList;
private Spinner exist_spinner; //supervisor_spinner;
@@ -81,13 +83,13 @@ public class CoachingVisitActivity extends AppCompatActivity implements AdapterV
img_cam = (ImageView) findViewById(R.id.img_cam);
multi_spinner_supervisor = (MultiSpinnerSearch) findViewById(R.id.multi_spinner_supervisor);
-
+ context = this;
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getResources().getString(R.string.title_activity_coaching_visit));
@@ -271,7 +273,7 @@ public class CoachingVisitActivity extends AppCompatActivity implements AdapterV
switch (v.getId()) {
case R.id.img_cam:
- _pathforcheck = store_id + "CoachingVisit" + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ _pathforcheck = store_id + "CoachingVisit" + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck;
@@ -304,7 +306,7 @@ public class CoachingVisitActivity extends AppCompatActivity implements AdapterV
database.insertCoachingVisitData(coachingVisitGetterSetter, store_id);
}
- Toast.makeText(getApplicationContext(), getString(R.string.save_message), Toast.LENGTH_SHORT).show();
+ Toast.makeText(context, getString(R.string.save_message), Toast.LENGTH_SHORT).show();
saved_flag = true;
@@ -320,7 +322,7 @@ public class CoachingVisitActivity extends AppCompatActivity implements AdapterV
database.insertCoachingVisitData(coachingVisitGetterSetter, store_id);
- Toast.makeText(getApplicationContext(), getString(R.string.save_message), Toast.LENGTH_SHORT).show();
+ Toast.makeText(context, getString(R.string.save_message), Toast.LENGTH_SHORT).show();
saved_flag = true;
fab_next.show();//setVisibility(View.VISIBLE);
}
@@ -363,7 +365,7 @@ public class CoachingVisitActivity extends AppCompatActivity implements AdapterV
Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path);
- outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file);
+ outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager();
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/CompetitionPromoActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/CompetitionPromoActivity.java
index 521d387..4b2809a 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/CompetitionPromoActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/CompetitionPromoActivity.java
@@ -49,7 +49,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.CompetitonPromoGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.PROMOTION_TYPE_MASTERGetterSetter;
public class CompetitionPromoActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener, View.OnClickListener {
-
+ private Context context;
ToggleButton btntoggle;
boolean isDataAdded = false, isExists = true, is_camera_compulsory = false;
LinearLayout lin_parent;
@@ -108,7 +108,7 @@ public class CompetitionPromoActivity extends AppCompatActivity implements Adapt
imgCam = (ImageView) findViewById(R.id.img_cam);
imgCam1 = (ImageView) findViewById(R.id.img_cam1);
imgCam2 = (ImageView) findViewById(R.id.img_cam2);
-
+ context = this;
//preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this);
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
@@ -122,7 +122,7 @@ public class CompetitionPromoActivity extends AppCompatActivity implements Adapt
storeType_id = preferences.getString(CommonString.KEY_STORETYPE_ID, "");
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
//Intent data
categoryName = getIntent().getStringExtra("categoryName");
@@ -183,7 +183,7 @@ public class CompetitionPromoActivity extends AppCompatActivity implements Adapt
if(exists_data.get(0).isExists()){
addedCounterfeitProducts = db.getCometionPromoAfterData(store_id, categoryId);
if(addedCounterfeitProducts.size()>0){
- rec_added_counterfeit_product.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
+ rec_added_counterfeit_product.setLayoutManager(new LinearLayoutManager(context));
productAdapter = new ProductAdapter(addedCounterfeitProducts);
rec_added_counterfeit_product.setAdapter(productAdapter);
}
@@ -278,7 +278,7 @@ public class CompetitionPromoActivity extends AppCompatActivity implements Adapt
addedCounterfeitProducts.add(product);
- rec_added_counterfeit_product.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
+ rec_added_counterfeit_product.setLayoutManager(new LinearLayoutManager(context));
productAdapter = new ProductAdapter(addedCounterfeitProducts);
rec_added_counterfeit_product.setAdapter(productAdapter);
@@ -320,19 +320,19 @@ public class CompetitionPromoActivity extends AppCompatActivity implements Adapt
break;
case R.id.img_cam:
- _pathforcheck = store_id + "CounterfeitProductImg1" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ _pathforcheck = store_id + "CounterfeitProductImg1" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck;
startCameraActivity();
break;
case R.id.img_cam1:
- _pathforcheck1 = store_id + "CounterfeitProductImg2" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ _pathforcheck1 = store_id + "CounterfeitProductImg2" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck1;
startCameraActivity();
break;
case R.id.img_cam2:
- _pathforcheck2 = store_id + "CounterfeitProductImg3" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ _pathforcheck2 = store_id + "CounterfeitProductImg3" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck2;
startCameraActivity();
break;
@@ -610,7 +610,7 @@ public class CompetitionPromoActivity extends AppCompatActivity implements Adapt
Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path);
- outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file);
+ outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager();
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/ConversationActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/ConversationActivity.java
index 460a68e..0efc0a2 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/ConversationActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/ConversationActivity.java
@@ -63,7 +63,7 @@ public class ConversationActivity extends AppCompatActivity {
private SharedPreferences preferences = null;
GSKOrangeDB db;
-
+ private Context context;
ArrayList conversation_list = new ArrayList<>();
MyRecyclerAdapter adapter;
@@ -85,7 +85,7 @@ public class ConversationActivity extends AppCompatActivity {
db = new GSKOrangeDB(ConversationActivity.this);
db.open();
-
+ context = this;
rec = (RecyclerView) findViewById(R.id.rec_conversation);
et_reply = (EditText) findViewById(R.id.et_reply);
@@ -96,7 +96,7 @@ public class ConversationActivity extends AppCompatActivity {
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
userId = preferences.getString(CommonString.KEY_USERNAME, null);
culture_id = preferences.getString(CommonString.KEY_CULTURE_ID, "");
@@ -146,9 +146,9 @@ public class ConversationActivity extends AppCompatActivity {
});
//if (conversation_list.size() > 0) {
- adapter = new MyRecyclerAdapter(getApplicationContext(), conversation_list);
+ adapter = new MyRecyclerAdapter(context, conversation_list);
rec.setAdapter(adapter);
- rec.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
+ rec.setLayoutManager(new LinearLayoutManager(context));
//}
}
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/CounterfeitIndicatorWebActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/CounterfeitIndicatorWebActivity.java
index 10af11b..f7808ac 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/CounterfeitIndicatorWebActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/CounterfeitIndicatorWebActivity.java
@@ -1,5 +1,6 @@
package cpm.com.gskmtorange.dailyentry;
+import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
@@ -21,7 +22,7 @@ import cpm.com.gskmtorange.constant.CommonFunctions;
import cpm.com.gskmtorange.constant.CommonString;
public class CounterfeitIndicatorWebActivity extends AppCompatActivity {
-
+ private Context context;
WebView webView;
String url = "https://gskme.parinaam.in/res/eg/fake.html";
private SharedPreferences preferences;
@@ -32,11 +33,11 @@ public class CounterfeitIndicatorWebActivity extends AppCompatActivity {
setContentView(R.layout.activity_counterfeit_indicator_web);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
-
+ context = this;
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getResources().getString(R.string.title_activity_counterfeit_indicator_web));
webView = (WebView) findViewById(R.id.webview);
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/CounterfeitProductsActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/CounterfeitProductsActivity.java
index cd35f3f..8ee0202 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/CounterfeitProductsActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/CounterfeitProductsActivity.java
@@ -51,6 +51,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.CounterfeitProductGetterSetter;
public class CounterfeitProductsActivity extends AppCompatActivity implements AdapterView.OnItemSelectedListener, View.OnClickListener {
+ private Context context;
ToggleButton btntoggle;
boolean isDataAdded = false, isExists = true, is_camera_compulsory = false;
LinearLayout lin_parent;
@@ -82,7 +83,7 @@ public class CounterfeitProductsActivity extends AppCompatActivity implements Ad
setContentView(R.layout.activity_counterfeit_products);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
-
+ context = this;
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
btntoggle = (ToggleButton) findViewById(R.id.btntoggle);
@@ -108,7 +109,7 @@ public class CounterfeitProductsActivity extends AppCompatActivity implements Ad
username = preferences.getString(CommonString.KEY_USERNAME, null);
country_id = preferences.getString(CommonString.KEY_COUNTRY_ID, null);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
//Intent data
categoryName = getIntent().getStringExtra("categoryName");
@@ -146,7 +147,7 @@ public class CounterfeitProductsActivity extends AppCompatActivity implements Ad
if(exists_data.get(0).isExists()){
addedCounterfeitProducts = db.getCounterfeitProductAfterData(store_id, categoryId);
if(addedCounterfeitProducts.size()>0){
- rec_added_counterfeit_product.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
+ rec_added_counterfeit_product.setLayoutManager(new LinearLayoutManager(context));
productAdapter = new ProductAdapter(addedCounterfeitProducts);
rec_added_counterfeit_product.setAdapter(productAdapter);
}
@@ -237,7 +238,7 @@ public class CounterfeitProductsActivity extends AppCompatActivity implements Ad
addedCounterfeitProducts.add(product);
- rec_added_counterfeit_product.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
+ rec_added_counterfeit_product.setLayoutManager(new LinearLayoutManager(context));
productAdapter = new ProductAdapter(addedCounterfeitProducts);
rec_added_counterfeit_product.setAdapter(productAdapter);
@@ -277,19 +278,19 @@ public class CounterfeitProductsActivity extends AppCompatActivity implements Ad
break;
case R.id.img_cam:
- _pathforcheck = store_id + "CounterfeitProductImg1" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ _pathforcheck = store_id + "CounterfeitProductImg1" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck;
startCameraActivity();
break;
case R.id.img_cam1:
- _pathforcheck1 = store_id + "CounterfeitProductImg2" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ _pathforcheck1 = store_id + "CounterfeitProductImg2" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck1;
startCameraActivity();
break;
case R.id.img_cam2:
- _pathforcheck2 = store_id + "CounterfeitProductImg3" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ _pathforcheck2 = store_id + "CounterfeitProductImg3" + categoryId + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck2;
startCameraActivity();
break;
@@ -401,7 +402,7 @@ public class CounterfeitProductsActivity extends AppCompatActivity implements Ad
Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path);
- outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file);
+ outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager();
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/CreateSelfActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/CreateSelfActivity.java
index 08e6805..855d1b6 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/CreateSelfActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/CreateSelfActivity.java
@@ -53,7 +53,7 @@ public class CreateSelfActivity extends AppCompatActivity {
RecyclerView rec_sub_category;
static int FROM_DIALOG = 0;
static int FROM_CLICK = 1;
-
+ private Context context;
ArrayList added_sub_category_list;
@Override
@@ -66,7 +66,7 @@ public class CreateSelfActivity extends AppCompatActivity {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
rec_sub_category = (RecyclerView) findViewById(R.id.rec_sub_category);
-
+ context = this;
//preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this);
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
@@ -195,7 +195,7 @@ public class CreateSelfActivity extends AppCompatActivity {
Snackbar.make(btn_create,"Sub Category already added",Snackbar.LENGTH_SHORT).show();
}
else {
- Intent in = new Intent(getApplicationContext(), NoCameraActivity.class);
+ Intent in = new Intent(context, NoCameraActivity.class);
in.putExtra("categoryName", categoryName);
in.putExtra("categoryId", categoryId);
in.putExtra(CommonString.KEY_NUMBER_OF_ROWS, number_of_rows);
@@ -467,7 +467,7 @@ public class CreateSelfActivity extends AppCompatActivity {
holder.parentLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- Intent in = new Intent(getApplicationContext(), NoCameraActivity.class);
+ Intent in = new Intent(context, NoCameraActivity.class);
in.putExtra("categoryName", categoryName);
in.putExtra("categoryId", categoryId);
in.putExtra(CommonString.KEY_NUMBER_OF_ROWS, 0);
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/DeliveryCallActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/DeliveryCallActivity.java
index b701d10..bf7e8ae 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/DeliveryCallActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/DeliveryCallActivity.java
@@ -51,7 +51,7 @@ import cpm.com.gskmtorange.upload.UploadImageWithRetrofit;
import cpm.com.gskmtorange.xmlGetterSetter.DeliveryCallsGetterSetter;
public class DeliveryCallActivity extends AppCompatActivity implements View.OnClickListener {
-
+ private Context context;
private SharedPreferences preferences;
private GSKOrangeDB database;
String visit_date, userId;
@@ -67,7 +67,7 @@ public class DeliveryCallActivity extends AppCompatActivity implements View.OnCl
setContentView(R.layout.activity_delivery_call);
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
-
+ context = this;
recyclerView = (RecyclerView) findViewById(R.id.rec_delivery_calls);
fab = (FloatingActionButton) findViewById(R.id.fab);
fab_upload = (FloatingActionButton) findViewById(R.id.fab_upload);
@@ -76,7 +76,7 @@ public class DeliveryCallActivity extends AppCompatActivity implements View.OnCl
visit_date = preferences.getString(CommonString.KEY_DATE, null);
userId = preferences.getString(CommonString.KEY_USERNAME, null);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
database = new GSKOrangeDB(this);
database.open();
@@ -103,7 +103,7 @@ public class DeliveryCallActivity extends AppCompatActivity implements View.OnCl
Snackbar.make(recyclerView, getString(R.string.title_store_list_checkout_current), Snackbar.LENGTH_SHORT).show();
} else {
- Intent in = new Intent(getApplicationContext(), DeliveryCallAddStoreActivity.class);
+ Intent in = new Intent(context, DeliveryCallAddStoreActivity.class);
startActivity(in);
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
@@ -162,7 +162,7 @@ public class DeliveryCallActivity extends AppCompatActivity implements View.OnCl
public void onClick(View v) {
if (current.getUPLOAD_STATUS().equals(CommonString.KEY_CHECK_IN)) {
- Intent in = new Intent(getApplicationContext(), DeliveryCallAddStoreActivity.class);
+ Intent in = new Intent(context, DeliveryCallAddStoreActivity.class);
in.putExtra(CommonString.KEY_STORE_ID, current);
in.putExtra(CommonString.KEY_STORE_FLAG, false);
startActivity(in);
@@ -203,14 +203,14 @@ public class DeliveryCallActivity extends AppCompatActivity implements View.OnCl
protected void onResume() {
super.onResume();
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getString(R.string.delivery_call));
deliveryCallsList = database.getDeliveryCallsData(visit_date);
if (deliveryCallsList.size() > 0) {
//list.setAdapter(new MyAdaptor());
- deliveryAdapter = new DeliveryAdapter(getApplicationContext(), deliveryCallsList);
+ deliveryAdapter = new DeliveryAdapter(context, deliveryCallsList);
recyclerView.setAdapter(deliveryAdapter);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/DeliveryCallAddStoreActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/DeliveryCallAddStoreActivity.java
index 121fde2..5af93a2 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/DeliveryCallAddStoreActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/DeliveryCallAddStoreActivity.java
@@ -106,7 +106,7 @@ public class DeliveryCallAddStoreActivity extends AppCompatActivity implements V
preferences = PreferenceManager.getDefaultSharedPreferences(this);
visit_date = preferences.getString(CommonString.KEY_DATE, null);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
checkin_flag = getIntent().getBooleanExtra(CommonString.KEY_STORE_FLAG, true);
deliveryCallsData = (DeliveryCallsGetterSetter) getIntent().getSerializableExtra(CommonString.KEY_STORE_ID);
@@ -224,7 +224,7 @@ public class DeliveryCallAddStoreActivity extends AppCompatActivity implements V
super.onResume();
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getString(R.string.delivery_call));
checkgpsEnableDevice();
@@ -318,9 +318,9 @@ public class DeliveryCallAddStoreActivity extends AppCompatActivity implements V
switch (v.getId()) {
case R.id.img_checkin:
- in_time = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext());
+ in_time = CommonFunctions.getCurrentTimeWithLanguage(context);
- _pathforcheck = "DeliveryCalls" + visit_date.replace("/", "") + "InTime" + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ _pathforcheck = "DeliveryCalls" + visit_date.replace("/", "") + "InTime" + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck;
@@ -329,9 +329,9 @@ public class DeliveryCallAddStoreActivity extends AppCompatActivity implements V
case R.id.img_checkout:
- out_time = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext());
+ out_time = CommonFunctions.getCurrentTimeWithLanguage(context);
- _pathforcheck = "DeliveryCalls" + visit_date.replace("/", "") + "OutTime" + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ _pathforcheck = "DeliveryCalls" + visit_date.replace("/", "") + "OutTime" + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck;
@@ -345,7 +345,7 @@ public class DeliveryCallAddStoreActivity extends AppCompatActivity implements V
Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path);
- outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file);
+ outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager();
@@ -439,7 +439,7 @@ public class DeliveryCallAddStoreActivity extends AppCompatActivity implements V
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else {
- Toast.makeText(getApplicationContext(), getResources().getString(R.string.notsuppoted)
+ Toast.makeText(context, getResources().getString(R.string.notsuppoted)
, Toast.LENGTH_LONG)
.show();
finish();
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/FutureJCPActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/FutureJCPActivity.java
index 373e3e1..2b07904 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/FutureJCPActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/FutureJCPActivity.java
@@ -153,7 +153,7 @@ public class FutureJCPActivity extends AppCompatActivity implements View.OnClick
culture_id = preferences.getString(CommonString.KEY_CULTURE_ID, "");
progressDialog = new ProgressDialog(FutureJCPActivity.this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
c = Calendar.getInstance();
year = c.get(Calendar.YEAR);
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/MessageActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/MessageActivity.java
index 8644cc6..0631f50 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/MessageActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/MessageActivity.java
@@ -56,7 +56,7 @@ import cpm.com.gskmtorange.xmlHandlers.XMLHandlers;
public class MessageActivity extends AppCompatActivity {
//ArrayList messages;
-
+ private Context context;
String categoryName = "", categoryId;
MyRecyclerAdapter adapter;
@@ -81,7 +81,7 @@ public class MessageActivity extends AppCompatActivity {
setContentView(R.layout.activity_message);
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
-
+ context = this;
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
rec = (RecyclerView)findViewById(R.id.rec);
@@ -91,7 +91,7 @@ public class MessageActivity extends AppCompatActivity {
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
userId = preferences.getString(CommonString.KEY_USERNAME, null);
culture_id = preferences.getString(CommonString.KEY_CULTURE_ID, "");
@@ -122,7 +122,7 @@ public class MessageActivity extends AppCompatActivity {
protected void onResume() {
super.onResume();
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getString(R.string.title_activity_message));
new DowloadAsync(MessageActivity.this).execute();
@@ -398,9 +398,9 @@ public class MessageActivity extends AppCompatActivity {
chatmessagelist = db.getChatMessageData(store_id);
if(chatmessagelist.size()>0){
- adapter = new MyRecyclerAdapter(getApplicationContext(), chatmessagelist);
+ adapter = new MyRecyclerAdapter(context, chatmessagelist);
rec.setAdapter(adapter);
- rec.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
+ rec.setLayoutManager(new LinearLayoutManager(context));
}
//finish();
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/NewStockDataActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/NewStockDataActivity.java
index d33c482..df5d96c 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/NewStockDataActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/NewStockDataActivity.java
@@ -70,6 +70,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.StockFacing_PlanogramTrackerDataGette
public class NewStockDataActivity extends AppCompatActivity implements DialogCallbackListener{
+ private Context context;
ExpandableListView expandableListView;
TextView txt_mslAvailabilityName;
ArrayList headerDataList;
@@ -121,11 +122,11 @@ public class NewStockDataActivity extends AppCompatActivity implements DialogCa
db = new GSKOrangeDB(this);
db.open();
-
+ context = this;
//preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
store_flag_hide = preferences.getString(CommonString.KEY_STORE_FLAG_FACING_HIDE, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null);
@@ -245,7 +246,7 @@ public class NewStockDataActivity extends AppCompatActivity implements DialogCa
@Override
public void onScrollStateChanged(AbsListView arg0, int arg1) {
- InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
+ InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -268,7 +269,7 @@ public class NewStockDataActivity extends AppCompatActivity implements DialogCa
expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
@Override
public void onGroupExpand(int groupPosition) {
- InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
+ InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (getWindow().getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -281,7 +282,7 @@ public class NewStockDataActivity extends AppCompatActivity implements DialogCa
expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
@Override
public void onGroupCollapse(int groupPosition) {
- InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
+ InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (getWindow().getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -659,7 +660,7 @@ public class NewStockDataActivity extends AppCompatActivity implements DialogCa
@Override
protected void onResume() {
super.onResume();
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
}
private void prepareList() {
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/NoCameraActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/NoCameraActivity.java
index 431a91d..238a3d5 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/NoCameraActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/NoCameraActivity.java
@@ -1,6 +1,7 @@
package cpm.com.gskmtorange.dailyentry;
import android.app.Dialog;
+import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
@@ -65,7 +66,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.NoCameraDataGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.RowColumnGetterSetter;
public class NoCameraActivity extends AppCompatActivity implements Listener {
-
+ private Context context;
GSKOrangeDB db;
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, camera_allow, str, country_id, store_flag_str;
String categoryName, categoryId;
@@ -93,7 +94,7 @@ public class NoCameraActivity extends AppCompatActivity implements Listener {
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
-
+ context = this;
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
fab = (FloatingActionButton) findViewById(R.id.fab);
@@ -158,11 +159,11 @@ public class NoCameraActivity extends AppCompatActivity implements Listener {
DynamycIdsGetterSetter dynamic_ids = new DynamycIdsGetterSetter();
// first Button
- RelativeLayout rLayout = new RelativeLayout(getApplicationContext());
+ RelativeLayout rLayout = new RelativeLayout(context);
RelativeLayout.LayoutParams lprams = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.MATCH_PARENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
- TextView tv = new TextView(getApplicationContext());
+ TextView tv = new TextView(context);
tv.setHeight(60);
tv.setTextSize(18);
tv.setBackgroundColor(getResources().getColor(R.color.grey_textview));
@@ -175,7 +176,7 @@ public class NoCameraActivity extends AppCompatActivity implements Listener {
//set dynamic textview id to object
dynamic_ids.setTextview_id(tv_id);
- RecyclerView rec_bottom = new RecyclerView(getApplicationContext());
+ RecyclerView rec_bottom = new RecyclerView(context);
int rec_id = View.generateViewId();
//set dynamic recycler id to object
@@ -193,7 +194,7 @@ public class NoCameraActivity extends AppCompatActivity implements Listener {
RelativeLayout.LayoutParams.MATCH_PARENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
lprams2.height = 2;
- View view = new View(getApplicationContext());
+ View view = new View(context);
view.setBackgroundColor(getResources().getColor(R.color.white));
view.setLayoutParams(lprams2);
@@ -221,7 +222,7 @@ public class NoCameraActivity extends AppCompatActivity implements Listener {
dynamic_ids.setTotal_unit(getTotalUnit(sku_group_master));
ids.add(dynamic_ids);
- MyAdapter adapter = new MyAdapter(getApplicationContext(), sku_group_master, this, rec_bottom);
+ MyAdapter adapter = new MyAdapter(context, sku_group_master, this, rec_bottom);
rec_bottom.setAdapter(adapter);
rec_bottom.scrollToPosition(sku_group_master.size() - 1);
@@ -248,11 +249,11 @@ public class NoCameraActivity extends AppCompatActivity implements Listener {
DynamycIdsGetterSetter dynamic_ids = new DynamycIdsGetterSetter();
// first Button
- RelativeLayout rLayout = new RelativeLayout(getApplicationContext());
+ RelativeLayout rLayout = new RelativeLayout(context);
RelativeLayout.LayoutParams lprams = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.MATCH_PARENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
- TextView tv = new TextView(getApplicationContext());
+ TextView tv = new TextView(context);
//tv.setHeight(60);
tv.setTextSize(20);
tv.setBackgroundColor(getResources().getColor(R.color.grey_textview));
@@ -265,7 +266,7 @@ public class NoCameraActivity extends AppCompatActivity implements Listener {
//set dynamic textview id to object
dynamic_ids.setTextview_id(tv_id);
- RecyclerView rec_bottom = new RecyclerView(getApplicationContext());
+ RecyclerView rec_bottom = new RecyclerView(context);
int rec_id = View.generateViewId();
//set dynamic recycler id to object
@@ -283,7 +284,7 @@ public class NoCameraActivity extends AppCompatActivity implements Listener {
RelativeLayout.LayoutParams.MATCH_PARENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
lprams2.height = 2;
- View view = new View(getApplicationContext());
+ View view = new View(context);
view.setBackgroundColor(getResources().getColor(R.color.white));
view.setLayoutParams(lprams2);
@@ -310,7 +311,7 @@ public class NoCameraActivity extends AppCompatActivity implements Listener {
List brands = new ArrayList<>();
- MyAdapter adapter = new MyAdapter(getApplicationContext(), brands, this, rec_bottom);
+ MyAdapter adapter = new MyAdapter(context, brands, this, rec_bottom);
rec_bottom.setAdapter(adapter);
tv.setOnDragListener(adapter.getDragInstance());
@@ -1203,11 +1204,11 @@ public class NoCameraActivity extends AppCompatActivity implements Listener {
DynamycIdsGetterSetter dynamic_ids = new DynamycIdsGetterSetter();
// first Button
- RelativeLayout rLayout = new RelativeLayout(getApplicationContext());
+ RelativeLayout rLayout = new RelativeLayout(context);
RelativeLayout.LayoutParams lprams = new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.MATCH_PARENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
- TextView tv = new TextView(getApplicationContext());
+ TextView tv = new TextView(context);
//tv.setHeight(60);
tv.setTextSize(20);
tv.setBackgroundColor(getResources().getColor(R.color.grey_textview));
@@ -1220,7 +1221,7 @@ public class NoCameraActivity extends AppCompatActivity implements Listener {
//set dynamic textview id to object
dynamic_ids.setTextview_id(tv_id);
- RecyclerView rec_bottom = new RecyclerView(getApplicationContext());
+ RecyclerView rec_bottom = new RecyclerView(context);
int rec_id = View.generateViewId();
//set dynamic recycler id to object
@@ -1238,7 +1239,7 @@ public class NoCameraActivity extends AppCompatActivity implements Listener {
RelativeLayout.LayoutParams.MATCH_PARENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
lprams2.height = 2;
- View view = new View(getApplicationContext());
+ View view = new View(context);
view.setBackgroundColor(getResources().getColor(R.color.white));
view.setLayoutParams(lprams2);
@@ -1265,7 +1266,7 @@ public class NoCameraActivity extends AppCompatActivity implements Listener {
List brands = new ArrayList<>();
- MyAdapter adapter = new MyAdapter(getApplicationContext(), brands, this, rec_bottom);
+ MyAdapter adapter = new MyAdapter(context, brands, this, rec_bottom);
rec_bottom.setAdapter(adapter);
tv.setOnDragListener(adapter.getDragInstance());
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/NonWorkingReason.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/NonWorkingReason.java
index 125ae29..28a5ed4 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/NonWorkingReason.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/NonWorkingReason.java
@@ -74,7 +74,7 @@ import cpm.com.gskmtorange.xmlHandlers.FailureXMLHandler;
public class NonWorkingReason extends AppCompatActivity implements
OnItemSelectedListener, OnClickListener {
-
+ private Context context;
ArrayList reasondata = new ArrayList();
ArrayList sub_reasondata = new ArrayList<>();
private Spinner reasonspinner, subreason_spinner;
@@ -130,12 +130,12 @@ public class NonWorkingReason extends AppCompatActivity implements
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
-
+ context = this;
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_flag_str = getIntent().getStringExtra(CommonString.KEY_STORE_FLAG);
@@ -190,7 +190,7 @@ public class NonWorkingReason extends AppCompatActivity implements
}
- intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext());
+ intime = CommonFunctions.getCurrentTimeWithLanguage(context);
camera.setOnClickListener(this);
save.setOnClickListener(this);
@@ -310,7 +310,7 @@ public class NonWorkingReason extends AppCompatActivity implements
Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path);
- outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file);
+ outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager();
@@ -428,7 +428,7 @@ public class NonWorkingReason extends AppCompatActivity implements
// TODO Auto-generated method stub
if (v.getId() == R.id.imgcam) {
- _pathforcheck = store_id + "NonWorking" + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ _pathforcheck = store_id + "NonWorking" + visit_date.replace("/", "") + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck;
@@ -447,13 +447,13 @@ public class NonWorkingReason extends AppCompatActivity implements
if(!validateSubReasonData()){
valid_flag = false;
- Toast.makeText(getApplicationContext(), R.string.title_activity_select_dropdown,
+ Toast.makeText(context, R.string.title_activity_select_dropdown,
Toast.LENGTH_SHORT).show();
}
} else {
valid_flag = false;
- Toast.makeText(getApplicationContext(), R.string.pleaseenterRemarks,
+ Toast.makeText(context, R.string.pleaseenterRemarks,
Toast.LENGTH_SHORT).show();
}
}
@@ -489,7 +489,7 @@ public class NonWorkingReason extends AppCompatActivity implements
cdata.setVisitDate(visit_date);
cdata.setUserId(_UserId);
cdata.setInTime(intime);
- cdata.setOutTime(CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()));
+ cdata.setOutTime(CommonFunctions.getCurrentTimeWithLanguage(context));
cdata.setReason(reasonname);
cdata.setReasonid(reasonid);
cdata.setLatitude("0.0");
@@ -524,7 +524,7 @@ public class NonWorkingReason extends AppCompatActivity implements
cdata.setVisitDate(visit_date);
cdata.setUserId(_UserId);
cdata.setInTime(intime);
- cdata.setOutTime(CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()));
+ cdata.setOutTime(CommonFunctions.getCurrentTimeWithLanguage(context));
cdata.setReason(reasonname);
cdata.setReasonid(reasonid);
cdata.setLatitude("0.0");
@@ -586,11 +586,11 @@ public class NonWorkingReason extends AppCompatActivity implements
}
} else {
- Toast.makeText(getApplicationContext(),
+ Toast.makeText(context,
R.string.title_activity_take_image, Toast.LENGTH_SHORT).show();
}
} else {
- Toast.makeText(getApplicationContext(),
+ Toast.makeText(context,
R.string.title_activity_select_dropdown, Toast.LENGTH_SHORT).show();
}
@@ -671,7 +671,7 @@ public class NonWorkingReason extends AppCompatActivity implements
@Override
protected void onResume() {
super.onResume();
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
}
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/POGQuestionsActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/POGQuestionsActivity.java
index ec02691..9bfdace 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/POGQuestionsActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/POGQuestionsActivity.java
@@ -48,7 +48,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityStockFacingGetterSett
import cpm.com.gskmtorange.xmlGetterSetter.POGGetterSetter;
public class POGQuestionsActivity extends AppCompatActivity {
-
+ private Context context;
ExpandableListView expandableListView;
LinearLayout linPlanogramType;
Spinner spinPlanogramType;
@@ -82,13 +82,13 @@ public class POGQuestionsActivity extends AppCompatActivity {
expandableListView = (ExpandableListView) findViewById(R.id.expandableListView);
linPlanogramType = (LinearLayout) findViewById(R.id.lin_planogram_type);
spinPlanogramType = (Spinner) findViewById(R.id.spinner_planogram_type);
-
+ context = this;
db = new GSKOrangeDB(this);
db.open();
//preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null);
date = preferences.getString(CommonString.KEY_DATE, null);
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/PlanogramPDFActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/PlanogramPDFActivity.java
index 9769ed1..9f0ba08 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/PlanogramPDFActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/PlanogramPDFActivity.java
@@ -64,7 +64,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.TableBean;
import cpm.com.gskmtorange.xmlHandlers.XMLHandlers;
public class PlanogramPDFActivity extends AppCompatActivity {
-
+ private Context context;
private Dialog dialog;
private ProgressBar pb;
private TextView percentage, message;
@@ -86,7 +86,7 @@ public class PlanogramPDFActivity extends AppCompatActivity {
setContentView(R.layout.activity_planogram_pdf);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
-
+ context = this;
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
rec = (RecyclerView) findViewById(R.id.rec);
@@ -96,7 +96,7 @@ public class PlanogramPDFActivity extends AppCompatActivity {
@Override
public void onClick(View view) {
if(checkNetIsAvailable()){
- new DowloadAsync(getApplicationContext()).execute();
+ new DowloadAsync(context).execute();
}
else {
Snackbar.make(fab, getResources().getString(R.string.nonetwork), Snackbar.LENGTH_SHORT)
@@ -108,7 +108,7 @@ public class PlanogramPDFActivity extends AppCompatActivity {
preferences = PreferenceManager.getDefaultSharedPreferences(this);
userId = preferences.getString(CommonString.KEY_USERNAME, null);
culture_id = preferences.getString(CommonString.KEY_CULTURE_ID, "");
- new DowloadAsync(getApplicationContext()).execute();
+ new DowloadAsync(context).execute();
}
//region Download doc
@@ -255,9 +255,9 @@ public class PlanogramPDFActivity extends AppCompatActivity {
if (result.contains(CommonString.KEY_SUCCESS)) {
if(document.getPLANOGRAM_URL().size()>0){
- adapter = new MyRecyclerAdapter(getApplicationContext(), document);
+ adapter = new MyRecyclerAdapter(context, document);
rec.setAdapter(adapter);
- rec.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
+ rec.setLayoutManager(new LinearLayoutManager(context));
}
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/ServiceActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/ServiceActivity.java
index a986610..8ae54ee 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/ServiceActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/ServiceActivity.java
@@ -26,7 +26,7 @@ public class ServiceActivity extends AppCompatActivity {
private SharedPreferences preferences;
Toolbar toolbar;
-
+ private Context context;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -35,11 +35,11 @@ public class ServiceActivity extends AppCompatActivity {
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
-
+ context = this;
//preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context,preferences.getString(CommonString.KEY_LANGUAGE, ""));
/* ServiceActivityFragment fragment = new ServiceActivityFragment();
getSupportFragmentManager().beginTransaction().add(R.id.fragment,fragment).commit();*/
@@ -83,7 +83,7 @@ public class ServiceActivity extends AppCompatActivity {
@Override
protected void onResume() {
super.onResume();
- CommonFunctions.updateLangResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context,preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(R.string.title_activity_service);
}
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/SettingsActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/SettingsActivity.java
index bf83186..d0a9a76 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/SettingsActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/SettingsActivity.java
@@ -30,7 +30,7 @@ import cpm.com.gskmtorange.fragment.SettingsActivityFragment;
public class SettingsActivity extends AppCompatActivity implements SelectLanguageFragment.OnFragmentInteractionListener {
String selected_lang = "", culture_id, notice_url;
-
+ private Context context;
FloatingActionButton fab;
private SharedPreferences preferences;
@@ -45,14 +45,14 @@ public class SettingsActivity extends AppCompatActivity implements SelectLanguag
setContentView(R.layout.activity_settings);
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
-
+ context = this;
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
//preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this);
editor = preferences.edit();
- CommonFunctions.updateLangResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context,preferences.getString(CommonString.KEY_LANGUAGE, ""));
/* SettingsActivityFragment fragment = new SettingsActivityFragment();
getSupportFragmentManager().beginTransaction().add(R.id.fragment,fragment).commit();*/
@@ -68,14 +68,14 @@ public class SettingsActivity extends AppCompatActivity implements SelectLanguag
.setAction("Action", null).show();
} else {
- CommonFunctions.updateLangResources(getApplicationContext(),selected_lang);
+ CommonFunctions.updateLangResources(context,selected_lang);
editor.putString(CommonString.KEY_LANGUAGE, selected_lang);
editor.putString(CommonString.KEY_CULTURE_ID, culture_id);
editor.putString(CommonString.KEY_NOTICE_BOARD_LINK, notice_url);
editor.commit();
- Intent startDownload = new Intent(getApplicationContext(), MainActivity.class);
+ Intent startDownload = new Intent(context, MainActivity.class);
startActivity(startDownload);
finish();
}
@@ -106,7 +106,7 @@ public class SettingsActivity extends AppCompatActivity implements SelectLanguag
if (id == android.R.id.home) {
- Intent startDownload = new Intent(getApplicationContext(), MainActivity.class);
+ Intent startDownload = new Intent(context, MainActivity.class);
startActivity(startDownload);
finish();
@@ -124,7 +124,7 @@ public class SettingsActivity extends AppCompatActivity implements SelectLanguag
@Override
public void onBackPressed() {
//super.onBackPressed();
- Intent startDownload = new Intent(getApplicationContext(), MainActivity.class);
+ Intent startDownload = new Intent(context, MainActivity.class);
startActivity(startDownload);
finish();
@@ -135,7 +135,7 @@ public class SettingsActivity extends AppCompatActivity implements SelectLanguag
@Override
protected void onResume() {
super.onResume();
- CommonFunctions.updateLangResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context,preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(R.string.title_activity_settings);
}
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/StockActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/StockActivity.java
index 0087d4e..c075335 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/StockActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/StockActivity.java
@@ -42,7 +42,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityStockFacingGetterSett
public class StockActivity extends AppCompatActivity implements DialogCallbackListener {
GSKOrangeDB db;
-
+ private Context context;
String categoryName, categoryId, storeId, Error_Message = "";
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, country_id, store_flag_str;
boolean isDialogOpen = true;
@@ -70,9 +70,9 @@ public class StockActivity extends AppCompatActivity implements DialogCallbackLi
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
-
+ context = this;
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null);
date = preferences.getString(CommonString.KEY_DATE, null);
@@ -174,7 +174,7 @@ public class StockActivity extends AppCompatActivity implements DialogCallbackLi
@Override
public void onScrollStateChanged(AbsListView arg0, int arg1) {
- InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
+ InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -197,7 +197,7 @@ public class StockActivity extends AppCompatActivity implements DialogCallbackLi
expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
@Override
public void onGroupExpand(int groupPosition) {
- InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
+ InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (getWindow().getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -210,7 +210,7 @@ public class StockActivity extends AppCompatActivity implements DialogCallbackLi
expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
@Override
public void onGroupCollapse(int groupPosition) {
- InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
+ InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (getWindow().getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/StockDataActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/StockDataActivity.java
index 8283b61..4736cf2 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/StockDataActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/StockDataActivity.java
@@ -54,7 +54,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityStockFacingGetterSett
public class StockDataActivity extends AppCompatActivity implements DialogCallbackListener {
GSKOrangeDB db;
-
+ private Context context;
String categoryName, categoryId, storeId, Error_Message = "";
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, country_id, store_flag_str;
boolean isDialogOpen = true;
@@ -83,9 +83,9 @@ public class StockDataActivity extends AppCompatActivity implements DialogCallba
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
-
+ context = this;
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null);
date = preferences.getString(CommonString.KEY_DATE, null);
@@ -184,7 +184,7 @@ public class StockDataActivity extends AppCompatActivity implements DialogCallba
@Override
public void onScrollStateChanged(AbsListView arg0, int arg1) {
- InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
+ InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -207,7 +207,7 @@ public class StockDataActivity extends AppCompatActivity implements DialogCallba
expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
@Override
public void onGroupExpand(int groupPosition) {
- InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
+ InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (getWindow().getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -220,7 +220,7 @@ public class StockDataActivity extends AppCompatActivity implements DialogCallba
expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
@Override
public void onGroupCollapse(int groupPosition) {
- InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
+ InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (getWindow().getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/StockPricingActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/StockPricingActivity.java
index fbab183..373daf9 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/StockPricingActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/StockPricingActivity.java
@@ -41,7 +41,7 @@ import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityStockFacingGetterSetter;
public class StockPricingActivity extends AppCompatActivity {
-
+ private Context context;
ExpandableListView expandableListView;
private SharedPreferences preferences;
@@ -71,10 +71,10 @@ public class StockPricingActivity extends AppCompatActivity {
db = new GSKOrangeDB(this);
db.open();
-
+ context = this;
//preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
store_flag_hide = preferences.getString(CommonString.KEY_STORE_FLAG_FACING_HIDE, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null);
@@ -158,7 +158,7 @@ public class StockPricingActivity extends AppCompatActivity {
@Override
public void onScrollStateChanged(AbsListView arg0, int arg1) {
- InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
+ InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -181,7 +181,7 @@ public class StockPricingActivity extends AppCompatActivity {
expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
@Override
public void onGroupExpand(int groupPosition) {
- InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
+ InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (getWindow().getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -194,7 +194,7 @@ public class StockPricingActivity extends AppCompatActivity {
expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
@Override
public void onGroupCollapse(int groupPosition) {
- InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
+ InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (getWindow().getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/StoreCheckoutImageActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/StoreCheckoutImageActivity.java
index 807d454..19c6244 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/StoreCheckoutImageActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/StoreCheckoutImageActivity.java
@@ -76,7 +76,7 @@ import cpm.com.gskmtorange.xmlHandlers.FailureXMLHandler;
*/
public class StoreCheckoutImageActivity extends AppCompatActivity implements View.OnClickListener,
GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
-
+ private Context context;
String gallery_package = "";
Uri outputFileUri;
@@ -105,9 +105,9 @@ public class StoreCheckoutImageActivity extends AppCompatActivity implements Vie
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_store_checkout_image);
-
+ context = this;
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
@@ -150,8 +150,8 @@ public class StoreCheckoutImageActivity extends AppCompatActivity implements Vie
}
if (Build.VERSION.SDK_INT >= 23 &&
- ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
- ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
+ ContextCompat.checkSelfPermission(context, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
+ ContextCompat.checkSelfPermission(context, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
return;
}
}
@@ -188,9 +188,9 @@ public class StoreCheckoutImageActivity extends AppCompatActivity implements Vie
switch (id) {
case R.id.img_cam_selfie:
- _pathforcheck = checkOutStore_id + "CHK_SI_" + visit_date.replace("/", "") + "_" + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ _pathforcheck = checkOutStore_id + "CHK_SI_" + visit_date.replace("/", "") + "_" + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck;
- intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext());
+ intime = CommonFunctions.getCurrentTimeWithLanguage(context);
startCameraActivity();
break;
@@ -225,7 +225,7 @@ public class StoreCheckoutImageActivity extends AppCompatActivity implements Vie
alert = builder.create();
alert.show();
} else {
- Toast.makeText(getApplicationContext(), getResources().getString(R.string.clickimage), Toast.LENGTH_SHORT).show();
+ Toast.makeText(context, getResources().getString(R.string.clickimage), Toast.LENGTH_SHORT).show();
}
break;
@@ -246,7 +246,7 @@ public class StoreCheckoutImageActivity extends AppCompatActivity implements Vie
Log.i("MakeMachine", "startCameraActivity()");
File file = new File(_path);
- outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file);
+ outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager();
@@ -366,7 +366,7 @@ public class StoreCheckoutImageActivity extends AppCompatActivity implements Vie
@Override
protected void onResume() {
super.onResume();
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(R.string.title_activity_store_checkout_image);
}
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/StoreListActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/StoreListActivity.java
index d03b03b..7eb6ec7 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/StoreListActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/StoreListActivity.java
@@ -226,12 +226,13 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
+
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
preferences = PreferenceManager.getDefaultSharedPreferences(this);
context = this;
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_flag_str = getIntent().getStringExtra(CommonString.KEY_STORE_FLAG);
@@ -254,16 +255,16 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
@Override
public void onClick(View view) {
- Intent in = new Intent(getApplicationContext(), DownloadActivity.class);
+ Intent in = new Intent(context, DownloadActivity.class);
startActivity(in);
finish();
}
});
- if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(getApplicationContext(),
+ if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(context,
android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
- ContextCompat.checkSelfPermission(getApplicationContext(),
+ ContextCompat.checkSelfPermission(context,
android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
return;
}
@@ -294,7 +295,7 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else {
- Toast.makeText(getApplicationContext(), getResources().getString(R.string.notsuppoted)
+ Toast.makeText(context, getResources().getString(R.string.notsuppoted)
, Toast.LENGTH_LONG)
.show();
finish();
@@ -345,7 +346,6 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
|| ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
if (mGoogleApiClient != null) {
LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);
- // Toast.makeText(getApplicationContext(), "startLocation - Lat" + lat + "Long" + lon, Toast.LENGTH_LONG).show();
}
}
@@ -382,7 +382,7 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
if (mLastLocation != null) {
lat = mLastLocation.getLatitude();
lon = mLastLocation.getLongitude();
- // Toast.makeText(getApplicationContext(), "onconnected lat-" + lat + " Long-" + lon, Toast.LENGTH_SHORT).show();
+
}
startLocationUpdates();
}
@@ -484,7 +484,7 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
}
checkgpsEnableDevice();
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
//toolbar.setTitle(getString(R.string.title_activity_store_list));
db.open();
if(store_flag_str.equals(CommonString.FROM_JCP)){
@@ -520,7 +520,7 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
StatusCompare ratingCompare = new StatusCompare();
Collections.sort(storelist, ratingCompare);
- adapter = new StoreListActivity.ValueAdapter(getApplicationContext(), storelist);
+ adapter = new StoreListActivity.ValueAdapter(context, storelist);
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
@@ -571,8 +571,7 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
}else if (id == R.id.iconMap) {
- //Intent in = new Intent(getApplicationContext(), StoreListMapActivity.class);
- Intent in = new Intent(getApplicationContext(), StoreListRouteActivity.class);
+ Intent in = new Intent(context, StoreListRouteActivity.class);
in.putExtra(CommonString.KEY_STORE_LIST, storelist);
startActivity(in);
}
@@ -877,7 +876,7 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
else {
String msg = getString(R.string.distance_from_the_store) + " " + distance + " meters";
- Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show();
+ Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
}
}
}
@@ -985,7 +984,7 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
viewHolder.imgview_navigation.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- Intent in = new Intent(getApplicationContext(), StoreRouteActivity.class);
+ Intent in = new Intent(context, StoreRouteActivity.class);
in.putExtra(CommonString.KEY_STORE_LIST,current);
startActivity(in);
}
@@ -1161,7 +1160,7 @@ public class StoreListActivity extends AppCompatActivity implements GoogleApiCli
else {
String msg = getString(R.string.distance_from_the_store) + " " + distance + " meters";
- Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show();
+ Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
}
}
}
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/StoreimageActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/StoreimageActivity.java
index b4b205d..262db76 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/StoreimageActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/StoreimageActivity.java
@@ -89,7 +89,7 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
String gallery_package = "";
Uri outputFileUri;
-
+ private Context context;
ImageView img_cam, img_clicked;
Button btn_save;
private Dialog dialog;
@@ -126,9 +126,9 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_storeimage);
-
+ context = this;
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
@@ -221,8 +221,8 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
}
if (Build.VERSION.SDK_INT >= 23 &&
- ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
- ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
+ ContextCompat.checkSelfPermission(context, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
+ ContextCompat.checkSelfPermission(context, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
return;
}
}
@@ -251,9 +251,7 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else {
- Toast.makeText(getApplicationContext(), getResources().getString(R.string.notsuppoted)
- , Toast.LENGTH_LONG)
- .show();
+ Toast.makeText(context, getResources().getString(R.string.notsuppoted), Toast.LENGTH_LONG).show();
finish();
}
return false;
@@ -480,11 +478,11 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
case R.id.img_cam_selfie:
- _pathforcheck = store_id + "SI_" + visit_date.replace("/", "") + "_" + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ _pathforcheck = store_id + "SI_" + visit_date.replace("/", "") + "_" + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
_path = CommonString.FILE_PATH + _pathforcheck;
- intime = CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext());
+ intime = CommonFunctions.getCurrentTimeWithLanguage(context);
startCameraActivity();
@@ -570,7 +568,7 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
alert.show();
} else {
- Toast.makeText(getApplicationContext(), getResources().getString(R.string.clickimage), Toast.LENGTH_SHORT).show();
+ Toast.makeText(context, getResources().getString(R.string.clickimage), Toast.LENGTH_SHORT).show();
}
break;
}
@@ -594,7 +592,7 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
//android.os.FileUriExposedException: file:///storage/emulated/0/.GSK_MT_ORANGE_IMAGES/15024SI_01022019_120426.jpg exposed beyond app through ClipData.Item.getUri()
//outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file);
- outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file);
+ outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager();
@@ -706,7 +704,7 @@ public class StoreimageActivity extends AppCompatActivity implements View.OnClic
@Override
protected void onResume() {
super.onResume();
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(R.string.title_activity_store_image);
// Resuming the periodic location updates
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/T2PComplianceActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/T2PComplianceActivity.java
index 1040da4..9a12138 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/T2PComplianceActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/T2PComplianceActivity.java
@@ -72,7 +72,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.SkuGetterSetter;
import cpm.com.gskmtorange.xmlGetterSetter.T2PGetterSetter;
public class T2PComplianceActivity extends AppCompatActivity {
-
+ private Context context;
String gallery_package = "";
Uri outputFileUri;
@@ -113,11 +113,11 @@ public class T2PComplianceActivity extends AppCompatActivity {
db = new GSKOrangeDB(T2PComplianceActivity.this);
db.open();
-
+ context = this;
//preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null);
@@ -231,7 +231,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
if (t2PGetterSetters.size() > 0) {
- rec_t2p.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
+ rec_t2p.setLayoutManager(new LinearLayoutManager(context));
t2PAdapter = new T2PAdapter(t2PGetterSetters);
rec_t2p.setAdapter(t2PAdapter);
@@ -254,7 +254,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
protected void onResume() {
super.onResume();
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
}
@@ -334,11 +334,6 @@ public class T2PComplianceActivity extends AppCompatActivity {
}
});
- //holder.tv_display.setTypeface(FontManager.getTypeface(getApplicationContext(),FontManager.FONTAWESOME));
-
- /* Typeface iconFont = FontManager.getTypeface(getApplicationContext(), FontManager.FONTAWESOME);
- FontManager.markAsIconContainer(findViewById(R.id.icons_container), iconFont);
-*/
holder.spinner.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
@@ -594,7 +589,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
public void onClick(View v) {
_pathforcheck = "T2P_Image_" + store_id + categoryId + "_" + mItem.getBrand_id() +
mItem.getDisplay_id() + visit_date.replace("/", "") + "_" +
- CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
child_position = position;
path = str + _pathforcheck;
@@ -623,7 +618,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
public void onClick(View v) {
_pathforcheck1 = "T2P_Image1_" + store_id + categoryId + "_" + mItem.getBrand_id() +
mItem.getDisplay_id() + visit_date.replace("/", "") + "_" +
- CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
child_position1 = position;
path = str + _pathforcheck1;
@@ -652,7 +647,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
public void onClick(View v) {
_pathforcheck2 = "T2P_Image2_" + store_id + categoryId + "_" + mItem.getBrand_id() +
mItem.getDisplay_id() + visit_date.replace("/", "") + "_" +
- CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
child_position2 = position;
path = str + _pathforcheck2;
@@ -840,7 +835,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
dialog.setContentView(R.layout.gaps_dialog_layout);
//pb = (ProgressBar) dialog.findViewById(R.id.progressBar1);
RecyclerView rec_gap_checklist = (RecyclerView) dialog.findViewById(R.id.rec_gap_checklist);
- rec_gap_checklist.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
+ rec_gap_checklist.setLayoutManager(new LinearLayoutManager(context));
GapsAdapter gapAdapter = new GapsAdapter(gapsChecklist);
rec_gap_checklist.setAdapter(gapAdapter);
@@ -898,7 +893,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
if (skuAddedList.size() > 0) {
- rec_sku.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
+ rec_sku.setLayoutManager(new LinearLayoutManager(context));
SkuAddedAdapter skuAdapter = new SkuAddedAdapter(skuAddedList);
rec_sku.setAdapter(skuAdapter);
@@ -924,7 +919,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
skuAddedList.add(sku);
- rec_sku.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
+ rec_sku.setLayoutManager(new LinearLayoutManager(context));
SkuAddedAdapter skuAdapter = new SkuAddedAdapter(skuAddedList);
rec_sku.setAdapter(skuAdapter);
@@ -1106,7 +1101,7 @@ public class T2PComplianceActivity extends AppCompatActivity {
Log.i("Stock & Facing ", "startCameraActivity()");
File file = new File(path);
- outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file);
+ outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager();
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/T2pBrand_Avaibility.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/T2pBrand_Avaibility.java
index 25302a8..0fa2584 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/T2pBrand_Avaibility.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/dailyentry/T2pBrand_Avaibility.java
@@ -47,6 +47,7 @@ import cpm.com.gskmtorange.constant.CommonString;
import cpm.com.gskmtorange.xmlGetterSetter.BrandMasterGetterSetter;
public class T2pBrand_Avaibility extends AppCompatActivity {
+ private Context context;
GSKOrangeDB db;
private SharedPreferences preferences;
String store_id, visit_date, username, intime, date, keyAccount_id, class_id, storeType_id, camera_allow;
@@ -67,7 +68,7 @@ public class T2pBrand_Avaibility extends AppCompatActivity {
spinner_brand = (Spinner) findViewById(R.id.spinner);
add = (Button) findViewById(R.id.button2);
recyclerView = (RecyclerView) findViewById(R.id.layout_recycle);
-
+ context = this;
db = new GSKOrangeDB(T2pBrand_Avaibility.this);
db.open();
@@ -75,7 +76,7 @@ public class T2pBrand_Avaibility extends AppCompatActivity {
//preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null);
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/download/DownloadActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/download/DownloadActivity.java
index f8a6727..9ff3198 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/download/DownloadActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/download/DownloadActivity.java
@@ -84,7 +84,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.TableBean;
import cpm.com.gskmtorange.xmlHandlers.XMLHandlers;
public class DownloadActivity extends AppCompatActivity {
-
+ private Context context;
Data data;
int eventType;
GSKOrangeDB db;
@@ -152,10 +152,10 @@ public class DownloadActivity extends AppCompatActivity {
setSupportActionBar(toolbar);
db = new GSKOrangeDB(this);
-
+ context = this;
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
userId = preferences.getString(CommonString.KEY_USERNAME, null);
culture_id = preferences.getString(CommonString.KEY_CULTURE_ID, "");
@@ -2078,7 +2078,7 @@ public class DownloadActivity extends AppCompatActivity {
super.onResume();
toolbar.setTitle(getString(R.string.main_menu_activity_name));
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
}
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/CategoryListActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/CategoryListActivity.java
index 1ea3d3e..24ad57f 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/CategoryListActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/CategoryListActivity.java
@@ -38,6 +38,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityStockFacingGetterSett
import cpm.com.gskmtorange.xmlGetterSetter.T2PGetterSetter;
public class CategoryListActivity extends AppCompatActivity {
+ private Context context;
RecyclerView recyclerView;
TextView txt_categoryName;
ArrayList categoryList;
@@ -53,8 +54,9 @@ public class CategoryListActivity extends AppCompatActivity {
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
db = new GSKOrangeDB(this);
db.open();
+ context = this;
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null);
date = preferences.getString(CommonString.KEY_DATE, null);
@@ -89,7 +91,7 @@ public class CategoryListActivity extends AppCompatActivity {
protected void onResume() {
super.onResume();
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
categoryList = new ArrayList<>();
@@ -351,7 +353,7 @@ public class CategoryListActivity extends AppCompatActivity {
adapter = new CategoryListAdapter(CategoryListActivity.this, categoryList);
recyclerView.setAdapter(adapter);
- recyclerView.setLayoutManager(new GridLayoutManager(getApplicationContext(), 2));
+ recyclerView.setLayoutManager(new GridLayoutManager(context, 2));
updateStatus();
}
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/CategoryWisePerformanceActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/CategoryWisePerformanceActivity.java
index f9c437e..201474e 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/CategoryWisePerformanceActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/CategoryWisePerformanceActivity.java
@@ -38,6 +38,7 @@ public class CategoryWisePerformanceActivity extends AppCompatActivity {
RecyclerView recyclerView,recyclerView_sos;
LinearLayout lay_sos;
Toolbar toolbar;
+ private Context context;
String categoryName = "", categoryId;
ArrayList categoryWisePerformanceList;
ArrayList store_category_wiseGetterSetters;
@@ -62,10 +63,10 @@ public class CategoryWisePerformanceActivity extends AppCompatActivity {
db = new GSKOrangeDB(this);
db.open();
-
+ context = this;
//preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context,preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null);
date = preferences.getString(CommonString.KEY_DATE, null);
@@ -108,7 +109,7 @@ public class CategoryWisePerformanceActivity extends AppCompatActivity {
protected void onResume() {
super.onResume();
try {
- CommonFunctions.updateLangResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context,preferences.getString(CommonString.KEY_LANGUAGE, ""));
if(store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
categoryWisePerformanceList = db.getCategoryWisePerformance(store_id, categoryId, CommonString.TABLE_STORE_PERFORMANCE_NEW_ADHOC);
}
@@ -122,11 +123,11 @@ public class CategoryWisePerformanceActivity extends AppCompatActivity {
}
adapter = new CategoryWisePerformaceAdapter(CategoryWisePerformanceActivity.this, categoryWisePerformanceList);
recyclerView.setAdapter(adapter);
- recyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
+ recyclerView.setLayoutManager(new LinearLayoutManager(context));
sos_adapter = new CategoryWiseSosPerformaceAdapter(CategoryWisePerformanceActivity.this, store_category_wiseGetterSetters);
recyclerView_sos.setAdapter(sos_adapter);
- recyclerView_sos.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
+ recyclerView_sos.setLayoutManager(new LinearLayoutManager(context));
} catch (Exception e) {
e.printStackTrace();
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/DailyDataMenuActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/DailyDataMenuActivity.java
index 16837e3..55fddf9 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/DailyDataMenuActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/DailyDataMenuActivity.java
@@ -55,6 +55,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
ArrayList categoryList;
DailyDataMenuAdapter adapter;
TextView txt_categoryName;
+ private Context context;
GSKOrangeDB db;
String categoryName = "", categoryId;
@@ -76,11 +77,11 @@ public class DailyDataMenuActivity extends AppCompatActivity {
db = new GSKOrangeDB(this);
db.open();
-
+ context = this;
//preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null);
@@ -121,7 +122,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
protected void onResume() {
super.onResume();
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
try {
categoryList = new ArrayList<>();
@@ -428,7 +429,7 @@ public class DailyDataMenuActivity extends AppCompatActivity {
adapter = new DailyDataMenuAdapter(DailyDataMenuActivity.this, categoryList);
recyclerView.setAdapter(adapter);
- recyclerView.setLayoutManager(new GridLayoutManager(getApplicationContext(), 2));
+ recyclerView.setLayoutManager(new GridLayoutManager(context, 2));
} catch (Resources.NotFoundException e) {
e.printStackTrace();
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/MSL_AvailabilityActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/MSL_AvailabilityActivity.java
index 62bb7ea..59cba25 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/MSL_AvailabilityActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/MSL_AvailabilityActivity.java
@@ -48,7 +48,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.MSL_AvailabilityGetterSetter;
public class MSL_AvailabilityActivity extends AppCompatActivity {
ExpandableListView expandableListView;
TextView txt_mslAvailabilityName;
-
+ private Context context;
ArrayList headerDataList;
ArrayList childDataList;
List hashMapListHeaderData;
@@ -75,11 +75,11 @@ public class MSL_AvailabilityActivity extends AppCompatActivity {
db = new GSKOrangeDB(this);
db.open();
-
+ context = this;
//preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null);
date = preferences.getString(CommonString.KEY_DATE, null);
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/MSL_Availability_StockFacingActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/MSL_Availability_StockFacingActivity.java
index 20c80e1..c5e8799 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/MSL_Availability_StockFacingActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/MSL_Availability_StockFacingActivity.java
@@ -70,6 +70,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.StockFacing_PlanogramTrackerDataGette
public class MSL_Availability_StockFacingActivity extends AppCompatActivity implements DialogCallbackListener {
ExpandableListView expandableListView;
+ private Context context;
TextView txt_mslAvailabilityName;
ArrayList headerDataList;
ArrayList childDataList;
@@ -122,11 +123,11 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity impl
db = new GSKOrangeDB(this);
db.open();
-
+ context = this;
//preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
store_flag_hide = preferences.getString(CommonString.KEY_STORE_FLAG_FACING_HIDE, null);
@@ -210,7 +211,7 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity impl
@Override
public void onScrollStateChanged(AbsListView arg0, int arg1) {
- InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
+ InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -233,7 +234,7 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity impl
expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
@Override
public void onGroupExpand(int groupPosition) {
- InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
+ InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (getWindow().getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -246,7 +247,7 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity impl
expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
@Override
public void onGroupCollapse(int groupPosition) {
- InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
+ InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (getWindow().getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -428,7 +429,7 @@ public class MSL_Availability_StockFacingActivity extends AppCompatActivity impl
@Override
protected void onResume() {
super.onResume();
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
}
private void prepareList() {
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/PromoComplianceActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/PromoComplianceActivity.java
index 7b159c9..1107de0 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/PromoComplianceActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/PromoComplianceActivity.java
@@ -61,6 +61,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.SelectGetterSetter;
public class PromoComplianceActivity extends AppCompatActivity {
LinearLayout lin_promo_sku, lin_addtional_promo;
View view_promo_sku, view_additional_promo;
+ private Context context;
Spinner sp_promo;
Spinner toggle_add_InStock, toggle_add_promoAnnouncer;
ToggleButton toggle_add_runningPos;
@@ -98,7 +99,7 @@ public class PromoComplianceActivity extends AppCompatActivity {
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
-
+ context = this;
lin_promo_sku = (LinearLayout) findViewById(R.id.lin_promo_sku);
lin_addtional_promo = (LinearLayout) findViewById(R.id.lin_addtional_promo);
view_promo_sku = findViewById(R.id.view_promo_sku);
@@ -132,7 +133,7 @@ public class PromoComplianceActivity extends AppCompatActivity {
//preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null);
date = preferences.getString(CommonString.KEY_DATE, null);
@@ -183,7 +184,7 @@ public class PromoComplianceActivity extends AppCompatActivity {
public void onClick(View v) {
_pathforcheck = "AddPromo_Image_" + store_id + categoryId + "_"
+ visit_date.replace("/", "") + "_" +
- CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
path = str + _pathforcheck;
startCameraActivity(2);
@@ -333,7 +334,7 @@ public class PromoComplianceActivity extends AppCompatActivity {
img_addPromotion.setBackgroundResource(R.mipmap.camera_grey);
Snackbar.make(v, getResources().getString(R.string.promo_add), Snackbar.LENGTH_LONG).setAction("Action", null).show();
- //Toast.makeText(getApplicationContext(), "promo is add", Toast.LENGTH_LONG).show();
+
}
})
.setNegativeButton(getResources().getString(R.string.no), new DialogInterface.OnClickListener() {
@@ -446,7 +447,7 @@ public class PromoComplianceActivity extends AppCompatActivity {
@Override
protected void onResume() {
super.onResume();
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
}
private void prepareList() {
@@ -597,7 +598,7 @@ public class PromoComplianceActivity extends AppCompatActivity {
public void onClick(View v) {
_pathforcheck = "Promo_Image_" + store_id + categoryId + "_" + data.getSku_id() +
data.getPromo_id() + visit_date.replace("/", "") + "_" +
- CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
//child_position = position;
child_position = finalI;
path = str + _pathforcheck;
@@ -985,7 +986,7 @@ public class PromoComplianceActivity extends AppCompatActivity {
Log.i("Stock & Facing ", "startCameraActivity()");
File file = new File(path);
- outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file);
+ outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager();
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/StockFacing_PlanogramTrackerActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/StockFacing_PlanogramTrackerActivity.java
index cf33918..2311e72 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/StockFacing_PlanogramTrackerActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/StockFacing_PlanogramTrackerActivity.java
@@ -61,6 +61,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.Stock_FacingGetterSetter;
public class StockFacing_PlanogramTrackerActivity extends AppCompatActivity
{
+ private Context context;
Button btn_addShelf, btn_addSKU;
ExpandableListView expandableListView;
String brand, brand_id, company_id, sub_category, sub_category_id;
@@ -100,9 +101,9 @@ public class StockFacing_PlanogramTrackerActivity extends AppCompatActivity
db = new GSKOrangeDB(this);
db.open();
-
+ context = this;
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null);
@@ -301,7 +302,7 @@ public class StockFacing_PlanogramTrackerActivity extends AppCompatActivity
@Override
public void onScrollStateChanged(AbsListView arg0, int arg1) {
- InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
+ InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -876,6 +877,6 @@ public class StockFacing_PlanogramTrackerActivity extends AppCompatActivity
@Override
protected void onResume() {
super.onResume();
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
}
}
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/Stock_FacingActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/Stock_FacingActivity.java
index ed82f0f..962a268 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/Stock_FacingActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/Stock_FacingActivity.java
@@ -81,6 +81,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.Store_wise_camera_DataGetterSetter;
import static android.R.attr.angle;
public class Stock_FacingActivity extends AppCompatActivity {
+ private Context context;
static int child_position = -1;
ExpandableListView expandableListView;
TextView txt_stockFacingName;
@@ -120,7 +121,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
db = new GSKOrangeDB(this);
db.open();
-
+ context = this;
expandableListView = (ExpandableListView) findViewById(R.id.expandableListView);
//txt_stockFacingName = (TextView) findViewById(R.id.txt_stockFacingName);
camera1 = (ImageView) findViewById(R.id.img_camera1);
@@ -136,7 +137,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
//preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null);
date = preferences.getString(CommonString.KEY_DATE, null);
@@ -191,7 +192,6 @@ public class Stock_FacingActivity extends AppCompatActivity {
} else {
db.InsertStock_Facing(store_id, categoryId, hashMapListHeaderData, hashMapListChildData);
Snackbar.make(view, getResources().getString(R.string.save_message), Snackbar.LENGTH_LONG).setAction("Action", null).show();
- //Toast.makeText(getApplicationContext(), "Data has been saved", Toast.LENGTH_LONG).show();
}
finish();
@@ -219,7 +219,6 @@ public class Stock_FacingActivity extends AppCompatActivity {
} else {
db.InsertStock_Facing(store_id, categoryId, hashMapListHeaderData, hashMapListChildData);
Snackbar.make(view, getResources().getString(R.string.save_message), Snackbar.LENGTH_LONG).setAction("Action", null).show();
- //Toast.makeText(getApplicationContext(), "Data has been saved", Toast.LENGTH_LONG).show();
}
finish();
@@ -266,7 +265,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
@Override
public void onScrollStateChanged(AbsListView arg0, int arg1) {
- InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
+ InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -289,7 +288,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
@Override
public void onGroupExpand(int groupPosition) {
- InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
+ InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (getWindow().getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -310,7 +309,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
expandableListView.setOnGroupCollapseListener(new ExpandableListView.OnGroupCollapseListener() {
@Override
public void onGroupCollapse(int groupPosition) {
- InputMethodManager inputManager = (InputMethodManager) getApplicationContext()
+ InputMethodManager inputManager = (InputMethodManager) context
.getSystemService(Context.INPUT_METHOD_SERVICE);
if (getWindow().getCurrentFocus() != null) {
inputManager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);
@@ -731,7 +730,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
try {
Log.e("MakeMachine", "startCameraActivity()");
File file = new File(path);
- outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file);
+ outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager();
@@ -818,7 +817,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
try {
Log.e("MakeMachine", "startCameraActivity()");
File file = new File(path);
- outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file);
+ outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager();
@@ -902,7 +901,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
try {
Log.e("MakeMachine", "startCameraActivity()");
File file = new File(path);
- outputFileUri = FileProvider.getUriForFile(getApplicationContext(), "cpm.com.gskmtorange.fileprovider", file);
+ outputFileUri = FileProvider.getUriForFile(context, "cpm.com.gskmtorange.fileprovider", file);
String defaultCameraPackage = "";
final PackageManager packageManager = getPackageManager();
@@ -1298,7 +1297,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
@Override
protected void onResume() {
super.onResume();
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
}
public class ExpandableListAdapter extends BaseExpandableListAdapter {
@@ -1380,7 +1379,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
//String tempDate = new Date().toLocaleString().toString().replace(' ', '_').replace(',', '_').replace(':', '-');
_pathforcheck = "Stock_Cam1_" + store_id + "_" + headerTitle.getBrand_id()
- + "_" + visit_date.replace("/", "") + "_" + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ + "_" + visit_date.replace("/", "") + "_" + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
child_position = groupPosition;
path = str + _pathforcheck;
@@ -1409,7 +1408,7 @@ public class Stock_FacingActivity extends AppCompatActivity {
//String tempDate = new Date().toLocaleString().toString().replace(' ', '_').replace(',', '_').replace(':', '-');
_pathforcheck = "Stock_Cam2_" + store_id + "_" + headerTitle.getBrand_id()
- + "_" + visit_date.replace("/", "") + "_" + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext()).replace(":", "") + ".jpg";
+ + "_" + visit_date.replace("/", "") + "_" + CommonFunctions.getCurrentTimeWithLanguage(context).replace(":", "") + ".jpg";
child_position = groupPosition;
path = str + _pathforcheck;
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/StoreWisePerformanceActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/StoreWisePerformanceActivity.java
index 4a67d62..2095a50 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/StoreWisePerformanceActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/gsk_dailyentry/StoreWisePerformanceActivity.java
@@ -40,6 +40,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.StoreWisePerformaceGetterSetter;
public class StoreWisePerformanceActivity extends AppCompatActivity {
RecyclerView recyclerView;
Toolbar toolbar;
+ private Context context;
ArrayList storeWisePerformanceList;
StoreWisePerformaceAdapter adapter;
@@ -59,11 +60,11 @@ public class StoreWisePerformanceActivity extends AppCompatActivity {
recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
db = new GSKOrangeDB(this);
- db.open();
-
+ db.open();
+ context = this;
//preference data
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context,preferences.getString(CommonString.KEY_LANGUAGE, ""));
store_id = preferences.getString(CommonString.KEY_STORE_ID, null);
visit_date = preferences.getString(CommonString.KEY_DATE, null);
date = preferences.getString(CommonString.KEY_DATE, null);
@@ -133,7 +134,7 @@ public class StoreWisePerformanceActivity extends AppCompatActivity {
protected void onResume() {
super.onResume();
try {
- CommonFunctions.updateLangResources(getApplicationContext(),preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context,preferences.getString(CommonString.KEY_LANGUAGE, ""));
if(store_flag_str.equalsIgnoreCase(CommonString.FROM_DEVIATION)) {
storeWisePerformanceList = db.getStoreWisePerformance(store_id, CommonString.TABLE_STORE_PERFORMANCE_NEW_ADHOC);
@@ -146,7 +147,7 @@ public class StoreWisePerformanceActivity extends AppCompatActivity {
adapter = new StoreWisePerformaceAdapter(StoreWisePerformanceActivity.this, storeWisePerformanceList);
recyclerView.setAdapter(adapter);
- recyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
+ recyclerView.setLayoutManager(new LinearLayoutManager(context));
} catch (Exception e) {
e.printStackTrace();
}
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/password/MPinActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/password/MPinActivity.java
index 691ff94..6174ba0 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/password/MPinActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/password/MPinActivity.java
@@ -90,7 +90,7 @@ import cpm.com.gskmtorange.xmlHandlers.XMLHandlers;
public class MPinActivity extends AppCompatActivity implements
View.OnClickListener,
BlurLockView.OnPasswordInputListener,
- BlurLockView.OnLeftButtonClickListener,GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener {
+ BlurLockView.OnLeftButtonClickListener, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener {
BlurLockView blurLockView;
ImageView imageView1;
@@ -101,13 +101,13 @@ public class MPinActivity extends AppCompatActivity implements
private SharedPreferences.Editor editor = null;
private Dialog dialog;
-
+
String userId, password, app_ver;
int eventType;
LoginGetterSetter lgs = null;
FirebaseAnalytics mFirebaseAnalytics;
static int counter = 1;
- // Trace myTrace;
+ // Trace myTrace;
private int versionCode;
private static final int MY_PERMISSIONS_REQUEST_CAMERA = 10;
@@ -141,9 +141,9 @@ public class MPinActivity extends AppCompatActivity implements
setSupportActionBar(toolbar);*/
// Obtain the FirebaseAnalytics instance.
- // mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
- // myTrace = FirebasePerformance.getInstance().newTrace("test_trace");
- // myTrace.start();
+ // mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
+ // myTrace = FirebasePerformance.getInstance().newTrace("test_trace");
+ // myTrace.start();
IS_PASSWORD_CHECK = getIntent().getBooleanExtra(CommonString.IS_PASSWORD_CHECK, false);
@@ -182,7 +182,6 @@ public class MPinActivity extends AppCompatActivity implements
blurLockView.setIs_Password_Check_Mode(IS_PASSWORD_CHECK);
-
blurLockView.setRightButton(getString(R.string.clear));
blurLockView.setTypeface(getTypeface());
blurLockView.setOnLeftButtonClickListener(this);
@@ -281,7 +280,8 @@ public class MPinActivity extends AppCompatActivity implements
editor.commit();
finish();
- Intent in = new Intent(getApplicationContext(), LoginActivity.class);
+
+ Intent in = new Intent(context , LoginActivity.class);
startActivity(in);
}
@@ -352,7 +352,7 @@ public class MPinActivity extends AppCompatActivity implements
editor.commit();
finish();
- Intent in = new Intent(getApplicationContext(), LoginActivity.class);
+ Intent in = new Intent(context, LoginActivity.class);
startActivity(in);
}
@@ -366,14 +366,13 @@ public class MPinActivity extends AppCompatActivity implements
editor.commit();
- Intent in = new Intent(getApplicationContext(), MainActivity.class);
- //Intent in = new Intent(getApplicationContext(), OneQADActivity.class);
+ Intent in = new Intent(context, MainActivity.class);
startActivity(in);
finish();
} else {
- Toast.makeText(getApplicationContext(), "Please fill four digit MPin", Toast.LENGTH_SHORT).show();
+ Toast.makeText(context, "Please fill four digit MPin", Toast.LENGTH_SHORT).show();
}
}
@@ -589,12 +588,11 @@ public class MPinActivity extends AppCompatActivity implements
try {
- versionCode = getPackageManager().getPackageInfo(
- getPackageName(), 0).versionCode;
-
+ versionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
+
String userauth_xml = "[DATA]" + "[USER_DATA][USER_ID]"
+ userId + "[/USER_ID]" + "[PASSWORD]" + password
- + "[/PASSWORD]" + "[IN_TIME]" + CommonFunctions.getCurrentTimeWithLanguage(getApplicationContext())
+ + "[/PASSWORD]" + "[IN_TIME]" + CommonFunctions.getCurrentTimeWithLanguage(context)
+ "[/IN_TIME]" + "[LATITUDE]" + lat
+ "[/LATITUDE]" + "[LONGITUDE]" + lon
+ "[/LONGITUDE]" + "[APP_VERSION]" + app_ver
@@ -602,28 +600,19 @@ public class MPinActivity extends AppCompatActivity implements
+ "[NETWORK_STATUS]" + "LoginStatus"
+ "[/NETWORK_STATUS]" + "[/USER_DATA][/DATA]";
- SoapObject request = new SoapObject(CommonString.NAMESPACE,
- CommonString.METHOD_LOGIN);
+ SoapObject request = new SoapObject(CommonString.NAMESPACE, CommonString.METHOD_LOGIN);
request.addProperty("onXML", userauth_xml);
- SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
- SoapEnvelope.VER11);
+ SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
- HttpTransportSE androidHttpTransport = new HttpTransportSE(
- CommonString.URL);
-
- androidHttpTransport.call(CommonString.SOAP_ACTION_LOGIN,
- envelope);
-
+ HttpTransportSE androidHttpTransport = new HttpTransportSE(CommonString.URL);
+ androidHttpTransport.call(CommonString.SOAP_ACTION_LOGIN, envelope);
Object result = (Object) envelope.getResponse();
- if (result.toString()
- .equalsIgnoreCase(CommonString.KEY_FAILURE)) {
-
+ if (result.toString().equalsIgnoreCase(CommonString.KEY_FAILURE)) {
runOnUiThread(new Runnable() {
-
@Override
public void run() {
@@ -631,8 +620,7 @@ public class MPinActivity extends AppCompatActivity implements
}
});
- } else if (result.toString().equalsIgnoreCase(
- CommonString.KEY_FALSE)) {
+ } else if (result.toString().equalsIgnoreCase(CommonString.KEY_FALSE)) {
runOnUiThread(new Runnable() {
@@ -643,8 +631,7 @@ public class MPinActivity extends AppCompatActivity implements
}
});
- } else if (result.toString().equalsIgnoreCase(
- CommonString.KEY_CHANGED)) {
+ } else if (result.toString().equalsIgnoreCase(CommonString.KEY_CHANGED)) {
runOnUiThread(new Runnable() {
@@ -657,19 +644,16 @@ public class MPinActivity extends AppCompatActivity implements
} else {
- XmlPullParserFactory factory = XmlPullParserFactory
- .newInstance();
+ XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
factory.setNamespaceAware(true);
XmlPullParser xpp = factory.newPullParser();
xpp.setInput(new StringReader(result.toString()));
xpp.next();
eventType = xpp.getEventType();
- final FailureGetterSetter failureGetterSetter = XMLHandlers
- .failureXMLHandler(xpp, eventType);
+ final FailureGetterSetter failureGetterSetter = XMLHandlers.failureXMLHandler(xpp, eventType);
- if (failureGetterSetter.getStatus().equalsIgnoreCase(
- CommonString.KEY_FAILURE)) {
+ if (failureGetterSetter.getStatus().equalsIgnoreCase(CommonString.KEY_FAILURE)) {
/* final AlertMessage message = new AlertMessage(
MPinActivity.this, CommonString.METHOD_LOGIN
+ failureGetterSetter.getErrorMsg(),
@@ -679,8 +663,7 @@ public class MPinActivity extends AppCompatActivity implements
@Override
public void run() {
// TODO Auto-generated method stub
- showAlert(CommonString.METHOD_LOGIN
- + failureGetterSetter.getErrorMsg());
+ showAlert(CommonString.METHOD_LOGIN + failureGetterSetter.getErrorMsg());
}
});
} else {
@@ -703,15 +686,11 @@ public class MPinActivity extends AppCompatActivity implements
editor.putString(CommonString.KEY_USERNAME, userId);
editor.putString(CommonString.KEY_PASSWORD, password);
editor.putString(CommonString.KEY_VERSION, lgs.getAPP_VERSION());
-
editor.putString(CommonString.KEY_PATH, lgs.getAPP_PATH());
-
editor.putString(CommonString.KEY_DATE, lgs.getCURRENTDATE());
//editor.putString(CommonString.KEY_DATE, "01/25/2019");
editor.putString(CommonString.KEY_COUNTRY_ID, lgs.getCOUNTRY_ID());
-
editor.commit();
-
setDataFromSharedPreferences(lgs);
Bundle bundle = new Bundle();
@@ -719,9 +698,9 @@ public class MPinActivity extends AppCompatActivity implements
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, CommonString.KEY_LOGIN_DATA);
bundle.putString(FirebaseAnalytics.Param.CONTENT_TYPE, "Data");
bundle.putString(CommonString.KEY_LANGUAGE, preferences.getString(CommonString.KEY_LANGUAGE, ""));
- // mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
+ // mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SELECT_CONTENT, bundle);
- // Crashlytics.setUserIdentifier(userId);
+ // Crashlytics.setUserIdentifier(userId);
return CommonString.KEY_SUCCESS;
@@ -770,7 +749,7 @@ public class MPinActivity extends AppCompatActivity implements
"acra_login", e);*/
//Crashlytics.log(7, CommonString.MESSAGE_EXCEPTION, e.toString());
//Crashlytics.logException(e.getCause());
- // Crashlytics.logException(new Exception("My custom login Exception"));
+ // Crashlytics.logException(new Exception("My custom login Exception"));
runOnUiThread(new Runnable() {
@Override
@@ -789,14 +768,14 @@ public class MPinActivity extends AppCompatActivity implements
super.onPostExecute(result);
//Stop performance trace
- // myTrace.stop();
+ // myTrace.stop();
if (result.equals(CommonString.KEY_SUCCESS)) {
//set true for South Africa
boolean forSA = false;
- if(forSA){
+ if (forSA) {
//For SA Only
if (preferences.getString(CommonString.KEY_LANGUAGE, "").equals("")) {
@@ -811,7 +790,7 @@ public class MPinActivity extends AppCompatActivity implements
setLanguageDataFromSharedPreferences();
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
Intent intent = new Intent(getBaseContext(),
MainActivity.class);
@@ -821,8 +800,7 @@ public class MPinActivity extends AppCompatActivity implements
//uploadPreviousImages();
}
- }
- else {
+ } else {
//for other than SA
//database.open();
if (preferences.getString(CommonString.KEY_VERSION, "").equals(
@@ -830,7 +808,7 @@ public class MPinActivity extends AppCompatActivity implements
setLanguageDataFromSharedPreferences();
- Intent in = new Intent(getApplicationContext(), MainActivity.class);
+ Intent in = new Intent(context, MainActivity.class);
in.putExtra(CommonString.IS_PASSWORD_CHECK, false);
startActivity(in);
finish();
@@ -858,13 +836,14 @@ public class MPinActivity extends AppCompatActivity implements
LoginGetterSetter login_data;
- private void setLanguageDataFromSharedPreferences(){
+ private void setLanguageDataFromSharedPreferences() {
Gson gson = new Gson();
login_data = new LoginGetterSetter();
String jsonPreferences = preferences.getString(CommonString.KEY_LOOGIN_PREF, "");
- Type type = new TypeToken() {}.getType();
+ Type type = new TypeToken() {
+ }.getType();
login_data = gson.fromJson(jsonPreferences, type);
language = login_data.getCULTURE_NAME();
@@ -873,9 +852,9 @@ public class MPinActivity extends AppCompatActivity implements
String lang = preferences.getString(CommonString.KEY_LANGUAGE, "");
- if(language.size()>0){
- for(int i=0; i 0) {
+ for (int i = 0; i < language.size(); i++) {
+ if (lang.equals(language.get(i))) {
editor.putString(CommonString.KEY_LANGUAGE, language.get(i));
editor.putString(CommonString.KEY_CULTURE_ID, culture_id.get(i));
editor.putString(CommonString.KEY_NOTICE_BOARD_LINK, notice_url.get(i));
@@ -934,13 +913,11 @@ public class MPinActivity extends AppCompatActivity implements
Gson gson = new Gson();
String jsonCurProduct = gson.toJson(lgs);
- //SharedPreferences sharedPref = getApplicationContext().getSharedPreferences(CommonString.KEY_LOOGIN_PREF, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
-
editor.putString(CommonString.KEY_LOOGIN_PREF, jsonCurProduct);
editor.commit();
}
-
+
//permission and location related
void checkAppPermission(String permission, int requestCode) {
@@ -989,9 +966,9 @@ public class MPinActivity extends AppCompatActivity implements
file_planogram.mkdir();
}
- if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(getApplicationContext(),
+ if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(context,
android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
- ContextCompat.checkSelfPermission(getApplicationContext(),
+ ContextCompat.checkSelfPermission(context,
android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
return;
}
@@ -1059,9 +1036,9 @@ public class MPinActivity extends AppCompatActivity implements
*/
- if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(getApplicationContext(),
+ if (Build.VERSION.SDK_INT >= 23 && ContextCompat.checkSelfPermission(context,
Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
- ContextCompat.checkSelfPermission(getApplicationContext(),
+ ContextCompat.checkSelfPermission(context,
Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
return;
}
@@ -1092,7 +1069,7 @@ public class MPinActivity extends AppCompatActivity implements
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else {
- Toast.makeText(getApplicationContext(), getResources().getString(R.string.notsuppoted)
+ Toast.makeText(context, getResources().getString(R.string.notsuppoted)
, Toast.LENGTH_LONG)
.show();
finish();
@@ -1144,7 +1121,6 @@ public class MPinActivity extends AppCompatActivity implements
|| ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
if (mGoogleApiClient != null) {
LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);
- // Toast.makeText(getApplicationContext(), "startLocation - Lat" + lat + "Long" + lon, Toast.LENGTH_LONG).show();
}
}
@@ -1181,7 +1157,6 @@ public class MPinActivity extends AppCompatActivity implements
if (mLastLocation != null) {
lat = mLastLocation.getLatitude();
lon = mLastLocation.getLongitude();
- // Toast.makeText(getApplicationContext(), "onconnected lat-" + lat + " Long-" + lon, Toast.LENGTH_SHORT).show();
}
startLocationUpdates();
}
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/storeinmap/StoreRouteActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/storeinmap/StoreRouteActivity.java
index 865ff86..c4f980f 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/storeinmap/StoreRouteActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/storeinmap/StoreRouteActivity.java
@@ -1,6 +1,7 @@
package cpm.com.gskmtorange.storeinmap;
import android.Manifest;
+import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.Color;
@@ -57,7 +58,7 @@ import cpm.com.gskmtorange.R;
import cpm.com.gskmtorange.constant.CommonString;
public class StoreRouteActivity extends FragmentActivity implements OnMapReadyCallback, GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, LocationListener {
-
+ private Context context;
private GoogleMap mMap;
StoreBean store;
LatLng origin, destination;
@@ -78,6 +79,7 @@ public class StoreRouteActivity extends FragmentActivity implements OnMapReadyCa
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_store_route);
fab_cancel = (FloatingActionButton) findViewById(R.id.fab_cancel);
+ context = this;
fab_cancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -114,7 +116,7 @@ public class StoreRouteActivity extends FragmentActivity implements OnMapReadyCa
GooglePlayServicesUtil.getErrorDialog(resultCode, this,
PLAY_SERVICES_RESOLUTION_REQUEST).show();
} else {
- Toast.makeText(getApplicationContext(), getResources().getString(R.string.notsuppoted)
+ Toast.makeText(context, getResources().getString(R.string.notsuppoted)
, Toast.LENGTH_LONG)
.show();
finish();
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/upload/PreviousDataUploadActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/upload/PreviousDataUploadActivity.java
index 64e1987..ed8893e 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/upload/PreviousDataUploadActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/upload/PreviousDataUploadActivity.java
@@ -70,6 +70,7 @@ import cpm.com.gskmtorange.xmlGetterSetter.T2PGetterSetter;
import cpm.com.gskmtorange.xmlHandlers.FailureXMLHandler;
public class PreviousDataUploadActivity extends AppCompatActivity {
+ private Context context;
GSKOrangeDB db;
ArrayList coverageList;
@@ -118,7 +119,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
date = preferences.getString(CommonString.KEY_DATE, null);
userId = preferences.getString(CommonString.KEY_USERNAME, null);
@@ -126,7 +127,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
db = new GSKOrangeDB(this);
db.open();
-
+ context = this;
Path = CommonString.FILE_PATH;
//start upload
@@ -2174,7 +2175,7 @@ public class PreviousDataUploadActivity extends AppCompatActivity {
@Override
protected void onResume() {
super.onResume();
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
}
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/upload/UploadActivity.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/upload/UploadActivity.java
index c71b36c..baa80cc 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/upload/UploadActivity.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/upload/UploadActivity.java
@@ -87,7 +87,7 @@ import cpm.com.gskmtorange.xmlHandlers.FailureXMLHandler;
import retrofit.Retrofit;
public class UploadActivity extends AppCompatActivity {
-
+ private Context context;
GSKOrangeDB db;
ArrayList coverageList;
String date, userId, app_version;
@@ -136,12 +136,12 @@ public class UploadActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
toolbar = (Toolbar) findViewById(R.id.toolbar);
-
+ context = this;
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
preferences = PreferenceManager.getDefaultSharedPreferences(this);
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
date = preferences.getString(CommonString.KEY_DATE, null);
userId = preferences.getString(CommonString.KEY_USERNAME, null);
@@ -1871,7 +1871,7 @@ public class UploadActivity extends AppCompatActivity {
@Override
protected void onResume() {
super.onResume();
- CommonFunctions.updateLangResources(getApplicationContext(), preferences.getString(CommonString.KEY_LANGUAGE, ""));
+ CommonFunctions.updateLangResources(context, preferences.getString(CommonString.KEY_LANGUAGE, ""));
toolbar.setTitle(getString(R.string.title_activity_upload));
}
diff --git a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/upload/UploadImageWithRetrofit.java b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/upload/UploadImageWithRetrofit.java
index 724a259..6f706c5 100644
--- a/GSKMTOrange/src/main/java/cpm/com/gskmtorange/upload/UploadImageWithRetrofit.java
+++ b/GSKMTOrange/src/main/java/cpm/com/gskmtorange/upload/UploadImageWithRetrofit.java
@@ -334,6 +334,7 @@ public class UploadImageWithRetrofit {
return file2;
}
+
/*
public File saveBitmapToFileSmaller(File file) {
File file2 = file;
@@ -383,6 +384,7 @@ public class UploadImageWithRetrofit {
*/
+
public void showAlert(final Context context, String str, final boolean flag) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
diff --git a/build.gradle b/build.gradle
index d28f445..114d739 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,20 +1,22 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
+
repositories {
google()
jcenter()
+ maven {
+ url "https://jitpack.io"
+ }
+
}
dependencies {
- // classpath 'com.android.tools.build:gradle:3.5.0'
- classpath 'com.android.tools.build:gradle:4.0.2'
- classpath 'com.google.gms:google-services:4.3.4'
- // Add dependency
- // classpath 'io.fabric.tools:gradle:1.26.1'
+ classpath 'com.android.tools.build:gradle:4.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
- // classpath 'com.google.gms:google-services:4.2.0'
+ classpath 'com.google.gms:google-services:4.3.5'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
+
}
}
@@ -23,7 +25,7 @@ allprojects {
google()
jcenter()
maven {
- url 'https://maven.google.com/'
+ url "https://jitpack.io"
}
}
}
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index afc0812..6fb9631 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Thu Dec 03 19:56:06 IST 2020
+#Tue Mar 23 15:41:02 IST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
diff --git a/library/build.gradle b/library/build.gradle
index 42af1a2..ac873be 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -24,11 +24,11 @@ ext {
}
android {
- compileSdkVersion 28
+ compileSdkVersion 30
buildToolsVersion '28.0.3'
defaultConfig {
- minSdkVersion 14
- targetSdkVersion 26
+ minSdkVersion 20
+ targetSdkVersion 29
versionCode 1
versionName '1.0'
}
diff --git a/library/build/generated/source/buildConfig/debug/com/androidbuts/multispinnerfilter/BuildConfig.java b/library/build/generated/source/buildConfig/debug/com/androidbuts/multispinnerfilter/BuildConfig.java
deleted file mode 100644
index b142466..0000000
--- a/library/build/generated/source/buildConfig/debug/com/androidbuts/multispinnerfilter/BuildConfig.java
+++ /dev/null
@@ -1,12 +0,0 @@
-/**
- * Automatically generated file. DO NOT MODIFY
- */
-package com.androidbuts.multispinnerfilter;
-
-public final class BuildConfig {
- public static final boolean DEBUG = Boolean.parseBoolean("true");
- public static final String LIBRARY_PACKAGE_NAME = "com.androidbuts.multispinnerfilter";
- public static final String BUILD_TYPE = "debug";
- public static final int VERSION_CODE = 1;
- public static final String VERSION_NAME = "1.0";
-}