Skip to content

Instantly share code, notes, and snippets.

View kapanadze's full-sized avatar

Akaki Kapanadze kapanadze

  • Tbilisi
View GitHub Profile
@sunmeat
sunmeat / gist:80b600dfe44f2878b91ec45fad750328
Last active October 14, 2025 17:04
justify text android (simple version)
JTextView.java:
package com.alex.controls;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
@lyaotian
lyaotian / ViewUtils.kt
Created April 12, 2018 03:48
Create background of android shadow view,
package com.kollway.booktravel.util
import android.graphics.Rect
import android.graphics.drawable.Drawable
import android.graphics.drawable.LayerDrawable
import android.graphics.drawable.ShapeDrawable
import android.graphics.drawable.shapes.RoundRectShape
import android.support.annotation.ColorRes
import android.support.v4.content.ContextCompat
import android.view.Gravity
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
@nickbutcher
nickbutcher / IconView.kt
Last active January 14, 2025 12:28
A prototype implementation of a shadow effect inspired by the Google Play Games app (https://play.google.com/store/apps/details?id=com.google.android.play.games).
/*
* Copyright 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@tinmegali
tinmegali / App.kt
Created July 14, 2017 17:08
Injecting ViewModel with Dagger2 on Android using Kotlin
class App : Application(), HasActivityInjector {
@Inject lateinit var activityInjector: DispatchingAndroidInjector<Activity>
override fun activityInjector(): AndroidInjector<Activity> {
return activityInjector
}
override fun onCreate() {
super.onCreate()
@electrolobzik
electrolobzik / RxBus.kt
Created March 28, 2017 10:16
Event bus implementation with RxJava and RxRelay (https://github.com/JakeWharton/RxRelay) with API similar to https://github.com/greenrobot/EventBus
/**
* Created with Android Studio
* User: electrolobzik electrolobzik@gmail.com
* Date: 27/03/2017
* Time: 22:05
*
* Event bus implementation with RxJava and RxRelay (https://github.com/JakeWharton/RxRelay) with API similar to https://github.com/greenrobot/EventBus
*/
class RxBus<T> {
var stickyEvent: T? = null
@zly394
zly394 / AppBarLayoutOverScrollViewBehavior.java
Last active February 26, 2026 01:44
Overscroll AppBarLayout Behavior—— AppBarLayout越界弹性效果
package com.zly.widget.behavior;
import android.animation.ValueAnimator;
import android.content.Context;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CoordinatorLayout;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.view.View;
Observable<Boolean> emptyFieldStream = Observable.combineLatest(
RxTextView.textChanges(etEmail)
.map(new Func1<CharSequence, Boolean>() {
@Override
public Boolean call(CharSequence charSequence) {
return TextUtils.isEmpty(charSequence);
}
}),
RxTextView.textChanges(etPassword)
.map(new Func1<CharSequence, Boolean>() {
@mistrydarshan99
mistrydarshan99 / FlickerActivity.java
Created December 27, 2016 04:46 — forked from devunwired/FlickerActivity.java
Quick Android Things demo using ObjectAnimator to animate the brightness of a PWM output. This example uses a BounceInterpolator to create a flickering effect on an LED (like a candle).
/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@kamikat
kamikat / AVUpdateUtils.java
Last active March 29, 2019 06:34
Auto-upgrade module for Android apps using LeanCloud SDK and RxJava.
public class AVUpdateUtils {
public static final long RESULT_OK = 0L;
public static final long RESULT_CANCEL = 1L;
public static final long RESULT_INSTALLING = 2L;
private static long downloadInBackground(Context context, String url, File file) {
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI);
request.setAllowedOverRoaming(false);