diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 36a1c064..32beaf54 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -75,6 +75,11 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/java/org/mian/gitnex/activities/BaseActivity.java b/app/src/main/java/org/mian/gitnex/activities/BaseActivity.java
index e1ccdc30..b08d9223 100644
--- a/app/src/main/java/org/mian/gitnex/activities/BaseActivity.java
+++ b/app/src/main/java/org/mian/gitnex/activities/BaseActivity.java
@@ -50,6 +50,9 @@ public abstract class BaseActivity extends AppCompatActivity {
setTheme(R.style.AppTheme);
}
+ String appLocale = tinyDb.getString("locale");
+ AppUtil.setAppLocale(getResources(), appLocale);
+
super.onCreate(savedInstanceState);
setContentView(getLayoutResourceId());
diff --git a/app/src/main/java/org/mian/gitnex/activities/MainActivity.java b/app/src/main/java/org/mian/gitnex/activities/MainActivity.java
index 71ba6e25..801b9930 100644
--- a/app/src/main/java/org/mian/gitnex/activities/MainActivity.java
+++ b/app/src/main/java/org/mian/gitnex/activities/MainActivity.java
@@ -97,9 +97,6 @@ public class MainActivity extends BaseActivity implements NavigationView.OnNavig
tinyDb.putInt("homeScreenId", 0);
}
- String appLocale = tinyDb.getString("locale");
- AppUtil.setAppLocale(getResources(), appLocale);
-
boolean connToInternet = AppUtil.haveNetworkConnection(getApplicationContext());
if(!tinyDb.getBoolean("loggedInMode")) {
diff --git a/app/src/main/java/org/mian/gitnex/activities/SettingsAppearanceActivity.java b/app/src/main/java/org/mian/gitnex/activities/SettingsAppearanceActivity.java
new file mode 100644
index 00000000..cd556524
--- /dev/null
+++ b/app/src/main/java/org/mian/gitnex/activities/SettingsAppearanceActivity.java
@@ -0,0 +1,327 @@
+package org.mian.gitnex.activities;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.Switch;
+import android.widget.TextView;
+import androidx.appcompat.app.AlertDialog;
+import org.mian.gitnex.R;
+import org.mian.gitnex.helpers.Toasty;
+import org.mian.gitnex.util.TinyDB;
+
+/**
+ * Author M M Arif
+ */
+
+public class SettingsAppearanceActivity extends BaseActivity {
+
+ private Context ctx;
+ private View.OnClickListener onClickListener;
+
+ private static String[] timeList = {"Pretty", "Normal"};
+ private static int timeSelectedChoice = 0;
+
+ private static String[] codeBlockList = {"Green - Black", "White - Black", "Grey - Black", "White - Grey", "Dark - White"};
+ private static int codeBlockSelectedChoice = 0;
+
+ private static String[] homeScreenList = {"My Repositories", "Starred Repositories", "Organizations", "Repositories", "Profile"};
+ private static int homeScreenSelectedChoice = 0;
+
+ private static String[] customFontList = {"Roboto", "Manrope", "Source Code Pro"};
+ private static int customFontSelectedChoice = 0;
+
+ private static String[] themeList = {"Dark", "Light", "Auto (Day/Night)"};
+ private static int themeSelectedChoice = 0;
+
+ @Override
+ protected int getLayoutResourceId() {
+
+ return R.layout.activity_settings_appearance;
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+
+ super.onCreate(savedInstanceState);
+ this.ctx = getApplicationContext();
+ final TinyDB tinyDb = new TinyDB(ctx);
+
+ ImageView closeActivity = findViewById(R.id.close);
+
+ final TextView tvDateTimeSelected = findViewById(R.id.tvDateTimeSelected); // setter for time
+ final TextView codeBlockSelected = findViewById(R.id.codeBlockSelected); // setter for code block
+ final TextView homeScreenSelected = findViewById(R.id.homeScreenSelected); // setter for home screen
+ final TextView customFontSelected = findViewById(R.id.customFontSelected); // setter for custom font
+ final TextView themeSelected = findViewById(R.id.themeSelected); // setter for theme
+
+ LinearLayout timeFrame = findViewById(R.id.timeFrame);
+ LinearLayout codeBlockFrame = findViewById(R.id.codeBlockFrame);
+ LinearLayout homeScreenFrame = findViewById(R.id.homeScreenFrame);
+ LinearLayout customFontFrame = findViewById(R.id.customFontFrame);
+ LinearLayout themeFrame = findViewById(R.id.themeSelectionFrame);
+
+ Switch counterBadgesSwitch = findViewById(R.id.switchCounterBadge);
+
+ initCloseListener();
+ closeActivity.setOnClickListener(onClickListener);
+
+ if(!tinyDb.getString("timeStr").isEmpty()) {
+ tvDateTimeSelected.setText(tinyDb.getString("timeStr"));
+ }
+
+ if(!tinyDb.getString("codeBlockStr").isEmpty()) {
+ codeBlockSelected.setText(tinyDb.getString("codeBlockStr"));
+ }
+
+ if(!tinyDb.getString("homeScreenStr").isEmpty()) {
+ homeScreenSelected.setText(tinyDb.getString("homeScreenStr"));
+ }
+
+ if(!tinyDb.getString("customFontStr").isEmpty()) {
+ customFontSelected.setText(tinyDb.getString("customFontStr"));
+ }
+
+ if(!tinyDb.getString("themeStr").isEmpty()) {
+ themeSelected.setText(tinyDb.getString("themeStr"));
+ }
+
+ if(timeSelectedChoice == 0) {
+ timeSelectedChoice = tinyDb.getInt("timeId");
+ }
+
+ if(codeBlockSelectedChoice == 0) {
+ codeBlockSelectedChoice = tinyDb.getInt("codeBlockId");
+ }
+
+ if(homeScreenSelectedChoice == 0) {
+ homeScreenSelectedChoice = tinyDb.getInt("homeScreenId");
+ }
+
+ if(customFontSelectedChoice == 0) {
+ customFontSelectedChoice = tinyDb.getInt("customFontId", 1);
+ }
+
+ if(themeSelectedChoice == 0) {
+ themeSelectedChoice = tinyDb.getInt("themeId");
+ }
+
+ if(tinyDb.getBoolean("enableCounterBadges")) {
+ counterBadgesSwitch.setChecked(true);
+ }
+ else {
+ counterBadgesSwitch.setChecked(false);
+ }
+
+ // counter badge switcher
+ counterBadgesSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
+
+ if (isChecked) {
+ tinyDb.putBoolean("enableCounterBadges", true);
+ Toasty.info(ctx, getResources().getString(R.string.settingsSave));
+ }
+ else {
+ tinyDb.putBoolean("enableCounterBadges", false);
+ Toasty.info(ctx, getResources().getString(R.string.settingsSave));
+ }
+
+ });
+
+ // theme selection dialog
+ themeFrame.setOnClickListener(view -> {
+
+ AlertDialog.Builder tsBuilder = new AlertDialog.Builder(SettingsAppearanceActivity.this);
+
+ tsBuilder.setTitle(getResources().getString(R.string.themeSelectorDialogTitle));
+ if(themeSelectedChoice != -1) {
+ tsBuilder.setCancelable(true);
+ }
+ else {
+ tsBuilder.setCancelable(false);
+ }
+
+ tsBuilder.setSingleChoiceItems(themeList, themeSelectedChoice, (dialogInterfaceTheme, i) -> {
+
+ themeSelectedChoice = i;
+ themeSelected.setText(themeList[i]);
+ tinyDb.putString("themeStr", themeList[i]);
+ tinyDb.putInt("themeId", i);
+
+ tinyDb.putBoolean("refreshParent", true);
+ this.recreate();
+ this.overridePendingTransition(0, 0);
+ dialogInterfaceTheme.dismiss();
+ Toasty.info(ctx, getResources().getString(R.string.settingsSave));
+
+ });
+
+ AlertDialog cfDialog = tsBuilder.create();
+ cfDialog.show();
+
+ });
+
+ // custom font dialog
+ customFontFrame.setOnClickListener(view -> {
+
+ AlertDialog.Builder cfBuilder = new AlertDialog.Builder(SettingsAppearanceActivity.this);
+
+ cfBuilder.setTitle(R.string.settingsCustomFontSelectorDialogTitle);
+ if(customFontSelectedChoice != -1) {
+ cfBuilder.setCancelable(true);
+ }
+ else {
+ cfBuilder.setCancelable(false);
+ }
+
+ cfBuilder.setSingleChoiceItems(customFontList, customFontSelectedChoice, (dialogInterfaceCustomFont, i) -> {
+
+ customFontSelectedChoice = i;
+ customFontSelected.setText(customFontList[i]);
+ tinyDb.putString("customFontStr", customFontList[i]);
+ tinyDb.putInt("customFontId", i);
+
+ tinyDb.putBoolean("refreshParent", true);
+ this.recreate();
+ this.overridePendingTransition(0, 0);
+ dialogInterfaceCustomFont.dismiss();
+ Toasty.info(ctx, ctx.getResources().getString(R.string.settingsSave));
+
+ });
+
+ AlertDialog cfDialog = cfBuilder.create();
+ cfDialog.show();
+
+ });
+
+ // home screen dialog
+ homeScreenFrame.setOnClickListener(view -> {
+
+ AlertDialog.Builder hsBuilder = new AlertDialog.Builder(SettingsAppearanceActivity.this);
+
+ hsBuilder.setTitle(R.string.settingshomeScreenSelectorDialogTitle);
+ if(homeScreenSelectedChoice != -1) {
+ hsBuilder.setCancelable(true);
+ }
+ else {
+ hsBuilder.setCancelable(false);
+ }
+
+ hsBuilder.setSingleChoiceItems(homeScreenList, homeScreenSelectedChoice, (dialogInterfaceHomeScreen, i) -> {
+
+ homeScreenSelectedChoice = i;
+ homeScreenSelected.setText(homeScreenList[i]);
+ tinyDb.putString("homeScreenStr", homeScreenList[i]);
+ tinyDb.putInt("homeScreenId", i);
+
+ dialogInterfaceHomeScreen.dismiss();
+ Toasty.info(ctx, getResources().getString(R.string.settingsSave));
+
+ });
+
+ AlertDialog hsDialog = hsBuilder.create();
+ hsDialog.show();
+
+ });
+
+ // code block dialog
+ codeBlockFrame.setOnClickListener(view -> {
+
+ AlertDialog.Builder cBuilder = new AlertDialog.Builder(SettingsAppearanceActivity.this);
+
+ cBuilder.setTitle(R.string.settingsCodeBlockSelectorDialogTitle);
+ if(codeBlockSelectedChoice != -1) {
+ cBuilder.setCancelable(true);
+ }
+ else {
+ cBuilder.setCancelable(false);
+ }
+
+ cBuilder.setSingleChoiceItems(codeBlockList, codeBlockSelectedChoice, (dialogInterfaceCodeBlock, i) -> {
+
+ codeBlockSelectedChoice = i;
+ codeBlockSelected.setText(codeBlockList[i]);
+ tinyDb.putString("codeBlockStr", codeBlockList[i]);
+ tinyDb.putInt("codeBlockId", i);
+
+ switch(codeBlockList[i]) {
+ case "White - Black":
+ tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.white));
+ tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.black));
+ break;
+ case "Grey - Black":
+ tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.colorAccent));
+ tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.black));
+ break;
+ case "White - Grey":
+ tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.white));
+ tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.colorAccent));
+ break;
+ case "Dark - White":
+ tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.colorPrimary));
+ tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.white));
+ break;
+ default:
+ tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.colorLightGreen));
+ tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.black));
+ break;
+ }
+
+ dialogInterfaceCodeBlock.dismiss();
+ Toasty.info(ctx, getResources().getString(R.string.settingsSave));
+
+ });
+
+ AlertDialog cDialog = cBuilder.create();
+ cDialog.show();
+
+ });
+
+ // time and date dialog
+ timeFrame.setOnClickListener(view -> {
+
+ AlertDialog.Builder tBuilder = new AlertDialog.Builder(SettingsAppearanceActivity.this);
+
+ tBuilder.setTitle(R.string.settingsTimeSelectorDialogTitle);
+ if(timeSelectedChoice != -1) {
+ tBuilder.setCancelable(true);
+ }
+ else {
+ tBuilder.setCancelable(false);
+ }
+
+ tBuilder.setSingleChoiceItems(timeList, timeSelectedChoice, (dialogInterfaceTime, i) -> {
+
+ timeSelectedChoice = i;
+ tvDateTimeSelected.setText(timeList[i]);
+ tinyDb.putString("timeStr", timeList[i]);
+ tinyDb.putInt("timeId", i);
+
+ if("Normal".equals(timeList[i])) {
+ tinyDb.putString("dateFormat", "normal");
+ }
+ else {
+ tinyDb.putString("dateFormat", "pretty");
+ }
+
+ dialogInterfaceTime.dismiss();
+ Toasty.info(ctx, getResources().getString(R.string.settingsSave));
+
+ });
+
+ AlertDialog tDialog = tBuilder.create();
+ tDialog.show();
+
+
+ });
+
+ }
+
+ private void initCloseListener() {
+ onClickListener = view -> {
+ finish();
+ };
+ }
+
+}
diff --git a/app/src/main/java/org/mian/gitnex/activities/SettingsFileViewerActivity.java b/app/src/main/java/org/mian/gitnex/activities/SettingsFileViewerActivity.java
new file mode 100644
index 00000000..6435871b
--- /dev/null
+++ b/app/src/main/java/org/mian/gitnex/activities/SettingsFileViewerActivity.java
@@ -0,0 +1,120 @@
+package org.mian.gitnex.activities;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.Switch;
+import android.widget.TextView;
+import androidx.appcompat.app.AlertDialog;
+import org.mian.gitnex.R;
+import org.mian.gitnex.helpers.Toasty;
+import org.mian.gitnex.util.TinyDB;
+
+/**
+ * Author M M Arif
+ */
+
+public class SettingsFileViewerActivity extends BaseActivity {
+
+ private Context ctx;
+ private View.OnClickListener onClickListener;
+
+ private static String[] fileveiwerSourceCodeThemesList = {"Sublime", "Arduino Light", "Github", "Far ", "Ir Black", "Android Studio"};
+ private static int fileveiwerSourceCodeThemesSelectedChoice = 0;
+
+ @Override
+ protected int getLayoutResourceId() {
+
+ return R.layout.activity_settings_fileview;
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+
+ super.onCreate(savedInstanceState);
+ this.ctx = getApplicationContext();
+ final TinyDB tinyDb = new TinyDB(ctx);
+
+ ImageView closeActivity = findViewById(R.id.close);
+
+ initCloseListener();
+ closeActivity.setOnClickListener(onClickListener);
+
+ final TextView fileveiwerSourceCodeThemesSelected = findViewById(R.id.sourceCodeThemeSelected); // setter for fileviewer theme
+
+ LinearLayout sourceCodeThemeFrame = findViewById(R.id.sourceCodeThemeFrame);
+
+ Switch pdfModeSwitch = findViewById(R.id.switchPdfMode);
+
+ if(!tinyDb.getString("fileviewerSourceCodeThemeStr").isEmpty()) {
+ fileveiwerSourceCodeThemesSelected.setText(tinyDb.getString("fileviewerSourceCodeThemeStr"));
+ }
+
+ if(fileveiwerSourceCodeThemesSelectedChoice == 0) {
+ fileveiwerSourceCodeThemesSelectedChoice = tinyDb.getInt("fileviewerThemeId");
+ }
+
+ if(tinyDb.getBoolean("enablePdfMode")) {
+ pdfModeSwitch.setChecked(true);
+ }
+ else {
+ pdfModeSwitch.setChecked(false);
+ }
+
+ // fileviewer srouce code theme selection dialog
+ sourceCodeThemeFrame.setOnClickListener(view -> {
+
+ AlertDialog.Builder fvtsBuilder = new AlertDialog.Builder(SettingsFileViewerActivity.this);
+
+ fvtsBuilder.setTitle(R.string.fileviewerSourceCodeThemeSelectorDialogTitle);
+ if(fileveiwerSourceCodeThemesSelectedChoice != -1) {
+ fvtsBuilder.setCancelable(true);
+ }
+ else {
+ fvtsBuilder.setCancelable(false);
+ }
+
+ fvtsBuilder.setSingleChoiceItems(fileveiwerSourceCodeThemesList, fileveiwerSourceCodeThemesSelectedChoice, (dialogInterfaceTheme, i) -> {
+
+ fileveiwerSourceCodeThemesSelectedChoice = i;
+ fileveiwerSourceCodeThemesSelected.setText(fileveiwerSourceCodeThemesList[i]);
+ tinyDb.putString("fileviewerSourceCodeThemeStr", fileveiwerSourceCodeThemesList[i]);
+ tinyDb.putInt("fileviewerSourceCodeThemeId", i);
+
+ dialogInterfaceTheme.dismiss();
+ Toasty.info(ctx, getResources().getString(R.string.settingsSave));
+
+ });
+
+ AlertDialog cfDialog = fvtsBuilder.create();
+ cfDialog.show();
+
+ });
+
+ // pdf night mode switcher
+ pdfModeSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
+
+ if(isChecked) {
+ tinyDb.putBoolean("enablePdfMode", true);
+ tinyDb.putString("enablePdfModeInit", "yes");
+ Toasty.info(ctx, getResources().getString(R.string.settingsSave));
+ }
+ else {
+ tinyDb.putBoolean("enablePdfMode", false);
+ tinyDb.putString("enablePdfModeInit", "yes");
+ Toasty.info(ctx, getResources().getString(R.string.settingsSave));
+ }
+
+ });
+
+ }
+
+ private void initCloseListener() {
+ onClickListener = view -> {
+ finish();
+ };
+ }
+
+}
diff --git a/app/src/main/java/org/mian/gitnex/activities/SettingsReportsActivity.java b/app/src/main/java/org/mian/gitnex/activities/SettingsReportsActivity.java
new file mode 100644
index 00000000..4d357f40
--- /dev/null
+++ b/app/src/main/java/org/mian/gitnex/activities/SettingsReportsActivity.java
@@ -0,0 +1,70 @@
+package org.mian.gitnex.activities;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.Switch;
+import org.mian.gitnex.R;
+import org.mian.gitnex.helpers.Toasty;
+import org.mian.gitnex.util.TinyDB;
+
+/**
+ * Author M M Arif
+ */
+
+public class SettingsReportsActivity extends BaseActivity {
+
+ private Context ctx;
+ private View.OnClickListener onClickListener;
+
+ @Override
+ protected int getLayoutResourceId() {
+
+ return R.layout.activity_settings_reporting;
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+
+ super.onCreate(savedInstanceState);
+ this.ctx = getApplicationContext();
+ TinyDB tinyDb = new TinyDB(ctx);
+
+ ImageView closeActivity = findViewById(R.id.close);
+
+ initCloseListener();
+ closeActivity.setOnClickListener(onClickListener);
+
+ Switch crashReportsSwitch = findViewById(R.id.crashReportsSwitch);
+
+ if(tinyDb.getBoolean("crashReportingEnabled")) {
+ crashReportsSwitch.setChecked(true);
+ }
+ else {
+ crashReportsSwitch.setChecked(false);
+ }
+
+ // crash reports switcher
+ crashReportsSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
+
+ if(isChecked) {
+ tinyDb.putBoolean("crashReportingEnabled", true);
+ Toasty.info(ctx, getResources().getString(R.string.settingsSave));
+ }
+ else {
+ tinyDb.putBoolean("crashReportingEnabled", false);
+ Toasty.info(ctx, getResources().getString(R.string.settingsSave));
+ }
+
+ });
+
+ }
+
+ private void initCloseListener() {
+ onClickListener = view -> {
+ finish();
+ };
+ }
+
+}
diff --git a/app/src/main/java/org/mian/gitnex/activities/SettingsSecurityActivity.java b/app/src/main/java/org/mian/gitnex/activities/SettingsSecurityActivity.java
new file mode 100644
index 00000000..4d45a2a8
--- /dev/null
+++ b/app/src/main/java/org/mian/gitnex/activities/SettingsSecurityActivity.java
@@ -0,0 +1,78 @@
+package org.mian.gitnex.activities;
+
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import androidx.appcompat.app.AlertDialog;
+import org.mian.gitnex.R;
+import org.mian.gitnex.helpers.ssl.MemorizingTrustManager;
+import org.mian.gitnex.util.TinyDB;
+
+/**
+ * Author M M Arif
+ */
+
+public class SettingsSecurityActivity extends BaseActivity {
+
+ private Context ctx;
+ private View.OnClickListener onClickListener;
+
+ @Override
+ protected int getLayoutResourceId() {
+
+ return R.layout.activity_settings_security;
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+
+ super.onCreate(savedInstanceState);
+ this.ctx = getApplicationContext();
+ TinyDB tinyDb = new TinyDB(ctx);
+
+ ImageView closeActivity = findViewById(R.id.close);
+
+ initCloseListener();
+ closeActivity.setOnClickListener(onClickListener);
+
+ LinearLayout certsFrame = findViewById(R.id.certsFrame);
+
+ // certs deletion
+ certsFrame.setOnClickListener(v1 -> {
+
+ AlertDialog.Builder builder = new AlertDialog.Builder(SettingsSecurityActivity.this);
+
+ builder.setTitle(getResources().getString(R.string.settingsCertsPopupTitle));
+ builder.setMessage(getResources().getString(R.string.settingsCertsPopupMessage));
+ builder.setPositiveButton(R.string.menuDeleteText, (dialog, which) -> {
+
+ ctx.getSharedPreferences(MemorizingTrustManager.KEYSTORE_NAME, Context.MODE_PRIVATE).edit().remove(MemorizingTrustManager.KEYSTORE_KEY).apply();
+
+ tinyDb.putBoolean("loggedInMode", false);
+ tinyDb.remove("basicAuthPassword");
+ tinyDb.putBoolean("basicAuthFlag", false);
+ //tinyDb.clear();
+
+ Intent loginActivityIntent = new Intent().setClass(ctx, LoginActivity.class);
+ loginActivityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ ctx.startActivity(loginActivityIntent);
+
+ });
+
+ builder.setNeutralButton(R.string.cancelButton, (dialog, which) -> dialog.dismiss());
+ builder.create().show();
+
+ });
+
+ }
+
+ private void initCloseListener() {
+ onClickListener = view -> {
+ finish();
+ };
+ }
+
+}
diff --git a/app/src/main/java/org/mian/gitnex/activities/SettingsTranslationActivity.java b/app/src/main/java/org/mian/gitnex/activities/SettingsTranslationActivity.java
new file mode 100644
index 00000000..9301175f
--- /dev/null
+++ b/app/src/main/java/org/mian/gitnex/activities/SettingsTranslationActivity.java
@@ -0,0 +1,164 @@
+package org.mian.gitnex.activities;
+
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import androidx.appcompat.app.AlertDialog;
+import org.mian.gitnex.R;
+import org.mian.gitnex.helpers.Toasty;
+import org.mian.gitnex.util.TinyDB;
+
+/**
+ * Author M M Arif
+ */
+
+public class SettingsTranslationActivity extends BaseActivity {
+
+ private Context ctx;
+ private View.OnClickListener onClickListener;
+
+ private static String[] langList = {"English", "Arabic", "Chinese", "Finnish", "French", "German", "Italian", "Latvian", "Persian", "Polish", "Portuguese/Brazilian", "Russian", "Serbian", "Spanish", "Turkish",
+ "Ukrainian"};
+ private static int langSelectedChoice = 0;
+
+ @Override
+ protected int getLayoutResourceId() {
+
+ return R.layout.activity_settings_translation;
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+
+ super.onCreate(savedInstanceState);
+ this.ctx = getApplicationContext();
+ TinyDB tinyDb = new TinyDB(ctx);
+
+ ImageView closeActivity = findViewById(R.id.close);
+
+ initCloseListener();
+ closeActivity.setOnClickListener(onClickListener);
+
+ final TextView tvLanguageSelected = findViewById(R.id.tvLanguageSelected); // setter for en, fr
+ TextView helpTranslate = findViewById(R.id.helpTranslate);
+
+ LinearLayout langFrame = findViewById(R.id.langFrame);
+
+ helpTranslate.setOnClickListener(v12 -> {
+
+ Intent intent = new Intent();
+ intent.setAction(Intent.ACTION_VIEW);
+ intent.addCategory(Intent.CATEGORY_BROWSABLE);
+ intent.setData(Uri.parse(getResources().getString(R.string.crowdInLink)));
+ startActivity(intent);
+
+ });
+
+ if(!tinyDb.getString("localeStr").isEmpty()) {
+ tvLanguageSelected.setText(tinyDb.getString("localeStr"));
+ }
+
+ if(langSelectedChoice == 0) {
+ langSelectedChoice = tinyDb.getInt("langId");
+ }
+
+ // language dialog
+ langFrame.setOnClickListener(view -> {
+
+ AlertDialog.Builder lBuilder = new AlertDialog.Builder(SettingsTranslationActivity.this);
+
+ lBuilder.setTitle(R.string.settingsLanguageSelectorDialogTitle);
+ if(langSelectedChoice != -1) {
+ lBuilder.setCancelable(true);
+ }
+ else {
+ lBuilder.setCancelable(false);
+ }
+
+ lBuilder.setSingleChoiceItems(langList, langSelectedChoice, (dialogInterface, i) -> {
+
+ langSelectedChoice = i;
+ tvLanguageSelected.setText(langList[i]);
+ tinyDb.putString("localeStr", langList[i]);
+ tinyDb.putInt("langId", i);
+
+ switch(langList[i]) {
+ case "Arabic":
+ tinyDb.putString("locale", "ar");
+ break;
+ case "Chinese":
+ tinyDb.putString("locale", "zh");
+ break;
+ case "Finnish":
+ tinyDb.putString("locale", "fi");
+ break;
+ case "French":
+ tinyDb.putString("locale", "fr");
+ break;
+ case "German":
+ tinyDb.putString("locale", "de");
+ break;
+ case "Italian":
+ tinyDb.putString("locale", "it");
+ break;
+ case "Latvian":
+ tinyDb.putString("locale", "lv");
+ break;
+ case "Persian":
+ tinyDb.putString("locale", "fa");
+ break;
+ case "Polish":
+ tinyDb.putString("locale", "pl");
+ break;
+ case "Portuguese/Brazilian":
+ tinyDb.putString("locale", "pt");
+ break;
+ case "Russian":
+ tinyDb.putString("locale", "ru");
+ break;
+ case "Serbian":
+ tinyDb.putString("locale", "sr");
+ break;
+ case "Spanish":
+ tinyDb.putString("locale", "es");
+ break;
+ case "Turkish":
+ tinyDb.putString("locale", "tr");
+ break;
+ case "Ukrainian":
+ tinyDb.putString("locale", "uk");
+ break;
+ default:
+ tinyDb.putString("locale", "en");
+ break;
+ }
+
+ tinyDb.putBoolean("refreshParent", true);
+ this.recreate();
+ this.overridePendingTransition(0, 0);
+ dialogInterface.dismiss();
+ Toasty.info(ctx, getResources().getString(R.string.settingsSave));
+
+ });
+
+ lBuilder.setNegativeButton(getString(R.string.cancelButton), (dialog, which) -> dialog.dismiss());
+
+ AlertDialog lDialog = lBuilder.create();
+ lDialog.show();
+
+ });
+
+ }
+
+ private void initCloseListener() {
+ onClickListener = view -> {
+ finish();
+ };
+ }
+
+}
diff --git a/app/src/main/java/org/mian/gitnex/fragments/SettingsFragment.java b/app/src/main/java/org/mian/gitnex/fragments/SettingsFragment.java
index db62d81e..1546680b 100644
--- a/app/src/main/java/org/mian/gitnex/fragments/SettingsFragment.java
+++ b/app/src/main/java/org/mian/gitnex/fragments/SettingsFragment.java
@@ -1,23 +1,20 @@
package org.mian.gitnex.fragments;
-import android.content.Context;
import android.content.Intent;
-import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
-import android.widget.Switch;
-import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.Fragment;
import org.mian.gitnex.R;
-import org.mian.gitnex.activities.MainActivity;
-import org.mian.gitnex.helpers.Toasty;
-import org.mian.gitnex.helpers.ssl.MemorizingTrustManager;
+import org.mian.gitnex.activities.SettingsAppearanceActivity;
+import org.mian.gitnex.activities.SettingsFileViewerActivity;
+import org.mian.gitnex.activities.SettingsReportsActivity;
+import org.mian.gitnex.activities.SettingsSecurityActivity;
+import org.mian.gitnex.activities.SettingsTranslationActivity;
import org.mian.gitnex.util.TinyDB;
import java.util.Objects;
@@ -27,518 +24,44 @@ import java.util.Objects;
public class SettingsFragment extends Fragment {
- private Context ctx = null;
-
- private static String[] langList = {"Arabic", "Chinese", "English", "Finnish", "French", "German", "Italian", "Latvian", "Persian", "Polish", "Portuguese/Brazilian", "Russian", "Serbian", "Spanish", "Turkish", "Ukrainian"};
- private static int langSelectedChoice = 0;
-
- private static String[] timeList = {"Pretty", "Normal"};
- private static int timeSelectedChoice = 0;
-
- private static String[] codeBlockList = {"Green - Black", "White - Black", "Grey - Black", "White - Grey", "Dark - White"};
- private static int codeBlockSelectedChoice = 0;
-
- private static String[] homeScreenList = {"My Repositories", "Starred Repositories", "Organizations", "Repositories", "Profile"};
- private static int homeScreenSelectedChoice = 0;
-
- private static String[] customFontList = {"Roboto", "Manrope", "Source Code Pro"};
- private static int customFontSelectedChoice = 0;
-
- private static String[] themeList = {"Dark", "Light", "Auto (Day/Night)"};
- private static int themeSelectedChoice = 0;
-
- private static String[] fileveiwerSourceCodeThemesList = {"Sublime", "Arduino Light", "Github", "Far ", "Ir Black", "Android Studio"};
- private static int fileveiwerSourceCodeThemesSelectedChoice = 0;
-
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_settings, container, false);
- final TinyDB tinyDb = new TinyDB(getContext());
- final TextView tvLanguageSelected = v.findViewById(R.id.tvLanguageSelected); // setter for en, fr
- final TextView tvDateTimeSelected = v.findViewById(R.id.tvDateTimeSelected); // setter for time
- final TextView codeBlockSelected = v.findViewById(R.id.codeBlockSelected); // setter for code block
- final TextView homeScreenSelected = v.findViewById(R.id.homeScreenSelected); // setter for home screen
- final TextView customFontSelected = v.findViewById(R.id.customFontSelected); // setter for custom font
- final TextView themeSelected = v.findViewById(R.id.themeSelected); // setter for theme
- final TextView fileveiwerSourceCodeThemesSelected = v.findViewById(R.id.sourceCodeThemeSelected); // setter for fileviewer theme
+ LinearLayout appreanceFrame = v.findViewById(R.id.appreanceFrame);
+ LinearLayout fileViewerFrame = v.findViewById(R.id.fileViewerFrame);
+ LinearLayout securityFrame = v.findViewById(R.id.securityFrame);
+ LinearLayout languagesFrame = v.findViewById(R.id.languagesFrame);
+ LinearLayout reportsFrame = v.findViewById(R.id.reportsFrame);
- LinearLayout langFrame = v.findViewById(R.id.langFrame);
- LinearLayout timeFrame = v.findViewById(R.id.timeFrame);
- LinearLayout codeBlockFrame = v.findViewById(R.id.codeBlockFrame);
- LinearLayout homeScreenFrame = v.findViewById(R.id.homeScreenFrame);
- LinearLayout customFontFrame = v.findViewById(R.id.customFontFrame);
- LinearLayout themeFrame = v.findViewById(R.id.themeSelectionFrame);
- LinearLayout certsFrame = v.findViewById(R.id.certsFrame);
- LinearLayout sourceCodeThemeFrame = v.findViewById(R.id.sourceCodeThemeFrame);
+ appreanceFrame.setOnClickListener(v1 -> startActivity(new Intent(getContext(), SettingsAppearanceActivity.class)));
- Switch counterBadgesSwitch = v.findViewById(R.id.switchCounterBadge);
- Switch pdfModeSwitch = v.findViewById(R.id.switchPdfMode);
- Switch crashReportsSwitch = v.findViewById(R.id.crashReportsSwitch);
- TextView helpTranslate = v.findViewById(R.id.helpTranslate);
+ fileViewerFrame.setOnClickListener(v1 -> startActivity(new Intent(getContext(), SettingsFileViewerActivity.class)));
- helpTranslate.setOnClickListener(v12 -> {
+ securityFrame.setOnClickListener(v1 -> startActivity(new Intent(getContext(), SettingsSecurityActivity.class)));
- Intent intent = new Intent();
- intent.setAction(Intent.ACTION_VIEW);
- intent.addCategory(Intent.CATEGORY_BROWSABLE);
- intent.setData(Uri.parse(getResources().getString(R.string.crowdInLink)));
- startActivity(intent);
+ languagesFrame.setOnClickListener(v1 -> startActivity(new Intent(getContext(), SettingsTranslationActivity.class)));
- });
-
- if(!tinyDb.getString("localeStr").isEmpty()) {
- tvLanguageSelected.setText(tinyDb.getString("localeStr"));
- }
-
- if(!tinyDb.getString("timeStr").isEmpty()) {
- tvDateTimeSelected.setText(tinyDb.getString("timeStr"));
- }
-
- if(!tinyDb.getString("codeBlockStr").isEmpty()) {
- codeBlockSelected.setText(tinyDb.getString("codeBlockStr"));
- }
-
- if(!tinyDb.getString("homeScreenStr").isEmpty()) {
- homeScreenSelected.setText(tinyDb.getString("homeScreenStr"));
- }
-
- if(!tinyDb.getString("customFontStr").isEmpty()) {
- customFontSelected.setText(tinyDb.getString("customFontStr"));
- }
-
- if(!tinyDb.getString("themeStr").isEmpty()) {
- themeSelected.setText(tinyDb.getString("themeStr"));
- }
-
- if(!tinyDb.getString("fileviewerSourceCodeThemeStr").isEmpty()) {
- fileveiwerSourceCodeThemesSelected.setText(tinyDb.getString("fileviewerSourceCodeThemeStr"));
- }
-
- if(langSelectedChoice == 0) {
- langSelectedChoice = tinyDb.getInt("langId");
- }
-
- if(timeSelectedChoice == 0) {
- timeSelectedChoice = tinyDb.getInt("timeId");
- }
-
- if(codeBlockSelectedChoice == 0) {
- codeBlockSelectedChoice = tinyDb.getInt("codeBlockId");
- }
-
- if(homeScreenSelectedChoice == 0) {
- homeScreenSelectedChoice = tinyDb.getInt("homeScreenId");
- }
-
- if(customFontSelectedChoice == 0) {
- customFontSelectedChoice = tinyDb.getInt("customFontId", 1);
- }
-
- if(themeSelectedChoice == 0) {
- themeSelectedChoice = tinyDb.getInt("themeId");
- }
-
- if(fileveiwerSourceCodeThemesSelectedChoice == 0) {
- fileveiwerSourceCodeThemesSelectedChoice = tinyDb.getInt("fileviewerThemeId");
- }
-
- if(tinyDb.getBoolean("enableCounterBadges")) {
- counterBadgesSwitch.setChecked(true);
- }
- else {
- counterBadgesSwitch.setChecked(false);
- }
-
- if(tinyDb.getBoolean("enablePdfMode")) {
- pdfModeSwitch.setChecked(true);
- }
- else {
- pdfModeSwitch.setChecked(false);
- }
-
- if(tinyDb.getBoolean("crashReportingEnabled")) {
- crashReportsSwitch.setChecked(true);
- }
- else {
- crashReportsSwitch.setChecked(false);
- }
-
- // fileviewer srouce code theme selection dialog
- sourceCodeThemeFrame.setOnClickListener(view -> {
-
- AlertDialog.Builder fvtsBuilder = new AlertDialog.Builder(ctx);
-
- fvtsBuilder.setTitle(R.string.fileviewerSourceCodeThemeSelectorDialogTitle);
- if(fileveiwerSourceCodeThemesSelectedChoice != -1) {
- fvtsBuilder.setCancelable(true);
- }
- else {
- fvtsBuilder.setCancelable(false);
- }
-
- fvtsBuilder.setSingleChoiceItems(fileveiwerSourceCodeThemesList, fileveiwerSourceCodeThemesSelectedChoice, (dialogInterfaceTheme, i) -> {
-
- fileveiwerSourceCodeThemesSelectedChoice = i;
- fileveiwerSourceCodeThemesSelected.setText(fileveiwerSourceCodeThemesList[i]);
- tinyDb.putString("fileviewerSourceCodeThemeStr", fileveiwerSourceCodeThemesList[i]);
- tinyDb.putInt("fileviewerSourceCodeThemeId", i);
-
- Objects.requireNonNull(getActivity()).recreate();
- getActivity().overridePendingTransition(0, 0);
- dialogInterfaceTheme.dismiss();
- Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
-
- });
-
- AlertDialog cfDialog = fvtsBuilder.create();
- cfDialog.show();
-
- });
-
- // certs deletion
- certsFrame.setOnClickListener(v1 -> {
-
- AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
- builder.setTitle(getResources().getString(R.string.settingsCertsPopupTitle));
- builder.setMessage(getResources().getString(R.string.settingsCertsPopupMessage));
- builder.setPositiveButton(R.string.menuDeleteText, (dialog, which) -> {
-
- ctx.getSharedPreferences(MemorizingTrustManager.KEYSTORE_NAME, Context.MODE_PRIVATE).edit().remove(MemorizingTrustManager.KEYSTORE_KEY).apply();
-
- MainActivity.logout(Objects.requireNonNull(getActivity()), ctx);
-
- });
-
- builder.setNeutralButton(R.string.cancelButton, (dialog, which) -> dialog.dismiss());
- builder.create().show();
-
- });
-
- // counter badge switcher
- counterBadgesSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
-
- if (isChecked) {
- tinyDb.putBoolean("enableCounterBadges", true);
- Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
- }
- else {
- tinyDb.putBoolean("enableCounterBadges", false);
- Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
- }
-
- });
-
- // pdf night mode switcher
- pdfModeSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
-
- if(isChecked) {
- tinyDb.putBoolean("enablePdfMode", true);
- tinyDb.putString("enablePdfModeInit", "yes");
- Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
- }
- else {
- tinyDb.putBoolean("enablePdfMode", false);
- tinyDb.putString("enablePdfModeInit", "yes");
- Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
- }
-
- });
-
- // crash reports switcher
- crashReportsSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> {
-
- if(isChecked) {
- tinyDb.putBoolean("crashReportingEnabled", true);
- Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
- }
- else {
- tinyDb.putBoolean("crashReportingEnabled", false);
- Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
- }
-
- });
-
- // theme selection dialog
- themeFrame.setOnClickListener(view -> {
-
- AlertDialog.Builder tsBuilder = new AlertDialog.Builder(ctx);
-
- tsBuilder.setTitle(R.string.themeSelectorDialogTitle);
- if(themeSelectedChoice != -1) {
- tsBuilder.setCancelable(true);
- }
- else {
- tsBuilder.setCancelable(false);
- }
-
- tsBuilder.setSingleChoiceItems(themeList, themeSelectedChoice, (dialogInterfaceTheme, i) -> {
-
- themeSelectedChoice = i;
- themeSelected.setText(themeList[i]);
- tinyDb.putString("themeStr", themeList[i]);
- tinyDb.putInt("themeId", i);
-
- Objects.requireNonNull(getActivity()).recreate();
- getActivity().overridePendingTransition(0, 0);
- dialogInterfaceTheme.dismiss();
- Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
-
- });
-
- AlertDialog cfDialog = tsBuilder.create();
- cfDialog.show();
-
- });
-
- // custom font dialog
- customFontFrame.setOnClickListener(view -> {
-
- AlertDialog.Builder cfBuilder = new AlertDialog.Builder(ctx);
-
- cfBuilder.setTitle(R.string.settingsCustomFontSelectorDialogTitle);
- if(customFontSelectedChoice != -1) {
- cfBuilder.setCancelable(true);
- }
- else {
- cfBuilder.setCancelable(false);
- }
-
- cfBuilder.setSingleChoiceItems(customFontList, customFontSelectedChoice, (dialogInterfaceCustomFont, i) -> {
-
- customFontSelectedChoice = i;
- customFontSelected.setText(customFontList[i]);
- tinyDb.putString("customFontStr", customFontList[i]);
- tinyDb.putInt("customFontId", i);
-
- Objects.requireNonNull(getActivity()).recreate();
- getActivity().overridePendingTransition(0, 0);
- dialogInterfaceCustomFont.dismiss();
- Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
-
- });
-
- AlertDialog cfDialog = cfBuilder.create();
- cfDialog.show();
-
- });
-
- // home screen dialog
- homeScreenFrame.setOnClickListener(view -> {
-
- AlertDialog.Builder hsBuilder = new AlertDialog.Builder(ctx);
-
- hsBuilder.setTitle(R.string.settingshomeScreenSelectorDialogTitle);
- if(homeScreenSelectedChoice != -1) {
- hsBuilder.setCancelable(true);
- }
- else {
- hsBuilder.setCancelable(false);
- }
-
- hsBuilder.setSingleChoiceItems(homeScreenList, homeScreenSelectedChoice, (dialogInterfaceHomeScreen, i) -> {
-
- homeScreenSelectedChoice = i;
- homeScreenSelected.setText(homeScreenList[i]);
- tinyDb.putString("homeScreenStr", homeScreenList[i]);
- tinyDb.putInt("homeScreenId", i);
-
- dialogInterfaceHomeScreen.dismiss();
- Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
-
- });
-
- AlertDialog hsDialog = hsBuilder.create();
- hsDialog.show();
-
- });
-
- // code block dialog
- codeBlockFrame.setOnClickListener(view -> {
-
- AlertDialog.Builder cBuilder = new AlertDialog.Builder(ctx);
-
- cBuilder.setTitle(R.string.settingsCodeBlockSelectorDialogTitle);
- if(codeBlockSelectedChoice != -1) {
- cBuilder.setCancelable(true);
- }
- else {
- cBuilder.setCancelable(false);
- }
-
- cBuilder.setSingleChoiceItems(codeBlockList, codeBlockSelectedChoice, (dialogInterfaceCodeBlock, i) -> {
-
- codeBlockSelectedChoice = i;
- codeBlockSelected.setText(codeBlockList[i]);
- tinyDb.putString("codeBlockStr", codeBlockList[i]);
- tinyDb.putInt("codeBlockId", i);
-
- switch(codeBlockList[i]) {
- case "White - Black":
- tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.white));
- tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.black));
- break;
- case "Grey - Black":
- tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.colorAccent));
- tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.black));
- break;
- case "White - Grey":
- tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.white));
- tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.colorAccent));
- break;
- case "Dark - White":
- tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.colorPrimary));
- tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.white));
- break;
- default:
- tinyDb.putInt("codeBlockColor", getResources().getColor(R.color.colorLightGreen));
- tinyDb.putInt("codeBlockBackground", getResources().getColor(R.color.black));
- break;
- }
-
- dialogInterfaceCodeBlock.dismiss();
- Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
-
- });
-
- AlertDialog cDialog = cBuilder.create();
- cDialog.show();
-
- });
-
- // language dialog
- langFrame.setOnClickListener(view -> {
-
- AlertDialog.Builder lBuilder = new AlertDialog.Builder(ctx);
-
- lBuilder.setTitle(R.string.settingsLanguageSelectorDialogTitle);
- if(langSelectedChoice != -1) {
- lBuilder.setCancelable(true);
- }
- else {
- lBuilder.setCancelable(false);
- }
-
- lBuilder.setSingleChoiceItems(langList, langSelectedChoice, (dialogInterface, i) -> {
-
- langSelectedChoice = i;
- tvLanguageSelected.setText(langList[i]);
- tinyDb.putString("localeStr", langList[i]);
- tinyDb.putInt("langId", i);
-
- switch(langList[i]) {
- case "Arabic":
- tinyDb.putString("locale", "ar");
- break;
- case "Chinese":
- tinyDb.putString("locale", "zh");
- break;
- case "Finnish":
- tinyDb.putString("locale", "fi");
- break;
- case "French":
- tinyDb.putString("locale", "fr");
- break;
- case "German":
- tinyDb.putString("locale", "de");
- break;
- case "Italian":
- tinyDb.putString("locale", "it");
- break;
- case "Latvian":
- tinyDb.putString("locale", "lv");
- break;
- case "Persian":
- tinyDb.putString("locale", "fa");
- break;
- case "Polish":
- tinyDb.putString("locale", "pl");
- break;
- case "Portuguese/Brazilian":
- tinyDb.putString("locale", "pt");
- break;
- case "Russian":
- tinyDb.putString("locale", "ru");
- break;
- case "Serbian":
- tinyDb.putString("locale", "sr");
- break;
- case "Spanish":
- tinyDb.putString("locale", "es");
- break;
- case "Turkish":
- tinyDb.putString("locale", "tr");
- break;
- case "Ukrainian":
- tinyDb.putString("locale", "uk");
- break;
- default:
- tinyDb.putString("locale", "en");
- break;
- }
-
- dialogInterface.dismiss();
- Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
- Objects.requireNonNull(getActivity()).recreate();
- getActivity().overridePendingTransition(0, 0);
-
- });
-
- lBuilder.setNegativeButton(getString(R.string.cancelButton), (dialog, which) -> dialog.dismiss());
-
- AlertDialog lDialog = lBuilder.create();
- lDialog.show();
-
- });
-
- // time n date dialog
- timeFrame.setOnClickListener(view -> {
-
- AlertDialog.Builder tBuilder = new AlertDialog.Builder(ctx);
-
- tBuilder.setTitle(R.string.settingsTimeSelectorDialogTitle);
- if(timeSelectedChoice != -1) {
- tBuilder.setCancelable(true);
- }
- else {
- tBuilder.setCancelable(false);
- }
-
- tBuilder.setSingleChoiceItems(timeList, timeSelectedChoice, (dialogInterfaceTime, i) -> {
-
- timeSelectedChoice = i;
- tvDateTimeSelected.setText(timeList[i]);
- tinyDb.putString("timeStr", timeList[i]);
- tinyDb.putInt("timeId", i);
-
- if("Normal".equals(timeList[i])) {
- tinyDb.putString("dateFormat", "normal");
- }
- else {
- tinyDb.putString("dateFormat", "pretty");
- }
-
- dialogInterfaceTime.dismiss();
- Toasty.info(getContext(), getResources().getString(R.string.settingsSave));
-
- });
-
- AlertDialog tDialog = tBuilder.create();
- tDialog.show();
-
- });
+ reportsFrame.setOnClickListener(v1 -> startActivity(new Intent(getContext(), SettingsReportsActivity.class)));
return v;
}
@Override
- public void onAttach(@NonNull Context context) {
+ public void onResume() {
- super.onAttach(context);
- ctx = context;
+ super.onResume();
+
+ TinyDB tinyDb = new TinyDB(getContext());
+
+ if(tinyDb.getBoolean("refreshParent")) {
+ Objects.requireNonNull(getActivity()).recreate();
+ getActivity().overridePendingTransition(0, 0);
+ tinyDb.putBoolean("refreshParent", false);
+ }
}
diff --git a/app/src/main/res/drawable/ic_flag_country.xml b/app/src/main/res/drawable/ic_flag_country.xml
new file mode 100644
index 00000000..df3bd5fa
--- /dev/null
+++ b/app/src/main/res/drawable/ic_flag_country.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/app/src/main/res/layout/settings_appearance.xml b/app/src/main/res/layout/activity_settings_appearance.xml
similarity index 72%
rename from app/src/main/res/layout/settings_appearance.xml
rename to app/src/main/res/layout/activity_settings_appearance.xml
index 23bf5d1c..7461806c 100644
--- a/app/src/main/res/layout/settings_appearance.xml
+++ b/app/src/main/res/layout/activity_settings_appearance.xml
@@ -2,21 +2,48 @@
-
+ android:theme="@style/Widget.AppCompat.SearchView">
+
+
+
+
+
+
+
+
+
+
@@ -42,7 +69,7 @@
android:layout_height="wrap_content"
android:textSize="14sp"
android:layout_marginStart="44dp"
- android:layout_marginEnd="4dp"
+ android:layout_marginEnd="24dp"
android:text="@string/themeSelectionSelectedText"
android:textColor="?attr/selectedTextColor"/>
@@ -52,7 +79,7 @@
android:id="@+id/customFontFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="10dp"
+ android:layout_marginTop="15dp"
android:orientation="vertical">
@@ -72,7 +99,7 @@
android:layout_height="wrap_content"
android:textSize="14sp"
android:layout_marginStart="44dp"
- android:layout_marginEnd="4dp"
+ android:layout_marginEnd="24dp"
android:text="@string/settingsCustomFontDefault"
android:textColor="?attr/selectedTextColor"/>
@@ -82,7 +109,7 @@
android:id="@+id/timeFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="5dp"
+ android:layout_marginTop="15dp"
android:orientation="vertical">
@@ -102,7 +129,7 @@
android:layout_height="wrap_content"
android:textSize="14sp"
android:layout_marginStart="44dp"
- android:layout_marginEnd="4dp"
+ android:layout_marginEnd="24dp"
android:text="@string/settingsDateTimeHeaderDefault"
android:textColor="?attr/selectedTextColor"/>
@@ -112,7 +139,7 @@
android:id="@+id/counterBadgeFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="20dp"
+ android:layout_marginTop="25dp"
android:orientation="horizontal">
@@ -131,6 +158,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:switchMinWidth="56dp"
+ android:paddingStart="0dp"
+ android:paddingEnd="24dp"
android:layout_alignParentEnd="true"
android:gravity="end"
android:layout_gravity="end" />
@@ -141,7 +170,7 @@
android:id="@+id/codeBlockFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="10dp"
+ android:layout_marginTop="15dp"
android:orientation="vertical">
@@ -161,7 +190,7 @@
android:layout_height="wrap_content"
android:textSize="14sp"
android:layout_marginStart="44dp"
- android:layout_marginEnd="4dp"
+ android:layout_marginEnd="24dp"
android:text="@string/codeBlockSelectedText"
android:textColor="?attr/selectedTextColor"/>
@@ -171,7 +200,7 @@
android:id="@+id/homeScreenFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="10dp"
+ android:layout_marginTop="15dp"
android:orientation="vertical">
@@ -191,7 +220,7 @@
android:layout_height="wrap_content"
android:textSize="14sp"
android:layout_marginStart="44dp"
- android:layout_marginEnd="4dp"
+ android:layout_marginEnd="24dp"
android:text="@string/settingsHomeScreenSelectedText"
android:textColor="?attr/selectedTextColor"/>
diff --git a/app/src/main/res/layout/settings_fileview.xml b/app/src/main/res/layout/activity_settings_fileview.xml
similarity index 56%
rename from app/src/main/res/layout/settings_fileview.xml
rename to app/src/main/res/layout/activity_settings_fileview.xml
index 9884f719..69d77519 100644
--- a/app/src/main/res/layout/settings_fileview.xml
+++ b/app/src/main/res/layout/activity_settings_fileview.xml
@@ -2,51 +2,49 @@
-
-
-
+ android:theme="@style/Widget.AppCompat.SearchView">
-
+ android:background="?attr/primaryBackgroundColor"
+ android:theme="@style/AppTheme.AppBarOverlay"
+ tools:ignore="UnusedAttribute">
-
+
-
+
+
+
+
+
@@ -72,10 +70,41 @@
android:layout_height="wrap_content"
android:textSize="14sp"
android:layout_marginStart="44dp"
- android:layout_marginEnd="4dp"
+ android:layout_marginEnd="24dp"
android:text="@string/settingsFileviewerSourceCodeSelectedText"
android:textColor="?attr/selectedTextColor"/>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_settings_reporting.xml b/app/src/main/res/layout/activity_settings_reporting.xml
new file mode 100644
index 00000000..4df671c7
--- /dev/null
+++ b/app/src/main/res/layout/activity_settings_reporting.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_settings_security.xml b/app/src/main/res/layout/activity_settings_security.xml
new file mode 100644
index 00000000..8e58d71b
--- /dev/null
+++ b/app/src/main/res/layout/activity_settings_security.xml
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/settings_languages.xml b/app/src/main/res/layout/activity_settings_translation.xml
similarity index 50%
rename from app/src/main/res/layout/settings_languages.xml
rename to app/src/main/res/layout/activity_settings_translation.xml
index cf5fe8c8..ce492989 100644
--- a/app/src/main/res/layout/settings_languages.xml
+++ b/app/src/main/res/layout/activity_settings_translation.xml
@@ -2,21 +2,48 @@
-
+ android:theme="@style/Widget.AppCompat.SearchView">
+
+
+
+
+
+
+
+
+
+
@@ -42,7 +69,7 @@
android:layout_height="wrap_content"
android:textSize="14sp"
android:layout_marginStart="44dp"
- android:layout_marginEnd="4dp"
+ android:layout_marginEnd="24dp"
android:text="@string/settingsLanguageSelectedHeaderDefault"
android:textColor="?attr/selectedTextColor"/>
@@ -52,7 +79,7 @@
android:layout_height="wrap_content"
android:textSize="14sp"
android:layout_marginStart="44dp"
- android:layout_marginEnd="4dp"
+ android:layout_marginEnd="24dp"
android:autoLink="web"
android:layout_marginTop="20dp"
android:text="@string/settingsHelpTranslateText"
diff --git a/app/src/main/res/layout/fragment_settings.xml b/app/src/main/res/layout/fragment_settings.xml
index 740fc21b..92548ef4 100644
--- a/app/src/main/res/layout/fragment_settings.xml
+++ b/app/src/main/res/layout/fragment_settings.xml
@@ -1,5 +1,6 @@
-
@@ -9,72 +10,178 @@
android:layout_height="match_parent"
android:background="?attr/primaryBackgroundColor">
-
+ android:orientation="vertical"
+ android:layout_height="wrap_content">
-
-
-
+ android:orientation="vertical"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="25dp">
-
+
-
+
+
+
+
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:layout_marginTop="25dp">
-
+
-
+
+
+
+
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:layout_marginTop="25dp">
-
+
-
+
+
+
+
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:layout_marginTop="25dp">
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/settings_reporting.xml b/app/src/main/res/layout/settings_reporting.xml
deleted file mode 100644
index 80528dc3..00000000
--- a/app/src/main/res/layout/settings_reporting.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/settings_security.xml b/app/src/main/res/layout/settings_security.xml
deleted file mode 100644
index b7c501f4..00000000
--- a/app/src/main/res/layout/settings_security.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index f8eafa2e..1ec58c8f 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -627,4 +627,10 @@
GitNex has stopped :(
Crash reports
You can tap the OK button to send the crash report by email. It will help to fix it :)\n\nYou can also add additional content in the email. Thank you!
+
+ Themes, fonts, badges, code block theme
+ PDF mode, source code theme
+ SSL certificates
+ Languages
+ Crash reports