|
@@ -1,6 +1,7 @@
|
|
|
package com.noahvogt.miniprojekt;
|
|
|
|
|
|
import android.os.Bundle;
|
|
|
+
|
|
|
import android.view.Menu;
|
|
|
import android.view.View;
|
|
|
import android.widget.Button;
|
|
@@ -13,11 +14,31 @@ import androidx.appcompat.app.AppCompatActivity;
|
|
|
import androidx.appcompat.widget.Toolbar;
|
|
|
import androidx.drawerlayout.widget.DrawerLayout;
|
|
|
import androidx.fragment.app.DialogFragment;
|
|
|
+
|
|
|
+import android.view.LayoutInflater;
|
|
|
+import android.view.Menu;
|
|
|
+import android.view.View;
|
|
|
+import android.view.ViewGroup;
|
|
|
+
|
|
|
+import com.noahvogt.miniprojekt.ui.home.CustomAdapter;
|
|
|
+import com.noahvogt.miniprojekt.ui.home.Data;
|
|
|
+
|
|
|
+import androidx.recyclerview.widget.LinearLayoutManager;
|
|
|
+import androidx.recyclerview.widget.RecyclerView;
|
|
|
+import androidx.recyclerview.widget.StaggeredGridLayoutManager;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+
|
|
|
+
|
|
|
+import com.google.android.material.navigation.NavigationView;
|
|
|
+
|
|
|
+
|
|
|
import androidx.navigation.NavController;
|
|
|
import androidx.navigation.Navigation;
|
|
|
import androidx.navigation.ui.AppBarConfiguration;
|
|
|
import androidx.navigation.ui.NavigationUI;
|
|
|
|
|
|
+
|
|
|
import com.google.android.material.navigation.NavigationView;
|
|
|
import com.google.android.material.snackbar.Snackbar;
|
|
|
|
|
@@ -27,6 +48,9 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
|
|
|
|
|
private AppBarConfiguration mAppBarConfiguration;
|
|
|
|
|
|
+ //imported by simon 2.may from RecyclerView Programm, changed to 23.may Simon to ArrayList<Data>...
|
|
|
+ protected ArrayList<Data> data;
|
|
|
+
|
|
|
private AlertDialog dialog;
|
|
|
|
|
|
private EditText newemail_name, newemail_email, newemail_password; // may not be private
|
|
@@ -35,6 +59,11 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
|
|
public MainActivity() {
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|
|
@@ -73,8 +102,21 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
|
|
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
|
|
|
NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
|
|
|
NavigationUI.setupWithNavController(navigationView, navController);
|
|
|
+
|
|
|
+ //initDataset();
|
|
|
+ // Lookup the recyclerview in activity layou
|
|
|
+ RecyclerView recyclerView = findViewById(R.id.recyclerView);
|
|
|
+ // Initialize contacts
|
|
|
+ data = Data.createContactsList(20);
|
|
|
+ // Create adapter passing in the sample user data
|
|
|
+ CustomAdapter adapter = new CustomAdapter(data);
|
|
|
+ // Attach the adapter to the recyclerview to populate items
|
|
|
+ recyclerView.setAdapter(adapter);
|
|
|
+ recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public boolean onCreateOptionsMenu(Menu menu) {
|
|
|
// Inflate the menu; this adds items to the action bar if it is present.
|
|
@@ -89,6 +131,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
|
|
|| super.onSupportNavigateUp();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
// better leave empty to avoid any listener disambiguity
|
|
|
public void onClick(View view) {}
|
|
|
|
|
@@ -156,4 +199,6 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
|
|
private void showToast(String text) {
|
|
|
Toast.makeText(MainActivity.this, text, Toast.LENGTH_SHORT).show();
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|