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
class MultiPreference<T> constructor(private val updates: Observable<String>, | |
private val preferences: SharedPreferences, | |
private val keys: List<String>, | |
private val defaultValue: T) : MutableLiveData<Map<String, T>>() { | |
private var disposable: Disposable? = null | |
private val values = mutableMapOf<String, T>() | |
init { | |
for (key in keys) |
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
== Adb Server | |
adb kill-server | |
adb start-server | |
== Adb Reboot | |
adb reboot | |
adb reboot recovery | |
adb reboot-bootloader | |
== Shell |
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
liveSharedPreferences.listenMultiple(listOf("bool1", "bool2", "bool3"), false).observe(this, Observer<Pair<String, Boolean>> { value -> | |
Log.d(TAG, "key: ${value!!.first} value: ${value.second}") | |
}) |
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
class MainActivity : AppCompatActivity() { | |
private const val TAG = "MainActivity" | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
val preferences = PreferenceManager.getDefaultSharedPreferences(this) | |
val liveSharedPreferences = LiveSharedPreferences(preferences) |
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
class MainActivity : AppCompatActivity() { | |
private val preferences = PreferenceManager.getDefaultSharedPreferences(this) | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
} | |
var listener: SharedPreferences.OnSharedPreferenceChangeListener = |
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
#include <stdio.h> | |
int sudo[9][9]; | |
int isExistsInRow(int row, int s) { | |
int i; | |
for(i=0; i<9; i++) | |
if(sudo[row][i] == s) | |
return 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
class SeekBarPreference(context: Context, attrs: AttributeSet) : | |
Preference(context, attrs, 0) { | |
private var max = 0 | |
private var current = 0 | |
init { | |
widgetLayoutResource = R.layout.preference_seekbar | |
layoutResource = R.layout.preference_seekbar |