Cleaned up the code of the previous 3 commits

This commit is contained in:
Aaron Sun 2020-11-10 19:54:32 -08:00
parent 65d59500be
commit ea660e4c3a
6 changed files with 11 additions and 37 deletions

View File

@ -67,7 +67,6 @@ public class MainActivity extends AppCompatActivity implements CreateListDialogF
startActivity(intent);
}
//------------------------------Auth Testing---------------------------------------------//
boolean testAuth = false;
@ -89,14 +88,10 @@ public class MainActivity extends AppCompatActivity implements CreateListDialogF
}
}
}
//NOTE: deleteUser is slightly unusual in that it requires a Requestor. See below for building one
//authManager.deleteUser(requestor);
//------------------------------------------------------------------------------------------//
//----------------------------------API Testing---------------------------------------------//
boolean testAPI = false;
//----------------------------------API Testing---------------------------------------------//
if (testAPI) {
AuthManager authManager = new AuthManager();
@ -114,10 +109,7 @@ public class MainActivity extends AppCompatActivity implements CreateListDialogF
Requestor requestor = new Requestor(authManager, configs.getProperty("apiKey"));
//The name is the only part of this that is used, the rest is generated by the Lambda.
List testList = new List(-1, "New List", "user filled by lambda", Instant.now().toEpochMilli());
//Everything except addedDate is used for ItemEntry
ListEntry entry = new ListEntry(1, 4, Math.abs(new Random().nextInt()), Instant.now().toEpochMilli(),false);
SynchronousReceiver<Integer> idReceiver = new SynchronousReceiver<>();
@ -148,37 +140,26 @@ public class MainActivity extends AppCompatActivity implements CreateListDialogF
receiverError.printStackTrace();
}
}
//------------------------------------------------------------------------------------------//
//------------------------------------------------------------------------------------------//
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
/*FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG).setAction("Action", null).show();
}
});*/
DrawerLayout drawer = findViewById(R.id.drawer_layout);
NavigationView navigationView = findViewById(R.id.nav_view);
// Passing each menu ID as a set of Ids because each menu should be considered as top level destinations.
mAppBarConfiguration = new AppBarConfiguration.Builder(
R.id.nav_home, R.id.nav_lists)
R.id.nav_home, R.id.nav_profile)
.setDrawerLayout(drawer)
.build();
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
NavigationUI.setupWithNavController(navigationView, navController);
// Handle search button click
ImageButton searchButton = (ImageButton) findViewById(R.id.searchButton);
searchButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, SearchResults.class);
// Send user to SearchResults activity
startActivity(intent);
overridePendingTransition(R.anim.enter_from_left, R.anim.exit_from_left);
@ -186,13 +167,6 @@ public class MainActivity extends AppCompatActivity implements CreateListDialogF
});
}
/*@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;
}*/
@Override
public boolean onSupportNavigateUp() {
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);

View File

@ -1,4 +1,4 @@
package com.example.listify.ui.lists;
package com.example.listify.ui.profile;
import android.app.AlertDialog;
import android.content.DialogInterface;
@ -24,11 +24,11 @@ import java.util.Properties;
import static com.example.listify.MainActivity.am;
public class ListsFragment extends Fragment {
public class ProfileFragment extends Fragment {
private Button toDeleteAccountPage;
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_lists, container, false);
View root = inflater.inflate(R.layout.fragment_profile, container, false);
toDeleteAccountPage = (Button) root.findViewById(R.id.button);
toDeleteAccountPage.setOnClickListener(new View.OnClickListener() {
@ -75,4 +75,4 @@ public class ListsFragment extends Fragment {
return root;
}
}
}

View File

@ -17,7 +17,7 @@
<!-- android:icon="@drawable/ic_menu_slideshow"-->
<!-- android:title="@string/menu_slideshow" />-->
<item
android:id="@+id/nav_lists"
android:id="@+id/nav_profile"
android:icon="@drawable/ic_baseline_list_alt_28"
android:title="@string/menu_lists" />
<!-- <item-->

View File

@ -24,8 +24,8 @@
tools:layout="@layout/fragment_slideshow" />
<fragment
android:id="@+id/nav_lists"
android:name="com.example.listify.ui.lists.ListsFragment"
android:id="@+id/nav_profile"
android:name="com.example.listify.ui.profile.ProfileFragment"
android:label="@string/menu_lists"
tools:layout="@layout/fragment_lists" />
tools:layout="@layout/fragment_profile" />
</navigation>