diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 50a922a..0000000 --- a/.gitignore +++ /dev/null @@ -1,91 +0,0 @@ -# [Android] ======================== -# Built application files -*.apk -*.ap_ - -# Files for the Dalvik VM -*.dex - -# Java class files -*.class - -# Generated files -bin/ -gen/ - -# Gradle files -.gradle/ -build/ - -# Local configuration file (sdk path, etc) -local.properties - -# Proguard folder generated by Eclipse -proguard/ - -# Log Files -*.log - - -## Directory-based project format: -.idea/ - -## File-based project format: -*.ipr -*.iws - -## Plugin-specific files: - -# IntelliJ -out/ - -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml - - -# [Maven] ======================== -target/ -pom.xml.tag -pom.xml.releaseBackup -pom.xml.versionsBackup -pom.xml.next -release.properties - - -# [Gradle-Android] ======================== - -# Ignore Gradle GUI config -gradle-app.setting - -# Gradle Signing -signing.properties -trestle.keystore - -# Mobile Tools for Java (J2ME) -.mtj.tmp/ - -# Package Files # -*.jar -*.war -*.ear - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* - -# Misc -/.idea/workspace.xml -.DS_Store -/captures -**/*.iml -*.classgradle.properties - - -# keep code style -!.idea/codeStyles/ -!.idea/codeStyles/** \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml deleted file mode 100644 index 24582f5..0000000 --- a/.idea/codeStyles/Project.xml +++ /dev/null @@ -1,992 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml deleted file mode 100644 index 79ee123..0000000 --- a/.idea/codeStyles/codeStyleConfig.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 937d518..0000000 --- a/.travis.yml +++ /dev/null @@ -1,39 +0,0 @@ -sudo: false - -language: android - -android: - components: - - tools - - platform-tools - - build-tools-28.0.3 - - android-28 - - extra-google-m2repository - - extra-android-m2repository - licenses: - - 'android-sdk-license-.+' - - 'google-gdk-license-.+' - -before_install: - - echo yes | sdkmanager "platforms;android-28" - -script: - - ./gradlew clean build -PdisablePreDex --stacktrace --console plain - -jdk: - - oraclejdk8 - -branches: - only: - - master - -before_cache: - - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock - - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ -cache: - directories: - - $HOME/.gradle/caches/ - - $HOME/.gradle/wrapper/ - - $HOME/.android/build-cache - -sudo: false \ No newline at end of file diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 9215f2b..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2018 Chahine Mouhamad - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/README.md b/README.md deleted file mode 100644 index 6277bdd..0000000 --- a/README.md +++ /dev/null @@ -1,101 +0,0 @@ -[![Build Status](https://travis-ci.org/chahine/pageindicator.svg?branch=master)](https://travis-ci.org/chahine/pageindicator) -[![](https://jitpack.io/v/chahine/pageindicator.svg)](https://jitpack.io/#chahine/pageindicator) - -# Page Indicator - -An Instagram like page indicator compatible with [RecyclerView](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.html) and [ViewPager](https://developer.android.com/reference/android/support/v4/view/ViewPager.html). - -![Preview](/art/pageindicator.gif) - -# Setup - -__Step 1.__ Add the JitPack repository to your build file -```groovy -allprojects { - repositories { - maven { url 'https://jitpack.io' } - } -} -``` -__Step 2.__ Add the dependency - -```groovy -dependencies { - compile 'com.github.chahine:pageindicator:' -} -``` - -# Usage - -Add the `PageIndicator` to your XML file: - -```xml - -``` - -#### RecyclerView - -```kotlin - pageIndicator.attachTo(recyclerView) -``` - -By default, attaching to a RecyclerView will end up updating the pageIndicator when the most visible item position changes and expect the RecyclerView items to have the same width. -If you would like to customize this behavior, add a scroll listener to your RecyclerView and use `PageIndicator::swipeNext` and `PageIndicator::swipePrevious`; and set the pageIndicator's count - -#### View Pager - -```kotlin - pageIndicator.attachTo(viewPager) -``` - -#### Manual -```kotlin - pageIndicator.swipePrevious() - pageIndicator.swipeNext() -``` - -# Customization - -| Attribute | Note | Default | -|---------------------|-------------------------------------------|-------------| -| piDotSpacing | Spacing between dots | 3dp | -| piDotBound | Range in which the selected dot remains | 40dp | -| piSize[1-6] | Size from smallest to largest dot | .5dp - 6dp | -| piAnimDuration | Duration of animation* in ms | 200 | -| piAnimInterpolator | Animation interpolator* | decelerate | -| piDefaultColor | Default unselected dot color | #B2B2B2 | -| piSelectedColor | Selected dot color | #3897F0 | - - -*Note: the animation duration and interpolator are shared between the scroll animation and dot scaling animation. - -## License - -``` -MIT License - -Copyright (c) 2018 Chahine Mouhamad - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -``` diff --git a/_windows/git.xml b/_windows/git.xml new file mode 100644 index 0000000..abf244a --- /dev/null +++ b/_windows/git.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/_windows/keymap.xml b/_windows/keymap.xml new file mode 100644 index 0000000..5526d96 --- /dev/null +++ b/_windows/keymap.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/_windows/laf.xml b/_windows/laf.xml new file mode 100644 index 0000000..c1f98d9 --- /dev/null +++ b/_windows/laf.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/_windows/path.macros.xml b/_windows/path.macros.xml new file mode 100644 index 0000000..447ffe7 --- /dev/null +++ b/_windows/path.macros.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/androidStudioFirstRun.xml b/androidStudioFirstRun.xml new file mode 100644 index 0000000..eb43c54 --- /dev/null +++ b/androidStudioFirstRun.xml @@ -0,0 +1,8 @@ + + + 1 + + + 3.4.1 + + \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore deleted file mode 100644 index 796b96d..0000000 --- a/app/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index c261c91..0000000 --- a/app/build.gradle +++ /dev/null @@ -1,27 +0,0 @@ -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-android-extensions' - -android { - compileSdkVersion rootProject.compileSdkVersion - - defaultConfig { - applicationId 'com.chahinem.pageindicator.sample' - - minSdkVersion rootProject.minSdkVersion - targetSdkVersion rootProject.targetSdkVersion - - versionCode 1 - versionName '1.0' - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } -} - -dependencies { - implementation project(':pageindicator') - - implementation rootProject.kotlinStdlib - implementation rootProject.picasso - implementation rootProject.supportLibs -} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro deleted file mode 100644 index f1b4245..0000000 --- a/app/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# 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 *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml deleted file mode 100644 index 98793ae..0000000 --- a/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/java/com/chahinem/pageindicator/sample/MainActivity.kt b/app/src/main/java/com/chahinem/pageindicator/sample/MainActivity.kt deleted file mode 100644 index a8f51d1..0000000 --- a/app/src/main/java/com/chahinem/pageindicator/sample/MainActivity.kt +++ /dev/null @@ -1,74 +0,0 @@ -package com.chahinem.pageindicator.sample - -import android.os.Bundle -import androidx.appcompat.app.AppCompatActivity -import androidx.recyclerview.widget.LinearSnapHelper -import com.chahinem.pageindicator.sample.MyAdapter.MyItem -import com.squareup.picasso.Picasso.Builder -import kotlinx.android.synthetic.main.activity_main.leftBtn -import kotlinx.android.synthetic.main.activity_main.list -import kotlinx.android.synthetic.main.activity_main.manualPageIndicator -import kotlinx.android.synthetic.main.activity_main.pageIndicator -import kotlinx.android.synthetic.main.activity_main.pager -import kotlinx.android.synthetic.main.activity_main.pagerPageIndicator -import kotlinx.android.synthetic.main.activity_main.rightBtn - -class MainActivity : AppCompatActivity() { - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.activity_main) - - val picasso = Builder(this).build() - - // RecyclerView - val adapter = MyAdapter(picasso) - list.adapter = adapter - LinearSnapHelper().attachToRecyclerView(list) - adapter.swapData(LIST_ITEMS) - pageIndicator attachTo list - - // ViewPager - val myPagerAdapter = MyPagerAdapter(picasso, LIST_ITEMS) - pager.adapter = myPagerAdapter - pagerPageIndicator attachTo pager - - // Manual - manualPageIndicator.count = 50 - leftBtn.setOnClickListener { manualPageIndicator.swipePrevious() } - rightBtn.setOnClickListener { manualPageIndicator.swipeNext() } - } - - companion object { - private val LIST_ITEMS = listOf( - MyItem( - "San Francisco, California", - "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod", - "https://scontent-cdg2-1.cdninstagram.com/t51.2885-15/e35/25024416_182774512460963_6661054269581426688_n.jpg"), - MyItem( - "Valensole", - "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod", - "https://scontent-cdg2-1.cdninstagram.com/t51.2885-15/e35/25022757_375109192929045_3153371362454667264_n.jpg"), - MyItem( - "Étretat", - "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod", - "https://scontent-cdg2-1.cdninstagram.com/t51.2885-15/e35/25005816_2020789231533395_4507938399037947904_n.jpg"), - MyItem( - "Tokyo, Japan", - "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod", - "https://scontent-cdg2-1.cdninstagram.com/t51.2885-15/e35/23421860_192904647945945_6319320906002857984_n.jpg"), - MyItem( - "Paris, France", - "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod", - "https://scontent-cdg2-1.cdninstagram.com/t51.2885-15/e35/23347334_633654673691303_8149777143685971968_n.jpg"), - MyItem( - "New York, New York", - "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod", - "https://scontent-cdg2-1.cdninstagram.com/t51.2885-15/e35/23101824_1822687121355425_8930059065124454400_n.jpg"), - MyItem( - "New York, New York", - "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod", - "https://scontent-cdg2-1.cdninstagram.com/t51.2885-15/e35/23161047_853121148199404_5154039615094521856_n.jpg") - ) - } -} diff --git a/app/src/main/java/com/chahinem/pageindicator/sample/MyAdapter.kt b/app/src/main/java/com/chahinem/pageindicator/sample/MyAdapter.kt deleted file mode 100644 index 9d88774..0000000 --- a/app/src/main/java/com/chahinem/pageindicator/sample/MyAdapter.kt +++ /dev/null @@ -1,52 +0,0 @@ -package com.chahinem.pageindicator.sample - -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.ImageView -import android.widget.TextView -import androidx.recyclerview.widget.RecyclerView -import com.chahinem.pageindicator.sample.MyAdapter.MyViewHolder -import com.squareup.picasso.Picasso - -class MyAdapter(private val picasso: Picasso) : RecyclerView.Adapter() { - - private val items: MutableList = mutableListOf() - - override fun getItemCount() = items.size - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = MyViewHolder( - LayoutInflater - .from(parent.context) - .inflate(R.layout.item_card, parent, false)) - - override fun onBindViewHolder(holder: MyViewHolder, position: Int) { - holder.bind(picasso, items[holder.adapterPosition]) - } - - fun swapData(data: Iterable?) { - items.clear() - data?.let { items.addAll(data) } - notifyDataSetChanged() - } - - class MyViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { - - private val title: TextView = itemView.findViewById(R.id.title) - private val caption: TextView = itemView.findViewById(R.id.caption) - private val image: ImageView = itemView.findViewById(R.id.image) - - fun bind(picasso: Picasso, item: MyItem) { - picasso - .load(item.image) - .placeholder(R.color.colorPrimaryDark) - .fit() - .centerCrop() - .into(image) - title.text = item.title - caption.text = item.caption - } - } - - class MyItem(val title: String, val caption: String, val image: String) -} \ No newline at end of file diff --git a/app/src/main/java/com/chahinem/pageindicator/sample/MyPagerAdapter.kt b/app/src/main/java/com/chahinem/pageindicator/sample/MyPagerAdapter.kt deleted file mode 100644 index 224436c..0000000 --- a/app/src/main/java/com/chahinem/pageindicator/sample/MyPagerAdapter.kt +++ /dev/null @@ -1,45 +0,0 @@ -package com.chahinem.pageindicator.sample - -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.ImageView -import android.widget.TextView -import androidx.viewpager.widget.PagerAdapter -import com.chahinem.pageindicator.sample.MyAdapter.MyItem -import com.squareup.picasso.Picasso - -class MyPagerAdapter(private val picasso: Picasso, - private val items: List) : PagerAdapter() { - - override fun getCount() = items.size - - override fun isViewFromObject(view: View, `object`: Any): Boolean = view == `object` - - override fun instantiateItem(container: ViewGroup, position: Int): Any { - val view = LayoutInflater - .from(container.context) - .inflate(R.layout.item_card, container, false) - - val item = items[position] - val title: TextView = view.findViewById(R.id.title) - val caption: TextView = view.findViewById(R.id.caption) - val image: ImageView = view.findViewById(R.id.image) - - picasso - .load(item.image) - .placeholder(R.color.colorPrimaryDark) - .fit() - .centerCrop() - .into(image) - title.text = item.title - caption.text = item.caption - - container.addView(view) - return view - } - - override fun destroyItem(container: ViewGroup, position: Int, view: Any) { - container.removeView(view as View) - } -} \ No newline at end of file diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml deleted file mode 100644 index de7e31c..0000000 --- a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml deleted file mode 100644 index c394cea..0000000 --- a/app/src/main/res/drawable/ic_launcher_background.xml +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml deleted file mode 100644 index f612b4a..0000000 --- a/app/src/main/res/layout/activity_main.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - -