This commit is contained in:
h4h13 2018-11-28 11:07:10 +05:30
parent b70c66abeb
commit 6001b21c42
72 changed files with 1809 additions and 1420 deletions

View file

@ -4,6 +4,7 @@ import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;
@ -24,6 +25,10 @@ import code.name.monkey.retromusic.R;
public class CollapsingFAB extends FrameLayout {
@ColorInt
int color = Color.WHITE;
String title;
Drawable icon;
boolean showTitle;
ImageView shuffleIcon;
@ -40,13 +45,18 @@ public class CollapsingFAB extends FrameLayout {
public CollapsingFAB(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
TypedArray attributes = getContext().obtainStyledAttributes(attrs, R.styleable.CollapsingFAB, 0, 0);
icon = attributes.getDrawable(R.styleable.CollapsingFAB_setIcon);
color = attributes.getColor(R.styleable.CollapsingFAB_shuffleBackgroundColor, 0);
showTitle = attributes.getBoolean(R.styleable.CollapsingFAB_showTitle, false);
title = attributes.getString(R.styleable.CollapsingFAB_setText);
View view = inflate(context, R.layout.collapsing_floating_action_button, this);
shuffleIcon = view.findViewById(R.id.icon);
shuffleIcon.setImageDrawable(icon);
textView = view.findViewById(R.id.shuffle_text);
textView.setText(title);
textView.setVisibility(showTitle ? VISIBLE : GONE);
cardView = view.findViewById(R.id.container);
attributes.recycle();