List of usage examples for android.graphics Color TRANSPARENT
int TRANSPARENT
To view the source code for android.graphics Color TRANSPARENT.
Click Source Link
From source file:com.mark.quick.ui.view.swipebacklayout.SwipeBackLayout.java
/** * Activity //from w w w .java 2 s. c om * * @param activity */ void attachToActivity(Activity activity) { mActivity = activity; setSliderFadeColor(Color.TRANSPARENT); ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView(); //view mShadowView = new SwipeBackShadowView(activity); addView(mShadowView, 0, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); //??DecorViewchild ViewGroup contentView = (ViewGroup) decorView.getChildAt(0); decorView.removeView(contentView); addView(contentView, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); //??DecorViewchild decorView.addView(this, 0); }
From source file:com.freshdigitable.udonroad.StatusViewBase.java
@CallSuper public void reset() { setBackgroundColor(Color.TRANSPARENT); setRtCountVisibility(GONE);/*from w w w. j a v a 2 s . c o m*/ setFavCountVisibility(GONE); setTextColor(Color.GRAY); setTint(rtIcon, R.color.twitter_action_normal); setTint(favIcon, R.color.twitter_action_normal); icon.setImageDrawable(null); icon.setImageResource(android.R.color.transparent); icon.setOnClickListener(null); setOnClickListener(null); setUserIconClickListener(null); mediaContainer.reset(); mediaContainer.setOnMediaClickListener(null); }
From source file:edu.stanford.mobisocial.dungbeetle.model.DbObject.java
/** * @param v the view to bind/*from w ww . j a v a 2s . c o m*/ * @param context standard activity context * @param c the cursor source for the object in the db object table. * Must include _id in the projection. * * @param allowInteractions controls whether the bound view is * allowed to intercept touch events and do its own processing. */ public static void bindView(View v, final Context context, Cursor cursor, boolean allowInteractions) { TextView nameText = (TextView) v.findViewById(R.id.name_text); ViewGroup frame = (ViewGroup) v.findViewById(R.id.object_content); frame.removeAllViews(); // make sure we have all the columns we need Long objId = cursor.getLong(cursor.getColumnIndexOrThrow(DbObj.COL_ID)); String[] projection = null; String selection = DbObj.COL_ID + " = ?"; String[] selectionArgs = new String[] { Long.toString(objId) }; String sortOrder = null; Cursor c = context.getContentResolver().query(DbObj.OBJ_URI, projection, selection, selectionArgs, sortOrder); if (!c.moveToFirst()) { Log.w(TAG, "could not find obj " + objId); c.close(); return; } DbObj obj = App.instance().getMusubi().objForCursor(c); if (obj == null) { nameText.setText("Failed to access database."); Log.e("DbObject", "cursor was null for bindView of DbObject"); return; } DbUser sender = obj.getSender(); Long timestamp = c.getLong(c.getColumnIndexOrThrow(DbObj.COL_TIMESTAMP)); Long hash = obj.getHash(); short deleted = c.getShort(c.getColumnIndexOrThrow(DELETED)); String feedName = obj.getFeedName(); String type = obj.getType(); Date date = new Date(timestamp); c.close(); c = null; if (sender == null) { nameText.setText("Message from unknown contact."); return; } nameText.setText(sender.getName()); final ImageView icon = (ImageView) v.findViewById(R.id.icon); if (sViewProfileAction == null) { sViewProfileAction = new OnClickViewProfile((Activity) context); } icon.setTag(sender.getLocalId()); if (allowInteractions) { icon.setOnClickListener(sViewProfileAction); v.setTag(objId); } icon.setImageBitmap(sender.getPicture()); if (deleted == 1) { v.setBackgroundColor(sDeletedColor); } else { v.setBackgroundColor(Color.TRANSPARENT); } TextView timeText = (TextView) v.findViewById(R.id.time_text); timeText.setText(RelativeDate.getRelativeDate(date)); frame.setTag(objId); // TODO: error prone! This is database id frame.setTag(R.id.object_entry, cursor.getPosition()); // this is cursor id FeedRenderer renderer = DbObjects.getFeedRenderer(type); if (renderer != null) { renderer.render(context, frame, obj, allowInteractions); } if (!allowInteractions) { v.findViewById(R.id.obj_attachments_icon).setVisibility(View.GONE); v.findViewById(R.id.obj_attachments).setVisibility(View.GONE); } else { if (!MusubiBaseActivity.isDeveloperModeEnabled(context)) { v.findViewById(R.id.obj_attachments_icon).setVisibility(View.GONE); v.findViewById(R.id.obj_attachments).setVisibility(View.GONE); } else { ImageView attachmentCountButton = (ImageView) v.findViewById(R.id.obj_attachments_icon); TextView attachmentCountText = (TextView) v.findViewById(R.id.obj_attachments); attachmentCountButton.setVisibility(View.VISIBLE); if (hash == 0) { attachmentCountButton.setVisibility(View.GONE); } else { //int color = DbObject.colorFor(hash); boolean selfPost = false; DBHelper helper = new DBHelper(context); try { Cursor attachments = obj.getSubfeed().query("type=?", new String[] { LikeObj.TYPE }); try { attachmentCountText.setText("+" + attachments.getCount()); if (attachments.moveToFirst()) { while (!attachments.isAfterLast()) { if (attachments.getInt(attachments.getColumnIndex(CONTACT_ID)) == -666) { selfPost = true; break; } attachments.moveToNext(); } } } finally { attachments.close(); } } finally { helper.close(); } if (selfPost) { attachmentCountButton.setImageResource(R.drawable.ic_menu_love_red); } else { attachmentCountButton.setImageResource(R.drawable.ic_menu_love); } attachmentCountText.setTag(R.id.object_entry, hash); attachmentCountText.setTag(R.id.feed_label, Feed.uriForName(feedName)); attachmentCountText.setOnClickListener(LikeListener.getInstance(context)); } } } }
From source file:com.jecelyin.editor.v2.ui.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); pref = Pref.getInstance(this); MenuManager.init(this); setContentView(R.layout.main_activity); L.d(TAG, "onCreate"); CrashDbHelper.getInstance(this).close(); //? mToolbar = (Toolbar) findViewById(R.id.toolbar); mLoadingLayout = (LinearLayout) findViewById(R.id.loading_layout); mTabPager = (TabViewPager) findViewById(R.id.tab_pager); mMenuRecyclerView = (RecyclerView) findViewById(R.id.menuRecyclerView); mDrawerLayout = (AnyDrawerLayout) findViewById(R.id.drawer_layout); mTabRecyclerView = (RecyclerView) findViewById(R.id.tabRecyclerView); mVersionTextView = (TextView) findViewById(R.id.versionTextView); findViewById(R.id.changeThemeBtn).setOnClickListener(new View.OnClickListener() { @Override/*from ww w .j a va2 s .c om*/ public void onClick(View v) { new ChangeThemeDialog(getContext()).show(); } }); SymbolBarLayout symbolBarLayout = (SymbolBarLayout) findViewById(R.id.symbolBarLayout); symbolBarLayout.setOnSymbolCharClickListener(new SymbolBarLayout.OnSymbolCharClickListener() { @Override public void onClick(View v, String text) { insertText(text); } }); if (!AppUtils.verifySign(getContext())) { UIUtils.showConfirmDialog(getContext(), getString(R.string.verify_sign_failure), new UIUtils.OnClickCallback() { @Override public void onOkClick() { SysUtils.startWebView(getContext(), "https://github.com/jecelyin/920-text-editor-v2/releases"); } }); } setStatusBarColor(mDrawerLayout); bindPreferences(); setScreenOrientation(); mDrawerLayout.setEnabled(false); mDrawerLayout.setScrimColor(Color.TRANSPARENT); String version = SysUtils.getVersionName(this); mVersionTextView.setText(version); if (savedInstanceState == null && pref.isAutoCheckUpdates()) { new CheckUpgradeTask(this).checkVersion(version); } if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_DENIED || ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_DENIED) { requestWriteExternalStoragePermission(); } else { start(); } }
From source file:com.nextgis.maplibui.formcontrol.Sign.java
public void save(int width, int height, boolean transparentBackground, File sigFile) throws IOException { if (mNotInitialized) return;/* w w w .ja va 2 s. c o m*/ float scale = Math.min((float) width / getWidth(), (float) height / getHeight()); Matrix matrix = new Matrix(); matrix.setScale(scale, scale); Bitmap bmp = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bmp); canvas.setMatrix(matrix); int color = transparentBackground ? Color.TRANSPARENT : 0xFFFFFF - mPaint.getColor(); drawSign(canvas, color, mPaint); if (sigFile.exists() || sigFile.createNewFile()) { FileOutputStream out = new FileOutputStream(sigFile); bmp.compress(Bitmap.CompressFormat.PNG, 90, out); } }
From source file:com.blestep.sportsbracelet.view.TimelineChartViewSleep.java
private void init(Context ctx, AttributeSet attrs, int defStyleAttr) { mUiHandler = new Handler(Looper.getMainLooper(), mMessenger); final Resources res = getResources(); final ViewConfiguration vc = ViewConfiguration.get(ctx); mTouchSlop = vc.getScaledTouchSlop() / 2; mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity(); mScroller = new OverScroller(ctx); int footerLabelColor = ContextCompat.getColor(getContext(), R.color.tlcSleepFooterLabelColor); int barItemBg = ContextCompat.getColor(getContext(), R.color.tlcSleepBarItemBg); int highlightBarItemBg = ContextCompat.getColor(getContext(), R.color.tlcSleepHighlightBarItemBg); int barDeepItemBg = ContextCompat.getColor(getContext(), R.color.tlcSleepBarDeepItemBg); int highlightBarDeepItemBg = ContextCompat.getColor(getContext(), R.color.tlcSleepHighlightBarDeepItemBg); mBarItemBgPaint = new Paint(); mBarItemBgPaint.setColor(barItemBg); mHighlightBarItemBgPaint = new Paint(); mHighlightBarItemBgPaint.setColor(highlightBarItemBg); mBarDeepItemBgPaint = new Paint(); mBarDeepItemBgPaint.setColor(barDeepItemBg); mHighlightBarDeepItemBgPaint = new Paint(); mHighlightBarDeepItemBgPaint.setColor(highlightBarDeepItemBg); mFooterBarHeight = res.getDimension(R.dimen.tlcDefFooterBarHeight); mViewAreaBgPaint = new Paint(); mGraphAreaBgPaint = new Paint(); mGraphAreaBgPaint.setColor(Color.TRANSPARENT); mFooterAreaBgPaint = new Paint(); mFooterAreaBgPaint.setColor(Color.TRANSPARENT); mGraphBottomLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mGraphBottomLinePaint.setColor(Color.WHITE); mGraphBottomLinePaint.setStrokeWidth(1); // labelPaint?? mLabelFgPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.LINEAR_TEXT_FLAG); mLabelFgPaint.setColor(footerLabelColor); // DisplayMetrics dp = getResources().getDisplayMetrics(); // float labelSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, res.getDimension(R.dimen.tlcDefFooterLabelSize), dp); mLabelFgPaint.setTextSize(res.getDimension(R.dimen.tlcDefFooterLabelSize)); mHighlightLabelFgPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.LINEAR_TEXT_FLAG); mHighlightLabelFgPaint.setColor(Color.WHITE); mHighlightLabelFgPaint.setTextSize(res.getDimension(R.dimen.tlcDefFooterLabelSize)); mBarItemWidth = res.getDimension(R.dimen.tlcDefBarItemWidth); mBarItemSpace = res.getDimension(R.dimen.tlcDefBarItemSpace); mTopSpaceHeight = res.getDimension(R.dimen.tlcDefTopSpace); // SurfaceView requires a background if (getBackground() == null) { setBackgroundColor(ContextCompat.getColor(getContext(), android.R.color.transparent)); }/*w w w . java 2 s. c o m*/ // Initialize stuff setupBackgroundHandler(); setupTickLabels(); // Initialize the drawing refs (this will be update when we have // the real size of the canvas) computeBoundAreas(); }
From source file:com.lizhi.library.widget.WechatTab.java
private void setTabsValue() { DisplayMetrics dm = getResources().getDisplayMetrics(); // Tab?// www.j av a2 s . c o m setShouldExpand(true); // Tab? setDividerColor(Color.TRANSPARENT); // Tab setUnderlineHeight((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, dm)); // Tab Indicator setIndicatorHeight((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 3, dm)); // Tab? setTextSize((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 16, dm)); // Tab Indicator //TODO // setIndicatorColor(getResources().getColor(R.color.theme_color)); // Tab () //TODO // setSelectedTextColor(getResources().getColor(R.color.theme_color)); // ?Tab setTabBackground(0); }
From source file:com.kksmartcontrol.view.pagersliding.PagerSlidingTabStrip.java
/** * PagerSlidingTabStrip?/*from w ww .j a v a 2s . c om*/ */ public void setTabsValue(DisplayMetrics displayMetrics) { // Tab? setShouldExpand(true); // Tab? setDividerColor(Color.TRANSPARENT); // Tab setUnderlineHeight((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, displayMetrics)); // Tab Indicator setIndicatorHeight((int) (TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, displayMetrics) / 1.5)); // Tab? setTextSize((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 16, displayMetrics)); // Tab Indicator setIndicatorColor(Color.parseColor("#45c01a")); // Tab () setSelectedTextColor(Color.parseColor("#45c01a")); // Tab setTabBackground(0); }
From source file:com.nttec.everychan.ui.tabs.TabsAdapter.java
@Override public View getView(final int position, View convertView, ViewGroup parent) { View view = convertView == null ? inflater.inflate(R.layout.sidebar_tabitem, parent, false) : convertView; View dragHandler = view.findViewById(R.id.tab_drag_handle); ImageView favIcon = (ImageView) view.findViewById(R.id.tab_favicon); TextView title = (TextView) view.findViewById(R.id.tab_text_view); ImageView closeBtn = (ImageView) view.findViewById(R.id.tab_close_button); dragHandler.getLayoutParams().width = position == draggingItem ? ViewGroup.LayoutParams.WRAP_CONTENT : 0; dragHandler.setLayoutParams(dragHandler.getLayoutParams()); if (position == selectedItem) { TypedValue typedValue = ThemeUtils.resolveAttribute(context.getTheme(), R.attr.sidebarSelectedItem, true);// w w w . j a v a2 s . c o m if (typedValue.type >= TypedValue.TYPE_FIRST_COLOR_INT && typedValue.type <= TypedValue.TYPE_LAST_COLOR_INT) { view.setBackgroundColor(typedValue.data); } else { view.setBackgroundResource(typedValue.resourceId); } } else { view.setBackgroundColor(Color.TRANSPARENT); } TabModel model = this.getItem(position); switch (model.type) { case TabModel.TYPE_NORMAL: case TabModel.TYPE_LOCAL: closeBtn.setVisibility(View.VISIBLE); String titleText = model.title; if (model.unreadPostsCount > 0 || model.autoupdateError) { StringBuilder titleStringBuilder = new StringBuilder(); if (model.unreadSubscriptions) titleStringBuilder.append("[*] "); if (model.autoupdateError) titleStringBuilder.append("[X] "); if (model.unreadPostsCount > 0) titleStringBuilder.append('[').append(model.unreadPostsCount).append("] "); titleText = titleStringBuilder.append(titleText).toString(); } title.setText(titleText); ChanModule chan = MainApplication.getInstance().getChanModule(model.pageModel.chanName); Drawable icon = chan != null ? chan.getChanFavicon() : ResourcesCompat.getDrawable(context.getResources(), android.R.drawable.ic_delete, null); if (icon != null) { if (model.type == TabModel.TYPE_LOCAL) { Drawable[] layers = new Drawable[] { icon, ResourcesCompat.getDrawable(context.getResources(), R.drawable.favicon_overlay_local, null) }; icon = new LayerDrawable(layers); } /* XXX ? ( overlay favicon ), ? ?? , , ( ). ? ? ? , , ? -? - , ?. ?? ?, ? ? . else if (model.type == TabModel.TYPE_NORMAL && model.pageModel != null && model.pageModel.type == UrlPageModel.TYPE_THREADPAGE && model.autoupdateBackground && MainApplication.getInstance().settings.isAutoupdateEnabled() && MainApplication.getInstance().settings.isAutoupdateBackground()) { Drawable[] layers = new Drawable[] { icon, ResourcesCompat.getDrawable(context.getResources(), R.drawable.favicon_overlay_autoupdate, null) }; icon = new LayerDrawable(layers); } */ favIcon.setImageDrawable(icon); favIcon.setVisibility(View.VISIBLE); } else { favIcon.setVisibility(View.GONE); } break; default: closeBtn.setVisibility(View.GONE); title.setText(R.string.error_deserialization); favIcon.setVisibility(View.GONE); } closeBtn.setTag(position); closeBtn.setOnClickListener(onCloseClick); return view; }
From source file:com.microntek.music.MusicActivity.java
private void updateVisualizerColor(int color) { if (color == Color.TRANSPARENT) { color = getResources().getColor(R.color.visualizer_fill_color); }//from w ww . j ava 2 s . c o m // check for null since updatestatusBarColor is a async task AudioPlayerFragment fragment = getAudioPlayerFragment(); if (fragment != null) { fragment.setVisualizerColor(color); } }