From ddf0b8110b33d7100aed06a6985317a6a098d662 Mon Sep 17 00:00:00 2001 From: Pablo Pajuelo Cabezas Date: Wed, 18 Dec 2024 09:58:48 +0100 Subject: [PATCH] build: remove viewpagerdotsindicator module --- app/build.gradle.kts | 1 - .../dataSetTable/DataSetTableActivity.kt | 22 +- .../layout/violation_rules_bottom_sheet.xml | 4 +- .../org/dhis2/commons/ui/PagerIndicator.kt | 119 +++++++ settings.gradle.kts | 2 +- viewpagerdotsindicator/.gitignore | 39 --- viewpagerdotsindicator/build.gradle.kts | 32 -- viewpagerdotsindicator/proguard-rules.pro | 17 - .../src/main/AndroidManifest.xml | 5 - .../viewpagerdotsindicator/DotsIndicator.java | 277 --------------- .../SpringDotsIndicator.java | 293 ---------------- .../viewpagerdotsindicator/UiUtils.java | 12 - .../WormDotsIndicator.java | 324 ------------------ .../src/main/res/drawable/dot_background.xml | 6 - .../res/drawable/spring_dot_background.xml | 6 - .../drawable/spring_dot_stroke_background.xml | 9 - .../main/res/drawable/worm_dot_background.xml | 6 - .../drawable/worm_dot_stroke_background.xml | 9 - .../src/main/res/layout/dot_layout.xml | 16 - .../src/main/res/layout/spring_dot_layout.xml | 16 - .../src/main/res/layout/worm_dot_layout.xml | 16 - .../src/main/res/values/attrs.xml | 40 --- .../src/main/res/values/strings.xml | 3 - .../ExampleUnitTest.java | 15 - 24 files changed, 142 insertions(+), 1147 deletions(-) create mode 100644 commons/src/main/java/org/dhis2/commons/ui/PagerIndicator.kt delete mode 100644 viewpagerdotsindicator/.gitignore delete mode 100644 viewpagerdotsindicator/build.gradle.kts delete mode 100644 viewpagerdotsindicator/proguard-rules.pro delete mode 100644 viewpagerdotsindicator/src/main/AndroidManifest.xml delete mode 100644 viewpagerdotsindicator/src/main/java/com/tbuonomo/viewpagerdotsindicator/DotsIndicator.java delete mode 100644 viewpagerdotsindicator/src/main/java/com/tbuonomo/viewpagerdotsindicator/SpringDotsIndicator.java delete mode 100644 viewpagerdotsindicator/src/main/java/com/tbuonomo/viewpagerdotsindicator/UiUtils.java delete mode 100644 viewpagerdotsindicator/src/main/java/com/tbuonomo/viewpagerdotsindicator/WormDotsIndicator.java delete mode 100644 viewpagerdotsindicator/src/main/res/drawable/dot_background.xml delete mode 100644 viewpagerdotsindicator/src/main/res/drawable/spring_dot_background.xml delete mode 100644 viewpagerdotsindicator/src/main/res/drawable/spring_dot_stroke_background.xml delete mode 100644 viewpagerdotsindicator/src/main/res/drawable/worm_dot_background.xml delete mode 100644 viewpagerdotsindicator/src/main/res/drawable/worm_dot_stroke_background.xml delete mode 100644 viewpagerdotsindicator/src/main/res/layout/dot_layout.xml delete mode 100644 viewpagerdotsindicator/src/main/res/layout/spring_dot_layout.xml delete mode 100644 viewpagerdotsindicator/src/main/res/layout/worm_dot_layout.xml delete mode 100644 viewpagerdotsindicator/src/main/res/values/attrs.xml delete mode 100644 viewpagerdotsindicator/src/main/res/values/strings.xml delete mode 100644 viewpagerdotsindicator/src/test/java/com/tbuonomo/viewpagerdotsindicator/ExampleUnitTest.java diff --git a/app/build.gradle.kts b/app/build.gradle.kts index de5b427240..c8d661c2dc 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -243,7 +243,6 @@ kotlin { dependencies { implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) - implementation(project(":viewpagerdotsindicator")) implementation(project(":dhis_android_analytics")) implementation(project(":form")) implementation(project(":commons")) diff --git a/app/src/main/java/org/dhis2/usescases/datasets/dataSetTable/DataSetTableActivity.kt b/app/src/main/java/org/dhis2/usescases/datasets/dataSetTable/DataSetTableActivity.kt index 07870ed8a1..be591c07c7 100644 --- a/app/src/main/java/org/dhis2/usescases/datasets/dataSetTable/DataSetTableActivity.kt +++ b/app/src/main/java/org/dhis2/usescases/datasets/dataSetTable/DataSetTableActivity.kt @@ -14,6 +14,7 @@ import androidx.compose.material.icons.Icons import androidx.compose.material.icons.automirrored.outlined.HelpOutline import androidx.compose.material.icons.outlined.LockReset import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue @@ -22,6 +23,7 @@ import androidx.databinding.DataBindingUtil import androidx.lifecycle.Lifecycle import androidx.lifecycle.lifecycleScope import androidx.lifecycle.repeatOnLifecycle +import androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.bottomsheet.BottomSheetBehavior.BottomSheetCallback import com.google.android.material.shape.CornerFamily @@ -44,6 +46,7 @@ import org.dhis2.commons.extensions.closeKeyboard import org.dhis2.commons.matomo.Labels.Companion.CLICK import org.dhis2.commons.sync.OnDismissListener import org.dhis2.commons.sync.SyncContext +import org.dhis2.commons.ui.PagerIndicator import org.dhis2.databinding.ActivityDatasetTableBinding import org.dhis2.usescases.datasets.dataSetTable.dataSetDetail.DataSetDetailFragment.Companion.create import org.dhis2.usescases.datasets.dataSetTable.dataSetSection.DataSetSection @@ -325,7 +328,24 @@ class DataSetTableActivity : ActivityGlobalAbstract(), DataSetTableContract.View resources.getQuantityText(R.plurals.error_message, violations.size) binding.BSLayout.violationsViewPager.adapter = ValidationResultViolationsAdapter(this, violations) - binding.BSLayout.dotsIndicator.setViewPager(binding.BSLayout.violationsViewPager) + binding.BSLayout.dotsIndicator.setContent { + var currentPage by remember { mutableIntStateOf(0) } + binding.BSLayout.violationsViewPager.registerOnPageChangeCallback( + object : OnPageChangeCallback() { + override fun onPageSelected(position: Int) { + super.onPageSelected(position) + currentPage = position + } + }, + ) + if (violations.isNotEmpty()) { + PagerIndicator( + pageCount = violations.size, + currentPage = currentPage, + dotIndicatorColor = SurfaceColor.Error, + ) + } + } behavior = BottomSheetBehavior.from(binding.BSLayout.bottomSheetLayout) behavior!!.addBottomSheetCallback(object : BottomSheetCallback() { override fun onStateChanged(bottomSheet: View, newState: Int) { diff --git a/app/src/main/res/layout/violation_rules_bottom_sheet.xml b/app/src/main/res/layout/violation_rules_bottom_sheet.xml index 073c5a1ae5..ca71d0311a 100644 --- a/app/src/main/res/layout/violation_rules_bottom_sheet.xml +++ b/app/src/main/res/layout/violation_rules_bottom_sheet.xml @@ -99,13 +99,11 @@ app:layout_constraintTop_toTopOf="@id/title" app:srcCompat="@drawable/ic_arrow_up" /> - diff --git a/commons/src/main/java/org/dhis2/commons/ui/PagerIndicator.kt b/commons/src/main/java/org/dhis2/commons/ui/PagerIndicator.kt new file mode 100644 index 0000000000..45303cec24 --- /dev/null +++ b/commons/src/main/java/org/dhis2/commons/ui/PagerIndicator.kt @@ -0,0 +1,119 @@ +package org.dhis2.commons.ui + +import androidx.compose.animation.core.animateDpAsState +import androidx.compose.foundation.ExperimentalFoundationApi +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.lazy.LazyListState +import androidx.compose.foundation.lazy.LazyRow +import androidx.compose.foundation.lazy.rememberLazyListState +import androidx.compose.foundation.pager.HorizontalPager +import androidx.compose.foundation.pager.rememberPagerState +import androidx.compose.foundation.shape.CircleShape +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.derivedStateOf +import androidx.compose.runtime.getValue +import androidx.compose.runtime.remember +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import kotlin.math.max + +@OptIn(ExperimentalFoundationApi::class) +@Preview(showBackground = true, backgroundColor = 0xFFFFFFFF) +@Composable +fun PagerIndicatorScreen() { + Column( + modifier = Modifier.fillMaxSize(), + horizontalAlignment = Alignment.CenterHorizontally, + ) { + val pageCount = 2 + val pagerState = rememberPagerState( + pageCount = { pageCount }, + ) + HorizontalPager( + state = pagerState, + modifier = Modifier + .fillMaxSize() + .weight(1f), + ) { + Box( + modifier = Modifier + .fillMaxSize(), + contentAlignment = Alignment.Center, + ) { + Text(text = "Page $it") + } + } + PagerIndicator( + pageCount = pageCount, + currentPage = pagerState.currentPage, + ) + } +} + +@Composable +fun PagerIndicator( + indicatorScrollState: LazyListState = rememberLazyListState(), + pageCount: Int, + currentPage: Int, + dotIndicatorColor: Color = Color.DarkGray, +) { + LaunchedEffect(key1 = currentPage) { + val size = indicatorScrollState.layoutInfo.visibleItemsInfo.size + val lastVisibleIndex = + indicatorScrollState.layoutInfo.visibleItemsInfo.lastOrNull()?.index ?: 0 + val firstVisibleItemIndex = indicatorScrollState.firstVisibleItemIndex + + if (currentPage > lastVisibleIndex - 1) { + indicatorScrollState.animateScrollToItem(currentPage - size + 2) + } else if (currentPage <= firstVisibleItemIndex + 1) { + indicatorScrollState.animateScrollToItem(max(currentPage - 1, 0)) + } + } + + LazyRow( + state = indicatorScrollState, + modifier = Modifier + .height(50.dp) + .width(((6 + 16) * 2 + 3 * (10 + 16)).dp), // I'm hard computing it to simplify + horizontalArrangement = Arrangement.Center, + verticalAlignment = Alignment.CenterVertically, + ) { + repeat(pageCount) { iteration -> + val color = if (currentPage == iteration) dotIndicatorColor else Color.LightGray + item(key = "item$iteration") { + val firstVisibleIndex by remember { derivedStateOf { indicatorScrollState.firstVisibleItemIndex } } + val lastVisibleIndex = + indicatorScrollState.layoutInfo.visibleItemsInfo.lastOrNull()?.index ?: 0 + val size by animateDpAsState( + targetValue = when (iteration) { + currentPage -> 10.dp + in firstVisibleIndex + 1.. 10.dp + else -> 6.dp + }, + label = "PagerIndicatorDotSizeAnimation", + ) + Box( + modifier = Modifier + .padding(all = 8.dp) + .background(color = color, CircleShape) + .size( + size, + ), + ) + } + } + } +} diff --git a/settings.gradle.kts b/settings.gradle.kts index 4e90978fba..c8de1e7524 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,5 +1,5 @@ include( - ":app", ":viewpagerdotsindicator", + ":app", ":dhis_android_analytics", ":form", ":commons", ":dhis2_android_maps", ":compose-table", ":ui-components", ":stock-usecase" diff --git a/viewpagerdotsindicator/.gitignore b/viewpagerdotsindicator/.gitignore deleted file mode 100644 index ea7f5e2e35..0000000000 --- a/viewpagerdotsindicator/.gitignore +++ /dev/null @@ -1,39 +0,0 @@ -# Built application files -*.apk -*.ap_ -.DS_Store -# Files for the Dalvik VM -*.dex - -# Java class files -*.class - -# Generated files -bin/ -/*/bin/ -gen/ -/*/gen/ - -# Gradle files -.gradle/ -/*/.gradle -build/ -/*/build/ - -# Config properties file -conf.properties - -# Local configuration file (sdk path, etc) -local.properties -/*/local.properties - -# Log Files -*.log - -# temp files -*~ - -# Idea files -.idea/ -/*/.idea -*.iml diff --git a/viewpagerdotsindicator/build.gradle.kts b/viewpagerdotsindicator/build.gradle.kts deleted file mode 100644 index d197597c30..0000000000 --- a/viewpagerdotsindicator/build.gradle.kts +++ /dev/null @@ -1,32 +0,0 @@ -plugins { - id("com.android.library") -} -apply(from = "${project.rootDir}/jacoco/jacoco.gradle.kts") - -android { - compileSdk = libs.versions.sdk.get().toInt() - - defaultConfig { - minSdk = libs.versions.minSdk.get().toInt() - testOptions.targetSdk = libs.versions.sdk.get().toInt() - } - namespace = "com.tbuonomo.viewpagerdotsindicator" - buildTypes { - getByName("release") { - isMinifyEnabled = false - proguardFiles( - getDefaultProguardFile("proguard-android-optimize.txt"), - "proguard-rules.pro" - ) - } - } -} - -dependencies { - implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) - - implementation(libs.androidx.appcompat) - implementation(libs.androidx.dynamicanimation) - implementation(libs.androidx.viewpager2) - testImplementation(libs.test.junit) -} diff --git a/viewpagerdotsindicator/proguard-rules.pro b/viewpagerdotsindicator/proguard-rules.pro deleted file mode 100644 index 6896eec081..0000000000 --- a/viewpagerdotsindicator/proguard-rules.pro +++ /dev/null @@ -1,17 +0,0 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in /home/tommy/Documents/Libraries/Android/Sdk/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle.kts. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/viewpagerdotsindicator/src/main/AndroidManifest.xml b/viewpagerdotsindicator/src/main/AndroidManifest.xml deleted file mode 100644 index 3ddf7f368f..0000000000 --- a/viewpagerdotsindicator/src/main/AndroidManifest.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/viewpagerdotsindicator/src/main/java/com/tbuonomo/viewpagerdotsindicator/DotsIndicator.java b/viewpagerdotsindicator/src/main/java/com/tbuonomo/viewpagerdotsindicator/DotsIndicator.java deleted file mode 100644 index 5e22196935..0000000000 --- a/viewpagerdotsindicator/src/main/java/com/tbuonomo/viewpagerdotsindicator/DotsIndicator.java +++ /dev/null @@ -1,277 +0,0 @@ -package com.tbuonomo.viewpagerdotsindicator; - -import android.content.Context; -import android.content.res.TypedArray; -import android.graphics.Color; -import android.graphics.drawable.GradientDrawable; -import android.util.AttributeSet; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.RelativeLayout; - -import androidx.recyclerview.widget.RecyclerView; -import androidx.viewpager2.widget.ViewPager2; - -import java.util.ArrayList; -import java.util.List; - -public class DotsIndicator extends LinearLayout { - private static final int DEFAULT_POINT_COLOR = Color.CYAN; - public static final float DEFAULT_WIDTH_FACTOR = 2.5f; - - private List dots; - private ViewPager2 viewPager; - private float dotsSize; - private float dotsCornerRadius; - private float dotsSpacing; - private int currentPage; - private float dotsWidthFactor; - private int dotsColor; - - private boolean dotsClickable; - private ViewPager2.OnPageChangeCallback pageChangeCallback; - - public DotsIndicator(Context context) { - super(context); - init(context, null); - } - - public DotsIndicator(Context context, AttributeSet attrs) { - super(context, attrs); - init(context, attrs); - } - - public DotsIndicator(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - init(context, attrs); - } - - private void init(Context context, AttributeSet attrs) { - dots = new ArrayList<>(); - setOrientation(HORIZONTAL); - - dotsSize = dpToPx(16); // 16dp - dotsSpacing = dpToPx(4); // 4dp - dotsCornerRadius = dotsSize / 2; - - dotsWidthFactor = DEFAULT_WIDTH_FACTOR; - dotsColor = DEFAULT_POINT_COLOR; - dotsClickable = true; - - if (attrs != null) { - TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.DotsIndicator); - - dotsColor = a.getColor(R.styleable.DotsIndicator_dotsColor, DEFAULT_POINT_COLOR); - setUpCircleColors(dotsColor); - - dotsWidthFactor = a.getFloat(R.styleable.DotsIndicator_dotsWidthFactor, 2.5f); - if (dotsWidthFactor < 1) { - dotsWidthFactor = 2.5f; - } - - dotsSize = a.getDimension(R.styleable.DotsIndicator_dotsSize, dotsSize); - dotsCornerRadius = - (int) a.getDimension(R.styleable.DotsIndicator_dotsCornerRadius, dotsSize / 2); - dotsSpacing = a.getDimension(R.styleable.DotsIndicator_dotsSpacing, dotsSpacing); - - a.recycle(); - } else { - setUpCircleColors(DEFAULT_POINT_COLOR); - } - - if (isInEditMode()) { - addDots(5); - } - } - - @Override protected void onAttachedToWindow() { - super.onAttachedToWindow(); - refreshDots(); - } - - private void refreshDots() { - if (viewPager != null && viewPager.getAdapter() != null) { - // Check if we need to refresh the dots count - if (dots.size() < viewPager.getAdapter().getItemCount()) { - addDots(viewPager.getAdapter().getItemCount() - dots.size()); - } else if (dots.size() > viewPager.getAdapter().getItemCount()) { - removeDots(dots.size() - viewPager.getAdapter().getItemCount()); - } - setUpDotsAnimators(); - } else { - Log.e(DotsIndicator.class.getSimpleName(), - "You have to set an adapter to the view pager before !"); - } - } - - private void addDots(int count) { - for (int i = 0; i < count; i++) { - View dot = LayoutInflater.from(getContext()).inflate(R.layout.dot_layout, this, false); - ImageView imageView = dot.findViewById(R.id.dot); - RelativeLayout.LayoutParams params = - (RelativeLayout.LayoutParams) imageView.getLayoutParams(); - params.width = params.height = (int) dotsSize; - params.setMargins((int) dotsSpacing, 0, (int) dotsSpacing, 0); - ((GradientDrawable) imageView.getBackground()).setCornerRadius(dotsCornerRadius); - ((GradientDrawable) imageView.getBackground()).setColor(dotsColor); - - final int finalI = i; - dot.setOnClickListener(new OnClickListener() { - @Override public void onClick(View v) { - if (dotsClickable - && viewPager != null - && viewPager.getAdapter() != null - && finalI < viewPager.getAdapter().getItemCount()) { - viewPager.setCurrentItem(finalI, true); - } - } - }); - - dots.add(imageView); - addView(dot); - } - } - - private void removeDots(int count) { - for (int i = 0; i < count; i++) { - removeViewAt(getChildCount() - 1); - dots.remove(dots.size() - 1); - } - } - - private void setUpDotsAnimators() { - if (viewPager != null - && viewPager.getAdapter() != null - && viewPager.getAdapter().getItemCount() > 0) { - if (currentPage < dots.size()) { - View dot = dots.get(currentPage); - - if (dot != null) { - RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) dot.getLayoutParams(); - params.width = (int) dotsSize; - dot.setLayoutParams(params); - } - } - - currentPage = viewPager.getCurrentItem(); - if (currentPage >= dots.size()) { - currentPage = dots.size() - 1; - viewPager.setCurrentItem(currentPage, false); - } - View dot = dots.get(currentPage); - - if (dot != null) { - RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) dot.getLayoutParams(); - params.width = (int) (dotsSize * dotsWidthFactor); - dot.setLayoutParams(params); - } - if (pageChangeCallback != null) { - viewPager.unregisterOnPageChangeCallback(pageChangeCallback); - } - setUpOnPageChangedListener(); - viewPager.registerOnPageChangeCallback(pageChangeCallback); - } - } - - private void setUpOnPageChangedListener() { - pageChangeCallback = new ViewPager2.OnPageChangeCallback() { - private int lastPage; - - @Override - public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { - if (position != currentPage && positionOffset == 0 || currentPage < position) { - setDotWidth(dots.get(currentPage), (int) dotsSize); - currentPage = position; - } - - if (Math.abs(currentPage - position) > 1) { - setDotWidth(dots.get(currentPage), (int) dotsSize); - currentPage = lastPage; - } - - ImageView dot = dots.get(currentPage); - - ImageView nextDot = null; - if (currentPage == position && currentPage + 1 < dots.size()) { - nextDot = dots.get(currentPage + 1); - } else if (currentPage > position) { - nextDot = dot; - dot = dots.get(currentPage - 1); - } - - int dotWidth = (int) (dotsSize + (dotsSize * (dotsWidthFactor - 1) * (1 - positionOffset))); - setDotWidth(dot, dotWidth); - - if (nextDot != null) { - int nextDotWidth = - (int) (dotsSize + (dotsSize * (dotsWidthFactor - 1) * (positionOffset))); - setDotWidth(nextDot, nextDotWidth); - } - - lastPage = position; - } - - @Override - public void onPageSelected(int position) { - super.onPageSelected(position); - } - - @Override - public void onPageScrollStateChanged(int state) { - super.onPageScrollStateChanged(state); - } - - private void setDotWidth(ImageView dot, int dotWidth) { - ViewGroup.LayoutParams dotParams = dot.getLayoutParams(); - dotParams.width = dotWidth; - dot.setLayoutParams(dotParams); - } - }; - } - - private void setUpCircleColors(int color) { - if (dots != null) { - for (ImageView elevationItem : dots) { - ((GradientDrawable) elevationItem.getBackground()).setColor(color); - } - } - } - - private void setUpViewPager() { - if (viewPager.getAdapter() != null) { - viewPager.getAdapter().registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() { - @Override - public void onChanged() { - super.onChanged(); - refreshDots(); - } - }); - } - } - - private int dpToPx(int dp) { - return (int) (getContext().getResources().getDisplayMetrics().density * dp); - } - - //********************************************************* - // Users Methods - //********************************************************* - - public void setPointsColor(int color) { - setUpCircleColors(color); - } - - public void setDotsClickable(boolean dotsClickable) { - this.dotsClickable = dotsClickable; - } - - public void setViewPager(ViewPager2 viewPager) { - this.viewPager = viewPager; - setUpViewPager(); - refreshDots(); - } -} diff --git a/viewpagerdotsindicator/src/main/java/com/tbuonomo/viewpagerdotsindicator/SpringDotsIndicator.java b/viewpagerdotsindicator/src/main/java/com/tbuonomo/viewpagerdotsindicator/SpringDotsIndicator.java deleted file mode 100644 index 012fe0f6d4..0000000000 --- a/viewpagerdotsindicator/src/main/java/com/tbuonomo/viewpagerdotsindicator/SpringDotsIndicator.java +++ /dev/null @@ -1,293 +0,0 @@ -package com.tbuonomo.viewpagerdotsindicator; - -import android.content.Context; -import android.content.res.TypedArray; -import android.database.DataSetObserver; -import android.graphics.drawable.GradientDrawable; -import android.util.AttributeSet; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.FrameLayout; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.RelativeLayout; - -import java.util.ArrayList; -import java.util.List; - -import androidx.appcompat.content.res.AppCompatResources; -import androidx.dynamicanimation.animation.SpringAnimation; -import androidx.dynamicanimation.animation.SpringForce; -import androidx.recyclerview.widget.RecyclerView; -import androidx.viewpager.widget.ViewPager; -import androidx.viewpager2.widget.ViewPager2; - -import static android.widget.LinearLayout.HORIZONTAL; -import static com.tbuonomo.viewpagerdotsindicator.UiUtils.getThemePrimaryColor; - -public class SpringDotsIndicator extends FrameLayout { - public static final float DEFAULT_DAMPING_RATIO = 0.5f; - public static final int DEFAULT_STIFFNESS = 300; - - private List strokeDots; - private View dotIndicatorView; - private ViewPager2 viewPager; - - // Attributes - private int dotsStrokeSize; - private int dotsSpacing; - private int dotsStrokeWidth; - private int dotsCornerRadius; - private int dotsStrokeColor; - private int dotIndicatorColor; - private float stiffness; - private float dampingRatio; - - private int dotIndicatorSize; - private int dotIndicatorAdditionalSize; - private int horizontalMargin; - private SpringAnimation dotIndicatorSpring; - private LinearLayout strokeDotsLinearLayout; - - private boolean dotsClickable; - private ViewPager2.OnPageChangeCallback pageChangeCallback; - - public SpringDotsIndicator(Context context) { - this(context, null); - } - - public SpringDotsIndicator(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public SpringDotsIndicator(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - - strokeDots = new ArrayList<>(); - strokeDotsLinearLayout = new LinearLayout(context); - LayoutParams linearParams = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); - horizontalMargin = dpToPx(24); - linearParams.setMargins(horizontalMargin, 0, horizontalMargin, 0); - strokeDotsLinearLayout.setLayoutParams(linearParams); - strokeDotsLinearLayout.setOrientation(HORIZONTAL); - addView(strokeDotsLinearLayout); - - dotsStrokeSize = dpToPx(16); // 16dp - dotsSpacing = dpToPx(4); // 4dp - dotsStrokeWidth = dpToPx(2); // 2dp - dotIndicatorAdditionalSize = dpToPx(1); // 1dp additional to fill the stroke dots - dotsCornerRadius = dotsStrokeSize / 2; // 1dp additional to fill the stroke dots - dotIndicatorColor = getThemePrimaryColor(context); - dotsStrokeColor = dotIndicatorColor; - stiffness = DEFAULT_STIFFNESS; - dampingRatio = DEFAULT_DAMPING_RATIO; - dotsClickable = true; - - if (attrs != null) { - TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.SpringDotsIndicator); - - // Dots attributes - dotIndicatorColor = a.getColor(R.styleable.SpringDotsIndicator_dotsColor, dotIndicatorColor); - dotsStrokeColor = a.getColor(R.styleable.SpringDotsIndicator_dotsStrokeColor, dotIndicatorColor); - dotsStrokeSize = (int) a.getDimension(R.styleable.SpringDotsIndicator_dotsSize, dotsStrokeSize); - dotsSpacing = (int) a.getDimension(R.styleable.SpringDotsIndicator_dotsSpacing, dotsSpacing); - dotsCornerRadius = (int) a.getDimension(R.styleable.SpringDotsIndicator_dotsCornerRadius, dotsStrokeSize / 2f); - stiffness = a.getFloat(R.styleable.SpringDotsIndicator_stiffness, stiffness); - dampingRatio = a.getFloat(R.styleable.SpringDotsIndicator_dampingRatio, dampingRatio); - - // Spring dots attributes - dotsStrokeWidth = (int) a.getDimension(R.styleable.SpringDotsIndicator_dotsStrokeWidth, dotsStrokeWidth); - - a.recycle(); - } - - dotIndicatorSize = dotsStrokeSize - dotsStrokeWidth * 2 + dotIndicatorAdditionalSize; - - if (isInEditMode()) { - addStrokeDots(5); - addView(buildDot(false)); - } - } - - @Override - protected void onAttachedToWindow() { - super.onAttachedToWindow(); - refreshDots(); - } - - private void refreshDots() { - if (dotIndicatorView == null) { - setUpDotIndicator(); - } - - if (viewPager != null && viewPager.getAdapter() != null) { - // Check if we need to refresh the strokeDots count - if (strokeDots.size() < viewPager.getAdapter().getItemCount()) { - addStrokeDots(viewPager.getAdapter().getItemCount() - strokeDots.size()); - } else if (strokeDots.size() > viewPager.getAdapter().getItemCount()) { - removeDots(strokeDots.size() - viewPager.getAdapter().getItemCount()); - } - setUpDotsAnimators(); - } else { - Log.e(SpringDotsIndicator.class.getSimpleName(), "You have to set an adapter to the view pager before !"); - } - } - - private void setUpDotIndicator() { - dotIndicatorView = buildDot(false); - addView(dotIndicatorView); - dotIndicatorSpring = new SpringAnimation(dotIndicatorView, SpringAnimation.TRANSLATION_X); - SpringForce springForce = new SpringForce(0); - springForce.setDampingRatio(dampingRatio); - springForce.setStiffness(stiffness); - dotIndicatorSpring.setSpring(springForce); - } - - private void addStrokeDots(int count) { - for (int i = 0; i < count; i++) { - ViewGroup dot = buildDot(true); - final int finalI = i; - dot.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - if (dotsClickable && viewPager != null && viewPager.getAdapter() != null && finalI < viewPager.getAdapter().getItemCount()) { - viewPager.setCurrentItem(finalI, true); - } - } - }); - - strokeDots.add((ImageView) dot.findViewById(R.id.spring_dot)); - strokeDotsLinearLayout.addView(dot); - } - } - - private ViewGroup buildDot(boolean stroke) { - ViewGroup dot = (ViewGroup) LayoutInflater.from(getContext()).inflate(R.layout.spring_dot_layout, this, false); - ImageView dotView = dot.findViewById(R.id.spring_dot); - dotView.setBackground( - AppCompatResources.getDrawable(getContext(), stroke ? R.drawable.spring_dot_stroke_background : R.drawable.spring_dot_background)); - RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) dotView.getLayoutParams(); - params.width = params.height = stroke ? dotsStrokeSize : dotIndicatorSize; - params.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE); - - params.setMargins(dotsSpacing, 0, dotsSpacing, 0); - - setUpDotBackground(stroke, dotView); - return dot; - } - - private void setUpDotBackground(boolean stroke, View dotView) { - GradientDrawable dotBackground = (GradientDrawable) dotView.getBackground(); - if (stroke) { - dotBackground.setStroke(dotsStrokeWidth, dotsStrokeColor); - } else { - dotBackground.setColor(dotIndicatorColor); - } - dotBackground.setCornerRadius(dotsCornerRadius); - } - - private void removeDots(int count) { - for (int i = 0; i < count; i++) { - strokeDotsLinearLayout.removeViewAt(strokeDotsLinearLayout.getChildCount() - 1); - strokeDots.remove(strokeDots.size() - 1); - } - } - - private void setUpDotsAnimators() { - if (viewPager != null && viewPager.getAdapter() != null && viewPager.getAdapter().getItemCount() > 0) { - if (pageChangeCallback != null) { - viewPager.unregisterOnPageChangeCallback(pageChangeCallback); - } - setUpOnPageChangedListener(); - viewPager.registerOnPageChangeCallback(pageChangeCallback); - } - } - - private void setUpOnPageChangedListener() { - pageChangeCallback = new ViewPager2.OnPageChangeCallback() { - @Override - public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { - float globalPositionOffsetPixels = position * (dotsStrokeSize + dotsSpacing * 2) + (dotsStrokeSize + dotsSpacing * 2) * positionOffset; - float indicatorTranslationX = globalPositionOffsetPixels + horizontalMargin + dotsStrokeWidth - dotIndicatorAdditionalSize / 2f; - dotIndicatorSpring.getSpring().setFinalPosition(indicatorTranslationX); - - if (!dotIndicatorSpring.isRunning()) { - dotIndicatorSpring.start(); - } - } - - @Override - public void onPageSelected(int position) { - super.onPageSelected(position); - } - - @Override - public void onPageScrollStateChanged(int state) { - super.onPageScrollStateChanged(state); - } - }; - } - - private void setUpViewPager() { - if (viewPager.getAdapter() != null) { - viewPager.getAdapter().registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() { - @Override - public void onChanged() { - super.onChanged(); - refreshDots(); - } - }); - } - } - - private int dpToPx(int dp) { - return (int) (getContext().getResources().getDisplayMetrics().density * dp); - } - - //********************************************************* - // Users Methods - //********************************************************* - - /** - * Set the indicator dot color. - * - * @param color the color fo the indicator dot. - */ - public void setDotIndicatorColor(int color) { - if (dotIndicatorView != null) { - dotIndicatorColor = color; - setUpDotBackground(false, dotIndicatorView); - } - } - - /** - * Set the stroke indicator dots color. - * - * @param color the color fo the stroke indicator dots. - */ - public void setStrokeDotsIndicatorColor(int color) { - if (strokeDots != null && !strokeDots.isEmpty()) { - dotsStrokeColor = color; - for (ImageView v : strokeDots) { - setUpDotBackground(true, v); - } - } - } - - /** - * Determine if the stroke dots are clickable to go the a page directly. - * - * @param dotsClickable true if dots are clickables. - */ - public void setDotsClickable(boolean dotsClickable) { - this.dotsClickable = dotsClickable; - } - - public void setViewPager(ViewPager2 viewPager) { - this.viewPager = viewPager; - setUpViewPager(); - refreshDots(); - } -} diff --git a/viewpagerdotsindicator/src/main/java/com/tbuonomo/viewpagerdotsindicator/UiUtils.java b/viewpagerdotsindicator/src/main/java/com/tbuonomo/viewpagerdotsindicator/UiUtils.java deleted file mode 100644 index ea44f354ba..0000000000 --- a/viewpagerdotsindicator/src/main/java/com/tbuonomo/viewpagerdotsindicator/UiUtils.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.tbuonomo.viewpagerdotsindicator; - -import android.content.Context; -import android.util.TypedValue; - -public class UiUtils { - public static int getThemePrimaryColor(final Context context) { - final TypedValue value = new TypedValue(); - context.getTheme().resolveAttribute(R.attr.colorPrimary, value, true); - return value.data; - } -} diff --git a/viewpagerdotsindicator/src/main/java/com/tbuonomo/viewpagerdotsindicator/WormDotsIndicator.java b/viewpagerdotsindicator/src/main/java/com/tbuonomo/viewpagerdotsindicator/WormDotsIndicator.java deleted file mode 100644 index 36a8527f22..0000000000 --- a/viewpagerdotsindicator/src/main/java/com/tbuonomo/viewpagerdotsindicator/WormDotsIndicator.java +++ /dev/null @@ -1,324 +0,0 @@ -package com.tbuonomo.viewpagerdotsindicator; - -import android.content.Context; -import android.content.res.TypedArray; -import android.database.DataSetObserver; -import android.graphics.drawable.GradientDrawable; -import android.util.AttributeSet; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.FrameLayout; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.RelativeLayout; - -import java.util.ArrayList; -import java.util.List; - -import androidx.appcompat.content.res.AppCompatResources; -import androidx.dynamicanimation.animation.FloatPropertyCompat; -import androidx.dynamicanimation.animation.SpringAnimation; -import androidx.dynamicanimation.animation.SpringForce; -import androidx.recyclerview.widget.RecyclerView; -import androidx.viewpager.widget.ViewPager; -import androidx.viewpager2.widget.ViewPager2; - -import static android.widget.LinearLayout.HORIZONTAL; -import static com.tbuonomo.viewpagerdotsindicator.UiUtils.getThemePrimaryColor; - -public class WormDotsIndicator extends FrameLayout { - private List strokeDots; - private ImageView dotIndicatorView; - private View dotIndicatorLayout; - private ViewPager2 viewPager; - - // Attributes - private int dotsSize; - private int dotsSpacing; - private int dotsStrokeWidth; - private int dotsCornerRadius; - private int dotIndicatorColor; - private int dotsStrokeColor; - - private int horizontalMargin; - private SpringAnimation dotIndicatorXSpring; - private SpringAnimation dotIndicatorWidthSpring; - private LinearLayout strokeDotsLinearLayout; - - private boolean dotsClickable; - private ViewPager2.OnPageChangeCallback pageChangeCallback; - - public WormDotsIndicator(Context context) { - this(context, null); - } - - public WormDotsIndicator(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public WormDotsIndicator(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - strokeDots = new ArrayList<>(); - strokeDotsLinearLayout = new LinearLayout(context); - LayoutParams linearParams = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); - horizontalMargin = dpToPx(24); - linearParams.setMargins(horizontalMargin, 0, horizontalMargin, 0); - strokeDotsLinearLayout.setLayoutParams(linearParams); - strokeDotsLinearLayout.setOrientation(HORIZONTAL); - addView(strokeDotsLinearLayout); - - dotsSize = dpToPx(16); // 16dp - dotsSpacing = dpToPx(4); // 4dp - dotsStrokeWidth = dpToPx(2); // 2dp - dotsCornerRadius = dotsSize / 2; - dotIndicatorColor = getThemePrimaryColor(context); - dotsStrokeColor = dotIndicatorColor; - dotsClickable = true; - - if (attrs != null) { - TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.WormDotsIndicator); - - // Dots attributes - dotIndicatorColor = a.getColor(R.styleable.WormDotsIndicator_dotsColor, dotIndicatorColor); - dotsStrokeColor = a.getColor(R.styleable.WormDotsIndicator_dotsStrokeColor, dotIndicatorColor); - dotsSize = (int) a.getDimension(R.styleable.WormDotsIndicator_dotsSize, dotsSize); - dotsSpacing = (int) a.getDimension(R.styleable.WormDotsIndicator_dotsSpacing, dotsSpacing); - dotsCornerRadius = (int) a.getDimension(R.styleable.WormDotsIndicator_dotsCornerRadius, dotsSize / 2f); - - // Spring dots attributes - dotsStrokeWidth = (int) a.getDimension(R.styleable.WormDotsIndicator_dotsStrokeWidth, dotsStrokeWidth); - - a.recycle(); - } - - if (isInEditMode()) { - addStrokeDots(5); - addView(buildDot(false)); - } - } - - @Override - protected void onAttachedToWindow() { - super.onAttachedToWindow(); - refreshDots(); - } - - private void refreshDots() { - if (dotIndicatorLayout == null) { - setUpDotIndicator(); - } - - if (viewPager != null && viewPager.getAdapter() != null) { - // Check if we need to refresh the strokeDots count - if (strokeDots.size() < viewPager.getAdapter().getItemCount()) { - addStrokeDots(viewPager.getAdapter().getItemCount() - strokeDots.size()); - } else if (strokeDots.size() > viewPager.getAdapter().getItemCount()) { - removeDots(strokeDots.size() - viewPager.getAdapter().getItemCount()); - } - setUpDotsAnimators(); - } else { - Log.e(WormDotsIndicator.class.getSimpleName(), "You have to set an adapter to the view pager before !"); - } - } - - private void setUpDotIndicator() { - dotIndicatorLayout = buildDot(false); - dotIndicatorView = dotIndicatorLayout.findViewById(R.id.worm_dot); - addView(dotIndicatorLayout); - dotIndicatorXSpring = new SpringAnimation(dotIndicatorLayout, SpringAnimation.TRANSLATION_X); - SpringForce springForceX = new SpringForce(0); - springForceX.setDampingRatio(1f); - springForceX.setStiffness(300); - dotIndicatorXSpring.setSpring(springForceX); - - FloatPropertyCompat floatPropertyCompat = new FloatPropertyCompat("DotsWidth") { - @Override - public float getValue(Object object) { - return dotIndicatorView.getLayoutParams().width; - } - - @Override - public void setValue(Object object, float value) { - ViewGroup.LayoutParams params = dotIndicatorView.getLayoutParams(); - params.width = (int) value; - dotIndicatorView.requestLayout(); - } - }; - dotIndicatorWidthSpring = new SpringAnimation(dotIndicatorLayout, floatPropertyCompat); - SpringForce springForceWidth = new SpringForce(0); - springForceWidth.setDampingRatio(1f); - springForceWidth.setStiffness(300); - dotIndicatorWidthSpring.setSpring(springForceWidth); - } - - private void addStrokeDots(int count) { - for (int i = 0; i < count; i++) { - ViewGroup dot = buildDot(true); - final int finalI = i; - dot.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - if (dotsClickable && viewPager != null && viewPager.getAdapter() != null && finalI < viewPager.getAdapter().getItemCount()) { - viewPager.setCurrentItem(finalI, true); - } - } - }); - - strokeDots.add((ImageView) dot.findViewById(R.id.worm_dot)); - strokeDotsLinearLayout.addView(dot); - } - } - - private ViewGroup buildDot(boolean stroke) { - ViewGroup dot = (ViewGroup) LayoutInflater.from(getContext()).inflate(R.layout.worm_dot_layout, this, false); - View dotImageView = dot.findViewById(R.id.worm_dot); - dotImageView.setBackground( - AppCompatResources.getDrawable(getContext(), stroke ? R.drawable.worm_dot_stroke_background : R.drawable.worm_dot_background)); - RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) dotImageView.getLayoutParams(); - params.width = params.height = dotsSize; - params.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE); - - params.setMargins(dotsSpacing, 0, dotsSpacing, 0); - - setUpDotBackground(stroke, dotImageView); - return dot; - } - - private void setUpDotBackground(boolean stroke, View dotImageView) { - GradientDrawable dotBackground = (GradientDrawable) dotImageView.getBackground(); - if (stroke) { - dotBackground.setStroke(dotsStrokeWidth, dotsStrokeColor); - } else { - dotBackground.setColor(dotIndicatorColor); - } - dotBackground.setCornerRadius(dotsCornerRadius); - } - - private void removeDots(int count) { - for (int i = 0; i < count; i++) { - strokeDotsLinearLayout.removeViewAt(strokeDotsLinearLayout.getChildCount() - 1); - strokeDots.remove(strokeDots.size() - 1); - } - } - - private void setUpDotsAnimators() { - if (viewPager != null && viewPager.getAdapter() != null && viewPager.getAdapter().getItemCount() > 0) { - if (pageChangeCallback != null) { - viewPager.unregisterOnPageChangeCallback(pageChangeCallback); - } - setUpOnPageChangedListener(); - viewPager.registerOnPageChangeCallback(pageChangeCallback); - } - } - - private void setUpOnPageChangedListener() { - pageChangeCallback = new ViewPager2.OnPageChangeCallback() { - @Override - public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { - float stepX = dotsSize + dotsSpacing * 2f; - float xFinalPosition; - float widthFinalPosition; - - if (positionOffset >= 0 && positionOffset < 0.1f) { - xFinalPosition = horizontalMargin + position * stepX; - widthFinalPosition = dotsSize; - } else if (positionOffset >= 0.1f && positionOffset <= 0.9f) { - xFinalPosition = horizontalMargin + position * stepX; - widthFinalPosition = dotsSize + stepX; - } else { - xFinalPosition = horizontalMargin + (position + 1) * stepX; - widthFinalPosition = dotsSize; - } - - if (dotIndicatorXSpring.getSpring().getFinalPosition() != xFinalPosition) { - dotIndicatorXSpring.getSpring().setFinalPosition(xFinalPosition); - } - - if (dotIndicatorWidthSpring.getSpring().getFinalPosition() != widthFinalPosition) { - dotIndicatorWidthSpring.getSpring().setFinalPosition(widthFinalPosition); - } - - if (!dotIndicatorXSpring.isRunning()) { - dotIndicatorXSpring.start(); - } - - if (!dotIndicatorWidthSpring.isRunning()) { - dotIndicatorWidthSpring.start(); - } - } - - @Override - public void onPageSelected(int position) { - // do nothing - } - - @Override - public void onPageScrollStateChanged(int state) { - // do nothing - } - }; - } - - private void setUpViewPager() { - if (viewPager.getAdapter() != null) { - viewPager.getAdapter().registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() { - @Override - public void onChanged() { - super.onChanged(); - refreshDots(); - } - }); - } - } - - private int dpToPx(int dp) { - return (int) (getContext().getResources().getDisplayMetrics().density * dp); - } - - //********************************************************* - // Users Methods - //********************************************************* - - /** - * Set the indicator dot color. - * - * @param color the color fo the indicator dot. - */ - public void setDotIndicatorColor(int color) { - if (dotIndicatorView != null) { - dotIndicatorColor = color; - setUpDotBackground(false, dotIndicatorView); - } - } - - /** - * Set the stroke indicator dots color. - * - * @param color the color fo the stroke indicator dots. - */ - public void setStrokeDotsIndicatorColor(int color) { - if (strokeDots != null && !strokeDots.isEmpty()) { - dotsStrokeColor = color; - for (ImageView v : strokeDots) { - setUpDotBackground(true, v); - } - } - } - - /** - * Determine if the stroke dots are clickable to go the a page directly. - * - * @param dotsClickable true if dots are clickables. - */ - public void setDotsClickable(boolean dotsClickable) { - this.dotsClickable = dotsClickable; - } - - public void setViewPager(ViewPager2 viewPager) { - this.viewPager = viewPager; - setUpViewPager(); - refreshDots(); - } -} diff --git a/viewpagerdotsindicator/src/main/res/drawable/dot_background.xml b/viewpagerdotsindicator/src/main/res/drawable/dot_background.xml deleted file mode 100644 index aff2e10c6a..0000000000 --- a/viewpagerdotsindicator/src/main/res/drawable/dot_background.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/viewpagerdotsindicator/src/main/res/drawable/spring_dot_background.xml b/viewpagerdotsindicator/src/main/res/drawable/spring_dot_background.xml deleted file mode 100644 index aff2e10c6a..0000000000 --- a/viewpagerdotsindicator/src/main/res/drawable/spring_dot_background.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/viewpagerdotsindicator/src/main/res/drawable/spring_dot_stroke_background.xml b/viewpagerdotsindicator/src/main/res/drawable/spring_dot_stroke_background.xml deleted file mode 100644 index d202ee7f83..0000000000 --- a/viewpagerdotsindicator/src/main/res/drawable/spring_dot_stroke_background.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/viewpagerdotsindicator/src/main/res/drawable/worm_dot_background.xml b/viewpagerdotsindicator/src/main/res/drawable/worm_dot_background.xml deleted file mode 100644 index aff2e10c6a..0000000000 --- a/viewpagerdotsindicator/src/main/res/drawable/worm_dot_background.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/viewpagerdotsindicator/src/main/res/drawable/worm_dot_stroke_background.xml b/viewpagerdotsindicator/src/main/res/drawable/worm_dot_stroke_background.xml deleted file mode 100644 index d202ee7f83..0000000000 --- a/viewpagerdotsindicator/src/main/res/drawable/worm_dot_stroke_background.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/viewpagerdotsindicator/src/main/res/layout/dot_layout.xml b/viewpagerdotsindicator/src/main/res/layout/dot_layout.xml deleted file mode 100644 index 101ca3bfdf..0000000000 --- a/viewpagerdotsindicator/src/main/res/layout/dot_layout.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/viewpagerdotsindicator/src/main/res/layout/spring_dot_layout.xml b/viewpagerdotsindicator/src/main/res/layout/spring_dot_layout.xml deleted file mode 100644 index cbac856e78..0000000000 --- a/viewpagerdotsindicator/src/main/res/layout/spring_dot_layout.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/viewpagerdotsindicator/src/main/res/layout/worm_dot_layout.xml b/viewpagerdotsindicator/src/main/res/layout/worm_dot_layout.xml deleted file mode 100644 index c6c95201de..0000000000 --- a/viewpagerdotsindicator/src/main/res/layout/worm_dot_layout.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/viewpagerdotsindicator/src/main/res/values/attrs.xml b/viewpagerdotsindicator/src/main/res/values/attrs.xml deleted file mode 100644 index 25311ea23a..0000000000 --- a/viewpagerdotsindicator/src/main/res/values/attrs.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/viewpagerdotsindicator/src/main/res/values/strings.xml b/viewpagerdotsindicator/src/main/res/values/strings.xml deleted file mode 100644 index 7bb50edbb5..0000000000 --- a/viewpagerdotsindicator/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - View Pager Dots Indicator - diff --git a/viewpagerdotsindicator/src/test/java/com/tbuonomo/viewpagerdotsindicator/ExampleUnitTest.java b/viewpagerdotsindicator/src/test/java/com/tbuonomo/viewpagerdotsindicator/ExampleUnitTest.java deleted file mode 100644 index 1b249f965e..0000000000 --- a/viewpagerdotsindicator/src/test/java/com/tbuonomo/viewpagerdotsindicator/ExampleUnitTest.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.tbuonomo.viewpagerdotsindicator; - -import org.junit.Test; - -import static org.junit.Assert.*; - -/** - * To work on unit tests, switch the Test Artifact in the Build Variants view. - */ -public class ExampleUnitTest { - @Test - public void addition_isCorrect() throws Exception { - assertEquals(4, 2 + 2); - } -} \ No newline at end of file