Java Code Examples for android.support.design.widget.FloatingActionButton#setRippleColor()
The following examples show how to use
android.support.design.widget.FloatingActionButton#setRippleColor() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ComposeFabFragment.java From actor-platform with GNU Affero General Public License v3.0 | 6 votes |
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View res = inflater.inflate(R.layout.fragment_fab, container, false); FloatingActionButton fabRoot = (FloatingActionButton) res.findViewById(R.id.fab); fabRoot.setImageResource(R.drawable.ic_edit_white_24dp); fabRoot.setBackgroundTintList(new ColorStateList(new int[][]{ new int[]{android.R.attr.state_pressed}, StateSet.WILD_CARD, }, new int[]{ ActorSDK.sharedActor().style.getFabPressedColor(), ActorSDK.sharedActor().style.getFabColor(), })); fabRoot.setRippleColor(ActorSDK.sharedActor().style.getFabPressedColor()); fabRoot.setOnClickListener(v -> startActivity(new Intent(getActivity(), ComposeActivity.class))); return res; }
Example 2
Source File: DetailActivity.java From MaterializeYourApp with Apache License 2.0 | 5 votes |
private void updateBackground(FloatingActionButton fab, Palette palette) { int lightVibrantColor = palette.getLightVibrantColor(getResources().getColor(android.R.color.white)); int vibrantColor = palette.getVibrantColor(getResources().getColor(R.color.accent)); fab.setRippleColor(lightVibrantColor); fab.setBackgroundTintList(ColorStateList.valueOf(vibrantColor)); }
Example 3
Source File: DataBindingAttributeUtil.java From droidkaigi2016 with Apache License 2.0 | 4 votes |
@BindingAdapter("sessionFab") public static void setSessionFab(FloatingActionButton fab, @NonNull Session session) { fab.setRippleColor(ContextCompat.getColor(fab.getContext(), session.category.getPaleColorResId())); fab.setSelected(session.checked); }
Example 4
Source File: BaseAudioView.java From audioview with Boost Software License 1.0 | 4 votes |
protected void init(@Nullable Context context, AttributeSet attrs) { if (isInEditMode()) return; if (context != null && attrs != null) { TypedArray styleable = context.obtainStyledAttributes(attrs, R.styleable.BaseAudioView, 0, 0); mShowTitle = styleable.getBoolean(R.styleable.BaseAudioView_showTitle, true); mSelectControls = styleable.getBoolean(R.styleable.BaseAudioView_selectControls, true); mMinified = styleable.getBoolean(R.styleable.BaseAudioView_minified, false); mCustomLayoutRes = styleable.getResourceId(R.styleable.BaseAudioView_customLayout, 0); mCustomPlayIconRes = styleable.getResourceId(R.styleable.BaseAudioView_customPlayIcon, R.drawable.ic_play_arrow_white_24dp); mCustomPauseIconRes = styleable.getResourceId(R.styleable.BaseAudioView_customPauseIcon, R.drawable.ic_pause_white_24dp); if (styleable.hasValue(R.styleable.BaseAudioView_primaryColor)) mPrimaryColor = styleable.getColor(R.styleable.BaseAudioView_primaryColor, 0xFF000000); if (styleable.hasValue(R.styleable.BaseAudioView_minified) && mCustomLayoutRes != 0) { throw new RuntimeException("Minified attr should not be specified while using custom layout."); } styleable.recycle(); } int layout; if (mCustomLayoutRes != 0) { layout = mCustomLayoutRes; } else { layout = mMinified ? R.layout.audioview_min : R.layout.audioview; } View view = inflate(getContext(), layout, null); addView(view); mPlay = findViewById(R.id.play); mRewind = findViewById(R.id.rewind); mForward = findViewById(R.id.forward); if (!mSelectControls) { if (mRewind != null) mRewind.setVisibility(GONE); if (mForward != null) mForward.setVisibility(GONE); } mProgress = findViewById(R.id.progress); mIndeterminate = findViewById(R.id.indeterminate); mTitle = findViewById(R.id.title); if (mTitle != null) { mTitle.setSelected(true); mTitle.setMovementMethod(new ScrollingMovementMethod()); if (!mShowTitle) mTitle.setVisibility(GONE); } mTime = findViewById(R.id.time); mTotalTime = findViewById(R.id.total_time); mPlay.setOnClickListener(this); if (mRewind != null) mRewind.setOnClickListener(this); if (mForward != null) mForward.setOnClickListener(this); if (mPrimaryColor != 0) { mProgress.getProgressDrawable().setColorFilter(mPrimaryColor, PorterDuff.Mode.MULTIPLY); mIndeterminate.getIndeterminateDrawable().setColorFilter(mPrimaryColor, PorterDuff.Mode.SRC_ATOP); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { mProgress.getThumb().setColorFilter(mPrimaryColor, PorterDuff.Mode.SRC_ATOP); } else { Drawable thumb = ContextCompat.getDrawable(getContext(), R.drawable.thumb); if (thumb != null) { thumb.setColorFilter(mPrimaryColor, PorterDuff.Mode.SRC_ATOP); mProgress.setThumb(thumb); } } if (mPlay instanceof FloatingActionButton) { FloatingActionButton mPlayFloating = (FloatingActionButton) mPlay; mPlayFloating.setBackgroundTintList(ColorStateList.valueOf(mPrimaryColor)); mPlayFloating.setRippleColor(darkenColor(mPrimaryColor, 0.87f)); } } }
Example 5
Source File: AlarmClockActivity.java From SuntimesWidget with GNU General Public License v3.0 | 4 votes |
/** * initialize ui/views * @param context a context used to access resources */ protected void initViews(Context context) { SuntimesUtils.initDisplayStrings(context); Toolbar menuBar = (Toolbar) findViewById(R.id.app_menubar); setSupportActionBar(menuBar); actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); boolean showBack = getIntent().getBooleanExtra(EXTRA_SHOWBACK, false); if (!showBack) { actionBar.setHomeAsUpIndicator(R.drawable.ic_action_suntimes); } } addButton = (FloatingActionButton) findViewById(R.id.btn_add); addButton.setBackgroundTintList(SuntimesUtils.colorStateList(colorAlarmEnabled, colorDisabled, colorPressed)); addButton.setRippleColor(Color.TRANSPARENT); addButton.setOnClickListener(onFabMenuClick); addAlarmButtonLayout = findViewById(R.id.layout_btn_addAlarm); addAlarmButton = (FloatingActionButton) findViewById(R.id.btn_addAlarm); addAlarmButton.setBackgroundTintList(SuntimesUtils.colorStateList(colorPressed, colorDisabled, colorAlarmEnabled)); addAlarmButton.setRippleColor(Color.TRANSPARENT); addAlarmButton.setOnClickListener(onAddAlarmButtonClick); addNotificationButtonLayout = findViewById(R.id.layout_btn_addNotification); addNotificationButton = (FloatingActionButton) findViewById(R.id.btn_addNotification); addNotificationButton.setBackgroundTintList(SuntimesUtils.colorStateList(colorPressed, colorDisabled, colorAlarmEnabled)); addNotificationButton.setRippleColor(Color.TRANSPARENT); addNotificationButton.setOnClickListener(onAddNotificationButtonClick); collapseFabMenu(); alarmList = (ListView)findViewById(R.id.alarmList); alarmList.setOnItemClickListener(onAlarmItemClick); alarmList.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { int pos = alarmList.pointToPosition((int)event.getX(), (int)event.getY()); if ((event.getAction() == MotionEvent.ACTION_DOWN) && pos == -1) { collapseFabMenu(); setSelectedItem(-1); } return false; } }); emptyView = findViewById(android.R.id.empty); emptyView.setOnClickListener(onEmptyViewClick); }
Example 6
Source File: DataBindingAttributeUtil.java From droidkaigi2016 with Apache License 2.0 | 4 votes |
@BindingAdapter("sessionFab") public static void setSessionFab(FloatingActionButton fab, @NonNull Session session) { fab.setRippleColor(ContextCompat.getColor(fab.getContext(), session.category.getPaleColorResId())); fab.setSelected(session.checked); }
Example 7
Source File: WebViewFragment.java From 4pdaClient-plus with Apache License 2.0 | 4 votes |
public void setFabColors(final FloatingActionButton fab){ fab.setBackgroundTintList(ColorStateList.valueOf(AppTheme.getColorAccent("Accent"))); fab.setRippleColor(AppTheme.getColorAccent("Pressed")); }