Skip to content

Instantly share code, notes, and snippets.

View TylerMcCraw's full-sized avatar

Tyler McCraw TylerMcCraw

View GitHub Profile
@TylerMcCraw
TylerMcCraw / MainActivity.java
Last active July 31, 2018 07:25
TextInputLayout Issues with setError
package com.example.tyler.myapplication;
import android.os.Bundle;
import android.support.design.widget.TextInputEditText;
import android.support.design.widget.TextInputLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.view.View;
@TylerMcCraw
TylerMcCraw / AndroidManifest_After.xml
Last active May 15, 2018 00:58
Decompiling APKs (before + after)
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.w3bshark.myapplication" platformBuildVersionCode="24" platformBuildVersionName="N">
<application android:allowBackup="true" android:debuggable="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme">
<activity android:label="@string/app_name" android:name="com.w3bshark.myapplication.MainActivity" android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>

Keybase proof

I hereby claim:

  • I am tylermccraw on github.
  • I am w3bshark (https://keybase.io/w3bshark) on keybase.
  • I have a public key ASCV7Jjy-80hQ6Ar1Oy1zBwwHqrnHVrB8CZFD4m7iV28XAo

To claim this, I am signing this object:

@TylerMcCraw
TylerMcCraw / MyFragment.kt
Created June 1, 2020 21:17
Always show AppBarLayout elevation regardless of state
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
// ... inflate layout ...
appBarLayout.stateListAnimator = AnimatorInflater.loadStateListAnimator(context, R.animator.appbar_always_elevated_state_list_animator)
}
@TylerMcCraw
TylerMcCraw / ScrollingViewAboveBottomNavigationBehavior.kt
Created September 18, 2020 16:58
ScrollingViewAboveBottomNavigationBehavior
import android.content.Context
import android.util.AttributeSet
import android.view.View
import androidx.coordinatorlayout.widget.CoordinatorLayout
import com.google.android.material.appbar.AppBarLayout
import com.google.android.material.bottomnavigation.BottomNavigationView
/**
* Extension of standard [AppBarLayout.ScrollingViewBehavior] which
* ensures the scrollview bottom aligns with the top of the view below it,
@TylerMcCraw
TylerMcCraw / WidgetWithAccelerometer.kt
Created March 4, 2022 18:47 — forked from PSPanishetti/WidgetWithAccelerometer.kt
Spaghetti code for working widget that attached to accelerometer in android.
import android.content.Context
import android.hardware.Sensor
import android.hardware.SensorEvent
import android.hardware.SensorEventListener
import android.hardware.SensorManager
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
@TylerMcCraw
TylerMcCraw / Parallax.kt
Created May 26, 2022 19:47 — forked from surajsau/ParallaxScreen.kt
Parallax effect with Jetpack Compose
val context = LocalContext.current
val scope = rememberCoroutineScope()
var data by remember { mutableStateOf<SensorData?>(null) }
DisposableEffect(Unit) {
val dataManager = SensorDataManager(context)
dataManager.init()
scope.launch {
@TylerMcCraw
TylerMcCraw / UIText.kt
Created August 22, 2022 16:40
Helper sealed class for handling text from Strings and from string resources
/**
* Taken from https://github.com/AdamMc331/TOA/blob/development/app/src/main/java/com/adammcneilly/toa/core/ui/UIText.kt
*/
import android.content.Context
import androidx.annotation.StringRes
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalContext
/**
@TylerMcCraw
TylerMcCraw / SharedPreferencesExtensions.kt
Created October 27, 2022 04:49 — forked from orwir/SharedPreferencesExtensions.kt
Kotlin extensions for shared preferences
import android.content.Context
import android.content.SharedPreferences
import kotlin.reflect.KProperty
/**
* Creates delegate for property from [prefs] with the key presented as className+propertyName.
* @param T type of the property
* @param defaultValue is used if property not set
* @return wrapper for property accessors
*/