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
//call if(BuildConfig.DEBUG) registerActivityLifecycleCallbacks(new ActivityLifecycleLogger()) in your own Application class. | |
public class ActivityLifecycleLogger implements Application.ActivityLifecycleCallbacks { | |
private static final String TAG = "LifeCycleLogger"; | |
private static final Class[] LOG_CYCLE_ACTIVITIES = new Class[] { | |
//add activities you want to log here | |
MainActivity.class | |
}; |
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.app.Activity; | |
import android.content.DialogInterface; | |
import android.content.pm.PackageManager; | |
import android.support.annotation.NonNull; | |
import android.support.annotation.Nullable; | |
import android.support.annotation.StringRes; | |
import android.support.v4.app.ActivityCompat; | |
import java.util.Map; |
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
#!/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 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
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 |
OlderNewer