updated
This commit is contained in:
parent
a3a4618769
commit
7a42723b9e
103 changed files with 1879 additions and 1195 deletions
|
@ -1,95 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Hemanth Savarala.
|
||||
*
|
||||
* Licensed under the GNU General Public License v3
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package code.name.monkey.retromusic.views;
|
||||
|
||||
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;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.google.android.material.card.MaterialCardView;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.transition.AutoTransition;
|
||||
import androidx.transition.TransitionManager;
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil;
|
||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper;
|
||||
import code.name.monkey.retromusic.R;
|
||||
|
||||
public class CollapsingFAB extends FrameLayout {
|
||||
@ColorInt
|
||||
int color = Color.WHITE;
|
||||
|
||||
String title;
|
||||
Drawable icon;
|
||||
|
||||
boolean showTitle;
|
||||
|
||||
ImageView shuffleIcon;
|
||||
TextView textView;
|
||||
MaterialCardView cardView;
|
||||
|
||||
public CollapsingFAB(@NonNull Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public CollapsingFAB(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
public void setShowTitle(boolean showTitle) {
|
||||
this.showTitle = showTitle;
|
||||
TransitionManager.beginDelayedTransition(this, new AutoTransition());
|
||||
textView.setVisibility(showTitle ? VISIBLE : GONE);
|
||||
invalidate();
|
||||
requestLayout();
|
||||
}
|
||||
|
||||
public void setColor(int color) {
|
||||
this.color = color;
|
||||
int textColor = MaterialValueHelper.INSTANCE.getPrimaryTextColor(getContext(), ColorUtil.INSTANCE.isColorLight(color));
|
||||
shuffleIcon.setColorFilter(textColor);
|
||||
textView.setTextColor(textColor);
|
||||
cardView.setCardBackgroundColor(ColorStateList.valueOf(color));
|
||||
postInvalidate();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Hemanth Savarala.
|
||||
*
|
||||
* Licensed under the GNU General Public License v3
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package code.name.monkey.retromusic.views;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.webkit.WebView;
|
||||
|
||||
public class LollipopFixedWebView extends WebView {
|
||||
public LollipopFixedWebView(Context context) {
|
||||
super(getFixedContext(context));
|
||||
}
|
||||
|
||||
public LollipopFixedWebView(Context context, AttributeSet attrs) {
|
||||
super(getFixedContext(context), attrs);
|
||||
}
|
||||
|
||||
public LollipopFixedWebView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(getFixedContext(context), attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
public LollipopFixedWebView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(getFixedContext(context), attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
||||
public LollipopFixedWebView(Context context, AttributeSet attrs, int defStyleAttr, boolean privateBrowsing) {
|
||||
super(getFixedContext(context), attrs, defStyleAttr, privateBrowsing);
|
||||
}
|
||||
|
||||
public static Context getFixedContext(Context context) {
|
||||
return context.createConfigurationContext(new Configuration());
|
||||
}
|
||||
}
|
|
@ -18,6 +18,9 @@ import android.content.Context;
|
|||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.glide.GlideApp;
|
||||
|
||||
|
@ -26,26 +29,26 @@ import code.name.monkey.retromusic.glide.GlideApp;
|
|||
*/
|
||||
public class NetworkImageView extends CircularImageView {
|
||||
|
||||
public NetworkImageView(Context context) {
|
||||
public NetworkImageView(@NonNull Context context) {
|
||||
super(context);
|
||||
init(context, null);
|
||||
}
|
||||
|
||||
public NetworkImageView(Context context, AttributeSet attrs) {
|
||||
public NetworkImageView(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
init(context, attrs);
|
||||
}
|
||||
|
||||
public NetworkImageView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
public NetworkImageView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init(context, attrs);
|
||||
}
|
||||
|
||||
public void setImageUrl(String imageUrl) {
|
||||
public void setImageUrl(@NonNull String imageUrl) {
|
||||
setImageUrl(getContext(), imageUrl);
|
||||
}
|
||||
|
||||
public void setImageUrl(Context context, String imageUrl) {
|
||||
public void setImageUrl(@NonNull Context context, @NonNull String imageUrl) {
|
||||
GlideApp.with(context)
|
||||
.load(imageUrl)
|
||||
.error(R.drawable.ic_person_flat)
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Copyright (c) 2019 Hemanth Savarala.
|
||||
*
|
||||
* Licensed under the GNU General Public License v3
|
||||
*
|
||||
* This is free software: you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
package code.name.monkey.retromusic.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import code.name.monkey.appthemehelper.ThemeStore;
|
||||
import code.name.monkey.appthemehelper.util.ATHUtil;
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil;
|
||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper;
|
||||
import code.name.monkey.retromusic.R;
|
||||
|
||||
/**
|
||||
* Created by hemanths on 3/23/19
|
||||
*/
|
||||
public class OptionMenuItemView extends FrameLayout {
|
||||
|
||||
public OptionMenuItemView(@NonNull Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public OptionMenuItemView(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, -1);
|
||||
}
|
||||
|
||||
public OptionMenuItemView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
this(context, attrs, defStyleAttr, -1);
|
||||
}
|
||||
|
||||
public OptionMenuItemView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
inflate(context, R.layout.item_option_menu, this);
|
||||
|
||||
setBackgroundTintList(ColorStateList.valueOf(ThemeStore.Companion.accentColor(context)));
|
||||
|
||||
TextView textView = findViewById(R.id.title);
|
||||
textView.setTextColor(MaterialValueHelper.INSTANCE.getPrimaryTextColor(context, ColorUtil.INSTANCE.isColorLight(ThemeStore.Companion.primaryColor(context))));
|
||||
IconImageView iconImageView = findViewById(R.id.icon);
|
||||
|
||||
TypedArray attributes = context.obtainStyledAttributes(attrs, R.styleable.OptionMenuItemView, 0, 0);
|
||||
|
||||
String title = attributes.getString(R.styleable.OptionMenuItemView_optionTitle);
|
||||
textView.setText(title);
|
||||
|
||||
Drawable icon = attributes.getDrawable(R.styleable.OptionMenuItemView_optionIcon);
|
||||
iconImageView.setImageDrawable(icon);
|
||||
|
||||
attributes.recycle();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue