This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun getAllFileWithExtension(dir: File, fileExtension: String): MutableList<String> { | |
val result = mutableListOf<String>() | |
val listFiles: Array<File>? = dir.listFiles() | |
listFiles?.takeIf { listFiles.isNotEmpty() }?.let { | |
listFiles.forEach { | |
when (it.isDirectory) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/Kotlin/anko |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* https://stackoverflow.com/questions/15128204/how-to-get-the-size-of-bitmap-after-displaying-it-in-imageview | |
*/ | |
public int[] getSizeDrawable() { | |
Rect bounds = getDrawable().getBounds(); | |
int width = bounds.width(); | |
int height = bounds.height(); | |
int bitmapWidth = getDrawable().getIntrinsicWidth(); //this is the bitmap's width | |
int bitmapHeight = getDrawable().getIntrinsicHeight(); //this is the bitmap's height | |
return new int[]{bitmapWidth, bitmapHeight}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/Polarrco/PolarrPhotoEditorAndroidSDK | |
https://github.com/imgly/pesdk-android-demo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (isExternalStorageWritable()) { | |
Log.e("ThoNH","isExternalStorageWritable") | |
val appDirectory = File("${Environment.getExternalStorageDirectory()}/MyPersonalAppFolder") | |
val logDirectory = File("$appDirectory/log") | |
val logFile = File(logDirectory, "logcat" + System.currentTimeMillis() + ".txt") | |
// create app folder | |
if (!appDirectory.exists()) { | |
appDirectory.mkdir() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Reference: | |
1.https://guides.codepath.com/android/Understanding-App-Permissions | |
2.https://guides.codepath.com/android/Managing-Runtime-Permissions-with-PermissionsDispatcher | |
3.https://gist.github.com/dlew/2a21b06ee8715e0f7338 | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<color name="colorPrimary">#001921</color> | |
<color name="colorPrimaryDark">#00151b</color> | |
<color name="colorAccent">#e54c4c</color> | |
<!--// LightBackground--> | |
<color name="colorTextDarkPrimary">#de000000</color> | |
<color name="colorTextDarkSecondary">#8a000000</color> | |
<color name="colorTextDarkHint">#61000000</color> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- values-mdpi --> | |
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<dimen name="divider_height">1px</dimen> | |
<dimen name="_1dp">1px</dimen> | |
<dimen name="_4dp">4px</dimen> | |
<dimen name="_8dp">8px</dimen> | |
<dimen name="_16dp">16px</dimen> | |
<dimen name="_24dp">24px</dimen> | |
<dimen name="_32dp">32px</dimen> |