每日签到对话框
This commit is contained in:
parent
2aea918304
commit
56b64a7cb0
|
|
@ -9,7 +9,9 @@ import androidx.fragment.app.viewModels
|
||||||
import com.ama.core.architecture.appBase.AppViewsFragment
|
import com.ama.core.architecture.appBase.AppViewsFragment
|
||||||
import com.ama.core.architecture.appBase.OnFragmentBackgroundListener
|
import com.ama.core.architecture.appBase.OnFragmentBackgroundListener
|
||||||
import com.ama.core.architecture.util.SpUtil
|
import com.ama.core.architecture.util.SpUtil
|
||||||
|
import com.ama.core.architecture.util.setOnClickBatch
|
||||||
import com.ama.core.architecture.util.setStatusBarDarkFont
|
import com.ama.core.architecture.util.setStatusBarDarkFont
|
||||||
|
import com.gamedog.vididin.main.fragments.task.DailySignDialog
|
||||||
import com.gamedog.vididin.main.interfaces.OnTabClickAgainListener
|
import com.gamedog.vididin.main.interfaces.OnTabClickAgainListener
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import kotlin.getValue
|
import kotlin.getValue
|
||||||
|
|
@ -41,7 +43,15 @@ class TasksFragment : AppViewsFragment<ViewBinding, UiState, ViewModel>(), OnTab
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun ViewBinding.initViews() {
|
override fun ViewBinding.initViews() {
|
||||||
|
with(binding) {
|
||||||
|
setOnClickBatch(ivGotoDailySign) {
|
||||||
|
when(this) {
|
||||||
|
ivGotoDailySign->{
|
||||||
|
DailySignDialog(context).build().show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun ViewBinding.initListeners() {
|
override fun ViewBinding.initListeners() {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
package com.gamedog.vididin.main.fragments.task
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import com.ama.core.architecture.util.setOnClickBatch
|
||||||
|
import com.ama.core.architecture.widget.BindingDialog
|
||||||
|
import com.gamedog.vididin.databinding.DialogDailySignBinding
|
||||||
|
|
||||||
|
|
||||||
|
class DailySignDialog(context: Context) : BindingDialog<DialogDailySignBinding>(context, DialogDailySignBinding::inflate) {
|
||||||
|
fun build(): DailySignDialog {
|
||||||
|
with()
|
||||||
|
setCenter()
|
||||||
|
setMaskValue(0.8f)
|
||||||
|
|
||||||
|
binding.run {
|
||||||
|
setOnClickBatch(butLeft, butRight) {
|
||||||
|
when (this) {
|
||||||
|
butLeft -> {
|
||||||
|
dismiss()
|
||||||
|
}
|
||||||
|
butRight -> {
|
||||||
|
handleRightButClicked()
|
||||||
|
dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
initDailySignItems()
|
||||||
|
}
|
||||||
|
|
||||||
|
show()
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private fun initDailySignItems() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun handleRightButClicked() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.gamedog.vididin.widget
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.widget.LinearLayout
|
||||||
|
import com.gamedog.vididin.databinding.DailySignItemBinding
|
||||||
|
import kotlin.run
|
||||||
|
|
||||||
|
class DailySignItemView @JvmOverloads constructor(
|
||||||
|
context: Context,
|
||||||
|
attrs: AttributeSet? = null,
|
||||||
|
defStyleAttr: Int = 0
|
||||||
|
) : LinearLayout(context, attrs, defStyleAttr) {
|
||||||
|
|
||||||
|
private var mBinding: DailySignItemBinding? = null
|
||||||
|
|
||||||
|
|
||||||
|
init {
|
||||||
|
mBinding = DailySignItemBinding.inflate(LayoutInflater.from(context), this, true)
|
||||||
|
mBinding?.run {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape android:shape="rectangle"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<stroke android:width="2dp" android:color="#ffff862f" />
|
||||||
|
<corners android:radius="42dp" />
|
||||||
|
</shape>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:src="@mipmap/img"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
>
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:id="@+id/tv_gold"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@mipmap/temp"/>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/tv_gold_num"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textColor="@color/red_0b"
|
||||||
|
android:text="100"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/tv_day_num"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:textSize="12sp"
|
||||||
|
android:textColor="@color/gray3"
|
||||||
|
android:text="Dia"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
@ -0,0 +1,201 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@mipmap/daily_sign_bg"
|
||||||
|
>
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_marginHorizontal="15dp"
|
||||||
|
android:layout_marginTop="120dp"
|
||||||
|
android:layout_marginBottom="20dp"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
android:clipChildren="false"
|
||||||
|
>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@mipmap/temp"/>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="8dp"
|
||||||
|
android:src="@mipmap/temp"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/tv_desc"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textColor="@color/gray6"
|
||||||
|
android:text="@string/daily_sign_desc"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/tv_times"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textColor="@color/gray9"
|
||||||
|
android:text="@string/daily_sign_times"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<com.gamedog.vididin.widget.DailySignItemView
|
||||||
|
android:id="@+id/sign_item_1"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
/>
|
||||||
|
<com.gamedog.vididin.widget.DailySignItemView
|
||||||
|
android:id="@+id/sign_item_2"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
/>
|
||||||
|
<com.gamedog.vididin.widget.DailySignItemView
|
||||||
|
android:id="@+id/sign_item_3"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
/>
|
||||||
|
<com.gamedog.vididin.widget.DailySignItemView
|
||||||
|
android:id="@+id/sign_item_4"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<com.gamedog.vididin.widget.DailySignItemView
|
||||||
|
android:id="@+id/sign_item_5"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
/>
|
||||||
|
<com.gamedog.vididin.widget.DailySignItemView
|
||||||
|
android:id="@+id/sign_item_6"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
/>
|
||||||
|
<com.gamedog.vididin.widget.DailySignItemView
|
||||||
|
android:id="@+id/sign_item_7"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="2"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:clipChildren="false"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/but_left"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/bg_sign_left_but"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textColor="@color/red_2f"
|
||||||
|
android:text="@string/resgatar"
|
||||||
|
android:paddingVertical="14dp"
|
||||||
|
android:gravity="center"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/but_right"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="46dp"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/bg_sign_left_but">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:layout_gravity="center">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="8dp"
|
||||||
|
android:layout_gravity="center_vertical"
|
||||||
|
android:src="@mipmap/temp"/>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:textColor="@color/red_2f"
|
||||||
|
android:text="@string/assistir"
|
||||||
|
android:paddingVertical="14dp"
|
||||||
|
android:gravity="center"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="8dp"
|
||||||
|
android:layout_gravity="top|right"
|
||||||
|
android:layout_marginTop="-15dp"
|
||||||
|
android:layout_marginRight="3dp"
|
||||||
|
android:src="@mipmap/temp"/>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
@ -381,6 +381,7 @@
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/iv_goto_daily_sign"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 306 KiB |
|
|
@ -60,5 +60,15 @@
|
||||||
|
|
||||||
<color name="green_39">#FF009B39</color>
|
<color name="green_39">#FF009B39</color>
|
||||||
|
|
||||||
|
<color name="gray3">#ff333333</color>
|
||||||
|
<color name="gray6">#ff666666</color>
|
||||||
|
<color name="gray9">#ff999999</color>
|
||||||
|
<color name="grayf6">#fff6f6f6</color>
|
||||||
|
<color name="gray28">#ff282828</color>
|
||||||
|
<color name="grayf3">#fff3f4ff</color>
|
||||||
|
<color name="graybe">#ffbebebe</color>
|
||||||
|
<color name="red_0b">#FFFF740B</color>
|
||||||
|
<color name="red_2f">#FFFF862F</color>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
@ -12,4 +12,8 @@
|
||||||
<string name="task_act_benef">Benefícios</string>
|
<string name="task_act_benef">Benefícios</string>
|
||||||
<string name="task_act_convi">Convidar</string>
|
<string name="task_act_convi">Convidar</string>
|
||||||
<string name="task_act_game">Game Center</string>
|
<string name="task_act_game">Game Center</string>
|
||||||
|
<string name="daily_sign_desc">Conclua o login de hoje e pode ganhar até 666 moedas!</string>
|
||||||
|
<string name="daily_sign_times">Logins realizados: 0/7</string>
|
||||||
|
<string name="resgatar">Resgatar</string>
|
||||||
|
<string name="assistir">Assistir</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
package com.ama.core.architecture.util;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.graphics.Point;
|
||||||
|
import android.view.Display;
|
||||||
|
import android.view.WindowManager;
|
||||||
|
import com.ama.core.architecture.BaseApp;
|
||||||
|
|
||||||
|
|
||||||
|
public class ScreenUtils {
|
||||||
|
/**
|
||||||
|
* 可用距离: 全屏高度- 状态栏- 导航栏
|
||||||
|
* @return 可用高度
|
||||||
|
*/
|
||||||
|
public static int getHeightRealPixels() {
|
||||||
|
return getScreenHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Display getDisplay(Context context) {
|
||||||
|
WindowManager wm;
|
||||||
|
if (context instanceof Activity) {
|
||||||
|
Activity activity = (Activity) context;
|
||||||
|
wm = activity.getWindowManager();
|
||||||
|
} else {
|
||||||
|
wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
|
||||||
|
}
|
||||||
|
if (wm != null) {
|
||||||
|
return wm.getDefaultDisplay();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the width of screen, in pixel.
|
||||||
|
*
|
||||||
|
* @return the width of screen, in pixel
|
||||||
|
*/
|
||||||
|
public static int getScreenWidth() {
|
||||||
|
WindowManager wm = (WindowManager) BaseApp.Companion.appContext().getSystemService(Context.WINDOW_SERVICE);
|
||||||
|
if (wm == null) return -1;
|
||||||
|
Point point = new Point();
|
||||||
|
wm.getDefaultDisplay().getRealSize(point);
|
||||||
|
return point.x;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得整个屏幕的高度,包括状态栏和导航栏
|
||||||
|
*
|
||||||
|
* @return the height of screen, in pixel
|
||||||
|
*/
|
||||||
|
public static int getScreenHeight() {
|
||||||
|
WindowManager wm = (WindowManager) BaseApp.Companion.appContext().getSystemService(Context.WINDOW_SERVICE);
|
||||||
|
if (wm == null) return -1;
|
||||||
|
Point point = new Point();
|
||||||
|
wm.getDefaultDisplay().getRealSize(point);
|
||||||
|
return point.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断当前设备是手机还是平板,代码来自 Google I/O App for Android
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @return 平板返回 True,手机返回 False
|
||||||
|
*/
|
||||||
|
public static boolean isPad(Context context) {
|
||||||
|
return (context.getResources().getConfiguration().screenLayout
|
||||||
|
& Configuration.SCREENLAYOUT_SIZE_MASK)
|
||||||
|
>= Configuration.SCREENLAYOUT_SIZE_LARGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
package com.ama.core.architecture.util
|
||||||
|
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.app.Activity
|
||||||
|
import androidx.core.view.ViewCompat
|
||||||
|
import androidx.core.view.WindowInsetsCompat
|
||||||
|
import androidx.core.view.doOnAttach
|
||||||
|
import kotlin.math.abs
|
||||||
|
|
||||||
|
|
||||||
|
object StatusBarUtil {
|
||||||
|
|
||||||
|
|
||||||
|
private var statusBarHeight: Int = 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得状态栏的高度
|
||||||
|
* Insets 只有在 view attached 才是可用的
|
||||||
|
*/
|
||||||
|
@SuppressLint("InternalInsetResource", "DiscouragedApi")
|
||||||
|
fun getStatusBarHeight(activity: Activity) {
|
||||||
|
activity.window.decorView.doOnAttach {
|
||||||
|
/**
|
||||||
|
* 正确获取status bar方法,通过windowInset获取
|
||||||
|
* getInsetsIgnoringVisibility 是获取到真实高度,无论状态栏是否隐藏
|
||||||
|
* getInsets 是根据隐藏状态获取
|
||||||
|
*/
|
||||||
|
val ignoringVisibilityTop =
|
||||||
|
ViewCompat.getRootWindowInsets(activity.window.decorView)?.getInsetsIgnoringVisibility(WindowInsetsCompat.Type.statusBars())?.top ?: 0
|
||||||
|
val ignoringVisibilityBottom =
|
||||||
|
ViewCompat.getRootWindowInsets(activity.window.decorView)?.getInsetsIgnoringVisibility(WindowInsetsCompat.Type.statusBars())?.bottom ?: 0
|
||||||
|
statusBarHeight = abs(ignoringVisibilityTop - ignoringVisibilityBottom)
|
||||||
|
/**
|
||||||
|
* 兼容,系统resources可能修改
|
||||||
|
*/
|
||||||
|
if (statusBarHeight == 0) {
|
||||||
|
statusBarHeight = try {
|
||||||
|
activity.resources
|
||||||
|
.getIdentifier("status_bar_height", "dimen", "android")
|
||||||
|
.takeIf { it > 0 }
|
||||||
|
?.run {
|
||||||
|
activity.resources.getDimensionPixelSize(this)
|
||||||
|
} ?: 0
|
||||||
|
} catch (_: Exception) {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.ama.core.architecture.util
|
||||||
|
|
||||||
|
import android.os.SystemClock
|
||||||
|
import android.view.View
|
||||||
|
import com.ama.core.architecture.R
|
||||||
|
|
||||||
|
class UiUtil {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
typealias viewClickHandler = View.() -> Unit
|
||||||
|
|
||||||
|
inline fun setOnClickBatch(vararg v: View?, crossinline block: viewClickHandler) {
|
||||||
|
val interval = 500L
|
||||||
|
v.forEach {
|
||||||
|
it?.let { view ->
|
||||||
|
view.setOnClickListener {
|
||||||
|
val lastClickedTimestamp = view.getTag(R.id.view_last_click_timestamp)?.toString()?.toLongOrNull() ?: 0L
|
||||||
|
val currTimestamp = SystemClock.uptimeMillis()
|
||||||
|
if (currTimestamp - lastClickedTimestamp < interval) return@setOnClickListener
|
||||||
|
view.setTag(R.id.view_last_click_timestamp, currTimestamp)
|
||||||
|
view.block()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,436 @@
|
||||||
|
package com.ama.core.architecture.widget
|
||||||
|
|
||||||
|
import android.app.Dialog
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.DialogInterface
|
||||||
|
import android.graphics.Bitmap
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.graphics.drawable.Drawable
|
||||||
|
import android.graphics.drawable.ShapeDrawable
|
||||||
|
import android.graphics.drawable.shapes.RoundRectShape
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.util.SparseArray
|
||||||
|
import android.view.Gravity
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.WindowManager
|
||||||
|
import android.widget.ImageView
|
||||||
|
import android.widget.TextView
|
||||||
|
import androidx.activity.ComponentActivity
|
||||||
|
import androidx.annotation.ColorInt
|
||||||
|
import androidx.annotation.DrawableRes
|
||||||
|
import androidx.annotation.IdRes
|
||||||
|
import androidx.annotation.StringRes
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
|
import androidx.lifecycle.Lifecycle
|
||||||
|
import androidx.lifecycle.LifecycleEventObserver
|
||||||
|
import androidx.lifecycle.LifecycleOwner
|
||||||
|
import androidx.viewbinding.ViewBinding
|
||||||
|
import com.ama.core.architecture.R
|
||||||
|
import com.ama.core.architecture.util.ScreenUtils
|
||||||
|
import com.ama.core.common.util.dp
|
||||||
|
|
||||||
|
|
||||||
|
open class BindingDialog<VB : ViewBinding>(private val context: Context,
|
||||||
|
private val inflate: (LayoutInflater) -> VB,
|
||||||
|
themeResId: Int = R.style.LDialog) : Dialog(context, themeResId), LifecycleEventObserver {
|
||||||
|
private val views = SparseArray<View>()
|
||||||
|
private var width = 0
|
||||||
|
private var height = 0
|
||||||
|
private var bgRadius = 0 //背景圆角
|
||||||
|
|
||||||
|
private var leftTopRadius = 0
|
||||||
|
private var rightTopRadius = 0
|
||||||
|
private var leftBottomRadius = 0
|
||||||
|
private var rightBottomRadius = 0
|
||||||
|
private var bgColor = Color.TRANSPARENT //背景颜色
|
||||||
|
|
||||||
|
lateinit var binding: VB
|
||||||
|
var currEvent: Lifecycle.Event? = null
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
fun getRoundRectDrawable(radius: Int, color: Int): ShapeDrawable {
|
||||||
|
return getRoundRectDrawable(radius, radius, radius, radius, color)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getRoundRectDrawable(leftTop: Int, rightTop: Int, rightBottom: Int, leftBottom: Int, color: Int): ShapeDrawable {
|
||||||
|
//左上、右上、右下、左下的圆角半径
|
||||||
|
val radius = floatArrayOf(
|
||||||
|
leftTop.toFloat(),
|
||||||
|
leftTop.toFloat(),
|
||||||
|
rightTop.toFloat(),
|
||||||
|
rightTop.toFloat(),
|
||||||
|
rightBottom.toFloat(),
|
||||||
|
rightBottom.toFloat(),
|
||||||
|
leftBottom.toFloat(),
|
||||||
|
leftBottom.toFloat()
|
||||||
|
)
|
||||||
|
val drawable = ShapeDrawable().apply {
|
||||||
|
shape = RoundRectShape(radius, null, null)
|
||||||
|
paint.color = color
|
||||||
|
}
|
||||||
|
return drawable
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
binding = inflate(layoutInflater)
|
||||||
|
setContentView(binding.root)
|
||||||
|
init()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onStateChanged(source: LifecycleOwner, event: Lifecycle.Event) {
|
||||||
|
currEvent = event
|
||||||
|
if (Lifecycle.Event.ON_DESTROY == event && isShowing) {
|
||||||
|
dismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun init() {
|
||||||
|
if (context is ComponentActivity) {
|
||||||
|
context.lifecycle.addObserver(this)
|
||||||
|
}
|
||||||
|
setCanceledOnTouchOutside(true)
|
||||||
|
window?.setBackgroundDrawableResource(R.color.transparent)
|
||||||
|
width = (ScreenUtils.getScreenWidth() * 0.8).toInt()
|
||||||
|
height = WindowManager.LayoutParams.WRAP_CONTENT
|
||||||
|
setWidthHeight()
|
||||||
|
window?.setWindowAnimations(R.style.dialog_alpha)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun with(): BindingDialog<VB> {
|
||||||
|
create()
|
||||||
|
setBg()
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setAnimationsStyle(style: Int): BindingDialog<VB> {
|
||||||
|
window?.setWindowAnimations(style)
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置位置
|
||||||
|
*/
|
||||||
|
fun setGravity(gravity: Int, offX: Int, offY: Int): BindingDialog<VB> {
|
||||||
|
setGravity(gravity)
|
||||||
|
val layoutParams = window?.attributes
|
||||||
|
layoutParams?.x = offX
|
||||||
|
layoutParams?.y = offY
|
||||||
|
window?.attributes = layoutParams
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setGravity(gravity: Int): BindingDialog<VB> {
|
||||||
|
window?.setGravity(gravity)
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun setBottom(): BindingDialog<VB> {
|
||||||
|
setGravity(Gravity.BOTTOM)
|
||||||
|
setAnimationsStyle(R.style.dialog_translate)
|
||||||
|
setWidthRatio(1.0)
|
||||||
|
setDBgRadius(24, 24, 0, 0)
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setCenter(cancelable: Boolean = true): BindingDialog<VB> {
|
||||||
|
setGravity(Gravity.CENTER)
|
||||||
|
setWidthRatio(0.8)
|
||||||
|
setBgRadius(16)
|
||||||
|
setAnimationsStyle(R.style.dialog_alpha)
|
||||||
|
setCanceledOnTouchOutside(cancelable)
|
||||||
|
setCancelable(cancelable)
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun show() {
|
||||||
|
if (!isShowing) {
|
||||||
|
super.show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun thisShow(): DialogInterface {
|
||||||
|
this.show()
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 遮罩透明度
|
||||||
|
*
|
||||||
|
* @param value 0-1f
|
||||||
|
*/
|
||||||
|
fun setMaskValue(value: Float): BindingDialog<VB> {
|
||||||
|
window?.setDimAmount(value)
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>设置背景>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||||
|
open fun setBg(): BindingDialog<VB> {
|
||||||
|
if (leftTopRadius != 0 || rightTopRadius != 0 || rightBottomRadius != 0 || leftBottomRadius != 0) {
|
||||||
|
window?.setBackgroundDrawable(getRoundRectDrawable(leftTopRadius, rightTopRadius, rightBottomRadius, leftBottomRadius, bgColor))
|
||||||
|
} else {
|
||||||
|
window?.setBackgroundDrawable(getRoundRectDrawable(bgRadius, bgColor))
|
||||||
|
}
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置背景颜色
|
||||||
|
*/
|
||||||
|
fun setBgColor(@ColorInt color: Int): BindingDialog<VB> {
|
||||||
|
bgColor = color
|
||||||
|
return setBg()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setBgColorRes(colorRes: Int): BindingDialog<VB> {
|
||||||
|
bgColor = ContextCompat.getColor(context, colorRes)
|
||||||
|
return setBg()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置背景圆角
|
||||||
|
*/
|
||||||
|
fun setBgRadius(bgRadius: Int): BindingDialog<VB> {
|
||||||
|
this.bgRadius = bgRadius.dp
|
||||||
|
return setBg()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置背景不同圆角
|
||||||
|
*/
|
||||||
|
fun setDBgRadius(leftTopRadius: Int, rightTopRadius: Int, rightBottomRadius: Int, leftBottomRadius: Int): BindingDialog<VB> {
|
||||||
|
this.leftTopRadius = leftTopRadius.dp
|
||||||
|
this.rightTopRadius = rightTopRadius.dp
|
||||||
|
this.rightBottomRadius = rightBottomRadius.dp
|
||||||
|
this.leftBottomRadius = leftBottomRadius.dp
|
||||||
|
return setBg()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置背景圆角
|
||||||
|
*/
|
||||||
|
fun setBgRadiusPX(bgRadius: Int): BindingDialog<VB> {
|
||||||
|
this.bgRadius = bgRadius
|
||||||
|
return setBg()
|
||||||
|
}
|
||||||
|
|
||||||
|
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>设置宽高>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||||
|
/**
|
||||||
|
* 设置宽高
|
||||||
|
*/
|
||||||
|
open fun setWidthHeight(): BindingDialog<VB> {
|
||||||
|
val dialogWindow = window
|
||||||
|
val lp = dialogWindow?.attributes
|
||||||
|
lp?.width = width
|
||||||
|
lp?.height = height
|
||||||
|
dialogWindow?.attributes = lp
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setWidth(width: Int): BindingDialog<VB> {
|
||||||
|
this.width = width.dp
|
||||||
|
return setWidthHeight()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setWidthPX(width: Int): BindingDialog<VB> {
|
||||||
|
this.width = width
|
||||||
|
return setWidthHeight()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setHeight(height: Int): BindingDialog<VB> {
|
||||||
|
this.height = height.dp
|
||||||
|
return setWidthHeight()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setHeightPX(height: Int): BindingDialog<VB> {
|
||||||
|
this.height = height
|
||||||
|
return setWidthHeight()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置宽占屏幕的比例
|
||||||
|
*/
|
||||||
|
fun setWidthRatio(widthRatio: Double): BindingDialog<VB> {
|
||||||
|
width = (ScreenUtils.getScreenWidth() * widthRatio).toInt()
|
||||||
|
setWidthHeight()
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置高占屏幕的比例
|
||||||
|
*/
|
||||||
|
fun setHeightRatio(heightRatio: Double): BindingDialog<VB> {
|
||||||
|
height = (ScreenUtils.getHeightRealPixels() * heightRatio).toInt()
|
||||||
|
setWidthHeight()
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>设置监听>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||||
|
/**
|
||||||
|
* 设置监听
|
||||||
|
*/
|
||||||
|
open fun setOnClickListener(onClickListener: DialogOnClickListener, vararg viewIds: Int): BindingDialog<VB> {
|
||||||
|
val lDialog: BindingDialog<VB> = this
|
||||||
|
for (element in viewIds) {
|
||||||
|
getView<View>(element).setOnClickListener { v -> onClickListener.onClick(v, lDialog) }
|
||||||
|
}
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DialogOnClickListener {
|
||||||
|
fun onClick(v: View, lDialog: BindingDialog<*>)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置 关闭dialog的按钮
|
||||||
|
*/
|
||||||
|
fun setCancelBtn(viewId: Int): BindingDialog<VB> {
|
||||||
|
getView<View>(viewId)?.setOnClickListener(View.OnClickListener { dismiss() })
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>设置常见属性>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
fun <T : View> getView(@IdRes viewId: Int): T {
|
||||||
|
var view = views[viewId]
|
||||||
|
if (view == null) {
|
||||||
|
view = binding.root.findViewById<T>(viewId)
|
||||||
|
views[viewId] = view
|
||||||
|
}
|
||||||
|
return view as T
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will set the text of a TextView.
|
||||||
|
*
|
||||||
|
* @param viewId The view id.
|
||||||
|
* @param value The text to put in the text view.
|
||||||
|
* @return The BaseViewHolder for chaining.
|
||||||
|
*/
|
||||||
|
fun setText(@IdRes viewId: Int, value: CharSequence): BindingDialog<VB> {
|
||||||
|
val view = getView<TextView>(viewId)
|
||||||
|
view.text = value
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setText(@IdRes viewId: Int, @StringRes strId: Int): BindingDialog<VB> {
|
||||||
|
val view = getView<TextView>(viewId)
|
||||||
|
view.setText(strId)
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will set the image of an ImageView from a resource id.
|
||||||
|
*
|
||||||
|
* @param viewId The view id.
|
||||||
|
* @param imageResId The image resource id.
|
||||||
|
* @return The BaseViewHolder for chaining.
|
||||||
|
*/
|
||||||
|
fun setImageResource(@IdRes viewId: Int, @DrawableRes imageResId: Int): BindingDialog<VB> {
|
||||||
|
val view = getView<ImageView>(viewId)
|
||||||
|
view.setImageResource(imageResId)
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will set background color of a view.
|
||||||
|
*
|
||||||
|
* @param viewId The view id.
|
||||||
|
* @param color A color, not a resource id.
|
||||||
|
* @return The BaseViewHolder for chaining.
|
||||||
|
*/
|
||||||
|
fun setBackgroundColor(@IdRes viewId: Int, @ColorInt color: Int): BindingDialog<VB> {
|
||||||
|
val view = getView<View>(viewId)
|
||||||
|
view.setBackgroundColor(color)
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will set background of a view.
|
||||||
|
*
|
||||||
|
* @param viewId The view id.
|
||||||
|
* @param backgroundRes A resource to use as a background.
|
||||||
|
* @return The BaseViewHolder for chaining.
|
||||||
|
*/
|
||||||
|
fun setBackgroundRes(@IdRes viewId: Int, @DrawableRes backgroundRes: Int): BindingDialog<VB> {
|
||||||
|
val view = getView<View>(viewId)
|
||||||
|
view.setBackgroundResource(backgroundRes)
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will set text color of a TextView.
|
||||||
|
*
|
||||||
|
* @param viewId The view id.
|
||||||
|
* @param textColor The text color (not a resource id).
|
||||||
|
* @return The BaseViewHolder for chaining.
|
||||||
|
*/
|
||||||
|
fun setTextColor(@IdRes viewId: Int, @ColorInt textColor: Int): BindingDialog<VB> {
|
||||||
|
val view = getView<TextView>(viewId)
|
||||||
|
view.setTextColor(textColor)
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will set the image of an ImageView from a drawable.
|
||||||
|
*
|
||||||
|
* @param viewId The view id.
|
||||||
|
* @param drawable The image drawable.
|
||||||
|
* @return The BaseViewHolder for chaining.
|
||||||
|
*/
|
||||||
|
fun setImageDrawable(@IdRes viewId: Int, drawable: Drawable): BindingDialog<VB> {
|
||||||
|
val view = getView<ImageView>(viewId)
|
||||||
|
view.setImageDrawable(drawable)
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add an action to set the image of an image view. Can be called multiple times.
|
||||||
|
*/
|
||||||
|
fun setImageBitmap(@IdRes viewId: Int, bitmap: Bitmap): BindingDialog<VB> {
|
||||||
|
val view = getView<ImageView>(viewId)
|
||||||
|
view.setImageBitmap(bitmap)
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add an action to set the alpha of a view. Can be called multiple times.
|
||||||
|
* Alpha between 0-1.
|
||||||
|
*/
|
||||||
|
fun setAlpha(@IdRes viewId: Int, value: Float): BindingDialog<VB> {
|
||||||
|
getView<View>(viewId).alpha = value
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a view visibility to VISIBLE (true) or GONE (false).
|
||||||
|
*
|
||||||
|
* @param viewId The view id.
|
||||||
|
* @param visible True for VISIBLE, false for GONE.
|
||||||
|
* @return The BaseViewHolder for chaining.
|
||||||
|
*/
|
||||||
|
fun setGone(@IdRes viewId: Int, visible: Boolean): BindingDialog<VB> {
|
||||||
|
val view = getView<View>(viewId)
|
||||||
|
view.visibility = if (visible) View.VISIBLE else View.GONE
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a view visibility to VISIBLE (true) or INVISIBLE (false).
|
||||||
|
*
|
||||||
|
* @param viewId The view id.
|
||||||
|
* @param visible True for VISIBLE, false for INVISIBLE.
|
||||||
|
* @return The BaseViewHolder for chaining.
|
||||||
|
*/
|
||||||
|
fun setVisible(@IdRes viewId: Int, visible: Boolean): BindingDialog<VB> {
|
||||||
|
val view = getView<View>(viewId)
|
||||||
|
view.visibility = if (visible) View.VISIBLE else View.INVISIBLE
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- 渐变 -->
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:duration="300"
|
||||||
|
tools:ignore="ResourceName">
|
||||||
|
<alpha
|
||||||
|
android:fromAlpha="1"
|
||||||
|
android:toAlpha="0"/>
|
||||||
|
</set>
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- 渐变 -->
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:duration="100"
|
||||||
|
tools:ignore="ResourceName">
|
||||||
|
<alpha
|
||||||
|
android:fromAlpha="0"
|
||||||
|
android:toAlpha="1"/>
|
||||||
|
</set>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- 平移 -->
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:duration="200"
|
||||||
|
tools:ignore="ResourceName">
|
||||||
|
|
||||||
|
<translate
|
||||||
|
android:duration="300"
|
||||||
|
android:fromXDelta="0%"
|
||||||
|
android:fromYDelta="0%"
|
||||||
|
android:interpolator="@android:anim/accelerate_interpolator"
|
||||||
|
android:toXDelta="0%"
|
||||||
|
android:toYDelta="100%" />
|
||||||
|
|
||||||
|
</set>
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- 平移 -->
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:duration="200"
|
||||||
|
tools:ignore="ResourceName">
|
||||||
|
|
||||||
|
<translate
|
||||||
|
android:duration="100"
|
||||||
|
android:fromXDelta="0%"
|
||||||
|
android:fromYDelta="100%"
|
||||||
|
android:interpolator="@android:anim/accelerate_interpolator"
|
||||||
|
android:toXDelta="0%"
|
||||||
|
android:toYDelta="0%" />
|
||||||
|
</set>
|
||||||
|
|
@ -46,4 +46,7 @@
|
||||||
<color name="md_theme_surfaceContainer">#FFE9E9</color>
|
<color name="md_theme_surfaceContainer">#FFE9E9</color>
|
||||||
<color name="md_theme_surfaceContainerHigh">#FFE1E1</color>
|
<color name="md_theme_surfaceContainerHigh">#FFE1E1</color>
|
||||||
<color name="md_theme_surfaceContainerHighest">#FCDBDB</color>
|
<color name="md_theme_surfaceContainerHighest">#FCDBDB</color>
|
||||||
|
|
||||||
|
|
||||||
|
<color name="transparent">00000000</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<item name="fake_status_bar_view" type="id" tools:ignore="ResourceName" />
|
||||||
|
<item name="view_last_click_timestamp" type="id" tools:ignore="ResourceName" />
|
||||||
|
|
||||||
|
|
||||||
|
</resources>
|
||||||
|
|
@ -25,4 +25,25 @@
|
||||||
<item name="android:textStyle">normal</item>
|
<item name="android:textStyle">normal</item>
|
||||||
<item name="android:textColor">?attr/colorOnSurface</item>
|
<item name="android:textColor">?attr/colorOnSurface</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<style name="LDialog" parent="@android:style/Theme.Dialog" tools:ignore="ResourceName">
|
||||||
|
<item name="android:windowBackground">@color/transparent</item>
|
||||||
|
<item name="android:background">@color/transparent</item>
|
||||||
|
<item name="android:windowNoTitle">true</item>
|
||||||
|
<item name="android:windowFrame">@null</item>
|
||||||
|
<item name="android:windowIsFloating">true</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="dialog_alpha" parent="android:Animation" tools:ignore="ResourceName">
|
||||||
|
<item name="android:windowEnterAnimation">@anim/dialog_alpha_show</item>
|
||||||
|
<item name="android:windowExitAnimation">@anim/dialog_alpha_cancel</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="dialog_translate" parent="android:Animation" tools:ignore="ResourceName">
|
||||||
|
<item name="android:windowEnterAnimation">@anim/dialog_translate_show</item>
|
||||||
|
<item name="android:windowExitAnimation">@anim/dialog_translate_cancel</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
Loading…
Reference in New Issue