Remove automatic showing of changelog after app upgrade.

This commit is contained in:
Andreas Schildbach 2021-01-16 23:55:34 +01:00
parent 459db742eb
commit 8d4894f25e
7 changed files with 3 additions and 112 deletions

View file

@ -36,8 +36,6 @@
<string name="global_preferences_title">Allgemein</string> <string name="global_preferences_title">Allgemein</string>
<string name="global_preferences_network_provider_title">Verkehrsnetz</string> <string name="global_preferences_network_provider_title">Verkehrsnetz</string>
<string name="global_preferences_network_provider_summary">Verkehrsnetz wählen.</string> <string name="global_preferences_network_provider_summary">Verkehrsnetz wählen.</string>
<string name="global_preferences_show_changelog_title">Änderungen zeigen</string>
<string name="global_preferences_show_changelog_summary">Nach Aktualisierung auf eine neue Version von Öffi Änderungen zeigen.</string>
<string name="global_preferences_show_hints_title">Tipps zeigen</string> <string name="global_preferences_show_hints_title">Tipps zeigen</string>
<string name="global_preferences_show_hints_summary">Hin und wieder einen nützlichen Tipp anzeigen.</string> <string name="global_preferences_show_hints_summary">Hin und wieder einen nützlichen Tipp anzeigen.</string>
<string name="global_preferences_location_settings_title">Standorteinstellungen</string> <string name="global_preferences_location_settings_title">Standorteinstellungen</string>
@ -321,9 +319,6 @@
<string name="alert_network_problem_title">Netzwerk-Probleme?</string> <string name="alert_network_problem_title">Netzwerk-Probleme?</string>
<string name="alert_network_problem_message">Kann Daten nicht laden.</string> <string name="alert_network_problem_message">Kann Daten nicht laden.</string>
<string name="alert_network_problem_retry">Nochmal versuchen</string> <string name="alert_network_problem_retry">Nochmal versuchen</string>
<string name="changelog_dialog_title_version">Willkommen zu Öffi Version %s!</string>
<string name="changelog_dialog_title">Folgendes ist neu:</string>
<string name="changelog_dialog_button_dismiss">Weiter</string>
<string name="alert_message_button_dismiss">Weiter</string> <string name="alert_message_button_dismiss">Weiter</string>
<string name="alert_message_button_update">App-Update</string> <string name="alert_message_button_update">App-Update</string>
<string name="alert_crash_report_title">Öffi ist letztens abgestürzt</string> <string name="alert_crash_report_title">Öffi ist letztens abgestürzt</string>

View file

@ -36,8 +36,6 @@
<string name="global_preferences_title">Common</string> <string name="global_preferences_title">Common</string>
<string name="global_preferences_network_provider_title">Transport network</string> <string name="global_preferences_network_provider_title">Transport network</string>
<string name="global_preferences_network_provider_summary">Pick transportation network.</string> <string name="global_preferences_network_provider_summary">Pick transportation network.</string>
<string name="global_preferences_show_changelog_title">Show changes</string>
<string name="global_preferences_show_changelog_summary">Show Offi\'s changelog after each upgrade to a new version.</string>
<string name="global_preferences_show_hints_title">Show hints</string> <string name="global_preferences_show_hints_title">Show hints</string>
<string name="global_preferences_show_hints_summary">Show useful hints now and then.</string> <string name="global_preferences_show_hints_summary">Show useful hints now and then.</string>
<string name="global_preferences_location_settings_title">Location settings</string> <string name="global_preferences_location_settings_title">Location settings</string>
@ -322,9 +320,6 @@
<string name="alert_network_problem_title">Network problems?</string> <string name="alert_network_problem_title">Network problems?</string>
<string name="alert_network_problem_message">Could not fetch data.</string> <string name="alert_network_problem_message">Could not fetch data.</string>
<string name="alert_network_problem_retry">Retry</string> <string name="alert_network_problem_retry">Retry</string>
<string name="changelog_dialog_title_version">Welcome to Offi version %s!</string>
<string name="changelog_dialog_title">Here is what\'s new:</string>
<string name="changelog_dialog_button_dismiss">Dismiss</string>
<string name="alert_message_button_dismiss">Dismiss</string> <string name="alert_message_button_dismiss">Dismiss</string>
<string name="alert_message_button_update">Update app</string> <string name="alert_message_button_update">Update app</string>
<string name="alert_crash_report_title">Previous crash detected</string> <string name="alert_crash_report_title">Previous crash detected</string>

View file

