List of usage examples for android.view View setBackgroundColor
@RemotableViewMethod public void setBackgroundColor(@ColorInt int color)
From source file:im.vector.adapters.RoomAdapter.java
@Override protected RecyclerView.ViewHolder createSubViewHolder(ViewGroup viewGroup, int viewType) { final LayoutInflater inflater = LayoutInflater.from(viewGroup.getContext()); View itemView; if (viewType == TYPE_HEADER_PUBLIC_ROOM) { //TODO replace by a empty view ? itemView = inflater.inflate(R.layout.adapter_section_header_public_room, viewGroup, false); itemView.setBackgroundColor(Color.MAGENTA); return new HeaderViewHolder(itemView); } else {/*from w w w.ja v a2s . c om*/ switch (viewType) { case TYPE_ROOM: itemView = inflater.inflate(R.layout.adapter_item_room_view, viewGroup, false); return new RoomViewHolder(itemView); case TYPE_PUBLIC_ROOM: itemView = inflater.inflate(R.layout.adapter_item_public_room_view, viewGroup, false); return new PublicRoomViewHolder(itemView); } } return null; }
From source file:net.binaryparadox.kerplapp.AppListFragment.java
@TargetApi(11) // TODO replace with appcompat-v7 @Override/* w w w . j a va 2 s . c om*/ public void onListItemClick(ListView l, View v, int position, long id) { if (mActionMode == null) mActionMode = appSelectActivity.startActionMode(appSelectActivity.mActionModeCallback); AppEntry appEntry = (AppEntry) adapter.getItem(position); appEntry.setEnabled(!appEntry.isEnabled()); if (appEntry.isEnabled()) { FDroidApp.selectedApps.add(appEntry.getPackageName()); v.setBackgroundColor(getResources().getColor(R.color.app_selected)); } else { FDroidApp.selectedApps.remove(appEntry.getPackageName()); v.setBackgroundColor(getResources().getColor(android.R.color.background_dark)); } }
From source file:de.tum.in.tumcampusapp.fragments.SettingsFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); // Set the default white background in the view so as to avoid transparency view.setBackgroundColor(Color.WHITE); }
From source file:com.chess.genesis.activity.GameListOnlineFrag.java
@Override public boolean onTouch(final View v, final MotionEvent event) { if (v.getId() == R.id.game_search) v.setBackgroundColor( (event.getAction() == MotionEvent.ACTION_DOWN) ? MColors.BLUE_NEON : MColors.CLEAR); return false; }
From source file:gov.sfmta.sfpark.DetailViewActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.detailview); if (annotation == null) { Log.v(TAG, "annotation is null"); return;/* www . j a v a2 s .c o m*/ } // Set up ActionBar ActionBar ab = getSupportActionBar(); ab.setDisplayShowTitleEnabled(true); ab.setTitle(" :: " + annotation.title); ab.setIcon(R.drawable.logo_header); ab.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); ab.setDisplayHomeAsUpEnabled(true); detailName = (TextView) findViewById(R.id.detailName); detailName.setText(annotation.title.toUpperCase()); garageUse = (TextView) findViewById(R.id.usageText); garageUse.setText(annotation.subtitle); View availColor = findViewById(R.id.blockColor); availColor.setBackgroundColor( annotation.onStreet ? annotation.blockColorAvailability : annotation.garageColor); if (!annotation.onStreet) { addressLabel = (TextView) findViewById(R.id.addressText); phoneTextView = (TextView) findViewById(R.id.phoneText); addressLabel.setVisibility(View.VISIBLE); phoneTextView.setVisibility(View.VISIBLE); String str; str = annotation.allGarageData.optString("DESC") + " (" + annotation.allGarageData.optString("INTER") + ")"; if (str != null) { addressLabel.setText(str); } str = annotation.allGarageData.optString("TEL"); if (str != null) { phoneTextView.setText(str); } } listLayout = (LinearLayout) findViewById(R.id.detailLinearLayout); listLayout.setOrientation(LinearLayout.VERTICAL); try { parseHours(); parseRates(); parseInfo(); } catch (JSONException e) { e.printStackTrace(); } }
From source file:com.hao.common.adapter.BaseViewHolderHelper.java
/** * @param viewId//from ww w. j av a 2 s . co m * @param color * @return */ public BaseViewHolderHelper setBackgroundColor(@IdRes int viewId, int color) { View view = getView(viewId); view.setBackgroundColor(color); return this; }
From source file:com.hao.common.adapter.BaseViewHolderHelper.java
/** * @param viewId/*from ww w . j a va 2s. c om*/ * @param colorResId ?id * @return */ public BaseViewHolderHelper setBackgroundColorRes(@IdRes int viewId, @ColorRes int colorResId) { View view = getView(viewId); view.setBackgroundColor(mContext.getResources().getColor(colorResId)); return this; }
From source file:com.glacialsoftware.googolplex.GoogolplexPreferenceFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = super.onCreateView(inflater, container, savedInstanceState); TypedValue typedValue = new TypedValue(); getActivity().getTheme().resolveAttribute(android.R.attr.windowBackground, typedValue, true); if (typedValue.type >= TypedValue.TYPE_FIRST_COLOR_INT && typedValue.type <= TypedValue.TYPE_LAST_COLOR_INT) { int backgroundColor = typedValue.data; view.setBackgroundColor(backgroundColor); } else {/* w w w . j a v a2 s . com*/ Drawable drawable = getActivity().getResources().getDrawable(typedValue.resourceId); view.setBackgroundDrawable(drawable); } return view; }
From source file:com.repay.android.adddebt.ChoosePersonFragment.java
@Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { Friend selectedFriend = (Friend) arg1.getTag(); Log.i(TAG, selectedFriend.getName() + " selected (" + selectedFriend.getRepayID() + ")"); if (mSelectedFriends.contains(selectedFriend)) { mSelectedFriends.remove(selectedFriend); arg1.setBackgroundColor(ChoosePersonAdapter.DESELECTED_COLOUR); } else {// ww w . j a v a 2 s .c om mSelectedFriends.add(selectedFriend); arg1.setBackgroundColor(ChoosePersonAdapter.SELECTED_COLOUR); } }
From source file:com.konsula.app.gcm.MyGcmListenerService.java
private void handleGCM(Bundle bundle) { try {// www .j a v a 2 s . c o m Bundle data = bundle; String message = data.getString(TAG_MESSAGE, ""); final String doc_name = data.getString(TAG_DOC_NAME, ""); final String schedule = data.getString(TAG_SCHEDULE, ""); final String specialization = data.getString(TAG_SPECIALIZATION, ""); final String status = data.getString(TAG_STATUS, ""); String tele_uuid = data.getString(TAG_TELE_UUID, ""); String page = data.getString(TAG_PAGE, ""); String type = data.getString(TAG_TYPE, ""); if (type.equals("dialog")) { if (page.equals("teledoc-confirmed")) { CustomAlertDialogBuilder builder = new CustomAlertDialogBuilder(this, getResources().getColor(R.color.green_xxl)); View invoiceDetail = LayoutInflater.from(this).inflate(R.layout.dialog_teledoc_confirm, null); TextView textViewname = (TextView) invoiceDetail.findViewById(R.id.tvNamaDokter); TextView textViewspeciality = (TextView) invoiceDetail.findViewById(R.id.etSpeciality); TextView textViewdate = (TextView) invoiceDetail.findViewById(R.id.tvDate); TextView textViewstatus = (TextView) invoiceDetail.findViewById(R.id.text_status); TextView btnCancel = (TextView) invoiceDetail.findViewById(R.id.positive_button); btnCancel.setBackgroundColor(getResources().getColor(R.color.green_xxl)); btnCancel.setText(getResources().getString(R.string.mdtp_ok)); btnCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); textViewname.setText(doc_name); textViewspeciality.setText(specialization); textViewdate.setText(schedule); textViewstatus.setText(status.toUpperCase()); builder.setView(invoiceDetail); builder.setTitle(getResources().getString(R.string.title_teledokter)); dialog = builder.create(); dialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { // TODO Auto-generated method stub Dialog d = ((Dialog) dialog); int dividerId = d.getContext().getResources().getIdentifier("android:id/titleDivider", null, null); View divider = d.findViewById(dividerId); if (divider != null) { divider.setBackgroundColor(getResources().getColor(R.color.green_xxl)); } } }); dialog.show(); } if (page.equals("teledoc-cancel")) { CustomAlertDialogBuilder builder = new CustomAlertDialogBuilder(this, getResources().getColor(R.color.green_xxl)); View invoiceDetail = LayoutInflater.from(this).inflate(R.layout.dialog_teledoc_cancel_confirm, null); TextView textView = (TextView) invoiceDetail.findViewById(R.id.message); TextView btnCancel = (TextView) invoiceDetail.findViewById(R.id.positive_button); btnCancel.setBackgroundColor(getResources().getColor(R.color.green_xxl)); btnCancel.setText(getResources().getString(R.string.mdtp_ok)); btnCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); textView.setText(getResources().getString(R.string.text_teledoc_cancel)); builder.setView(invoiceDetail); builder.setTitle(getResources().getString(R.string.title_teledokter)); dialog = builder.create(); dialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { // TODO Auto-generated method stub Dialog d = ((Dialog) dialog); int dividerId = d.getContext().getResources().getIdentifier("android:id/titleDivider", null, null); View divider = d.findViewById(dividerId); if (divider != null) { divider.setBackgroundColor(getResources().getColor(R.color.green_xxl)); } } }); dialog.show(); } if (page.equals("teledoc-reschedule")) { CustomAlertDialogBuilder builder = new CustomAlertDialogBuilder(this, getResources().getColor(R.color.green_xxl)); View invoiceDetail = LayoutInflater.from(this).inflate(R.layout.dialog_teledoc_cancel_confirm, null); TextView textView = (TextView) invoiceDetail.findViewById(R.id.message); TextView btnCancel = (TextView) invoiceDetail.findViewById(R.id.positive_button); btnCancel.setBackgroundColor(getResources().getColor(R.color.green_xxl)); btnCancel.setText(getResources().getString(R.string.mdtp_ok)); btnCancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); } }); textView.setText(getResources().getString(R.string.text_reschedule_information)); builder.setView(invoiceDetail); builder.setTitle(getResources().getString(R.string.title_teledokter)); dialog = builder.create(); dialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { // TODO Auto-generated method stub Dialog d = ((Dialog) dialog); int dividerId = d.getContext().getResources().getIdentifier("android:id/titleDivider", null, null); View divider = d.findViewById(dividerId); if (divider != null) { divider.setBackgroundColor(getResources().getColor(R.color.green_xxl)); } } }); dialog.show(); } } else if (type.equals("intent") && (page.equals("teledoc-confirmation-reschedule"))) { Intent intent = new Intent(this, TeledocRescheduleActivity.class); intent.putExtra(TeledocRescheduleActivity.TAG_TELE_UUID, tele_uuid); intent.putExtra(TeledocRescheduleActivity.TAG_DOC_NAME, doc_name); intent.putExtra(TeledocRescheduleActivity.TAG_DOC_SPECIALIZATION, specialization); intent.putExtra(TeledocRescheduleActivity.TAG_DOC_SCHEDULE, schedule); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); } } catch (Exception e) { Log.e("ee", e.getMessage()); Log.e("ee", String.valueOf(e)); } }