mirror of
https://github.com/tateisu/SubwayTooter
synced 2025-01-29 18:19:22 +01:00
アプリ設定に「絵文字コードの手前に空白以外の文字があっても変換する」を追加
This commit is contained in:
parent
dd5be0ce87
commit
a06a7db55e
@ -9,8 +9,8 @@ android {
|
||||
applicationId "jp.juggler.subwaytooter"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 26
|
||||
versionCode 168
|
||||
versionName "1.6.8"
|
||||
versionCode 169
|
||||
versionName "1.6.9"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
|
@ -106,6 +106,7 @@ public class ActAppSetting extends AppCompatActivity
|
||||
Switch swDontUseActionButtonWithQuickTootBar;
|
||||
Switch swShortAcctLocalUser;
|
||||
Switch swDisableEmojiAnimation;
|
||||
Switch swAllowNonSpaceBeforeEmojiShortcode;
|
||||
|
||||
Spinner spBackButtonAction;
|
||||
Spinner spUITheme;
|
||||
@ -226,6 +227,10 @@ public class ActAppSetting extends AppCompatActivity
|
||||
swDisableEmojiAnimation = findViewById( R.id.swDisableEmojiAnimation );
|
||||
swDisableEmojiAnimation.setOnCheckedChangeListener( this );
|
||||
|
||||
swAllowNonSpaceBeforeEmojiShortcode= findViewById( R.id.swAllowNonSpaceBeforeEmojiShortcode );
|
||||
swAllowNonSpaceBeforeEmojiShortcode.setOnCheckedChangeListener( this );
|
||||
|
||||
|
||||
cbNotificationSound = findViewById( R.id.cbNotificationSound );
|
||||
cbNotificationVibration = findViewById( R.id.cbNotificationVibration );
|
||||
cbNotificationLED = findViewById( R.id.cbNotificationLED );
|
||||
@ -385,7 +390,8 @@ public class ActAppSetting extends AppCompatActivity
|
||||
swDontUseActionButtonWithQuickTootBar.setChecked( pref.getBoolean( Pref.KEY_DONT_USE_ACTION_BUTTON, false ) );
|
||||
swShortAcctLocalUser.setChecked( pref.getBoolean( Pref.KEY_SHORT_ACCT_LOCAL_USER, false ) );
|
||||
swDisableEmojiAnimation.setChecked( pref.getBoolean( Pref.KEY_DISABLE_EMOJI_ANIMATION, false ) );
|
||||
|
||||
swAllowNonSpaceBeforeEmojiShortcode.setChecked( pref.getBoolean( Pref.KEY_ALLOW_NON_SPACE_BEFORE_EMOJI_SHORTCODE, false ) );
|
||||
|
||||
// Switch with default true
|
||||
swDisableFastScroller.setChecked( pref.getBoolean( Pref.KEY_DISABLE_FAST_SCROLLER, true ) );
|
||||
swPriorChrome.setChecked( pref.getBoolean( Pref.KEY_PRIOR_CHROME, true ) );
|
||||
@ -457,6 +463,8 @@ public class ActAppSetting extends AppCompatActivity
|
||||
.putBoolean( Pref.KEY_DONT_USE_ACTION_BUTTON, swDontUseActionButtonWithQuickTootBar.isChecked() )
|
||||
.putBoolean( Pref.KEY_SHORT_ACCT_LOCAL_USER, swShortAcctLocalUser.isChecked() )
|
||||
.putBoolean( Pref.KEY_DISABLE_EMOJI_ANIMATION, swDisableEmojiAnimation.isChecked() )
|
||||
.putBoolean( Pref.KEY_ALLOW_NON_SPACE_BEFORE_EMOJI_SHORTCODE, swAllowNonSpaceBeforeEmojiShortcode.isChecked() )
|
||||
|
||||
|
||||
.putBoolean( Pref.KEY_NOTIFICATION_SOUND, cbNotificationSound.isChecked() )
|
||||
.putBoolean( Pref.KEY_NOTIFICATION_VIBRATION, cbNotificationVibration.isChecked() )
|
||||
|
@ -481,9 +481,10 @@ public class App1 extends Application {
|
||||
|
||||
// Activity開始時に設定を読み直す
|
||||
public static boolean disable_emoji_animation;
|
||||
public static boolean allow_non_space_before_emoji_shortcode;
|
||||
private static void reloadConfig(){
|
||||
disable_emoji_animation = pref.getBoolean( Pref.KEY_DISABLE_EMOJI_ANIMATION,false );
|
||||
allow_non_space_before_emoji_shortcode = pref.getBoolean( Pref.KEY_ALLOW_NON_SPACE_BEFORE_EMOJI_SHORTCODE,false );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -320,6 +320,7 @@ public class AppDataExporter {
|
||||
case Pref.KEY_DONT_USE_ACTION_BUTTON:
|
||||
case Pref.KEY_SHORT_ACCT_LOCAL_USER:
|
||||
case Pref.KEY_DISABLE_EMOJI_ANIMATION:
|
||||
case Pref.KEY_ALLOW_NON_SPACE_BEFORE_EMOJI_SHORTCODE:
|
||||
boolean bv = reader.nextBoolean();
|
||||
e.putBoolean( k, bv );
|
||||
break;
|
||||
|
@ -6,7 +6,6 @@ import android.preference.PreferenceManager;
|
||||
|
||||
public class Pref {
|
||||
|
||||
|
||||
public static SharedPreferences pref( Context context ){
|
||||
return PreferenceManager.getDefaultSharedPreferences( context );
|
||||
}
|
||||
@ -73,7 +72,7 @@ public class Pref {
|
||||
public static final String KEY_QUICK_TOOT_BAR = "quick_toot_bar";
|
||||
|
||||
public static final String KEY_QUOTE_NAME_FORMAT = "quote_name_format";
|
||||
|
||||
|
||||
public static final String KEY_ENABLE_GIF_ANIMATION = "enable_gif_animation";
|
||||
|
||||
public static final String KEY_MENTION_FULL_ACCT = "mention_full_acct";
|
||||
@ -91,6 +90,8 @@ public class Pref {
|
||||
public static final String KEY_EMOJI_PICKER_RECENT = "emoji_picker_recent";
|
||||
|
||||
public static final String KEY_DISABLE_EMOJI_ANIMATION = "disable_emoji_animation";
|
||||
|
||||
|
||||
public static final String KEY_ALLOW_NON_SPACE_BEFORE_EMOJI_SHORTCODE = "allow_non_space_before_emoji_shortcode";
|
||||
|
||||
// 項目を追加したらAppDataExporter#importPref のswitch文も更新すること
|
||||
}
|
||||
|
@ -155,8 +155,11 @@ public class EmojiDecoder {
|
||||
int c = s.codePointAt( i );
|
||||
int width = Character.charCount( c );
|
||||
if( c == ':' ){
|
||||
if( i + width < end && s.codePointAt( i + width ) == '@' ){
|
||||
// 例外として、フレニコのプロフ絵文字 :@who: は手前の空白を要求しない
|
||||
if( App1.allow_non_space_before_emoji_shortcode ){
|
||||
// アプリ設定により、: の手前に空白を要求しない
|
||||
break;
|
||||
}else if( i + width < end && s.codePointAt( i + width ) == '@' ){
|
||||
// フレニコのプロフ絵文字 :@who: は手前の空白を要求しない
|
||||
break;
|
||||
}else if( i == 0 || isWhitespaceBeforeEmoji( s.codePointBefore( i ) ) ){
|
||||
// ショートコードの手前は始端か改行か空白文字でないとならない
|
||||
@ -239,7 +242,7 @@ public class EmojiDecoder {
|
||||
{
|
||||
CustomEmoji emoji = ( custom_map == null ? null : custom_map.get( name ) );
|
||||
if( emoji != null ){
|
||||
String url = ( App1.disable_emoji_animation && !TextUtils.isEmpty( emoji.static_url) ) ? emoji.static_url : emoji.url;
|
||||
String url = ( App1.disable_emoji_animation && ! TextUtils.isEmpty( emoji.static_url ) ) ? emoji.static_url : emoji.url;
|
||||
decode_env.addNetworkEmojiSpan( part, url );
|
||||
return;
|
||||
}
|
||||
|
@ -227,6 +227,52 @@
|
||||
|
||||
<!-- =============================================== -->
|
||||
|
||||
<TextView
|
||||
style="@style/setting_group_header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/emoji"
|
||||
/>
|
||||
|
||||
<View style="@style/setting_divider"/>
|
||||
|
||||
<TextView
|
||||
style="@style/setting_row_label"
|
||||
android:text="@string/disable_custom_emoji_animation"
|
||||
/>
|
||||
|
||||
<LinearLayout style="@style/setting_row_form">
|
||||
|
||||
<Switch
|
||||
android:id="@+id/swDisableEmojiAnimation"
|
||||
style="@style/setting_horizontal_stretch"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<View style="@style/setting_divider"/>
|
||||
|
||||
<TextView
|
||||
style="@style/setting_row_label"
|
||||
android:text="@string/allow_non_space_before_emoji_code"
|
||||
/>
|
||||
|
||||
<LinearLayout style="@style/setting_row_form">
|
||||
|
||||
<Switch
|
||||
android:id="@+id/swAllowNonSpaceBeforeEmojiShortcode"
|
||||
style="@style/setting_horizontal_stretch"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View style="@style/setting_divider"/>
|
||||
|
||||
<!-- =============================================== -->
|
||||
|
||||
<TextView
|
||||
style="@style/setting_group_header"
|
||||
android:layout_width="match_parent"
|
||||
@ -301,6 +347,10 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<View style="@style/setting_divider"/>
|
||||
|
||||
<TextView
|
||||
@ -572,17 +622,18 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<View style="@style/setting_divider"/>
|
||||
|
||||
<TextView
|
||||
style="@style/setting_row_label"
|
||||
android:text="@string/disable_custom_emoji_animation"
|
||||
android:text="@string/short_acct_local_user"
|
||||
/>
|
||||
|
||||
<LinearLayout style="@style/setting_row_form">
|
||||
|
||||
<Switch
|
||||
android:id="@+id/swDisableEmojiAnimation"
|
||||
android:id="@+id/swShortAcctLocalUser"
|
||||
style="@style/setting_horizontal_stretch"
|
||||
android:gravity="center"
|
||||
/>
|
||||
@ -608,23 +659,6 @@
|
||||
|
||||
<View style="@style/setting_divider"/>
|
||||
|
||||
<TextView
|
||||
style="@style/setting_row_label"
|
||||
android:text="@string/short_acct_local_user"
|
||||
/>
|
||||
|
||||
<LinearLayout style="@style/setting_row_form">
|
||||
|
||||
<Switch
|
||||
android:id="@+id/swShortAcctLocalUser"
|
||||
style="@style/setting_horizontal_stretch"
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View style="@style/setting_divider"/>
|
||||
|
||||
<TextView
|
||||
style="@style/setting_row_label"
|
||||
android:text="@string/relative_timestamp"
|
||||
|
@ -516,6 +516,8 @@
|
||||
<string name="card_header_card">Card</string>
|
||||
<string name="card_header_author">Author</string>
|
||||
<string name="card_header_provider">Provider</string>
|
||||
<string name="allow_non_space_before_emoji_code">Allow non-space character before emoji shortcode (Affect to display and post. to update display, please restart app and reload column. The emojis converted at posting can\'t be restored to shortcode.)</string>
|
||||
<string name="emoji">Emoji</string>
|
||||
<!--<string name="abc_action_bar_home_description">Revenir à l\'accueil</string>-->
|
||||
<!--<string name="abc_action_bar_home_description_format">%1$s, %2$s</string>-->
|
||||
<!--<string name="abc_action_bar_home_subtitle_description_format">%1$s, %2$s, %3$s</string>-->
|
||||
|
@ -803,4 +803,6 @@
|
||||
<string name="card_header_card">Card</string>
|
||||
<string name="card_header_author">Author</string>
|
||||
<string name="card_header_provider">Provider</string>
|
||||
<string name="allow_non_space_before_emoji_code">絵文字コードの手前に空白以外の文字があっても変換する (投稿と表示の両方に影響します。表示の反映にはアプリ再起動とカラムのリロードが必要です。投稿時に変換された絵文字を元のコードに戻すことはできません。)</string>
|
||||
<string name="emoji">絵文字</string>
|
||||
</resources>
|
||||
|
@ -507,5 +507,7 @@
|
||||
<string name="card_header_card">Card</string>
|
||||
<string name="card_header_author">Author</string>
|
||||
<string name="card_header_provider">Provider</string>
|
||||
<string name="allow_non_space_before_emoji_code">Allow non-space character before emoji shortcode (Affect to display and post. to update display, please restart app and reload column. The emojis converted at posting can\'t be restored to shortcode.)</string>
|
||||
<string name="emoji">Emoji</string>
|
||||
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user