Commit 39843456 authored by 张释方's avatar 张释方

代码提交

parent 584c5bec
package com.mints.street.main.my
import android.os.Bundle
import com.mints.street.databinding.ActivityAboutusBinding
import com.fry.base.base.BaseActivity
import com.mints.street.BR
import com.mints.street.R
class AboutusActivity :BaseActivity<ActivityAboutusBinding, AboutusViewModel>() {
override fun initVariableId() = BR.viewModel
override fun initContentView(savedInstanceState: Bundle?)= R.layout.activity_aboutus
}
package com.mints.street.main.my
import android.app.Application
import me.goldze.mvvmhabit.base.BaseViewModel
class AboutusViewModel(application: Application): BaseViewModel(application) {
}
\ No newline at end of file
package com.mints.street.main.my
import android.os.Bundle
import com.fry.base.base.BaseActivity
import com.mints.street.BR
import com.mints.street.R
import com.mints.street.databinding.ActivityMoresettingsBinding
class MoresettingsActivity: BaseActivity<ActivityMoresettingsBinding, MoresettingsViewModel>() {
override fun initVariableId() = BR.viewModel
override fun initContentView(savedInstanceState: Bundle?)= R.layout.activity_moresettings
}
package com.mints.street.main.my
import android.app.Application
import me.goldze.mvvmhabit.base.BaseViewModel
class MoresettingsViewModel(application: Application): BaseViewModel(application) {
}
package com.mints.street.main.my package com.mints.street.main.my
import android.graphics.drawable.BitmapDrawable
import android.os.Bundle import android.os.Bundle
import android.view.Gravity
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.PopupWindow
import androidx.activity.OnBackPressedCallback
import com.fry.base.base.BaseFragment import com.fry.base.base.BaseFragment
import com.mints.street.BR import com.mints.street.BR
import com.mints.street.R import com.mints.street.R
import com.mints.street.databinding.FragmentMyBinding import com.mints.street.databinding.FragmentMyBinding
import kotlinx.android.synthetic.main.fragment_my.*
/** /**
* Created by 冯瑞雨 on 2021/7/2. * Created by 冯瑞雨 on 2021/7/2.
* 个人中心页面 * 个人中心页面
*/ */
class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>() { class MyFragment : BaseFragment<FragmentMyBinding, MyViewModel>(), View.OnClickListener {
private var popupWindow: PopupWindow? = null
private var contentView: View? = null
override fun initContentView(inflater: LayoutInflater?, override fun initContentView(inflater: LayoutInflater?,
container: ViewGroup?, container: ViewGroup?,
savedInstanceState: Bundle?) = R.layout.fragment_my savedInstanceState: Bundle?) = R.layout.fragment_my
override fun initVariableId() = BR.viewModel override fun initVariableId() = BR.viewModel
override fun initData() {
super.initData()
ly_aboutus.setOnClickListener(this)
ly_moresettings.setOnClickListener(this)
requireActivity().onBackPressedDispatcher.addCallback(
this,
object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
//监听到后要执行的逻辑
if (popupWindow != null && popupWindow!!.isShowing()) {
popupWindow?.dismiss();
}
}
})
}
override fun onClick(v: View?) {
when (v?.id) {
R.id.ly_aboutus -> {
startActivity(AboutusActivity::class.java)
}
R.id.ly_moresettings -> {
startActivity(MoresettingsActivity::class.java)
}
R.id.ll_my_login -> {
//这里需要加判断
showPopwindow();
}
}
}
private fun showPopwindow() {
//加载弹出框的布局
contentView = LayoutInflater.from(context).inflate(
R.layout.layout_popupwindow, null);
// 设置按钮的点击事件
popupWindow = PopupWindow(contentView,
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT)
popupWindow!!.isFocusable = true // 取得焦点
//注意 要是点击外部空白处弹框消息 那么必须给弹框设置一个背景色 不然是不起作用的
//注意 要是点击外部空白处弹框消息 那么必须给弹框设置一个背景色 不然是不起作用的
popupWindow!!.setBackgroundDrawable(BitmapDrawable())
//点击外部消失
//点击外部消失
popupWindow!!.isOutsideTouchable = true
//设置可以点击
//设置可以点击
popupWindow!!.isTouchable = true
//进入退出的动画,指定刚才定义的style
//进入退出的动画,指定刚才定义的style
popupWindow!!.animationStyle = R.style.ipopwindow_anim_style
}
fun openPopWindow(v: View?) {
//从底部显示
popupWindow!!.showAtLocation(contentView, Gravity.BOTTOM, 0, 0)
}
} }
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="800"
android:fromYDelta="0"
android:toYDelta="50%p" />
<alpha
android:duration="1000"
android:fromAlpha="1.0"
android:toAlpha="0.0" />
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="800"
android:fromYDelta="100%p"
android:toYDelta="0" />
<alpha
android:duration="500"
android:fromAlpha="0.0"
android:toAlpha="1.0" />
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
name="ViewModel"
type="com.mints.street.main.my.AboutusViewModel" />
</data>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
name="ViewModel"
type="com.mints.street.main.my.MoresettingsViewModel" />
</data>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto"> <layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data> <data>
<variable <variable
name="ViewModel" name="ViewModel"
type="com.mints.street.main.my.MyViewModel" /> type="com.mints.street.main.my.MyViewModel" />
</data> </data>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
android:id="@+id/llMyRoot"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="wrap_content"
android:orientation="vertical">
<include layout="@layout/item_fragment_main_my_title" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginTop="19dp"
android:layout_marginEnd="15dp"
android:background="@drawable/shape_gold_card"
android:elevation="10dp"
android:orientation="vertical">
<LinearLayout
android:id="@+id/ly_aboutus"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentLeft="true"
android:layout_marginStart="15dp"
android:layout_marginTop="20dp"
android:src="@mipmap/iv_about_us" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="18dp"
android:layout_weight="1"
android:text="关于我们"
android:textColor="@color/black"
android:textSize="18sp" />
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentEnd="true"
android:layout_marginTop="20dp"
android:layout_marginEnd="11dp"
android:src="@mipmap/bg_right" />
</LinearLayout>
<View
android:layout_width="328pt"
android:layout_height="1dp"
android:layout_marginStart="13dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="14dp"
android:background="#979797" />
<LinearLayout
android:id="@+id/ly_moresettings"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentLeft="true"
android:layout_marginStart="15dp"
android:layout_marginTop="20dp"
android:src="@mipmap/iv_more_settings" />
<TextView <TextView
android:id="@+id/tv1"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent" android:layout_marginLeft="5dp"
app:layout_constraintStart_toStartOf="parent" android:layout_marginTop="18dp"
android:text="个人中心" android:layout_weight="1"
android:text="更多设置"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="39dp" android:textSize="18sp" />
/>
</androidx.constraintlayout.widget.ConstraintLayout> <ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentEnd="true"
android:layout_marginTop="20dp"
android:layout_marginEnd="11dp"
android:layout_marginBottom="20dp"
android:src="@mipmap/bg_right" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</layout> </layout>
\ No newline at end of file
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#553b3a3a">
<LinearLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@android:color/white"
android:orientation="vertical">
<TextView
android:id="@+id/open_from_camera"
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="center"
android:padding="8dp"
android:text="相机"
android:textColor="#333"
android:textSize="15sp" />
<TextView
android:id="@+id/open_album"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginTop="1dp"
android:gravity="center"
android:padding="8dp"
android:text="打开图库"
android:textColor="#333"
android:textSize="15sp" />
<TextView
android:id="@+id/cancel"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginTop="1dp"
android:gravity="center"
android:padding="8dp"
android:text="取消"
android:textColor="#333"
android:textSize="15sp" />
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
...@@ -139,7 +139,12 @@ ...@@ -139,7 +139,12 @@
<item name="android:layout_height">1px</item> <item name="android:layout_height">1px</item>
<item name="android:background">#d3d3d3</item> <item name="android:background">#d3d3d3</item>
</style> </style>
<style name="ipopwindow_anim_style">
<item name="android:windowEnterAnimation">@anim/popshow_anim</item>
<!-- 指定显示的动画xml -->
<item name="android:windowExitAnimation">@anim/pophidden</item>
<!-- 指定消失的动画xml -->
</style>
</resources> </resources>
\ No newline at end of file
#Thu Jul 08 18:38:39 CST 2021 #Fri Jul 09 14:31:29 CST 2021
VERSION_BUILD=2597 VERSION_BUILD=2603
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment