Merge branch 'feature/roleDependentLayout' of s416084/find-my-tutor-android into develop
This commit is contained in:
commit
2f802ad64f
@ -368,10 +368,9 @@ public class LoginActivity extends AppCompatActivity implements LoaderCallbacks<
|
|||||||
showProgress(false);
|
showProgress(false);
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
// TODO: Ma zwracac 666 i cos jeszcze, do tego wpisywac jwt to shared prefs... kurwa
|
// DONE: returns the role of signed user and return code
|
||||||
Intent data = new Intent();
|
Intent data = new Intent();
|
||||||
String txt = "test text to Startup compo";
|
data.putExtra("is_tutor", isTutor);
|
||||||
data.setData(Uri.parse(txt));
|
|
||||||
setResult(RESULT_OK, data);
|
setResult(RESULT_OK, data);
|
||||||
finish();
|
finish();
|
||||||
} else {
|
} else {
|
||||||
|
@ -28,7 +28,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
private BottomNavigationView mMainNav;
|
private BottomNavigationView mMainNav;
|
||||||
private FrameLayout mMainFrame;
|
private FrameLayout mMainFrame;
|
||||||
|
private boolean isTutor;
|
||||||
private MapFragment mapFragment;
|
private MapFragment mapFragment;
|
||||||
private NotificationFragment notificationFragment;
|
private NotificationFragment notificationFragment;
|
||||||
private ProfileFragment profileFragment;
|
private ProfileFragment profileFragment;
|
||||||
@ -52,10 +52,13 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
Mapbox.getInstance(this, getString(R.string.access_token));
|
Mapbox.getInstance(this, getString(R.string.access_token));
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
|
Bundle extras = getIntent().getExtras();
|
||||||
|
|
||||||
mMainFrame = (FrameLayout) findViewById(R.id.main_frame);
|
mMainFrame = (FrameLayout) findViewById(R.id.main_frame);
|
||||||
mMainNav = (BottomNavigationView) findViewById(R.id.main_nav);
|
mMainNav = (BottomNavigationView) findViewById(R.id.main_nav);
|
||||||
|
isTutor = (boolean) extras.get("is_tutor");
|
||||||
|
if (!isTutor){
|
||||||
|
mMainNav.findViewById(R.id.nav_profile).setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
mapFragment = new MapFragment();
|
mapFragment = new MapFragment();
|
||||||
notificationFragment = new NotificationFragment();
|
notificationFragment = new NotificationFragment();
|
||||||
@ -65,21 +68,19 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
setFragment(mapFragment);
|
setFragment(mapFragment);
|
||||||
mMainNav.setSelectedItemId(R.id.nav_map);
|
mMainNav.setSelectedItemId(R.id.nav_map);
|
||||||
|
|
||||||
|
/* code below is resposible for changing colours of tabs in main tab menu */
|
||||||
mMainNav.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
|
mMainNav.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
|
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
|
||||||
|
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.nav_map:
|
case R.id.nav_map:
|
||||||
mMainNav.setItemBackgroundResource(R.color.colorPrimary);
|
|
||||||
setFragment(mapFragment);
|
setFragment(mapFragment);
|
||||||
return true;
|
return true;
|
||||||
case R.id.nav_notif:
|
case R.id.nav_notif:
|
||||||
mMainNav.setItemBackgroundResource(R.color.colorAccent);
|
|
||||||
setFragment(notificationFragment);
|
setFragment(notificationFragment);
|
||||||
return true;
|
return true;
|
||||||
case R.id.nav_profile:
|
case R.id.nav_profile:
|
||||||
mMainNav.setItemBackgroundResource(R.color.colorPrimaryDark);
|
|
||||||
setFragment(profileFragment);
|
setFragment(profileFragment);
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
|
@ -38,6 +38,7 @@ public class StartupActivity extends AppCompatActivity {
|
|||||||
if (requestCode == AUTHENTICATION_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
|
if (requestCode == AUTHENTICATION_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
|
||||||
Intent startupIntent = new Intent(this, MainActivity.class);
|
Intent startupIntent = new Intent(this, MainActivity.class);
|
||||||
startupIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
startupIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
startupIntent.putExtra("is_tutor",(boolean) data.getExtras().get("is_tutor"));
|
||||||
startActivity(startupIntent);
|
startActivity(startupIntent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
xmlns:mapbox="http://schemas.android.com/apk/res-auto"
|
xmlns:mapbox="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".activity.MainActivity">
|
tools:context=".activity.MainActivity">
|
||||||
@ -39,6 +39,7 @@
|
|||||||
android:theme="@style/AppTheme.AppBarOverlay">
|
android:theme="@style/AppTheme.AppBarOverlay">
|
||||||
|
|
||||||
</android.support.design.widget.AppBarLayout>
|
</android.support.design.widget.AppBarLayout>
|
||||||
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/include"
|
android:id="@+id/include"
|
||||||
layout="@layout/content_main" />
|
layout="@layout/content_main" />
|
||||||
@ -56,13 +57,14 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_marginStart="0dp"
|
||||||
|
android:background="@color/colorPrimaryDark"
|
||||||
app:itemBackground="@color/colorPrimaryDark"
|
app:itemBackground="@color/colorPrimaryDark"
|
||||||
app:itemIconTint="@color/nav_item_colors"
|
app:itemIconTint="@color/nav_item_colors"
|
||||||
app:itemTextColor="@color/nav_item_colors"
|
app:itemTextColor="@color/nav_item_colors"
|
||||||
app:layout_anchor="@+id/include"
|
app:layout_anchor="@+id/include"
|
||||||
app:layout_anchorGravity="bottom|center"
|
app:layout_anchorGravity="bottom|center"
|
||||||
app:menu="@menu/nav_items"
|
app:menu="@menu/nav_items" />
|
||||||
/>
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,6 +12,6 @@
|
|||||||
android:title="@string/nav_map" />
|
android:title="@string/nav_map" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/nav_notif"
|
android:id="@+id/nav_notif"
|
||||||
android:icon="@drawable/outline_notifications_white_24dp"
|
android:icon="@drawable/mapbox_info_icon_default"
|
||||||
android:title="@string/nav_notif" />
|
android:title="Active" />
|
||||||
</menu>
|
</menu>
|
Loading…
Reference in New Issue
Block a user