Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用glide4.6.1点击返回键时异常 #43

Closed
ufbeans opened this issue Aug 8, 2018 · 8 comments
Closed

使用glide4.6.1点击返回键时异常 #43

ufbeans opened this issue Aug 8, 2018 · 8 comments
Labels
Milestone

Comments

@ufbeans
Copy link

ufbeans commented Aug 8, 2018

Caused by: com.jkb.fragment.rigger.c.c: Can not find Puppet annotation.please add Puppet annotation for the class com.bumptech.glide.manager.SupportRequestManagerFragment
        at com.jkb.fragment.rigger.rigger.Rigger.getRigger(Unknown Source:57)
        at com.jkb.fragment.rigger.rigger._Rigger.dispatchBackPressed(Unknown Source:45)
        at com.jkb.fragment.rigger.rigger.Rigger.onBackPressed(Unknown Source:9)
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.jkb.fragment.rigger.b.a.h(Unknown Source:26)
 ```
@ufbeans
Copy link
Author

ufbeans commented Aug 8, 2018

implementation "com.github.bumptech.glide:glide:4.6.1"
implementation "com.github.bumptech.glide:okhttp3-integration:4.6.1"
implementation "com.github.bumptech.glide:recyclerview-integration:4.6.1"
annotationProcessor "com.github.bumptech.glide:compiler:4.6.1"

@ufbeans
Copy link
Author

ufbeans commented Aug 8, 2018

在demo中TestFragment中添加

    protected void init(Bundle savedInstanceState) {
        findViewById(R.id.fs_startFragment).setOnClickListener(this);
        findViewById(R.id.fs_startFragmentDelay).setOnClickListener(this);
        findViewById(R.id.fs_showFragment).setOnClickListener(this);
        findViewById(R.id.fs_replaceFragment).setOnClickListener(this);
        findViewById(R.id.fs_startFragmentForResult).setOnClickListener(this);
        findViewById(R.id.fs_lazyload).setOnClickListener(this);
        findViewById(R.id.fs_activity).setOnClickListener(this);
        ImageView imageView = (ImageView) findViewById(R.id.image);
        GlideApp.with(this).load("https://timesks.oss-cn-shenzhen.aliyuncs.com/user/header/tt191.jpg").into(imageView);
    }

@ufbeans
Copy link
Author

ufbeans commented Aug 8, 2018

@GlideModule
public class ContactUriModule extends AppGlideModule {
    private static final String TAG = "ContactUriModule";

    private static final int DEFAULT_CACHE_SIZE = 1024 * 1024 * 4;
    private static final int DEFAULT_DISK_CACHE_SIZE = 1024 * 1024 * 200;
    // Intentionally keyFailed.

    @Override
    public boolean isManifestParsingEnabled() {
        return false;
    }

    @Override
    public void applyOptions(@NonNull Context context, @NonNull GlideBuilder builder) {

        builder.setBitmapPool(new LruBitmapPool(getCacheSize(context)));
        builder.setMemoryCache(new LruResourceCache(getCacheSize(context)));
        builder.setDiskCache(new InternalCacheDiskCacheFactory(context, "cache", DEFAULT_DISK_CACHE_SIZE));
        builder.setLogLevel(Log.ERROR);

        super.applyOptions(context, builder);
    }

    private long getCacheSize(Context context) {
        long cacheSize = DEFAULT_CACHE_SIZE;
        ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
        ActivityManager.MemoryInfo mi = new ActivityManager.MemoryInfo();
        if (am != null) {
            am.getMemoryInfo(mi);
            long availMem = mi.availMem;
            cacheSize = availMem / 40;
        }
        if (cacheSize < DEFAULT_CACHE_SIZE) {
            cacheSize = DEFAULT_CACHE_SIZE;
        }
        Log.i(TAG, "getCacheSize: " + cacheSize);
        return cacheSize;
    }
}

@JingYeoh JingYeoh added the bug label Aug 10, 2018
@JingYeoh
Copy link
Owner

@ufbeans 感谢反馈,周末会对你提出的这种场景进行尝试,如果有问题会尽快解决。

@JingYeoh
Copy link
Owner

@ufbeans 找不到 GlideApp 类,方便的话对你遇到的这个问题提交一个PR,我来排查一下。

@ufbeans
Copy link
Author

ufbeans commented Aug 13, 2018

@JustKiddingBaby 提交了。你有时间看一下

@iFanie
Copy link

iFanie commented Aug 13, 2018

@JustKiddingBaby since no one is going to use Glide fragments by hand, you could just ignore any instance of com.bumptech.glide.manager.SupportRequestManagerFragment and not throw a RiggerException

JingYeoh added a commit that referenced this issue Aug 16, 2018
@JingYeoh JingYeoh mentioned this issue Aug 16, 2018
JingYeoh added a commit that referenced this issue Aug 16, 2018
@JingYeoh JingYeoh added this to the release-1.4 milestone Aug 16, 2018
@JingYeoh
Copy link
Owner

@ufbeans 已经在1.4.3版本中修复。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants