Skip to content

Instantly share code, notes, and snippets.

View Zhuinden's full-sized avatar
🤔
Fighting Proguard

Gabor Varadi Zhuinden

🤔
Fighting Proguard
View GitHub Profile
// RecyclerView Adapter implemented as ListAdapter and DiffCallback
class Mydapter(
private val clickListener: (String) -> Unit
) :
ListAdapter<MyUiModel, MyViewHolder>(MyDiffCallback()) {
override fun onCreateViewHolder(
parent: ViewGroup,
position: Int
private val rotation = FloatPropKey()
private fun createDefinition(duration: Int) = transitionDefinition {
state(0) { this[rotation] = 0f }
state(1) { this[rotation] = 360f }
transition {
rotation using repeatable {
animation = tween {
easing = LinearEasing
@mlykotom
mlykotom / appkill.sh
Last active July 5, 2021 18:26
Script for killing Android app (as system would)
#!/bin/bash
# Provide package of your application (com.example.myapp)
PACKAGE=$1
# First, put your app to background and then run this script
echo "Killing $PACKAGE"
adb shell ps | grep $PACKAGE | awk '{print $2}' | xargs adb shell run-as $PACKAGE kill
package com.davidmedenjak.overlappinginvertview
import android.content.Context
import android.graphics.*
import android.util.AttributeSet
import android.view.View
import android.widget.FrameLayout
class InvertViewLayout(context: Context, attrs: AttributeSet? = null) : FrameLayout(context, attrs) {
package utils;
import android.Manifest;
import android.app.Activity;
import android.content.pm.PackageManager;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.widget.Toast;
/**
public class RealmListParcelConverter implements TypeRangeParcelConverter<RealmList<? extends RealmObject>, RealmList<? extends RealmObject>> {
private static final int NULL = -1;
@Override
public void toParcel(RealmList<? extends RealmObject> input, Parcel parcel) {
if (input == null) {
parcel.writeInt(NULL);
} else {
parcel.writeInt(input.size());
for (RealmObject item : input) {
@dlew
dlew / themes-debug.xml
Last active March 1, 2024 15:46
With the new theming in AppCompat, a lot of assets are tinted automatically for you via theme attributes. That has often led me to wonder "where the hell did this color come from?" You can replace your normal theme with this debug theme to help figure out the source of that color.
<!-- You can change the parent around to whatever you normally use -->
<style name="DebugColors" parent="Theme.AppCompat">
<!-- System colors -->
<item name="android:windowBackground">@color/__debugWindowBackground</item>
<item name="android:colorPressedHighlight">#FF4400</item>
<item name="android:colorLongPressedHighlight">#FF0044</item>
<item name="android:colorFocusedHighlight">#44FF00</item>
<item name="android:colorActivatedHighlight">#00FF44</item>