Skip to content

Commit

Permalink
change some style
Browse files Browse the repository at this point in the history
  • Loading branch information
licoba committed May 16, 2023
1 parent 423d3c6 commit ea17b25
Show file tree
Hide file tree
Showing 7 changed files with 189 additions and 114 deletions.
1 change: 0 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ dependencies {
//自定义FAB控件
implementation 'com.github.clans:fab:1.6.4'
//自定义Toast控件
implementation 'com.github.hss01248:Toasty:2.0.4'
implementation 'com.github.GrenderG:Toasty:1.5.2'
//数据库框架GreenDao
implementation 'org.greenrobot:greendao:3.3.0'
// add library
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ class MainActivity : BaseActivity() {
private var listView: ListView? = null
private var toolbar: Toolbar? = null
private var mPopWindow: PopupWindow? = null
private val mPopTip: PopupWindow? = null
private var llEmpty: LinearLayout? = null
var accountsList: MutableList<Account> = mutableListOf()
lateinit var qb: QueryBuilder<Account>
Expand Down Expand Up @@ -205,7 +204,8 @@ class MainActivity : BaseActivity() {
inner class myItemClickListener : AdapterView.OnItemClickListener {
override fun onItemClick(adapterView: AdapterView<*>, view: View, i: Int, l: Long) {
val account = adapterView.getItemAtPosition(i) as Account
PopAccountDetail(this@MainActivity,account).showPopupWindow()
PopAccountDetail(this@MainActivity, account)
.showPopupWindow()
}
}

Expand Down Expand Up @@ -355,8 +355,7 @@ class MainActivity : BaseActivity() {
}



// @Override
// @Override
// protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// super.onActivityResult(requestCode, resultCode, data);
// if (resultCode == RESULT_OK) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.example.dibage.accountb.dao.DaoSession
import com.kongzue.dialogx.DialogX
import com.kongzue.dialogx.dialogs.MessageDialog
import com.tencent.mmkv.MMKV
import es.dmoral.toasty.Toasty
import skin.support.SkinCompatManager
import skin.support.app.SkinAppCompatViewInflater
import skin.support.app.SkinCardViewInflater
Expand Down Expand Up @@ -46,6 +47,10 @@ class MyApplication : Application() {
// .addInflater(SkinCardViewInflater()) // CardView v7 控件换肤初始化[可选]
// .setSkinWindowBackgroundEnable(false) // 关闭windowBackground换肤,默认打开[可选]
// .loadSkin()

Toasty.Config.getInstance()
.allowQueue(false)
.apply()
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import android.content.Context
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.AccelerateDecelerateInterpolator
import android.view.animation.Animation
import android.view.animation.DecelerateInterpolator
import android.view.animation.OvershootInterpolator
import android.widget.LinearLayout
import android.widget.TextView
Expand All @@ -18,6 +21,7 @@ import com.example.dibage.accountb.base.BaseActivity
import com.example.dibage.accountb.databinding.PopDetailBinding
import com.example.dibage.accountb.entitys.Account
import es.dmoral.toasty.Toasty
import razerdp.basepopup.BasePopupFlag
import razerdp.basepopup.BasePopupWindow
import razerdp.util.animation.AnimationHelper
import razerdp.util.animation.ScaleConfig
Expand All @@ -32,8 +36,11 @@ class PopAccountDetail(context: Context, account: Account) : BasePopupWindow(con

init {
contentView = mBinding.root
popupGravity = Gravity.BOTTOM
setOverlayNavigationBar(true)
setOverlayNavigationBarMode(BasePopupFlag.OVERLAY_MASK)
setOverlayNavigationBarMode(BasePopupFlag.OVERLAY_CONTENT)

popupGravity = Gravity.CENTER
val tv1: TextView = contentView.findViewById(R.id.tv_description)
val tv2: TextView = contentView.findViewById(R.id.tv_username)
val tv3: TextView = contentView.findViewById(R.id.tv_password)
Expand All @@ -42,47 +49,51 @@ class PopAccountDetail(context: Context, account: Account) : BasePopupWindow(con
tv1.text = account.description
tv2.text = account.username
tv3.text = account.password
tv4.text = account.remark
val layout1 = contentView.findViewById<LinearLayout>(R.id.layout1)
val layout2 = contentView.findViewById<LinearLayout>(R.id.layout2)
val layout3 = contentView.findViewById<LinearLayout>(R.id.layout3)
tv4.text = account.remark.ifEmpty { "" }
val layout1 = contentView.findViewById<ViewGroup>(R.id.layout1)
val layout2 = contentView.findViewById<ViewGroup>(R.id.layout2)
val layout3 = contentView.findViewById<ViewGroup>(R.id.layout3)
layout1.setOnClickListener {
dismiss();
val cmb = context
.getSystemService(BaseActivity.CLIPBOARD_SERVICE) as ClipboardManager
cmb.text = account.username
Toasty.success(context, "账号已复制", Toast.LENGTH_SHORT, true).show()
}
layout2.setOnClickListener {
dismiss();
val cmb = context
.getSystemService(BaseActivity.CLIPBOARD_SERVICE) as ClipboardManager
cmb.text = account.password
Toasty.success(context, "密码已复制", Toast.LENGTH_SHORT, true).show()
}
layout3.setOnClickListener {
val cmb = context
.getSystemService(BaseActivity.CLIPBOARD_SERVICE) as ClipboardManager
cmb.text = account.remark
Toasty.success(context, "备注已复制", Toast.LENGTH_SHORT, true).show()
}
}


override fun onCreateShowAnimator(): Animator {
val animator = ValueAnimator.ofFloat(0.0f, 1.0f)
val animator = ValueAnimator.ofFloat(1.0f, 0.0f)
animator.duration = 200 // 设置动画时间为 100 毫秒
// 设置差值器,使得动画变化速率先慢后快
animator.interpolator = AccelerateDecelerateInterpolator()
animator.addUpdateListener {
val value = it.animatedValue as Float
displayAnimateView.alpha = value
displayAnimateView.translationY = displayAnimateView.height * value
}
return animator
}



override fun onCreateDismissAnimator(): Animator {
val animator = ValueAnimator.ofFloat(1.0f, 0.0f)
animator.duration = 120 // 设置动画时间为 100 毫秒
val animator = ValueAnimator.ofFloat(0.0f, 1.0f)
animator.duration = 200 // 设置动画时间为 100 毫秒
animator.interpolator = DecelerateInterpolator()
animator.addUpdateListener {
val value = it.animatedValue as Float
// displayAnimateView.scaleX = value
// displayAnimateView.scaleY = value
displayAnimateView.alpha = value
displayAnimateView.translationY = displayAnimateView.height * value
}
return animator
}
Expand Down
19 changes: 19 additions & 0 deletions app/src/main/res/drawable/popwindow_bottom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>

<!--<shape xmlns:android="http://schemas.android.com/apk/res/android">-->
<!--&lt;!&ndash; 设置填充颜色 &ndash;&gt;-->
<!--<solid android:color="@color/WhiteText" />-->

<!--&lt;!&ndash; 设置几何图形四个角的弧度 &ndash;&gt;-->
<!--<corners android:radius="50dp"/>-->

<!--</shape>-->

<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/WhiteText" />
<corners
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp"
android:topLeftRadius="12dp"
android:topRightRadius="12dp" />
</shape>
Loading

0 comments on commit ea17b25

Please sign in to comment.