diff --git a/app/build.gradle b/app/build.gradle index b5df14fa..9bc118e3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "jp.juggler.subwaytooter" minSdkVersion 21 targetSdkVersion 25 - versionCode 38 - versionName "0.3.8" + versionCode 39 + versionName "0.3.9" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/java/jp/juggler/subwaytooter/ActMutedApp.java b/app/src/main/java/jp/juggler/subwaytooter/ActMutedApp.java index 277b3388..6bc4327f 100644 --- a/app/src/main/java/jp/juggler/subwaytooter/ActMutedApp.java +++ b/app/src/main/java/jp/juggler/subwaytooter/ActMutedApp.java @@ -88,9 +88,12 @@ public class ActMutedApp extends AppCompatActivity { // 左にスワイプした(右端に青が見えた) なら要素を削除する if( swipedDirection == ListSwipeItem.SwipeDirection.LEFT ){ - MyItem adapterItem = (MyItem) item.getTag(); - MutedApp.delete( adapterItem.name ); - listAdapter.removeItem( listAdapter.getPositionForItem( adapterItem ) ); + Object o = item.getTag(); + if( o instanceof MyItem){ + MyItem adapterItem = ( MyItem ) o; + MutedApp.delete( adapterItem.name ); + listAdapter.removeItem( listAdapter.getPositionForItem( adapterItem ) ); + } } } } ); diff --git a/app/src/main/java/jp/juggler/subwaytooter/Column.java b/app/src/main/java/jp/juggler/subwaytooter/Column.java index ba9bec4f..d2c5e2e1 100644 --- a/app/src/main/java/jp/juggler/subwaytooter/Column.java +++ b/app/src/main/java/jp/juggler/subwaytooter/Column.java @@ -2211,7 +2211,11 @@ class Column { restore_y = getItemTop( restore_idx ); }catch( IndexOutOfBoundsException ex ){ restore_idx = position; - restore_y = getItemTop( restore_idx ); + try{ + restore_y = getItemTop( restore_idx ); + }catch( IndexOutOfBoundsException ex2 ){ + restore_idx = -1; + } } } @@ -2221,7 +2225,11 @@ class Column { fireShowContent(); if( holder != null ){ - setItemTop( restore_idx + added - 1, restore_y ); + if(restore_idx >= 0 ){ + setItemTop( restore_idx + added - 1, restore_y ); + }else{ + // ギャップが画面内にない場合、何もしない + } }else{ if( scroll_save != null ){ scroll_save.pos += added - 1;