Fix broken preferences
This commit is contained in:
parent
c446e4bd02
commit
b3c825339f
|
@ -233,7 +233,7 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, HasAndroidInje
|
||||||
.getBoolean("enableSwipeForTabs", true)
|
.getBoolean("enableSwipeForTabs", true)
|
||||||
viewPager.isUserInputEnabled = uswSwipeForTabs
|
viewPager.isUserInputEnabled = uswSwipeForTabs
|
||||||
|
|
||||||
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean("viewPagerOffScreenLimit", false)) {
|
if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(PrefKeys.VIEW_PAGER_OFF_SCREEN_LIMIT, false)) {
|
||||||
viewPager.offscreenPageLimit = 9
|
viewPager.offscreenPageLimit = 9
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,10 +20,10 @@ import androidx.preference.Preference
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
import androidx.preference.SwitchPreference
|
import androidx.preference.SwitchPreference
|
||||||
import com.keylesspalace.tusky.R
|
import com.keylesspalace.tusky.R
|
||||||
import com.keylesspalace.tusky.db.AccountManager
|
|
||||||
import com.keylesspalace.tusky.di.Injectable
|
|
||||||
import com.keylesspalace.tusky.components.compose.ComposeActivity
|
import com.keylesspalace.tusky.components.compose.ComposeActivity
|
||||||
import com.keylesspalace.tusky.components.compose.ComposeActivity.ComposeOptions
|
import com.keylesspalace.tusky.components.compose.ComposeActivity.ComposeOptions
|
||||||
|
import com.keylesspalace.tusky.db.AccountManager
|
||||||
|
import com.keylesspalace.tusky.di.Injectable
|
||||||
import com.keylesspalace.tusky.entity.Notification
|
import com.keylesspalace.tusky.entity.Notification
|
||||||
import com.keylesspalace.tusky.settings.*
|
import com.keylesspalace.tusky.settings.*
|
||||||
import com.keylesspalace.tusky.util.ThemeUtils
|
import com.keylesspalace.tusky.util.ThemeUtils
|
||||||
|
@ -128,7 +128,6 @@ class PreferencesFragment : PreferenceFragmentCompat(), Injectable {
|
||||||
setTitle(R.string.pref_title_bot_overlay)
|
setTitle(R.string.pref_title_bot_overlay)
|
||||||
isSingleLineTitle = false
|
isSingleLineTitle = false
|
||||||
setIcon(R.drawable.ic_bot_24dp)
|
setIcon(R.drawable.ic_bot_24dp)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switchPreference {
|
switchPreference {
|
||||||
|
@ -157,14 +156,6 @@ class PreferencesFragment : PreferenceFragmentCompat(), Injectable {
|
||||||
key = PrefKeys.SHOW_NOTIFICATIONS_FILTER
|
key = PrefKeys.SHOW_NOTIFICATIONS_FILTER
|
||||||
setTitle(R.string.pref_title_show_notifications_filter)
|
setTitle(R.string.pref_title_show_notifications_filter)
|
||||||
isSingleLineTitle = false
|
isSingleLineTitle = false
|
||||||
setOnPreferenceClickListener {
|
|
||||||
activity?.let { activity ->
|
|
||||||
val intent = PreferencesActivity.newIntent(activity, PreferencesActivity.TAB_FILTER_PREFERENCES)
|
|
||||||
activity.startActivity(intent)
|
|
||||||
activity.overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left)
|
|
||||||
}
|
|
||||||
true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switchPreference {
|
switchPreference {
|
||||||
|
@ -285,8 +276,16 @@ class PreferencesFragment : PreferenceFragmentCompat(), Injectable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
preferenceCategory(R.string.pref_title_experimental) {
|
||||||
|
switchPreference {
|
||||||
|
title = getString(R.string.pref_title_experimental_viewpager_offscreen)
|
||||||
|
setDefaultValue(false)
|
||||||
|
key = PrefKeys.VIEW_PAGER_OFF_SCREEN_LIMIT
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
preferenceManager.sharedPreferences.let { prefs ->
|
preferenceManager.sharedPreferences.let { prefs ->
|
||||||
prefs.getString("stack_trace", null)?.let { stackTrace ->
|
prefs.getString(PrefKeys.STACK_TRACE, null)?.let { stackTrace ->
|
||||||
preferenceCategory(R.string.pref_title_stacktrace) {
|
preferenceCategory(R.string.pref_title_stacktrace) {
|
||||||
preference {
|
preference {
|
||||||
setTitle(R.string.pref_title_stacktrace_send)
|
setTitle(R.string.pref_title_stacktrace_send)
|
||||||
|
@ -298,11 +297,12 @@ class PreferencesFragment : PreferenceFragmentCompat(), Injectable {
|
||||||
))
|
))
|
||||||
activity.startActivity(intent)
|
activity.startActivity(intent)
|
||||||
prefs.edit()
|
prefs.edit()
|
||||||
.remove("stack_trace")
|
.remove(PrefKeys.STACK_TRACE)
|
||||||
.apply()
|
.apply()
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
key = PrefKeys.SEND_CRASH_REPORT
|
||||||
}
|
}
|
||||||
|
|
||||||
preference {
|
preference {
|
||||||
|
|
|
@ -4,6 +4,10 @@ import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.keylesspalace.tusky.settings.PrefKeys;
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
|
|
||||||
|
@ -20,13 +24,13 @@ public class CustomUncaughtExceptionHandler implements Thread.UncaughtExceptionH
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void uncaughtException(Thread thread, Throwable e) {
|
public void uncaughtException(@NonNull Thread thread, Throwable e) {
|
||||||
StringWriter stringWriter = new StringWriter();
|
StringWriter stringWriter = new StringWriter();
|
||||||
e.printStackTrace(new PrintWriter(stringWriter));
|
e.printStackTrace(new PrintWriter(stringWriter));
|
||||||
String stackTrace = stringWriter.toString();
|
String stackTrace = stringWriter.toString();
|
||||||
|
|
||||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
preferences.edit().putString("stack_trace", stackTrace).apply();
|
preferences.edit().putString(PrefKeys.STACK_TRACE, stackTrace).apply();
|
||||||
|
|
||||||
mDefaultUncaughtExceptionHandler.uncaughtException(thread, e);
|
mDefaultUncaughtExceptionHandler.uncaughtException(thread, e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,7 +172,6 @@
|
||||||
<string name="pref_title_limited_bandwidth_mobile">モバイルネットワークでのみ有効</string>
|
<string name="pref_title_limited_bandwidth_mobile">モバイルネットワークでのみ有効</string>
|
||||||
<string name="pref_title_limited_bandwidth_timeline">トゥート後のタイムラインの自動更新をしない</string>
|
<string name="pref_title_limited_bandwidth_timeline">トゥート後のタイムラインの自動更新をしない</string>
|
||||||
<string name="pref_title_experimental_viewpager_offscreen">ViewPagerのoffscreenPageLimitを増やす</string>
|
<string name="pref_title_experimental_viewpager_offscreen">ViewPagerのoffscreenPageLimitを増やす</string>
|
||||||
<string name="pref_title_experimental_htl_streaming">HTLのストリーミングを利用する</string>
|
|
||||||
<string name="app_them_dark">ダーク</string>
|
<string name="app_them_dark">ダーク</string>
|
||||||
<string name="app_theme_light">ライト</string>
|
<string name="app_theme_light">ライト</string>
|
||||||
<string name="app_theme_black">ブラック</string>
|
<string name="app_theme_black">ブラック</string>
|
||||||
|
@ -467,4 +466,4 @@
|
||||||
<item quantity="other">%s人</item>
|
<item quantity="other">%s人</item>
|
||||||
</plurals>
|
</plurals>
|
||||||
<string name="warning_scheduling_interval">Mastodonにおける予約までの最小間隔は5分です。</string>
|
<string name="warning_scheduling_interval">Mastodonにおける予約までの最小間隔は5分です。</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -252,7 +252,6 @@
|
||||||
<string name="pref_title_limited_bandwidth_timeline">Reduce timeline auto reload after toot</string>
|
<string name="pref_title_limited_bandwidth_timeline">Reduce timeline auto reload after toot</string>
|
||||||
<string name="pref_title_experimental">Experimental Settings</string>
|
<string name="pref_title_experimental">Experimental Settings</string>
|
||||||
<string name="pref_title_experimental_viewpager_offscreen">Increase offscreenPageLimit of ViewPager</string>
|
<string name="pref_title_experimental_viewpager_offscreen">Increase offscreenPageLimit of ViewPager</string>
|
||||||
<string name="pref_title_experimental_htl_streaming">Use home timeline streaming</string>
|
|
||||||
<string name="pref_title_stacktrace">Stacktrace</string>
|
<string name="pref_title_stacktrace">Stacktrace</string>
|
||||||
<string name="pref_title_stacktrace_send">Send crash report to developer</string>
|
<string name="pref_title_stacktrace_send">Send crash report to developer</string>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue