From 92bb6223cd6bd83a777ba88671030cb853827226 Mon Sep 17 00:00:00 2001 From: tateisu Date: Thu, 28 Dec 2017 23:42:02 +0900 Subject: [PATCH] =?UTF-8?q?-=20=E7=B0=A1=E7=95=A5=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E3=81=A8=E5=86=85=E8=94=B5=E3=83=A1=E3=83=87=E3=82=A3=E3=82=A2?= =?UTF-8?q?=E3=83=93=E3=83=A5=E3=83=BC=E3=82=A2=E3=81=AE=E3=83=87=E3=83=95?= =?UTF-8?q?=E3=82=A9=E3=83=AB=E3=83=88=E3=82=92ON=E3=81=AB=E3=81=97?= =?UTF-8?q?=E3=81=9F=20-=20logcat=E3=81=B8=E3=81=AE=E5=87=BA=E5=8A=9B?= =?UTF-8?q?=E3=82=92=E5=B0=91=E3=81=97=E5=89=8A=E3=81=A3=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jp/juggler/subwaytooter/ActAppSetting.java | 4 ++-- .../jp/juggler/subwaytooter/ColumnViewHolder.java | 2 +- .../jp/juggler/subwaytooter/ItemViewHolder.java | 2 +- .../subwaytooter/api/entity/CustomEmoji.java | 14 +++++++++++--- .../jp/juggler/subwaytooter/util/PostHelper.java | 4 +++- .../java/jp/juggler/subwaytooter/util/Utils.java | 1 + 6 files changed, 19 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/jp/juggler/subwaytooter/ActAppSetting.java b/app/src/main/java/jp/juggler/subwaytooter/ActAppSetting.java index 41a8b525..ab1ddb6b 100644 --- a/app/src/main/java/jp/juggler/subwaytooter/ActAppSetting.java +++ b/app/src/main/java/jp/juggler/subwaytooter/ActAppSetting.java @@ -379,7 +379,7 @@ public class ActAppSetting extends AppCompatActivity swDontConfirmBeforeCloseColumn.setChecked( pref.getBoolean( Pref.KEY_DONT_CONFIRM_BEFORE_CLOSE_COLUMN, false ) ); swPriorLocalURL.setChecked( pref.getBoolean( Pref.KEY_PRIOR_LOCAL_URL, false ) ); - swSimpleList.setChecked( pref.getBoolean( Pref.KEY_SIMPLE_LIST, false ) ); + swSimpleList.setChecked( pref.getBoolean( Pref.KEY_SIMPLE_LIST, true ) ); swExitAppWhenCloseProtectedColumn.setChecked( pref.getBoolean( Pref.KEY_EXIT_APP_WHEN_CLOSE_PROTECTED_COLUMN, false ) ); swShowFollowButtonInButtonBar.setChecked( pref.getBoolean( Pref.KEY_SHOW_FOLLOW_BUTTON_IN_BUTTON_BAR, false ) ); swDontRound.setChecked( pref.getBoolean( Pref.KEY_DONT_ROUND, false ) ); @@ -398,7 +398,7 @@ public class ActAppSetting extends AppCompatActivity 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 ) ); - swUseInternalMediaViewer.setChecked( pref.getBoolean( Pref.KEY_USE_INTERNAL_MEDIA_VIEWER, false ) ); + swUseInternalMediaViewer.setChecked( pref.getBoolean( Pref.KEY_USE_INTERNAL_MEDIA_VIEWER, true ) ); // Switch with default true swDisableFastScroller.setChecked( pref.getBoolean( Pref.KEY_DISABLE_FAST_SCROLLER, true ) ); swPriorChrome.setChecked( pref.getBoolean( Pref.KEY_PRIOR_CHROME, true ) ); diff --git a/app/src/main/java/jp/juggler/subwaytooter/ColumnViewHolder.java b/app/src/main/java/jp/juggler/subwaytooter/ColumnViewHolder.java index 33e7c025..0230343b 100644 --- a/app/src/main/java/jp/juggler/subwaytooter/ColumnViewHolder.java +++ b/app/src/main/java/jp/juggler/subwaytooter/ColumnViewHolder.java @@ -256,7 +256,7 @@ class ColumnViewHolder log.d( "onPageCreate [%d] %s", page_idx, column.getColumnName( true ) ); - boolean bSimpleList = ( column.column_type != Column.TYPE_CONVERSATION && activity.pref.getBoolean( Pref.KEY_SIMPLE_LIST, false ) ); + boolean bSimpleList = ( column.column_type != Column.TYPE_CONVERSATION && activity.pref.getBoolean( Pref.KEY_SIMPLE_LIST, true ) ); tvColumnIndex.setText( activity.getString( R.string.column_index, page_idx + 1, page_count ) ); diff --git a/app/src/main/java/jp/juggler/subwaytooter/ItemViewHolder.java b/app/src/main/java/jp/juggler/subwaytooter/ItemViewHolder.java index 0b47e2a4..bf9083f4 100644 --- a/app/src/main/java/jp/juggler/subwaytooter/ItemViewHolder.java +++ b/app/src/main/java/jp/juggler/subwaytooter/ItemViewHolder.java @@ -922,7 +922,7 @@ class ItemViewHolder implements View.OnClickListener, View.OnLongClickListener { if( media_attachments == null ) return; - if( App1.pref.getBoolean( Pref. KEY_USE_INTERNAL_MEDIA_VIEWER,false) ){ + if( App1.pref.getBoolean( Pref. KEY_USE_INTERNAL_MEDIA_VIEWER,true) ){ ActMediaViewer.open( activity, media_attachments, i ); return; } diff --git a/app/src/main/java/jp/juggler/subwaytooter/api/entity/CustomEmoji.java b/app/src/main/java/jp/juggler/subwaytooter/api/entity/CustomEmoji.java index b76b0f5c..7c13ca53 100644 --- a/app/src/main/java/jp/juggler/subwaytooter/api/entity/CustomEmoji.java +++ b/app/src/main/java/jp/juggler/subwaytooter/api/entity/CustomEmoji.java @@ -33,7 +33,7 @@ public class CustomEmoji { this.static_url = static_url; } - public static CustomEmoji parse( JSONObject src ){ + public static CustomEmoji parse( @Nullable JSONObject src ){ if( src == null ) return null; String shortcode = Utils.optStringX( src, "shortcode" ); String url = Utils.optStringX( src, "url" ); @@ -47,19 +47,27 @@ public class CustomEmoji { public static class List extends ArrayList< CustomEmoji > { } - public static List parseList( JSONArray src, @NonNull String instance ){ + public static @Nullable List parseList( @Nullable JSONArray src, @NonNull String instance ){ + if( src == null ) return null; + + int src_length = src.length(); + if( src_length == 0 ) return null; + List dst = new List(); for( int i = 0, ie = src.length() ; i < ie ; ++ i ){ CustomEmoji item = parse( src.optJSONObject( i ) ); if( item != null ) dst.add( item ); } + + if( dst.isEmpty() ) return null; + Collections.sort( dst, new Comparator< CustomEmoji >() { @Override public int compare( CustomEmoji a, CustomEmoji b ){ return a.shortcode.compareToIgnoreCase( b.shortcode ); } } ); - log.d( "parseList: parse %d emojis for %s.", dst.size(), instance ); + return dst; } diff --git a/app/src/main/java/jp/juggler/subwaytooter/util/PostHelper.java b/app/src/main/java/jp/juggler/subwaytooter/util/PostHelper.java index c74c27f5..3a15b3b9 100644 --- a/app/src/main/java/jp/juggler/subwaytooter/util/PostHelper.java +++ b/app/src/main/java/jp/juggler/subwaytooter/util/PostHelper.java @@ -1,5 +1,6 @@ package jp.juggler.subwaytooter.util; +import android.annotation.SuppressLint; import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.SharedPreferences; @@ -172,6 +173,7 @@ public class PostHelper implements CustomEmojiLister.Callback, EmojiPicker.Callb //noinspection deprecation final ProgressDialog progress = new ProgressDialog( activity ); + @SuppressLint("StaticFieldLeak") final AsyncTask< Void, Void, TootApiResult > task = new AsyncTask< Void, Void, TootApiResult >() { final SavedAccount target_account = account; @@ -607,7 +609,7 @@ public class PostHelper implements CustomEmojiLister.Callback, EmojiPicker.Callb String part = src.substring( last_sharp + 1, end ); if( reCharsNotTag.matcher( part ).find() ){ - log.d( "checkTag: character not tag in string %s", part ); + // log.d( "checkTag: character not tag in string %s", part ); checkEmoji(); return; } diff --git a/app/src/main/java/jp/juggler/subwaytooter/util/Utils.java b/app/src/main/java/jp/juggler/subwaytooter/util/Utils.java index 0187336f..a9d300c7 100644 --- a/app/src/main/java/jp/juggler/subwaytooter/util/Utils.java +++ b/app/src/main/java/jp/juggler/subwaytooter/util/Utils.java @@ -846,6 +846,7 @@ public class Utils { if( ct != null && ct.contains( "/html" ) ){ sv = new DecodeOptions().decodeHTML( null, null, sv ).toString(); } + // TODO: Amazon S3 が403を返した場合にcontent-typeが?/xmlでserverがAmazonならXMLをパースして sb.append( sv ); }