Merge remote-tracking branch 'origin/feature/show_changelog_button' into feature/show_changelog_button

This commit is contained in:
LucasGGamerM
2022-12-25 14:18:59 -03:00
4 changed files with 49 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ package org.joinmastodon.android.fragments;
import android.animation.ObjectAnimator;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Canvas;
@@ -49,6 +50,7 @@ import org.joinmastodon.android.ui.M3AlertDialogBuilder;
import org.joinmastodon.android.ui.OutlineProviders;
import org.joinmastodon.android.ui.utils.UiUtils;
import org.joinmastodon.android.updater.GithubSelfUpdater;
import org.w3c.dom.Text;
import java.util.ArrayList;
import java.util.function.Consumer;
@@ -185,6 +187,9 @@ public class SettingsFragment extends MastodonToolbarFragment{
checkForUpdateItem = new TextItem(R.string.sk_check_for_update, GithubSelfUpdater.getInstance()::checkForUpdates);
items.add(checkForUpdateItem);
}
// TODO fix this up tomorrow, by probably just making another method for chacking and displaying the new changelog
items.add(new TextItem(R.string.sk_get_changelog, this::onGetChangelogClick));
items.add(new TextItem(R.string.sk_settings_contribute, ()->UiUtils.launchWebBrowser(getActivity(), "https://github.com/LucasGGamerM/moshidon")));
items.add(new TextItem(R.string.settings_clear_cache, this::clearImageCache));
items.add(new TextItem(R.string.sk_clear_recent_languages, ()->UiUtils.showConfirmationAlert(getActivity(), R.string.sk_clear_recent_languages, R.string.sk_confirm_clear_recent_languages, R.string.clear, ()->{
@@ -262,6 +267,12 @@ public class SettingsFragment extends MastodonToolbarFragment{
E.unregister(this);
}
private void onGetChangelogClick(){
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getContext());
alertDialogBuilder.setTitle("Something TODO remove this");
alertDialogBuilder.setMessage(GithubSelfUpdater.getInstance().getChangelog());
}
private void onThemePreferenceClick(GlobalUserPreferences.ThemePreference theme){
GlobalUserPreferences.theme=theme;
GlobalUserPreferences.save();

View File

@@ -39,6 +39,8 @@ public abstract class GithubSelfUpdater{
public abstract void cancelDownload();
public abstract String getChangelog();
public abstract void handleIntentFromInstaller(Intent intent, Activity activity);
public enum UpdateState{

View File

@@ -89,4 +89,5 @@
<string name="sk_reblog_with_visibility">Reblog with visibility</string>
<string name="sk_quote_post">Post about this</string>
<string name="sk_hashtags_you_follow">Hashtags you follow</string>
<string name="sk_get_changelog">Get changelog</string>
</resources>