Tweaks and cleanup

Signed-off-by: androidacy-user <opensource@androidacy.com>
pull/27/head
androidacy-user 3 years ago
parent 16cf6d4501
commit 5d941ae570

@ -81,6 +81,15 @@ android {
flavorDimensions "type"
productFlavors {
"default" {
// Latest commit hash as BuildConfig.COMMIT_HASH
def gitCommitHash = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim()
buildConfigField "String", "COMMIT_HASH", "\"${gitCommitHash}\""
// Get the current branch name as BuildConfig.BRANCH_NAME
def gitBranchName = 'git rev-parse --abbrev-ref HEAD'.execute([], project.rootDir).text.trim()
buildConfigField "String", "BRANCH_NAME", "\"${gitBranchName}\""
// Get remote url as BuildConfig.REMOTE_URL
def gitRemoteUrl = 'git config --get remote.origin.url'.execute([], project.rootDir).text.trim()
buildConfigField "String", "REMOTE_URL", "\"${gitRemoteUrl}\""
dimension "type"
buildConfigField "boolean", "ENABLE_AUTO_UPDATER", "true"
buildConfigField "boolean", "DEFAULT_ENABLE_CRASH_REPORTING", "true"
@ -119,6 +128,16 @@ android {
dimension "type"
applicationIdSuffix ".fdroid"
// Latest commit hash as BuildConfig.COMMIT_HASH
def gitCommitHash = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim()
buildConfigField "String", "COMMIT_HASH", "\"${gitCommitHash}\""
// Get the current branch name as BuildConfig.BRANCH_NAME
def gitBranchName = 'git rev-parse --abbrev-ref HEAD'.execute([], project.rootDir).text.trim()
buildConfigField "String", "BRANCH_NAME", "\"${gitBranchName}\""
// Get remote url as BuildConfig.REMOTE_URL
def gitRemoteUrl = 'git config --get remote.origin.url'.execute([], project.rootDir).text.trim()
buildConfigField "String", "REMOTE_URL", "\"${gitRemoteUrl}\""
// Need to disable auto-updater for F-Droid flavor because their inclusion policy
// forbids downloading blobs from third-party websites (and F-Droid APK isn't signed
// with our keys, so the APK wouldn't install anyways).

@ -257,7 +257,10 @@ public class MainActivity extends FoxActivity implements SwipeRefreshLayout.OnRe
Log.i("NoodleDebug", "Check Update");
RepoManager.getINSTANCE().update(value -> runOnUiThread(max == 0 ? () -> progressIndicator.setProgressCompat((int) (value * PRECISION), true) : () -> progressIndicator.setProgressCompat((int) (value * PRECISION * 0.75F), true)));
NotificationType.NEED_CAPTCHA_ANDROIDACY.autoAdd(moduleViewListBuilder);
// Add debug notification for debug builds
if (!NotificationType.DEBUG.shouldRemove()) {
moduleViewListBuilder.addNotification(NotificationType.DEBUG);
}
if (!NotificationType.NO_INTERNET.shouldRemove()) {
moduleViewListBuilder.addNotification(NotificationType.NO_INTERNET);
} else if (!NotificationType.REPO_UPDATE_FAILED.shouldRemove()) {

@ -280,6 +280,9 @@ public class MainApplication extends FoxApplication implements androidx.work.Con
INSTANCE = this;
relPackageName = this.getPackageName();
super.onCreate();
if (BuildConfig.DEBUG) {
Log.d("MainApplication", "Starting FoxMMM version " + BuildConfig.VERSION_NAME + " (" + BuildConfig.VERSION_CODE + "), commit " + BuildConfig.COMMIT_HASH);
}
SharedPreferences sharedPreferences = MainApplication.getSharedPreferences();
// We are only one process so it's ok to do this
SharedPreferences bootPrefs = MainApplication.bootSharedPreferences = this.getSharedPreferences("mmm_boot", MODE_PRIVATE);

@ -29,7 +29,7 @@ public enum NotificationType implements NotificationTypeCst {
DEBUG(R.string.debug_build, R.drawable.ic_baseline_bug_report_24) {
@Override
public boolean shouldRemove() {
return BuildConfig.DEBUG;
return !BuildConfig.DEBUG;
}
},
SHOWCASE_MODE(R.string.showcase_mode, R.drawable.ic_baseline_lock_24,

@ -333,26 +333,31 @@ public class SettingsActivity extends FoxActivity implements LanguageActivity {
});
// Warning! Locales that are't exist will crash the app
// Anything that is commented out is supported but the translation is not complete to at least 60%
HashSet<String> supportedLocales = new HashSet<>();
// supportedLocales.add("ar");
// supportedLocales.add("ar_SA");
supportedLocales.add("cs");
supportedLocales.add("de");
supportedLocales.add("el");
// supportedLocales.add("el");
supportedLocales.add("es");
supportedLocales.add("es-rMX");
supportedLocales.add("et");
// supportedLocales.add("et");
supportedLocales.add("fr");
supportedLocales.add("id");
supportedLocales.add("it");
supportedLocales.add("ja");
supportedLocales.add("nb-rNO");
// supportedLocales.add("ja");
// supportedLocales.add("nb-rNO");
supportedLocales.add("pl");
supportedLocales.add("pt-rBR");
supportedLocales.add("ro");
supportedLocales.add("ru");
supportedLocales.add("sk");
supportedLocales.add("tr");
supportedLocales.add("vi");
supportedLocales.add("uk");
// supportedLocales.add("vi");
supportedLocales.add("zh-rCH");
supportedLocales.add("zh-rTW");
// supportedLocales.add("zh-rTW");
supportedLocales.add("en");
Preference languageSelector = findPreference("pref_language_selector");
@ -363,6 +368,23 @@ public class SettingsActivity extends FoxActivity implements LanguageActivity {
return true;
});
// Handle pref_language_selector_cta by taking user to https://translate.nift4.org/engage/foxmmm/
LongClickablePreference languageSelectorCta = findPreference("pref_language_selector_cta");
languageSelectorCta.setOnPreferenceClickListener(preference -> {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://translate.nift4.org/engage/foxmmm/"));
startActivity(browserIntent);
return true;
});
// Long click to copy url
languageSelectorCta.setOnPreferenceLongClickListener(v -> {
ClipboardManager clipboard = (ClipboardManager) requireContext().getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("URL", "https://translate.nift4.org/engage/foxmmm/");
clipboard.setPrimaryClip(clip);
Toast.makeText(requireContext(), R.string.link_copied, Toast.LENGTH_SHORT).show();
return true;
});
int level = this.currentLanguageLevel();
if (level != LANGUAGE_SUPPORT_LEVEL) {
Log.e(TAG, "Detected language level " + level + ", latest is " + LANGUAGE_SUPPORT_LEVEL);
@ -484,6 +506,8 @@ public class SettingsActivity extends FoxActivity implements LanguageActivity {
findPreference("pref_report_bug").setVisible(false);
}
linkClickable = findPreference("pref_source_code");
// Set summary to the last commit this build was built from
linkClickable.setSummary(String.format(getString(R.string.source_code_summary), BuildConfig.COMMIT_HASH));
linkClickable.setOnPreferenceClickListener(p -> {
if (devModeStep == 2) {
devModeStep = 0;
@ -499,7 +523,8 @@ public class SettingsActivity extends FoxActivity implements LanguageActivity {
ExternalHelper.INSTANCE.refreshHelper(getContext());
return true;
}
IntentHelper.openUrl(p.getContext(), "https://github.com/Fox2Code/FoxMagiskModuleManager");
// build url from BuildConfig.REMOTE_URL and BuildConfig.COMMIT_HASH. May have to remove the .git at the end
IntentHelper.openUrl(p.getContext(), BuildConfig.REMOTE_URL + "/tree/" + BuildConfig.COMMIT_HASH);
return true;
});
linkClickable.setOnPreferenceLongClickListener(p -> {

@ -58,7 +58,7 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:maxLines="1"
android:maxLines="2"
android:text="@string/loading"
android:textSize="16sp"
android:textAppearance="?attr/textAppearanceTitleMedium"

@ -179,7 +179,7 @@
<string name="sentry_dialogue_success">Danke für dein Feedback</string>
<string name="sentry_dialogue_no_description">Konnte nicht abgesendet werden, da keine Fehlerbeschreibung angegeben wurde</string>
<string name="go_to_online_repo">Zu Online-Repos gehen</string>
<string name="pref_pkg_info_summary">%1$s v%2$s (%3$o) | %4$s Build</string>
<string name="pref_pkg_info_summary">%1$s v%2$s (%3$d) | %4$s Build</string>
<string name="official">Offiziell</string>
<string name="unofficial">Inoffiziell</string>
<string name="setup_title">Willkommen</string>

@ -218,7 +218,7 @@
<string name="sentry_dialogue_no_description">Il n\est pas possible d\envoyer le retour d\expérience etant donné qu\aucune
description n\a été fournie</string>
<string name="go_to_online_repo">Défiler jusqu\aux dépôts en ligne</string>
<string name="pref_pkg_info_summary">%1$s v%2$s (%3$o) | %4$s Fabrication</string>
<string name="pref_pkg_info_summary">%1$s v%2$s (%3$d) | %4$s Fabrication</string>
<string name="official">Officielle</string>
<string name="unofficial">Non-officielle</string>
<string name="setup_title">Première mise en service</string>

@ -199,7 +199,7 @@
<string name="sentry_dialogue_success">Feedback inviato correttamente. Lo esamineremo a breve</string>
<string name="sentry_dialogue_no_description">Impossibile inviare il feedback in quanto non è stata fornita alcuna descrizione</string>
<string name="go_to_online_repo">Scorri fino al repository online</string>
<string name="pref_pkg_info_summary">%1$s v%2$s (%3$o) | %4$s Crea</string>
<string name="pref_pkg_info_summary">%1$s v%2$s (%3$d) | %4$s Crea</string>
<string name="official">Ufficiale</string>
<string name="unofficial">Non ufficiale</string>
<string name="setup_title">Configurazione per la prima volta</string>

@ -150,7 +150,7 @@
<string name="sentry_dialogue_success">Feedback met succes verzonden. We zullen het zo snel mogelijk bekijken</string>
<string name="sentry_dialogue_no_description">Kan geen feedback verzenden omdat er geen beschrijving is gegeven</string>
<string name="go_to_online_repo">Scroll naar online repo</string>
<string name="pref_pkg_info_summary">%1$s v%2$s (%3$o) | %4$s Build</string>
<string name="pref_pkg_info_summary">%1$s v%2$s (%3$d) | %4$s Build</string>
<string name="official">Officieel</string>
<string name="unofficial">Niet-officieel</string>
<string name="setup_title">Eerste installatie</string>

@ -188,7 +188,7 @@
<string name="sentry_dialogue_no_description">Nie można przesłać opinii, ponieważ nie podano opisu</string>
<string name="go_to_online_repo">Przewiń do repozytorium online</string>
<string name="official">Oficjalna</string>
<string name="pref_pkg_info_summary">%1$s v%2$s (%3$o) | %4$s kompilacja</string>
<string name="pref_pkg_info_summary">%1$s v%2$s (%3$d) | %4$s kompilacja</string>
<string name="sentry_dialogue_success">Pomyślnie przesłano opinię. Wkrótce to sprawdzimy</string>
<string name="setup_title">Powitalna konfiguracja</string>
<string name="setup_button">Zastosuj</string>

@ -164,7 +164,7 @@
<string name="sentry_dialogue_success">Relatório enviador com sucesso. Iremos analisar logo em breve</string>
<string name="sentry_dialogue_no_description">Incapaz de enviar relatório já que nenhuma descrição foi providenciada</string>
<string name="go_to_online_repo">Descer até os repositórios online</string>
<string name="pref_pkg_info_summary">Versão %1$s v%2$s (%3$o) | %4$s</string>
<string name="pref_pkg_info_summary">Versão %1$s v%2$s (%3$d) | %4$s</string>
<string name="official">Oficial</string>
<string name="unofficial">Não oficial</string>
<string name="setup_title">Configuração inicial</string>

@ -193,7 +193,7 @@
<string name="sentry_dialogue_success">Feedback trimis cu succes. Îl vom revizui în curând</string>
<string name="sentry_dialogue_no_description">Nu s-a putut trimite feedback deoarece nu a fost furnizată nicio descriere</string>
<string name="go_to_online_repo">Derulați la depozitele online</string>
<string name="pref_pkg_info_summary">%1$s v%2$s (%3$o) | %4$s</string>
<string name="pref_pkg_info_summary">%1$s v%2$s (%3$d) | %4$s</string>
<string name="official">Oficial</string>
<string name="unofficial">Neoficial</string>
<string name="setup_title">Configurare pentru prima dată</string>

@ -192,7 +192,7 @@
<string name="sentry_dialogue_success">Отзыв отправлен успешно. Мы рассмотрим его в ближайшее время</string>
<string name="additional_info">Сообщите нам что случилось</string>
<string name="go_to_online_repo">Перейдите к онлайн-репозиторию</string>
<string name="pref_pkg_info_summary">Сборка %1$s v%2$s (%3$o) | %4$s</string>
<string name="pref_pkg_info_summary">Сборка %1$s v%2$s (%3$d) | %4$s</string>
<string name="official">Официальный</string>
<string name="repos">Репозитории</string>
<string name="misc">Разное</string>

@ -186,7 +186,7 @@
<string name="sentry_dialogue_success">Відгук успішно надіслано. Невдовзі ми його розглянемо</string>
<string name="sentry_dialogue_no_description">Не вдалося надіслати відгук, оскільки не було надано опису</string>
<string name="go_to_online_repo">Перейдіть до онлайн репозиторію</string>
<string name="pref_pkg_info_summary">Збірка: %1$s v%2$s (%3$o) | %4$s</string>
<string name="pref_pkg_info_summary">Збірка: %1$s v%2$s (%3$d) | %4$s</string>
<string name="official">Офіційний</string>
<string name="unofficial">Неофіційний</string>
<string name="setup_title">Перше налаштування</string>

@ -218,7 +218,7 @@
<string name="sentry_dialogue_no_description">无法提交反馈, 因为
因为没有提供描述</string>
<string name="go_to_online_repo">移动到在线仓库</string>
<string name="pref_pkg_info_summary">%1$s v%2$s (%3$o) | %4$s 构建</string>
<string name="pref_pkg_info_summary">%1$s v%2$s (%3$d) | %4$s 构建</string>
<string name="official">官方</string>
<string name="unofficial">非官方</string>
<string name="setup_title">初始设定</string>

@ -218,7 +218,7 @@
<string name="sentry_dialogue_no_description">Could not submit feedback as no
description was provided</string>
<string name="go_to_online_repo">Scroll to online repo</string>
<string name="pref_pkg_info_summary">%1$s v%2$s (%3$o) | %4$s Build</string>
<string name="pref_pkg_info_summary">%1$s v%2$s (%3$d) | %4$s Build</string>
<string name="official">Official</string>
<string name="unofficial">Unofficial</string>
<string name="setup_title">First time setup</string>
@ -248,12 +248,24 @@
<string name="debug_build">This is a debug build. Expect some bugs and worse performance.</string>
<string name="androidacy_repo_name">Androidacy Repo</string>
<string name="magisk_alt_repo_name">Magisk Alt Repo</string>
<string name="repo_enabled_changed">You\'ve enabled or disabled a repo. Please refresh the module list or restart the app.</string><string name="finish">Finish</string><string name="setup_theme">Choose a theme</string><string name="setup_theme_header">Choose a theme</string><string name="setup_theme_system">System theme</string><string name="setup_theme_light">Light theme</string><string name="setup_theme_dark">Dark theme</string><string name="setup_theme_black">AMOLED Black theme</string><string name="setup_theme_transparent_light">Transparent light theme - will disable monet and blur!</string><string name="setup_theme_button">Choose a theme</string><string name="theme">Theme</string><string name="theme_system">System</string>
<string name="repo_enabled_changed">You\'ve enabled or disabled a repo. Please refresh the module list or restart the app.</string>
<string name="finish">Finish</string>
<string name="setup_theme">Choose a theme</string>
<string name="setup_theme_header">Choose a theme</string>
<string name="setup_theme_system">System theme</string>
<string name="setup_theme_light">Light theme</string>
<string name="setup_theme_dark">Dark theme</string>
<string name="setup_theme_black">AMOLED Black theme</string>
<string name="setup_theme_transparent_light">Transparent light theme - will disable monet and blur!</string>
<string name="setup_theme_button">Choose a theme</string>
<string name="theme">Theme</string>
<string name="theme_system">System</string>
<string name="theme_dark">Dark</string>
<string name="theme_black">AMOLED Black</string>
<string name="theme_transparent_light">Light (transparency)</string>
<string name="theme_light">Light</string>
<string name="androidacy_update_needed">This app is outdated.</string>
<string name="androidacy_update_needed_message">Please update the app to the latest version.</string>
<string name="androidacy_webview_update_required">Your webview is outdated! Please update it.</string>
<string name="androidacy_webview_update_required">Your webview is outdated! Please update it.</string><string name="language_cta">Don\'t see your language?</string><string name="language_cta_desc">Help us by translating it! Tap here to find out more.</string>
<string name="source_code_summary"><b>Commit</b> %1$s</string>
</resources>

@ -96,6 +96,11 @@
<item name="colorPrimaryVariant">@color/orange_700</item>
<item name="colorSecondary">@color/orange_500</item>
<item name="colorSecondaryVariant">@color/orange_700</item>
<!-- Fix some unthemed dialogs -->
<item name="android:colorAccent">@color/orange_200</item>
<item name="android:colorBackground">@color/black</item>
<item name="android:colorForeground">@color/white</item>
<item name="android:colorBackgroundCacheHint">@null</item>
</style>
<style name="Widget.Material.Chip.Choice.Dark" parent="Widget.MaterialComponents.Chip.Action">

@ -1,4 +1,4 @@
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto">
<!-- Custom repos has been announced, check https://github.com/Fox2Code/FoxMagiskModuleManager/issues/131 -->
<PreferenceCategory app:title="@string/pref_category_repos">
@ -61,6 +61,17 @@
app:key="pref_language_selector"
app:title="@string/language" />
<!-- Call to action for translators -->
<com.fox2code.mmm.settings.LongClickablePreference
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="8sp"
app:icon="@drawable/ic_baseline_info_24"
app:key="pref_language_selector_cta"
app:singleLineTitle="false"
app:summary="@string/language_cta_desc"
app:title="@string/language_cta" />
<SwitchPreferenceCompat
app:defaultValue="false"
app:icon="@drawable/ic_baseline_blur_on_24"

Loading…
Cancel
Save