mirror of
https://github.com/revanced/revanced-integrations.git
synced 2025-01-07 10:35:49 +01:00
add toast for failed exporting
This commit is contained in:
parent
eba12ba2e6
commit
c0c9ea451e
@ -301,11 +301,13 @@ public class SponsorBlockPreferenceFragment extends PreferenceFragment implement
|
|||||||
|
|
||||||
{
|
{
|
||||||
EditTextPreference preference = new EditTextPreference(context);
|
EditTextPreference preference = new EditTextPreference(context);
|
||||||
|
Context applicationContext = context.getApplicationContext();
|
||||||
|
|
||||||
preference.setTitle(str("settings_ie"));
|
preference.setTitle(str("settings_ie"));
|
||||||
preference.setSummary(str("settings_ie_sum"));
|
preference.setSummary(str("settings_ie_sum"));
|
||||||
preference.setText(SponsorBlockUtils.exportSettings());
|
preference.setText(SponsorBlockUtils.exportSettings(applicationContext));
|
||||||
preference.setOnPreferenceChangeListener((preference1, newValue) -> {
|
preference.setOnPreferenceChangeListener((preference1, newValue) -> {
|
||||||
SponsorBlockUtils.importSettings((String) newValue, context.getApplicationContext());
|
SponsorBlockUtils.importSettings((String) newValue, applicationContext);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
screen.addPreference(preference);
|
screen.addPreference(preference);
|
||||||
|
@ -604,7 +604,7 @@ public abstract class SponsorBlockUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String exportSettings() {
|
public static String exportSettings(Context context) {
|
||||||
try {
|
try {
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
|
|
||||||
@ -636,6 +636,7 @@ public abstract class SponsorBlockUtils {
|
|||||||
return json.toString();
|
return json.toString();
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
|
Toast.makeText(context, str("settings_export_failed"), Toast.LENGTH_SHORT).show();
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -161,6 +161,7 @@
|
|||||||
<string name="settings_ie_sum">This is your entire configuration that is applicable in the desktop extension in JSON. This includes your userID, so be sure to share this wisely.</string>
|
<string name="settings_ie_sum">This is your entire configuration that is applicable in the desktop extension in JSON. This includes your userID, so be sure to share this wisely.</string>
|
||||||
<string name="settings_import_successful">Settings were successfully imported</string>
|
<string name="settings_import_successful">Settings were successfully imported</string>
|
||||||
<string name="settings_import_failed">Failed to import settings</string>
|
<string name="settings_import_failed">Failed to import settings</string>
|
||||||
|
<string name="settings_export_failed">Failed to export settings</string>
|
||||||
<string name="segments_sponsor">Sponsor</string>
|
<string name="segments_sponsor">Sponsor</string>
|
||||||
<string name="segments_sponsor_sum">Paid promotion, paid referrals and direct advertisements</string>
|
<string name="segments_sponsor_sum">Paid promotion, paid referrals and direct advertisements</string>
|
||||||
<string name="segments_intermission">Intermission/Intro Animation</string>
|
<string name="segments_intermission">Intermission/Intro Animation</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user