This file contains hidden or 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
activity_main.xml: | |
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:gravity="center" | |
android:orientation="vertical"> | |
<Button |
This file contains hidden or 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
1. connect the headset to the phone via USB (tp-c) | |
2. check if ap connected to hs | |
3. check current app set (0 or 1) | |
4. send Img Persist file to start firmware. | |
Wait when the IMG file is finalized. | |
Then update the next 3 files in the same way. | |
audioMgr.sendCommand( | |
UPDATE_IMAGE_COMMAND, | |
address, |
This file contains hidden or 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
am = (AudioManager) getSystemService(Context.AUDIO_SERVICE); | |
brr(new BroadcastReceiver() { | |
@Override | |
public void onReceive(Context context, Intent intent) { | |
int state = intent.getIntExtra(AudioManager.EXTRA_SCO_AUDIO_STATE, -1); | |
Log.d(TAG, "Audio SCO state: " + state); | |
if (AudioManager.SCO_AUDIO_STATE_CONNECTED == state) { |
This file contains hidden or 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
https://stackoverflow.com/a/53243938/6352712 | |
@IntRange(from = 0, to = 3) | |
fun getConnectionType(context: Context): Int { | |
var result = 0 // Returns connection type. 0: none; 1: mobile data; 2: wifi | |
val cm = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager? | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { | |
cm?.run { | |
cm.getNetworkCapabilities(cm.activeNetwork)?.run { |
This file contains hidden or 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
https://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/design.html | |
jdouble Java_pkg_Cls_f__ILjava_lang_String_2 ( | |
JNIEnv *env, /* interface pointer */ | |
jobject obj, /* "this" pointer */ | |
jint i, /* argument #1 */ | |
jstring s) /* argument #2 */ | |
{ | |
/* Obtain a C-copy of the Java string */ | |
const char *str = (*env)->GetStringUTFChars(env, s, 0); |
This file contains hidden or 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
https://github.com/googlemaps/android-samples/tree/master/ApiDemos | |
При использовании API в полностью интерактивном режиме пользователи | |
класса MapView должны передавать все методы жизненного цикла объекта activity соответствующим методам в классе MapView: | |
onCreate(), onStart(), onResume(), onPause(), onStop(), onDestroy(), onSaveInstanceState() и onLowMemory(). | |
This file contains hidden or 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
/** | |
* Helper class for creating pools of objects. An example use looks like this: | |
* <pre> | |
* public class MyPooledClass { | |
* | |
* private static final SynchronizedPool<MyPooledClass> sPool = | |
* new SynchronizedPool<MyPooledClass>(10); | |
* | |
* public static MyPooledClass obtain() { | |
* MyPooledClass instance = sPool.acquire(); |
This file contains hidden or 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
Activity, Fragment & Service as KoinComponents | |
Activity, Fragment & Service are extended with the KoinComponents extension. You gain access to: | |
by inject() - lazy evaluated instance from Koin container | |
get() - eager fetch instance from Koin container | |
release() - release module’s instances from its path | |
getProperty()/setProperty() - get/set property | |
This file contains hidden or 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
Use large, simple controls | |
https://developer.android.com/guide/topics/ui/accessibility/apps#large-controls | |
Your app's UI is easier to use if it contains controls that are easier to see and tap. | |
We recommend that each interactive UI element have a focusable area, | |
or touch target size, of at least 48dp ✕ 48dp. Larger is even better. | |
Describe each UI element |
This file contains hidden or 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 AudiTrackOutput(private val audioBuffer: AudioDataBuffer) : Thread() { | |
private lateinit var handler: Handler | |
fun play(from: Int) { | |
handler.removeCallbacksAndMessages(null) | |
val msg = handler.obtainMessage() | |
val bundle = Bundle() | |
bundle.putInt("FROM", from) | |
msg.data = bundle |
NewerOlder