Added copyrights
This commit is contained in:
parent
168471cf04
commit
427f01895d
123 changed files with 1563 additions and 330 deletions
|
@ -1,36 +0,0 @@
|
|||
package code.name.monkey.retromusic.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||
|
||||
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.NavigationViewUtil;
|
||||
import code.name.monkey.retromusic.R;
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil;
|
||||
|
||||
public class BottomNavigationBarTinted extends BottomNavigationView {
|
||||
public BottomNavigationBarTinted(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public BottomNavigationBarTinted(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public BottomNavigationBarTinted(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
setLabelVisibilityMode(PreferenceUtil.getInstance().getTabTitleMode());
|
||||
setBackgroundColor(ThemeStore.Companion.primaryColor(context));
|
||||
setSelectedItemId(PreferenceUtil.getInstance().getLastPage());
|
||||
|
||||
int iconColor = ATHUtil.INSTANCE.resolveColor(context, R.attr.iconColor);
|
||||
int accentColor = ThemeStore.Companion.accentColor(context);
|
||||
NavigationViewUtil.INSTANCE.setItemIconColors(this, ColorUtil.INSTANCE.withAlpha(iconColor, 0.5f), accentColor);
|
||||
NavigationViewUtil.INSTANCE.setItemTextColors(this, ColorUtil.INSTANCE.withAlpha(iconColor, 0.5f), accentColor);
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package code.name.monkey.retromusic.views
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
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.NavigationViewUtil
|
||||
import code.name.monkey.retromusic.R
|
||||
import code.name.monkey.retromusic.util.PreferenceUtil
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
|
||||
class BottomNavigationBarTinted @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) :
|
||||
BottomNavigationView(context, attrs, defStyleAttr) {
|
||||
|
||||
init {
|
||||
labelVisibilityMode = PreferenceUtil.getInstance().tabTitleMode
|
||||
setBackgroundColor(ThemeStore.primaryColor(context))
|
||||
selectedItemId = PreferenceUtil.getInstance().lastPage
|
||||
|
||||
val iconColor = ATHUtil.resolveColor(context, R.attr.iconColor)
|
||||
val accentColor = ThemeStore.accentColor(context)
|
||||
NavigationViewUtil.setItemIconColors(this, ColorUtil.withAlpha(iconColor, 0.5f), accentColor)
|
||||
NavigationViewUtil.setItemTextColors(this, ColorUtil.withAlpha(iconColor, 0.5f), accentColor)
|
||||
}
|
||||
}
|
|
@ -1,141 +0,0 @@
|
|||
/*
|
||||
* Mantou Earth - Live your wallpaper with live earth
|
||||
* Copyright (C) 2015 XiNGRZ <xxx@oxo.ooo>
|
||||
*
|
||||
* This program 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 program 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package code.name.monkey.retromusic.views;
|
||||
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.core.view.GravityCompat;
|
||||
import androidx.core.view.ViewCompat;
|
||||
import androidx.core.view.WindowInsetsCompat;
|
||||
|
||||
public class WindowInsetsFrameLayout extends FrameLayout {
|
||||
|
||||
private static final String TAG = "WindowInsetsFrameLayout";
|
||||
|
||||
public WindowInsetsFrameLayout(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public WindowInsetsFrameLayout(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public WindowInsetsFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
ViewCompat.setOnApplyWindowInsetsListener(this, (v, insets) ->
|
||||
applySystemWindowInsets21(insets) ? insets.consumeSystemWindowInsets() : insets);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
protected boolean fitSystemWindows(Rect insets) {
|
||||
if (Build.VERSION.SDK_INT >= 19 && Build.VERSION.SDK_INT < 21) {
|
||||
return applySystemWindowInsets19(insets);
|
||||
}
|
||||
|
||||
return super.fitSystemWindows(insets);
|
||||
}
|
||||
|
||||
@TargetApi(19)
|
||||
private boolean applySystemWindowInsets19(Rect insets) {
|
||||
boolean consumed = false;
|
||||
|
||||
for (int i = 0; i < getChildCount(); i++) {
|
||||
View child = getChildAt(i);
|
||||
|
||||
if (!child.getFitsSystemWindows()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Rect childInsets = new Rect(insets);
|
||||
|
||||
computeInsetsWithGravity(child, childInsets);
|
||||
|
||||
child.setPadding(childInsets.left, childInsets.top, childInsets.right, childInsets.bottom);
|
||||
|
||||
consumed = true;
|
||||
}
|
||||
|
||||
return consumed;
|
||||
}
|
||||
|
||||
@TargetApi(21)
|
||||
private boolean applySystemWindowInsets21(WindowInsetsCompat insets) {
|
||||
boolean consumed = false;
|
||||
|
||||
for (int i = 0; i < getChildCount(); i++) {
|
||||
View child = getChildAt(i);
|
||||
|
||||
if (!child.getFitsSystemWindows()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Rect childInsets = new Rect(
|
||||
insets.getSystemWindowInsetLeft(),
|
||||
insets.getSystemWindowInsetTop(),
|
||||
insets.getSystemWindowInsetRight(),
|
||||
insets.getSystemWindowInsetBottom());
|
||||
|
||||
computeInsetsWithGravity(child, childInsets);
|
||||
|
||||
ViewCompat.dispatchApplyWindowInsets(child, insets.replaceSystemWindowInsets(childInsets));
|
||||
|
||||
consumed = true;
|
||||
}
|
||||
|
||||
return consumed;
|
||||
}
|
||||
|
||||
@SuppressLint("RtlHardcoded")
|
||||
private void computeInsetsWithGravity(View view, Rect insets) {
|
||||
LayoutParams lp = (LayoutParams) view.getLayoutParams();
|
||||
|
||||
int gravity = GravityCompat.getAbsoluteGravity(
|
||||
lp.gravity, ViewCompat.getLayoutDirection(view));
|
||||
|
||||
if (lp.width != LayoutParams.MATCH_PARENT) {
|
||||
if ((gravity & Gravity.LEFT) != Gravity.LEFT) {
|
||||
insets.left = 0;
|
||||
}
|
||||
|
||||
if ((gravity & Gravity.RIGHT) != Gravity.RIGHT) {
|
||||
insets.right = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (lp.height != LayoutParams.MATCH_PARENT) {
|
||||
if ((gravity & Gravity.TOP) != Gravity.TOP) {
|
||||
insets.top = 0;
|
||||
}
|
||||
|
||||
if ((gravity & Gravity.BOTTOM) != Gravity.BOTTOM) {
|
||||
insets.bottom = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue