SherlockGougou / BigImageViewPager

🔥🔥🔥 BigImage ImageView ViewPager 支持超长图、超大图的图片浏览器,优化内存,支持手势放大、下拉关闭、查看原图、加载百分比、保存图片等功能。
Other
2.17k stars 247 forks source link

您好,百分比进度回调无法回调 #31

Closed dary123 closed 5 years ago

dary123 commented 5 years ago

.setProgressLayoutId(ImagePreview.PROGRESS_THEME_CIRCLE_TEXT, new OnOriginProgressListener() { @Override public void progress(View parentView, int progress) { Log.d(TAG, "progress: " + progress);

                        // 需要找到进度控件并设置百分比,回调中的parentView即是传入的布局的根View,可通过parentView找到进度控件:
                        ProgressBar progressBar = parentView.findViewById(R.id.sh_progress_view);
                        TextView textView = parentView.findViewById(R.id.sh_progress_text);
                        progressBar.setProgress(progress);
                        String progressText = progress + "%";
                        textView.setText(progressText);
                    }

                    @Override public void finish(View parentView) {
                        Log.d(TAG, "finish: ");
                    }
                })

打印不出来百分比

dary123 commented 5 years ago

运行了demo,也没用回调日志呀,进度条还是之前绿色的那个

SherlockGougou commented 5 years ago

你把这个setProgressLayoutId先注释掉,看看查看原图能否显示百分呢?

dary123 commented 5 years ago

还是没有,还是之前的绿色进度条

SherlockGougou commented 5 years ago

image Demo中我运行看是有回调的呀

dary123 commented 5 years ago

奇怪,难道跟安卓系统有关?我用的是红米5,安卓系统是7.1.2

dary123 commented 5 years ago

ide使用的android stduio3.2.1

dary123 commented 5 years ago

我这边只能回调onPageScrolled这个出来,之前你回复我的,让我在源码里那个回调的地方改,我打印了,也是没有进度回调

SherlockGougou commented 5 years ago

你的图片是只有一张,还是有缩略图和原图之分呢?

SherlockGougou commented 5 years ago

这个进度只针对点击查看原图后,原图加载的百分比的,缩略图的百分比是没有的。

dary123 commented 5 years ago

我的项目中没有缩略图和原图之分,就一张,我刚刚使用的demo,demo里我选择是仅原图查看的

dary123 commented 5 years ago

四种加载策略我在demo中都试了,都没有回调

SherlockGougou commented 5 years ago

针对默认图片的百分比功能暂时没有,后续我再加吧。现在的百分比功能,只针对有缩略图和原图之分有效。

dary123 commented 5 years ago

可是我使用的是demo啊,demo目前是没有缩略图和原图之分么

SherlockGougou commented 5 years ago

Demo中前几张图片是没有区分的,后面有查看原图按钮的才有。你往后划划再试试。

SherlockGougou commented 5 years ago

前几张图片都是为了测试https、奇葩url、奇葩后缀、奇葩宽高比等添加的,后面的几张正常图片,才有缩略图和和原图之分。

dary123 commented 5 years ago

恩,原来是这样,谢谢

SherlockGougou commented 5 years ago

你需要的那个默认图的百分比功能,我年后优先添加吧。

dary123 commented 5 years ago

还有一个问题,产品提了一个奇葩的需求,图片放大时系统状态栏要消失,能做到吗,我只听过状态栏透明

SherlockGougou commented 5 years ago

放大时?放多大时?不如直接就隐藏,自己通过配置预览的额那个activity的主题为全屏,就会隐藏状态栏。如多是说图片被状态栏覆盖时再隐藏,就比较复杂了,得监听图片目前显示的高度。

dary123 commented 5 years ago

说错了,不是放大,就是图片浏览时直接隐藏状态栏,如何使Activity全屏呢

SherlockGougou commented 5 years ago

image 这是基础知识哟,自己多查查。

dary123 commented 5 years ago

哈哈,多谢,可能我的能力还不够,很多东西还没来得及去了解

dary123 commented 5 years ago

好像改起来也很容易呀,是不是只要将图片上 那串代码放到刚进来的时候图片加载的方法里就ok了,这样是不是就不用点击查看原图才显示百分比了 156

SherlockGougou commented 5 years ago

差不多是这个意思,你可以先自己尝试改改。