diff options
author | Brad Leege <bleege@gmail.com> | 2015-08-07 13:45:56 -0500 |
---|---|---|
committer | Brad Leege <bleege@gmail.com> | 2015-08-07 13:45:56 -0500 |
commit | 34d1c023de43a3c07d7531a156b438e625bc23d6 (patch) | |
tree | 136c9a0ff78ede37b13b620f7581c05dad524eaf /android | |
parent | 2f4b627f17b3086a5119a3f4157ca5b1024c6379 (diff) | |
download | qtlocation-mapboxgl-34d1c023de43a3c07d7531a156b438e625bc23d6.tar.gz |
#1856 - Initial conversion to Material Design components
Diffstat (limited to 'android')
5 files changed, 116 insertions, 48 deletions
diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java index df524f9905..a637ee3f2b 100644 --- a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java @@ -3,7 +3,9 @@ package com.mapbox.mapboxgl.testapp; import android.graphics.Color; import android.graphics.PointF; import android.os.Bundle; -import android.support.v7.app.ActionBarActivity; +import android.support.v4.widget.DrawerLayout; +import android.support.v7.app.ActionBar; +import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.GestureDetector; @@ -33,7 +35,7 @@ import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; -public class MainActivity extends ActionBarActivity { +public class MainActivity extends AppCompatActivity { private static final String TAG = "MainActivity"; @@ -49,6 +51,7 @@ public class MainActivity extends ActionBarActivity { // // Used for the UI + private DrawerLayout mDrawerLayout; private MapView mapView; private TextView mFpsTextView; private FrameLayout mMapFrameLayout; @@ -79,6 +82,17 @@ public class MainActivity extends ActionBarActivity { // Load the layout setContentView(R.layout.activity_main); + + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + + final ActionBar ab = getSupportActionBar(); + ab.setHomeAsUpIndicator(R.drawable.ic_menu); + ab.setDisplayHomeAsUpEnabled(true); + + mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); + + mapView = (MapView) findViewById(R.id.mainMapView); // Load the access token try { @@ -120,6 +134,8 @@ public class MainActivity extends ActionBarActivity { mFpsTextView.setText(""); mMapFrameLayout = (FrameLayout) findViewById(R.id.layout_map); + +/* // Add a toolbar as the action bar Toolbar mainToolbar = (Toolbar) findViewById(R.id.toolbar_main); setSupportActionBar(mainToolbar); @@ -136,6 +152,7 @@ public class MainActivity extends ActionBarActivity { mClassSpinner = (Spinner) findViewById(R.id.spinner_class); mOutdoorsClassAdapter = ArrayAdapter.createFromResource(getSupportActionBar().getThemedContext(), R.array.outdoors_class_list, android.R.layout.simple_spinner_dropdown_item); +*/ if (savedInstanceState != null) { mapView.setMyLocationEnabled(savedInstanceState.getBoolean(STATE_IS_GPS_ON, false)); diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_main.xml b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_main.xml index 0cf914a066..6cae392295 100644 --- a/android/java/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_main.xml +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_main.xml @@ -1,59 +1,91 @@ <?xml version="1.0" encoding="utf-8"?> -<LinearLayout + +<android.support.v4.widget.DrawerLayout + android:id="@+id/drawer_layout" xmlns:android="http://schemas.android.com/apk/res/android" 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" - android:orientation="vertical"> + android:fitsSystemWindows="true"> - <android.support.v7.widget.Toolbar - android:id="@+id/toolbar_main" - android:layout_height="wrap_content" - android:layout_width="match_parent" - android:minHeight="?attr/actionBarSize" - android:background="?attr/colorPrimary"> - - <Spinner - android:id="@+id/spinner_style" - android:layout_width="wrap_content" - android:layout_height="wrap_content" /> - - <Spinner - android:id="@+id/spinner_class" - android:visibility="invisible" - android:layout_width="wrap_content" - android:layout_height="wrap_content" /> - </android.support.v7.widget.Toolbar> - - <FrameLayout - android:id="@+id/layout_map" + + <android.support.design.widget.CoordinatorLayout + android:id="@+id/main_content" + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" - android:layout_height="fill_parent" - android:orientation="vertical"> + android:layout_height="match_parent"> -<!-- - <fragment - android:name="com.mapbox.mapboxgl.testapp.MapFragment" - android:id="@+id/fragment_map" + <android.support.design.widget.AppBarLayout + android:id="@+id/appbar" android:layout_width="match_parent" - android:layout_height="match_parent" - tools:context="${packageName}.${activityClass}" - tools:layout="@layout/fragment_main" /> ---> + android:layout_height="wrap_content" + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> - <com.mapbox.mapboxgl.views.MapView - android:id="@+id/mainMapView" + <android.support.v7.widget.Toolbar + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="?attr/actionBarSize" + android:background="?attr/colorPrimary" + app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/> + + + </android.support.design.widget.AppBarLayout> + + <FrameLayout + android:id="@+id/layout_map" android:layout_width="match_parent" android:layout_height="match_parent" - /> + > - <TextView - android:id="@+id/view_fps" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="?android:attr/textAppearanceLarge" - android:text="@string/label_fps" - android:layout_margin="10dp" /> + <!-- + <fragment + android:name="com.mapbox.mapboxgl.testapp.MapFragment" + android:id="@+id/fragment_map" + android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context="${packageName}.${activityClass}" + tools:layout="@layout/fragment_main" /> + --> + + <com.mapbox.mapboxgl.views.MapView + android:id="@+id/mainMapView" + android:layout_width="match_parent" + android:layout_height="match_parent" + /> + + <TextView + android:id="@+id/view_fps" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_margin="10dp" + android:text="@string/label_fps" + android:textAppearance="?android:attr/textAppearanceLarge"/> + + </FrameLayout> + + + <!-- + <android.support.design.widget.FloatingActionButton + android:id="@+id/fab" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="end|bottom" + android:layout_margin="@dimen/fab_margin" + /> + --> + + </android.support.design.widget.CoordinatorLayout> + + + <android.support.design.widget.NavigationView + android:id="@+id/nav_view" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_gravity="start" + android:fitsSystemWindows="true" + tools:headerLayout="@layout/nav_header" + tools:menu="@menu/drawer_view"/> - </FrameLayout> -</LinearLayout> +</android.support.v4.widget.DrawerLayout> diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/res/values/colors.xml b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/values/colors.xml new file mode 100644 index 0000000000..ac3b4fc30d --- /dev/null +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/values/colors.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <color name="primary">#1E8CAB</color> + <color name="primaryDark">#166B83</color> + <color name="accent">#E55E5E</color> + <color name="white">#FFFFFF</color> +</resources> diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/res/values/dimens.xml b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/values/dimens.xml new file mode 100644 index 0000000000..f76eef07c3 --- /dev/null +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/values/dimens.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <dimen name="fab_margin">16dp</dimen> +</resources> diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/res/values/styles.xml b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/values/styles.xml index 2399c78bee..200665796e 100644 --- a/android/java/MapboxGLAndroidSDKTestApp/src/main/res/values/styles.xml +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/values/styles.xml @@ -1,5 +1,13 @@ <?xml version="1.0" encoding="utf-8"?> <resources> - <style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light.NoActionBar" /> + <style name="AppTheme" parent="AppBaseTheme" /> + + <style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light.NoActionBar"> + <item name="colorPrimary">@color/primary</item> + <item name="colorPrimaryDark">@color/primaryDark</item> + <item name="colorAccent">@color/accent</item> + <item name="android:windowBackground">@color/white</item> + </style> + </resources> |