Merge branch 'develop' into prompt_to_save_before_leaving_changed_profile
This commit is contained in:
commit
2d52ab9072
|
@ -56,6 +56,8 @@ import java.util.List;
|
|||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static com.keylesspalace.tusky.settings.PrefKeys.APP_THEME;
|
||||
|
||||
public abstract class BaseActivity extends AppCompatActivity implements Injectable {
|
||||
private static final String TAG = "BaseActivity";
|
||||
|
||||
|
@ -74,7 +76,7 @@ public abstract class BaseActivity extends AppCompatActivity implements Injectab
|
|||
/* 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. */
|
||||
String theme = preferences.getString("appTheme", ThemeUtils.APP_THEME_DEFAULT);
|
||||
String theme = preferences.getString(APP_THEME, ThemeUtils.APP_THEME_DEFAULT);
|
||||
Log.d("activeTheme", theme);
|
||||
if (theme.equals("black")) {
|
||||
setTheme(R.style.TuskyBlackTheme);
|
||||
|
|
|
@ -25,10 +25,13 @@ import androidx.work.WorkManager
|
|||
import autodispose2.AutoDisposePlugins
|
||||
import com.keylesspalace.tusky.components.notifications.NotificationHelper
|
||||
import com.keylesspalace.tusky.di.AppInjector
|
||||
import com.keylesspalace.tusky.settings.NEW_INSTALL_SCHEMA_VERSION
|
||||
import com.keylesspalace.tusky.settings.PrefKeys
|
||||
import com.keylesspalace.tusky.settings.PrefKeys.APP_THEME
|
||||
import com.keylesspalace.tusky.settings.SCHEMA_VERSION
|
||||
import com.keylesspalace.tusky.util.APP_THEME_DEFAULT
|
||||
import com.keylesspalace.tusky.util.LocaleManager
|
||||
import com.keylesspalace.tusky.util.THEME_NIGHT
|
||||
import com.keylesspalace.tusky.util.setAppNightMode
|
||||
import com.keylesspalace.tusky.worker.PruneCacheWorker
|
||||
import com.keylesspalace.tusky.worker.WorkerFactory
|
||||
|
@ -76,7 +79,7 @@ class TuskyApplication : Application(), HasAndroidInjector {
|
|||
AppInjector.init(this)
|
||||
|
||||
// Migrate shared preference keys and defaults from version to version.
|
||||
val oldVersion = sharedPreferences.getInt(PrefKeys.SCHEMA_VERSION, 0)
|
||||
val oldVersion = sharedPreferences.getInt(PrefKeys.SCHEMA_VERSION, NEW_INSTALL_SCHEMA_VERSION)
|
||||
if (oldVersion != SCHEMA_VERSION) {
|
||||
upgradeSharedPreferences(oldVersion, SCHEMA_VERSION)
|
||||
}
|
||||
|
@ -87,7 +90,7 @@ class TuskyApplication : Application(), HasAndroidInjector {
|
|||
EmojiPackHelper.init(this, DefaultEmojiPackList.get(this), allowPackImports = false)
|
||||
|
||||
// init night mode
|
||||
val theme = sharedPreferences.getString("appTheme", APP_THEME_DEFAULT)
|
||||
val theme = sharedPreferences.getString(APP_THEME, APP_THEME_DEFAULT)
|
||||
setAppNightMode(theme)
|
||||
|
||||
localeManager.setLocale()
|
||||
|
@ -136,6 +139,14 @@ class TuskyApplication : Application(), HasAndroidInjector {
|
|||
editor.remove(PrefKeys.Deprecated.SHOW_NOTIFICATIONS_FILTER)
|
||||
}
|
||||
|
||||
if (oldVersion != NEW_INSTALL_SCHEMA_VERSION && oldVersion < 2023082301) {
|
||||
// Default value for appTheme is now THEME_SYSTEM. If the user is upgrading and
|
||||
// didn't have an explicit preference set use the previous default, so the
|
||||
// theme does not unexpectedly change.
|
||||
if (!sharedPreferences.contains(APP_THEME)) {
|
||||
editor.putString(APP_THEME, THEME_NIGHT)
|
||||
}
|
||||
}
|
||||
editor.putInt(PrefKeys.SCHEMA_VERSION, newVersion)
|
||||
editor.apply()
|
||||
}
|
||||
|
|
|
@ -94,6 +94,7 @@ import com.keylesspalace.tusky.entity.Emoji
|
|||
import com.keylesspalace.tusky.entity.NewPoll
|
||||
import com.keylesspalace.tusky.entity.Status
|
||||
import com.keylesspalace.tusky.settings.PrefKeys
|
||||
import com.keylesspalace.tusky.settings.PrefKeys.APP_THEME
|
||||
import com.keylesspalace.tusky.util.APP_THEME_DEFAULT
|
||||
import com.keylesspalace.tusky.util.MentionSpan
|
||||
import com.keylesspalace.tusky.util.PickMediaFiles
|
||||
|
@ -208,7 +209,7 @@ class ComposeActivity :
|
|||
|
||||
activeAccount = accountManager.activeAccount ?: return
|
||||
|
||||
val theme = preferences.getString("appTheme", APP_THEME_DEFAULT)
|
||||
val theme = preferences.getString(APP_THEME, APP_THEME_DEFAULT)
|
||||
if (theme == "black") {
|
||||
setTheme(R.style.TuskyDialogActivityBlackTheme)
|
||||
}
|
||||
|
|
|
@ -238,7 +238,7 @@ public class NotificationHelper {
|
|||
Bundle extras = new Bundle();
|
||||
// Add the sending account's name, so it can be used when summarising this notification
|
||||
extras.putString(EXTRA_ACCOUNT_NAME, body.getAccount().getName());
|
||||
extras.putString(EXTRA_NOTIFICATION_TYPE, body.getType().toString());
|
||||
extras.putSerializable(EXTRA_NOTIFICATION_TYPE, body.getType());
|
||||
builder.addExtras(extras);
|
||||
|
||||
// Only alert for the first notification of a batch to avoid multiple alerts at once
|
||||
|
|
|
@ -34,6 +34,7 @@ import com.keylesspalace.tusky.appstore.EventHub
|
|||
import com.keylesspalace.tusky.appstore.PreferenceChangedEvent
|
||||
import com.keylesspalace.tusky.databinding.ActivityPreferencesBinding
|
||||
import com.keylesspalace.tusky.settings.PrefKeys
|
||||
import com.keylesspalace.tusky.settings.PrefKeys.APP_THEME
|
||||
import com.keylesspalace.tusky.util.APP_THEME_DEFAULT
|
||||
import com.keylesspalace.tusky.util.getNonNullString
|
||||
import com.keylesspalace.tusky.util.setAppNightMode
|
||||
|
@ -145,8 +146,8 @@ class PreferencesActivity :
|
|||
|
||||
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences, key: String) {
|
||||
when (key) {
|
||||
"appTheme" -> {
|
||||
val theme = sharedPreferences.getNonNullString("appTheme", APP_THEME_DEFAULT)
|
||||
APP_THEME -> {
|
||||
val theme = sharedPreferences.getNonNullString(APP_THEME, APP_THEME_DEFAULT)
|
||||
Log.d("activeTheme", theme)
|
||||
setAppNightMode(theme)
|
||||
|
||||
|
|
|
@ -41,7 +41,10 @@ enum class AppTheme(val value: String) {
|
|||
*
|
||||
* - Adding a new preference that does not change the interpretation of an existing preference
|
||||
*/
|
||||
const val SCHEMA_VERSION = 2023072401
|
||||
const val SCHEMA_VERSION = 2023082301
|
||||
|
||||
/** The schema version for fresh installs */
|
||||
const val NEW_INSTALL_SCHEMA_VERSION = 0
|
||||
|
||||
object PrefKeys {
|
||||
// Note: not all of these keys are actually used as SharedPreferences keys but we must give
|
||||
|
|
|
@ -30,12 +30,12 @@ import com.google.android.material.color.MaterialColors
|
|||
* the ability to do so is not supported in resource files.
|
||||
*/
|
||||
|
||||
private const val THEME_NIGHT = "night"
|
||||
private const val THEME_DAY = "day"
|
||||
private const val THEME_BLACK = "black"
|
||||
private const val THEME_AUTO = "auto"
|
||||
private const val THEME_SYSTEM = "auto_system"
|
||||
const val APP_THEME_DEFAULT = THEME_NIGHT
|
||||
const val THEME_NIGHT = "night"
|
||||
const val THEME_DAY = "day"
|
||||
const val THEME_BLACK = "black"
|
||||
const val THEME_AUTO = "auto"
|
||||
const val THEME_SYSTEM = "auto_system"
|
||||
const val APP_THEME_DEFAULT = THEME_SYSTEM
|
||||
|
||||
fun getDimension(context: Context, @AttrRes attribute: Int): Int {
|
||||
return context.obtainStyledAttributes(intArrayOf(attribute)).use { array ->
|
||||
|
|
|
@ -731,4 +731,6 @@
|
|||
<string name="about_copied">Copïwyd fersiwn a gwybodaeth dyfais</string>
|
||||
<string name="list_exclusive_label">Cuddio o\'r ffrwd cartref</string>
|
||||
<string name="error_media_playback">Methodd chwarae: %s</string>
|
||||
<string name="dialog_delete_filter_positive_action">Dileu</string>
|
||||
<string name="dialog_delete_filter_text">Dileu\'r hidlydd \'%1$s\'\?</string>
|
||||
</resources>
|
||||
|
|
|
@ -683,4 +683,6 @@
|
|||
<string name="about_copied">اطّلاعات افزاره و نگارش رونوشت شد</string>
|
||||
<string name="list_exclusive_label">نهفتن از خط زمانی خانگی</string>
|
||||
<string name="error_media_playback">پخش شکست خورد: %s</string>
|
||||
<string name="dialog_delete_filter_positive_action">حذف</string>
|
||||
<string name="dialog_delete_filter_text">حذف پالایهٔ «%1$s»؟</string>
|
||||
</resources>
|
||||
|
|
|
@ -439,7 +439,7 @@
|
|||
<string name="add_poll_choice">Ajouter un choix</string>
|
||||
<string name="poll_allow_multiple_choices">Choix multiples</string>
|
||||
<string name="poll_new_choice_hint">Choix %d</string>
|
||||
<string name="edit_poll">Éditer</string>
|
||||
<string name="edit_poll">Modifier</string>
|
||||
<string name="title_scheduled_posts">Pouets planifiés</string>
|
||||
<string name="action_edit">Modifier</string>
|
||||
<string name="action_access_scheduled_posts">Messages programmés</string>
|
||||
|
|
|
@ -262,10 +262,10 @@
|
|||
<string name="action_add_to_list">Engadir conta á listaxe</string>
|
||||
<string name="hint_search_people_list">Atopar persoas ás que segues</string>
|
||||
<string name="action_delete_list">Eliminar a listaxe</string>
|
||||
<string name="action_rename_list">Renomear a listaxe</string>
|
||||
<string name="action_rename_list">Actualizar a listaxe</string>
|
||||
<string name="action_create_list">Crear unha listaxe</string>
|
||||
<string name="error_delete_list">Non se puido eliminar a listaxe</string>
|
||||
<string name="error_rename_list">Non se puido renomear a listaxe</string>
|
||||
<string name="error_rename_list">Non se actualizou a listaxe</string>
|
||||
<string name="error_create_list">Non se puido crear a listaxe</string>
|
||||
<string name="title_lists">Listaxes</string>
|
||||
<string name="action_lists">Listaxes</string>
|
||||
|
@ -305,9 +305,8 @@
|
|||
<string name="post_share_content">Compartir contido do toot</string>
|
||||
<string name="about_tusky_account">Perfil de Tusky</string>
|
||||
<string name="about_bug_feature_request_site">Informar de fallos e solicitar funcións:
|
||||
\n https://github.com/tuskyapp/Tusky/issues</string>
|
||||
<string name="about_project_site">Web do proxecto:
|
||||
\n https://tusky.app</string>
|
||||
\nhttps://github.com/tuskyapp/Tusky/issues</string>
|
||||
<string name="about_project_site">Web do proxecto: https://tusky.app</string>
|
||||
<string name="about_tusky_license">Tusky é software libre e de código aberto. Está baixo a licenza GNU General Public License Version 3. Podes ver a licenza aquí: https://www.gnu.org/licenses/gpl-3.0.en.html</string>
|
||||
<string name="about_powered_by_tusky">Desenvolta por Tusky</string>
|
||||
<string name="about_tusky_version">Tusky %s</string>
|
||||
|
@ -666,4 +665,16 @@
|
|||
<string name="notification_notification_worker">Obtendo as notificacións…</string>
|
||||
<string name="notification_prune_cache">Mantemento da caché…</string>
|
||||
<string name="error_media_upload_sending_fmt">Fallou a subida: %s</string>
|
||||
<string name="about_device_info_title">O teu dispositivo</string>
|
||||
<string name="about_device_info">%s %s
|
||||
\nVersión de Android: %s
|
||||
\nVersión SDK: %d</string>
|
||||
<string name="about_account_info_title">A túa conta</string>
|
||||
<string name="about_account_info">\@%s@%s
|
||||
\nVersión: %s</string>
|
||||
<string name="about_copied">Copiouse a información sobre o dispositivo e versión</string>
|
||||
<string name="about_copy">Copiar a información da versión e o dispositivo</string>
|
||||
<string name="dialog_delete_filter_positive_action">Eliminar</string>
|
||||
<string name="list_exclusive_label">Agochar na cronoloxía de inicio</string>
|
||||
<string name="dialog_delete_filter_text">Eliminar o filtro \'%1$s\'\?</string>
|
||||
</resources>
|
|
@ -259,10 +259,8 @@
|
|||
<string name="title_lists">Lijsten</string>
|
||||
<string name="compose_active_account_description">Berichten plaatsen als %1$s</string>
|
||||
<plurals name="hint_describe_for_visually_impaired">
|
||||
<item quantity="one">Omschrijf dit voor iemand met een visuele beperking
|
||||
\n(tekenlimiet is %d)</item>
|
||||
<item quantity="other">Omschrijf dit voor mensen met een visuele beperking
|
||||
\n(tekenlimiet is %d)</item>
|
||||
<item quantity="one">Omschrijf inhoud voor iemand met een visuele beperking (tekenlimiet is %d)</item>
|
||||
<item quantity="other">Omschrijf inhoud voor mensen met een visuele beperking (tekenlimiet is %d)</item>
|
||||
</plurals>
|
||||
<string name="action_set_caption">Beschrijving toevoegen</string>
|
||||
<string name="action_remove">Verwijderen</string>
|
||||
|
@ -663,4 +661,6 @@
|
|||
<string name="about_copied">Versie en apparaatinformatie gekopieerd</string>
|
||||
<string name="error_media_upload_sending_fmt">De upload is mislukt: %s</string>
|
||||
<string name="socket_timeout_exception">Contact zoeken met je server duurde te lang</string>
|
||||
<string name="dialog_delete_filter_positive_action">Verwijder</string>
|
||||
<string name="dialog_delete_filter_text">Verwijder filter \'%1$s\'\?</string>
|
||||
</resources>
|
||||
|
|
|
@ -665,4 +665,6 @@
|
|||
<string name="about_device_info_title">Thiết bị của bạn</string>
|
||||
<string name="list_exclusive_label">Ẩn khỏi bảng tin</string>
|
||||
<string name="error_media_playback">Không thể phát: %s</string>
|
||||
<string name="dialog_delete_filter_text">Xóa bộ lọc \'%1$s\'\?</string>
|
||||
<string name="dialog_delete_filter_positive_action">Xóa</string>
|
||||
</resources>
|
||||
|
|
|
@ -679,4 +679,6 @@
|
|||
<string name="about_copy">复制版本及设备信息</string>
|
||||
<string name="list_exclusive_label">不出现在首页时间线中</string>
|
||||
<string name="error_media_playback">播放失败了:%s</string>
|
||||
<string name="dialog_delete_filter_text">删除筛选器\'%1$s\'吗?</string>
|
||||
<string name="dialog_delete_filter_positive_action">删除</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue