Skip to content

Commit

Permalink
fix icon launcher conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
mahdiasd committed Oct 1, 2022
1 parent 2a8b1ec commit 0dd0b57
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ package com.mahdiasd.filepicker
import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.content.res.ColorStateList
import android.net.Uri
import android.util.Log.d
import android.view.View
import android.webkit.MimeTypeMap
import android.widget.ImageView
Expand Down Expand Up @@ -54,7 +52,7 @@ class FilePickerAdapter(
it.subFolderCount = model.file.listFiles()?.size ?: 0
it.stackListSize = stack.size
it.activeColor = config.activeColor
it.checkbox.buttonTintList = ColorStateList.valueOf(config.activeColor)
it.deActiveColor = config.deActiveColor
}
}
else -> {
Expand All @@ -63,9 +61,9 @@ class FilePickerAdapter(
it.item = model
glideSdCart(itemBinding.image, model.path)
it.presenter = this
it.activeColor = config.activeColor
it.deActiveColor = config.deActiveColor
it.type = config.selectedMode
// it.checkbox.buttonTintList = ColorStateList.valueOf(config.activeColor)
it.checkbox.setColorFilter(config.cardBackgroundColor)
}
}
}
Expand Down Expand Up @@ -186,7 +184,6 @@ class FilePickerAdapter(
intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
context.startActivity(intent)
} catch (e: java.lang.Exception) {
d("TAG", "openFile: ${e.message}")
Toast.makeText(
context,
context.resources.getString(R.string.mahdiasd_file_picker_failed_open_file),
Expand Down
7 changes: 3 additions & 4 deletions FilePicker/src/main/res/drawable/ic_done.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<vector android:height="128dp" android:viewportHeight="64"
android:viewportWidth="64" android:width="128dp" xmlns:android="http://schemas.android.com/apk/res/android">

<path android:fillColor="#000000" android:pathData="M32,10c12.15,0 22,9.85 22,22s-9.85,22 -22,22s-22,-9.85 -22,-22S19.85,10 32,10zM42.679,25.486c0.601,-0.927 0.336,-2.166 -0.591,-2.766c-0.93,-0.6 -2.167,-0.336 -2.767,0.591l-9.709,14.986l-5.11,-5.809c-0.729,-0.829 -1.994,-0.911 -2.823,-0.18c-0.829,0.729 -0.91,1.993 -0.181,2.823l6.855,7.791c0.382,0.433 0.93,0.679 1.502,0.679c0.049,0 0.098,-0.002 0.146,-0.005c0.625,-0.046 1.191,-0.382 1.532,-0.907L42.679,25.486z"/>
<vector android:height="128dp" android:viewportHeight="24"
android:viewportWidth="24" android:width="128dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#fff" android:pathData="M12,2C6.5,2 2,6.5 2,12s4.5,10 10,10s10,-4.5 10,-10C22,6.5 17.5,2 12,2zM16.2,10.3l-4.8,4.8c-0.4,0.4 -1,0.4 -1.4,0l0,0l-2.2,-2.2c-0.4,-0.4 -0.4,-1 0,-1.4c0.4,-0.4 1,-0.4 1.4,0c0,0 0,0 0,0l1.5,1.5l4.1,-4.1c0.4,-0.4 1,-0.4 1.4,0C16.6,9.3 16.6,9.9 16.2,10.3z"/>
</vector>
29 changes: 23 additions & 6 deletions FilePicker/src/main/res/layout/item_file_picker.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@

<data>

<variable
name="activeColor"
type="Integer" />

<variable
name="deActiveColor"
type="Integer" />

<import type="android.view.View" />

<variable
Expand Down Expand Up @@ -48,7 +56,7 @@
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_centerInParent="true"
android:elevation="5dp"
android:elevation="3dp"
android:onClick="@{(v) -> presenter.onClick(v , item)}"
android:src="@drawable/ic_play"
android:tint="@color/white"
Expand All @@ -58,17 +66,26 @@
app:layout_constraintRight_toRightOf="@id/image"
app:layout_constraintTop_toTopOf="@id/image" />

<View
android:layout_width="16dp"
android:layout_height="16dp"
android:background="@drawable/shape_circle"
android:backgroundTint="@color/white"
app:layout_constraintBottom_toBottomOf="@id/checkbox"
android:elevation="2dp"
app:layout_constraintLeft_toLeftOf="@id/checkbox"
app:layout_constraintRight_toRightOf="@id/checkbox"
app:layout_constraintTop_toTopOf="@id/checkbox" />

<ImageView
android:id="@+id/checkbox"
android:layout_width="24dp"
android:layout_height="24dp"
android:background="@drawable/shape_circle"
android:backgroundTint="@color/white"
android:src="@{item.selected ? @drawable/ic_done : @drawable/shape_circle}"
android:tint="@{config.activeColor}"
android:layout_margin="4dp"
android:elevation="6dp"
android:elevation="3dp"
android:onClick="@{(v) -> presenter.checkBox(v , item)}"
android:src="@{item.selected ? @drawable/ic_done : @drawable/shape_circle}"
android:tint="@{item.selected ? activeColor : @color/white}"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
Expand Down
20 changes: 15 additions & 5 deletions FilePicker/src/main/res/layout/item_file_picker_manager.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
name="item"
type="com.mahdiasd.filepicker.FileModel" />

<variable
name="deActiveColor"
type="Integer" />

<variable
name="activeColor"
type="Integer" />
Expand Down Expand Up @@ -114,14 +118,20 @@
android:text="@{`(` + subFolderCount + `)`}"
android:visibility="@{item.file.directory ? View.VISIBLE : View.GONE}" />

<com.google.android.material.checkbox.MaterialCheckBox

<ImageView
android:id="@+id/checkbox"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center"
android:checked="@{item.selected}"
android:layout_margin="4dp"
android:elevation="3dp"
android:onClick="@{(v) -> presenter.checkBox(v , item)}"
android:visibility="@{!item.file.directory ? View.VISIBLE : View.GONE}" />
android:src="@{item.selected ? @drawable/ic_done : @drawable/shape_circle}"
android:tint="@{item.selected ? activeColor : deActiveColor}"
android:visibility="@{!item.file.directory ? View.VISIBLE : View.GONE}"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</FrameLayout>

</RelativeLayout>
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

[![](https://jitpack.io/v/mahdiasd/BottomDialogFilePicker.svg)](https://jitpack.io/#mahdiasd/BottomDialogFilePicker)

A android bottom dialog picker like telegram for all version of android
A android bottom dialog picker like telegram for all version of android (1 ... , 10 , 11 , 12 , 13)

Search in Files

Support android 10+
Support android 10+

Expandable and scrollable dialog

Full Customisable (Color / text / minimum and maximum selected file size / ...)
Full Customisable (Color , text , minimum and maximum selected file size , ...)

No required runtime permission

Expand Down Expand Up @@ -44,7 +44,7 @@ Add it in your root build.gradle at the end of repositories:
```bash
dependencies {
implementation 'com.github.mahdiasd:BottomDialogFilePicker:1.0.2'
implementation 'com.github.mahdiasd:BottomDialogFilePicker:1.0.4'
}
```
## Ho To Use
Expand Down Expand Up @@ -116,8 +116,8 @@ Add it in your root build.gradle at the end of repositories:

## This library uses the following libraries

- [Glide](https://github.com/bumptech/glide)
- [Handle Path Oz](https://github.com/onimur/handle-path-oz)
- [Glide](https://github.com/bumptech/glide)
- [Handle Path Oz](https://github.com/onimur/handle-path-oz)

Thanks to the very powerful Glide and Handle Path Oz

Expand Down
2 changes: 0 additions & 2 deletions app/src/main/java/com/mahdiasd/sample/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.mahdiasd.sample

import android.graphics.Color
import android.os.Bundle
import android.util.Log
import android.view.View
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
Expand Down Expand Up @@ -79,7 +78,6 @@ class MainActivity : AppCompatActivity() {
.setActiveColor(Color.parseColor(activeColor))
.setListener(object : FilePickerListener {
override fun selectedFiles(list: List<FileModel>?) {
Log.e("TAG", "selectedFiles: ${list.toString()}")
}
})
.show()
Expand Down

0 comments on commit 0dd0b57

Please sign in to comment.