diff --git a/src/main/java/eu/siacs/conversations/ui/AboutActivity.java b/src/main/java/eu/siacs/conversations/ui/AboutActivity.java
index f5ac23654..13d87c78d 100644
--- a/src/main/java/eu/siacs/conversations/ui/AboutActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/AboutActivity.java
@@ -5,6 +5,7 @@ import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import eu.siacs.conversations.R;
+import eu.siacs.conversations.utils.ThemeHelper;
import static eu.siacs.conversations.ui.XmppActivity.configureActionBar;
@@ -14,10 +15,7 @@ public class AboutActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- Boolean dark = PreferenceManager.getDefaultSharedPreferences(getApplicationContext())
- .getString("theme", "light").equals("dark");
- int mTheme = dark ? R.style.ConversationsTheme_Dark : R.style.ConversationsTheme;
- setTheme(mTheme);
+ setTheme(ThemeHelper.find(this));
setContentView(R.layout.activity_about);
setSupportActionBar(findViewById(R.id.toolbar));
diff --git a/src/main/java/eu/siacs/conversations/ui/MemorizingActivity.java b/src/main/java/eu/siacs/conversations/ui/MemorizingActivity.java
index 7ff8605b3..556ed760c 100644
--- a/src/main/java/eu/siacs/conversations/ui/MemorizingActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/MemorizingActivity.java
@@ -40,6 +40,7 @@ import java.util.logging.Logger;
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.MTMDecision;
import eu.siacs.conversations.services.MemorizingTrustManager;
+import eu.siacs.conversations.utils.ThemeHelper;
public class MemorizingActivity extends AppCompatActivity implements OnClickListener, OnCancelListener {
@@ -52,7 +53,7 @@ public class MemorizingActivity extends AppCompatActivity implements OnClickList
@Override
public void onCreate(Bundle savedInstanceState) {
LOGGER.log(Level.FINE, "onCreate");
- setTheme(findTheme());
+ setTheme(ThemeHelper.find(this));
super.onCreate(savedInstanceState);
getLayoutInflater().inflate(R.layout.toolbar, findViewById(android.R.id.content));
setSupportActionBar(findViewById(R.id.toolbar));
@@ -89,15 +90,6 @@ public class MemorizingActivity extends AppCompatActivity implements OnClickList
finish();
}
- protected int findTheme() {
- return getPreferences().getString(SettingsActivity.THEME, getResources().getString(R.string.theme)).equals("dark") ? R.style.ConversationsTheme_Dark : R.style.ConversationsTheme;
- }
-
- protected SharedPreferences getPreferences() {
- return PreferenceManager
- .getDefaultSharedPreferences(getApplicationContext());
- }
-
// react on AlertDialog button press
public void onClick(DialogInterface dialog, int btnId) {
int decision;
diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
index 5093eefcb..3e7ae1b63 100644
--- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java
@@ -71,6 +71,7 @@ import eu.siacs.conversations.services.XmppConnectionService.XmppConnectionBinde
import eu.siacs.conversations.ui.util.MenuDoubleTabUtil;
import eu.siacs.conversations.ui.util.PresenceSelector;
import eu.siacs.conversations.utils.ExceptionHelper;
+import eu.siacs.conversations.utils.ThemeHelper;
import eu.siacs.conversations.xmpp.OnKeyStatusUpdated;
import eu.siacs.conversations.xmpp.OnUpdateBlocklist;
import rocks.xmpp.addr.Jid;
@@ -845,13 +846,7 @@ public abstract class XmppActivity extends AppCompatActivity {
}
protected int findTheme() {
- Boolean dark = getPreferences().getString(SettingsActivity.THEME, getResources().getString(R.string.theme)).equals("dark");
-
- if (dark) {
- return R.style.ConversationsTheme_Dark;
- } else {
- return R.style.ConversationsTheme;
- }
+ return ThemeHelper.find(this);
}
@Override
diff --git a/src/main/java/eu/siacs/conversations/utils/ThemeHelper.java b/src/main/java/eu/siacs/conversations/utils/ThemeHelper.java
new file mode 100644
index 000000000..534e63608
--- /dev/null
+++ b/src/main/java/eu/siacs/conversations/utils/ThemeHelper.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2018, Daniel Gultsch All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution.
+ *
+ * 3. Neither the name of the copyright holder nor the names of its contributors
+ * may be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package eu.siacs.conversations.utils;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.content.res.Resources;
+import android.preference.PreferenceManager;
+
+import eu.siacs.conversations.R;
+import eu.siacs.conversations.ui.SettingsActivity;
+
+public class ThemeHelper {
+
+ public static int find(Context context) {
+ final SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
+ final Resources resources = context.getResources();
+ final boolean dark = sharedPreferences.getString(SettingsActivity.THEME, resources.getString(R.string.theme)).equals("dark");
+ final String fontSize = sharedPreferences.getString("font_size", resources.getString(R.string.default_font_size));
+ switch (fontSize) {
+ case "medium":
+ return dark ? R.style.ConversationsTheme_Dark_Medium : R.style.ConversationsTheme_Medium;
+ case "large":
+ return dark ? R.style.ConversationsTheme_Dark_Large : R.style.ConversationsTheme_Large;
+ default:
+ return dark ? R.style.ConversationsTheme_Dark : R.style.ConversationsTheme;
+ }
+ }
+}
diff --git a/src/main/res/values/arrays.xml b/src/main/res/values/arrays.xml
index bb54e779a..86be2ee97 100644
--- a/src/main/res/values/arrays.xml
+++ b/src/main/res/values/arrays.xml
@@ -100,6 +100,14 @@
- @string/default_on
- @string/default_off
- On by default
- Off by default
+
+ - small
+ - medium
+ - large
+
+
+ - @string/small
+ - @string/medium
+ - @string/large
+
diff --git a/src/main/res/values/defaults.xml b/src/main/res/values/defaults.xml
index c21999c39..ab306ea0e 100644
--- a/src/main/res/values/defaults.xml
+++ b/src/main/res/values/defaults.xml
@@ -43,4 +43,5 @@
true
true
default_on
+ small
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 549c1bc79..823f527d3 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -349,7 +349,7 @@
Could not verify fingerprint
Manually verify
Are you sure that you want to verify your contact’s OTR fingerprint?
- Show dynamic tags
+ Dynamic Tags
Display read-only tags underneath contacts
Enable notifications
No group chat server found
@@ -739,4 +739,11 @@
OMEMO will always be used for one-on-one and private group chats.
OMEMO will be used by default for new conversations.
OMEMO will have to be turned on explicitly for new conversations.
+ Font Size
+ The relative font size used within the app.
+ On by default
+ Off by default
+ Small
+ Medium
+ Large
diff --git a/src/main/res/values/themes.xml b/src/main/res/values/themes.xml
index 9a8a70eea..0c3ba74da 100644
--- a/src/main/res/values/themes.xml
+++ b/src/main/res/values/themes.xml
@@ -167,6 +167,50 @@
- @drawable/ic_new_releases_white_24dp
+
+
+
+
+
+
+
+