Polished Grid example and added a few missing details at
Launcher fragment. Video- and Music examples now also use an Activity. BackgroundHandler in MainFragment removed. Removed unused Log-Tag field and added correct background. Changed Grid Zoom factor. Moved Grid- and Card example to their own packages and they now are started using an Activity. Launcher fragment uses correct primaryColor and its row has been lowered. Music and Video consumption example are using Activities as well. Thus BackgroundManager in MainFragment is unnecessair, which is why it got removed. Change-Id: I928614314677706f19e648666697f0a710d88e0a
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
android:icon="@mipmap/app_banner_sample_app"
|
android:icon="@mipmap/app_banner_sample_app"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:largeHeap="true"
|
android:largeHeap="true"
|
||||||
android:theme="@style/Theme.Example.Leanback">
|
android:theme="@style/Theme.Example.LeanbackLauncher">
|
||||||
<activity
|
<activity
|
||||||
android:name=".app.MainActivity"
|
android:name=".app.MainActivity"
|
||||||
android:icon="@mipmap/app_banner_sample_app"
|
android:icon="@mipmap/app_banner_sample_app"
|
||||||
@@ -42,6 +42,18 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".app.details.DetailViewExampleActivity"
|
android:name=".app.details.DetailViewExampleActivity"
|
||||||
android:theme="@style/Theme.Example.LeanbackDetailView"></activity>
|
android:theme="@style/Theme.Example.LeanbackDetailView"></activity>
|
||||||
|
<activity
|
||||||
|
android:name=".app.cards.CardExampleActivity"
|
||||||
|
android:theme="@style/Theme.Example.Leanback"></activity>
|
||||||
|
<activity
|
||||||
|
android:name=".app.grid.GridExampleActivity"
|
||||||
|
android:theme="@style/Theme.Example.Leanback"></activity>
|
||||||
|
<activity
|
||||||
|
android:name=".app.media.VideoExampleActivity"
|
||||||
|
android:theme="@style/Theme.Example.Leanback"></activity>
|
||||||
|
<activity
|
||||||
|
android:name=".app.media.MusicExampleActivity"
|
||||||
|
android:theme="@style/Theme.Example.Leanback"></activity>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|||||||
@@ -14,29 +14,23 @@
|
|||||||
|
|
||||||
package android.support.v17.leanback.supportleanbackshowcase.app;
|
package android.support.v17.leanback.supportleanbackshowcase.app;
|
||||||
|
|
||||||
import android.app.Fragment;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
|
||||||
import android.support.v17.leanback.app.BackgroundManager;
|
|
||||||
import android.support.v17.leanback.app.BrowseFragment;
|
import android.support.v17.leanback.app.BrowseFragment;
|
||||||
|
import android.support.v17.leanback.supportleanbackshowcase.R;
|
||||||
|
import android.support.v17.leanback.supportleanbackshowcase.app.cards.CardExampleActivity;
|
||||||
import android.support.v17.leanback.supportleanbackshowcase.app.details.DetailViewExampleActivity;
|
import android.support.v17.leanback.supportleanbackshowcase.app.details.DetailViewExampleActivity;
|
||||||
import android.support.v17.leanback.supportleanbackshowcase.app.dialog.DialogExampleActivity;
|
import android.support.v17.leanback.supportleanbackshowcase.app.dialog.DialogExampleActivity;
|
||||||
import android.support.v17.leanback.supportleanbackshowcase.app.media.MusicConsumptionExampleFragment;
|
import android.support.v17.leanback.supportleanbackshowcase.app.grid.GridExampleActivity;
|
||||||
import android.support.v17.leanback.supportleanbackshowcase.app.media.VideoConsumptionExampleFragment;
|
import android.support.v17.leanback.supportleanbackshowcase.app.media.MusicExampleActivity;
|
||||||
import android.support.v17.leanback.supportleanbackshowcase.app.media.VideoSurfaceFragment;
|
import android.support.v17.leanback.supportleanbackshowcase.app.media.VideoExampleActivity;
|
||||||
import android.support.v17.leanback.supportleanbackshowcase.app.settings.SettingsExampleActivity;
|
import android.support.v17.leanback.supportleanbackshowcase.app.settings.SettingsExampleActivity;
|
||||||
import android.support.v17.leanback.supportleanbackshowcase.app.wizard.WizardExampleActivity;
|
import android.support.v17.leanback.supportleanbackshowcase.app.wizard.WizardExampleActivity;
|
||||||
import android.support.v17.leanback.supportleanbackshowcase.utils.Constants;
|
import android.support.v17.leanback.supportleanbackshowcase.cards.presenters.CardPresenterSelector;
|
||||||
import android.support.v17.leanback.supportleanbackshowcase.models.Movie;
|
|
||||||
import android.support.v17.leanback.supportleanbackshowcase.utils.PicassoBackgroundManagerTarget;
|
|
||||||
import android.support.v17.leanback.supportleanbackshowcase.R;
|
|
||||||
import android.support.v17.leanback.supportleanbackshowcase.utils.Utils;
|
|
||||||
import android.support.v17.leanback.supportleanbackshowcase.models.Card;
|
import android.support.v17.leanback.supportleanbackshowcase.models.Card;
|
||||||
import android.support.v17.leanback.supportleanbackshowcase.models.CardRow;
|
import android.support.v17.leanback.supportleanbackshowcase.models.CardRow;
|
||||||
import android.support.v17.leanback.supportleanbackshowcase.cards.presenters.CardPresenterSelector;
|
import android.support.v17.leanback.supportleanbackshowcase.models.Movie;
|
||||||
|
import android.support.v17.leanback.supportleanbackshowcase.utils.Utils;
|
||||||
import android.support.v17.leanback.widget.ArrayObjectAdapter;
|
import android.support.v17.leanback.widget.ArrayObjectAdapter;
|
||||||
import android.support.v17.leanback.widget.ListRow;
|
import android.support.v17.leanback.widget.ListRow;
|
||||||
import android.support.v17.leanback.widget.ListRowPresenter;
|
import android.support.v17.leanback.widget.ListRowPresenter;
|
||||||
@@ -46,50 +40,23 @@ import android.support.v17.leanback.widget.Presenter;
|
|||||||
import android.support.v17.leanback.widget.PresenterSelector;
|
import android.support.v17.leanback.widget.PresenterSelector;
|
||||||
import android.support.v17.leanback.widget.Row;
|
import android.support.v17.leanback.widget.Row;
|
||||||
import android.support.v17.leanback.widget.RowPresenter;
|
import android.support.v17.leanback.widget.RowPresenter;
|
||||||
import android.util.DisplayMetrics;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.squareup.picasso.Picasso;
|
|
||||||
import com.squareup.picasso.Target;
|
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
import java.util.Timer;
|
|
||||||
import java.util.TimerTask;
|
|
||||||
|
|
||||||
|
|
||||||
public class MainFragment extends BrowseFragment {
|
public class MainFragment extends BrowseFragment {
|
||||||
|
|
||||||
public static final String VIDEO_SURFACE_FRAGMENT_TAG = "VIDEO_SURFACE";
|
|
||||||
private static final String TAG = "MainFragment";
|
|
||||||
private static final int BACKGROUND_UPDATE_DELAY = 300;
|
|
||||||
private static final int DEFAULT_BACKGROUND_IMAGE = R.drawable.default_background;
|
|
||||||
private final Handler mHandler = new Handler();
|
|
||||||
private ArrayObjectAdapter mRowsAdapter;
|
private ArrayObjectAdapter mRowsAdapter;
|
||||||
private Target mBackgroundTarget;
|
|
||||||
private Timer mBackgroundTimer;
|
|
||||||
private URI mBackgroundURI;
|
|
||||||
private BackgroundManager mBackgroundManager;
|
|
||||||
private DisplayMetrics mMetrics;
|
|
||||||
|
|
||||||
@Override public void onActivityCreated(Bundle savedInstanceState) {
|
@Override
|
||||||
if (Constants.LOCAL_LOGD) Log.d(TAG, "onActivityCreated");
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
|
||||||
setupBackgroundManager();
|
|
||||||
setupUIElements();
|
setupUIElements();
|
||||||
setupRowAdapter();
|
setupRowAdapter();
|
||||||
setupEventListeners();
|
setupEventListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
if (null != mBackgroundTimer) {
|
|
||||||
if (Constants.LOCAL_LOGD) Log.d(TAG, "onDestroy: " + mBackgroundTimer.toString());
|
|
||||||
mBackgroundTimer.cancel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setupRowAdapter() {
|
private void setupRowAdapter() {
|
||||||
mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
|
mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
|
||||||
createRows();
|
createRows();
|
||||||
@@ -114,18 +81,6 @@ public class MainFragment extends BrowseFragment {
|
|||||||
return new ListRow(listRowAdapter);
|
return new ListRow(listRowAdapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupBackgroundManager() {
|
|
||||||
mBackgroundManager = BackgroundManager.getInstance(getActivity());
|
|
||||||
mBackgroundManager.setThemeDrawableResourceId(DEFAULT_BACKGROUND_IMAGE);
|
|
||||||
mBackgroundManager.attach(getActivity().getWindow());
|
|
||||||
|
|
||||||
mBackgroundTarget = new PicassoBackgroundManagerTarget(mBackgroundManager);
|
|
||||||
mMetrics = new DisplayMetrics();
|
|
||||||
getActivity().getWindowManager().getDefaultDisplay().getMetrics(mMetrics);
|
|
||||||
getView().setBackgroundResource(R.drawable.bg_living_room_wide);
|
|
||||||
//updateBackgroundImage(R.drawable.bg_living_room_wide);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setupUIElements() {
|
private void setupUIElements() {
|
||||||
setTitle(getString(R.string.browse_title));
|
setTitle(getString(R.string.browse_title));
|
||||||
setBadgeDrawable(getResources().getDrawable(R.drawable.title_android_tv, null));
|
setBadgeDrawable(getResources().getDrawable(R.drawable.title_android_tv, null));
|
||||||
@@ -139,53 +94,24 @@ public class MainFragment extends BrowseFragment {
|
|||||||
setOnItemViewSelectedListener(new ItemViewSelectedListener());
|
setOnItemViewSelectedListener(new ItemViewSelectedListener());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateBackgroundImage(URI uri) {
|
|
||||||
// Deactivated until we decide whether to load a background image from an URL or resource. @hahnr
|
|
||||||
if (true) return;
|
|
||||||
Picasso.with(getActivity()).load(uri.toString())
|
|
||||||
.resize(mMetrics.widthPixels, mMetrics.heightPixels).centerCrop()
|
|
||||||
.error(DEFAULT_BACKGROUND_IMAGE).into(mBackgroundTarget);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void updateBackgroundImage(Drawable drawable) {
|
|
||||||
mBackgroundManager.setDrawable(drawable);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void updateBackgroundImage(int resId) {
|
|
||||||
mBackgroundManager.setDrawable(getResources().getDrawable(resId, null));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void startBackgroundTimer() {
|
|
||||||
if (null != mBackgroundTimer) {
|
|
||||||
mBackgroundTimer.cancel();
|
|
||||||
}
|
|
||||||
mBackgroundTimer = new Timer();
|
|
||||||
mBackgroundTimer.schedule(new UpdateBackgroundTask(), BACKGROUND_UPDATE_DELAY);
|
|
||||||
}
|
|
||||||
|
|
||||||
private final class ItemViewClickedListener implements OnItemViewClickedListener {
|
private final class ItemViewClickedListener implements OnItemViewClickedListener {
|
||||||
|
|
||||||
@Override public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
|
@Override
|
||||||
RowPresenter.ViewHolder rowViewHolder, Row row) {
|
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
|
||||||
|
RowPresenter.ViewHolder rowViewHolder, Row row) {
|
||||||
Card card = (Card) item;
|
Card card = (Card) item;
|
||||||
int id = card.getId();
|
int id = card.getId();
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case 0: {
|
case 0: {
|
||||||
updateBackgroundImage(new ColorDrawable(
|
Intent intent = new Intent(getActivity().getBaseContext(),
|
||||||
getResources().getColor(R.color.card_examples_background)));
|
CardExampleActivity.class);
|
||||||
Fragment fragment = new CardExampleFragment();
|
startActivity(intent);
|
||||||
getFragmentManager().beginTransaction()
|
|
||||||
.replace(R.id.fragmentContainer, fragment)
|
|
||||||
.addToBackStack(null).commit();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2: {
|
case 2: {
|
||||||
updateBackgroundImage(
|
Intent intent = new Intent(getActivity().getBaseContext(),
|
||||||
getResources().getDrawable(R.drawable.background_canyon, null));
|
GridExampleActivity.class);
|
||||||
Fragment fragment = new GridExample();
|
startActivity(intent);
|
||||||
getFragmentManager().beginTransaction()
|
|
||||||
.replace(R.id.fragmentContainer, fragment)
|
|
||||||
.addToBackStack(null).commit();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 3: {
|
case 3: {
|
||||||
@@ -195,23 +121,15 @@ public class MainFragment extends BrowseFragment {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4: {
|
case 4: {
|
||||||
updateBackgroundImage(
|
Intent intent = new Intent(getActivity().getBaseContext(),
|
||||||
getResources().getDrawable(R.drawable.background_canyon, null));
|
VideoExampleActivity.class);
|
||||||
Fragment fragment = new VideoConsumptionExampleFragment();
|
startActivity(intent);
|
||||||
getFragmentManager().beginTransaction()
|
|
||||||
.replace(R.id.fragmentContainer, new VideoSurfaceFragment(),
|
|
||||||
VIDEO_SURFACE_FRAGMENT_TAG)
|
|
||||||
.add(R.id.fragmentContainer, fragment).addToBackStack(null)
|
|
||||||
.commit();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 5: {
|
case 5: {
|
||||||
updateBackgroundImage(
|
Intent intent = new Intent(getActivity().getBaseContext(),
|
||||||
getResources().getDrawable(R.drawable.background_sax, null));
|
MusicExampleActivity.class);
|
||||||
Fragment fragment = new MusicConsumptionExampleFragment();
|
startActivity(intent);
|
||||||
getFragmentManager().beginTransaction()
|
|
||||||
.replace(R.id.fragmentContainer, fragment)
|
|
||||||
.addToBackStack(null).commit();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 6: {
|
case 6: {
|
||||||
@@ -254,21 +172,9 @@ public class MainFragment extends BrowseFragment {
|
|||||||
|
|
||||||
private final class ItemViewSelectedListener implements OnItemViewSelectedListener {
|
private final class ItemViewSelectedListener implements OnItemViewSelectedListener {
|
||||||
|
|
||||||
@Override public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item,
|
@Override
|
||||||
RowPresenter.ViewHolder rowViewHolder, Row row) {
|
public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item,
|
||||||
}
|
RowPresenter.ViewHolder rowViewHolder, Row row) {
|
||||||
}
|
|
||||||
|
|
||||||
private class UpdateBackgroundTask extends TimerTask {
|
|
||||||
|
|
||||||
@Override public void run() {
|
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
@Override public void run() {
|
|
||||||
if (mBackgroundURI != null) {
|
|
||||||
updateBackgroundImage(mBackgroundURI);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014 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 distributed under the License
|
||||||
|
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||||
|
* or implied. See the License for the specific language governing permissions and limitations under
|
||||||
|
* the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package android.support.v17.leanback.supportleanbackshowcase.app.cards;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.drawable.ColorDrawable;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v17.leanback.app.GuidedStepFragment;
|
||||||
|
import android.support.v17.leanback.supportleanbackshowcase.R;
|
||||||
|
import android.support.v17.leanback.supportleanbackshowcase.app.dialog.DialogExampleFragment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: Javadoc
|
||||||
|
*/
|
||||||
|
public class CardExampleActivity extends Activity {
|
||||||
|
|
||||||
|
@Override public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_cards_example);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
* the License.
|
* the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package android.support.v17.leanback.supportleanbackshowcase.app;
|
package android.support.v17.leanback.supportleanbackshowcase.app.cards;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v17.leanback.app.BrowseFragment;
|
import android.support.v17.leanback.app.BrowseFragment;
|
||||||
@@ -39,8 +39,6 @@ import com.google.gson.Gson;
|
|||||||
*/
|
*/
|
||||||
public class CardExampleFragment extends BrowseFragment {
|
public class CardExampleFragment extends BrowseFragment {
|
||||||
|
|
||||||
private static final String TAG = "CardExampleFragment";
|
|
||||||
|
|
||||||
private ArrayObjectAdapter mRowsAdapter;
|
private ArrayObjectAdapter mRowsAdapter;
|
||||||
|
|
||||||
@Override public void onActivityCreated(Bundle savedInstanceState) {
|
@Override public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
@@ -148,7 +148,7 @@ public class DetailViewExampleFragment extends DetailsFragment implements OnItem
|
|||||||
null);
|
null);
|
||||||
getView().setBackgroundColor(backgroundColor);
|
getView().setBackgroundColor(backgroundColor);
|
||||||
} else {
|
} else {
|
||||||
getView().setBackgroundResource(R.drawable.background_canyon);
|
getView().setBackground(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* the License.
|
* the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package android.support.v17.leanback.supportleanbackshowcase.app;
|
package android.support.v17.leanback.supportleanbackshowcase.app.grid;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v17.leanback.app.VerticalGridFragment;
|
import android.support.v17.leanback.app.VerticalGridFragment;
|
||||||
@@ -32,9 +32,8 @@ import com.google.gson.Gson;
|
|||||||
*/
|
*/
|
||||||
public class GridExample extends VerticalGridFragment {
|
public class GridExample extends VerticalGridFragment {
|
||||||
|
|
||||||
private static final String TAG = "GridExample";
|
|
||||||
private static final int COLUMNS = 4;
|
private static final int COLUMNS = 4;
|
||||||
private static final int ZOOM_FACTOR = FocusHighlight.ZOOM_FACTOR_NONE;
|
private static final int ZOOM_FACTOR = FocusHighlight.ZOOM_FACTOR_MEDIUM;
|
||||||
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014 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 distributed under the License
|
||||||
|
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||||
|
* or implied. See the License for the specific language governing permissions and limitations under
|
||||||
|
* the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package android.support.v17.leanback.supportleanbackshowcase.app.grid;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v17.leanback.supportleanbackshowcase.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: Javadoc
|
||||||
|
*/
|
||||||
|
public class GridExampleActivity extends Activity {
|
||||||
|
|
||||||
|
@Override public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_grid_example);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014 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 distributed under the License
|
||||||
|
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||||
|
* or implied. See the License for the specific language governing permissions and limitations under
|
||||||
|
* the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package android.support.v17.leanback.supportleanbackshowcase.app.media;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v17.leanback.supportleanbackshowcase.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: Javadoc
|
||||||
|
*/
|
||||||
|
public class MusicExampleActivity extends Activity {
|
||||||
|
|
||||||
|
@Override public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_music_example);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -37,12 +37,14 @@ public class VideoConsumptionExampleFragment extends PlaybackOverlayFragment imp
|
|||||||
private ArrayObjectAdapter mRowsAdapter;
|
private ArrayObjectAdapter mRowsAdapter;
|
||||||
private MediaPlayerGlue mGlue;
|
private MediaPlayerGlue mGlue;
|
||||||
|
|
||||||
@Override public void onCreate(Bundle savedInstanceState) {
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
mGlue = new VideoMediaPlayerGlue(getActivity(), this) {
|
mGlue = new VideoMediaPlayerGlue(getActivity(), this) {
|
||||||
|
|
||||||
@Override protected void onRowChanged(PlaybackControlsRow row) {
|
@Override
|
||||||
|
protected void onRowChanged(PlaybackControlsRow row) {
|
||||||
if (mRowsAdapter == null) return;
|
if (mRowsAdapter == null) return;
|
||||||
mRowsAdapter.notifyArrayItemRangeChanged(0, 1);
|
mRowsAdapter.notifyArrayItemRangeChanged(0, 1);
|
||||||
}
|
}
|
||||||
@@ -55,10 +57,11 @@ public class VideoConsumptionExampleFragment extends PlaybackOverlayFragment imp
|
|||||||
mGlue.setMediaSource(URL);
|
mGlue.setMediaSource(URL);
|
||||||
|
|
||||||
Fragment videoSurfaceFragment = getFragmentManager()
|
Fragment videoSurfaceFragment = getFragmentManager()
|
||||||
.findFragmentByTag(MainFragment.VIDEO_SURFACE_FRAGMENT_TAG);
|
.findFragmentByTag(VideoExampleActivity.VIDEO_SURFACE_FRAGMENT_TAG);
|
||||||
SurfaceView surface = (SurfaceView) videoSurfaceFragment.getView();
|
SurfaceView surface = (SurfaceView) videoSurfaceFragment.getView();
|
||||||
surface.getHolder().addCallback(new SurfaceHolder.Callback() {
|
surface.getHolder().addCallback(new SurfaceHolder.Callback() {
|
||||||
@Override public void surfaceCreated(SurfaceHolder holder) {
|
@Override
|
||||||
|
public void surfaceCreated(SurfaceHolder holder) {
|
||||||
mGlue.setDisplay(holder);
|
mGlue.setDisplay(holder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,7 +70,8 @@ public class VideoConsumptionExampleFragment extends PlaybackOverlayFragment imp
|
|||||||
// Nothing to do
|
// Nothing to do
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void surfaceDestroyed(SurfaceHolder holder) {
|
@Override
|
||||||
|
public void surfaceDestroyed(SurfaceHolder holder) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -75,12 +79,14 @@ public class VideoConsumptionExampleFragment extends PlaybackOverlayFragment imp
|
|||||||
addPlaybackControlsRow();
|
addPlaybackControlsRow();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void onStart() {
|
@Override
|
||||||
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
mGlue.enableProgressUpdating(mGlue.hasValidMedia() && mGlue.isMediaPlaying());
|
mGlue.enableProgressUpdating(mGlue.hasValidMedia() && mGlue.isMediaPlaying());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void onStop() {
|
@Override
|
||||||
|
public void onStop() {
|
||||||
super.onStop();
|
super.onStop();
|
||||||
mGlue.enableProgressUpdating(false);
|
mGlue.enableProgressUpdating(false);
|
||||||
mGlue.reset();
|
mGlue.reset();
|
||||||
@@ -95,14 +101,16 @@ public class VideoConsumptionExampleFragment extends PlaybackOverlayFragment imp
|
|||||||
setOnItemViewClickedListener(this);
|
setOnItemViewClickedListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
|
@Override
|
||||||
RowPresenter.ViewHolder rowViewHolder, Row row) {
|
public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item,
|
||||||
|
RowPresenter.ViewHolder rowViewHolder, Row row) {
|
||||||
if (!(item instanceof Action)) return;
|
if (!(item instanceof Action)) return;
|
||||||
mGlue.onActionClicked((Action) item);
|
mGlue.onActionClicked((Action) item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override public void onMediaFileFinishedPlaying(MediaPlayerGlue.MetaData metaData) {
|
@Override
|
||||||
|
public void onMediaFileFinishedPlaying(MediaPlayerGlue.MetaData metaData) {
|
||||||
mGlue.startPlayback();
|
mGlue.startPlayback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014 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 distributed under the License
|
||||||
|
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||||
|
* or implied. See the License for the specific language governing permissions and limitations under
|
||||||
|
* the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package android.support.v17.leanback.supportleanbackshowcase.app.media;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v17.leanback.supportleanbackshowcase.R;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: Javadoc
|
||||||
|
*/
|
||||||
|
public class VideoExampleActivity extends Activity {
|
||||||
|
|
||||||
|
public static final String VIDEO_SURFACE_FRAGMENT_TAG = "VIDEO_SURFACE";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_video_example);
|
||||||
|
|
||||||
|
|
||||||
|
getFragmentManager().beginTransaction()
|
||||||
|
.replace(R.id.videoFragment, new VideoSurfaceFragment(), VIDEO_SURFACE_FRAGMENT_TAG)
|
||||||
|
.add(R.id.videoFragment, new VideoConsumptionExampleFragment())
|
||||||
|
.commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -18,7 +18,6 @@ import android.app.Fragment;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v14.preference.PreferenceFragment;
|
import android.support.v14.preference.PreferenceFragment;
|
||||||
import android.support.v17.leanback.supportleanbackshowcase.utils.Constants;
|
|
||||||
import android.support.v17.leanback.supportleanbackshowcase.R;
|
import android.support.v17.leanback.supportleanbackshowcase.R;
|
||||||
import android.support.v17.preference.LeanbackPreferenceFragment;
|
import android.support.v17.preference.LeanbackPreferenceFragment;
|
||||||
import android.support.v17.preference.LeanbackSettingsFragment;
|
import android.support.v17.preference.LeanbackSettingsFragment;
|
||||||
@@ -26,13 +25,13 @@ import android.support.v7.preference.DialogPreference;
|
|||||||
import android.support.v7.preference.ListPreference;
|
import android.support.v7.preference.ListPreference;
|
||||||
import android.support.v7.preference.Preference;
|
import android.support.v7.preference.Preference;
|
||||||
import android.support.v7.preference.PreferenceScreen;
|
import android.support.v7.preference.PreferenceScreen;
|
||||||
import android.util.Log;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
|
|
||||||
public class SettingsExampleFragment extends LeanbackSettingsFragment implements DialogPreference.TargetFragment {
|
public class SettingsExampleFragment extends LeanbackSettingsFragment implements DialogPreference.TargetFragment {
|
||||||
|
|
||||||
public static final String TAG = "SettingsExampleFragment";
|
|
||||||
private final Stack<Fragment> fragments = new Stack<Fragment>();
|
private final Stack<Fragment> fragments = new Stack<Fragment>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -50,12 +49,6 @@ public class SettingsExampleFragment extends LeanbackSettingsFragment implements
|
|||||||
public boolean onPreferenceStartScreen(PreferenceFragment preferenceFragment,
|
public boolean onPreferenceStartScreen(PreferenceFragment preferenceFragment,
|
||||||
PreferenceScreen preferenceScreen) {
|
PreferenceScreen preferenceScreen) {
|
||||||
PreferenceFragment frag = buildPreferenceFragment(R.xml.prefs, preferenceScreen.getKey());
|
PreferenceFragment frag = buildPreferenceFragment(R.xml.prefs, preferenceScreen.getKey());
|
||||||
if ("prefs_wifi_screen_key".equals(preferenceScreen.getKey())) {
|
|
||||||
ListPreference pref = (ListPreference)preferenceScreen.findPreference("prefs_wifi_key");
|
|
||||||
pref.setEntries(new String[] {"Wi-Fi Network 01"});
|
|
||||||
pref.setEntryValues(new String[] {"01"});
|
|
||||||
if (Constants.LOCAL_LOGD) Log.d(TAG, "pref: " + pref);
|
|
||||||
}
|
|
||||||
startPreferenceFragment(frag);
|
startPreferenceFragment(frag);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -87,6 +80,18 @@ public class SettingsExampleFragment extends LeanbackSettingsFragment implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onPreferenceTreeClick(Preference preference) {
|
||||||
|
final String[] keys = {"prefs_wifi_connect_wps", "prefs_date", "prefs_time",
|
||||||
|
"prefs_date_time_use_timezone", "app_banner_sample_app", "pref_force_stop",
|
||||||
|
"pref_uninstall", "pref_more_info"};
|
||||||
|
if (Arrays.asList(keys).contains(preference.getKey())) {
|
||||||
|
Toast.makeText(getActivity(), "Implement your own action handler.", Toast.LENGTH_SHORT).show();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onPreferenceTreeClick(preference);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(Context context) {
|
public void onAttach(Context context) {
|
||||||
fragments.push(this);
|
fragments.push(this);
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 228 KiB |
@@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (C) 2015 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
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:background="@color/card_examples_background"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/cardsFragment"
|
||||||
|
android:name="android.support.v17.leanback.supportleanbackshowcase.app.cards.CardExampleFragment"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"></fragment>
|
||||||
|
</RelativeLayout>
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
-->
|
-->
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
android:background="@drawable/background_canyon"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/detailsFragment"
|
android:id="@+id/detailsFragment"
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (C) 2015 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
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:background="@drawable/background_food"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/cardsFragment"
|
||||||
|
android:name="android.support.v17.leanback.supportleanbackshowcase.app.grid.GridExample"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"></fragment>
|
||||||
|
</RelativeLayout>
|
||||||
@@ -21,5 +21,6 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:deviceIds="tv"
|
tools:deviceIds="tv"
|
||||||
|
android:background="@drawable/bg_living_room_wide"
|
||||||
tools:ignore="MergeRootFrame">
|
tools:ignore="MergeRootFrame">
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (C) 2015 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
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:background="@drawable/background_sax"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/musicFragment"
|
||||||
|
android:name="android.support.v17.leanback.supportleanbackshowcase.app.media.MusicConsumptionExampleFragment"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"></fragment>
|
||||||
|
</RelativeLayout>
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
Copyright (C) 2015 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
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/videoFragment"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
</RelativeLayout>
|
||||||
@@ -33,4 +33,12 @@
|
|||||||
<item>This description becomes visible only on focus.</item>
|
<item>This description becomes visible only on focus.</item>
|
||||||
<item>This description becomes visible only on focus.</item>
|
<item>This description becomes visible only on focus.</item>
|
||||||
</array>
|
</array>
|
||||||
|
<array name="pref_wifi_networks">
|
||||||
|
<item>Wi-Fi network 1</item>
|
||||||
|
<item>Wi-Fi network 2</item>
|
||||||
|
<item>Wi-Fi network 3</item>
|
||||||
|
<item>Wi-Fi network 4</item>
|
||||||
|
<item>Wi-Fi network 5</item>
|
||||||
|
<item>Wi-Fi network 6</item>
|
||||||
|
</array>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -42,6 +42,10 @@
|
|||||||
<item name="android:visibility">invisible</item>
|
<item name="android:visibility">invisible</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="MovieCardContentStyle" parent="Widget.Leanback.ImageCardView.ContentStyle">
|
||||||
|
<item name="android:gravity">right</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="MovieCardImageStyle" parent="Widget.Leanback.ImageCardView.ImageStyle">
|
<style name="MovieCardImageStyle" parent="Widget.Leanback.ImageCardView.ImageStyle">
|
||||||
<item name="android:layout_width">@dimen/movie_image_card_width</item>
|
<item name="android:layout_width">@dimen/movie_image_card_width</item>
|
||||||
<item name="android:layout_height">@dimen/movie_image_card_height</item>
|
<item name="android:layout_height">@dimen/movie_image_card_height</item>
|
||||||
@@ -55,6 +59,7 @@
|
|||||||
<style name="MovieCardCompleteStyle" parent="MovieCardSimpleStyle">
|
<style name="MovieCardCompleteStyle" parent="MovieCardSimpleStyle">
|
||||||
<item name="lbImageCardViewTitleStyle">@style/MovieCardTitleTwoLineStyle</item>
|
<item name="lbImageCardViewTitleStyle">@style/MovieCardTitleTwoLineStyle</item>
|
||||||
<item name="lbImageCardViewBadgeStyle">@style/MovieCardBadgeStyle</item>
|
<item name="lbImageCardViewBadgeStyle">@style/MovieCardBadgeStyle</item>
|
||||||
|
<item name="lbImageCardViewContentStyle">@style/MovieCardContentStyle</item>
|
||||||
<item name="lbImageCardViewType">Title|Content|IconOnLeft</item>
|
<item name="lbImageCardViewType">Title|Content|IconOnLeft</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|||||||
@@ -23,11 +23,15 @@
|
|||||||
<item name="android:windowAllowReturnTransitionOverlap">true</item>
|
<item name="android:windowAllowReturnTransitionOverlap">true</item>
|
||||||
<item name="android:windowAllowEnterTransitionOverlap">true</item>
|
<item name="android:windowAllowEnterTransitionOverlap">true</item>
|
||||||
<item name="android:windowContentTransitions">true</item>
|
<item name="android:windowContentTransitions">true</item>
|
||||||
<item name="android:colorPrimary">@color/search_color</item>
|
<item name="android:colorPrimary">#00A2B8</item>
|
||||||
<item name="android:colorAccent">@color/accent</item>
|
<item name="android:colorAccent">@color/accent</item>
|
||||||
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14</item>
|
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="Theme.Example.LeanbackLauncher" parent="Theme.Example.Leanback">
|
||||||
|
<item name="browseRowsMarginTop">275dp</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="Theme.Example.LeanbackWizard" parent="Theme.Leanback.GuidedStep">
|
<style name="Theme.Example.LeanbackWizard" parent="Theme.Leanback.GuidedStep">
|
||||||
<item name="guidedActionsContainerStyle">@style/WizardActionsContainerStyle</item>
|
<item name="guidedActionsContainerStyle">@style/WizardActionsContainerStyle</item>
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:summary="This is a dummy activitiy only to show case how to build a settings in an application. Changing configurations in this example doesn't affect anything."
|
android:summary="This is a dummy activitiy only to show case how to build a settings in an application. Changing configurations in this example doesn't affect anything."
|
||||||
android:title="Settings Example">
|
android:title="Settings Example">
|
||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
@@ -11,14 +12,19 @@
|
|||||||
android:title="Available Wi-Fi networks">
|
android:title="Available Wi-Fi networks">
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:defaultValue="-1"
|
android:defaultValue="-1"
|
||||||
android:title="More Wi-Fi networks"
|
android:entries="@array/pref_wifi_networks"
|
||||||
|
android:entryValues="@array/pref_wifi_networks"
|
||||||
|
android:title="Available Wi-Fi networks"
|
||||||
android:key="prefs_wifi_key">
|
android:key="prefs_wifi_key">
|
||||||
</ListPreference>
|
</ListPreference>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
android:key="prefs_wifi_others_key"
|
android:key="prefs_wifi_others_key"
|
||||||
android:title="Other options">
|
android:title="Other options">
|
||||||
<Preference android:title="Connect via WPS"><!-- You can use Intents here --></Preference>
|
<Preference
|
||||||
|
android:title="Connect via WPS"
|
||||||
|
android:key="prefs_wifi_connect_wps"><!-- You can use Intents here -->
|
||||||
|
</Preference>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
@@ -53,18 +59,15 @@
|
|||||||
android:summary="GMT 07:00 Pacific Daylight Time"
|
android:summary="GMT 07:00 Pacific Daylight Time"
|
||||||
android:title="Time zone"></Preference>
|
android:title="Time zone"></Preference>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
<PreferenceScreen
|
<ListPreference
|
||||||
|
android:defaultValue="everyone"
|
||||||
android:icon="@drawable/ic_settings_parental_control"
|
android:icon="@drawable/ic_settings_parental_control"
|
||||||
android:key="prefs_parental_control_screen_key"
|
android:entries="@array/pref_parent_control_entries"
|
||||||
|
android:entryValues="@array/pref_parent_control_entries_values"
|
||||||
|
android:key="prefs_parental_control_level_key"
|
||||||
|
android:dialogMessage="Allow contents rated for"
|
||||||
android:title="Parental Control">
|
android:title="Parental Control">
|
||||||
<ListPreference
|
</ListPreference>
|
||||||
android:defaultValue="everyone"
|
|
||||||
android:entries="@array/pref_parent_control_entries"
|
|
||||||
android:entryValues="@array/pref_parent_control_entries_values"
|
|
||||||
android:key="prefs_parental_control_level_key"
|
|
||||||
android:title="Allow contents rated for">
|
|
||||||
</ListPreference>
|
|
||||||
</PreferenceScreen>
|
|
||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
android:icon="@drawable/ic_settings_apps"
|
android:icon="@drawable/ic_settings_apps"
|
||||||
android:key="prefs_apps_screen_key"
|
android:key="prefs_apps_screen_key"
|
||||||
@@ -77,14 +80,34 @@
|
|||||||
android:summary="Lorem ipsum dolor sit amet consectur adipiscing."
|
android:summary="Lorem ipsum dolor sit amet consectur adipiscing."
|
||||||
android:title="App permissions">
|
android:title="App permissions">
|
||||||
<Preference
|
<Preference
|
||||||
android:icon="@drawable/face_01"
|
android:icon="@mipmap/app_banner_sample_app"
|
||||||
android:summary="45.5 MB"
|
android:summary="45.5 MB"
|
||||||
|
android:selectable="false"
|
||||||
android:title="Application A"></Preference>
|
android:title="Application A"></Preference>
|
||||||
<Preference android:summary="Hier steht ein voelligst sinnfreier Text den ja sowieso niemandhier lesen kann. Deshalb macht es auch keinen Unterschied ob hier sinnvolles und nicht so sinnvolles Zeug steht."></Preference>
|
<Preference
|
||||||
<Preference android:title="Force Stop"><!-- Start an Intent --></Preference>
|
android:selectable="false"
|
||||||
<Preference android:title="Uninstall"><!-- Start an Intent --></Preference>
|
android:summary="Hier steht ein voelligst sinnfreier Text den ja sowieso niemandhier lesen kann. Deshalb macht es auch keinen Unterschied ob hier sinnvolles und nicht so sinnvolles Zeug steht. Hm... Sasha, du kannst das vielleicht lesen und denkst dir jetzt auch, dass ich voll haengen geblieben bin, oder?... ^_^"></Preference>
|
||||||
<Preference android:title="More Information"></Preference>
|
<Preference
|
||||||
|
android:title="Force Stop"
|
||||||
|
android:key="pref_force_stop"><!-- Start an Intent --></Preference>
|
||||||
|
<Preference
|
||||||
|
android:title="Uninstall"
|
||||||
|
android:key="pref_uninstall"><!-- Start an Intent --></Preference>
|
||||||
|
<Preference
|
||||||
|
android:title="More Information"
|
||||||
|
android:key="pref_more_info"></Preference>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
<PreferenceCategory
|
||||||
|
android:key="prefs_app_downloaded_apps_category"
|
||||||
|
android:title="Downloaded Apps">
|
||||||
|
<ListPreference
|
||||||
|
android:defaultValue="everyone"
|
||||||
|
android:entries="@array/pref_parent_control_entries"
|
||||||
|
android:entryValues="@array/pref_parent_control_entries_values"
|
||||||
|
android:key="prefs_parental_control_level_key"
|
||||||
|
android:title="Downloaded Apps">
|
||||||
|
</ListPreference>
|
||||||
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|||||||
Reference in New Issue
Block a user