浏览代码

product model

dola 1 年之前
父节点
当前提交
f43dbcc327

+ 5 - 0
app/src/main/java/com/sambath/kunkhmer/app/MainActivity.kt

@@ -8,6 +8,7 @@ import androidx.navigation.ui.setupWithNavController
 import com.google.android.material.bottomnavigation.BottomNavigationView
 import com.sambath.kunkhmer.R
 import com.sambath.kunkhmer.screen.fighter.FighterFragment
+import kotlinx.android.synthetic.main.app_bar_boxing.iv_account
 
 class MainActivity : AppCompatActivity(), FighterFragment.TabSelectionListener {
 
@@ -31,6 +32,10 @@ class MainActivity : AppCompatActivity(), FighterFragment.TabSelectionListener {
 
         //setupActionBarWithNavController(navController, appBarConfiguration)
         navView.setupWithNavController(navController)
+
+        iv_account.setOnClickListener{
+            findNavController(R.id.nav_host_fragment_activity_main).navigate(R.id.navigation_account)
+        }
     }
 
     override fun onTabSelected(tabIndex: Int) {

+ 60 - 0
app/src/main/java/com/sambath/kunkhmer/screen/account/AccountFragment.kt

@@ -0,0 +1,60 @@
+package com.sambath.kunkhmer.screen.account
+
+import android.os.Bundle
+import androidx.fragment.app.Fragment
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import com.sambath.kunkhmer.R
+
+// TODO: Rename parameter arguments, choose names that match
+// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
+private const val ARG_PARAM1 = "param1"
+private const val ARG_PARAM2 = "param2"
+
+/**
+ * A simple [Fragment] subclass.
+ * Use the [AccountFragment.newInstance] factory method to
+ * create an instance of this fragment.
+ */
+class AccountFragment : Fragment() {
+    // TODO: Rename and change types of parameters
+    private var param1: String? = null
+    private var param2: String? = null
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+        arguments?.let {
+            param1 = it.getString(ARG_PARAM1)
+            param2 = it.getString(ARG_PARAM2)
+        }
+    }
+
+    override fun onCreateView(
+        inflater: LayoutInflater, container: ViewGroup?,
+        savedInstanceState: Bundle?
+    ): View? {
+        // Inflate the layout for this fragment
+        return inflater.inflate(R.layout.fragment_account, container, false)
+    }
+
+    companion object {
+        /**
+         * Use this factory method to create a new instance of
+         * this fragment using the provided parameters.
+         *
+         * @param param1 Parameter 1.
+         * @param param2 Parameter 2.
+         * @return A new instance of fragment AccountFragment.
+         */
+        // TODO: Rename and change types and number of parameters
+        @JvmStatic
+        fun newInstance(param1: String, param2: String) =
+            AccountFragment().apply {
+                arguments = Bundle().apply {
+                    putString(ARG_PARAM1, param1)
+                    putString(ARG_PARAM2, param2)
+                }
+            }
+    }
+}

+ 2 - 2
app/src/main/res/layout/app_bar_boxing.xml

@@ -37,12 +37,12 @@
                 android:id="@+id/iv_account"
                 android:layout_width="24dp"
                 android:layout_height="wrap_content"
-                android:layout_marginEnd="8dp"
+                android:layout_marginEnd="12dp"
                 android:adjustViewBounds="true"
                 android:background="?attr/selectableItemBackgroundBorderless"
                 android:clickable="true"
                 android:focusable="true"
-                android:visibility="gone"
+                android:visibility="visible"
                 android:scaleType="fitXY"
                 android:src="@drawable/ic_user_white"
                 app:layout_constraintBottom_toBottomOf="@+id/iv_logo"

+ 6 - 0
app/src/main/res/layout/fragment_account.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 14 - 0
app/src/main/res/layout/fragment_account2.xml

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    tools:context=".screen.account.AccountFragment">
+
+    <!-- TODO: Update blank fragment layout -->
+    <TextView
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:text="@string/hello_blank_fragment" />
+
+</FrameLayout>

+ 6 - 0
app/src/main/res/navigation/mobile_navigation.xml

@@ -35,4 +35,10 @@
         android:label="@string/title_shop"
         tools:layout="@layout/fragment_notifications" />
 
+    <fragment
+        android:id="@+id/navigation_account"
+        android:name="com.sambath.kunkhmer.screen.account.AccountFragment"
+        android:label="@string/account"
+        tools:layout="@layout/fragment_account"/>
+
 </navigation>

+ 1 - 0
app/src/main/res/values/strings.xml

@@ -85,4 +85,5 @@
     <string name="news_detail_title">News Title</string>
     <string name="description">Description</string>
     <string name="top_news">TOP NEWS</string>
+    <string name="account">Account</string>
 </resources>