List of usage examples for android.view View setBackgroundColor
@RemotableViewMethod public void setBackgroundColor(@ColorInt int color)
From source file:com.z299studio.pb.DetailFragment.java
private void setupToolbar(View rootView, String title) { Toolbar toolbar;//from w w w . j a v a2 s.co m TextView titleView; toolbar = (Toolbar) rootView.findViewById(R.id.toolbar); View close = rootView.findViewById(R.id.close); close.setOnClickListener(this); View header = rootView.findViewById(R.id.header); ImageButton fab = (ImageButton) rootView.findViewById(R.id.fab); if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) { LayerDrawable background = (LayerDrawable) fab.getBackground(); background.getDrawable(1).setColorFilter(C.ThemedColors[C.colorAccent], PorterDuff.Mode.SRC_ATOP); } fab.setOnClickListener(this); header.setBackgroundColor(mColor); titleView = (TextView) rootView.findViewById(android.R.id.title); titleView.setText(title); // Elevation to minus 1 so that fab would not be covered on 5.0 float elevation = getResources().getDimension(R.dimen.fab_small_elevation) - 0.5f; ViewCompat.setElevation(header, elevation); if (rootView.findViewById(R.id.frame_box) == null) { MainActivity ma = (MainActivity) getActivity(); ma.setStatusBarColor(mColor, 200, false); } toolbar.inflateMenu(R.menu.menu_detail); toolbar.getMenu().getItem(0).getIcon().setColorFilter(C.ThemedColors[C.colorTextNormal], PorterDuff.Mode.SRC_ATOP); toolbar.setOnMenuItemClickListener(this); }
From source file:com.cssweb.android.quote.QHSCGridActivity.java
public void setSelectRow(int paramInt) throws Exception { LinearLayout localLinearLayout1 = this.mLinerLock; Integer localInteger1 = Integer.valueOf(this.m_nPos); View localView1 = localLinearLayout1.findViewWithTag(localInteger1); if (localView1 != null) { int l = this.residCol; localView1.setBackgroundResource(l); }/* w w w. j a v a2 s. c o m*/ LinearLayout localLinearLayout2 = this.mLinerLock; Integer localInteger2 = Integer.valueOf(paramInt); View localView2 = localLinearLayout2.findViewWithTag(localInteger2); if (localView2 != null) { int i1 = this.residSelColor; localView2.setBackgroundColor(i1); } if (true) { LinearLayout localLinerLock = this.mLinerLock2; Integer localLockInteger = Integer.valueOf(this.m_nPos); View localLockView = localLinerLock.findViewWithTag(localLockInteger); if (localLockView != null) { int l = this.residCol; localLockView.setBackgroundResource(l); } LinearLayout localLinerLock2 = this.mLinerLock2; Integer localLockInteger2 = Integer.valueOf(paramInt); View localLockView2 = localLinerLock2.findViewWithTag(localLockInteger2); if (localLockView2 != null) { int i1 = this.residSelColor; localLockView2.setBackgroundColor(i1); } } LinearLayout localLinearLayout3 = this.mLinerHScroll; Integer localInteger3 = Integer.valueOf(this.m_nPos); LinearLayout localLinearLayout4 = (LinearLayout) localLinearLayout3.findViewWithTag(localInteger3); if (localLinearLayout4 != null) { int i3 = localLinearLayout4.getChildCount(); for (int i = 0; i < i3; i++) { View localView3 = localLinearLayout4.getChildAt(i); int i0 = 0; if (i == i3 - 1) i0 = this.residScrollCol[2]; else if (i == 13) i0 = this.residScrollCol[1]; else if (i % 2 == 0) i0 = this.residScrollCol[0]; else i0 = this.residScrollCol[1]; localView3.setBackgroundResource(i0); } } LinearLayout localLinearLayout5 = this.mLinerHScroll; Integer localInteger4 = Integer.valueOf(paramInt); LinearLayout localLinearLayout6 = (LinearLayout) localLinearLayout5.findViewWithTag(localInteger4); if (localLinearLayout6 != null) { int i4 = this.residSelColor; localLinearLayout6.setBackgroundColor(i4); } int i6 = localLinearLayout6.getChildCount(); for (int i = 0; i < i6; i++) { View localView6 = localLinearLayout6.getChildAt(i); int i10 = this.residSelColor; localView6.setBackgroundColor(i10); } this.m_nPos = paramInt; if (null != stringList && stringList.size() > paramInt && null != temp2[m_nPos - 1] && !"".equals(temp2[m_nPos - 1]) && null != temp1[m_nPos - 1] && !"".equals(temp1[m_nPos - 1]) && temp1[m_nPos - 1].length() > 2) { Log.i("tag", "stringList.length" + stringList.size() + " : paramInt : " + paramInt); String[] data = stringList.get(paramInt - 1); String market = data[data.length - 2]; cssStock = new CssStock(); cssStock.setStkcode(temp1[m_nPos - 1].substring(2)); // cssStock.setStkname(temp2[m_nPos - 1]); cssStock.setMarket(market); } // this.cssStock = list.get(paramInt - 1); }
From source file:com.hbm.devices.scan.ui.android.DetailsFiller.java
private void addRule(LinearLayout layout) { final View rule = new View(activity); final LinearLayout.LayoutParams viewLp = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, activity.getResources().getDimensionPixelSize(R.dimen.rule_height)); viewLp.setMargins(activity.getResources().getDimensionPixelSize(R.dimen.device_info_padding_left), activity.getResources().getDimensionPixelSize(R.dimen.device_info_padding_top), 0, 0); rule.setLayoutParams(viewLp);//from ww w . j a v a2 s.c o m rule.setBackgroundColor(ContextCompat.getColor(activity, R.color.details_horizontal_rule_color)); layout.addView(rule); }
From source file:com.evandroid.musica.fragment.LocalLyricsFragment.java
@Override public void onActivityCreated(Bundle onSavedInstanceState) { super.onActivityCreated(onSavedInstanceState); if (megaListView != null) { View fragmentView = getView(); TypedValue typedValue = new TypedValue(); getActivity().getTheme().resolveAttribute(android.R.attr.colorBackground, typedValue, true); if (fragmentView != null) fragmentView.setBackgroundColor(typedValue.data); megaListView.setDividerHeight(0); megaListView.setFastScrollEnabled(true); megaListView.setDrawSelectorOnTop(true); }// www. j a v a 2 s. co m }
From source file:org.gnucash.android.ui.accounts.AccountsListFragment.java
/** * De-selects the previously selected item in a ListView. * Only one account entry can be highlighted at a time, so the previously selected * one is deselected. /*from w w w . jav a 2 s . co m*/ */ private void deselectPreviousSelectedItem() { if (mSelectedViewPosition >= 0) { ListView lv = getListView(); lv.setItemChecked(mSelectedViewPosition, false); View v = getListView().getChildAt(mSelectedViewPosition - lv.getFirstVisiblePosition()); if (v == null) { //if we just deleted a row, then the previous position is invalid return; } v.setBackgroundColor(getResources().getColor(android.R.color.transparent)); v.setSelected(false); } }
From source file:com.visual.ivi.LinkedinUserSettingsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { v = inflater.inflate(R.layout.user_settings_linkedin, container, false); loginButton = (Button) v.findViewById(R.id.linkedin_usersettingsfragment_login_button); connectedStateLabel = (TextView) v.findViewById(R.id.linkedin_usersettingsfragment_profile_name); c = Prefs.getMyUserPref(getActivity().getApplicationContext()); loginButton.setOnClickListener(new OnClickListener() { @Override//from w w w . j av a 2s . com public void onClick(View v) { Button ClickedButton = (Button) v; if (((Button) v).getText() == getResources() .getString(R.string.com_facebook_loginview_log_out_button)) { logoutSession(); } else { //Login Intent startNewActivityOpen = new Intent(getActivity(), LinkedinTask.class); getActivity().startActivityForResult(startNewActivityOpen, 1253); } } }); if (v.getBackground() == null) { v.setBackgroundColor(getResources().getColor(R.color.linkedin_gray)); } else { v.getBackground().setDither(true); } String id = Prefs.getMyUserPref(getActivity().getApplicationContext()).get_sn_linkedin(); String name = Prefs.getMyStringPref(getActivity().getApplicationContext(), "LinkedinFirstName"); String lname = Prefs.getMyStringPref(getActivity().getApplicationContext(), "LinkedinLastName"); retrievePreviousAndSetSession(id, name, lname); return v; }
From source file:im.vector.adapters.ImagesSliderAdapter.java
@Override public Object instantiateItem(ViewGroup container, final int position) { View view = mLayoutInflater.inflate(R.layout.activity_image_web_view, null, false); // hide the pie chart final PieFractionView pieFractionView = (PieFractionView) view .findViewById(R.id.download_zoomed_image_piechart); pieFractionView.setVisibility(View.GONE); final WebView webView = (WebView) view.findViewById(R.id.image_webview); // black background view.setBackgroundColor(0xFF000000); webView.setBackgroundColor(0xFF000000); final SlidableImageInfo imageInfo = mListImageMessages.get(position); String mediaUrl = imageInfo.mImageUrl; final int rotationAngle = imageInfo.mRotationAngle; final String mimeType = imageInfo.mMimeType; final MXMediasCache mediasCache = Matrix.getInstance(this.context).getMediasCache(); File mediaFile = mediasCache.mediaCacheFile(mediaUrl, mimeType); // is the high picture already downloaded ? if (null != mediaFile) { if (mHighResMediaIndex.indexOf(position) < 0) { mHighResMediaIndex.add(position); }/* www.ja va 2 s. c o m*/ } else { // try to retrieve the thumbnail mediaFile = mediasCache.mediaCacheFile(mediaUrl, mMaxImageWidth, mMaxImageHeight, null); } // the thumbnail is not yet downloaded if (null == mediaFile) { // display nothing container.addView(view, 0); return view; } String mediaUri = "file://" + mediaFile.getPath(); String css = computeCss(mediaUri, mMaxImageWidth, mMaxImageHeight, rotationAngle); final String viewportContent = "width=640"; webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setLoadWithOverviewMode(true); webView.getSettings().setUseWideViewPort(true); webView.getSettings().setBuiltInZoomControls(true); loadImage(webView, Uri.parse(mediaUri), viewportContent, css); container.addView(view, 0); return view; }
From source file:es.usc.citius.servando.calendula.fragments.MedicineCreateOrEditFragment.java
void onClickMedicine(int viewId, View rootView) { for (View v : getViewsByTag((ViewGroup) rootView, "med_type")) { v.setBackgroundColor(getResources().getColor(R.color.transparent)); }//from w ww . j a v a2 s . c o m rootView.findViewById(viewId).setBackgroundResource(R.drawable.presentation_circle_background); switch (viewId) { case R.id.med_presentation_2: selectedPresentation = Presentation.CAPSULES; Log.d(getTag(), "Capsule"); break; case R.id.med_presentation_3: selectedPresentation = Presentation.EFFERVESCENT; Log.d(getTag(), "Effervescent"); break; case R.id.med_presentation_4: selectedPresentation = Presentation.PILLS; Log.d(getTag(), "Pill"); break; case R.id.med_presentation_5: selectedPresentation = Presentation.SYRUP; Log.d(getTag(), "Syrup"); break; case R.id.med_presentation_6: selectedPresentation = Presentation.DROPS; Log.d(getTag(), "Drops"); break; case R.id.med_presentation_7: selectedPresentation = Presentation.SPRAY; Log.d(getTag(), "Spray"); break; case R.id.med_presentation_8: selectedPresentation = Presentation.INHALER; Log.d(getTag(), "Drops"); break; case R.id.med_presentation_9: selectedPresentation = Presentation.INJECTIONS; Log.d(getTag(), "Injection"); break; case R.id.med_presentation_10: selectedPresentation = Presentation.POMADE; Log.d(getTag(), "Pomade"); break; case R.id.med_presentation_11: selectedPresentation = Presentation.PATCHES; Log.d(getTag(), "Patches"); break; } if (selectedPresentation != null) { mPresentationTv.setText(selectedPresentation.getName(getResources())); } }
From source file:org.anurag.fragments.SdCardPanel.java
@Override public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) { // TODO Auto-generated method stub item = adapter_list.get(position);//w ww. j a v a 2s . c o m if (Constants.LONG_CLICK[2]) { if (ITEMS[position] != 1) { ITEMS[position] = 1; arg1.setBackgroundColor(getResources().getColor(R.color.white_grey)); ++counter; //updating folder and file count while long press is active.... if (item.isDirectory()) folder_count++; else file_count++; getActivity().sendBroadcast(new Intent("update_action_bar_long_click")); } else if (ITEMS[position] == 1) { ITEMS[position] = 0; arg1.setBackgroundColor(Color.WHITE); //updating folder and file count while long press is active.... if (item.isDirectory()) folder_count--; else file_count--; if (--counter == 0) getActivity().sendBroadcast(new Intent("inflate_normal_menu")); else getActivity().sendBroadcast(new Intent("update_action_bar_long_click")); } return; } if (item.isLocked()) { new MasterPassword(getActivity(), item, null, Constants.MODES.OPEN, null); return; } open_locked_item(); }
From source file:com.geekandroid.sdk.base.BaseActivity.java
@Override public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN://start to touch the view if (v.getBackground() != null) { /**//from w w w.j a v a 2s. co m * set background is color */ if ((v.getBackground() instanceof ColorDrawable)) { v.setTag(((ColorDrawable) v.getBackground()).getColor()); v.setBackgroundColor(getResources().getColor(android.R.color.darker_gray)); } else { /** * set background is drawable if you want change saturationby use variable */ v.setTag(""); colorMatrix.setSaturation(saturation); colorMatrixColorFilter = new ColorMatrixColorFilter(colorMatrix); v.getBackground().setColorFilter(colorMatrixColorFilter); } } /** * have not set background */ else { v.setBackgroundColor(getResources().getColor(android.R.color.darker_gray)); v.setTag(null); } break; case MotionEvent.ACTION_UP://when the finger leave the screen case MotionEvent.ACTION_CANCEL://cancel the action /** * retrieve background is color */ if (v.getTag() instanceof Integer) { v.setBackgroundColor((Integer) v.getTag()); } else if (v.getTag() instanceof String) { colorMatrix.setSaturation(1); colorMatrixColorFilter = new ColorMatrixColorFilter(colorMatrix); v.getBackground().setColorFilter(colorMatrixColorFilter); } else { v.setBackgroundColor(getResources().getColor(android.R.color.transparent)); } v.setTag(null); break; default: break; } mGestureDetector.onTouchEvent(event); return false; }