Explorar o código

Merge remote-tracking branch 'origin/master'

pan.zhang %!s(int64=2) %!d(string=hai) anos
pai
achega
4988cda88e
Modificáronse 19 ficheiros con 320 adicións e 6 borrados
  1. 26 1
      bannerview/src/main/java/com/zhpan/bannerview/BannerViewPager.java
  2. 16 0
      bannerview/src/main/java/com/zhpan/bannerview/BaseBannerAdapter.java
  3. 15 0
      bannerview/src/main/java/com/zhpan/bannerview/BaseViewHolder.java
  4. 16 0
      bannerview/src/main/java/com/zhpan/bannerview/annotation/AIndicatorGravity.java
  5. 16 0
      bannerview/src/main/java/com/zhpan/bannerview/annotation/APageStyle.java
  6. 16 0
      bannerview/src/main/java/com/zhpan/bannerview/annotation/Visibility.java
  7. 16 0
      bannerview/src/main/java/com/zhpan/bannerview/constants/IndicatorGravity.java
  8. 16 0
      bannerview/src/main/java/com/zhpan/bannerview/constants/PageStyle.java
  9. 19 3
      bannerview/src/main/java/com/zhpan/bannerview/indicator/DrawableIndicator.kt
  10. 16 0
      bannerview/src/main/java/com/zhpan/bannerview/manager/AttributeController.java
  11. 16 0
      bannerview/src/main/java/com/zhpan/bannerview/manager/BannerManager.java
  12. 26 0
      bannerview/src/main/java/com/zhpan/bannerview/manager/BannerOptions.java
  13. 16 0
      bannerview/src/main/java/com/zhpan/bannerview/provider/ReflectLayoutManager.java
  14. 14 0
      bannerview/src/main/java/com/zhpan/bannerview/provider/RoundViewOutlineProvider.java
  15. 16 0
      bannerview/src/main/java/com/zhpan/bannerview/provider/ScrollDurationManger.java
  16. 13 0
      bannerview/src/main/java/com/zhpan/bannerview/provider/ViewStyleSetter.java
  17. 17 2
      bannerview/src/main/java/com/zhpan/bannerview/transform/OverlapPageTransformer.kt
  18. 15 0
      bannerview/src/main/java/com/zhpan/bannerview/transform/ScaleInTransformer.java
  19. 15 0
      bannerview/src/main/java/com/zhpan/bannerview/utils/BannerUtils.java

+ 26 - 1
bannerview/src/main/java/com/zhpan/bannerview/BannerViewPager.java

@@ -1,3 +1,18 @@
+/*
+Copyright 2017 zhpanvip The BannerViewPager Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ */
 package com.zhpan.bannerview;
 
 import android.content.Context;
@@ -283,7 +298,8 @@ public class BannerViewPager<T> extends RelativeLayout implements LifecycleObser
 
   private void handlePosition() {
     if (mBannerPagerAdapter != null && mBannerPagerAdapter.getListSize() > 1 && isAutoPlay()) {
-      mViewPager.setCurrentItem(mViewPager.getCurrentItem() + 1);
+      mViewPager.setCurrentItem(mViewPager.getCurrentItem() + 1,
+          mBannerManager.getBannerOptions().isAutoScrollSmoothly());
       mHandler.postDelayed(mRunnable, getInterval());
     }
   }
@@ -1126,6 +1142,15 @@ public class BannerViewPager<T> extends RelativeLayout implements LifecycleObser
     return this;
   }
 
+  /**
+   * @param autoScrollSmoothly is auto play scroll smoothly.
+   */
+  public BannerViewPager<T> setAutoPlaySmoothly(boolean autoScrollSmoothly) {
+    mBannerManager.getBannerOptions()
+        .setAutoScrollSmoothly(autoScrollSmoothly);
+    return this;
+  }
+
   /**
    * @deprecated Use {@link BannerViewPager#disallowParentInterceptDownEvent(boolean)} instead.
    */

