diff --git a/app/build.gradle b/app/build.gradle index dd0b3ebc..210cf4d1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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" } diff --git a/app/src/main/java/jp/juggler/subwaytooter/ActAppSetting.java b/app/src/main/java/jp/juggler/subwaytooter/ActAppSetting.java index 7a194144..db81d041 100644 --- a/app/src/main/java/jp/juggler/subwaytooter/ActAppSetting.java +++ b/app/src/main/java/jp/juggler/subwaytooter/ActAppSetting.java @@ -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() ) diff --git a/app/src/main/java/jp/juggler/subwaytooter/App1.java b/app/src/main/java/jp/juggler/subwaytooter/App1.java index fb0c075d..3a5fc564 100644 --- a/app/src/main/java/jp/juggler/subwaytooter/App1.java +++ b/app/src/main/java/jp/juggler/subwaytooter/App1.java @@ -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 ); } - } diff --git a/app/src/main/java/jp/juggler/subwaytooter/AppDataExporter.java b/app/src/main/java/jp/juggler/subwaytooter/AppDataExporter.java index 8765cf17..21c34a55 100644 --- a/app/src/main/java/jp/juggler/subwaytooter/AppDataExporter.java +++ b/app/src/main/java/jp/juggler/subwaytooter/AppDataExporter.java @@ -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; diff --git a/app/src/main/java/jp/juggler/subwaytooter/Pref.java b/app/src/main/java/jp/juggler/subwaytooter/Pref.java index 3b3eba1e..d7d31c80 100644 --- a/app/src/main/java/jp/juggler/subwaytooter/Pref.java +++ b/app/src/main/java/jp/juggler/subwaytooter/Pref.java @@ -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文も更新すること } diff --git a/app/src/main/java/jp/juggler/subwaytooter/util/EmojiDecoder.java b/app/src/main/java/jp/juggler/subwaytooter/util/EmojiDecoder.java index 051509d2..a32b7856 100644 --- a/app/src/main/java/jp/juggler/subwaytooter/util/EmojiDecoder.java +++ b/app/src/main/java/jp/juggler/subwaytooter/util/EmojiDecoder.java @@ -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; } diff --git a/app/src/main/res/layout/act_app_setting.xml b/app/src/main/res/layout/act_app_setting.xml index c707afdc..6f18bdab 100644 --- a/app/src/main/res/layout/act_app_setting.xml +++ b/app/src/main/res/layout/act_app_setting.xml @@ -227,6 +227,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -608,23 +659,6 @@ - - - - - - - - - - Card Author Provider + 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.) + Emoji diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 5db06452..f51ccbec 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -803,4 +803,6 @@ Card Author Provider + 絵文字コードの手前に空白以外の文字があっても変換する (投稿と表示の両方に影響します。表示の反映にはアプリ再起動とカラムのリロードが必要です。投稿時に変換された絵文字を元のコードに戻すことはできません。) + 絵文字 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 96d09710..d92f6f28 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -507,5 +507,7 @@ Card Author Provider + 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.) + Emoji