Skip to content

Commit c8e44e5

Browse files
authored
Merge pull request #116 from Mindinventory/develop
v1.4.0
2 parents 2faf654 + e1ea9da commit c8e44e5

File tree

24 files changed

+829
-209
lines changed

24 files changed

+829
-209
lines changed

README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Lassi is simplest way to pick media (either image, video, audio or doc)
6060
6161
6262
* Step 1.
63-
To open a app color theme view then add Lassi in to your activity class:
63+
To open an app color theme view then add Lassi in to your activity class:
6464
6565
```kotlin
6666
val intent = Lassi(this)
@@ -73,14 +73,18 @@ Lassi is simplest way to pick media (either image, video, audio or doc)
7373
.setMaxTime(30) // for MediaType.VIDEO only
7474
.setSupportedFileTypes("mp4", "mkv", "webm", "avi", "flv", "3gp") // Filter by limited media format (Optional)
7575
.setMinFileSize(100) // Restrict by minimum file size
76-
.setMaxFileSize(1024) // Restrict by maximum file size
76+
.setMaxFileSize(1024) // Restrict by maximum file size
7777
.disableCrop() // to remove crop from the single image selection (crop is enabled by default for single image)
7878
/*
7979
* Configuration for UI
8080
*/
8181
.setStatusBarColor(R.color.colorPrimaryDark)
8282
.setToolbarResourceColor(R.color.colorPrimary)
8383
.setProgressBarColor(R.color.colorAccent)
84+
.setSortingCheckedRadioButtonColor(R.color.darkBlue) // To set color of the checked state radio button resource within sorting dialog
85+
.setSortingUncheckedRadioButtonColor(R.color.regentStBlue) // To set color of the unchecked state radio button resource within sorting dialog
86+
.setSortingCheckedTextColor(R.color.regentStBlue) // To set color of the checked state radio button resource within sorting dialog
87+
.setSortingUncheckedTextColor(R.color.darkBlue) // To set color of the unchecked state radio button resource within sorting dialog
8488
.setPlaceHolder(R.drawable.ic_image_placeholder)
8589
.setErrorDrawable(R.drawable.ic_image_placeholder)
8690
.setSelectionDrawable(R.drawable.ic_checked_media)
@@ -123,6 +127,24 @@ Lassi is simplest way to pick media (either image, video, audio or doc)
123127
}
124128
}
125129
```
130+
131+
* Option - 1. To set language's text programmatically based on the current language set on the device follow below mentioned approach of setting strings in your desired language.
132+
* getMultiLngBuilder() exposes params which you can use to set texts.
133+
* By default english (en) language is set so no need to follow this step.
134+
```kotlin
135+
val currentLang = Locale.getDefault().language.toString()
136+
if (currentLang == "es") {
137+
lassi.getMultiLngBuilder(
138+
setOkLbl = "d'accord",
139+
setCancelLbl = "Annuler",
140+
setSortAscendingLbl = "Ascendant",
141+
setSortDescendingLbl = "Descendant",
142+
setSortByDateLbl = "Trier par date"
143+
)
144+
}
145+
```
146+
* Option - 2. To localize text content of Lassi picker with multiple language options, define language-specific string resource file in your project and update values of string resource keys mentioned in below link with your desired language.
147+
* [Lassi String Resources](https://github.com/Mindinventory/Lassi-Android/blob/931e147ebe6282bd1629858b5a9f29fe5a0b8b32/lassi/src/main/res/values/strings.xml)
126148
127149
### Document access permission note
128150
If Android device SDK is >= 30 and wants to access document (only for choose the non media file) then add ```android.permission.MANAGE_EXTERNAL_STORAGE``` permission in your app otherwise library won't allow to access documents. Kindly check sample app for more detail.

app/src/main/java/com/lassi/app/MainActivity.kt

Lines changed: 114 additions & 105 deletions
Large diffs are not rendered by default.

app/src/main/res/layout/activity_main.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,25 @@
150150
app:layout_constraintHorizontal_bias="0.5"
151151
app:layout_constraintStart_toEndOf="@+id/btnImageCapture"
152152
app:layout_constraintTop_toBottomOf="@+id/btnDocumentSystemIntent" />
153+
154+
<Button
155+
android:id="@+id/btnPhotoPicker"
156+
android:layout_width="wrap_content"
157+
android:layout_height="wrap_content"
158+
android:layout_marginTop="16dp"
159+
android:background="@drawable/bg_rounded_button"
160+
android:drawableStart="@drawable/ic_document"
161+
android:padding="10dp"
162+
android:text="@string/photo_picker"
163+
android:textAllCaps="false"
164+
android:textColor="@android:color/white"
165+
android:textSize="16sp"
166+
android:textStyle="bold"
167+
android:visibility="gone"
168+
app:layout_constraintEnd_toEndOf="parent"
169+
app:layout_constraintHorizontal_bias="0.5"
170+
app:layout_constraintStart_toStartOf="parent"
171+
app:layout_constraintTop_toBottomOf="@+id/btnVideoCapture" />
153172
</androidx.constraintlayout.widget.ConstraintLayout>
154173

155174
<androidx.recyclerview.widget.RecyclerView
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<string name="app_name">Lassi sample</string>
4+
<string name="selected_media">Medios seleccionados</string>
5+
<string name="open_video_picker">Abrir selector de vídeos</string>
6+
<string name="open_image_picker">Abrir selector de imágenes</string>
7+
<string name="image">Imagen</string>
8+
<string name="video">Video</string>
9+
<string name="document">Documento</string>
10+
<string name="audio">Audio</string>
11+
<string name="open_system_view">"Abrir vista del sistema "</string>
12+
<string name="photo_picker">Selector de fotos</string>
13+
14+
<string name="sort_by_date">Ordenar por fecha</string>
15+
<string name="sort_ascending">Ascendente</string>
16+
<string name="sort_descending">Descendente</string>
17+
<string name="camera_permission_rational">No se concede el permiso de la cámara. Por favor, permita que se configure.</string>
18+
<string name="crop_image_menu_crop">Cultivo</string>
19+
</resources>

app/src/main/res/values/colors.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@
88
<color name="cherry_red">#E9333C</color>
99
<color name="chartreuse">#DFFF00</color>
1010
<color name="emerald_green">#50C878</color>
11+
<color name="darkBlue">#22223b</color>
12+
<color name="regentStBlue">#98c1d9</color>
1113
</resources>

app/src/main/res/values/strings.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,11 @@
88
<string name="document">Document</string>
99
<string name="audio">Audio</string>
1010
<string name="open_system_view">Open System View</string>
11+
<string name="photo_picker">Photo Picker</string>
12+
13+
<string name="sort_by_date">Sort by Date</string>
14+
<string name="sort_ascending">Ascending</string>
15+
<string name="sort_descending">Descending</string>
16+
<string name="camera_permission_rational">Camera permission is not granted. Please allow it from setting.</string>
17+
<string name="crop_image_menu_crop">Crop</string>
1118
</resources>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Thu Aug 31 11:56:21 IST 2023
1+
#Tue Mar 12 19:15:15 IST 2024
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

lassi/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ android {
1414
defaultConfig {
1515
minSdk 21
1616
targetSdk 34
17-
versionCode 26
18-
versionName "1.3.0"
17+
versionCode 27
18+
versionName "1.4.0"
1919
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2020
vectorDrawables.useSupportLibrary = true
2121
multiDexEnabled true

lassi/src/main/AndroidManifest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
1010
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
1111

12+
<!-- To handle the reselection within the app on Android 14 (API level 34) -->
13+
<uses-permission android:name="android.permission.READ_MEDIA_VISUAL_USER_SELECTED" />
14+
1215
<!-- Required to maintain app compatibility. -->
1316
<uses-permission
1417
android:name="android.permission.READ_EXTERNAL_STORAGE"

lassi/src/main/java/com/lassi/common/utils/KeyUtils.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ object KeyUtils {
1818
const val DESCENDING_ORDER = 0
1919
const val ASCENDING_ORDER = 1
2020
const val DEFAULT_ORDER = 2
21+
const val ERROR_EXCEEDING_MSG = "You are exceeding the defined Max limit."
2122
}

0 commit comments

Comments
 (0)