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
// 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 |
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
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 |
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
#!/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 |
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 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) { |
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 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; | |
/** |
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
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) { |
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
<!-- 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> |