adding support for Material You theme
This commit is contained in:
parent
c2b676e344
commit
53af02349d
4 changed files with 33 additions and 7 deletions
|
@ -25,14 +25,17 @@
|
|||
android:theme="@style/AppTheme">
|
||||
<activity
|
||||
android:name=".activities.SplashActivity"
|
||||
android:exported="false"
|
||||
android:theme="@style/SplashTheme" />
|
||||
|
||||
<activity
|
||||
android:name=".activities.MainActivity"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name=".activities.WidgetConfigureActivity"
|
||||
android:exported="true"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/MyWidgetConfigTheme">
|
||||
<intent-filter>
|
||||
|
@ -42,8 +45,9 @@
|
|||
|
||||
<activity
|
||||
android:name=".activities.SettingsActivity"
|
||||
android:exported="true"
|
||||
android:label="@string/settings"
|
||||
android:parentActivityName=".activities.MainActivity" >
|
||||
android:parentActivityName=".activities.MainActivity">
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.APPLICATION_PREFERENCES" />
|
||||
|
@ -53,16 +57,19 @@
|
|||
|
||||
<activity
|
||||
android:name="com.simplemobiletools.commons.activities.AboutActivity"
|
||||
android:exported="false"
|
||||
android:label="@string/about"
|
||||
android:parentActivityName=".activities.MainActivity" />
|
||||
|
||||
<activity
|
||||
android:name="com.simplemobiletools.commons.activities.CustomizationActivity"
|
||||
android:exported="false"
|
||||
android:label="@string/customize_colors"
|
||||
android:parentActivityName=".activities.SettingsActivity" />
|
||||
|
||||
<receiver
|
||||
android:name=".helpers.MyWidgetProvider"
|
||||
android:exported="true"
|
||||
android:icon="@drawable/img_widget_preview">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||
|
@ -76,6 +83,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Red"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_red"
|
||||
android:roundIcon="@mipmap/ic_launcher_red"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -89,6 +97,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Pink"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_pink"
|
||||
android:roundIcon="@mipmap/ic_launcher_pink"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -102,6 +111,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Purple"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_purple"
|
||||
android:roundIcon="@mipmap/ic_launcher_purple"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -115,6 +125,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Deep_purple"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_deep_purple"
|
||||
android:roundIcon="@mipmap/ic_launcher_deep_purple"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -128,6 +139,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Indigo"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_indigo"
|
||||
android:roundIcon="@mipmap/ic_launcher_indigo"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -141,6 +153,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Blue"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_blue"
|
||||
android:roundIcon="@mipmap/ic_launcher_blue"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -154,6 +167,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Light_blue"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_light_blue"
|
||||
android:roundIcon="@mipmap/ic_launcher_light_blue"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -167,6 +181,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Cyan"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_cyan"
|
||||
android:roundIcon="@mipmap/ic_launcher_cyan"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -180,6 +195,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Teal"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_teal"
|
||||
android:roundIcon="@mipmap/ic_launcher_teal"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -193,6 +209,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Green"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_green"
|
||||
android:roundIcon="@mipmap/ic_launcher_green"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -206,6 +223,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Light_green"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_light_green"
|
||||
android:roundIcon="@mipmap/ic_launcher_light_green"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -219,6 +237,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Lime"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_lime"
|
||||
android:roundIcon="@mipmap/ic_launcher_lime"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -232,6 +251,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Yellow"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_yellow"
|
||||
android:roundIcon="@mipmap/ic_launcher_yellow"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -245,6 +265,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Amber"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_amber"
|
||||
android:roundIcon="@mipmap/ic_launcher_amber"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -258,6 +279,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Orange"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:roundIcon="@mipmap/ic_launcher"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -270,6 +292,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Deep_orange"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_deep_orange"
|
||||
android:roundIcon="@mipmap/ic_launcher_deep_orange"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -283,6 +306,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Brown"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_brown"
|
||||
android:roundIcon="@mipmap/ic_launcher_brown"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -296,6 +320,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Blue_grey"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_blue_grey"
|
||||
android:roundIcon="@mipmap/ic_launcher_blue_grey"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
@ -309,6 +334,7 @@
|
|||
<activity-alias
|
||||
android:name=".activities.SplashActivity.Grey_black"
|
||||
android:enabled="false"
|
||||
android:exported="true"
|
||||
android:icon="@mipmap/ic_launcher_grey_black"
|
||||
android:roundIcon="@mipmap/ic_launcher_grey_black"
|
||||
android:targetActivity=".activities.SplashActivity">
|
||||
|
|
|
@ -60,7 +60,7 @@ class MainActivity : SimpleActivity(), Calculator {
|
|||
AutofitHelper.create(result)
|
||||
AutofitHelper.create(formula)
|
||||
storeStateVariables()
|
||||
updateViewColors(calculator_holder, config.textColor)
|
||||
updateViewColors(calculator_holder, getProperTextColor())
|
||||
checkWhatsNewDialog()
|
||||
checkAppOnSDCard()
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ class MainActivity : SimpleActivity(), Calculator {
|
|||
override fun onResume() {
|
||||
super.onResume()
|
||||
if (storedTextColor != config.textColor) {
|
||||
updateViewColors(calculator_holder, config.textColor)
|
||||
updateViewColors(calculator_holder, getProperTextColor())
|
||||
}
|
||||
|
||||
if (config.preventPhoneFromSleeping) {
|
||||
|
@ -77,7 +77,7 @@ class MainActivity : SimpleActivity(), Calculator {
|
|||
|
||||
vibrateOnButtonPress = config.vibrateOnButtonPress
|
||||
|
||||
val adjustedPrimaryColor = getAdjustedPrimaryColor()
|
||||
val adjustedPrimaryColor = getProperPrimaryColor()
|
||||
arrayOf(btn_percent, btn_power, btn_root, btn_clear, btn_reset, btn_divide, btn_multiply, btn_plus, btn_minus, btn_equals, btn_decimal).forEach {
|
||||
it.setTextColor(adjustedPrimaryColor)
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ class SettingsActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
arrayOf(settings_color_customization_holder, settings_general_settings_holder).forEach {
|
||||
it.background.applyColorFilter(baseConfig.backgroundColor.getContrastColor())
|
||||
it.background.applyColorFilter(getProperBackgroundColor().getContrastColor())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,16 +5,16 @@ import android.view.ViewGroup
|
|||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.simplemobiletools.calculator.R
|
||||
import com.simplemobiletools.calculator.activities.SimpleActivity
|
||||
import com.simplemobiletools.calculator.extensions.config
|
||||
import com.simplemobiletools.calculator.helpers.CalculatorImpl
|
||||
import com.simplemobiletools.calculator.models.History
|
||||
import com.simplemobiletools.commons.extensions.copyToClipboard
|
||||
import com.simplemobiletools.commons.extensions.getProperTextColor
|
||||
import kotlinx.android.synthetic.main.history_view.view.*
|
||||
|
||||
class HistoryAdapter(val activity: SimpleActivity, val items: List<History>, val calc: CalculatorImpl, val itemClick: () -> Unit) :
|
||||
RecyclerView.Adapter<HistoryAdapter.ViewHolder>() {
|
||||
|
||||
private var textColor = activity.config.textColor
|
||||
private var textColor = activity.getProperTextColor()
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val view = activity.layoutInflater.inflate(R.layout.history_view, parent, false)
|
||||
|
|
Loading…
Reference in a new issue