List of usage examples for android.view View setActivated
public void setActivated(boolean activated)
From source file:Main.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) private static void deactivate(View item) { item.setActivated(false); }
From source file:Main.java
public static void setActivatedCompat(View view, boolean activated) { if (atLeastHoneycomb()) { view.setActivated(activated); }//w w w . j av a 2 s. c o m }
From source file:com.doctoror.fuckoffmusicplayer.presentation.util.BindingAdapters.java
@BindingAdapter("activated") public static void setActivated(@NonNull final View view, final boolean activated) { view.setActivated(activated); }
From source file:com.appgeneration.magmanager.imagefetcher.UIUtils.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) public static void setActivatedCompat(View view, boolean activated) { if (hasHoneycomb()) { view.setActivated(activated); }/* w w w . j av a 2 s . c o m*/ }
From source file:com.vuze.android.remote.AndroidUtilsUI.java
public static void setViewChecked(View child, boolean activate) { if (child == null) { return;/*from www . j a v a 2 s. c om*/ } if (child instanceof Checkable) { ((Checkable) child).setChecked(activate); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { child.setActivated(activate); } }
From source file:com.sonymobile.androidapp.gridcomputing.utils.ViewUtils.java
/** * Updates the status bar with the current conditions. * * @param parent parent view./*from w ww . ja v a2 s . c o m*/ * @param enabled the enabled condition. * @param paused the paused condition. * @param battery the battery condition. * @param charger the charger condition. * @param wifi the wifi condition. */ public static void updateStatusBar(final View parent, final boolean enabled, final boolean paused, final boolean battery, final boolean charger, final boolean wifi) { final boolean progress = battery && charger && wifi && !paused; final CheckableImageButton enableView = (CheckableImageButton) parent .findViewById(R.id.summary_menu_power_toggle); final View batteryView = parent.findViewById(R.id.iv_battery); final View chargerView = parent.findViewById(R.id.iv_charger); final View wifiView = parent.findViewById(R.id.iv_wifi); final StatusProgressBar progressView = (StatusProgressBar) parent.findViewById(R.id.progress); //final View standByProgressView = parent.findViewById(R.id.progress_stand_by); final TextView textView = (TextView) parent.findViewById(R.id.summary_status_text); boolean running = enabled && !paused; enableView.setChecked(running && progress); batteryView.setEnabled(running); chargerView.setEnabled(running); wifiView.setEnabled(running); textView.setEnabled(running); batteryView.setActivated(running && battery); chargerView.setActivated(running && charger); wifiView.setActivated(running && wifi); textView.setActivated(running && progress); if (running) { enableView.setImageResource(R.drawable.power_bt); if (progress) { textView.setText(R.string.helping_out); progressView.changeMode(StatusProgressBar.ProgressStatus.RUNNING); } else { textView.setText(R.string.stand_by); progressView.changeMode(StatusProgressBar.ProgressStatus.STAND_BY); } } else { progressView.changeMode(StatusProgressBar.ProgressStatus.NONE); if (!enabled) { enableView.setImageResource(R.drawable.power_bt_disabled); textView.setText(R.string.disabled); } else { enableView.setImageResource(R.drawable.power_bt_paused); textView.setText(R.string.paused); } } }
From source file:org.flerda.android.honeypad.NoteListFragment.java
/** * Helper method to set the activation state of a note * /*from w w w .j a v a 2s . c o m*/ * @param noteId * The id of the note to be activated */ protected void setActivatedNote(long noteId) { if (mAdapter != null) { // work out the position in the list of note with the given id final int N = mAdapter.getCount(); for (int position = 0; position < N; position++) { if (mAdapter.getItemId(position) == noteId) { if (position != mCurrentActivePosition) { clearActivation(); mCurrentActivePosition = position; View row = getListView().getChildAt(position); if (row != null) { row.setActivated(true); } } break; } } } else { // if we have not loaded our cursor yet then store the note id // for now & activate once loaded mNoteIdToActivate = noteId; } }
From source file:nuclei.ui.view.media.PlayerControlsView.java
private void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { setClickable(true);/*w ww . ja v a 2 s. c o m*/ final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PlayerControlsView, defStyleAttr, defStyleRes); mAutoHide = a.getBoolean(R.styleable.PlayerControlsView_auto_hide, false); boolean bottom = a.getBoolean(R.styleable.PlayerControlsView_bottom, false); int layout = a.getResourceId(R.styleable.PlayerControlsView_control_layout, bottom ? R.layout.cyto_view_player_controls_bottom : R.layout.cyto_view_player_controls); boolean hasPrevious = a.getBoolean(R.styleable.PlayerControlsView_has_previous, true); boolean hasNext = a.getBoolean(R.styleable.PlayerControlsView_has_next, true); boolean hasRewind = a.getBoolean(R.styleable.PlayerControlsView_has_rewind, false); boolean hasFastforward = a.getBoolean(R.styleable.PlayerControlsView_has_fastforward, false); a.recycle(); View view = LayoutInflater.from(context).inflate(layout, this, false); addView(view); View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View v) { if (mMediaInterface != null) { if (v.getId() == R.id.btn_play) { if (mMediaInterface.getPlayerController() != null) { v.setActivated(!v.isActivated()); if (v.isActivated()) mMediaInterface.getPlayerController().start(); else mMediaInterface.getPlayerController().pause(); } } else if (v.getId() == R.id.btn_speed) { onSpeedSelected(v); } else if (v.getId() == R.id.btn_timer) { onTimerSelected(v); } else if (mMediaInterface.getMediaController() != null) { if (mMediaInterface.getPlayerController() != null) { if (v.getId() == R.id.btn_previous) mMediaInterface.getPlayerController().skipToPrevious(); else if (v.getId() == R.id.btn_next) mMediaInterface.getPlayerController().skipToNext(); else if (v.getId() == R.id.btn_rewind) mMediaInterface.getPlayerController().rewind(); else if (v.getId() == R.id.btn_fastforward) mMediaInterface.getPlayerController().fastForward(); } } } } }; view.findViewById(R.id.btn_play).setOnClickListener(listener); ImageView previous = (ImageView) view.findViewById(R.id.btn_previous); ImageView next = (ImageView) view.findViewById(R.id.btn_next); ImageView rewind = (ImageView) view.findViewById(R.id.btn_rewind); ImageView fastforward = (ImageView) view.findViewById(R.id.btn_fastforward); if (previous != null) { previous.setOnClickListener(listener); previous.setVisibility(hasPrevious ? VISIBLE : GONE); } if (next != null) { next.setOnClickListener(listener); next.setVisibility(hasNext ? VISIBLE : GONE); } if (rewind != null) { rewind.setOnClickListener(listener); rewind.setVisibility(hasRewind ? VISIBLE : GONE); } if (fastforward != null) { fastforward.setOnClickListener(listener); fastforward.setVisibility(hasFastforward ? VISIBLE : GONE); } DefaultCallback.onHandleState(this, fastforward, rewind, next, previous, null); TextView speed = ((TextView) view.findViewById(R.id.btn_speed)); if (speed != null) { speed.setText(ResourceProvider.getInstance().getSelectedSpeed()); speed.setOnClickListener(listener); speed.setVisibility(View.VISIBLE); } TextView timer = (TextView) view.findViewById(R.id.btn_timer); if (timer != null) { timer.setText(ResourceProvider.getInstance().getString(ResourceProvider.TIMER)); timer.setOnClickListener(listener); } }
From source file:co.codecrunch.musicplayerlite.recyclerviewutils.ItemSelectionSupport.java
@TargetApi(HONEYCOMB) public void setViewChecked(View view, boolean checked) { if (view instanceof Checkable) { ((Checkable) view).setChecked(checked); } else if (Build.VERSION.SDK_INT >= HONEYCOMB) { view.setActivated(checked); }//from w ww.ja va 2 s .c o m }
From source file:com.hippo.widget.recyclerview.EasyRecyclerView.java
public static void setViewChecked(View view, boolean checked) { final boolean useActivated = Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB; if (view instanceof Checkable) { ((Checkable) view).setChecked(checked); } else if (useActivated) { view.setActivated(checked); }/*from w w w. j av a 2s . c o m*/ }