作者 liyan

修改BaseFragment2

@@ -109,16 +109,16 @@ abstract class BaseActivity : AppCompatActivity() { @@ -109,16 +109,16 @@ abstract class BaseActivity : AppCompatActivity() {
109 109
110 open fun reLoad() {} 110 open fun reLoad() {}
111 111
112 - override fun onBackPressed() {  
113 - val time = System.currentTimeMillis()  
114 -  
115 - if (time - mExitTime > 2000) {  
116 -// toast(getString(R.string.exit_app))  
117 - mExitTime = time  
118 - } else {  
119 - AppManager.instance.exitApp(this)  
120 - }  
121 - } 112 +// override fun onBackPressed() {
  113 +// val time = System.currentTimeMillis()
  114 +//
  115 +// if (time - mExitTime > 2000) {
  116 +//// toast(getString(R.string.exit_app))
  117 +// mExitTime = time
  118 +// } else {
  119 +// AppManager.instance.exitApp(this)
  120 +// }
  121 +// }
122 122
123 fun setUpReveal(savedInstanceState: Bundle?) { 123 fun setUpReveal(savedInstanceState: Bundle?) {
124 setReveal(savedInstanceState) 124 setReveal(savedInstanceState)
@@ -57,7 +57,6 @@ abstract class BaseFragment : Fragment() { @@ -57,7 +57,6 @@ abstract class BaseFragment : Fragment() {
57 open fun reLoad() = initData() 57 open fun reLoad() = initData()
58 58
59 59
60 - abstract fun getLayoutId(): Int  
61 60
62 private fun initStatusColor(color: Int) { 61 private fun initStatusColor(color: Int) {
63 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { 62 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
@@ -14,8 +14,4 @@ class BankFragment :BaseLifeCycleFragment<BankViewModel,FragmentBankBinding>(Fra @@ -14,8 +14,4 @@ class BankFragment :BaseLifeCycleFragment<BankViewModel,FragmentBankBinding>(Fra
14 override fun initDataObserver() { 14 override fun initDataObserver() {
15 15
16 } 16 }
17 -  
18 - override fun getLayoutId(): Int {  
19 - return R.layout.fragment_bank  
20 - }  
21 } 17 }
@@ -41,9 +41,6 @@ class HomeFragment : BaseLifeCycleFragment<MineViewModel,FragmentHomeBinding>(Fr @@ -41,9 +41,6 @@ class HomeFragment : BaseLifeCycleFragment<MineViewModel,FragmentHomeBinding>(Fr
41 41
42 } 42 }
43 43
44 - override fun getLayoutId(): Int {  
45 - return R.layout.fragment_home  
46 - }  
47 } 44 }
48 //class HomeFragment : Fragment() { 45 //class HomeFragment : Fragment() {
49 // override fun onCreateView( 46 // override fun onCreateView(
@@ -15,8 +15,5 @@ class MineFragment :BaseLifeCycleFragment<MineViewModel,FragmentMineBinding>(Fra @@ -15,8 +15,5 @@ class MineFragment :BaseLifeCycleFragment<MineViewModel,FragmentMineBinding>(Fra
15 override fun initDataObserver() { 15 override fun initDataObserver() {
16 16
17 } 17 }
18 -  
19 - override fun getLayoutId(): Int {  
20 - return R.layout.fragment_mine  
21 - } 18 +
22 } 19 }
@@ -4,10 +4,48 @@ @@ -4,10 +4,48 @@
4 android:layout_width="match_parent" 4 android:layout_width="match_parent"
5 android:layout_height="match_parent"> 5 android:layout_height="match_parent">
6 6
7 - <TextView  
8 - android:layout_gravity="center_horizontal"  
9 - android:gravity="center"  
10 - android:text="home" 7 + <LinearLayout
11 android:layout_width="match_parent" 8 android:layout_width="match_parent"
12 - android:layout_height="match_parent" /> 9 + android:layout_height="?actionBarSize"
  10 + android:background="@color/white"
  11 + android:orientation="horizontal"
  12 + android:paddingStart="16dp"
  13 + android:paddingEnd="16dp">
  14 +
  15 + <ImageView
  16 + android:layout_width="87dp"
  17 + android:layout_height="26dp"
  18 + android:layout_gravity="center_vertical"
  19 + android:background="@color/color_96"
  20 + android:contentDescription="@string/logo" />
  21 +
  22 + <RelativeLayout
  23 + android:id="@+id/search"
  24 + android:layout_width="match_parent"
  25 + android:layout_height="32dp"
  26 + android:layout_gravity="center_vertical"
  27 + android:layout_marginStart="8dp"
  28 + android:background="@drawable/search_back">
  29 +
  30 + <TextView
  31 + android:layout_width="wrap_content"
  32 + android:layout_height="wrap_content"
  33 + android:layout_centerInParent="true"
  34 + android:text="搜索"
  35 + android:textColor="@color/white"
  36 + android:textSize="14sp" />
  37 +
  38 + <ImageView
  39 + android:layout_width="40dp"
  40 + android:layout_height="28dp"
  41 + android:layout_alignParentEnd="true"
  42 + android:layout_centerVertical="true"
  43 + android:layout_marginEnd="2dp"
  44 + android:background="@drawable/solid_ff_14"
  45 + android:contentDescription="@string/logo"
  46 + android:paddingStart="12dp"
  47 + android:paddingEnd="12dp"
  48 + android:src="@mipmap/search" />
  49 + </RelativeLayout>
  50 + </LinearLayout>
13 </LinearLayout> 51 </LinearLayout>