Rename smart widget -> clock widget

This commit is contained in:
MM20 2021-12-15 18:59:49 +01:00
parent f591506b07
commit 5ff244dd1b
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389
4 changed files with 18 additions and 18 deletions

View File

@ -95,7 +95,7 @@ class LauncherActivity : AppCompatActivity() {
field = value
if (value) {
binding.widgetSpacer.visibility = View.GONE
binding.smartWidget.visibility = View.GONE
binding.clockWidget.visibility = View.GONE
binding.searchBar.setRightIcon(R.drawable.ic_done)
binding.scrollView.setOnTouchListener(null)
for (v in binding.widgetList.iterator()) {
@ -146,7 +146,7 @@ class LauncherActivity : AppCompatActivity() {
binding.scrollContainer.layoutTransition = ChangingLayoutTransition()
binding.searchBar.setRightIcon(R.drawable.ic_more_vert)
binding.scrollView.setOnTouchListener(scrollViewOnTouchListener)
binding.smartWidget.visibility = View.VISIBLE
binding.clockWidget.visibility = View.VISIBLE
for (v in binding.widgetList.iterator()) {
if (v is WidgetView) {
v.editMode = false
@ -256,10 +256,10 @@ class LauncherActivity : AppCompatActivity() {
binding.searchBar.raise()
} else binding.searchBar.drop()
if (scrollY == 0) {
binding.smartWidget.translucent = true
binding.clockWidget.translucent = true
if (!searchVisibility) binding.searchBar.hide()
} else {
binding.smartWidget.translucent = false
binding.clockWidget.translucent = false
binding.searchBar.show()
}
@ -459,7 +459,7 @@ class LauncherActivity : AppCompatActivity() {
}
private fun adjustWidgetSpace() {
val firstWidget = binding.smartWidget
val firstWidget = binding.clockWidget
if (firstWidget == null) {
val m = binding.scrollContainer.paddingTop
val params = binding.widgetSpacer.layoutParams as LinearLayout.LayoutParams
@ -675,7 +675,7 @@ class LauncherActivity : AppCompatActivity() {
?: 0f
).start()
}
binding.smartWidget.compactView = compactView
binding.clockWidget.compactView = compactView
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {

View File

@ -29,7 +29,7 @@ import de.mm20.launcher2.ui.databinding.ViewDateTimeBinding
import de.mm20.launcher2.ui.legacy.view.LauncherCardView
import java.util.*
class SmartWidget : LauncherCardView {
class ClockWidget : LauncherCardView {
constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
@ -96,10 +96,10 @@ class SmartWidget : LauncherCardView {
AnimatorSet().apply {
duration = 200
playTogether(
ObjectAnimator.ofInt(this@SmartWidget, "backgroundOpacity", 0).apply {
ObjectAnimator.ofInt(this@ClockWidget, "backgroundOpacity", 0).apply {
interpolator = AccelerateInterpolator(3f)
},
ObjectAnimator.ofFloat(this@SmartWidget, "translationZ", -elevation).apply {
ObjectAnimator.ofFloat(this@ClockWidget, "translationZ", -elevation).apply {
interpolator = DecelerateInterpolator(3f)
}
)
@ -111,11 +111,11 @@ class SmartWidget : LauncherCardView {
AnimatorSet().apply {
duration = 200
playTogether(
ObjectAnimator.ofFloat(this@SmartWidget, "translationZ", 0f).apply {
ObjectAnimator.ofFloat(this@ClockWidget, "translationZ", 0f).apply {
interpolator = AccelerateInterpolator(3f)
},
ObjectAnimator.ofInt(
this@SmartWidget,
this@ClockWidget,
"backgroundOpacity",
LauncherPreferences.instance.cardOpacity
).apply {
@ -131,7 +131,7 @@ class SmartWidget : LauncherCardView {
var compactView: CompactView? = getDefaultCompactView()
set(value) {
binding.smartWidgetContainer.removeView(field as? View)
binding.clockWidgetContainer.removeView(field as? View)
if (value == null) {
field = getDefaultCompactView()
} else {
@ -139,7 +139,7 @@ class SmartWidget : LauncherCardView {
}
(field as? View)?.let {
it.layoutParams = getCompactViewLayoutParams()
binding.smartWidgetContainer.addView(it)
binding.clockWidgetContainer.addView(it)
}
field?.setTranslucent(translucent)
}
@ -155,7 +155,7 @@ class SmartWidget : LauncherCardView {
)
params.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE)
params.addRule(RelativeLayout.ALIGN_PARENT_START, RelativeLayout.TRUE)
params.addRule(RelativeLayout.START_OF, R.id.smartWidgetDivider)
params.addRule(RelativeLayout.START_OF, R.id.clockWidgetDivider)
params.marginStart = (16 * dp).toInt()
params.marginEnd = (16 * dp).toInt()
return params

View File

@ -137,8 +137,8 @@
android:src="@drawable/ic_arrow_up"
android:tint="#fff" />
<de.mm20.launcher2.ui.legacy.widget.SmartWidget
android:id="@+id/smartWidget"
<de.mm20.launcher2.ui.legacy.widget.ClockWidget
android:id="@+id/clockWidget"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp" />

View File

@ -2,7 +2,7 @@
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/smartWidgetContainer"
android:id="@+id/clockWidgetContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
@ -10,7 +10,7 @@
android:clipToPadding="false">
<FrameLayout
android:id="@+id/smartWidgetDivider"
android:id="@+id/clockWidgetDivider"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"