-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from EPICSGroup/Samuel
-completed android navigation
- Loading branch information
Showing
31 changed files
with
511 additions
and
133 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 5 additions & 8 deletions
13
.../notifications/NotificationsFragment.java → ...onstruction/ConstructionFormFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,25 @@ | ||
package com.sf.stormwaterutilityandroid.notifications; | ||
package com.sf.stormwaterutilityandroid.Construction; | ||
|
||
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.fragment.app.Fragment; | ||
import androidx.lifecycle.ViewModelProvider; | ||
|
||
import com.sf.stormwaterutilityandroid.R; | ||
|
||
|
||
public class NotificationsFragment extends Fragment { | ||
public class ConstructionFormFragment extends Fragment { | ||
|
||
|
||
public View onCreateView(@NonNull LayoutInflater inflater, | ||
ViewGroup container, Bundle savedInstanceState) { | ||
|
||
View root = inflater.inflate(R.layout.fragment_notifications, container, false); | ||
final TextView textView = root.findViewById(R.id.text_notifications); | ||
|
||
|
||
View root = inflater.inflate(R.layout.fragment_home, container, false); | ||
|
||
return root; | ||
|
||
} | ||
} |
164 changes: 164 additions & 0 deletions
164
app/src/main/java/com/sf/stormwaterutilityandroid/Construction/ConstructionNav.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
package com.sf.stormwaterutilityandroid.Construction; | ||
|
||
import android.os.Bundle; | ||
import android.view.MenuItem; | ||
import android.widget.TextView; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.appcompat.app.AppCompatActivity; | ||
import androidx.fragment.app.Fragment; | ||
import androidx.fragment.app.FragmentManager; | ||
|
||
import com.google.android.material.bottomnavigation.BottomNavigationView; | ||
import com.google.firebase.auth.FirebaseAuth; | ||
import com.sf.stormwaterutilityandroid.R; | ||
import com.sf.stormwaterutilityandroid.WaterWay.WaterWayFormFragment; | ||
import com.sf.stormwaterutilityandroid.WaterWay.WaterWayReportFragment; | ||
|
||
public class ConstructionNav extends AppCompatActivity { | ||
private TextView mTextMessage; | ||
private FirebaseAuth auth; | ||
final Fragment fragment1 = new ConstructionFormFragment(); | ||
final Fragment fragment2 = new ConstructionReportsFragment(); | ||
|
||
// final Fragment fragment4 = new Admin_fragment(); | ||
// final Fragment fragment5 = new HR_fragment(); | ||
final FragmentManager fm = getSupportFragmentManager(); | ||
Fragment active = fragment1; | ||
private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener | ||
= new BottomNavigationView.OnNavigationItemSelectedListener() { | ||
|
||
@Override | ||
public boolean onNavigationItemSelected(@NonNull MenuItem item) { | ||
switch (item.getItemId()) { | ||
case R.id.constructionHome: | ||
// mTextMessage.setText(R.string.title_home); | ||
fm.beginTransaction().hide(active).show(fragment1).commit(); | ||
|
||
active = fragment1; | ||
fm.popBackStack(); | ||
return true; | ||
case R.id.constructionReports: | ||
// mTextMessage.setText(R.string.title_dashboard); | ||
fm.beginTransaction().hide(active).show(fragment2).commit(); | ||
active = fragment2; | ||
fm.popBackStack(); | ||
return true; | ||
|
||
|
||
} | ||
return false; | ||
} | ||
}; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_construction); | ||
|
||
// Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); | ||
//setSupportActionBar(toolbar); | ||
|
||
|
||
BottomNavigationView navigation = findViewById(R.id.navigationConstruction); | ||
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener); | ||
// fm.beginTransaction().add(R.id.main_container, fragment5, "5").hide(fragment5).commit(); | ||
// fm.beginTransaction().add(R.id.main_container, fragment4, "4").hide(fragment4).commit(); | ||
|
||
fm.beginTransaction().add(R.id.main_containerConstruction, fragment2, "2").hide(fragment2).commit(); | ||
fm.beginTransaction().add(R.id.main_containerConstruction, fragment1, "1").commit(); | ||
|
||
} | ||
|
||
/* @Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
signout2 = (Button) findViewById(R.id.sign_out); | ||
signout2.setOnClickListener(new View.OnClickListener() { | ||
public void onClick(View v) { | ||
FirebaseAuth.getInstance().signOut(); | ||
startActivity(new Intent(com.samuelford48gmail.thsconnect.teacher.MainActivity.this, LoginActivity.class)); | ||
finish(); | ||
} | ||
}); | ||
mTextMessage = (TextView) findViewById(R.id.message); | ||
BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation); | ||
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener); | ||
} | ||
FirebaseAuth.AuthStateListener authListener = new FirebaseAuth.AuthStateListener() { | ||
@SuppressLint("SetTextI18n") | ||
@Override | ||
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) { | ||
FirebaseUser user = firebaseAuth.getCurrentUser(); | ||
if (user == null) { | ||
// user auth state is changed - user is null | ||
// launch login activity | ||
startActivity(new Intent(com.samuelford48gmail.thsconnect.teacher.MainActivity.this, LoginActivity.class)); | ||
finish(); | ||
} | ||
} | ||
}; | ||
// public void signout (View v){ | ||
// signOut(); | ||
//} | ||
/* | ||
public void signOut() { | ||
auth.signOut(); | ||
// this listener will be called when there is change in firebase user session | ||
FirebaseAuth.AuthStateListener authListener = new FirebaseAuth.AuthStateListener() { | ||
@Override | ||
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) { | ||
FirebaseUser user = firebaseAuth.getCurrentUser(); | ||
if (user == null) { | ||
// user auth state is changed - user is null | ||
// launch login activity | ||
startActivity(new Intent(com.samuelford48gmail.thsconnect.teacher.MainActivity.this, LoginActivity.class)); | ||
finish(); | ||
} | ||
} | ||
}; | ||
} | ||
@Override | ||
public void onStart() { | ||
super.onStart(); | ||
auth.addAuthStateListener(authListener); | ||
} | ||
@Override | ||
public void onStop() { | ||
super.onStop(); | ||
if (authListener != null) { | ||
auth.removeAuthStateListener(authListener); | ||
} | ||
*/ | ||
/*@Override | ||
public boolean onCreateOptionsMenu(Menu menu) { | ||
getMenuInflater().inflate(R.menu., menu); | ||
return super.onCreateOptionsMenu(menu); | ||
} | ||
@Override | ||
public boolean onOptionsItemSelected(MenuItem item) { | ||
int id = item.getItemId(); | ||
if (id == R.id.action_settings) { | ||
startActivity(new Intent(com.samuelford48gmail.thsconnect.teacher.MainActivity.this, SettingsActivity.class)); | ||
return true; | ||
} | ||
return super.onOptionsItemSelected(item); | ||
} | ||
*/ | ||
} |
25 changes: 25 additions & 0 deletions
25
...c/main/java/com/sf/stormwaterutilityandroid/Construction/ConstructionReportsFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.sf.stormwaterutilityandroid.Construction; | ||
|
||
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.ViewModelProvider; | ||
|
||
import com.sf.stormwaterutilityandroid.R; | ||
|
||
public class ConstructionReportsFragment extends Fragment { | ||
|
||
|
||
public View onCreateView(@NonNull LayoutInflater inflater, | ||
ViewGroup container, Bundle savedInstanceState) { | ||
View root = inflater.inflate(R.layout.fragment_dashboard, container, false); | ||
final TextView textView = root.findViewById(R.id.text_dashboard); | ||
return root; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
app/src/main/java/com/sf/stormwaterutilityandroid/MainMenu.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.sf.stormwaterutilityandroid; | ||
|
||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.widget.Button; | ||
|
||
import com.sf.stormwaterutilityandroid.Construction.ConstructionNav; | ||
import com.sf.stormwaterutilityandroid.WaterWay.WaterWayNav; | ||
|
||
public class MainMenu extends AppCompatActivity { | ||
Button launchWWF,launchCF, launchSettings; | ||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main_menu); | ||
launchWWF = findViewById(R.id.wwf); | ||
launchCF = findViewById(R.id.cf); | ||
launchSettings = findViewById(R.id.settings); | ||
launchSettings.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
Intent intent = new Intent(MainMenu.this, Settings.class); | ||
startActivity(intent); | ||
|
||
} | ||
}); | ||
launchCF.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
Intent intent = new Intent(MainMenu.this, ConstructionNav.class); | ||
startActivity(intent); | ||
|
||
|
||
} | ||
}); | ||
launchWWF.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
Intent intent = new Intent(MainMenu.this, WaterWayNav.class); | ||
startActivity(intent); | ||
|
||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
app/src/main/java/com/sf/stormwaterutilityandroid/Settings.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.sf.stormwaterutilityandroid; | ||
|
||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
import android.os.Bundle; | ||
|
||
public class Settings extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_settings); | ||
} | ||
} |
Oops, something went wrong.