change handling of font size, introduce font size setting
This commit is contained in:
parent
8f8d49f421
commit
bf4d0bb722
25 changed files with 208 additions and 83 deletions
|
|
@ -15,8 +15,6 @@
|
|||
|
||||
package com.keylesspalace.tusky;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
|
|
@ -46,9 +44,7 @@ import okhttp3.logging.HttpLoggingInterceptor;
|
|||
import retrofit2.Retrofit;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
|
||||
@SuppressLint("Registered")
|
||||
public class BaseActivity extends AppCompatActivity {
|
||||
protected static final int SERVICE_REQUEST_CODE = 8574603; // This number is arbitrary.
|
||||
public abstract class BaseActivity extends AppCompatActivity {
|
||||
|
||||
public MastodonApi mastodonApi;
|
||||
protected Dispatcher mastodonApiDispatcher;
|
||||
|
|
@ -60,12 +56,30 @@ public class BaseActivity extends AppCompatActivity {
|
|||
redirectIfNotLoggedIn();
|
||||
createMastodonApi();
|
||||
|
||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
|
||||
/* There isn't presently a way to globally change the theme of a whole application at
|
||||
* runtime, just individual activities. So, each activity has to set its theme before any
|
||||
* views are created. */
|
||||
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("lightTheme", false)) {
|
||||
if (preferences.getBoolean("lightTheme", false)) {
|
||||
setTheme(R.style.AppTheme_Light);
|
||||
}
|
||||
|
||||
int style;
|
||||
switch(preferences.getString("statusTextSize", "small")) {
|
||||
case "large":
|
||||
style = R.style.TextSizeLarge;
|
||||
break;
|
||||
case "medium":
|
||||
style = R.style.TextSizeMedium;
|
||||
break;
|
||||
case "small":
|
||||
default:
|
||||
style = R.style.TextSizeSmall;
|
||||
break;
|
||||
}
|
||||
getTheme().applyStyle(style, false);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue