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 MyMediaSessionCallback: MediaSessionCompat.Callback { | |
override fun onPause() { ... } | |
override fun onPlay() { ... } | |
override fun onStop() { ... } | |
override fun onSeekTo(position: Long) { ... } | |
override fun onSkipToNext() { ... } | |
override fun onSkipToPrevious() { ... }} | |
mediaSession.setCallback(myMediaSessionCallback) |
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
mediaSession = new MediaSessionCompat(this, "sample"); | |
mediaSessionConnector = new MediaSessionConnector(mediaSession); | |
mediaSessionConnector.setPlayer(player); |
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
<activity ... > | |
<intent-filter> | |
<action android:name="android.intent.action.MAIN" /> | |
<category android:name="android.intent.category.LEANBACK_LAUNCHER" /> | |
</intent-filter> | |
</activity> | |
</manifest> |
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
<application | |
... | |
android:banner="@drawable/my_banner"> |
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
<uses-feature | |
android:name="android.software.leanback" | |
android:required="true" /> |
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
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | |
<uses-feature | |
android:name="android.hardware.touchscreen" | |
android:required="false" /> |
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
package com.pixplicity.retrofit; | |
import com.squareup.okhttp.MediaType; | |
import com.squareup.okhttp.RequestBody; | |
import java.io.IOException; | |
import java.lang.annotation.Annotation; | |
import java.lang.reflect.Type; | |
import retrofit.Converter; |
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
// Define the @IndexPrefixedByTableName annotation: | |
@Retention(value = RetentionPolicy.RUNTIME) | |
@Target(value = ElementType.FIELD) | |
public @interface IndexPrefixedByTableName {} | |
// In your model, for instance in a superclass of multiple models: |
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
#!/bin/bash | |
##### | |
# Note about extracting databases using cat: | |
# On some devices (e.g. Moto X 2014) the database file contains some misplaced 0x0D characters. At first look these | |
# occur preceding a "CREATE TABLE" instruction. | |
##### | |
function notice { | |
echo -e "\033[1m$1\033[0m" |
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
public class MultiViewPager extends ViewPager { | |
/** | |
* Maximum size. | |
*/ | |
private int mMaxWidth = -1; | |
/** | |
* Maximum size. | |
*/ | |
private int mMaxHeight = -1; |