diff options
author | Sungsoo Lim <sungsoo@google.com> | 2014-06-06 02:28:49 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-06-06 02:28:49 +0000 |
commit | 6a26c3a95b861ae72ecea8efccb3a5becb49368d (patch) | |
tree | be9893a5805d8969dbe3c41bc7d40a0d7f6fdecf | |
parent | 566ceca13abf57ac85ac44993f19fcfa6959c986 (diff) | |
parent | 31749ac8452cd9809dd5130bb7ec11fc3c33b378 (diff) | |
download | TV-6a26c3a95b861ae72ecea8efccb3a5becb49368d.tar.gz |
Merge "Implement channel editor in the side panel" into lmp-preview-dev
-rw-r--r-- | res/layout/edit_channels.xml | 66 | ||||
-rw-r--r-- | res/layout/edit_channels_fragment.xml | 63 | ||||
-rw-r--r-- | res/layout/edit_channels_item.xml | 4 | ||||
-rw-r--r-- | res/values/strings.xml | 6 | ||||
-rw-r--r-- | src/com/android/tv/TvActivity.java | 15 | ||||
-rw-r--r-- | src/com/android/tv/data/ChannelMap.java | 3 | ||||
-rw-r--r-- | src/com/android/tv/dialog/EditChannelsDialogFragment.java | 221 | ||||
-rw-r--r-- | src/com/android/tv/ui/EditChannelsFragment.java | 128 | ||||
-rw-r--r-- | src/com/android/tv/ui/InputPickerFragment.java | 7 | ||||
-rw-r--r-- | src/com/android/tv/ui/MainMenuView.java | 3 | ||||
-rw-r--r-- | src/com/android/tv/ui/OptionsAdapter.java | 2 |
11 files changed, 205 insertions, 313 deletions
diff --git a/res/layout/edit_channels.xml b/res/layout/edit_channels.xml deleted file mode 100644 index 3da51003..00000000 --- a/res/layout/edit_channels.xml +++ /dev/null @@ -1,66 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- 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. ---> - -<!-- Layout for the configure devices activity. --> -<!-- The width and height here should be based on what settings uses in frameworks/base/core/res/res/layout/preference_list_content.xml --> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" - android:focusable="true" - android:descendantFocusability="afterDescendants"> - - <LinearLayout - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:gravity="center_vertical" - android:paddingLeft="14dip" - android:paddingRight="20dip" > - <Button android:id="@+id/button_enable" - android:layout_width="120dip" - android:layout_height="wrap_content" - android:text="@string/button_enable_all" /> - <Button android:id="@+id/button_disable" - android:layout_width="135dip" - android:layout_height="wrap_content" - android:text="@string/button_disable_all" /> - </LinearLayout> - - <!-- This layout takes all available vertical space. --> - <LinearLayout - android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="0dip" - android:layout_weight="1" - android:gravity="center" - android:layout_gravity="fill"> - <ListView - android:id="@android:id/list" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:visibility="visible" /> - <TextView - android:id="@+id/empty" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:visibility="gone" - android:text="@string/empty_channel_tvinput" - android:gravity="center" - android:padding="15dip" - android:textAppearance="?android:attr/textAppearanceMedium" /> - </LinearLayout> -</LinearLayout> diff --git a/res/layout/edit_channels_fragment.xml b/res/layout/edit_channels_fragment.xml new file mode 100644 index 00000000..0a983e68 --- /dev/null +++ b/res/layout/edit_channels_fragment.xml @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> + +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:lb="http://schemas.android.com/apk/res-auto" + android:layout_width="@dimen/side_panel_shadow_width" + android:layout_height="match_parent" + android:layout_gravity="right" > + + <FrameLayout + android:id="@+id/side_panel_shadow" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_marginRight="@dimen/side_panel_shadow_margin_right" + android:background="@drawable/bg_protection_right" /> + + <LinearLayout + android:layout_gravity="right" + android:layout_width="@dimen/side_panel_width" + android:layout_height="match_parent" + android:orientation="vertical" + android:background="@color/option_fragment_background" > + <LinearLayout + android:layout_gravity="right" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="@dimen/side_panel_header_padding_top" + android:paddingLeft="@dimen/side_panel_header_padding_left" + android:orientation="vertical" + android:background="@color/option_fragment_header_background" > + <TextView + android:id="@+id/side_panel_title" + android:layout_width="match_parent" + android:layout_height="@dimen/side_panel_header_text_height" + android:gravity="center_vertical" + android:textSize="@dimen/side_panel_header_text_size" + android:textColor="@color/menu_default_text_color" + android:fontFamily="@string/font" /> + </LinearLayout> + + <android.support.v17.leanback.widget.VerticalGridView + android:id="@+id/side_panel_list" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:clipChildren="false" + android:clipToPadding="false" + android:focusable="true" + lb:verticalMargin="0dp" /> + </LinearLayout> +</FrameLayout> diff --git a/res/layout/edit_channels_item.xml b/res/layout/edit_channels_item.xml index e7a98ab0..8b567c6b 100644 --- a/res/layout/edit_channels_item.xml +++ b/res/layout/edit_channels_item.xml @@ -19,6 +19,7 @@ android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="?android:attr/listPreferredItemHeight" + android:focusable="true" android:gravity="left|center_vertical" android:padding="10dip"> @@ -50,5 +51,6 @@ android:paddingRight="10dip" android:singleLine="true" android:ellipsize="marquee" - android:marqueeRepeatLimit="1" /> + android:marqueeRepeatLimit="1" + android:fontFamily="@string/font" /> </LinearLayout> diff --git a/res/values/strings.xml b/res/values/strings.xml index 56773a0b..7dde9883 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -69,11 +69,7 @@ <string name="unified_tv_input_label">Unified TV input</string> <!-- Edit channel list (enable/disable individual channels) --> - <string name="edit_channels_title">Edit channel list for <xliff:g id="serviceName">%s</xliff:g></string> - <!-- Button label to enable all --> - <string name="button_enable_all">Check all</string> - <!-- Button label to disable all --> - <string name="button_disable_all">Uncheck all</string> + <string name="edit_channels_title">Edit channel list for\n<xliff:g id="tv_input">%s</xliff:g></string> <!-- Text displayed in edit channels activity when there aren't any channels in the TV input. [CHAR LIMIT=20] --> <string name="empty_channel_tvinput">No channels in the TV input.</string> diff --git a/src/com/android/tv/TvActivity.java b/src/com/android/tv/TvActivity.java index c4560b7c..192db5f0 100644 --- a/src/com/android/tv/TvActivity.java +++ b/src/com/android/tv/TvActivity.java @@ -53,7 +53,6 @@ import com.android.tv.data.AspectRatio; import com.android.tv.data.Channel; import com.android.tv.data.ChannelMap; import com.android.tv.data.StreamInfo; -import com.android.tv.dialog.EditChannelsDialogFragment; import com.android.tv.dialog.EditInputDialogFragment; import com.android.tv.dialog.RecentlyWatchedDialogFragment; import com.android.tv.input.TisTvInput; @@ -63,10 +62,10 @@ import com.android.tv.ui.AspectRatioOptionFragment; import com.android.tv.ui.BaseSideFragment; import com.android.tv.ui.ChannelBannerView; import com.android.tv.ui.ClosedCaptionOptionFragment; +import com.android.tv.ui.EditChannelsFragment; import com.android.tv.ui.InputPickerFragment; import com.android.tv.ui.MainMenuView; import com.android.tv.ui.SimpleGuideFragment; -import com.android.tv.ui.SimpleGuideShowOnlyFragment; import com.android.tv.ui.TunableTvView; import com.android.tv.ui.TunableTvView.OnTuneListener; import com.android.tv.util.TvInputManagerHelper; @@ -91,7 +90,8 @@ public class TvActivity extends Activity implements AudioManager.OnAudioFocusCha private static final float AUDIO_MAX_VOLUME = 1.0f; private static final float AUDIO_MIN_VOLUME = 0.0f; private static final float AUDIO_DUCKING_VOLUME = 0.3f; - private static final int START_TV_MAX_RETRY = 4; + // Wait for 3 seconds + private static final int START_TV_MAX_RETRY = 12; private static final int START_TV_RETRY_INTERVAL = 250; // TODO: add more KEYCODEs to the white list. @@ -148,7 +148,6 @@ public class TvActivity extends Activity implements AudioManager.OnAudioFocusCha static { AVAILABLE_DIALOG_TAGS.add(RecentlyWatchedDialogFragment.DIALOG_TAG); - AVAILABLE_DIALOG_TAGS.add(EditChannelsDialogFragment.DIALOG_TAG); AVAILABLE_DIALOG_TAGS.add(EditInputDialogFragment.DIALOG_TAG); } @@ -421,12 +420,8 @@ public class TvActivity extends Activity implements AudioManager.OnAudioFocusCha return mChannelMap == null ? null : mChannelMap.getTvInput(); } - public void showEditChannelsDialog() { - if (getSelectedTvInput() == null) { - return; - } - - showDialogFragment(EditChannelsDialogFragment.DIALOG_TAG, new EditChannelsDialogFragment()); + public void showEditChannelsFragment(int initiator) { + showSideFragment(new EditChannelsFragment(mChannelMap.getChannelList(false)), initiator); } public boolean startSetupActivity() { diff --git a/src/com/android/tv/data/ChannelMap.java b/src/com/android/tv/data/ChannelMap.java index b00eec4c..5ea8afe9 100644 --- a/src/com/android/tv/data/ChannelMap.java +++ b/src/com/android/tv/data/ChannelMap.java @@ -32,6 +32,7 @@ import android.util.Log; import com.android.tv.input.TvInput; import com.android.tv.util.TvInputManagerHelper; +import java.util.Arrays; import java.util.HashSet; import java.util.Set; @@ -91,7 +92,7 @@ public class ChannelMap implements LoaderManager.LoaderCallbacks<Cursor> { public Channel[] getChannelList(boolean browsableOnly) { if (mBrowsableChannelCount == 0 || !browsableOnly) { - return mChannelList; + return Arrays.copyOf(mChannelList, mChannelList.length); } Channel[] channels = new Channel[mBrowsableChannelCount]; diff --git a/src/com/android/tv/dialog/EditChannelsDialogFragment.java b/src/com/android/tv/dialog/EditChannelsDialogFragment.java deleted file mode 100644 index 6b5e37f0..00000000 --- a/src/com/android/tv/dialog/EditChannelsDialogFragment.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * 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 com.android.tv.dialog; - -import android.app.AlertDialog; -import android.app.Dialog; -import android.app.DialogFragment; -import android.app.LoaderManager.LoaderCallbacks; -import android.content.ContentValues; -import android.content.CursorLoader; -import android.content.Loader; -import android.database.Cursor; -import android.media.tv.TvContract; -import android.net.Uri; -import android.os.Bundle; -import android.text.TextUtils; -import android.view.LayoutInflater; -import android.view.View; -import android.view.View.OnClickListener; -import android.widget.AdapterView; -import android.widget.AdapterView.OnItemClickListener; -import android.widget.Button; -import android.widget.CheckedTextView; -import android.widget.ListView; -import android.widget.SimpleCursorAdapter; -import android.widget.SimpleCursorAdapter.ViewBinder; -import android.widget.Toast; - -import com.android.internal.util.Preconditions; -import com.android.tv.R; -import com.android.tv.TvActivity; -import com.android.tv.input.TvInput; - -public class EditChannelsDialogFragment extends DialogFragment { - public static final String DIALOG_TAG = EditChannelsDialogFragment.class.getName(); - - private static final int BROWSABLE = 1; - - private TvInput mSelectedInput; - private SimpleCursorAdapter mAdapter; - - private View mView; - private ListView mListView; - - private int mIndexDisplayNumber; - private int mIndexDisplayName; - private int mIndexBrowsable; - - private int mBrowsableChannelCount; - - private boolean isInitialLoading; - - @Override - public Dialog onCreateDialog(Bundle savedInstanceState) { - mSelectedInput = ((TvActivity) getActivity()).getSelectedTvInput(); - Preconditions.checkNotNull(mSelectedInput); - - String displayName = mSelectedInput.getDisplayName(); - String title = String.format(getString(R.string.edit_channels_title), displayName); - - mView = LayoutInflater.from(getActivity()).inflate(R.layout.edit_channels, null); - initButtons(); - initListView(); - - return new AlertDialog.Builder(getActivity()) - .setView(mView) - .setTitle(title) - .create(); - } - - private void initButtons() { - Button button = (Button) mView.findViewById(R.id.button_enable); - button.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - updateAllChannels(true); - } - }); - - button = (Button) mView.findViewById(R.id.button_disable); - button.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - updateAllChannels(false); - } - }); - } - - private void initListView() { - getLoaderManager().initLoader(0, null, new LoaderCallbacks<Cursor>() { - @Override - public Loader<Cursor> onCreateLoader(int id, Bundle args) { - Uri uri = mSelectedInput.buildChannelsUri(); - String[] projections = { TvContract.Channels._ID, - TvContract.Channels.COLUMN_DISPLAY_NUMBER, - TvContract.Channels.COLUMN_DISPLAY_NAME, - TvContract.Channels.COLUMN_BROWSABLE }; - String sortOrder = mSelectedInput.buildChannelsSortOrder(); - - isInitialLoading = true; - return new CursorLoader(getActivity(), uri, projections, null, null, sortOrder); - } - - @Override - public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { - mIndexDisplayNumber = cursor.getColumnIndex( - TvContract.Channels.COLUMN_DISPLAY_NUMBER); - mIndexDisplayName = cursor.getColumnIndex(TvContract.Channels.COLUMN_DISPLAY_NAME); - mIndexBrowsable = cursor.getColumnIndex(TvContract.Channels.COLUMN_BROWSABLE); - - cursor.setNotificationUri(getActivity().getContentResolver(), - TvContract.Channels.CONTENT_URI); - mAdapter.swapCursor(cursor); - - if (isInitialLoading) { - isInitialLoading = false; - mBrowsableChannelCount = 0; - while(cursor.moveToNext()) { - if (cursor.getInt(mIndexBrowsable) == BROWSABLE) { - ++mBrowsableChannelCount; - } - } - if (mBrowsableChannelCount <= 0) { - Toast.makeText(getActivity(), R.string.all_the_channels_are_unchecked, - Toast.LENGTH_SHORT).show(); - } - } - } - - @Override - public void onLoaderReset(Loader<Cursor> loader) { - mAdapter.swapCursor(null); - } - }); - - // TODO: need to show logo when TvProvider supports logo-related field. - String[] from = { TvContract.Channels.COLUMN_DISPLAY_NAME }; - int[] to = {R.id.channel_text_view}; - - mAdapter = new SimpleCursorAdapter(getActivity(), R.layout.edit_channels_item, null, from, - to, 0); - mAdapter.setViewBinder(new ViewBinder() { - @Override - public boolean setViewValue(View view, Cursor cursor, int columnIndex) { - if (columnIndex == mIndexDisplayName) { - String channelNumber = cursor.getString(mIndexDisplayNumber); - String channelName = cursor.getString(mIndexDisplayName); - String channelString; - if (TextUtils.isEmpty(channelName)) { - channelString = channelNumber; - } else { - channelString = String.format(getString(R.string.channel_item), - channelNumber, channelName); - } - CheckedTextView checkedTextView = (CheckedTextView) view; - checkedTextView.setText(channelString); - checkedTextView.setChecked(cursor.getInt(mIndexBrowsable) == 1); - } - return true; - } - }); - - mListView = (ListView) mView.findViewById(android.R.id.list); - mListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); - mListView.setAdapter(mAdapter); - mListView.setEmptyView(mView.findViewById(R.id.empty)); - - mListView.setOnItemClickListener(new OnItemClickListener() { - @Override - public void onItemClick(AdapterView<?> parent, View view, int position, long id) { - CheckedTextView checkedTextView = - (CheckedTextView) view.findViewById(R.id.channel_text_view); - boolean checked = checkedTextView.isChecked(); - - Uri uri = TvContract.buildChannelUri(id); - ContentValues values = new ContentValues(); - values.put(TvContract.Channels.COLUMN_BROWSABLE, checked ? 0 : 1); - getActivity().getContentResolver().update(uri, values, null, null); - - mBrowsableChannelCount += checked ? -1 : 1; - if (mBrowsableChannelCount <= 0) { - Toast.makeText(getActivity(), R.string.all_the_channels_are_unchecked, - Toast.LENGTH_SHORT).show(); - } - } - }); - } - - private void updateAllChannels(boolean browsable) { - if (mAdapter == null || mAdapter.getCursor() == null) { - return; - } - Uri uri = mSelectedInput.buildChannelsUri(); - ContentValues values = new ContentValues(); - values.put(TvContract.Channels.COLUMN_BROWSABLE, browsable ? 1 : 0); - - getActivity().getContentResolver().update(uri, values, null, null); - - if (browsable) { - mBrowsableChannelCount = mAdapter.getCount(); - } else { - mBrowsableChannelCount = 0; - Toast.makeText(getActivity(), R.string.all_the_channels_are_unchecked, - Toast.LENGTH_SHORT).show(); - } - } -} diff --git a/src/com/android/tv/ui/EditChannelsFragment.java b/src/com/android/tv/ui/EditChannelsFragment.java new file mode 100644 index 00000000..71f7a858 --- /dev/null +++ b/src/com/android/tv/ui/EditChannelsFragment.java @@ -0,0 +1,128 @@ +/* + * 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 com.android.tv.ui; + +import android.content.ContentValues; +import android.media.tv.TvContract; +import android.net.Uri; +import android.os.Bundle; +import android.support.v17.leanback.widget.VerticalGridView; +import android.text.TextUtils; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.CheckedTextView; +import android.widget.Toast; + +import com.android.tv.R; +import com.android.tv.TvActivity; +import com.android.tv.data.Channel; +import com.android.tv.input.TvInput; + +public class EditChannelsFragment extends BaseSideFragment { + private static final String TAG = "EditChannelsFragment"; + private static final boolean DEBUG = true; + + private TvInput mSelectedInput; + + private TvActivity mTvActivity; + private Channel[] mChannels; + + private int mBgColor; + private int mFocusedBgColor; + + private int mBrowsableChannelCount; + + public EditChannelsFragment(Channel[] channels) { + mChannels = channels; + mBrowsableChannelCount = 0; + for (Channel channel : channels) { + if (channel.isBrowsable()) { + ++mBrowsableChannelCount; + } + } + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + mTvActivity = (TvActivity) getActivity(); + mSelectedInput = mTvActivity.getSelectedTvInput(); + + mBgColor = getActivity().getResources().getColor(R.color.option_item_background); + mFocusedBgColor = getActivity().getResources().getColor( + R.color.option_item_focused_background); + + String displayName = mSelectedInput.getDisplayName(); + String title = String.format(getString(R.string.edit_channels_title), displayName); + initialize(title, mChannels, R.layout.edit_channels_fragment, R.layout.edit_channels_item, + false); + + if (mBrowsableChannelCount <= 0) { + Toast.makeText(getActivity(), R.string.all_the_channels_are_unchecked, + Toast.LENGTH_SHORT).show(); + } + return super.onCreateView(inflater, container, savedInstanceState); + } + + @Override + public void onBindView(View v, int position, Object tag, boolean prevSelected) { + super.onBindView(v, position, tag, prevSelected); + + Channel channel = (Channel) tag; + String channelNumber = channel.getDisplayNumber(); + String channelName = channel.getDisplayName(); + String channelString; + if (TextUtils.isEmpty(channelName)) { + channelString = channelNumber; + } else { + channelString = String.format(getString(R.string.channel_item), + channelNumber, channelName); + } + CheckedTextView checkedTextView = + (CheckedTextView) v.findViewById(R.id.channel_text_view); + checkedTextView.setText(channelString); + checkedTextView.setChecked(channel.isBrowsable()); + } + + @Override + public void onItemSelected(View v, int position, Object tag) { + CheckedTextView checkedTextView = + (CheckedTextView) v.findViewById(R.id.channel_text_view); + boolean checked = checkedTextView.isChecked(); + + Channel channel = (Channel) tag; + Uri uri = TvContract.buildChannelUri(channel.getId()); + ContentValues values = new ContentValues(); + values.put(TvContract.Channels.COLUMN_BROWSABLE, checked ? 0 : 1); + getActivity().getContentResolver().update(uri, values, null, null); + + checkedTextView.setChecked(!checked); + mBrowsableChannelCount += checked ? -1 : 1; + if (mBrowsableChannelCount <= 0) { + Toast.makeText(getActivity(), R.string.all_the_channels_are_unchecked, + Toast.LENGTH_SHORT).show(); + } + + super.onItemSelected(v, position, tag); + } + + @Override + public void onItemFocusChanged(View v, boolean focusGained, int position, Object tag) { + v.setBackgroundColor(focusGained ? mFocusedBgColor : mBgColor); + } +} diff --git a/src/com/android/tv/ui/InputPickerFragment.java b/src/com/android/tv/ui/InputPickerFragment.java index a266be00..c822a136 100644 --- a/src/com/android/tv/ui/InputPickerFragment.java +++ b/src/com/android/tv/ui/InputPickerFragment.java @@ -19,11 +19,9 @@ package com.android.tv.ui; import android.media.tv.TvInputInfo; import android.media.tv.TvInputManager; import android.os.Bundle; -import android.os.Handler; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.ArrayAdapter; import android.widget.RadioButton; import com.android.internal.util.Preconditions; @@ -39,9 +37,6 @@ import java.util.Collection; import java.util.Comparator; public class InputPickerFragment extends BaseOptionFragment { - private static final String TAG = "InputPickerFragment"; - private static final boolean DEBUG = true; - private TvInput mSelectedInput; private TvActivity mTvActivity; @@ -58,8 +53,6 @@ public class InputPickerFragment extends BaseOptionFragment { } }; - private final Handler mHandler = new Handler(); - @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { diff --git a/src/com/android/tv/ui/MainMenuView.java b/src/com/android/tv/ui/MainMenuView.java index 1fa32a42..95cde6d7 100644 --- a/src/com/android/tv/ui/MainMenuView.java +++ b/src/com/android/tv/ui/MainMenuView.java @@ -296,7 +296,8 @@ public class MainMenuView extends FrameLayout implements View.OnClickListener, break; case MenuAction.EDIT_CHANNEL_LIST_TYPE: - mTvActivity.showEditChannelsDialog(); + mTvActivity.showEditChannelsFragment( + BaseSideFragment.INITIATOR_MENU); break; case MenuAction.AUTO_SCAN_CHANNELS_TYPE: diff --git a/src/com/android/tv/ui/OptionsAdapter.java b/src/com/android/tv/ui/OptionsAdapter.java index 7dcc1894..5afe9a7c 100644 --- a/src/com/android/tv/ui/OptionsAdapter.java +++ b/src/com/android/tv/ui/OptionsAdapter.java @@ -62,7 +62,7 @@ public class OptionsAdapter extends ItemListView.ItemListAdapter { actionList.add(MenuAction.SELECT_ASPECT_RATIO_ACTION); actionList.add(MenuAction.SELECT_TV_INPUT_ACTION); actionList.add(MenuAction.TOGGLE_PIP_ACTION); - if (channelMap != null) { + if (channelMap != null && channelMap.size() != 0) { actionList.add(MenuAction.EDIT_CHANNEL_LIST_ACTION); } if (channelMap != null && tvInput.getIntentForSetupActivity() != null) { |