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
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 LivePreference<T> constructor(private val updates: Observable<String>, | |
private val preferences: SharedPreferences, | |
private val key: String, | |
private val defaultValue: T) : MutableLiveData<T>() { | |
private var disposable: Disposable? = null | |
override fun onActive() { | |
super.onActive() | |
value = (preferences.all[key] as T) ?: defaultValue |
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 |
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
find . -name "*.zip" -exec unzip {} \; |
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
/* | |
* Copyright (C) 2017 The Android Open Source Project | |
* | |
* 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 | |
* | |
* Unless required by applicable law or agreed to in writing, software |