Use XML-defined intent instead of code

This commit is contained in:
xynngh 2020-10-18 01:48:26 +04:00
parent f60efa1963
commit 55b0f4ef01
3 changed files with 9 additions and 8 deletions

View File

@ -22,6 +22,9 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
applicationVariants.all { variant ->
variant.resValue "string", "app_id", variant.applicationId
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8

View File

@ -137,7 +137,6 @@ public class SettingsActivity extends AppCompatActivity
private static final String PREF_NOTIFICATION_CHANNEL_SETTINGS = "notificationChannelSettings";
private static final String PREF_CATEGORY_NOTIFICATIONS = "categoryNotifications";
private static final String PREF_SCREEN_ADVANCED = "screenAdvanced";
private static final String PREF_DB_MANAGEMENT = "dbManagement";
private static final String PREF_COUNTRY_CODES_INFO = "countryCodesInfo";
private static final String PREF_EXPORT_LOGCAT = "exportLogcat";
@ -291,12 +290,6 @@ public class SettingsActivity extends AppCompatActivity
private void initAdvancedScreen(String rootKey) {
if (!PREF_SCREEN_ADVANCED.equals(rootKey)) return;
requireNonNull((Preference) findPreference(PREF_DB_MANAGEMENT))
.setOnPreferenceClickListener(preference -> {
startActivity(new Intent(requireContext(), DbManagementActivity.class));
return true;
});
String countryCodesExplanationSummary = getString(R.string.country_codes_info_summary)
+ ". " + getString(R.string.country_codes_info_summary_addition,
App.getSettings().getCachedAutoDetectedCountryCode());

View File

@ -1,4 +1,5 @@
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
app:title="@string/title_settings_activity">
<PreferenceCategory app:title="@string/settings_category_main">
@ -83,7 +84,11 @@
<Preference
app:key="dbManagement"
app:persistent="false"
app:title="@string/open_db_management_activity" />
app:title="@string/open_db_management_activity">
<intent
android:targetClass="dummydomain.yetanothercallblocker.DbManagementActivity"
android:targetPackage="@string/app_id" />
</Preference>
<PreferenceCategory
app:key="categoryCountryCodes"
app:title="@string/settings_category_country_codes">