This file contains 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
import android.app.Activity | |
import androidx.activity.result.ActivityResultLauncher | |
import androidx.activity.result.contract.ActivityResultContracts | |
import androidx.appcompat.app.AppCompatActivity | |
import androidx.core.app.ActivityCompat.shouldShowRequestPermissionRationale | |
import androidx.fragment.app.Fragment | |
object PermissionUtil { |
This file contains 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
// conversions based on https://material.io/blog/migrating-material-3, deprecated colors set to Colors.Red | |
@Composable | |
fun fromMaterial3Theme(isLight: Boolean): Colors { | |
val scheme = MaterialTheme.colorScheme | |
return Colors( | |
primary = scheme.primary, | |
primaryVariant = Color.Red, | |
secondary = scheme.secondary, | |
secondaryVariant = Color.Red, | |
background = scheme.background, |
This file contains 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
package foo | |
import androidx.compose.foundation.BorderStroke | |
import androidx.compose.foundation.background | |
import androidx.compose.foundation.layout.Box | |
import androidx.compose.foundation.layout.Row | |
import androidx.compose.foundation.layout.fillMaxWidth | |
import androidx.compose.foundation.layout.height | |
import androidx.compose.foundation.layout.padding | |
import androidx.compose.foundation.layout.size |
This file contains 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
import androidx.fragment.app.FragmentManager | |
import androidx.lifecycle.LiveData | |
import androidx.lifecycle.MutableLiveData | |
import androidx.navigation.NavController | |
import androidx.navigation.fragment.NavHostFragment | |
import com.google.android.material.bottomnavigation.BottomNavigationView | |
import java.util.Stack | |
import kotlin.collections.HashMap | |
class BottomBackStackController { |
This file contains 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
#!/usr/bin/env bash | |
# I've found that the "Migrate to AndroidX" converter in Android Studio doesn't work very | |
# well, so I wrote my own script to do the simple job of converting package names. | |
# | |
# You can download a CSV of package names here: https://developer.android.com/topic/libraries/support-library/downloads/androidx-class-mapping.csv | |
# | |
# It'll run faster on a clean build because then there are fewer files to scan over. | |
# | |
# Uses `gsed` because I'm on a Mac. Can easily replace with `sed` if you don't have `gsed`. |
This file contains 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
import java.text.Normalizer; | |
import java.util.ArrayList; | |
import java.util.LinkedList; | |
import java.util.List; | |
import java.util.StringTokenizer; | |
/** | |
* Created by Muzaffer YILMAZ on 28.2.2018. | |
*/ | |
public class SearchManager<T extends SearchManager.Searchable> { |
This file contains 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
import android.content.Context; | |
import android.speech.tts.TextToSpeech; | |
import android.speech.tts.UtteranceProgressListener; | |
import android.util.Log; | |
import java.util.HashMap; | |
import java.util.Locale; | |
/** | |
* Created by Muzaffer Yılmaz on 24.04.2018. |
This file contains 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
import java.math.BigInteger | |
import java.security.MessageDigest | |
fun String.md5(): String { | |
val md = MessageDigest.getInstance("MD5") | |
return BigInteger(1, md.digest(toByteArray())).toString(16).padStart(32, '0') | |
} |