From 08e218697fc4a19d5a88e6f4bb74aac44500b9c7 Mon Sep 17 00:00:00 2001 From: Nolan Chappuis Date: Thu, 21 May 2020 14:05:57 +0200 Subject: [PATCH 01/20] inital commit --- app/src/main/java/ch/epfl/sdp/ui/MainActivity.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/ch/epfl/sdp/ui/MainActivity.kt b/app/src/main/java/ch/epfl/sdp/ui/MainActivity.kt index ee66b3fb0..38c8264a5 100644 --- a/app/src/main/java/ch/epfl/sdp/ui/MainActivity.kt +++ b/app/src/main/java/ch/epfl/sdp/ui/MainActivity.kt @@ -7,6 +7,7 @@ import android.os.Bundle import android.view.Menu import android.view.MenuItem import android.view.View +import android.widget.EditText import androidx.annotation.RequiresApi import androidx.appcompat.app.AppCompatActivity import androidx.core.view.GravityCompat @@ -35,6 +36,7 @@ class MainActivity : AppCompatActivity() { private lateinit var appBarConfiguration: AppBarConfiguration private lateinit var snackbar: Snackbar + private lateinit var textGroup: EditText companion object { private const val SEARCH_GROUP_SELECTION_ACTIVITY_REQUEST_CODE = 7865 @@ -94,7 +96,7 @@ class MainActivity : AppCompatActivity() { .putString(getString(R.string.pref_key_current_group_id), it) .apply() }) - + textGroup.setText("test") //TODO Get role of current search group } From 4ed4b91206579c8677e2bcad732cdd0c99a981de Mon Sep 17 00:00:00 2001 From: Nolan Chappuis Date: Thu, 21 May 2020 14:38:49 +0200 Subject: [PATCH 02/20] Create textfield --- .../main/java/ch/epfl/sdp/ui/MainActivity.kt | 8 ++++++-- app/src/main/res/layout/fragment_home.xml | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/ch/epfl/sdp/ui/MainActivity.kt b/app/src/main/java/ch/epfl/sdp/ui/MainActivity.kt index 38c8264a5..989715060 100644 --- a/app/src/main/java/ch/epfl/sdp/ui/MainActivity.kt +++ b/app/src/main/java/ch/epfl/sdp/ui/MainActivity.kt @@ -8,6 +8,7 @@ import android.view.Menu import android.view.MenuItem import android.view.View import android.widget.EditText +import android.widget.TextView import androidx.annotation.RequiresApi import androidx.appcompat.app.AppCompatActivity import androidx.core.view.GravityCompat @@ -36,7 +37,6 @@ class MainActivity : AppCompatActivity() { private lateinit var appBarConfiguration: AppBarConfiguration private lateinit var snackbar: Snackbar - private lateinit var textGroup: EditText companion object { private const val SEARCH_GROUP_SELECTION_ACTIVITY_REQUEST_CODE = 7865 @@ -56,6 +56,7 @@ class MainActivity : AppCompatActivity() { configureNavigationView() loadActiveGroupFromPrefs() + setTextGroup() } private fun configureNavigationView() { @@ -96,7 +97,6 @@ class MainActivity : AppCompatActivity() { .putString(getString(R.string.pref_key_current_group_id), it) .apply() }) - textGroup.setText("test") //TODO Get role of current search group } @@ -182,4 +182,8 @@ class MainActivity : AppCompatActivity() { } Auth.onActivityResult(requestCode, resultCode, data) } + private fun setTextGroup(){ + val groupText = findViewById(R.id.current_group_text) + groupText.text = "test" + } } diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index c4f97bfbd..49c11f095 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -7,6 +7,7 @@ tools:context=".ui.home.HomeFragment"> + + + \ No newline at end of file From b070501c100f3d22ff4d9f94fe71fdd2f4022976 Mon Sep 17 00:00:00 2001 From: Nolan Chappuis Date: Thu, 21 May 2020 15:03:29 +0200 Subject: [PATCH 03/20] Try to resolve bug --- app/src/main/java/ch/epfl/sdp/ui/MainActivity.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/ch/epfl/sdp/ui/MainActivity.kt b/app/src/main/java/ch/epfl/sdp/ui/MainActivity.kt index 989715060..a4ea32874 100644 --- a/app/src/main/java/ch/epfl/sdp/ui/MainActivity.kt +++ b/app/src/main/java/ch/epfl/sdp/ui/MainActivity.kt @@ -9,6 +9,7 @@ import android.view.MenuItem import android.view.View import android.widget.EditText import android.widget.TextView +import android.widget.Toast import androidx.annotation.RequiresApi import androidx.appcompat.app.AppCompatActivity import androidx.core.view.GravityCompat @@ -184,6 +185,6 @@ class MainActivity : AppCompatActivity() { } private fun setTextGroup(){ val groupText = findViewById(R.id.current_group_text) - groupText.text = "test" + groupText.text="You current group is..." } } From 1c0a21aaaeed45878624e8939f9f6756ec5bbe1a Mon Sep 17 00:00:00 2001 From: Nolan Chappuis Date: Thu, 21 May 2020 15:34:42 +0200 Subject: [PATCH 04/20] Inflate layout to access fragment home --- app/src/main/java/ch/epfl/sdp/ui/MainActivity.kt | 7 +++++-- app/src/main/res/layout/nav_header_main.xml | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/ch/epfl/sdp/ui/MainActivity.kt b/app/src/main/java/ch/epfl/sdp/ui/MainActivity.kt index a4ea32874..f97c16431 100644 --- a/app/src/main/java/ch/epfl/sdp/ui/MainActivity.kt +++ b/app/src/main/java/ch/epfl/sdp/ui/MainActivity.kt @@ -4,6 +4,7 @@ import android.content.Intent import android.graphics.Color import android.os.Build import android.os.Bundle +import android.view.LayoutInflater import android.view.Menu import android.view.MenuItem import android.view.View @@ -184,7 +185,9 @@ class MainActivity : AppCompatActivity() { Auth.onActivityResult(requestCode, resultCode, data) } private fun setTextGroup(){ - val groupText = findViewById(R.id.current_group_text) - groupText.text="You current group is..." + val v = LayoutInflater.from(this).inflate(R.layout.fragment_home, null) + val groupText = v.findViewById(R.id.current_group_text) + //groupText.text="You current group is..." + Toast.makeText(this, groupText.text, Toast.LENGTH_SHORT).show() } } diff --git a/app/src/main/res/layout/nav_header_main.xml b/app/src/main/res/layout/nav_header_main.xml index a8fb3e072..0852ff5f5 100644 --- a/app/src/main/res/layout/nav_header_main.xml +++ b/app/src/main/res/layout/nav_header_main.xml @@ -17,4 +17,5 @@ android:name="ch.epfl.sdp.ui.home.LoginNavFragment" android:layout_width="match_parent" android:layout_height="match_parent" /> + From a62d81708446444ffee22443d3fd130880d9fe9e Mon Sep 17 00:00:00 2001 From: AlexisTabin Date: Thu, 21 May 2020 17:08:37 +0200 Subject: [PATCH 05/20] Simple help to Nolan --- .../main/java/ch/epfl/sdp/ui/MainActivity.kt | 11 -------- .../java/ch/epfl/sdp/ui/home/HomeFragment.kt | 7 ++++- app/src/main/res/layout/fragment_home.xml | 28 ++++++++----------- app/src/main/res/values/strings.xml | 1 + 4 files changed, 18 insertions(+), 29 deletions(-) diff --git a/app/src/main/java/ch/epfl/sdp/ui/MainActivity.kt b/app/src/main/java/ch/epfl/sdp/ui/MainActivity.kt index f97c16431..77e47a479 100644 --- a/app/src/main/java/ch/epfl/sdp/ui/MainActivity.kt +++ b/app/src/main/java/ch/epfl/sdp/ui/MainActivity.kt @@ -4,13 +4,9 @@ import android.content.Intent import android.graphics.Color import android.os.Build import android.os.Bundle -import android.view.LayoutInflater import android.view.Menu import android.view.MenuItem import android.view.View -import android.widget.EditText -import android.widget.TextView -import android.widget.Toast import androidx.annotation.RequiresApi import androidx.appcompat.app.AppCompatActivity import androidx.core.view.GravityCompat @@ -58,7 +54,6 @@ class MainActivity : AppCompatActivity() { configureNavigationView() loadActiveGroupFromPrefs() - setTextGroup() } private fun configureNavigationView() { @@ -184,10 +179,4 @@ class MainActivity : AppCompatActivity() { } Auth.onActivityResult(requestCode, resultCode, data) } - private fun setTextGroup(){ - val v = LayoutInflater.from(this).inflate(R.layout.fragment_home, null) - val groupText = v.findViewById(R.id.current_group_text) - //groupText.text="You current group is..." - Toast.makeText(this, groupText.text, Toast.LENGTH_SHORT).show() - } } diff --git a/app/src/main/java/ch/epfl/sdp/ui/home/HomeFragment.kt b/app/src/main/java/ch/epfl/sdp/ui/home/HomeFragment.kt index fac2acde6..9d815e765 100644 --- a/app/src/main/java/ch/epfl/sdp/ui/home/HomeFragment.kt +++ b/app/src/main/java/ch/epfl/sdp/ui/home/HomeFragment.kt @@ -4,8 +4,10 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.widget.TextView import androidx.fragment.app.Fragment import androidx.lifecycle.ViewModelProvider +import ch.epfl.sdp.MainApplication import ch.epfl.sdp.R @@ -18,7 +20,10 @@ class HomeFragment : Fragment() { container: ViewGroup?, savedInstanceState: Bundle? ): View? { + val v = inflater.inflate(R.layout.fragment_home, container, false) homeViewModel = ViewModelProvider(this).get(HomeViewModel::class.java) - return inflater.inflate(R.layout.fragment_home, container, false) + var groupText = v.findViewById(R.id.current_group_text) + groupText?.text = MainApplication.applicationContext().getString(R.string.group_name_main_activity, "82") + return v } } diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index 49c11f095..ee1a847ff 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -30,8 +30,8 @@