diff --git a/app/src/main/java/org/openimis/imispolicies/ClientAndroidInterface.java b/app/src/main/java/org/openimis/imispolicies/ClientAndroidInterface.java index 149d38aa..23831638 100644 --- a/app/src/main/java/org/openimis/imispolicies/ClientAndroidInterface.java +++ b/app/src/main/java/org/openimis/imispolicies/ClientAndroidInterface.java @@ -2384,7 +2384,7 @@ public void getLocalData() { ((Activity) mContext).runOnUiThread(new Runnable() { @Override public void run() { - ((MainActivity) mContext).openDialogFromPage(); + ((MainActivity) mContext).PickMasterDataFileDialogFromPage(); ((MainActivity) mContext).calledFrom = "htmlpage"; } }); @@ -4622,7 +4622,7 @@ public void run() { @JavascriptInterface public void popUpOfficerDialog() { - ((MainActivity) mContext).ShowDialogTex(); + ((MainActivity) mContext).ShowEnrolmentOfficerDialog(); } @JavascriptInterface @@ -4636,17 +4636,14 @@ public void run() { startDownloading(); finalPd.dismiss(); - ((Activity) mContext).runOnUiThread(new Runnable() { - @Override - public void run() { - ShowDialog(mContext.getResources().getString(R.string.DataDownloadedSuccess)); - Global global = Global.getGlobal(); - global.setOfficerCode(""); + ((Activity) mContext).runOnUiThread(() -> { + ShowDialog(mContext.getResources().getString(R.string.DataDownloadedSuccess)); + Global global = Global.getGlobal(); + global.setOfficerCode(""); // Intent refresh = new Intent(mContext, MainActivity.class); // ((MainActivity)mContext).startActivity(refresh); // ((MainActivity)mContext).finish(); - ((MainActivity) mContext).ShowDialogTex(); - } + ((MainActivity) mContext).ShowEnrolmentOfficerDialog(); }); } catch (JSONException e) { diff --git a/app/src/main/java/org/openimis/imispolicies/Global.java b/app/src/main/java/org/openimis/imispolicies/Global.java index f7cc42cc..b029139b 100644 --- a/app/src/main/java/org/openimis/imispolicies/Global.java +++ b/app/src/main/java/org/openimis/imispolicies/Global.java @@ -25,6 +25,7 @@ package org.openimis.imispolicies; +import android.Manifest; import android.app.Application; import android.content.Context; import android.content.SharedPreferences; @@ -32,6 +33,7 @@ import android.content.res.Resources; import android.net.ConnectivityManager; import android.net.NetworkInfo; +import android.os.Build; import android.os.Environment; import android.util.DisplayMetrics; import android.util.Log; @@ -64,6 +66,7 @@ public class Global extends Application { private String OfficerName; private int UserId; private int OfficerId; + private String[] permissions; private String ImageFolder; @@ -89,6 +92,13 @@ public void onCreate() { SubDirectories = new HashMap<>(); ProtectedDirectories = Arrays.asList("Authentications", "Database", "Images"); initSharedPrefsInts(); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + permissions = new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.VIBRATE, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.INTERNET, Manifest.permission.CAMERA, Manifest.permission.ACCESS_NETWORK_STATE, Manifest.permission.ACCESS_WIFI_STATE, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.CHANGE_WIFI_STATE, Manifest.permission.MANAGE_EXTERNAL_STORAGE}; + } else { + permissions = new String[]{Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.VIBRATE, Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.INTERNET, Manifest.permission.CAMERA, Manifest.permission.ACCESS_NETWORK_STATE, Manifest.permission.ACCESS_WIFI_STATE, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.CHANGE_WIFI_STATE}; + } + } private void initSharedPrefsInts() { @@ -178,6 +188,10 @@ public void setOfficerName(String officerName) { OfficerName = officerName; } + public String[] getPermissions() { + return permissions; + } + public boolean isNetworkAvailable() { ConnectivityManager cm = (ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo ni = cm.getActiveNetworkInfo(); diff --git a/app/src/main/java/org/openimis/imispolicies/MainActivity.java b/app/src/main/java/org/openimis/imispolicies/MainActivity.java index 9d344180..0edb6b0c 100644 --- a/app/src/main/java/org/openimis/imispolicies/MainActivity.java +++ b/app/src/main/java/org/openimis/imispolicies/MainActivity.java @@ -32,7 +32,6 @@ import android.app.ProgressDialog; import android.content.ActivityNotFoundException; import android.content.Context; -import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; @@ -41,6 +40,7 @@ import android.os.Build; import android.os.Bundle; import android.os.Environment; +import android.support.annotation.NonNull; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v4.app.ActivityCompat; @@ -80,10 +80,12 @@ import static android.provider.Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION; - public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { + private static final int REQUEST_ALL_FILES_ACCESS_CODE = 7; + private static final int REQUEST_PERMISSIONS_CODE = 1; + private static final int REQUEST_PICK_MD_FILE = 4; private static final String PREFS_NAME = "CMPref"; private NavigationView navigationView; @@ -107,7 +109,6 @@ public class MainActivity extends AppCompatActivity String calledFrom = "java"; public File f; public String etRarPassword = ""; - boolean isUserLogged = false; @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { @@ -118,22 +119,28 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) { wv.evaluateJavascript(String.format("selectImageCallback(\"%s\");", selectedImage), null); } else if (requestCode == ClientAndroidInterface.RESULT_SCAN && resultCode == RESULT_OK && data != null) { this.InsureeNumber = data.getStringExtra("SCAN_RESULT"); - } else if (requestCode == 4 && resultCode == RESULT_OK && data != null) { - Uri uri = data.getData(); - if (uri != null) { - try { - byte[] bytes = IOUtils.toByteArray(getContentResolver().openInputStream(uri)); - String path = global.getSubdirectory("Database"); - f = new File(path, "MasterData.rar"); - if (f.exists() || f.createNewFile()) - new FileOutputStream(f).write(bytes); - } catch (IOException e) { - e.printStackTrace(); + } else if (requestCode == REQUEST_PICK_MD_FILE) { + if (resultCode == RESULT_OK && data != null) { + Uri uri = data.getData(); + if (uri != null) { + try { + byte[] bytes = IOUtils.toByteArray(getContentResolver().openInputStream(uri)); + String path = global.getSubdirectory("Database"); + f = new File(path, "MasterData.rar"); + if (f.exists() || f.createNewFile()) + new FileOutputStream(f).write(bytes); + } catch (IOException e) { + e.printStackTrace(); + } + ShowDialogTex2(); } - ShowDialogTex2(); + } else { + finish(); + } + } else if (requestCode == REQUEST_ALL_FILES_ACCESS_CODE) { + if (checkRequirements()) { + onAllRequirementsMet(); } - } else if (requestCode == 4 && resultCode == 0) { - finish(); } else { //if user cancels ClientAndroidInterface.inProgress = false; @@ -142,6 +149,13 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) { } } + @Override + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { + if (checkRequirements()) { + onAllRequirementsMet(); + } + } + @SuppressLint({"AddJavascriptInterface", "SetJavaScriptEnabled"}) @Override protected void onCreate(Bundle savedInstanceState) { @@ -151,20 +165,14 @@ protected void onCreate(Bundle savedInstanceState) { selectedLanguage = spHF.getString("Language", "en"); changeLanguage(selectedLanguage, false); super.onCreate(savedInstanceState); - //Request for camera permission// - //By Herman 20/2/2018 - requestPermision(); - setContentView(R.layout.activity_main); - sqlHandler = new SQLHandler(this); - sqlHandler.isPrivate = true; //Set the Image folder path - global.setImageFolder(getApplicationContext().getApplicationInfo().dataDir + "/Images/"); + global.setImageFolder(global.getApplicationInfo().dataDir + "/Images/"); CreateFolders(); //Check if database exists - File database = getApplicationContext().getDatabasePath(SQLHandler.DBNAME); + File database = global.getDatabasePath(SQLHandler.DBNAME); if (!database.exists()) { sqlHandler.getReadableDatabase(); if (copyDatabase(this)) { @@ -248,11 +256,10 @@ public void onReceivedTitle(WebView view, String title) { SetLoggedIn(getResources().getString(R.string.Login), getResources().getString(R.string.Logout)); navigationView.setCheckedItem(R.id.nav_home); - if (TextUtils.isEmpty(global.getOfficerCode())) { - //Edited By HERMAN - ShowDialogTex(); + + if (checkRequirements()) { + onAllRequirementsMet(); } - global.isSDCardAvailable(); setVisibilityOfPaymentMenu(); } @@ -260,7 +267,8 @@ public void onReceivedTitle(WebView view, String title) { private void setVisibilityOfPaymentMenu() { navigationView = findViewById(R.id.nav_view); MenuItem navPayment = navigationView.getMenu().findItem(R.id.nav_payment); - navPayment.setVisible(AppInformation.MenuInfo.getShowPaymentNumberMenu()); + navPayment.setVisible(AppInformation.MenuInfo.getShowPaymentNumberMenu() + || AppInformation.MenuInfo.getShowBulkCNMenu()); } @Override @@ -308,7 +316,7 @@ private void loadLanguages() { } } - public void openDialog() { + public void PickMasterDataFileDialog() { new AlertDialog.Builder(MainActivity.this) .setTitle(getResources().getString(R.string.NoInternetTitle)) .setMessage(getResources().getString(R.string.DoImport)) @@ -319,7 +327,7 @@ public void openDialog() { intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("*/*"); try { - startActivityForResult(intent, 4); + startActivityForResult(intent, REQUEST_PICK_MD_FILE); } catch (ActivityNotFoundException e) { Toast.makeText(getApplicationContext(), getResources().getString(R.string.NoFileExporerInstalled), Toast.LENGTH_SHORT).show(); } @@ -330,72 +338,49 @@ public void openDialog() { }).show(); } - public void openDialogFromPage() { + public void PickMasterDataFileDialogFromPage() { AlertDialog.Builder alertDialog2 = new AlertDialog.Builder( MainActivity.this); -// Setting Dialog Title alertDialog2.setTitle(getResources().getString(R.string.NoInternetTitle)); alertDialog2.setMessage(getResources().getString(R.string.DoImport)); -// Setting Icon to Dialog - // alertDialog2.setIcon(R.drawable.delete); - -// Setting Positive "Yes" Btn alertDialog2.setPositiveButton(getResources().getString(R.string.Yes), - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - - Intent intent = new Intent(Intent.ACTION_GET_CONTENT); - intent.addCategory(Intent.CATEGORY_OPENABLE); - intent.setType("*/*"); - try { - startActivityForResult(intent, 4); - } catch (ActivityNotFoundException e) { - Toast.makeText(getApplicationContext(), getResources().getString(R.string.NoFileExporerInstalled), Toast.LENGTH_SHORT).show(); - } - // Write your code here to execute after dialog + (dialog, which) -> { + + Intent intent = new Intent(Intent.ACTION_GET_CONTENT); + intent.addCategory(Intent.CATEGORY_OPENABLE); + intent.setType("*/*"); + try { + startActivityForResult(intent, REQUEST_PICK_MD_FILE); + } catch (ActivityNotFoundException e) { + Toast.makeText(getApplicationContext(), getResources().getString(R.string.NoFileExporerInstalled), Toast.LENGTH_SHORT).show(); } + // Write your code here to execute after dialog }).setNegativeButton(getResources().getString(R.string.No), - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - dialog.cancel(); - } - }); + (dialog, id) -> dialog.cancel()); -// Showing Alert Dialog alertDialog2.show(); } - public void ConfirmDialog(String filename) { + public void ConfirmMasterDataDialog(String filename) { AlertDialog.Builder alertDialog2 = new AlertDialog.Builder( MainActivity.this); -// Setting Dialog Title alertDialog2.setTitle(getResources().getString(R.string.LoadFile)); alertDialog2.setMessage(filename); alertDialog2.setCancelable(false); -// Setting Icon to Dialog - // alertDialog2.setIcon(R.drawable.delete); - -// Setting Positive "Yes" Btn alertDialog2.setPositiveButton(getResources().getString(R.string.Ok), - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - MasterDataLocalAsync masterDataLocalAsync = new MasterDataLocalAsync(); - masterDataLocalAsync.execute(); - // Write your code here to execute after dialog - } + (dialog, which) -> { + MasterDataLocalAsync masterDataLocalAsync = new MasterDataLocalAsync(); + masterDataLocalAsync.execute(); }).setNegativeButton(getResources().getString(R.string.Quit), - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - dialog.cancel(); - finish(); - } + (dialog, id) -> { + dialog.cancel(); + finish(); }); -// Showing Alert Dialog alertDialog2.show(); } @@ -403,34 +388,21 @@ public void ConfirmDialogPage(String filename) { AlertDialog.Builder alertDialog2 = new AlertDialog.Builder( MainActivity.this); -// Setting Dialog Title alertDialog2.setTitle(getResources().getString(R.string.LoadFile)); alertDialog2.setMessage(filename); alertDialog2.setCancelable(false); -// Setting Icon to Dialog - // alertDialog2.setIcon(R.drawable.delete); - -// Setting Positive "Yes" Btn alertDialog2.setPositiveButton(getResources().getString(R.string.Ok), - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - MasterDataLocalAsync masterDataLocalAsync = new MasterDataLocalAsync(); - masterDataLocalAsync.execute(); - // Write your code here to execute after dialog - } + (dialog, which) -> { + MasterDataLocalAsync masterDataLocalAsync = new MasterDataLocalAsync(); + masterDataLocalAsync.execute(); }).setNegativeButton(getResources().getString(R.string.Quit), - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - dialog.cancel(); - } - }); + (dialog, id) -> dialog.cancel()); -// Showing Alert Dialog alertDialog2.show(); } - public void ShowDialogTex() { + public void ShowEnrolmentOfficerDialog() { final ClientAndroidInterface ca = new ClientAndroidInterface(context); final int MasterData = ca.isMasterDataAvailable(); @@ -453,10 +425,6 @@ public void ShowDialogTex() { userInput.setVisibility(View.GONE); } - - // set dialog message - final String result = ""; - int positiveButton, negativeButton; if (MasterData > 0) { positiveButton = R.string.Ok; @@ -470,50 +438,64 @@ public void ShowDialogTex() { alertDialogBuilder .setCancelable(false) .setPositiveButton(getResources().getString(positiveButton), - new DialogInterface.OnClickListener() { - - public void onClick(DialogInterface dialog, int id) { - try { - if (MasterData > 0) { - if (ca.isOfficerCodeValid(userInput.getText().toString())) { - global.setOfficerCode(userInput.getText().toString()); - OfficerName.setText(global.getOfficerName()); + (dialog, id) -> { + try { + if (MasterData > 0) { + if (ca.isOfficerCodeValid(userInput.getText().toString())) { + global.setOfficerCode(userInput.getText().toString()); + OfficerName.setText(global.getOfficerName()); // if(_General.isNetworkAvailable(MainActivity.this)){ // ca.getOfficerVillages(userInput.getText().toString()); // } - } else { - ShowDialogTex(); - ca.ShowDialog(getResources().getString(R.string.IncorrectOfficerCode)); - } } else { - if (!global.isNetworkAvailable()) { - openDialog(); - } else { - MasterDataAsync masterDataAsync = new MasterDataAsync(); - masterDataAsync.execute(); - - } - //ca.downloadMasterData(); - //ShowDialogTex(); + ShowEnrolmentOfficerDialog(); + ca.ShowDialog(getResources().getString(R.string.IncorrectOfficerCode)); + } + } else { + if (!global.isNetworkAvailable()) { + PickMasterDataFileDialog(); + } else { + MasterDataAsync masterDataAsync = new MasterDataAsync(); + masterDataAsync.execute(); + } - } catch (JSONException e) { - e.printStackTrace(); + //ca.downloadMasterData(); + //ShowDialogTex(); } + } catch (JSONException e) { + e.printStackTrace(); } }) .setNegativeButton(getResources().getString(negativeButton), - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - dialog.cancel(); - finish(); - } + (dialog, id) -> { + dialog.cancel(); + finish(); }); - // create alert dialog - alertDialog = alertDialogBuilder.create(); + alertDialog = alertDialogBuilder.show(); + } - // show it - alertDialog.show(); + public void ShowMasterDataDialog() { + new AlertDialog.Builder(context) + .setTitle(R.string.MasterData) + .setMessage(R.string.MasterDataNotFound) + .setCancelable(false) + .setPositiveButton(R.string.Yes, + (dialog, id) -> { + if (!global.isNetworkAvailable()) { + PickMasterDataFileDialog(); + } else { + MasterDataAsync masterDataAsync = new MasterDataAsync(); + masterDataAsync.execute(); + + } + }) + .setNegativeButton(R.string.ForceClose, + (dialog, id) -> { + dialog.cancel(); + finish(); + }) + .show(); } @@ -535,30 +517,24 @@ public void ShowDialogTex2() { alertDialogBuilder .setCancelable(false) .setPositiveButton(getResources().getString(R.string.Yes), - new DialogInterface.OnClickListener() { - - public void onClick(DialogInterface dialog, int id) { - try { - etRarPassword = userInput.getText().toString(); - getMasterDataText2(f.getPath(), etRarPassword); + (dialog, id) -> { + try { + etRarPassword = userInput.getText().toString(); + getMasterDataText2(f.getPath(), etRarPassword); - if (calledFrom == "java") { - ConfirmDialog((f.getName()).toString()); - } else { - ConfirmDialogPage((f.getName()).toString()); - } - } catch (Exception e) { - e.getMessage(); + if (calledFrom == "java") { + ConfirmMasterDataDialog((f.getName())); + } else { + ConfirmDialogPage((f.getName())); } + } catch (Exception e) { + e.getMessage(); } - }) .setNegativeButton(getResources().getString(R.string.No), - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - dialog.cancel(); - finish(); - } + (dialog, id) -> { + dialog.cancel(); + finish(); }); // create alert dialog @@ -805,7 +781,6 @@ protected Void doInBackground(Void... voids) { @Override protected void onPostExecute(Void aVoid) { pd.dismiss(); - ShowDialogTex(); Intent refresh = new Intent(MainActivity.this, MainActivity.class); startActivity(refresh); @@ -819,7 +794,6 @@ public class MasterDataLocalAsync extends AsyncTask { @Override protected void onPreExecute() { - pd = ProgressDialog.show(context, context.getResources().getString(R.string.Sync), context.getResources().getString(R.string.DownloadingMasterData)); } @@ -838,7 +812,6 @@ protected Void doInBackground(Void... voids) { @Override protected void onPostExecute(Void aVoid) { pd.dismiss(); - ShowDialogTex(); Intent refresh = new Intent(MainActivity.this, MainActivity.class); startActivity(refresh); @@ -892,31 +865,12 @@ protected void onStop() { // } // } - //Ask for permission - public void requestPermision() { - int PERMISSION_ALL = 1; - String[] PERMISSIONS = {Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.VIBRATE, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.INTERNET, Manifest.permission.CAMERA, Manifest.permission.ACCESS_NETWORK_STATE, Manifest.permission.ACCESS_WIFI_STATE, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.CHANGE_WIFI_STATE}; - if (!hasPermissions(this, PERMISSIONS)) { - ActivityCompat.requestPermissions(this, PERMISSIONS, PERMISSION_ALL); - } - - // Ask for "Manage External Storage" permission, required in Android 11 - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { - String[] Android11Permissions = {Manifest.permission.MANAGE_EXTERNAL_STORAGE}; - if (!hasPermissions(this, Android11Permissions)) { - ActivityCompat.requestPermissions(this, Android11Permissions, PERMISSION_ALL); - if (!Environment.isExternalStorageManager()) { - Intent intent = new Intent(ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION); - startActivity(intent); - } - } - } - } - public static boolean hasPermissions(Context context, String... permissions) { if (context != null && permissions != null) { for (String permission : permissions) { - if (ActivityCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED) { + if (ActivityCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED + && !permission.equals(Manifest.permission.MANAGE_EXTERNAL_STORAGE)) { + // MANAGE_EXTERNAL_STORAGE always report as denied by design return false; } } @@ -924,6 +878,71 @@ public static boolean hasPermissions(Context context, String... permissions) { return true; } + public void externalStorageAccessDialog() { + AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context) + .setTitle(R.string.ExternalStorageAccess) + .setMessage(getResources().getString(R.string.ExternalStorageAccessInfo, getResources().getString(R.string.app_name_policies))) + .setCancelable(false) + .setPositiveButton(R.string.Ok, + (dialog, id) -> { + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.R) { + Intent intent = new Intent(ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION); + startActivityForResult(intent, REQUEST_ALL_FILES_ACCESS_CODE); + } + }) + .setNegativeButton(R.string.ForceClose, + (dialog, id) -> { + dialog.cancel(); + finish(); + }); + + alertDialogBuilder.show(); + } + + public void PermissionsDialog() { + AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context) + .setTitle(R.string.Permissions) + .setMessage(getResources().getString(R.string.PermissionsInfo, getResources().getString(R.string.app_name_policies))) + .setCancelable(false) + .setPositiveButton(R.string.Ok, + (dialog, id) -> ActivityCompat.requestPermissions(this, global.getPermissions(), REQUEST_PERMISSIONS_CODE)) + .setNegativeButton(R.string.ForceClose, + (dialog, id) -> { + dialog.cancel(); + finish(); + }); + + alertDialogBuilder.show(); + } + + public boolean checkRequirements() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + if (!Environment.isExternalStorageManager()) { + externalStorageAccessDialog(); + return false; + } + } + + if (!hasPermissions(this, global.getPermissions())) { + PermissionsDialog(); + return false; + } + + if (ca.isMasterDataAvailable() < 1) { + ShowMasterDataDialog(); + return false; + } + + return true; + } + + public void onAllRequirementsMet() { + if (TextUtils.isEmpty(global.getOfficerCode())) { + ShowEnrolmentOfficerDialog(); + } + global.isSDCardAvailable(); + } + public String getSelectedLanguage() { return selectedLanguage; } diff --git a/app/src/main/java/org/openimis/imispolicies/PaymentOverview.java b/app/src/main/java/org/openimis/imispolicies/PaymentOverview.java index 3f6600ab..47eb606d 100644 --- a/app/src/main/java/org/openimis/imispolicies/PaymentOverview.java +++ b/app/src/main/java/org/openimis/imispolicies/PaymentOverview.java @@ -32,6 +32,9 @@ protected void onCreate(Bundle savedInstanceState) { CheckCommission = findViewById(R.id.CheckCommission); BulkControlNumber = findViewById(R.id.BulkControlNumber); + OverViewPolicies.setVisibility(AppInformation.MenuInfo.getShowPaymentNumberMenu() ? View.VISIBLE : View.GONE); + NotEnrolledPolicies.setVisibility(AppInformation.MenuInfo.getShowPaymentNumberMenu() ? View.VISIBLE : View.GONE); + OverViewControlNumber.setVisibility(AppInformation.MenuInfo.getShowPaymentNumberMenu() ? View.VISIBLE : View.GONE); BulkControlNumber.setVisibility(AppInformation.MenuInfo.getShowBulkCNMenu() ? View.VISIBLE : View.GONE); OverViewPolicies.setOnClickListener(view -> openPage(SearchOverViewPolicies.class)); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 30d24fda..d3ed0f0a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -422,4 +422,9 @@ No control numbers left for this product. Please fetch control numbers or provide control number from other source. Control Number : No control number assigned to this policy. Please fetch control numbers or provide control number from other source. + Master Data + External Storage Access + To work correctly, %1$s requires external storage access. Please allow it for %1$s in next screen in order to use the application. + Permissions + To work correctly, %1$s requires multiple permissions. Please allow them in next screen in order to use the application.