Skip to content

Instantly share code, notes, and snippets.

View 0neel's full-sized avatar

Maksim Kovalev 0neel

View GitHub Profile
@0neel
0neel / build.gradle
Created March 5, 2024 14:29
kotlinx-kover 0.7.6 merged report setup
import com.android.build.gradle.api.AndroidBasePlugin
subprojects {
apply plugin: "org.jetbrains.kotlinx.kover"
plugins.withType(AndroidBasePlugin) {
configurations.implementation {
dependencies.withType(ProjectDependency) {
project.dependencies.kover dependencyProject
}
@0neel
0neel / tools.sh
Last active April 18, 2023 20:47
Various Android terminal tools
# preview
# Starts the emulator with a manually set dns address
emulator -avd Nexus_5_API_16 -dns-server 8.8.8.8
# Makes gradlew executable (required by Jenkins and other unix systems)
git update-index --chmod=+x ./gradlew
# Remount linux file system
mount -o rw,remount,rw /system # make read-write
public abstract class KeyEventHandlingFragment extends Fragment
implements KeyEventPassingActivity.KeyEventListener {
@SuppressWarnings("deprecation")
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
if (activity instanceof KeyEventPassingActivity) {
((KeyEventPassingActivity) activity).addKeyEventHandler(this);
}
@0neel
0neel / SettingsUtils.java
Created April 7, 2017 12:09
Some convenient utils to work with shared preferences
public class SettingsUtils {
private SettingsUtils() {}
public static abstract class OnSharedPreferenceChangeListener
implements SharedPreferences.OnSharedPreferenceChangeListener {
private static final String TAG = "SharedPreferences";
@NonNull
private Context context;
@0neel
0neel / TimePreference.java
Last active April 6, 2017 11:03
The preference showing a dialog with a time picker. Supports disabled state.
/**
* Based on http://stackoverflow.com/a/10608622/2489474
* <p>Created by Maksim Kovalev on 05.04.2017.
*/
public class TimePreference extends DialogPreference {
public static final long TIME_NOT_SET = -1;
private TimePicker picker = null;
@0neel
0neel / .gitignore
Created February 21, 2017 12:44
The full Android gitignore. Possibly contains some overhead or lines duplicates
### Android ###
# Built application files
*.apk
*.ap_
# Files for the Dalvik VM
*.dex
# Java class files
*.class