Rename smart widget -> clock widget
This commit is contained in:
parent
f591506b07
commit
5ff244dd1b
@ -95,7 +95,7 @@ class LauncherActivity : AppCompatActivity() {
|
|||||||
field = value
|
field = value
|
||||||
if (value) {
|
if (value) {
|
||||||
binding.widgetSpacer.visibility = View.GONE
|
binding.widgetSpacer.visibility = View.GONE
|
||||||
binding.smartWidget.visibility = View.GONE
|
binding.clockWidget.visibility = View.GONE
|
||||||
binding.searchBar.setRightIcon(R.drawable.ic_done)
|
binding.searchBar.setRightIcon(R.drawable.ic_done)
|
||||||
binding.scrollView.setOnTouchListener(null)
|
binding.scrollView.setOnTouchListener(null)
|
||||||
for (v in binding.widgetList.iterator()) {
|
for (v in binding.widgetList.iterator()) {
|
||||||
@ -146,7 +146,7 @@ class LauncherActivity : AppCompatActivity() {
|
|||||||
binding.scrollContainer.layoutTransition = ChangingLayoutTransition()
|
binding.scrollContainer.layoutTransition = ChangingLayoutTransition()
|
||||||
binding.searchBar.setRightIcon(R.drawable.ic_more_vert)
|
binding.searchBar.setRightIcon(R.drawable.ic_more_vert)
|
||||||
binding.scrollView.setOnTouchListener(scrollViewOnTouchListener)
|
binding.scrollView.setOnTouchListener(scrollViewOnTouchListener)
|
||||||
binding.smartWidget.visibility = View.VISIBLE
|
binding.clockWidget.visibility = View.VISIBLE
|
||||||
for (v in binding.widgetList.iterator()) {
|
for (v in binding.widgetList.iterator()) {
|
||||||
if (v is WidgetView) {
|
if (v is WidgetView) {
|
||||||
v.editMode = false
|
v.editMode = false
|
||||||
@ -256,10 +256,10 @@ class LauncherActivity : AppCompatActivity() {
|
|||||||
binding.searchBar.raise()
|
binding.searchBar.raise()
|
||||||
} else binding.searchBar.drop()
|
} else binding.searchBar.drop()
|
||||||
if (scrollY == 0) {
|
if (scrollY == 0) {
|
||||||
binding.smartWidget.translucent = true
|
binding.clockWidget.translucent = true
|
||||||
if (!searchVisibility) binding.searchBar.hide()
|
if (!searchVisibility) binding.searchBar.hide()
|
||||||
} else {
|
} else {
|
||||||
binding.smartWidget.translucent = false
|
binding.clockWidget.translucent = false
|
||||||
binding.searchBar.show()
|
binding.searchBar.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -459,7 +459,7 @@ class LauncherActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun adjustWidgetSpace() {
|
private fun adjustWidgetSpace() {
|
||||||
val firstWidget = binding.smartWidget
|
val firstWidget = binding.clockWidget
|
||||||
if (firstWidget == null) {
|
if (firstWidget == null) {
|
||||||
val m = binding.scrollContainer.paddingTop
|
val m = binding.scrollContainer.paddingTop
|
||||||
val params = binding.widgetSpacer.layoutParams as LinearLayout.LayoutParams
|
val params = binding.widgetSpacer.layoutParams as LinearLayout.LayoutParams
|
||||||
@ -675,7 +675,7 @@ class LauncherActivity : AppCompatActivity() {
|
|||||||
?: 0f
|
?: 0f
|
||||||
).start()
|
).start()
|
||||||
}
|
}
|
||||||
binding.smartWidget.compactView = compactView
|
binding.clockWidget.compactView = compactView
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
|
|||||||
@ -29,7 +29,7 @@ import de.mm20.launcher2.ui.databinding.ViewDateTimeBinding
|
|||||||
import de.mm20.launcher2.ui.legacy.view.LauncherCardView
|
import de.mm20.launcher2.ui.legacy.view.LauncherCardView
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class SmartWidget : LauncherCardView {
|
class ClockWidget : LauncherCardView {
|
||||||
|
|
||||||
constructor(context: Context) : super(context)
|
constructor(context: Context) : super(context)
|
||||||
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
|
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
|
||||||
@ -96,10 +96,10 @@ class SmartWidget : LauncherCardView {
|
|||||||
AnimatorSet().apply {
|
AnimatorSet().apply {
|
||||||
duration = 200
|
duration = 200
|
||||||
playTogether(
|
playTogether(
|
||||||
ObjectAnimator.ofInt(this@SmartWidget, "backgroundOpacity", 0).apply {
|
ObjectAnimator.ofInt(this@ClockWidget, "backgroundOpacity", 0).apply {
|
||||||
interpolator = AccelerateInterpolator(3f)
|
interpolator = AccelerateInterpolator(3f)
|
||||||
},
|
},
|
||||||
ObjectAnimator.ofFloat(this@SmartWidget, "translationZ", -elevation).apply {
|
ObjectAnimator.ofFloat(this@ClockWidget, "translationZ", -elevation).apply {
|
||||||
interpolator = DecelerateInterpolator(3f)
|
interpolator = DecelerateInterpolator(3f)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -111,11 +111,11 @@ class SmartWidget : LauncherCardView {
|
|||||||
AnimatorSet().apply {
|
AnimatorSet().apply {
|
||||||
duration = 200
|
duration = 200
|
||||||
playTogether(
|
playTogether(
|
||||||
ObjectAnimator.ofFloat(this@SmartWidget, "translationZ", 0f).apply {
|
ObjectAnimator.ofFloat(this@ClockWidget, "translationZ", 0f).apply {
|
||||||
interpolator = AccelerateInterpolator(3f)
|
interpolator = AccelerateInterpolator(3f)
|
||||||
},
|
},
|
||||||
ObjectAnimator.ofInt(
|
ObjectAnimator.ofInt(
|
||||||
this@SmartWidget,
|
this@ClockWidget,
|
||||||
"backgroundOpacity",
|
"backgroundOpacity",
|
||||||
LauncherPreferences.instance.cardOpacity
|
LauncherPreferences.instance.cardOpacity
|
||||||
).apply {
|
).apply {
|
||||||
@ -131,7 +131,7 @@ class SmartWidget : LauncherCardView {
|
|||||||
|
|
||||||
var compactView: CompactView? = getDefaultCompactView()
|
var compactView: CompactView? = getDefaultCompactView()
|
||||||
set(value) {
|
set(value) {
|
||||||
binding.smartWidgetContainer.removeView(field as? View)
|
binding.clockWidgetContainer.removeView(field as? View)
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
field = getDefaultCompactView()
|
field = getDefaultCompactView()
|
||||||
} else {
|
} else {
|
||||||
@ -139,7 +139,7 @@ class SmartWidget : LauncherCardView {
|
|||||||
}
|
}
|
||||||
(field as? View)?.let {
|
(field as? View)?.let {
|
||||||
it.layoutParams = getCompactViewLayoutParams()
|
it.layoutParams = getCompactViewLayoutParams()
|
||||||
binding.smartWidgetContainer.addView(it)
|
binding.clockWidgetContainer.addView(it)
|
||||||
}
|
}
|
||||||
field?.setTranslucent(translucent)
|
field?.setTranslucent(translucent)
|
||||||
}
|
}
|
||||||
@ -155,7 +155,7 @@ class SmartWidget : LauncherCardView {
|
|||||||
)
|
)
|
||||||
params.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE)
|
params.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE)
|
||||||
params.addRule(RelativeLayout.ALIGN_PARENT_START, 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.marginStart = (16 * dp).toInt()
|
||||||
params.marginEnd = (16 * dp).toInt()
|
params.marginEnd = (16 * dp).toInt()
|
||||||
return params
|
return params
|
||||||
@ -137,8 +137,8 @@
|
|||||||
android:src="@drawable/ic_arrow_up"
|
android:src="@drawable/ic_arrow_up"
|
||||||
android:tint="#fff" />
|
android:tint="#fff" />
|
||||||
|
|
||||||
<de.mm20.launcher2.ui.legacy.widget.SmartWidget
|
<de.mm20.launcher2.ui.legacy.widget.ClockWidget
|
||||||
android:id="@+id/smartWidget"
|
android:id="@+id/clockWidget"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="8dp" />
|
android:layout_marginTop="8dp" />
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/smartWidgetContainer"
|
android:id="@+id/clockWidgetContainer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:animateLayoutChanges="true"
|
android:animateLayoutChanges="true"
|
||||||
@ -10,7 +10,7 @@
|
|||||||
android:clipToPadding="false">
|
android:clipToPadding="false">
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/smartWidgetDivider"
|
android:id="@+id/clockWidgetDivider"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user