From 3dfa729579f5ab4a2df4b731d7a2091f6b79d78c Mon Sep 17 00:00:00 2001 From: Floens Date: Thu, 13 Aug 2015 16:36:28 +0200 Subject: [PATCH] Add PreviousVersionHandler to show a message when Clover is updated. The update text will be added when the beta is out. --- .../chan/core/settings/ChanSettings.java | 4 ++ .../chan/ui/activity/StartActivity.java | 4 ++ .../ui/helper/PreviousVersionHandler.java | 42 ++++++++++++ Clover/app/src/main/res/values/strings.xml | 67 +++++++++++-------- 4 files changed, 89 insertions(+), 28 deletions(-) create mode 100644 Clover/app/src/main/java/org/floens/chan/ui/helper/PreviousVersionHandler.java diff --git a/Clover/app/src/main/java/org/floens/chan/core/settings/ChanSettings.java b/Clover/app/src/main/java/org/floens/chan/core/settings/ChanSettings.java index adce6c88..25b58bd6 100644 --- a/Clover/app/src/main/java/org/floens/chan/core/settings/ChanSettings.java +++ b/Clover/app/src/main/java/org/floens/chan/core/settings/ChanSettings.java @@ -101,6 +101,8 @@ public class ChanSettings { public static final BooleanSetting historyEnabled; + public static final IntegerSetting previousVersion; + public static final BooleanSetting proxyEnabled; public static final StringSetting proxyAddress; public static final IntegerSetting proxyPort; @@ -169,6 +171,8 @@ public class ChanSettings { historyEnabled = new BooleanSetting(p, "preference_history_enabled", true); + previousVersion = new IntegerSetting(p, "preference_previous_version", 0); + proxyEnabled = new BooleanSetting(p, "preference_proxy_enabled", false, new Setting.SettingCallback() { @Override public void onValueChange(Setting setting, Boolean value) { diff --git a/Clover/app/src/main/java/org/floens/chan/ui/activity/StartActivity.java b/Clover/app/src/main/java/org/floens/chan/ui/activity/StartActivity.java index cd7db971..74597313 100644 --- a/Clover/app/src/main/java/org/floens/chan/ui/activity/StartActivity.java +++ b/Clover/app/src/main/java/org/floens/chan/ui/activity/StartActivity.java @@ -46,6 +46,7 @@ import org.floens.chan.ui.controller.SplitNavigationController; import org.floens.chan.ui.controller.StyledToolbarNavigationController; import org.floens.chan.ui.controller.ViewThreadController; import org.floens.chan.ui.helper.ImagePickDelegate; +import org.floens.chan.ui.helper.PreviousVersionHandler; import org.floens.chan.ui.state.ChanState; import org.floens.chan.ui.theme.ThemeHelper; import org.floens.chan.utils.AndroidUtils; @@ -162,6 +163,9 @@ public class StartActivity extends AppCompatActivity implements NfcAdapter.Creat if (loadDefault) { browseController.loadBoard(boardManager.getSavedBoards().get(0)); } + + PreviousVersionHandler previousVersionHandler = new PreviousVersionHandler(); + previousVersionHandler.run(this); } public void restart() { diff --git a/Clover/app/src/main/java/org/floens/chan/ui/helper/PreviousVersionHandler.java b/Clover/app/src/main/java/org/floens/chan/ui/helper/PreviousVersionHandler.java new file mode 100644 index 00000000..3d90761c --- /dev/null +++ b/Clover/app/src/main/java/org/floens/chan/ui/helper/PreviousVersionHandler.java @@ -0,0 +1,42 @@ +/* + * Clover - 4chan browser https://github.com/Floens/Clover/ + * Copyright (C) 2014 Floens + * + * 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 . + */ +package org.floens.chan.ui.helper; + +import android.content.Context; +import android.support.v7.app.AlertDialog; +import android.text.Html; + +import org.floens.chan.R; +import org.floens.chan.core.settings.ChanSettings; + +public class PreviousVersionHandler { + private static final int CURRENT_VERSION = 1; + + public void run(Context context) { + if (ChanSettings.previousVersion.get() < CURRENT_VERSION) { + CharSequence message = Html.fromHtml(context.getString(R.string.previous_version_1)); + + new AlertDialog.Builder(context) + .setMessage(message) + .setPositiveButton(R.string.ok, null) + .show(); + + ChanSettings.previousVersion.set(CURRENT_VERSION); + } + } +} diff --git a/Clover/app/src/main/res/values/strings.xml b/Clover/app/src/main/res/values/strings.xml index de5f696f..516ccd4d 100644 --- a/Clover/app/src/main/res/values/strings.xml +++ b/Clover/app/src/main/res/values/strings.xml @@ -18,6 +18,13 @@ along with this program. If not, see . Clover + + Clover was updated + Put recent changes here + ]]> + + Cancel Add Close @@ -140,27 +147,29 @@ along with this program. If not, see . Pick color Filter help - "Filters act on a given pattern and a place to search the pattern.<br> -If the pattern matches then the post can be hidden or highlighted.<br> - -<h4>For tripcodes, names and IDs:</h4> -<p> - It will match the given pattern exact.<br> - <tt>!Ep8pui8Vw2</tt> will match the tripcode <i>!Ep8pui8Vw2</i> but not <i>Ep8pu</i>. -</p> - -<h4>For comments, subjects and filenames:</h4> -<p> - These filters are pattern based, and have three modes:<br> - <br> - 1. The pattern <tt>foo bar</tt> will match text that has any of the words in it. It will match <i>foo</i> or <i>bar</i>, but not <i>foobar</i>. - Placing a * allows any character to be filled in: <tt>f*o</tt> will match both <i>foo</i>, <i>foooo</i> but not <i>foobar</i><br> - <br> - 2. Quoting your pattern with <tt>\"</tt> like <tt>\"foo bar\"</tt> will match the text exact. - <i>foo bar</i> matches but <i>foo</i> does not.<br> - <br> - 3. Regular expressions. <tt>/^>implying/</tt> for example. -</p>" + + If the pattern matches then the post can be hidden or highlighted.
+ +

For tripcodes, names and IDs:

+

+ It will match the given pattern exact.
+ !Ep8pui8Vw2 will match the tripcode !Ep8pui8Vw2 but not Ep8pu. +

+ +

For comments, subjects and filenames:

+

+ These filters are pattern based, and have three modes:
+
+ 1. The pattern foo bar will match text that has any of the words in it. It will match foo or bar, but not foobar. + Placing a * allows any character to be filled in: f*o will match both foo, foooo but not foobar
+
+ 2. Quoting your pattern with \" like \"foo bar\" will match the text exact. + foo bar matches but foo does not.
+
+ 3. Regular expressions. /^>implying/ for example. +

+ ]]>
Tripcode @@ -363,13 +372,15 @@ If the pattern matches then the post can be hidden or highlighted.<br> Logout Loading… Connection error - -"Forgot your 4chan Pass login details?<br> -<a href=\"https://www.4chan.org/pass?reset\">Go here to reset your PIN.</a><<br> -<br> -Don't have a 4chan Pass?<br> -<a href=\"https://www.4chan.org/pass\">Click here to learn more.</a>" - + " + + Go here to reset your PIN.
+
+ Don't have a 4chan Pass?
+ Click here to learn more. + ]]> + "
Using 4chan pass Off