diff --git a/app/src/main/java/app/fedilab/android/activities/AdminAccountActivity.java b/app/src/main/java/app/fedilab/android/activities/AdminAccountActivity.java index 03b16d7d..53059e1a 100644 --- a/app/src/main/java/app/fedilab/android/activities/AdminAccountActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/AdminAccountActivity.java @@ -27,6 +27,7 @@ import android.text.Spanned; import android.text.method.LinkMovementMethod; import android.text.style.ForegroundColorSpan; import android.text.style.UnderlineSpan; +import android.util.TypedValue; import android.view.MenuItem; import android.view.View; import android.widget.TextView; @@ -97,7 +98,9 @@ public class AdminAccountActivity extends BaseActivity { actionBar.setDisplayShowTitleEnabled(false); actionBar.setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(this, R.color.cyanea_primary))); } - + SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this); + float scale = sharedpreferences.getFloat(getString(R.string.SET_FONT_SCALE), 1.1f); + binding.title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18 * 1.1f / scale); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); diff --git a/app/src/main/java/app/fedilab/android/activities/AdminReportActivity.java b/app/src/main/java/app/fedilab/android/activities/AdminReportActivity.java index caa43800..b550df34 100644 --- a/app/src/main/java/app/fedilab/android/activities/AdminReportActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/AdminReportActivity.java @@ -27,6 +27,7 @@ import android.text.Spanned; import android.text.method.LinkMovementMethod; import android.text.style.ForegroundColorSpan; import android.text.style.UnderlineSpan; +import android.util.TypedValue; import android.view.MenuItem; import android.view.View; import android.widget.TextView; @@ -97,7 +98,9 @@ public class AdminReportActivity extends BaseActivity { actionBar.setDisplayShowTitleEnabled(false); actionBar.setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(this, R.color.cyanea_primary))); } - + SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this); + float scale = sharedpreferences.getFloat(getString(R.string.SET_FONT_SCALE), 1.1f); + binding.title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18 * 1.1f / scale); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); diff --git a/app/src/main/java/app/fedilab/android/activities/AnnouncementActivity.java b/app/src/main/java/app/fedilab/android/activities/AnnouncementActivity.java index 8b5e147c..fca3e910 100644 --- a/app/src/main/java/app/fedilab/android/activities/AnnouncementActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/AnnouncementActivity.java @@ -18,12 +18,15 @@ package app.fedilab.android.activities; import static app.fedilab.android.BaseMainActivity.currentInstance; import static app.fedilab.android.BaseMainActivity.emojis; +import android.content.SharedPreferences; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; +import android.util.TypedValue; import android.view.MenuItem; import androidx.appcompat.app.ActionBar; import androidx.core.content.ContextCompat; +import androidx.preference.PreferenceManager; import app.fedilab.android.R; import app.fedilab.android.client.entities.api.EmojiInstance; @@ -57,7 +60,9 @@ public class AnnouncementActivity extends BaseActivity { getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); } - + SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this); + float scale = sharedpreferences.getFloat(getString(R.string.SET_FONT_SCALE), 1.1f); + binding.title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18 * 1.1f / scale); Helper.addFragment(getSupportFragmentManager(), R.id.nav_host_fragment_tags, new FragmentMastodonAnnouncement(), null, null, null); if (emojis == null || !emojis.containsKey(currentInstance)) { new Thread(() -> { diff --git a/app/src/main/java/app/fedilab/android/activities/ComposeActivity.java b/app/src/main/java/app/fedilab/android/activities/ComposeActivity.java index 14ba600f..215fcbec 100644 --- a/app/src/main/java/app/fedilab/android/activities/ComposeActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/ComposeActivity.java @@ -36,6 +36,7 @@ import android.os.Handler; import android.os.Looper; import android.text.Editable; import android.text.TextWatcher; +import android.util.TypedValue; import android.view.Menu; import android.view.MenuItem; import android.view.MotionEvent; @@ -479,6 +480,9 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); } + SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this); + float scale = sharedpreferences.getFloat(getString(R.string.SET_FONT_SCALE), 1.1f); + binding.title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18 * 1.1f / scale); statusList = new ArrayList<>(); Bundle b = getIntent().getExtras(); if (b != null) { @@ -565,7 +569,6 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana } }).start(); } - final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(ComposeActivity.this); if (MainActivity.instanceInfo == null) { String instanceInfo = sharedpreferences.getString(getString(R.string.INSTANCE_INFO) + instance, null); if (instanceInfo != null) { diff --git a/app/src/main/java/app/fedilab/android/activities/ContextActivity.java b/app/src/main/java/app/fedilab/android/activities/ContextActivity.java index 307f6ae0..75def795 100644 --- a/app/src/main/java/app/fedilab/android/activities/ContextActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/ContextActivity.java @@ -24,6 +24,7 @@ import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.os.Handler; import android.os.Looper; +import android.util.TypedValue; import android.view.Menu; import android.view.MenuItem; @@ -67,13 +68,16 @@ public class ContextActivity extends BaseActivity { actionBar.setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(this, R.color.cyanea_primary))); } binding.title.setText(R.string.context_conversation); + SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this); + float scale = sharedpreferences.getFloat(getString(R.string.SET_FONT_SCALE), 1.1f); + binding.title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18 * 1.1f / scale); + if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); } binding.toolbar.setPopupTheme(Helper.popupStyle()); Bundle b = getIntent().getExtras(); - final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(ContextActivity.this); displayCW = sharedpreferences.getBoolean(getString(R.string.SET_EXPAND_CW), false); Status focusedStatus = null; // or other values if (b != null) diff --git a/app/src/main/java/app/fedilab/android/activities/DraftActivity.java b/app/src/main/java/app/fedilab/android/activities/DraftActivity.java index bcf6585f..ccfe83a8 100644 --- a/app/src/main/java/app/fedilab/android/activities/DraftActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/DraftActivity.java @@ -16,10 +16,12 @@ package app.fedilab.android.activities; import static app.fedilab.android.BaseMainActivity.currentAccount; +import android.content.SharedPreferences; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.os.Handler; import android.os.Looper; +import android.util.TypedValue; import android.view.Menu; import android.view.MenuItem; import android.view.View; @@ -30,6 +32,7 @@ import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AlertDialog; import androidx.core.content.ContextCompat; import androidx.lifecycle.ViewModelProvider; +import androidx.preference.PreferenceManager; import androidx.recyclerview.widget.LinearLayoutManager; import java.io.File; @@ -74,6 +77,9 @@ public class DraftActivity extends BaseActivity implements StatusDraftAdapter.Dr } binding.toolbar.setPopupTheme(Helper.popupStyle()); binding.title.setText(R.string.drafts); + SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this); + float scale = sharedpreferences.getFloat(getString(R.string.SET_FONT_SCALE), 1.1f); + binding.title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18 * 1.1f / scale); binding.loader.setVisibility(View.VISIBLE); binding.lvStatus.setVisibility(View.GONE); binding.noAction.setVisibility(View.GONE); diff --git a/app/src/main/java/app/fedilab/android/activities/ProfileActivity.java b/app/src/main/java/app/fedilab/android/activities/ProfileActivity.java index a7892341..b08d35f6 100644 --- a/app/src/main/java/app/fedilab/android/activities/ProfileActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/ProfileActivity.java @@ -33,6 +33,7 @@ import android.text.Spanned; import android.text.method.LinkMovementMethod; import android.text.style.ForegroundColorSpan; import android.text.style.UnderlineSpan; +import android.util.TypedValue; import android.view.Menu; import android.view.MenuItem; import android.view.View; @@ -157,6 +158,9 @@ public class ProfileActivity extends BaseActivity { getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); } + SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this); + float scale = sharedpreferences.getFloat(getString(R.string.SET_FONT_SCALE), 1.1f); + binding.title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18 * 1.1f / scale); binding.toolbar.setPopupTheme(Helper.popupStyle()); accountsVM = new ViewModelProvider(ProfileActivity.this).get(AccountsVM.class); if (account != null) { diff --git a/app/src/main/java/app/fedilab/android/activities/ScheduledActivity.java b/app/src/main/java/app/fedilab/android/activities/ScheduledActivity.java index f01a9e1a..527dd931 100644 --- a/app/src/main/java/app/fedilab/android/activities/ScheduledActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/ScheduledActivity.java @@ -16,13 +16,16 @@ package app.fedilab.android.activities; import static app.fedilab.android.BaseMainActivity.currentAccount; +import android.content.SharedPreferences; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; +import android.util.TypedValue; import android.view.MenuItem; import androidx.annotation.Nullable; import androidx.appcompat.app.ActionBar; import androidx.core.content.ContextCompat; +import androidx.preference.PreferenceManager; import com.google.android.material.tabs.TabLayout; @@ -53,7 +56,9 @@ public class ScheduledActivity extends BaseActivity { getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); } - + SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this); + float scale = sharedpreferences.getFloat(getString(R.string.SET_FONT_SCALE), 1.1f); + binding.title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18 * 1.1f / scale); MastodonHelper.loadPPMastodon(binding.profilePicture, currentAccount.mastodon_account); binding.title.setText(R.string.scheduled); binding.scheduleTablayout.addTab(binding.scheduleTablayout.newTab().setText(getString(R.string.toots_server)));