updated strings

This commit is contained in:
Mariotaku Lee 2017-02-18 13:39:33 +08:00
parent a6cdf3217c
commit 6e8c7f1b9a
No known key found for this signature in database
GPG Key ID: 15C10F89D7C33535
9 changed files with 158 additions and 127 deletions

View File

@ -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();
}
}

View File

@ -1,59 +0,0 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
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;
}
}

View File

@ -0,0 +1,34 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2017 Mariotaku Lee <mariotaku.lee@gmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
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
}

View File

@ -0,0 +1,67 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
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<CharSequence>(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
}
}
}

View File

@ -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

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<resources xmlns:tools="http://schemas.android.com/tools">
<string-array name="entries_refresh_interval">
<item>3 minutes</item>
@ -12,59 +12,55 @@
<item>4 hours</item>
</string-array>
<string-array name="entries_auto_refresh_content">
<item>@string/title_home</item>
<item>@string/title_mentions</item>
<item>@string/inbox</item>
<item>@string/trends</item>
<item>Home</item>
<item>Interactions</item>
<item>Direct messages</item>
<item>Trends</item>
</string-array>
<string-array name="entries_notification_content">
<item>@string/title_home</item>
<item>@string/title_mentions</item>
<item>@string/inbox</item>
<item>Home</item>
<item>Interactions</item>
<item>Direct messages</item>
</string-array>
<string-array name="entries_home_refresh_content">
<item>@string/title_mentions</item>
<item>@string/inbox</item>
<item>@string/trends</item>
<item>@string/saved_searches</item>
</string-array>
<string-array name="entries_image_preload_option">
<item>@string/profile_images</item>
<item>@string/preview_images</item>
<item>Interactions</item>
<item>Direct messages</item>
<item>Trends</item>
<item>Saved searches</item>
</string-array>
<string-array name="entries_theme">
<item>@string/theme_light</item>
<item>@string/theme_dark</item>
<item>@string/theme_auto</item>
<item>Light</item>
<item>Dark</item>
<item>Auto</item>
</string-array>
<string-array name="entries_theme_background">
<item>@string/theme_background_default</item>
<item>@string/theme_background_solid</item>
<item>@string/theme_background_transparent</item>
<item>Default</item>
<item>Pure white/black</item>
<item>Transparent</item>
</string-array>
<string-array name="entries_tab_display_option">
<item>@string/tab_display_option_icon</item>
<item>@string/tab_display_option_label</item>
<item>@string/tab_display_option_icon_and_label</item>
<item>Icon</item>
<item>Label</item>
<item>Icon and label</item>
</string-array>
<string-array name="entries_compose_now_action">
<item>@string/action_compose</item>
<item>@string/action_take_photo</item>
<item>@string/add_image</item>
<item>Compose</item>
<item>Take photo</item>
<item>Add media</item>
</string-array>
<string-array name="entries_media_preview_style">
<item>@string/preview_style_crop</item>
<item>@string/preview_style_scale</item>
<item>@string/preview_style_real_size</item>
<item>Crop</item>
<item>Scale</item>
<item>Real size</item>
</string-array>
<string-array name="entries_image_sources">
<item>@string/source_camera</item>
<item>@string/source_gallery</item>
<item>@string/source_clipboard</item>
<item>Camera</item>
<item>Gallery</item>
<item>Clipboard</item>
</string-array>
<string-array name="entries_profile_image_style">
<item>@string/round</item>
<item>@string/square</item>
<item>Round</item>
<item>Square</item>
</string-array>
<string-array name="entries_proxy_type">
<item>HTTP</item>
@ -73,5 +69,10 @@
<string-array name="entries_media_preload">
<item>Wi-Fi</item>
</string-array>
<string-array name="entries_tab_column_width">
<item>Narrow</item>
<item>Normal</item>
<item>Wide</item>
</string-array>
</resources>

View File

@ -91,5 +91,10 @@
<item>place</item>
<item>coordinate</item>
</string-array>
<string-array name="values_tab_column_width">
<item>narrow</item>
<item>normal</item>
<item>wide</item>
</string-array>
</resources>

View File

@ -911,7 +911,7 @@
<string name="preference_randomize_account_rename_accounts_confirm">Rename existing accounts?</string>
<string name="preference_summary_auto_refresh_compatibility_mode">Enable for faster refresh interval, increases power usage on Android 5.0+</string>
<string name="preference_summary_auto_refresh_power_saving">Stop auto refresh when battery is low</string>
<string name="preference_summary_chrome_custom_tab">Open links in in-app browser (Powered by Chrome)</string>
<string name="preference_summary_chrome_custom_tab">Open links with in-app browser (Powered by Chrome)</string>
<string name="preference_summary_database_item_limit">Upper limit of items stored in databases for each account, set to a smaller value to save space and increase loading speed.</string>
<string name="preference_summary_media_preload_non_metered_network">Preload media only on free networks like Wi-Fi</string>
<string name="preference_summary_trends_location">Now you can set location separately in tab settings.</string>
@ -927,6 +927,7 @@
<string name="preference_title_landscape">Landscape</string>
<string name="preference_title_light_font">Light font</string>
<string name="preference_title_media_preload_non_metered_network">Preload on free network</string>
<string name="preference_title_multi_column_tab_width">Multi column tab width</string>
<string name="preference_title_multi_column_tabs">Multi column tabs</string>
<string name="preference_title_portrait">Portrait</string>
<string name="preference_title_storage">Storage</string>

View File

@ -23,6 +23,16 @@
android:value="true"/>
</SwitchPreferenceCompat>
</org.mariotaku.twidere.preference.TintedPreferenceCategory>
<org.mariotaku.twidere.preference.EntrySummaryListPreference
android:defaultValue="normal"
android:key="multi_column_tab_width"
android:title="@string/preference_title_multi_column_tab_width">
<extra
android:name="should_recreate"
android:value="true"/>
</org.mariotaku.twidere.preference.EntrySummaryListPreference>
<SwitchPreferenceCompat
android:defaultValue="true"
android:key="floating_detailed_contents"