Add PreviousVersionHandler to show a message when Clover is updated.

The update text will be added when the beta is out.
multisite
Floens 10 years ago
parent e38d47a47c
commit 3dfa729579
  1. 4
      Clover/app/src/main/java/org/floens/chan/core/settings/ChanSettings.java
  2. 4
      Clover/app/src/main/java/org/floens/chan/ui/activity/StartActivity.java
  3. 42
      Clover/app/src/main/java/org/floens/chan/ui/helper/PreviousVersionHandler.java
  4. 67
      Clover/app/src/main/res/values/strings.xml

@ -101,6 +101,8 @@ public class ChanSettings {
public static final BooleanSetting historyEnabled; public static final BooleanSetting historyEnabled;
public static final IntegerSetting previousVersion;
public static final BooleanSetting proxyEnabled; public static final BooleanSetting proxyEnabled;
public static final StringSetting proxyAddress; public static final StringSetting proxyAddress;
public static final IntegerSetting proxyPort; public static final IntegerSetting proxyPort;
@ -169,6 +171,8 @@ public class ChanSettings {
historyEnabled = new BooleanSetting(p, "preference_history_enabled", true); 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<Boolean>() { proxyEnabled = new BooleanSetting(p, "preference_proxy_enabled", false, new Setting.SettingCallback<Boolean>() {
@Override @Override
public void onValueChange(Setting setting, Boolean value) { public void onValueChange(Setting setting, Boolean value) {

@ -46,6 +46,7 @@ import org.floens.chan.ui.controller.SplitNavigationController;
import org.floens.chan.ui.controller.StyledToolbarNavigationController; import org.floens.chan.ui.controller.StyledToolbarNavigationController;
import org.floens.chan.ui.controller.ViewThreadController; import org.floens.chan.ui.controller.ViewThreadController;
import org.floens.chan.ui.helper.ImagePickDelegate; 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.state.ChanState;
import org.floens.chan.ui.theme.ThemeHelper; import org.floens.chan.ui.theme.ThemeHelper;
import org.floens.chan.utils.AndroidUtils; import org.floens.chan.utils.AndroidUtils;
@ -162,6 +163,9 @@ public class StartActivity extends AppCompatActivity implements NfcAdapter.Creat
if (loadDefault) { if (loadDefault) {
browseController.loadBoard(boardManager.getSavedBoards().get(0)); browseController.loadBoard(boardManager.getSavedBoards().get(0));
} }
PreviousVersionHandler previousVersionHandler = new PreviousVersionHandler();
previousVersionHandler.run(this);
} }
public void restart() { public void restart() {

@ -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 <http://www.gnu.org/licenses/>.
*/
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);
}
}
}

@ -18,6 +18,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<resources> <resources>
<string name="app_name">Clover</string> <string name="app_name">Clover</string>
<string name="previous_version_1">
<![CDATA[
<h3>Clover was updated</h3>
Put recent changes here
]]>
</string>
<string name="cancel">Cancel</string> <string name="cancel">Cancel</string>
<string name="add">Add</string> <string name="add">Add</string>
<string name="close">Close</string> <string name="close">Close</string>
@ -140,27 +147,29 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<string name="filter_color_pick">Pick color</string> <string name="filter_color_pick">Pick color</string>
<string name="filter_help_title">Filter help</string> <string name="filter_help_title">Filter help</string>
<string name="filter_help"> <string name="filter_help">
"Filters act on a given pattern and a place to search the pattern.&lt;br> <![CDATA[
If the pattern matches then the post can be hidden or highlighted.&lt;br> 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>
&lt;h4>For tripcodes, names and IDs:&lt;/h4>
&lt;p> <h4>For tripcodes, names and IDs:</h4>
It will match the given pattern exact.&lt;br> <p>
&lt;tt>!Ep8pui8Vw2&lt;/tt> will match the tripcode &lt;i>!Ep8pui8Vw2&lt;/i> but not &lt;i>Ep8pu&lt;/i>. It will match the given pattern exact.<br>
&lt;/p> <tt>!Ep8pui8Vw2</tt> will match the tripcode <i>!Ep8pui8Vw2</i> but not <i>Ep8pu</i>.
</p>
&lt;h4>For comments, subjects and filenames:&lt;/h4>
&lt;p> <h4>For comments, subjects and filenames:</h4>
These filters are pattern based, and have three modes:&lt;br> <p>
&lt;br> These filters are pattern based, and have three modes:<br>
1. The pattern &lt;tt>foo bar&lt;/tt> will match text that has any of the words in it. It will match &lt;i>foo&lt;/i> or &lt;i>bar&lt;/i>, but not &lt;i>foobar&lt;/i>. <br>
Placing a * allows any character to be filled in: &lt;tt>f*o&lt;/tt> will match both &lt;i>foo&lt;/i>, &lt;i>foooo&lt;/i> but not &lt;i>foobar&lt;/i>&lt;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>.
&lt;br> 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>
2. Quoting your pattern with &lt;tt>\"&lt;/tt> like &lt;tt>\"foo bar\"&lt;/tt> will match the text exact. <br>
&lt;i>foo bar&lt;/i> matches but &lt;i>foo&lt;/i> does not.&lt;br> 2. Quoting your pattern with <tt>\"</tt> like <tt>\"foo bar\"</tt> will match the text exact.
&lt;br> <i>foo bar</i> matches but <i>foo</i> does not.<br>
3. Regular expressions. &lt;tt>/^>implying/&lt;/tt> for example. <br>
&lt;/p>" 3. Regular expressions. <tt>/^>implying/</tt> for example.
</p>
]]>
</string> </string>
<string name="filter_tripcode">Tripcode</string> <string name="filter_tripcode">Tripcode</string>
@ -363,13 +372,15 @@ If the pattern matches then the post can be hidden or highlighted.&lt;br>
<string name="setting_pass_logout">Logout</string> <string name="setting_pass_logout">Logout</string>
<string name="setting_pass_logging_in">Loading&#8230;</string> <string name="setting_pass_logging_in">Loading&#8230;</string>
<string name="setting_pass_error">Connection error</string> <string name="setting_pass_error">Connection error</string>
<string name="setting_pass_bottom_description"> <string name="setting_pass_bottom_description">"
"Forgot your 4chan Pass login details?&lt;br> <![CDATA[
&lt;a href=\"https://www.4chan.org/pass?reset\">Go here to reset your PIN.&lt;/a>&lt;&lt;br> Forgot your 4chan Pass login details?<br>
&lt;br> <a href=\"https://www.4chan.org/pass?reset\">Go here to reset your PIN.</a><br>
Don't have a 4chan Pass?&lt;br> <br>
&lt;a href=\"https://www.4chan.org/pass\">Click here to learn more.&lt;/a>" Don't have a 4chan Pass?<br>
</string> <a href=\"https://www.4chan.org/pass\">Click here to learn more.</a>
]]>
"</string>
<string name="setting_pass_summary_enabled">Using 4chan pass</string> <string name="setting_pass_summary_enabled">Using 4chan pass</string>
<string name="setting_pass_summary_disabled">Off</string> <string name="setting_pass_summary_disabled">Off</string>

Loading…
Cancel
Save