+ 16 - 0
bannerview/src/main/java/com/zhpan/bannerview/BaseBannerAdapter.java

@@ -1,3 +1,19 @@
+/*
+Copyright 2017 zhpanvip The BannerViewPager Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ */
+
 package com.zhpan.bannerview;
 
 import android.view.LayoutInflater;

+ 15 - 0
bannerview/src/main/java/com/zhpan/bannerview/BaseViewHolder.java

@@ -1,3 +1,18 @@
+/*
+Copyright 2017 zhpanvip The BannerViewPager Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ */
 package com.zhpan.bannerview;
 
 import android.graphics.Bitmap;

+ 16 - 0
bannerview/src/main/java/com/zhpan/bannerview/annotation/AIndicatorGravity.java

@@ -1,3 +1,19 @@
+/*
+Copyright 2017 zhpanvip The BannerViewPager Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ */
+
 package com.zhpan.bannerview.annotation;
 
 import androidx.annotation.IntDef;

+ 16 - 0
bannerview/src/main/java/com/zhpan/bannerview/annotation/APageStyle.java

@@ -1,3 +1,19 @@
+/*
+Copyright 2017 zhpanvip The BannerViewPager Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ */
+
 package com.zhpan.bannerview.annotation;
 
 import androidx.annotation.IntDef;

+ 16 - 0
bannerview/src/main/java/com/zhpan/bannerview/annotation/Visibility.java

@@ -1,3 +1,19 @@
+/*
+Copyright 2017 zhpanvip The BannerViewPager Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ */
+
 package com.zhpan.bannerview.annotation;
 
 import android.view.View;

+ 16 - 0
bannerview/src/main/java/com/zhpan/bannerview/constants/IndicatorGravity.java

@@ -1,3 +1,19 @@
+/*
+Copyright 2017 zhpanvip The BannerViewPager Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ */
+
 package com.zhpan.bannerview.constants;
 
 /**

+ 16 - 0
bannerview/src/main/java/com/zhpan/bannerview/constants/PageStyle.java

@@ -1,3 +1,19 @@
+/*
+Copyright 2017 zhpanvip The BannerViewPager Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ */
+
 package com.zhpan.bannerview.constants;
 
 /**

+ 19 - 3
bannerview/src/main/java/com/zhpan/bannerview/indicator/DrawableIndicator.kt

@@ -1,3 +1,19 @@
+/*
+Copyright 2017 zhpanvip The BannerViewPager Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ */
+
 package com.zhpan.bannerview.indicator
 
 import android.content.Context
