Merge branch 'feature/roleDependentLayout' of s416084/find-my-tutor-android into develop

This commit is contained in:
Marcin Jedyński 2018-09-13 16:15:27 +00:00 committed by Gogs
commit 2f802ad64f
5 changed files with 24 additions and 21 deletions

View File

@ -368,10 +368,9 @@ public class LoginActivity extends AppCompatActivity implements LoaderCallbacks<
showProgress(false);
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();
String txt = "test text to Startup compo";
data.setData(Uri.parse(txt));
data.putExtra("is_tutor", isTutor);
setResult(RESULT_OK, data);
finish();
} else {

View File

@ -28,7 +28,7 @@ public class MainActivity extends AppCompatActivity {
private BottomNavigationView mMainNav;
private FrameLayout mMainFrame;
private boolean isTutor;
private MapFragment mapFragment;
private NotificationFragment notificationFragment;
private ProfileFragment profileFragment;
@ -52,10 +52,13 @@ public class MainActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
Mapbox.getInstance(this, getString(R.string.access_token));
setContentView(R.layout.activity_main);
Bundle extras = getIntent().getExtras();
mMainFrame = (FrameLayout) findViewById(R.id.main_frame);
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();
notificationFragment = new NotificationFragment();
@ -65,21 +68,19 @@ public class MainActivity extends AppCompatActivity {
setFragment(mapFragment);
mMainNav.setSelectedItemId(R.id.nav_map);
/* code below is resposible for changing colours of tabs in main tab menu */
mMainNav.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.nav_map:
mMainNav.setItemBackgroundResource(R.color.colorPrimary);
setFragment(mapFragment);
return true;
case R.id.nav_notif:
mMainNav.setItemBackgroundResource(R.color.colorAccent);
setFragment(notificationFragment);
return true;
case R.id.nav_profile:
mMainNav.setItemBackgroundResource(R.color.colorPrimaryDark);
setFragment(profileFragment);
return true;
default:

View File

@ -38,6 +38,7 @@ public class StartupActivity extends AppCompatActivity {
if (requestCode == AUTHENTICATION_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
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.putExtra("is_tutor",(boolean) data.getExtras().get("is_tutor"));
startActivity(startupIntent);
}

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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"
xmlns:mapbox="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=".activity.MainActivity">
@ -12,13 +12,13 @@
android:layout_height="wrap_content">
<!--<com.mapbox.mapboxsdk.maps.MapView-->
<!--android:id="@+id/mapView"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent"-->
<!--mapbox:mapbox_cameraTargetLat="52.466799"-->
<!--mapbox:mapbox_cameraTargetLng="16.927002"-->
<!--mapbox:mapbox_cameraZoom="17"-->
<!--mapbox:mapbox_styleUrl="mapbox://styles/domagalsky/cjiyzrqjp05l72rmj6ntvv2n8">-->
<!--android:id="@+id/mapView"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent"-->
<!--mapbox:mapbox_cameraTargetLat="52.466799"-->
<!--mapbox:mapbox_cameraTargetLng="16.927002"-->
<!--mapbox:mapbox_cameraZoom="17"-->
<!--mapbox:mapbox_styleUrl="mapbox://styles/domagalsky/cjiyzrqjp05l72rmj6ntvv2n8">-->
<!--</com.mapbox.mapboxsdk.maps.MapView>-->
@ -39,6 +39,7 @@
android:theme="@style/AppTheme.AppBarOverlay">
</android.support.design.widget.AppBarLayout>
<include
android:id="@+id/include"
layout="@layout/content_main" />
@ -56,13 +57,14 @@
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginStart="0dp"
android:background="@color/colorPrimaryDark"
app:itemBackground="@color/colorPrimaryDark"
app:itemIconTint="@color/nav_item_colors"
app:itemTextColor="@color/nav_item_colors"
app:layout_anchor="@+id/include"
app:layout_anchorGravity="bottom|center"
app:menu="@menu/nav_items"
/>
app:menu="@menu/nav_items" />
</RelativeLayout>

View File

@ -12,6 +12,6 @@
android:title="@string/nav_map" />
<item
android:id="@+id/nav_notif"
android:icon="@drawable/outline_notifications_white_24dp"
android:title="@string/nav_notif" />
android:icon="@drawable/mapbox_info_icon_default"
android:title="Active" />
</menu>