fix BannerView bugs

androidx
Ztiany 5 years ago
parent fb8c8c90d5
commit 31a626abb9
  1. 9
      lib_base/src/main/java/com/android/base/imageloader/ProgressGlideModule.java
  2. 3
      lib_base/src/main/java/com/android/base/utils/android/ActFragWrapper.java
  3. 18
      lib_base/src/main/java/com/android/base/widget/viewpager/BannerViewPager.java
  4. 1
      lib_media_selector/src/main/java/com/android/sdk/mediaselector/CropOptions.java

@ -16,21 +16,26 @@ import okhttp3.OkHttpClient;
public class ProgressGlideModule extends AppGlideModule {
//配置glide网络加载框架
@Override
@CallSuper
public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) {
//配置glide网络加载框架
ProgressManager.getInstance().setRefreshTime(getRefreshTime());
OkHttpClient.Builder builder = ProgressManager.getInstance().withProgress(new OkHttpClient.Builder());
configImageOkHttp(builder);
registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(builder.build()));
}
//不使用清单配置的方式,减少初始化时间
@Override
public boolean isManifestParsingEnabled() {
//不使用清单配置的方式,减少初始化时间
return false;
}
protected void configImageOkHttp(OkHttpClient.Builder builder) {
}
protected int getRefreshTime() {
return 200;
}

@ -18,6 +18,9 @@ public class ActFragWrapper {
private Fragment mFragment;
private Activity mActivity;
private ActFragWrapper() {
}
public static ActFragWrapper create(Activity activity) {
ActFragWrapper context = new ActFragWrapper();
context.mActivity = activity;

@ -109,11 +109,21 @@ public class BannerViewPager extends FrameLayout {
}
public void setCurrentPosition(int position) {
if (position < 0) {
return;
}
if (mImageUrlList.size() > 1) {
if (position <= mImageUrlList.size() - 2) {
position++;
} else {
position = mImageUrlList.size() - 2;
int realSize = mImageUrlList.size() - 2;
if (position >= realSize) {
position = realSize - 1;
}
if (mOnBannerPositionChangedListener != null) {
mOnBannerPositionChangedListener.onPagePositionChanged(position);
}
position++;
} else {
if (mOnBannerPositionChangedListener != null) {
mOnBannerPositionChangedListener.onPagePositionChanged(0);
}
}
mViewPager.setCurrentItem(position);

@ -16,7 +16,6 @@ public class CropOptions implements Serializable {
private int outputY;
public CropOptions() {
}
int getAspectX() {

Loading…
Cancel
Save