Skip to content

Commit

Permalink
Merge pull request #283 from rahulyadav07/make-default-value-is-5-of-…
Browse files Browse the repository at this point in the history
…count-pref

Allow to user can select the 5 images without opening the setting Activity
  • Loading branch information
akshay2211 authored Jun 26, 2024
2 parents 8ee3d87 + 7ef125e commit fa57762
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/src/main/java/io/ak1/pixsample/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,16 @@ class MainActivity : AppCompatActivity() {
30
}
}
/**
* allow to user can select 5 image first time.
*/
count = try {
sp.getString("count", "1")?.toInt() ?: 1
sp.getString("count", "5")?.toInt() ?: 5
} catch (e: Exception) {
sp.apply {
edit().putString("count", "1").commit()
edit().putString("count", "5").commit()
}
1
5
}
spanCount = sp.getString("spanCount", "4")?.toInt() ?: 4
}
Expand Down

0 comments on commit fa57762

Please sign in to comment.