Skip to content

Instantly share code, notes, and snippets.

@tseglevskiy
tseglevskiy / hello.kt
Last active Aug 16, 2018
Hello, Gist!
View hello.kt
class HelloWorld
@tseglevskiy
tseglevskiy / ExecTerminal.java
Created Oct 29, 2016
How to use 'su' command in Android
View ExecTerminal.java
/*******************************************************************************
* Origin: https://github.com/alt236/Wifi-Key-Recovery---Android/blob/master/src/aws/apps/wifiKeyRecovery/util/ExecTerminal.java
*
* Copyright 2011 Alexandros Schillings
*
* 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
View AndroidManifest.xml
<application
android:allowBackup="true"
android:fullBackupContent="@xml/mybackupscheme"
.......
android:backupAgent=".MyBackupAgent"
>
.......
</application>
View 1.xml
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:host="jollydroid.ru" android:scheme="http"/>
@tseglevskiy
tseglevskiy / 1.java
Last active Nov 12, 2015
Text Selection Demo
View 1.java
// floating menu on long click
callback = new AcCallback();
textView1.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
if (actionMode != null) {
return false;
}
@tseglevskiy
tseglevskiy / 1.java
Last active Nov 10, 2015
App Permissions
View 1.java
private void requestPermissionAndExecute(
final String permission,
final int requestCode,
final Runnable granted,
final Runnable denied
)
{
grantedActions.put(requestCode, granted);
deniedActions.put(requestCode, denied);
View 1.java
if (
connectivityManager.getActiveNetworkInfo() != null &&
connectivityManager.getActiveNetworkInfo().isConnected() &&
(!powerManager.isDeviceIdleMode() ||
powerManager.isIgnoringBatteryOptimizations()))
{
// do something
}