Java Code Examples for android.support.v17.leanback.widget.VerticalGridView#setAdapter()
The following examples show how to use
android.support.v17.leanback.widget.VerticalGridView#setAdapter() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JsonListingPanelActivity.java From CumulusTV with MIT License | 5 votes |
private void refreshUi() { try { final JsonListing[] names = getUrls(); items = new RecyclerViewItem[names.length + 1]; items[0] = new RecyclerViewItem(getString(R.string.add_new_link)) { @Override public void onClick() { Intent i = new Intent(JsonListingPanelActivity.this, ListingPlugin.class); i.putExtra(CumulusTvPlugin.INTENT_EXTRA_ACTION, CumulusTvPlugin.INTENT_ADD); startActivity(i); } }; if (names.length > 0) { for (int i = 1; i < items.length; i++) { final int finalI = i; Log.d(TAG, "Poll " + finalI); items[i] = new RecyclerViewItem(names[finalI - 1].getUrl()) { @Override public void onClick() { showEditDialog(names[finalI - 1]); } }; } } } catch (JSONException e) { e.printStackTrace(); } mAppLinkMenuList = (VerticalGridView) findViewById(R.id.list); mAppLinkMenuList.setAdapter(new AppLinkMenuAdapter(this, items)); }
Example 2
Source File: RichAppLinkSidePanelActivity.java From androidtv-sample-inputs with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); List<Channel> channels = ModelUtils.getChannels(getContentResolver()); Channel appLinkChannel = null; String displayNumber = getIntent().getStringExtra(RichFeedUtil.EXTRA_DISPLAY_NUMBER); if (displayNumber != null) { for (Channel channel : channels) { if (displayNumber.equals(channel.getDisplayNumber())) { appLinkChannel = channel; break; } } } // Sets the size and position of dialog activity. WindowManager.LayoutParams layoutParams = getWindow().getAttributes(); layoutParams.gravity = Gravity.END | Gravity.CENTER_VERTICAL; layoutParams.width = getResources().getDimensionPixelSize(R.dimen.side_panel_width); layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT; getWindow().setAttributes(layoutParams); setContentView(R.layout.rich_app_link_side_panel); if (appLinkChannel != null && appLinkChannel.getAppLinkColor() != 0) { TextView titleView = (TextView) findViewById(R.id.title); titleView.setBackgroundColor(appLinkChannel.getAppLinkColor()); } mAppLinkMenuList = (VerticalGridView) findViewById(R.id.list); mAppLinkMenuList.setAdapter(new AppLinkMenuAdapter()); }
Example 3
Source File: PlaybackQuickSettingsActivity.java From CumulusTV with MIT License | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getActionBar() != null) { getActionBar().hide(); } setContentView(R.layout.activity_quick_settings); RecyclerViewItem[] quickSettings = new RecyclerViewItem[3]; try { final JsonChannel jsonChannel = new JsonChannel.Builder(getIntent() .getStringExtra(EXTRA_JSON_CHANNEL)).build(); // Set the title ((TextView) findViewById(R.id.title)).setText(jsonChannel.getName()); // Open this channel in the editor quickSettings[0] = new RecyclerViewItem( getString(R.string.edit_channel_name, jsonChannel.getName())) { @Override public void onClick() { ActivityUtils.editChannel(PlaybackQuickSettingsActivity.this, jsonChannel.getMediaUrl()); } }; // Open CumulusTV quickSettings[1] = new RecyclerViewItem(getString(R.string.open_cumulus_tv)) { @Override public void onClick() { startActivity(new Intent(PlaybackQuickSettingsActivity.this, ActivityUtils.getMainActivity(PlaybackQuickSettingsActivity.this))); } }; // Sends a crash report quickSettings[2] = new RecyclerViewItem(getString(R.string.report_playback_issue)) { @Override public void onClick() { throw new PlaybackIssueException("Issue found with playback: " + jsonChannel.toString()); } }; } catch (JSONException e) { Toast.makeText(this, R.string.toast_error_sorry, Toast.LENGTH_SHORT).show(); finish(); return; } // Sets the size and position of dialog activity. WindowManager.LayoutParams layoutParams = getWindow().getAttributes(); layoutParams.gravity = Gravity.END | Gravity.CENTER_VERTICAL; layoutParams.width = getResources().getDimensionPixelSize(R.dimen.side_panel_width); layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT; getWindow().setAttributes(layoutParams); mAppLinkMenuList = (VerticalGridView) findViewById(R.id.list); mAppLinkMenuList.setAdapter(new AppLinkMenuAdapter(this, quickSettings)); }