Skip to content
Open

v2.0 #47

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 22 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Carousel Picker

![alt downloads](https://img.shields.io/jitpack/dm/github/GoodieBag/CarouselPicker.svg)
[![Download](https://jitpack.io/v/Husseinhj/KotlinCarouselPicker.svg)](https://jitpack.io/#Husseinhj/KotlinCarouselPicker)


A Carousel picker library for android which supports both text and icons . :pouting_cat:

Expand All @@ -12,19 +13,17 @@
Add this in your root build.gradle file at the end of repositories:
```java
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```
Add the dependency :
```java
dependencies {
implementation 'com.github.GoodieBag:CarouselPicker:v1.2'
// v1.2 is the latest release with vertical orientation and font styling options.
// For the previous stable release use v1.1
}
implementation 'com.github.Husseinhj:KotlinCarouselPicker:2.0.2'
}
```
Sync the gradle and that's it! :+1:

Expand All @@ -38,7 +37,7 @@ Sync the gradle and that's it! :+1:
### XML :

```xml
<in.goodiebag.carouselpicker.CarouselPicker
<com.goodiebag.carouselpicker.CarouselPicker
android:id="@+id/carousel"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
Expand Down Expand Up @@ -75,6 +74,9 @@ textItems.add(new CarouselPicker.TextItem("hi", 20));
CarouselPicker.CarouselViewAdapter textAdapter = new CarouselPicker.CarouselViewAdapter(this, textItems, 0);
carouselPicker.setAdapter(textAdapter);

textAdapter.selectedItemTextColor = Color.GREEN
textAdapter.selectedIndex = 1

//Case 3 : To populate the picker with both images and text
List<CarouselPicker.PickerItem> mixItems = new ArrayList<>();
mixItems.add(new CarouselPicker.DrawableItem(R.drawable.i1));
Expand All @@ -89,23 +91,18 @@ carouselPicker.setAdapter(mixAdapter);
- Text color for text items can be set using ```adapter.setTextColor(colorInt)```

## Listeners :
```java
carouselPicker.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

}

@Override
public void onPageSelected(int position) {
//position of the selected item
}
```kotlin
carouselPicker.addOnPageChangeListener(object: ViewPager.OnPageChangeListener {
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
}

@Override
public void onPageScrollStateChanged(int state) {
override fun onPageSelected(position: Int) {
//position of the selected item
}

}
});
override fun onPageScrollStateChanged(state: Int) {
}
})
```

## LICENSE :
Expand Down
19 changes: 12 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
apply plugin: 'com.android.application'
apply plugin: 'org.jetbrains.kotlin.android'

android {
compileSdkVersion 29
compileSdk 34
namespace "in.goodiebag.example"
defaultConfig {
applicationId "in.goodiebag.example"
minSdkVersion 15
targetSdkVersion 29
targetSdk 34
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -17,15 +19,18 @@ android {
}
}
compileOptions {
sourceCompatibility = 1.7
targetCompatibility = 1.7
sourceCompatibility = 11
targetCompatibility = 11
}
kotlinOptions {
jvmTarget = '11'
}
buildToolsVersion = '29.0.2'
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.1.0'
testImplementation 'junit:junit:4.12'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.core:core-ktx:1.12.0'
testImplementation 'junit:junit:4.13.2'
implementation project(':carouselpicker')
}

This file was deleted.

6 changes: 3 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="in.goodiebag.example">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name="in.goodiebag.example.MainActivity">
<activity android:name="in.goodiebag.example.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
112 changes: 0 additions & 112 deletions app/src/main/java/in/goodiebag/example/MainActivity.java

This file was deleted.

Loading