diff --git a/Listify/app/src/main/java/com/example/listify/MainActivity.java b/Listify/app/src/main/java/com/example/listify/MainActivity.java index e66713c..c41be80 100644 --- a/Listify/app/src/main/java/com/example/listify/MainActivity.java +++ b/Listify/app/src/main/java/com/example/listify/MainActivity.java @@ -1,10 +1,8 @@ package com.example.listify; -import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.Menu; -import android.widget.Button; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.snackbar.Snackbar; @@ -20,7 +18,6 @@ import androidx.appcompat.widget.Toolbar; public class MainActivity extends AppCompatActivity { private AppBarConfiguration mAppBarConfiguration; - //private Button toLoginPage; @Override protected void onCreate(Bundle savedInstanceState) { @@ -45,20 +42,10 @@ public class MainActivity extends AppCompatActivity { NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment); NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration); NavigationUI.setupWithNavController(navigationView, navController); - - /*toLoginPage = (Button) findViewById(R.id.button1); - toLoginPage.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - Intent intent = new Intent(MainActivity.this, com.example.listify.ui.SignupPage.class); - startActivity(intent); - } - });*/ } @Override public boolean onCreateOptionsMenu(Menu menu) { - // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } diff --git a/Listify/app/src/main/java/com/example/listify/ui/home/HomeFragment.java b/Listify/app/src/main/java/com/example/listify/ui/home/HomeFragment.java index 1937ed3..492ab33 100644 --- a/Listify/app/src/main/java/com/example/listify/ui/home/HomeFragment.java +++ b/Listify/app/src/main/java/com/example/listify/ui/home/HomeFragment.java @@ -1,33 +1,28 @@ package com.example.listify.ui.home; +import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.TextView; +import android.widget.Button; import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; -import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProviders; import com.example.listify.R; public class HomeFragment extends Fragment { + private Button toLoginPage; - private HomeViewModel homeViewModel; - - public View onCreateView(@NonNull LayoutInflater inflater, - ViewGroup container, Bundle savedInstanceState) { - homeViewModel = - ViewModelProviders.of(this).get(HomeViewModel.class); + public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.inflate(R.layout.fragment_home, container, false); - final TextView textView = root.findViewById(R.id.text_home); - homeViewModel.getText().observe(getViewLifecycleOwner(), new Observer() { + toLoginPage = (Button) root.findViewById(R.id.button1); + toLoginPage.setOnClickListener(new View.OnClickListener() { @Override - public void onChanged(@Nullable String s) { - textView.setText(s); + public void onClick(View v) { + Intent intent = new Intent(HomeFragment.this.getActivity(), com.example.listify.ui.SignupPage.class); + startActivity(intent); } }); return root; diff --git a/Listify/app/src/main/res/layout/fragment_home.xml b/Listify/app/src/main/res/layout/fragment_home.xml index f3d9b08..ac1b34e 100644 --- a/Listify/app/src/main/res/layout/fragment_home.xml +++ b/Listify/app/src/main/res/layout/fragment_home.xml @@ -6,17 +6,36 @@ android:layout_height="match_parent" tools:context=".ui.home.HomeFragment"> - + + + + + \ No newline at end of file