クラッシュ対応
This commit is contained in:
parent
9af3b7ec21
commit
17986f614a
|
@ -868,7 +868,18 @@ public class ActMain extends AppCompatActivity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute( TootApiResult result ){
|
protected void onPostExecute( TootApiResult result ){
|
||||||
|
try{
|
||||||
progress.dismiss();
|
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
|
//noinspection StatementWithEmptyBody
|
||||||
if( result == null ){
|
if( result == null ){
|
||||||
|
|
|
@ -1425,7 +1425,19 @@ public class ActPost extends AppCompatActivity implements View.OnClickListener,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute( TootApiResult result ){
|
protected void onPostExecute( TootApiResult result ){
|
||||||
|
try{
|
||||||
progress.dismiss();
|
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
|
//noinspection StatementWithEmptyBody
|
||||||
if( result == null ){
|
if( result == null ){
|
||||||
// cancelled.
|
// cancelled.
|
||||||
|
|
|
@ -95,7 +95,6 @@ public class MyNetworkImageView extends AppCompatImageView {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the image for the view if it isn't already loaded.
|
* Loads the image for the view if it isn't already loaded.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
void loadImageIfNecessary( final boolean isInLayoutPass ){
|
void loadImageIfNecessary( final boolean isInLayoutPass ){
|
||||||
int width = getWidth();
|
int width = getWidth();
|
||||||
|
@ -137,23 +136,34 @@ public class MyNetworkImageView extends AppCompatImageView {
|
||||||
|
|
||||||
final AtomicBoolean isImmediate = new AtomicBoolean( true );
|
final AtomicBoolean isImmediate = new AtomicBoolean( true );
|
||||||
mTargetUrl = mUrl;
|
mTargetUrl = mUrl;
|
||||||
|
try{
|
||||||
mTarget = Glide.with( getContext() )
|
mTarget = Glide.with( getContext() )
|
||||||
.load( mUrl )
|
.load( mUrl )
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.into(
|
.into(
|
||||||
new SimpleTarget< Bitmap >( desiredWidth, desiredHeight ) {
|
new SimpleTarget< Bitmap >( desiredWidth, desiredHeight ) {
|
||||||
@Override public void onLoadFailed( Exception e, Drawable errorDrawable ){
|
@Override public void onLoadFailed( Exception e, Drawable errorDrawable ){
|
||||||
|
try{
|
||||||
// このViewは別の画像を表示するように指定が変わっていた
|
// このViewは別の画像を表示するように指定が変わっていた
|
||||||
if( mTargetUrl == null || ! mTargetUrl.equals( mUrl ) ) return;
|
if( mTargetUrl == null || ! mTargetUrl.equals( mUrl ) ) return;
|
||||||
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
if( mErrorImageId != 0 ) setImageResource( mErrorImageId );
|
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(
|
@Override public void onResourceReady(
|
||||||
final Bitmap bitmap
|
final Bitmap bitmap
|
||||||
, final GlideAnimation< ? super Bitmap > glideAnimation
|
, final GlideAnimation< ? super Bitmap > glideAnimation
|
||||||
){
|
){
|
||||||
|
try{
|
||||||
if( isImmediate.get() && isInLayoutPass ){
|
if( isImmediate.get() && isInLayoutPass ){
|
||||||
post( new Runnable() {
|
post( new Runnable() {
|
||||||
@Override public void run(){
|
@Override public void run(){
|
||||||
|
@ -176,10 +186,21 @@ public class MyNetworkImageView extends AppCompatImageView {
|
||||||
d.setCornerRadius( mCornerRadius );
|
d.setCornerRadius( mCornerRadius );
|
||||||
setImageDrawable( d );
|
setImageDrawable( d );
|
||||||
}
|
}
|
||||||
|
}catch( Throwable ex ){
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
isImmediate.set( false );
|
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 ){
|
@Override protected void onLayout( boolean changed, int left, int top, int right, int bottom ){
|
||||||
|
|
Loading…
Reference in New Issue