diff --git a/twidere/src/main/java/org/mariotaku/twidere/preference/EntrySummaryListPreference.java b/twidere/src/main/java/org/mariotaku/twidere/preference/EntrySummaryListPreference.java deleted file mode 100644 index 1eee08e91..000000000 --- a/twidere/src/main/java/org/mariotaku/twidere/preference/EntrySummaryListPreference.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.mariotaku.twidere.preference; - -import android.content.Context; -import android.util.AttributeSet; - -/** - * Created by mariotaku on 16/3/22. - */ -public class EntrySummaryListPreference extends ThemedListPreference { - public EntrySummaryListPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); - } - - public EntrySummaryListPreference(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - } - - public EntrySummaryListPreference(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public EntrySummaryListPreference(Context context) { - super(context); - } - - @Override - public CharSequence getSummary() { - return getEntry(); - } -} diff --git a/twidere/src/main/java/org/mariotaku/twidere/preference/LinkHighlightPreference.java b/twidere/src/main/java/org/mariotaku/twidere/preference/LinkHighlightPreference.java deleted file mode 100644 index 21c4b8816..000000000 --- a/twidere/src/main/java/org/mariotaku/twidere/preference/LinkHighlightPreference.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Twidere - Twitter client for Android - * - * Copyright (C) 2012-2014 Mariotaku Lee - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package org.mariotaku.twidere.preference; - -import android.content.Context; -import android.text.SpannableString; -import android.util.AttributeSet; - -import org.mariotaku.twidere.Constants; -import org.mariotaku.twidere.R; -import org.mariotaku.twidere.text.TwidereHighLightStyle; - -public class LinkHighlightPreference extends EntrySummaryListPreference implements Constants { - - private static final int[] ENTRIES_RES = {R.string.none, R.string.highlight, R.string.underline, - R.string.highlight_and_underline}; - private static final String[] VALUES = {VALUE_LINK_HIGHLIGHT_OPTION_NONE, VALUE_LINK_HIGHLIGHT_OPTION_HIGHLIGHT, - VALUE_LINK_HIGHLIGHT_OPTION_UNDERLINE, VALUE_LINK_HIGHLIGHT_OPTION_BOTH}; - private static final int[] OPTIONS = {VALUE_LINK_HIGHLIGHT_OPTION_CODE_NONE, - VALUE_LINK_HIGHLIGHT_OPTION_CODE_HIGHLIGHT, VALUE_LINK_HIGHLIGHT_OPTION_CODE_UNDERLINE, - VALUE_LINK_HIGHLIGHT_OPTION_CODE_BOTH}; - - public LinkHighlightPreference(final Context context) { - this(context, null); - } - - public LinkHighlightPreference(final Context context, final AttributeSet attrs) { - super(context, attrs); - final CharSequence[] entries = new CharSequence[VALUES.length]; - for (int i = 0, j = entries.length; i < j; i++) { - entries[i] = getStyledEntry(OPTIONS[i], context.getString(ENTRIES_RES[i])); - } - setEntries(entries); - setEntryValues(VALUES); - } - - private static CharSequence getStyledEntry(final int option, final CharSequence entry) { - final SpannableString str = new SpannableString(entry); - str.setSpan(new TwidereHighLightStyle(option), 0, str.length(), 0); - return str; - } -} diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/preference/EntrySummaryListPreference.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/preference/EntrySummaryListPreference.kt new file mode 100644 index 000000000..0efe4802e --- /dev/null +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/preference/EntrySummaryListPreference.kt @@ -0,0 +1,34 @@ +/* + * Twidere - Twitter client for Android + * + * Copyright (C) 2012-2017 Mariotaku Lee + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package org.mariotaku.twidere.preference + +import android.content.Context +import android.util.AttributeSet + +/** + * Created by mariotaku on 16/3/22. + */ +open class EntrySummaryListPreference( + context: Context, attrs: AttributeSet? = null +) : ThemedListPreference(context, attrs) { + + override fun getSummary(): CharSequence? = entry + +} diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/preference/LinkHighlightPreference.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/preference/LinkHighlightPreference.kt new file mode 100644 index 000000000..01cd17bdc --- /dev/null +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/preference/LinkHighlightPreference.kt @@ -0,0 +1,67 @@ +/* + * Twidere - Twitter client for Android + * + * Copyright (C) 2012-2014 Mariotaku Lee + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package org.mariotaku.twidere.preference + +import android.content.Context +import android.text.SpannableString +import android.util.AttributeSet +import org.mariotaku.twidere.R +import org.mariotaku.twidere.constant.SharedPreferenceConstants.* +import org.mariotaku.twidere.text.TwidereHighLightStyle + +class LinkHighlightPreference( + context: Context, attrs: AttributeSet? +) : EntrySummaryListPreference(context, attrs) { + + init { + entries = Array(VALUES.size) { i -> + getStyledEntry(OPTIONS[i], context.getString(ENTRIES_RES[i])) + } + entryValues = VALUES + } + + companion object { + + private val ENTRIES_RES = intArrayOf( + R.string.none, + R.string.highlight, + R.string.underline, + R.string.highlight_and_underline + ) + private val VALUES = arrayOf( + VALUE_LINK_HIGHLIGHT_OPTION_NONE, + VALUE_LINK_HIGHLIGHT_OPTION_HIGHLIGHT, + VALUE_LINK_HIGHLIGHT_OPTION_UNDERLINE, + VALUE_LINK_HIGHLIGHT_OPTION_BOTH + ) + private val OPTIONS = intArrayOf( + VALUE_LINK_HIGHLIGHT_OPTION_CODE_NONE, + VALUE_LINK_HIGHLIGHT_OPTION_CODE_HIGHLIGHT, + VALUE_LINK_HIGHLIGHT_OPTION_CODE_UNDERLINE, + VALUE_LINK_HIGHLIGHT_OPTION_CODE_BOTH + ) + + private fun getStyledEntry(option: Int, entry: CharSequence): CharSequence { + val str = SpannableString(entry) + str.setSpan(TwidereHighLightStyle(option), 0, str.length, 0) + return str + } + } +} diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/preference/RefreshIntervalPreference.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/preference/RefreshIntervalPreference.kt index cd863f8df..fed78f459 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/preference/RefreshIntervalPreference.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/preference/RefreshIntervalPreference.kt @@ -14,7 +14,9 @@ import java.util.concurrent.TimeUnit /** * Created by mariotaku on 2017/2/8. */ -class RefreshIntervalPreference(context: Context, attrs: AttributeSet? = null) : EntrySummaryListPreference(context, attrs) { +class RefreshIntervalPreference( + context: Context, attrs: AttributeSet? = null +) : EntrySummaryListPreference(context, attrs) { private val entriesBackup = entries private val valuesBackup = entryValues diff --git a/twidere/src/main/res/values/arrays.xml b/twidere/src/main/res/values/arrays.xml index 1f3708107..57860513e 100644 --- a/twidere/src/main/res/values/arrays.xml +++ b/twidere/src/main/res/values/arrays.xml @@ -1,5 +1,5 @@ - + 3 minutes @@ -12,59 +12,55 @@ 4 hours - @string/title_home - @string/title_mentions - @string/inbox - @string/trends + Home + Interactions + Direct messages + Trends - @string/title_home - @string/title_mentions - @string/inbox + Home + Interactions + Direct messages - @string/title_mentions - @string/inbox - @string/trends - @string/saved_searches - - - @string/profile_images - @string/preview_images + Interactions + Direct messages + Trends + Saved searches - @string/theme_light - @string/theme_dark - @string/theme_auto + Light + Dark + Auto - @string/theme_background_default - @string/theme_background_solid - @string/theme_background_transparent + Default + Pure white/black + Transparent - @string/tab_display_option_icon - @string/tab_display_option_label - @string/tab_display_option_icon_and_label + Icon + Label + Icon and label - @string/action_compose - @string/action_take_photo - @string/add_image + Compose + Take photo + Add media - @string/preview_style_crop - @string/preview_style_scale - @string/preview_style_real_size + Crop + Scale + Real size - @string/source_camera - @string/source_gallery - @string/source_clipboard + Camera + Gallery + Clipboard - @string/round - @string/square + Round + Square HTTP @@ -73,5 +69,10 @@ Wi-Fi + + Narrow + Normal + Wide + \ No newline at end of file diff --git a/twidere/src/main/res/values/arrays_no_translate.xml b/twidere/src/main/res/values/arrays_no_translate.xml index 07ed4840a..bbf214653 100644 --- a/twidere/src/main/res/values/arrays_no_translate.xml +++ b/twidere/src/main/res/values/arrays_no_translate.xml @@ -91,5 +91,10 @@ place coordinate + + narrow + normal + wide + \ No newline at end of file diff --git a/twidere/src/main/res/values/strings.xml b/twidere/src/main/res/values/strings.xml index 74dbb5ade..5761ee18f 100644 --- a/twidere/src/main/res/values/strings.xml +++ b/twidere/src/main/res/values/strings.xml @@ -911,7 +911,7 @@ Rename existing accounts? Enable for faster refresh interval, increases power usage on Android 5.0+ Stop auto refresh when battery is low - Open links in in-app browser (Powered by Chrome) + Open links with in-app browser (Powered by Chrome) Upper limit of items stored in databases for each account, set to a smaller value to save space and increase loading speed. Preload media only on free networks like Wi-Fi Now you can set location separately in tab settings. @@ -927,6 +927,7 @@ Landscape Light font Preload on free network + Multi column tab width Multi column tabs Portrait Storage diff --git a/twidere/src/main/res/xml/preferences_tablet_mode.xml b/twidere/src/main/res/xml/preferences_tablet_mode.xml index 55d1448b8..3a664ba64 100644 --- a/twidere/src/main/res/xml/preferences_tablet_mode.xml +++ b/twidere/src/main/res/xml/preferences_tablet_mode.xml @@ -23,6 +23,16 @@ android:value="true"/> + + + + +