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
findPreference<Preference>(getString(R.string.setting_settings_key)) | |
?.setOnPreferenceClickListener { pref -> | |
@SuppressLint("RestrictedApi") | |
if (listView.adapter is PreferenceGroupAdapter) { | |
val adapter = listView.adapter as PreferenceGroupAdapter | |
val position = adapter.getPreferenceAdapterPosition(pref) | |
if (position != RecyclerView.NO_POSITION) { | |
val itemView = listView.findViewHolderForAdapterPosition(position)?.itemView | |
if (itemView != null) { | |
// do something |
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
import com.google.protobuf.gradle.* | |
plugins { | |
id("com.google.protobuf") version "0.8.18" | |
} | |
protobuf { | |
protoc { | |
artifact = "com.google.protobuf:protoc:3.19.1" | |
} |
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/sh | |
# Usage: ./watch-fds.sh <application_id> [delay_secs = 5] | |
APP_ID=${1:?missing application id} | |
DELAY=$(( ${2:-5} )) | |
DEVICE_LIMIT=$(( $(adb shell ulimit -n) )) | |
WARN_THRESHOLD=$(( ${DEVICE_LIMIT} / 3 )) | |
echo "Will warn at ${WARN_THRESHOLD}" |
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
import android.content.Context; | |
import android.support.annotation.NonNull; | |
import android.support.design.widget.AppBarLayout; | |
import android.support.v4.view.MotionEventCompat; | |
import android.support.v4.view.NestedScrollingChild; | |
import android.support.v4.view.NestedScrollingChildHelper; | |
import android.support.v4.view.VelocityTrackerCompat; | |
import android.support.v4.view.ViewCompat; | |
import android.support.v4.widget.ScrollerCompat; | |
import android.util.AttributeSet; |
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
GetObjectClass -> DeleteLocalRef | |
FindClass -> DeleteLocalRef | |
NewString -> DeleteLocalRef | |
NewStringUTF -> DeleteLocalRef | |
NewObject -> DeleteLocalRef | |
NewBooleanArray -> DeleteLocalRef | |
NewByteArray -> DeleteLocalRef | |
NewCharArray -> DeleteLocalRef | |
NewShortArray -> DeleteLocalRef | |
NewIntArray -> DeleteLocalRef |
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 ListViewOnScrollListener extends OnScrollListener{ | |
@Override | |
public void onScrollStateChanged(AbsListView view, int scrollState) {} | |
private int lastVisibleItem = 0; | |
private int lastY = 0; | |
@Override | |
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { | |
int top = 0; |
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 me.yugy.cnbeta.widget; | |
import android.content.Context; | |
import android.database.ContentObserver; | |
import android.database.Cursor; | |
import android.database.DataSetObservable; | |
import android.database.DataSetObserver; | |
import android.os.Handler; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.ViewGroup; |
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
import android.annotation.TargetApi; | |
import android.content.Context; | |
import android.graphics.Canvas; | |
import android.graphics.drawable.Drawable; | |
import android.os.Build; | |
import android.support.annotation.NonNull; | |
import android.util.AttributeSet; | |
import android.widget.ImageView; | |
import me.yugy.app.timeline.R; |
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
//compile all jar in libs folder | |
dependencies { | |
compile fileTree(dir: 'libs' , include: '*.jar') | |
} | |
//pack all so file into a jar and compile it | |
task nativeLibsToJar( | |
type: Zip, | |
description: 'create a jar archive of the native libs') { | |
destinationDir file('./libs') | |
baseName 'native-libs' |
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
import android.support.v4.view.ViewPager; | |
import android.view.View; | |
public class StackPageTransformer implements ViewPager.PageTransformer { | |
@TargetApi(Build.VERSION_CODES.HONEYCOMB) | |
public void transformPage(View page, float position) { | |
final float alpha; | |
final float translationX; |
NewerOlder