bottom nav with activities

This commit is contained in:
Domagalski 2018-09-30 10:34:32 +02:00
parent 883b2ef7db
commit 64c594174a
6 changed files with 86 additions and 14 deletions

View File

@ -23,11 +23,11 @@
android:label="@string/title_activity_startup" android:label="@string/title_activity_startup"
android:launchMode="singleInstance" android:launchMode="singleInstance"
android:theme="@style/AppTheme.NoActionBar"> android:theme="@style/AppTheme.NoActionBar">
<!--<intent-filter>--> <intent-filter>
<!--<action android:name="android.intent.action.MAIN" />--> <action android:name="android.intent.action.MAIN" />
<!--<category android:name="android.intent.category.LAUNCHER" />--> <category android:name="android.intent.category.LAUNCHER" />
<!--</intent-filter>--> </intent-filter>
</activity> </activity>
<activity <activity
android:name=".activity.MainActivity" android:name=".activity.MainActivity"
@ -39,13 +39,8 @@
android:label="@string/title_activity_login" android:label="@string/title_activity_login"
android:launchMode="singleTask" android:launchMode="singleTask"
android:noHistory="true" /> android:noHistory="true" />
<!--<activity android:name=".activity.BaseActivity" />-->
<activity android:name=".activity.ProfileActivity" /> <activity android:name=".activity.ProfileActivity" />
<activity android:name=".activity.MapActivity"> <intent-filter> <activity android:name=".activity.MapActivity" />
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter></activity>
<activity android:name=".activity.NotificationsActivity" /> <activity android:name=".activity.NotificationsActivity" />
</application> </application>

View File

@ -20,7 +20,7 @@ public abstract class BaseActivity
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(getContentViewId()); setContentView(getContentViewId());
navigationView = (BottomNavigationView) findViewById(R.id.navigation); navigationView = findViewById(R.id.navigation);
navigationView.setOnNavigationItemSelectedListener(this); navigationView.setOnNavigationItemSelectedListener(this);
} }

View File

@ -1,8 +1,70 @@
package com.uam.wmi.findmytutor.activity; package com.uam.wmi.findmytutor.activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import com.mapbox.mapboxsdk.Mapbox;
import com.mapbox.mapboxsdk.maps.MapView;
import com.uam.wmi.findmytutor.R; import com.uam.wmi.findmytutor.R;
import static com.mapbox.mapboxsdk.Mapbox.getApplicationContext;
public class MapActivity extends BaseActivity { public class MapActivity extends BaseActivity {
private MapView mapView;
String tag = "LifeCycleEvents";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Mapbox.getInstance(this, getString(R.string.access_token));
mapView = findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
}
@Override
public void onStart()
{
super.onStart();
mapView.onStart();
Log.d(tag, "In the onStart() event");
}
@Override
public void onRestart()
{
super.onRestart();
Log.d(tag, "In the onRestart() event");
}
@Override
public void onResume()
{
super.onResume();
mapView.onResume();
Log.d(tag, "In the onResume() event");
}
@Override
public void onPause()
{
super.onPause();
mapView.onPause();
Log.d(tag, "In the onPause() event");
}
@Override
public void onStop()
{
super.onStop();
mapView.onStop();
Log.d(tag, "In the onStop() event");
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
mapView.onSaveInstanceState(outState);
}
@Override @Override
protected int getContentViewId() { protected int getContentViewId() {

View File

@ -1,17 +1,31 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.constraint.ConstraintLayout 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:mapbox="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" 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.MapActivity"> tools:context=".activity.MapActivity">
<com.mapbox.mapboxsdk.maps.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible"
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>
<include <include
android:id="@+id/navigation" android:id="@+id/navigation"
layout="@layout/element_bottom_navigation" layout="@layout/element_bottom_navigation"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
/> app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</android.support.constraint.ConstraintLayout> </android.support.constraint.ConstraintLayout>

View File

@ -12,6 +12,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
/> app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</android.support.constraint.ConstraintLayout> </android.support.constraint.ConstraintLayout>

View File

@ -12,6 +12,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
/> app:layout_constraintBottom_toBottomOf="parent" />
</android.support.constraint.ConstraintLayout> </android.support.constraint.ConstraintLayout>