@ -10,11 +10,6 @@
android:targetPackage="de.schildbach.oeffi" android:targetPackage="de.schildbach.oeffi"
android:targetClass="de.schildbach.oeffi.network.NetworkPickerActivity" /> android:targetClass="de.schildbach.oeffi.network.NetworkPickerActivity" />
</Preference> </Preference>
<CheckBoxPreference
android:defaultValue="true"
android:key="show_changelog"
android:summary="@string/global_preferences_show_changelog_summary"
android:title="@string/global_preferences_show_changelog_title" />
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="true" android:defaultValue="true"
android:key="show_hints" android:key="show_hints"

View file

@ -54,7 +54,6 @@ public class Constants {
public static final String PREFS_KEY_NETWORK_PROVIDER = "network_provider"; public static final String PREFS_KEY_NETWORK_PROVIDER = "network_provider";
public static final String PREFS_KEY_LAST_NETWORK_PROVIDERS = "last_network_providers"; public static final String PREFS_KEY_LAST_NETWORK_PROVIDERS = "last_network_providers";
public static final String PREFS_KEY_SHOW_CHANGELOG = "show_changelog";
public static final String PREFS_KEY_PRODUCT_FILTER = "product_filter"; public static final String PREFS_KEY_PRODUCT_FILTER = "product_filter";
public static final String PREFS_KEY_OPTIMIZE_TRIP = "optimize_trip"; public static final String PREFS_KEY_OPTIMIZE_TRIP = "optimize_trip";
public static final String PREFS_KEY_WALK_SPEED = "walk_speed"; public static final String PREFS_KEY_WALK_SPEED = "walk_speed";

View file

@ -54,7 +54,6 @@ import de.schildbach.oeffi.preference.AboutFragment;
import de.schildbach.oeffi.preference.DonateFragment; import de.schildbach.oeffi.preference.DonateFragment;
import de.schildbach.oeffi.preference.PreferenceActivity; import de.schildbach.oeffi.preference.PreferenceActivity;
import de.schildbach.oeffi.stations.StationsActivity; import de.schildbach.oeffi.stations.StationsActivity;
import de.schildbach.oeffi.util.ChangelogDialogBuilder;
import de.schildbach.oeffi.util.DialogBuilder; import de.schildbach.oeffi.util.DialogBuilder;
import de.schildbach.oeffi.util.DividerItemDecoration; import de.schildbach.oeffi.util.DividerItemDecoration;
import de.schildbach.oeffi.util.Downloader; import de.schildbach.oeffi.util.Downloader;
@ -98,7 +97,6 @@ public abstract class OeffiMainActivity extends OeffiActivity {
private final Handler handler = new Handler(); private final Handler handler = new Handler();
private static final int DIALOG_NEW_VERSION = 101;
private static final int DIALOG_MESSAGE = 102; private static final int DIALOG_MESSAGE = 102;
private static final Logger log = LoggerFactory.getLogger(OeffiMainActivity.class); private static final Logger log = LoggerFactory.getLogger(OeffiMainActivity.class);
@ -123,11 +121,6 @@ public abstract class OeffiMainActivity extends OeffiActivity {
downloadAndProcessMessages(prefsGetNetwork()); downloadAndProcessMessages(prefsGetNetwork());
} else if (versionCode != lastVersionCode) { } else if (versionCode != lastVersionCode) {
prefs.edit().putInt(Constants.PREFS_KEY_LAST_VERSION, versionCode).commit(); prefs.edit().putInt(Constants.PREFS_KEY_LAST_VERSION, versionCode).commit();
if (versionCode > lastVersionCode) {
if (lastVersionCode > 0 && prefs.getBoolean(Constants.PREFS_KEY_SHOW_CHANGELOG, true))
showDialog(DIALOG_NEW_VERSION);
}
} else { } else {
downloadAndProcessMessages(prefsGetNetwork()); downloadAndProcessMessages(prefsGetNetwork());
} }
@ -349,9 +342,6 @@ public abstract class OeffiMainActivity extends OeffiActivity {
@Override @Override
protected Dialog onCreateDialog(final int id, final Bundle bundle) { protected Dialog onCreateDialog(final int id, final Bundle bundle) {
switch (id) { switch (id) {
case DIALOG_NEW_VERSION:
return ChangelogDialogBuilder.get(this, versionCode, applicationVersionName(), applicationVersionFlavor(),
lastVersionCode, taskName()).create();
case DIALOG_MESSAGE: case DIALOG_MESSAGE:
return messageDialog(bundle); return messageDialog(bundle);
} }

View file

@ -26,7 +26,6 @@ import androidx.annotation.Nullable;
import de.schildbach.oeffi.Application; import de.schildbach.oeffi.Application;
import de.schildbach.oeffi.Constants; import de.schildbach.oeffi.Constants;
import de.schildbach.oeffi.R; import de.schildbach.oeffi.R;
import de.schildbach.oeffi.util.ChangelogDialogBuilder;
public class AboutFragment extends PreferenceFragment { public class AboutFragment extends PreferenceFragment {
private static final String KEY_ABOUT_VERSION = "about_version"; private static final String KEY_ABOUT_VERSION = "about_version";
@ -52,10 +51,8 @@ public class AboutFragment extends PreferenceFragment {
final Uri marketUri = Uri.parse(String.format(Constants.MARKET_APP_URL, application.getPackageName())); final Uri marketUri = Uri.parse(String.format(Constants.MARKET_APP_URL, application.getPackageName()));
findPreference(KEY_ABOUT_MARKET_APP).setSummary(marketUri.toString()); findPreference(KEY_ABOUT_MARKET_APP).setSummary(marketUri.toString());
findPreference(KEY_ABOUT_MARKET_APP).setIntent(new Intent(Intent.ACTION_VIEW, marketUri)); findPreference(KEY_ABOUT_MARKET_APP).setIntent(new Intent(Intent.ACTION_VIEW, marketUri));
findPreference(KEY_ABOUT_CHANGELOG).setOnPreferenceClickListener(preference -> { final Uri changelogUri = Uri.parse(activity.getString(R.string.about_changelog_summary));
ChangelogDialogBuilder.get(activity, Application.versionCode(application), null, findPreference(KEY_ABOUT_CHANGELOG).setSummary(changelogUri.toString());
Application.versionFlavor(application), 0, null).show(); findPreference(KEY_ABOUT_CHANGELOG).setIntent(new Intent(Intent.ACTION_VIEW, changelogUri));
return true;
});
} }
} }

View file

@ -1,80 +0,0 @@
/*
* Copyright the original author or authors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.schildbach.oeffi.util;
import android.app.AlertDialog;
import android.content.Context;
import android.os.Build;
import android.view.LayoutInflater;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import androidx.annotation.Nullable;
import de.schildbach.oeffi.Constants;
import de.schildbach.oeffi.R;
import okhttp3.HttpUrl;
public class ChangelogDialogBuilder extends AlertDialog.Builder {
public static ChangelogDialogBuilder get(final Context context, final int versionCode, final String versionName,
final String versionFlavor, final int lastVersionCode, @Nullable final String task) {
return new ChangelogDialogBuilder(context, Constants.ALERT_DIALOG_THEME, versionCode, versionName,
versionFlavor, lastVersionCode, task);
}
private ChangelogDialogBuilder(final Context context, final int theme, final int versionCode,
final String versionName, final String versionFlavor, final int lastVersionCode,
@Nullable final String task) {
super(context, theme);
init(context, versionCode, versionName, versionFlavor, lastVersionCode, task);
}
private void init(final Context context, final int versionCode, final String versionName,
final String versionFlavor, final int lastVersionCode, @Nullable final String task) {
final LayoutInflater inflater = LayoutInflater.from(context);
final View view = inflater.inflate(R.layout.changelog_dialog, null);
final View progressView = view.findViewById(R.id.changelog_dialog_progress);
final WebView webView = (WebView) view.findViewById(R.id.changelog_dialog_webview);
webView.setWebChromeClient(new WebChromeClient() {
@Override
public void onProgressChanged(final WebView view, final int progress) {
if (progress == 100)
progressView.setVisibility(View.GONE);
}
});
webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
final HttpUrl.Builder url = HttpUrl.parse(context.getString(R.string.about_changelog_summary)).newBuilder();
url.addQueryParameter("version", Integer.toString(versionCode));
if (lastVersionCode > 0)
url.addQueryParameter("lastVersion", Integer.toString(lastVersionCode));
if (versionFlavor != null)
url.addEncodedQueryParameter("flavor", versionFlavor);
url.addQueryParameter("sdk", Integer.toString(Build.VERSION.SDK_INT));
if (task != null)
url.addEncodedQueryParameter("task", task);
webView.loadUrl(url.build().toString());
setIcon(R.mipmap.ic_oeffi_stations_color_48dp);
setTitle((versionName != null ? context.getString(R.string.changelog_dialog_title_version, versionName) + '\n'
: "") + context.getString(R.string.changelog_dialog_title));
setView(view);
setPositiveButton(context.getString(R.string.changelog_dialog_button_dismiss),
(dialog, id) -> dialog.dismiss());
}
}