updated
This commit is contained in:
parent
a3a4618769
commit
7a42723b9e
103 changed files with 1879 additions and 1195 deletions
|
@ -28,9 +28,9 @@ android {
|
|||
|
||||
dependencies {
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
implementation 'androidx.appcompat:appcompat:1.0.2'
|
||||
implementation 'com.google.android.material:material:1.0.0'
|
||||
implementation 'androidx.preference:preference:1.0.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0-alpha03'
|
||||
implementation 'com.google.android.material:material:1.1.0-alpha04'
|
||||
implementation 'androidx.preference:preference:1.1.0-alpha04'
|
||||
implementation 'androidx.cardview:cardview:1.0.0'
|
||||
// Used for the list preference classes
|
||||
implementation "com.afollestad.material-dialogs:core:$materialDialog"
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* 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.appthemehelper.common.views
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
|
||||
class ATEAccentTextView : AppCompatTextView {
|
||||
constructor(context: Context) : super(context) {
|
||||
init(context, null)
|
||||
}
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
|
||||
init(context, attrs)
|
||||
}
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
|
||||
init(context, attrs)
|
||||
}
|
||||
|
||||
private fun init(context: Context, attrs: AttributeSet?) {
|
||||
setTextColor(ThemeStore.accentColor(context))
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* 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.appthemehelper.common.views
|
||||
|
||||
import android.content.Context
|
||||
import android.content.res.ColorStateList
|
||||
import android.util.AttributeSet
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import code.name.monkey.appthemehelper.util.ColorUtil
|
||||
import code.name.monkey.appthemehelper.util.MaterialValueHelper
|
||||
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||
|
||||
class ATEExtendedFloatingActionButton @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = -1) : ExtendedFloatingActionButton(context, attrs, defStyleAttr) {
|
||||
|
||||
init {
|
||||
backgroundTintList = ColorStateList.valueOf(ThemeStore.accentColor(context))
|
||||
setTextColor(ColorStateList.valueOf(MaterialValueHelper.getPrimaryTextColor(context, ColorUtil.isColorLight(ThemeStore.accentColor(context)))))
|
||||
}
|
||||
|
||||
}
|
|
@ -18,10 +18,11 @@ import android.content.Context;
|
|||
import android.content.res.ColorStateList;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import com.google.android.material.textfield.TextInputLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.android.material.textfield.TextInputLayout;
|
||||
|
||||
import code.name.monkey.appthemehelper.ThemeStore;
|
||||
|
||||
/**
|
||||
|
@ -38,14 +39,9 @@ public class ATETextInputLayout extends TextInputLayout {
|
|||
|
||||
public ATETextInputLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
|
||||
setBoxBackgroundMode(BOX_BACKGROUND_OUTLINE);
|
||||
setBoxStrokeColor(ThemeStore.Companion.textColorSecondary(context));
|
||||
final float scale = context.getResources().getDisplayMetrics().density;
|
||||
int border = (int) (8 * scale + 0.5f);
|
||||
setBoxCornerRadii(border, border, border, border);
|
||||
setBoxBackgroundMode(BOX_BACKGROUND_FILLED);
|
||||
setHintAnimationEnabled(true);
|
||||
setHintEnabled(true);
|
||||
|
||||
setBackgroundTintList(ColorStateList.valueOf(ThemeStore.Companion.accentColor(context)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
package code.name.monkey.appthemehelper.util
|
||||
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.PorterDuff
|
||||
import android.widget.EditText
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.ColorInt
|
||||
import androidx.core.content.ContextCompat
|
||||
import code.name.monkey.appthemehelper.ThemeStore
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import com.google.android.material.textfield.TextInputLayout
|
||||
|
@ -28,7 +33,7 @@ object MaterialUtil {
|
|||
|
||||
}
|
||||
|
||||
fun setTint(textInputLayout: TextInputLayout, background: Boolean) {
|
||||
fun setTint(textInputLayout: TextInputLayout, background: Boolean = true) {
|
||||
val context = textInputLayout.context
|
||||
val accentColor = ThemeStore.accentColor(context)
|
||||
val colorState = ColorStateList.valueOf(accentColor)
|
||||
|
@ -39,6 +44,32 @@ object MaterialUtil {
|
|||
} else {
|
||||
textInputLayout.boxStrokeColor = accentColor
|
||||
textInputLayout.defaultHintTextColor = colorState
|
||||
textInputLayout.isHintAnimationEnabled = true
|
||||
}
|
||||
}
|
||||
|
||||
private fun setCursorPointerColor(view: EditText, @ColorInt color: Int) {
|
||||
try {
|
||||
//get the pointer resource id
|
||||
var field = TextView::class.java.getDeclaredField("mTextSelectHandleRes")
|
||||
field.isAccessible = true
|
||||
val drawableResId = field.getInt(view)
|
||||
|
||||
//get the editor
|
||||
field = TextView::class.java.getDeclaredField("mEditor")
|
||||
field.isAccessible = true
|
||||
val editor = field.get(view)
|
||||
|
||||
//tint drawable
|
||||
val drawable = ContextCompat.getDrawable(view.context, drawableResId)!!
|
||||
drawable.setColorFilter(color, PorterDuff.Mode.SRC_IN)
|
||||
|
||||
//set the drawable
|
||||
field = editor.javaClass.getDeclaredField("mSelectHandleCenter")
|
||||
field.isAccessible = true
|
||||
field.set(editor, drawable)
|
||||
|
||||
} catch (ex: Exception) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue