List of usage examples for android.widget ImageView setVisibility
@RemotableViewMethod @Override public void setVisibility(int visibility)
From source file:com.brq.wallet.activity.modern.ModernMain.java
public void setRefreshAnimation() { if (refreshItem != null) { if (_mbwManager.getWalletManager(false).getState() == WalletManager.State.SYNCHRONIZING) { MenuItem menuItem = MenuItemCompat.setActionView(refreshItem, R.layout.actionbar_indeterminate_progress); ImageView ivTorIcon = (ImageView) menuItem.getActionView().findViewById(R.id.ivTorIcon); if (_mbwManager.getTorMode() == ServerEndpointType.Types.ONLY_TOR && _mbwManager.getTorManager() != null) { ivTorIcon.setVisibility(View.VISIBLE); if (_mbwManager.getTorManager().getInitState() == 100) { ivTorIcon.setImageResource(R.drawable.tor); } else { ivTorIcon.setImageResource(R.drawable.tor_gray); }//from w ww . j a v a2 s . com } else { ivTorIcon.setVisibility(View.GONE); } } else { MenuItemCompat.setActionView(refreshItem, null); } } }
From source file:com.lastorder.pushnotifications.data.ImageDownloader.java
/** * Same as download but the image is always downloaded and the cache is not used. * Kept private at the moment as its interest is not clear. *///ww w . j ava2 s. co m private void forceDownload(String url, ImageView imageView, ProgressBar bar) { // State sanity: url is guaranteed to never be null in DownloadedDrawable and cache keys. if (url == null || !url.contains(".") || url.length() <= 6 || url.contains("null")) { bar.setVisibility(8); imageView.setImageResource(R.drawable.ic_launcher); imageView.setVisibility(0); return; } if (cancelPotentialDownload(url, imageView)) { BitmapDownloaderTask task = new BitmapDownloaderTask(imageView, bar); DownloadedDrawable downloadedDrawable = new DownloadedDrawable(task); imageView.setImageDrawable(downloadedDrawable); imageView.setMinimumHeight(156); task.execute(url); } }
From source file:com.wizardsofm.deskclock.timer.TimerFragment.java
@Override public void onUpdateFab(@NonNull ImageView fab) { if (mCurrentView == mTimersView) { final Timer timer = getTimer(); if (timer == null) { fab.setVisibility(INVISIBLE); return; }/*from w w w. j a v a2s . c om*/ fab.setVisibility(VISIBLE); switch (timer.getState()) { case RUNNING: fab.setImageResource(com.wizardsofm.deskclock.R.drawable.ic_pause_white_24dp); fab.setContentDescription( fab.getResources().getString(com.wizardsofm.deskclock.R.string.timer_stop)); break; case RESET: case PAUSED: fab.setImageResource(com.wizardsofm.deskclock.R.drawable.ic_start_white_24dp); fab.setContentDescription( fab.getResources().getString(com.wizardsofm.deskclock.R.string.timer_start)); break; case EXPIRED: fab.setImageResource(com.wizardsofm.deskclock.R.drawable.ic_stop_white_24dp); fab.setContentDescription( fab.getResources().getString(com.wizardsofm.deskclock.R.string.timer_stop)); break; } } else if (mCurrentView == mCreateTimerView) { if (mCreateTimerView.hasValidInput()) { fab.setImageResource(com.wizardsofm.deskclock.R.drawable.ic_start_white_24dp); fab.setContentDescription( fab.getResources().getString(com.wizardsofm.deskclock.R.string.timer_start)); fab.setVisibility(VISIBLE); } else { fab.setVisibility(INVISIBLE); } } }
From source file:com.arantius.tivocommander.Explore.java
protected void finishRequest() { if (--mRequestCount != 0) { return;/*www .j a v a 2s . c o m*/ } getParent().setProgressBarIndeterminateVisibility(false); if (mRecordingId == null) { for (JsonNode recording : mContent.path("recordingForContentId")) { String state = recording.path("state").asText(); if ("inProgress".equals(state) || "complete".equals(state) || "scheduled".equals(state)) { mRecordingId = recording.path("recordingId").asText(); mRecordingState = state; break; } } } // Fill mChoices based on the data we now have. if ("scheduled".equals(mRecordingState)) { mChoices.add(RecordActions.DONT_RECORD.toString()); } else if ("inProgress".equals(mRecordingState)) { mChoices.add(RecordActions.RECORD_STOP.toString()); } else if (mOfferId != null) { mChoices.add(RecordActions.RECORD.toString()); } if (mSubscriptionId != null) { mChoices.add(RecordActions.SP_MODIFY.toString()); mChoices.add(RecordActions.SP_CANCEL.toString()); } else if (mCollectionId != null && !"movie".equals(mContent.path("collectionType").asText()) && !mContent.has("movieYear")) { mChoices.add(RecordActions.SP_ADD.toString()); } setContentView(R.layout.explore); // Show only appropriate buttons. findViewById(R.id.explore_btn_watch).setVisibility( "complete".equals(mRecordingState) || "inprogress".equals(mRecordingState) ? View.VISIBLE : View.GONE); hideViewIfNull(R.id.explore_btn_upcoming, mCollectionId); if (mChoices.size() == 0) { findViewById(R.id.explore_btn_record).setVisibility(View.GONE); } // Delete / undelete buttons visible only if appropriate. findViewById(R.id.explore_btn_delete) .setVisibility("complete".equals(mRecordingState) ? View.VISIBLE : View.GONE); findViewById(R.id.explore_btn_undelete) .setVisibility("deleted".equals(mRecordingState) ? View.VISIBLE : View.GONE); // Display titles. String title = mContent.path("title").asText(); String subtitle = mContent.path("subtitle").asText(); ((TextView) findViewById(R.id.content_title)).setText(title); TextView subtitleView = ((TextView) findViewById(R.id.content_subtitle)); if ("".equals(subtitle)) { subtitleView.setVisibility(View.GONE); } else { subtitleView.setText(subtitle); } // Display (only the proper) badges. if (mRecording != null && mRecording.path("episodic").asBoolean() && !mRecording.path("repeat").asBoolean()) { findViewById(R.id.badge_new).setVisibility(View.VISIBLE); } if (mRecording != null && mRecording.path("hdtv").asBoolean()) { findViewById(R.id.badge_hd).setVisibility(View.VISIBLE); } ImageView iconSubType = (ImageView) findViewById(R.id.icon_sub_type); TextView textSubType = (TextView) findViewById(R.id.text_sub_type); // TODO: Downloading state? if ("complete".equals(mRecordingState)) { iconSubType.setVisibility(View.GONE); textSubType.setVisibility(View.GONE); } else if ("inProgress".equals(mRecordingState)) { iconSubType.setImageResource(R.drawable.recording_recording); textSubType.setText(R.string.sub_recording); } else if (mSubscriptionType != null) { switch (mSubscriptionType) { case SEASON_PASS: iconSubType.setImageResource(R.drawable.todo_seasonpass); textSubType.setText(R.string.sub_season_pass); break; case SINGLE_OFFER: iconSubType.setImageResource(R.drawable.todo_single_offer); textSubType.setText(R.string.sub_single_offer); break; case WISHLIST: iconSubType.setImageResource(R.drawable.todo_wishlist); textSubType.setText(R.string.sub_wishlist); break; default: iconSubType.setVisibility(View.GONE); textSubType.setVisibility(View.GONE); } } else { iconSubType.setVisibility(View.GONE); textSubType.setVisibility(View.GONE); } // Display channel and time. if (mRecording != null) { String channelStr = ""; JsonNode channel = mRecording.path("channel"); if (!channel.isMissingNode()) { channelStr = String.format("%s %s, ", channel.path("channelNumber").asText(), channel.path("callSign").asText()); } // Lots of shows seem to be a few seconds short, add padding so that // rounding down works as expected. Magic number. final int minutes = (30 + mRecording.path("duration").asInt()) / 60; String durationStr = minutes >= 60 ? String.format(Locale.US, "%d hr", minutes / 60) : String.format(Locale.US, "%d min", minutes); if (isRecordingPartial()) { durationStr += " (partial)"; } ((TextView) findViewById(R.id.content_chan_len)).setText(channelStr + durationStr); String airTime = new SimpleDateFormat("EEE MMM d, hh:mm a", Locale.US) .format(Utils.parseDateTimeStr(mRecording.path("actualStartTime").asText())); ((TextView) findViewById(R.id.content_air_time)).setText("Air time: " + airTime); } else { ((TextView) findViewById(R.id.content_chan_len)).setVisibility(View.GONE); ((TextView) findViewById(R.id.content_air_time)).setVisibility(View.GONE); } // Construct and display details. ArrayList<String> detailParts = new ArrayList<String>(); int season = mContent.path("seasonNumber").asInt(); int epNum = mContent.path("episodeNum").path(0).asInt(); if (season != 0 && epNum != 0) { detailParts.add(String.format("Sea %d Ep %d", season, epNum)); } if (mContent.has("mpaaRating")) { detailParts.add(mContent.path("mpaaRating").asText().toUpperCase(Locale.US)); } else if (mContent.has("tvRating")) { detailParts.add("TV-" + mContent.path("tvRating").asText().toUpperCase(Locale.US)); } detailParts.add(mContent.path("category").path(0).path("label").asText()); int year = mContent.path("originalAirYear").asInt(); if (year != 0) { detailParts.add(Integer.toString(year)); } // Filter empty strings. for (int i = detailParts.size() - 1; i >= 0; i--) { if ("".equals(detailParts.get(i)) || null == detailParts.get(i)) { detailParts.remove(i); } } // Then format the parts into one string. String detail1 = "(" + Utils.join(", ", detailParts) + ") "; if ("() ".equals(detail1)) { detail1 = ""; } String detail2 = mContent.path("description").asText(); TextView detailView = ((TextView) findViewById(R.id.content_details)); if (detail2 == null) { detailView.setText(detail1); } else { Spannable details = new SpannableString(detail1 + detail2); details.setSpan(new ForegroundColorSpan(Color.WHITE), detail1.length(), details.length(), 0); detailView.setText(details); } // Add credits. ArrayList<String> credits = new ArrayList<String>(); for (JsonNode credit : mContent.path("credit")) { String role = credit.path("role").asText(); if ("actor".equals(role) || "host".equals(role) || "guestStar".equals(role)) { credits.add(credit.path("first").asText() + " " + credit.path("last").asText()); } } TextView creditsView = (TextView) findViewById(R.id.content_credits); creditsView.setText(Utils.join(", ", credits)); // Find and set the banner image if possible. ImageView imageView = (ImageView) findViewById(R.id.content_image); View progressView = findViewById(R.id.content_image_progress); String imageUrl = Utils.findImageUrl(mContent); new DownloadImageTask(this, imageView, progressView).execute(imageUrl); }
From source file:com.facebook.GraphObjectAdapter.java
protected View createGraphObjectView(T graphObject, View convertView) { View result = inflater.inflate(getGraphObjectRowLayoutId(graphObject), null); ViewStub checkboxStub = (ViewStub) result.findViewById(R.id.com_facebook_picker_checkbox_stub); if (checkboxStub != null) { if (!getShowCheckbox()) { checkboxStub.setVisibility(View.GONE); } else {// w w w. jav a 2 s . c o m CheckBox checkBox = (CheckBox) checkboxStub.inflate(); updateCheckboxState(checkBox, false); } } ViewStub profilePicStub = (ViewStub) result.findViewById(R.id.com_facebook_picker_profile_pic_stub); if (!getShowPicture()) { profilePicStub.setVisibility(View.GONE); } else { ImageView imageView = (ImageView) profilePicStub.inflate(); imageView.setVisibility(View.VISIBLE); } return result; }
From source file:me.fireant.photoselect.ui.PhotoSelectedPreviewActivity.java
@Override protected void initData() { if (getIntent() != null) { Intent intent = getIntent();/*w ww . j av a2s. c o m*/ mSelectedPhotos = intent.getParcelableArrayListExtra(BUNDLE_SELECTED_PHOTOS); mSelectIndex = intent.getIntExtra(BUNDLE_SELECT_INDEX, 0); } if (mSelectedPhotos == null || mSelectedPhotos.isEmpty()) { throw new IllegalStateException("selectPhotos must > 0"); } mPagerAdapter = new PagerAdapter() { @Override public int getCount() { return mSelectedPhotos.size(); } @Override public boolean isViewFromObject(View view, Object object) { return view == object; } @Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView((View) object); } @Override public int getItemPosition(Object object) { return POSITION_NONE; } @Override public Object instantiateItem(ViewGroup container, int position) { View rootView = LayoutInflater.from(PhotoSelectedPreviewActivity.this) .inflate(R.layout.list_cell_photo_preview, null); final ImageView photoView = (ImageView) rootView.findViewById(R.id.iv_photo); final ProgressBar pbLoading = (ProgressBar) rootView.findViewById(R.id.pb_loading); final Photo photo = mSelectedPhotos.get(position); Picasso.with(PhotoSelectedPreviewActivity.this).load(new File(photo.getPath())) .error(R.drawable.ic_photo_error).into(photoView, new Callback() { @Override public void onSuccess() { photoView.setVisibility(View.VISIBLE); pbLoading.setVisibility(View.GONE); } @Override public void onError() { } }); container.addView(rootView); return rootView; } }; mViewPager.setAdapter(mPagerAdapter); mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { mSelectIndex = position + 1; setActionTitle(); } @Override public void onPageScrollStateChanged(int state) { } }); if (mSelectIndex == 0) { mSelectIndex = mSelectIndex + 1; setActionTitle(); } else { mViewPager.setCurrentItem(mSelectIndex, false); } }
From source file:de.msal.shoutemo.fragments.ChatFragment.java
@Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_chat, container, false); /* set the fragment title of the toolbar */ getActivity().setTitle(getString(R.string.app_name)); /* INPUT FIELD WHERE THE MESSAGE IS COMPOSED */ mInputField = (EditText) view.findViewById(R.id.et_input); /* display a blinking dot to show the refresh status */ final ImageView updateStatus = (ImageView) view.findViewById(R.id.ib_update_indicator); mReceiver = new BroadcastReceiver() { @Override// ww w . ja va 2 s.com public void onReceive(Context context, Intent intent) { boolean enabled = intent.getBooleanExtra(GetPostsService.INTENT_UPDATE_ENABLED, false); if (enabled) { updateStatus.setVisibility(View.VISIBLE); } else { updateStatus.setVisibility(View.INVISIBLE); } } }; /* SEND MESSAGE BUTTON */ mSendButton = (ImageButton) view.findViewById(R.id.ib_send); // initially the mInputField is empty, so disable the send button mSendButton.setVisibility(View.GONE); // Send message when clicked on SEND-BUTTON mSendButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mInputField.getText() != null && !TextUtils.isEmpty(mInputField.getText())) { new SendPostTask(getActivity()).execute(mInputField.getText().toString()); mInputField.setText(""); } } }); mEmoticonGrid = (GridView) view.findViewById(R.id.emoticons_grid); /* set the adapter for the emoticons */ mEmoticonGrid .setAdapter(new EmoticonsAdapter(getActivity(), new EmoticonsAdapter.OnEmoticonClickListener() { @Override public void onEmoticonClick(String bbcode) { mInputField.getText().replace(mInputField.getSelectionStart(), mInputField.getSelectionEnd(), " " + bbcode + " "); } })); /* A BUTTON WHICH SWITCHES BETWEEN SOFT KEYBOARD AND EMOTICON SELECTOR */ mKeyboardButton = (ImageButton) view.findViewById(R.id.ib_emoticons); /* Showing and dismissing popup on clicking EMOTICONS-BUTTON */ mKeyboardButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mEmoticonGrid.getVisibility() == View.VISIBLE) { mKeyboardButton.setImageResource(R.drawable.ic_action_keyboard_alt_white_24dp); mEmoticonGrid.setVisibility(View.GONE); } else { mKeyboardButton.setImageResource(R.drawable.ic_action_keyboard_arrow_down_white_24dp); mEmoticonGrid.setVisibility(View.VISIBLE); hideKeyboard(); } } }); /* LIST STUFF */ RecyclerView recyclerView = (RecyclerView) view.findViewById(android.R.id.list); recyclerView .addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST)); mLayoutManager = new LinearLayoutManager(getActivity()); mLayoutManager.setStackFromEnd(true); recyclerView.setLayoutManager(mLayoutManager); mListAdapter = new ChatAdapter(getActivity(), new ArrayList<Post>()); mListAdapter.setOnItemLongClickListener(this); recyclerView.setAdapter(mListAdapter); getLoaderManager().initLoader(LOADER_ID_MESSAGES, null, this); return view; }
From source file:com.stasbar.knowyourself.timer.TimerFragment.java
public void onUpdateFab(@NonNull ImageView fab) { if (mCurrentView == mTimersView) { final Timer timer = getTimer(); if (timer == null) { fab.setVisibility(INVISIBLE); return; }//from www.j av a 2 s.c o m fab.setVisibility(VISIBLE); switch (timer.getState()) { case RUNNING: fab.setImageResource(R.drawable.ic_pause_white_24dp); fab.setContentDescription(fab.getResources().getString(R.string.timer_stop)); break; case RESET: case PAUSED: fab.setImageResource(R.drawable.ic_start_white_24dp); fab.setContentDescription(fab.getResources().getString(R.string.timer_start)); break; case MISSED: case EXPIRED: fab.setImageResource(R.drawable.ic_stop_white_24dp); fab.setContentDescription(fab.getResources().getString(R.string.timer_stop)); break; } } else if (mCurrentView == mCreateTimerView) { if (mCreateTimerView.hasValidInput()) { fab.setImageResource(R.drawable.ic_start_white_24dp); fab.setContentDescription(fab.getResources().getString(R.string.timer_start)); fab.setVisibility(VISIBLE); } else { fab.setVisibility(INVISIBLE); } } }
From source file:MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final ImageView imageViewThumbnail = (ImageView) findViewById(R.id.imageViewThumbnail); imageViewThumbnail.setImageBitmap(loadSampledResource(R.drawable.image, 100, 100)); imageViewThumbnail.setOnClickListener(new View.OnClickListener() { @Override/* w ww . ja va2 s . c o m*/ public void onClick(View view) { zoomFromThumbnail((ImageView) view); } }); mImageViewExpanded = (ImageView) findViewById(R.id.imageViewExpanded); mImageViewExpanded.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mImageViewExpanded.setVisibility(View.GONE); mImageViewExpanded.setImageBitmap(null); imageViewThumbnail.setVisibility(View.VISIBLE); } }); }
From source file:com.woodblockwithoutco.quickcontroldock.ui.factory.ServiceViewFactory.java
@SuppressWarnings("deprecation") public View getServiceView() { boolean sameLayout = GeneralResolver.isSameLayoutForLandscape(mContext); int inflateId = 0; if (ScreenUtils.getScreenOrientation(mContext) == Configuration.ORIENTATION_PORTRAIT || sameLayout) { inflateId = R.layout.panel_layout; } else {// w w w .j a v a2s . co m inflateId = R.layout.panel_layout_land; } View view = LayoutInflater.from(mContext).inflate(inflateId, null, false); final DragViewGroup dragView = (DragViewGroup) view.findViewById(R.id.panel_drag_handler); dragView.setBackgroundDrawable(ColorsResolver.getBackgroundDrawable(mContext)); if (ConstantHolder.getIsDebug()) { initTestVersionText(dragView); } ViewGroup viewToHide; if (ScreenUtils.getScreenOrientation(mContext) == Configuration.ORIENTATION_PORTRAIT || sameLayout) { LinearLayout panelsContainer = (LinearLayout) dragView.findViewById(R.id.panels_container); viewToHide = panelsContainer; if (ScreenUtils.getScreenOrientation(mContext) == Configuration.ORIENTATION_PORTRAIT) { panelsContainer.setTranslationY(GeneralResolver.getPanelsOffset(mContext)); } List<String> panelsOrder = PanelsOrderResolver.getPanelsOrder(mContext); if (ShortcutsResolver.isShortcutsEnabled(mContext)) { ShortcutsViewFactory svFactory = new ShortcutsViewFactory(mContext); int id = getContainerIdForPanelType(panelsOrder, PanelType.SHORTCUTS.name()); FrameLayout section = (FrameLayout) view.findViewById(id); adjustPanelMargins(section); section.addView(svFactory.getShortcutsSectionView()); } if (MusicResolver.isMusicPanelEnabled(mContext)) { MusicViewFactory mvFactory = new MusicViewFactory(mContext); int id = getContainerIdForPanelType(panelsOrder, PanelType.MUSIC.name()); FrameLayout section = (FrameLayout) view.findViewById(id); adjustPanelMargins(section); section.addView(mvFactory.getMusicView()); } if (TogglesResolver.isTogglesEnabled(mContext)) { TogglesViewFactory tvFactory = new TogglesViewFactory(mContext); int id = getContainerIdForPanelType(panelsOrder, PanelType.TOGGLES.name()); FrameLayout section = (FrameLayout) view.findViewById(id); adjustPanelMargins(section); section.addView(tvFactory.getTogglesSectionView()); } if (InfoResolver.isInfoPanelEnabled(mContext)) { InfoViewFactory ivFactory = new InfoViewFactory(mContext); int id = getContainerIdForPanelType(panelsOrder, PanelType.INFO.name()); FrameLayout section = (FrameLayout) view.findViewById(id); adjustPanelMargins(section); section.addView(ivFactory.getInfoView()); } if (NotificationsResolver.isNotificationsEnabled(mContext)) { final ImageView fakeNotificationsButton = (ImageView) dragView .findViewById(R.id.notifications_button_fake); PressImageView notificationsButton = (PressImageView) dragView .findViewById(R.id.notifications_button); fakeNotificationsButton.setVisibility(View.VISIBLE); notificationsButton.setVisibility(View.VISIBLE); fakeNotificationsButton.setImageResource(R.drawable.ic_notification_switch); fakeNotificationsButton.setColorFilter(ColorsResolver.getActiveColor(mContext)); final float SCALE = 1.5f; fakeNotificationsButton.setScaleX(SCALE); fakeNotificationsButton.setScaleY(SCALE); notificationsButton.setOnPressedStateChangeListener(new OnPressedStateChangeListener() { private final int BG_COLOR = ColorsResolver.getPressedColor(mContext); @Override public void onPressedStateChange(ImageView v, boolean pressed) { if (pressed) { fakeNotificationsButton.setBackgroundColor(BG_COLOR); } else { fakeNotificationsButton.setBackgroundColor(0x00000000); } } }); NotificationViewFactory nvFactory = new NotificationViewFactory(mContext); ViewGroup notificationsView = nvFactory.getNotificationsView(); notificationsView.setAlpha(0.0f); notificationsView.setVisibility(View.INVISIBLE); FrameLayout notificationsContainer = (FrameLayout) dragView .findViewById(R.id.notifications_section); notificationsContainer.addView(notificationsView); notificationsButton .setOnClickListener(new NotificationButtonClickListener(viewToHide, notificationsView)); } } else { ViewPager pager = (ViewPager) view.findViewById(R.id.landscape_pager); viewToHide = pager; List<View> views = new ArrayList<View>(); if (NotificationsResolver.isNotificationsEnabled(mContext)) { NotificationViewFactory nvFactory = new NotificationViewFactory(mContext); ViewGroup notificationsView = nvFactory.getNotificationsView(); views.add(notificationsView); } List<String> panelsOrder = PanelsOrderResolver.getPanelsOrder(mContext); for (String t : panelsOrder) { PanelType type = PanelType.valueOf(t); View v = null; FrameLayout container = (FrameLayout) LayoutInflater.from(mContext) .inflate(R.layout.panel_section_land, null, false); switch (type) { case INFO: // if (InfoResolver.isInfoPanelEnabled(mContext)) { InfoViewFactory ivFactory = new InfoViewFactory(mContext); FrameLayout fourthSection = (FrameLayout) view.findViewById(R.id.fourth_section); fourthSection.addView(ivFactory.getInfoView()); } break; case MUSIC: if (MusicResolver.isMusicPanelEnabled(mContext)) { MusicViewFactory mvFactory = new MusicViewFactory(mContext); v = mvFactory.getMusicView(); } break; case SHORTCUTS: if (ShortcutsResolver.isShortcutsEnabled(mContext)) { ShortcutsViewFactory svFactory = new ShortcutsViewFactory(mContext); v = svFactory.getShortcutsSectionView(); } break; case TOGGLES: if (TogglesResolver.isTogglesEnabled(mContext)) { TogglesViewFactory tvFactory = new TogglesViewFactory(mContext); v = tvFactory.getTogglesSectionView(); } break; } if (v != null) { views.add(v); container.addView(v); } } LandscapePanelsAdapter adapter = new LandscapePanelsAdapter(views); pager.setAdapter(adapter); pager.setOverScrollMode(View.OVER_SCROLL_NEVER); pager.setOffscreenPageLimit(VIEW_PAGER_OFFSCREEN_PAGES_COUNT); pager.setPageMargin(mContext.getResources().getDimensionPixelSize(R.dimen.pager_margin)); } return view; }