add Launcher for FireTV

This commit is contained in:
Felix 2017-04-18 08:38:00 +02:00
parent 15ae664c1f
commit 022a5b860b
2 changed files with 42 additions and 0 deletions

View file

@ -30,6 +30,17 @@
<category android:name="android.intent.category.LEANBACK_LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".activities.FiretvStartActivity"
android:banner="@drawable/chaosflix_logo"
android:icon="@drawable/chaosflix_logo"
android:label="@string/app_name"
android:logo="@drawable/chaosflix_logo"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".activities.EventsActivity"
android:exported="true"
android:theme="@style/Theme.Leanback"/>

View file

@ -0,0 +1,31 @@
package de.nicidienase.chaosflix.activities;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;
import android.widget.Toast;
/**
* Created by felix on 18.04.17.
*/
public class FiretvStartActivity extends Activity {
private static final String TAG = FiretvStartActivity.class.getSimpleName();
public static final String NO_FIRE_TV = "This is not a Fire TV device.";
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final String AMAZON_FEATURE_FIRE_TV = "amazon.hardware.fire_tv";
if (getPackageManager().hasSystemFeature(AMAZON_FEATURE_FIRE_TV)) {
Log.v(TAG, "Yes, this is a Fire TV device.");
Intent i = new Intent(this,ConferencesActivity.class);
startActivity(i);
} else {
Toast.makeText(this, NO_FIRE_TV,Toast.LENGTH_SHORT).show();
Log.v(TAG, NO_FIRE_TV);
}
}
}