Skip to content

Commit 06d20c6

Browse files
Merge pull request #28 from hamzaahmedkhan/release/1.2.3
Release/1.2.3
2 parents f4b9e03 + 50dca53 commit 06d20c6

File tree

21 files changed

+561
-107
lines changed

21 files changed

+561
-107
lines changed

.github/workflows/greetings.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Greetings
2+
3+
on: [pull_request, issues]
4+
5+
jobs:
6+
greeting:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/first-interaction@v1
10+
with:
11+
repo-token: ${{ secrets.GITHUB_TOKEN }}
12+
issue-message: 'Message that will be displayed on users'' first issue'
13+
pr-message: 'Message that will be displayed on users'' first pr'

README.md

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,24 @@ Android Spinner Dialog Library, Use for single or multi selection of choice
33

44
[![](https://jitpack.io/v/hamzaahmedkhan/SpinnerDialog.svg)](https://jitpack.io/#hamzaahmedkhan/SpinnerDialog)
55

6-
[ ![Download](https://api.bintray.com/packages/hamzaahmedkhan/SpinnerDialog/SpinnerDialog/images/download.svg?version=v1.2.2) ](https://bintray.com/hamzaahmedkhan/SpinnerDialog/SpinnerDialog/v1.2.2/link)
6+
[ ![Download](https://api.bintray.com/packages/hamzaahmedkhan/SpinnerDialog/SpinnerDialog/images/download.svg?version=v1.2.3) ](https://bintray.com/hamzaahmedkhan/SpinnerDialog/SpinnerDialog/v1.2.3/link)
77

88

99

1010
## Android UI
1111

1212
<img src='demo/home.png' height=480 width=240 />
1313

14-
15-
<img src='demo/list_0.png' height=480 width=240 />
16-
17-
1814
<img src='demo/list_1.png' height=480 width=240 />
1915

20-
2116
<img src='demo/list_2.png' height=480 width=240 />
2217

23-
2418
<img src='demo/list_3.png' height=480 width=240 />
2519

20+
<img src='demo/list_4.png' height=480 width=240 />
21+
22+
<img src='demo/list_5.png' height=480 width=240 />
23+
2624

2725
## Download
2826

@@ -31,7 +29,7 @@ To include `SpinnerDialog` in your project, add the following to your dependenci
3129
**app/build.gradle**
3230
```groovy
3331
dependencies {
34-
implementation 'com.github.hamzaahmedkhan:SpinnerDialog:v1.2.2'
32+
implementation 'com.github.hamzaahmedkhan:SpinnerDialog:v1.2.3'
3533
}
3634
```
3735

@@ -49,14 +47,39 @@ class MainActivity : AppCompatActivity() {
4947
super.onCreate(savedInstanceState)
5048
setContentView(R.layout.activity_main)
5149

52-
50+
// INITIALZE DATA
5351
val arraySpinnerModel: ArrayList<SpinnerModel> = ArrayList()
5452

5553
for (i in 1..9) {
56-
arraySpinnerModel.add(SpinnerModel("Number $i"))
54+
val spinnerModel = SpinnerModel(
55+
"Number $i"
56+
)
57+
spinnerModel.id = i
58+
arraySpinnerModel.add(
59+
spinnerMode
60+
)
5761
}
5862

5963

64+
// EXTRA PROPERTIES OF SPINNER MODEL
65+
66+
// User can set ImageType as Circle or Square
67+
spinnerModel.imageType = ImageType.IMAGE_CIRCLE
68+
spinnerModel.imageType = ImageType.IMAGE_SQUARE
69+
70+
// User can set Description text
71+
spinnerModel.description = "This is Description of $i"
72+
73+
// To set Image Path (Either URL or from Drawable Resources), priority will be given to Res ID. If resID not provided then it will load image from URL
74+
spinnerModel.imagePath("https://homepages.cae.wisc.edu/~ece533/images/airplane.png")
75+
spinnerModel.imagePath(R.drawable.img_bird)
76+
77+
78+
79+
80+
81+
82+
6083
// Init single select Fragment
6184
val spinnerSingleSelectDialogFragment =
6285
SpinnerDialogFragment.newInstance(
@@ -117,14 +140,18 @@ class MainActivity : AppCompatActivity() {
117140
spinnerSingleSelectDialogFragment.showSearchBar = true
118141
spinnerSingleSelectDialogFragment.searchbarHint = "type here to search.."
119142
spinnerSingleSelectDialogFragment.setDialogHeight(ViewGroup.LayoutParams.MATCH_PARENT) // for dynamic height you can use Integer.dp e.g setDialogHeight(500.dp) or ViewGroup.LayoutParams.WRAP_CONTENT
143+
spinnerSingleSelectDialogFragment.showDescription(true)
144+
spinnerSingleSelectDialogFragment.showImage(true)
120145

121146

122147
// Using optional features for multi select dialog
123148
spinnerMultiSelectDialogFragment.buttonText = "SAVE"
124149
spinnerMultiSelectDialogFragment.themeColorResId = resources.getColor(R.color.material_pink500)
125150
spinnerMultiSelectDialogFragment.showSearchBar = true
126151
spinnerMultiSelectDialogFragment.searchbarHint = "type here to search.."
127-
spinnerSingleSelectDialogFragment.setDialogHeight(ViewGroup.LayoutParams.MATCH_PARENT) // for dynamic height you can use Integer.dp e.g setDialogHeight(500.dp) or ViewGroup.LayoutParams.WRAP_CONTENT
152+
spinnerMultiSelectDialogFragment.setDialogHeight(ViewGroup.LayoutParams.MATCH_PARENT) // for dynamic height you can use Integer.dp e.g setDialogHeight(500.dp) or ViewGroup.LayoutParams.WRAP_CONTENT
153+
spinnerMultiSelectDialogFragment.showDescription(true)
154+
spinnerMultiSelectDialogFragment.showImage(true)
128155

129156

130157
```
@@ -170,4 +197,4 @@ TestEnum.values().forEach {
170197

171198
**FUTURE RELEASE PLANS**
172199

173-
-> Open issues in Release 1.3.0
200+
-> Open issues for Release 1.3.0

app/build.gradle

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ android {
1010
applicationId "com.github.hamzaahmedkhan"
1111
minSdkVersion 21
1212
targetSdkVersion 28
13-
versionCode 1
14-
versionName "1.2.1"
13+
versionCode 3
14+
versionName "1.2.3"
1515
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1616
}
1717
buildTypes {
@@ -27,6 +27,9 @@ android {
2727
targetCompatibility JavaVersion.VERSION_1_8
2828
}
2929

30+
kotlinOptions {
31+
jvmTarget = JavaVersion.VERSION_1_8
32+
}
3033

3134
lintOptions {
3235
checkReleaseBuilds false
@@ -39,7 +42,7 @@ android {
3942
dependencies {
4043
implementation fileTree(dir: 'libs', include: ['*.jar'])
4144
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
42-
implementation 'androidx.appcompat:appcompat:1.0.0'
45+
implementation 'androidx.appcompat:appcompat:1.2.0'
4346
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
4447
testImplementation 'junit:junit:4.12'
4548
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
package com.github.hamzaahmedkhan
2+
3+
import com.github.hamzaahmedkhan.spinnerdialog.enums.ImageType
4+
import com.github.hamzaahmedkhan.spinnerdialog.models.SpinnerModel
5+
6+
object Constants {
7+
8+
9+
fun sampleDataWithDescriptionAndImage(): ArrayList<SpinnerModel> {
10+
val arraySpinnerModel = ArrayList<SpinnerModel>()
11+
12+
for (i in 1..9) {
13+
val spinnerModel = SpinnerModel(
14+
"Number $i"
15+
)
16+
spinnerModel.id = i
17+
spinnerModel.description = "This is Description of $i"
18+
if (i%2 == 0) {
19+
spinnerModel.imagePath("https://homepages.cae.wisc.edu/~ece533/images/airplane.png")
20+
} else {
21+
spinnerModel.imagePath(R.drawable.img_bird)
22+
}
23+
spinnerModel.imageType = ImageType.IMAGE_CIRCLE
24+
25+
arraySpinnerModel.add(
26+
spinnerModel
27+
)
28+
}
29+
30+
return arraySpinnerModel
31+
}
32+
33+
34+
fun sampleDataWithDescription(): ArrayList<SpinnerModel> {
35+
val arraySpinnerModel = ArrayList<SpinnerModel>()
36+
37+
for (i in 1..9) {
38+
val spinnerModel = SpinnerModel(
39+
"Number $i"
40+
)
41+
spinnerModel.id = i
42+
spinnerModel.description = "This is Description of $i"
43+
arraySpinnerModel.add(
44+
spinnerModel
45+
)
46+
}
47+
48+
return arraySpinnerModel
49+
}
50+
51+
52+
fun sampleData(): ArrayList<SpinnerModel> {
53+
val arraySpinnerModel = ArrayList<SpinnerModel>()
54+
55+
for (i in 1..9) {
56+
val spinnerModel = SpinnerModel(
57+
"Number $i"
58+
)
59+
spinnerModel.id = i
60+
arraySpinnerModel.add(
61+
spinnerModel
62+
)
63+
}
64+
65+
return arraySpinnerModel
66+
}
67+
}

app/src/main/java/com/github/hamzaahmedkhan/MainActivity.kt

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,7 @@ class MainActivity : AppCompatActivity() {
1919
setContentView(R.layout.activity_main)
2020

2121

22-
val arraySpinnerModel: ArrayList<SpinnerModel> = ArrayList()
23-
24-
for (i in 1..9) {
25-
arraySpinnerModel.add(
26-
SpinnerModel(
27-
"Number $i"
28-
)
29-
)
30-
}
31-
22+
val arraySpinnerModel = Constants.sampleDataWithDescriptionAndImage()
3223

3324
// Init single select Fragment
3425
val spinnerSingleSelectDialogFragment =
@@ -79,14 +70,18 @@ class MainActivity : AppCompatActivity() {
7970
spinnerSingleSelectDialogFragment.showSearchBar = true
8071
spinnerSingleSelectDialogFragment.searchbarHint = "Type here to search.."
8172
spinnerSingleSelectDialogFragment.setDialogHeight(ViewGroup.LayoutParams.MATCH_PARENT)
73+
spinnerSingleSelectDialogFragment.showDescription(true)
74+
spinnerSingleSelectDialogFragment.showImage(true)
8275

8376

8477
// Using optional features for multi select dialog
8578
spinnerMultiSelectDialogFragment.buttonText = "DONE"
8679
spinnerMultiSelectDialogFragment.themeColorResId = resources.getColor(R.color.material_pink500)
8780
spinnerMultiSelectDialogFragment.showSearchBar = true
8881
spinnerMultiSelectDialogFragment.searchbarHint = "Type here to search.."
89-
spinnerSingleSelectDialogFragment.setDialogHeight(500.dp)
82+
spinnerMultiSelectDialogFragment.setDialogHeight(500.dp)
83+
spinnerMultiSelectDialogFragment.showDescription(true)
84+
spinnerMultiSelectDialogFragment.showImage(true)
9085

9186

9287
txtShowSingleChoiceSpinner.setOnClickListener { spinnerSingleSelectDialogFragment.show(supportFragmentManager, "SpinnerDialogFragmentSingle") }

demo/list_0.png

-53.8 KB
Binary file not shown.

demo/list_4.png

467 KB
Loading

demo/list_5.png

300 KB
Loading

spinnerdialog/build.gradle

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ android {
99
defaultConfig {
1010
minSdkVersion 15
1111
targetSdkVersion 28
12-
versionCode 2
13-
versionName "1.2.2"
12+
versionCode 3
13+
versionName "1.2.3"
1414

1515
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1616

@@ -23,20 +23,28 @@ android {
2323
}
2424
}
2525
compileOptions {
26-
sourceCompatibility = '1.8'
27-
targetCompatibility = '1.8'
26+
sourceCompatibility JavaVersion.VERSION_1_8
27+
targetCompatibility JavaVersion.VERSION_1_8
28+
}
29+
30+
kotlinOptions {
31+
jvmTarget = JavaVersion.VERSION_1_8
32+
javaParameters = true // Useful for reflection.
2833
}
2934

3035
}
3136

3237
dependencies {
3338
implementation fileTree(dir: 'libs', include: ['*.jar'])
34-
implementation 'androidx.appcompat:appcompat:1.0.0'
39+
implementation 'androidx.appcompat:appcompat:1.2.0'
3540

3641
testImplementation 'junit:junit:4.12'
3742
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
3843
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
3944
implementation 'androidx.recyclerview:recyclerview:1.1.0'
4045
implementation 'com.jcminarro:RoundKornerLayouts:0.4.0'
4146
testImplementation 'junit:junit:4.12'
47+
48+
implementation("io.coil-kt:coil:1.0.0-rc3")
49+
4250
}
Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,12 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.github.hamzaahmedkhan.spinnerdialog" />
2+
package="com.github.hamzaahmedkhan.spinnerdialog">
3+
<uses-permission android:name="android.permission.INTERNET" />
4+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
5+
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
6+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
7+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
8+
9+
<application
10+
android:usesCleartextTraffic="true">
11+
</application>
12+
</manifest>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.github.hamzaahmedkhan.spinnerdialog.enums
2+
3+
enum class ImageType {
4+
IMAGE_CIRCLE, IMAGE_SQUARE
5+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.github.hamzaahmedkhan.spinnerdialog.extension
2+
3+
import android.os.Handler
4+
import android.view.View
5+
6+
fun View.disableClick(time: Long = 2000) {
7+
this.let {
8+
it.isEnabled = false
9+
val handler = Handler()
10+
handler.postDelayed({
11+
it.isEnabled = true
12+
}, time)
13+
}
14+
}
15+
16+
fun View.visible(){
17+
this.visibility = View.VISIBLE
18+
}
19+
20+
fun View.gone(){
21+
this.visibility = View.GONE
22+
}

0 commit comments

Comments
 (0)