クラッシュ対応
This commit is contained in:
parent
9af3b7ec21
commit
17986f614a
|
@ -868,7 +868,18 @@ public class ActMain extends AppCompatActivity
|
|||
|
||||
@Override
|
||||
protected void onPostExecute( TootApiResult result ){
|
||||
try{
|
||||
progress.dismiss();
|
||||
}catch(Throwable ignored){
|
||||
// java.lang.IllegalArgumentException:
|
||||
// at android.view.WindowManagerGlobal.findViewLocked(WindowManagerGlobal.java:396)
|
||||
// at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:322)
|
||||
// at android.view.WindowManagerImpl.removeViewImmediate(WindowManagerImpl.java:116)
|
||||
// at android.app.Dialog.dismissDialog(Dialog.java:341)
|
||||
// at android.app.Dialog.dismiss(Dialog.java:324)
|
||||
// at jp.juggler.subwaytooter.ActMain$10$1.onPostExecute(ActMain.java:867)
|
||||
// at jp.juggler.subwaytooter.ActMain$10$1.onPostExecute(ActMain.java:837)
|
||||
}
|
||||
|
||||
//noinspection StatementWithEmptyBody
|
||||
if( result == null ){
|
||||
|
|
|
@ -1425,7 +1425,19 @@ public class ActPost extends AppCompatActivity implements View.OnClickListener,
|
|||
|
||||
@Override
|
||||
protected void onPostExecute( TootApiResult result ){
|
||||
try{
|
||||
progress.dismiss();
|
||||
}catch(Throwable ignored){
|
||||
// java.lang.IllegalArgumentException:
|
||||
// at android.view.WindowManagerGlobal.findViewLocked(WindowManagerGlobal.java:396)
|
||||
// at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:322)
|
||||
// at android.view.WindowManagerImpl.removeViewImmediate(WindowManagerImpl.java:116)
|
||||
// at android.app.Dialog.dismissDialog(Dialog.java:341)
|
||||
// at android.app.Dialog.dismiss(Dialog.java:324)
|
||||
// at jp.juggler.subwaytooter.ActMain$10$1.onPostExecute(ActMain.java:867)
|
||||
// at jp.juggler.subwaytooter.ActMain$10$1.onPostExecute(ActMain.java:837)
|
||||
}
|
||||
|
||||
//noinspection StatementWithEmptyBody
|
||||
if( result == null ){
|
||||
// cancelled.
|
||||
|
|
|
@ -95,7 +95,6 @@ public class MyNetworkImageView extends AppCompatImageView {
|
|||
|
||||
/**
|
||||
* Loads the image for the view if it isn't already loaded.
|
||||
*
|
||||
*/
|
||||
void loadImageIfNecessary( final boolean isInLayoutPass ){
|
||||
int width = getWidth();
|
||||
|
@ -137,23 +136,34 @@ public class MyNetworkImageView extends AppCompatImageView {
|
|||
|
||||
final AtomicBoolean isImmediate = new AtomicBoolean( true );
|
||||
mTargetUrl = mUrl;
|
||||
try{
|
||||
mTarget = Glide.with( getContext() )
|
||||
.load( mUrl )
|
||||
.asBitmap()
|
||||
.into(
|
||||
new SimpleTarget< Bitmap >( desiredWidth, desiredHeight ) {
|
||||
@Override public void onLoadFailed( Exception e, Drawable errorDrawable ){
|
||||
try{
|
||||
// このViewは別の画像を表示するように指定が変わっていた
|
||||
if( mTargetUrl == null || ! mTargetUrl.equals( mUrl ) ) return;
|
||||
|
||||
e.printStackTrace();
|
||||
if( mErrorImageId != 0 ) setImageResource( mErrorImageId );
|
||||
}catch( Throwable ex ){
|
||||
ex.printStackTrace();
|
||||
// java.lang.NullPointerException:
|
||||
// at jp.juggler.subwaytooter.view.MyNetworkImageView$1.onLoadFailed(MyNetworkImageView.java:147)
|
||||
// at com.bumptech.glide.request.GenericRequest.setErrorPlaceholder(GenericRequest.java:404)
|
||||
// at com.bumptech.glide.request.GenericRequest.onException(GenericRequest.java:548)
|
||||
// at com.bumptech.glide.load.engine.EngineJob.handleExceptionOnMainThread(EngineJob.java:183)
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onResourceReady(
|
||||
final Bitmap bitmap
|
||||
, final GlideAnimation< ? super Bitmap > glideAnimation
|
||||
){
|
||||
try{
|
||||
if( isImmediate.get() && isInLayoutPass ){
|
||||
post( new Runnable() {
|
||||
@Override public void run(){
|
||||
|
@ -176,10 +186,21 @@ public class MyNetworkImageView extends AppCompatImageView {
|
|||
d.setCornerRadius( mCornerRadius );
|
||||
setImageDrawable( d );
|
||||
}
|
||||
}catch( Throwable ex ){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
isImmediate.set( false );
|
||||
}catch( Throwable ex ){
|
||||
ex.printStackTrace();
|
||||
// java.lang.IllegalArgumentException:
|
||||
// at com.bumptech.glide.manager.RequestManagerRetriever.assertNotDestroyed(RequestManagerRetriever.java:134)
|
||||
// at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:102)
|
||||
// at com.bumptech.glide.manager.RequestManagerRetriever.get(RequestManagerRetriever.java:87)
|
||||
// at com.bumptech.glide.Glide.with(Glide.java:657)
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected void onLayout( boolean changed, int left, int top, int right, int bottom ){
|
||||
|
|
Loading…
Reference in New Issue