All the nav buttons are there now, successfully compiles.

This commit is contained in:
2020-06-13 07:09:32 -05:00
parent f449e52280
commit 07360067be
17 changed files with 137 additions and 136 deletions

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@@ -20,7 +20,8 @@ public class MainActivity extends AppCompatActivity {
// Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations.
AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(
R.id.navigation_home, R.id.navigation_dashboard, R.id.navigation_notifications)
R.id.navigation_tacnet, R.id.navigation_editor, R.id.navigation_settings,
R.id.navigation_search)
.build();
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);

View File

@@ -1,64 +0,0 @@
package org.timecrafters.TimeCraftersConfigurationTool;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* A simple {@link Fragment} subclass.
* Use the {@link TACNETFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class TACNETFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
public TACNETFragment() {
// Required empty public constructor
}
/**
* 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 TACNETFragment.
*/
// TODO: Rename and change types and number of parameters
public static TACNETFragment newInstance(String param1, String param2) {
TACNETFragment fragment = new TACNETFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_tacnet, container, false);
}
}

View File

@@ -1,4 +1,4 @@
package org.timecrafters.TimeCraftersConfigurationTool.ui.home;
package org.timecrafters.TimeCraftersConfigurationTool.ui.editor;
import android.os.Bundle;
import android.view.LayoutInflater;
@@ -14,17 +14,17 @@ import androidx.lifecycle.ViewModelProviders;
import org.timecrafters.TimeCraftersConfigurationTool.R;
public class HomeFragment extends Fragment {
public class EditorFragment extends Fragment {
private HomeViewModel homeViewModel;
private EditorViewModel editorViewModel;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
homeViewModel =
ViewModelProviders.of(this).get(HomeViewModel.class);
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<String>() {
editorViewModel =
ViewModelProviders.of(this).get(EditorViewModel.class);
View root = inflater.inflate(R.layout.fragment_editor, container, false);
final TextView textView = root.findViewById(R.id.text_editor);
editorViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);

View File

@@ -1,16 +1,16 @@
package org.timecrafters.TimeCraftersConfigurationTool.ui.home;
package org.timecrafters.TimeCraftersConfigurationTool.ui.editor;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
public class HomeViewModel extends ViewModel {
public class EditorViewModel extends ViewModel {
private MutableLiveData<String> mText;
public HomeViewModel() {
public EditorViewModel() {
mText = new MutableLiveData<>();
mText.setValue("This is home fragment");
mText.setValue("This is editor fragment");
}
public LiveData<String> getText() {

View File

@@ -1,4 +1,4 @@
package org.timecrafters.TimeCraftersConfigurationTool.ui.dashboard;
package org.timecrafters.TimeCraftersConfigurationTool.ui.search;
import android.os.Bundle;
import android.view.LayoutInflater;
@@ -14,17 +14,17 @@ import androidx.lifecycle.ViewModelProviders;
import org.timecrafters.TimeCraftersConfigurationTool.R;
public class DashboardFragment extends Fragment {
public class SearchFragment extends Fragment {
private DashboardViewModel dashboardViewModel;
private SearchViewModel searchViewModel;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
dashboardViewModel =
ViewModelProviders.of(this).get(DashboardViewModel.class);
View root = inflater.inflate(R.layout.fragment_dashboard, container, false);
final TextView textView = root.findViewById(R.id.text_dashboard);
dashboardViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
searchViewModel =
ViewModelProviders.of(this).get(SearchViewModel.class);
View root = inflater.inflate(R.layout.fragment_search, container, false);
final TextView textView = root.findViewById(R.id.text_search);
searchViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);

View File

@@ -1,16 +1,16 @@
package org.timecrafters.TimeCraftersConfigurationTool.ui.dashboard;
package org.timecrafters.TimeCraftersConfigurationTool.ui.search;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
public class DashboardViewModel extends ViewModel {
public class SearchViewModel extends ViewModel {
private MutableLiveData<String> mText;
public DashboardViewModel() {
public SearchViewModel() {
mText = new MutableLiveData<>();
mText.setValue("This is dashboard fragment");
mText.setValue("This is search fragment");
}
public LiveData<String> getText() {

View File

@@ -1,4 +1,4 @@
package org.timecrafters.TimeCraftersConfigurationTool.ui.notifications;
package org.timecrafters.TimeCraftersConfigurationTool.ui.settings;
import android.os.Bundle;
import android.view.LayoutInflater;
@@ -14,17 +14,17 @@ import androidx.lifecycle.ViewModelProviders;
import org.timecrafters.TimeCraftersConfigurationTool.R;
public class NotificationsFragment extends Fragment {
public class SettingsFragment extends Fragment {
private NotificationsViewModel notificationsViewModel;
private SettingsViewModel settingsViewModel;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
notificationsViewModel =
ViewModelProviders.of(this).get(NotificationsViewModel.class);
View root = inflater.inflate(R.layout.fragment_notifications, container, false);
final TextView textView = root.findViewById(R.id.text_notifications);
notificationsViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
settingsViewModel =
ViewModelProviders.of(this).get(SettingsViewModel.class);
View root = inflater.inflate(R.layout.fragment_settings, container, false);
final TextView textView = root.findViewById(R.id.text_settings);
settingsViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);

View File

@@ -1,16 +1,16 @@
package org.timecrafters.TimeCraftersConfigurationTool.ui.notifications;
package org.timecrafters.TimeCraftersConfigurationTool.ui.settings;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
public class NotificationsViewModel extends ViewModel {
public class SettingsViewModel extends ViewModel {
private MutableLiveData<String> mText;
public NotificationsViewModel() {
public SettingsViewModel() {
mText = new MutableLiveData<>();
mText.setValue("This is notifications fragment");
mText.setValue("This is settings fragment");
}
public LiveData<String> getText() {

View File

@@ -0,0 +1,35 @@
package org.timecrafters.TimeCraftersConfigurationTool.ui.tacnet;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import org.timecrafters.TimeCraftersConfigurationTool.R;
public class TACNETFragment extends Fragment {
private TACNETViewModel TACNETViewModel;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
TACNETViewModel =
ViewModelProviders.of(this).get(TACNETViewModel.class);
View root = inflater.inflate(R.layout.fragment_tacnet, container, false);
final TextView textView = root.findViewById(R.id.text_tacnet);
TACNETViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);
}
});
return root;
}
}

View File

@@ -0,0 +1,19 @@
package org.timecrafters.TimeCraftersConfigurationTool.ui.tacnet;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
public class TACNETViewModel extends ViewModel {
private MutableLiveData<String> mText;
public TACNETViewModel() {
mText = new MutableLiveData<>();
mText.setValue("This is TACNET fragment");
}
public LiveData<String> getText() {
return mText;
}
}

View File

@@ -4,10 +4,10 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.dashboard.DashboardFragment">
tools:context=".ui.editor.EditorFragment">
<TextView
android:id="@+id/text_dashboard"
android:id="@+id/text_editor"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"

View File

@@ -4,10 +4,10 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.notifications.NotificationsFragment">
tools:context=".ui.search.SearchFragment">
<TextView
android:id="@+id/text_notifications"
android:id="@+id/text_search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"

View File

@@ -4,10 +4,10 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.home.HomeFragment">
tools:context=".ui.settings.SettingsFragment">
<TextView
android:id="@+id/text_home"
android:id="@+id/text_settings"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"

View File

@@ -1,14 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".TACNETFragment">
tools:context=".ui.tacnet.TACNETFragment">
<!-- TODO: Update blank fragment layout -->
<TextView
android:id="@+id/text_tacnet"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment" />
</FrameLayout>
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:textAlignment="center"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -3,28 +3,28 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mobile_navigation"
app:startDestination="@+id/navigation_home">
app:startDestination="@+id/navigation_editor">
<fragment
android:id="@+id/navigation_tacnet"
android:name="org.timecrafters.TimeCraftersConfigurationTool.ui.tacnet.TACNETFragment"
android:label="@string/title_tacnet"
tools:layout="@layout/fragment_tacnet" />
<fragment
android:id="@+id/navigation_editor"
android:name="org.timecrafters.TimeCraftersConfigurationTool.ui.home.HomeFragment"
android:label="@string/title_home"
tools:layout="@layout/fragment_home" />
android:name="org.timecrafters.TimeCraftersConfigurationTool.ui.editor.EditorFragment"
android:label="@string/title_editor"
tools:layout="@layout/fragment_editor" />
<fragment
android:id="@+id/navigation_dashboard"
android:name="org.timecrafters.TimeCraftersConfigurationTool.ui.dashboard.DashboardFragment"
android:label="@string/title_dashboard"
tools:layout="@layout/fragment_dashboard" />
android:id="@+id/navigation_settings"
android:name="org.timecrafters.TimeCraftersConfigurationTool.ui.settings.SettingsFragment"
android:label="@string/title_settings"
tools:layout="@layout/fragment_settings" />
<fragment
android:id="@+id/navigation_notifications"
android:name="org.timecrafters.TimeCraftersConfigurationTool.ui.notifications.NotificationsFragment"
android:label="@string/title_notifications"
tools:layout="@layout/fragment_notifications" />
<fragment
android:id="@+id/TACNETFragment"
android:name="org.timecrafters.TimeCraftersConfigurationTool.TACNETFragment"
android:label="fragment_tacnet"
tools:layout="@layout/fragment_tacnet" />
android:id="@+id/navigation_search"
android:name="org.timecrafters.TimeCraftersConfigurationTool.ui.search.SearchFragment"
android:label="@string/title_search"
tools:layout="@layout/fragment_search" />
</navigation>

View File

@@ -1,9 +1,5 @@
<resources>
<string name="app_name">TimeCraftersConfigurationTool</string>
<string name="title_home">Home</string>
<string name="title_dashboard">Dashboard</string>
<string name="title_notifications">Notifications</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
<string name="title_editor">Editor</string>
<string name="title_search">Search</string>