Skip to content

Instantly share code, notes, and snippets.

@Ifeo-A
Ifeo-A / usefulAndroidLibraries.md
Last active February 23, 2021 18:54
Collection of useful android libraries
@Ifeo-A
Ifeo-A / create_jpeg_filename_with_timestamp.txt
Last active August 27, 2020 16:56
Creates a .jpg filename
private fun createImageFile(albumName: String): File?
{
val randomString = UUID.randomUUID().toString()
val fileLocation = File(
context?.getExternalFilesDir(Environment.DIRECTORY_PICTURES), albumName
)
fileLocation.apply {
if(!this.exists())
@Ifeo-A
Ifeo-A / Android learning resources.md
Last active August 27, 2020 16:55
List of online resources for improving Android development skills.
@Ifeo-A
Ifeo-A / animations.kt
Created February 25, 2020 09:46
Animation Extension Functions
fun View.slideDownToShow(startPosition: Float, duration: Long = 300L){
if (this.visibility == View.GONE || this.visibility == View.INVISIBLE){
this.visibility = View.VISIBLE
}
val translationAnimation = TranslateAnimation(
0f, // fromXDelta
0f, // toXDelta
- startPosition, // fromYDelta
@Ifeo-A
Ifeo-A / CubicBezierGraphPoints.md
Last active April 4, 2020 21:04
SemiCircleView (Custom View) implementation
@Ifeo-A
Ifeo-A / CossfadeIcon.kt
Created November 16, 2022 21:29
Compose crossfade animation
Crossfade(targetState = currentText.isEmpty()) { isEmpty ->
if(isEmpty){
Icon(
imageVector = Icons.Outlined.Search,
contentDescription = null,
modifier = Modifier
.clickable {
currentText = ""
}
)
@Ifeo-A
Ifeo-A / SearchBar.kt
Created November 16, 2022 21:30
Search bar component
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun SearchBar(
modifier: Modifier = Modifier,
@StringRes placeholderText: Int = R.string.placholder_text,
onSearch: (searchString: String) -> Unit
) {
var currentText by rememberSaveable { mutableStateOf("") }
val focusManager = LocalFocusManager.current
@Ifeo-A
Ifeo-A / MainNavigation.kt
Created November 16, 2022 21:32
Nav controller extension to pass objects to destinations
// Using the nav controller extension
@Composable
fun MainNavigation() {
val navController = rememberNavController()
NavHost(navController = navController, startDestination = Destinations.HOME) {
composable(route = Destinations.HOME) {
HomeScreen { recipe ->
navController.navigate(
route = Destinations.RECIPE_DETAIL,
@Ifeo-A
Ifeo-A / change-accessibility-settings-with-adb.md
Created January 9, 2024 03:24 — forked from mrk-han/change-accessibility-settings-with-adb.md
Enable and Disable Android Accessibility Settings from the Command Line using ADB (Font scale, talkback, color blind)

Using ADB to control Accessbility settings for easier testing with Android Emulators + Real Devices

It's a lot easier to test accessibility on the fly using ADB. This gist attempts to make the days of navigating through the Android device settings UI to change Accessibility settings obsolete.

These ADB commands will hopefully encourage Android developers to test and use their apps with common Accessiblility settings enabled.

Credit to James Nitsch for inspiring this, and for figuring out the put commands to enable these settings.

Font Scale (Font Size -- Testing Dynamic Text)