@@ -184,11 +200,11 @@ class DrawableIndicator @JvmOverloads constructor(
     drawable?.let {
       if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
         drawable = DrawableCompat.wrap(drawable!!)
-            .mutate()
+          .mutate()
       }
       val bitmap = Bitmap.createBitmap(
-          drawable!!.intrinsicWidth,
-          drawable!!.intrinsicHeight, Bitmap.Config.ARGB_8888
+        drawable!!.intrinsicWidth,
+        drawable!!.intrinsicHeight, Bitmap.Config.ARGB_8888
       )
       val canvas = Canvas(bitmap)
       drawable!!.setBounds(0, 0, canvas.width, canvas.height)

+ 16 - 0
bannerview/src/main/java/com/zhpan/bannerview/manager/AttributeController.java

@@ -1,3 +1,19 @@
+/*
+Copyright 2017 zhpanvip The BannerViewPager Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ */
+
 package com.zhpan.bannerview.manager;
 
 import android.content.Context;

+ 16 - 0
bannerview/src/main/java/com/zhpan/bannerview/manager/BannerManager.java

@@ -1,3 +1,19 @@
+/*
+Copyright 2017 zhpanvip The BannerViewPager Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ */
+
 package com.zhpan.bannerview.manager;
 
 import android.content.Context;

+ 26 - 0
bannerview/src/main/java/com/zhpan/bannerview/manager/BannerOptions.java

@@ -1,3 +1,19 @@
+/*
+Copyright 2017 zhpanvip The BannerViewPager Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ */
+
 package com.zhpan.bannerview.manager;
 
 import android.view.View;
@@ -69,6 +85,8 @@ public class BannerOptions {
 
   private boolean stopLoopWhenDetachedFromWindow = true;
 
+  private boolean autoScrollSmoothly = true;
+
   private final IndicatorOptions mIndicatorOptions;
 
   public int getInterval() {
@@ -215,6 +233,14 @@ public class BannerOptions {
     mIndicatorMargin = new IndicatorMargin(left, top, right, bottom);
   }
 
+  public boolean isAutoScrollSmoothly() {
+    return autoScrollSmoothly;
+  }
+
+  public void setAutoScrollSmoothly(boolean autoScrollSmoothly) {
+    this.autoScrollSmoothly = autoScrollSmoothly;
+  }
+
   public float[] getRoundRectRadiusArray() {
     return roundRadiusArray;
   }

+ 16 - 0
bannerview/src/main/java/com/zhpan/bannerview/provider/ReflectLayoutManager.java

@@ -1,3 +1,19 @@
+/*
+Copyright 2017 zhpanvip The BannerViewPager Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ */
+
 package com.zhpan.bannerview.provider;
 
 import androidx.recyclerview.widget.LinearLayoutManager;

+ 14 - 0
bannerview/src/main/java/com/zhpan/bannerview/provider/RoundViewOutlineProvider.java

@@ -1,4 +1,18 @@
+/*
+Copyright 2017 zhpanvip The BannerViewPager Open Source Project
 
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ */
 
 package com.zhpan.bannerview.provider;
 

+ 16 - 0
bannerview/src/main/java/com/zhpan/bannerview/provider/ScrollDurationManger.java

@@ -1,3 +1,19 @@
+/*
+Copyright 2017 zhpanvip The BannerViewPager Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ */
+
 package com.zhpan.bannerview.provider;
 
 import android.graphics.Rect;

+ 13 - 0
bannerview/src/main/java/com/zhpan/bannerview/provider/ViewStyleSetter.java

@@ -1,5 +1,18 @@
+/*
+Copyright 2017 zhpanvip The BannerViewPager Open Source Project
 
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
 
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ */
 package com.zhpan.bannerview.provider;
 
 import android.os.Build;

+ 17 - 2
bannerview/src/main/java/com/zhpan/bannerview/transform/OverlapPageTransformer.kt

@@ -1,3 +1,18 @@
+/*
+Copyright 2017 zhpanvip The BannerViewPager Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ */
 package com.zhpan.bannerview.transform
 
 import android.os.Build
@@ -24,7 +39,7 @@ class OverlapPageTransformer(
   init {
     require(minScale in 0f..1f) { "minScale value should be between 1.0 to 0.0" }
     require(
-        unSelectedItemAlpha in 0f..1f
+      unSelectedItemAlpha in 0f..1f
     ) { "unSelectedItemAlpha value should be between 1.0 to 0.0" }
   }
 
@@ -72,7 +87,7 @@ class OverlapPageTransformer(
               }
         }
         else -> throw IllegalArgumentException(
-            "Gives correct orientation value, ViewPager2.ORIENTATION_HORIZONTAL or ViewPager2.ORIENTATION_VERTICAL"
+          "Gives correct orientation value, ViewPager2.ORIENTATION_HORIZONTAL or ViewPager2.ORIENTATION_VERTICAL"
         )
       }
 

+ 15 - 0
bannerview/src/main/java/com/zhpan/bannerview/transform/ScaleInTransformer.java

@@ -1,3 +1,18 @@
+/*
+Copyright 2017 zhpanvip The BannerViewPager Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ */
 package com.zhpan.bannerview.transform;
 
 import android.view.View;

+ 15 - 0
bannerview/src/main/java/com/zhpan/bannerview/utils/BannerUtils.java

@@ -1,3 +1,18 @@
+/*
+Copyright 2017 zhpanvip The BannerViewPager Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+ */
 package com.zhpan.bannerview.utils;
 
 import android.content.res.Resources;