Skip to content

Instantly share code, notes, and snippets.

View dmytrodanylyk's full-sized avatar

Dmytro Danylyk dmytrodanylyk

View GitHub Profile
@dmytrodanylyk
dmytrodanylyk / ErrorLabelLayout.java
Created January 21, 2015 15:35
Android Error Label
public class ErrorLabelLayout extends LinearLayout implements ViewGroup.OnHierarchyChangeListener {
private static final int ERROR_LABEL_TEXT_SIZE = 12;
private static final int ERROR_LABEL_PADDING = 4;
private TextView mErrorLabel;
private Drawable mDrawable;
private int mErrorColor;
public ErrorLabelLayout(Context context) {
@dmytrodanylyk
dmytrodanylyk / res_color_btn_flat_selector.xml
Last active March 4, 2023 07:52
Material Flat Button Style
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false"
android:color="@color/flat_disabled_text"/>
<item android:color="@color/flat_normal_text"/>
</selector>
@dmytrodanylyk
dmytrodanylyk / ShadowLayout.java
Last active August 29, 2015 14:15
ShadowLayout
public class ShadowLayout extends FrameLayout implements ViewGroup.OnHierarchyChangeListener {
private int mBackgroundColor;
private int mShadowColor;
private float mShadowRadius;
private float mCornerRadius;
private float mDx;
private float mDy;
private Paint mPaint;
@dmytrodanylyk
dmytrodanylyk / FadingToolbar.java
Last active September 21, 2015 12:06
Fading Toolbar
public class FadingToolbar extends Toolbar {
private Drawable mToolbarBackgroundDrawable;
public FadingToolbar(Context context) {
super(context);
initView(context);
}
public FadingToolbar(Context context, AttributeSet attrs) {
if (BuildConfig.DEBUG) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectCustomSlowCalls()
.detectDiskReads()
.detectDiskWrites()
.detectNetwork()
.penaltyLog()
.build());
StrictMode.VmPolicy.Builder vmPolicy = new StrictMode.VmPolicy.Builder()
# Add project specific ProGuard rules here.
-dontobfuscate
-dontoptimize
-ignorewarnings
@dmytrodanylyk
dmytrodanylyk / Test1.java
Last active March 6, 2018 12:57
Realm test
// Test 1
for (int i = 0; i < 10; i++) {
// spawn new thread which call queryNoTransaction()
}
void queryNoTransaction() {
try (Realm realm = Realm.getDefaultInstance()) {
long start = System.currentTimeMillis();
RealmResults<UserProfile> users = realm.where(UserProfile.class).findAll();
List<UserProfile> userCopy = realm.copyFromRealm(users);
android {
lintOptions {
lintConfig file("$project.rootDir/tools/rules-lint.xml")
htmlOutput file("$project.buildDir/outputs/lint/lint.html")
warningsAsErrors true
xmlReport false
}
}
apply plugin: 'com.android.application'
apply from: "$project.rootDir/tools/script-lint.gradle"
...
<?xml version="1.0" encoding="utf-8"?>
<lint>
<issue id="GoogleAppIndexingWarning" severity="ignore" />
</lint>