summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCameron <cameron@mapbox.com>2016-11-04 15:19:47 -0400
committerCameron <cameron@mapbox.com>2016-11-04 15:19:47 -0400
commit477338d4892146722720fe3a26acb5ca7b2a1501 (patch)
treedff08f91ddf611eb6c816a2b41943c3eaea16206
parent6c30105a5390b1821ba698d6b9c05c4c24294db6 (diff)
downloadqtlocation-mapboxgl-upstream/cam-add-keyboard-example.tar.gz
added keyboard activity to testappupstream/cam-add-keyboard-example
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml10
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/KeyboardActivity.java94
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_keyboard.xml34
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/strings.xml4
4 files changed, 141 insertions, 1 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml
index 92a8f0e48e..14459372c3 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml
@@ -445,6 +445,16 @@
android:name="@string/category"
android:value="@string/category_maplayout" />
</activity>
+ <activity
+ android:name=".activity.maplayout.KeyboardActivity"
+ android:description="@string/description_keyboard"
+ android:configChanges="orientation|screenSize|keyboardHidden"
+ android:windowSoftInputMode="adjustResize"
+ android:label="@string/activity_keyboard">
+ <meta-data
+ android:name="@string/category"
+ android:value="@string/category_maplayout" />
+ </activity>
<!-- For Unit tests -->
<activity android:name=".activity.style.RuntimeStyleTestActivity" />
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/KeyboardActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/KeyboardActivity.java
new file mode 100644
index 0000000000..229719583d
--- /dev/null
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/KeyboardActivity.java
@@ -0,0 +1,94 @@
+package com.mapbox.mapboxsdk.testapp.activity.maplayout;
+
+import android.os.Bundle;
+import android.support.v7.app.ActionBar;
+import android.support.v7.app.AppCompatActivity;
+import android.support.v7.widget.Toolbar;
+import android.view.MenuItem;
+
+import com.mapbox.mapboxsdk.maps.MapView;
+import com.mapbox.mapboxsdk.maps.MapboxMap;
+import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
+import com.mapbox.mapboxsdk.testapp.R;
+
+public class KeyboardActivity extends AppCompatActivity implements OnMapReadyCallback {
+
+ private MapView mapView;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_keyboard);
+
+ Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
+ setSupportActionBar(toolbar);
+
+ ActionBar actionBar = getSupportActionBar();
+ if (actionBar != null) {
+ actionBar.setDisplayHomeAsUpEnabled(true);
+ actionBar.setDisplayShowHomeEnabled(true);
+ }
+
+ mapView = (MapView) findViewById(R.id.mapView);
+ mapView.onCreate(savedInstanceState);
+ mapView.getMapAsync(this);
+ }
+
+ @Override
+ public void onMapReady(MapboxMap mapboxMap) {
+
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ mapView.onStart();
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ mapView.onResume();
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ mapView.onPause();
+ }
+
+ @Override
+ public void onLowMemory() {
+ super.onLowMemory();
+ mapView.onLowMemory();
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ mapView.onStop();
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ mapView.onDestroy();
+ }
+
+ @Override
+ protected void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ mapView.onSaveInstanceState(outState);
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ switch (item.getItemId()) {
+ case android.R.id.home:
+ onBackPressed();
+ return true;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+ }
+}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_keyboard.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_keyboard.xml
new file mode 100644
index 0000000000..911e724206
--- /dev/null
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_keyboard.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:mapbox="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+
+ <android.support.v7.widget.Toolbar
+ android:id="@+id/toolbar"
+ android:layout_width="match_parent"
+ android:layout_height="?attr/actionBarSize"
+ android:background="@color/primary"
+ android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
+
+ <com.mapbox.mapboxsdk.maps.MapView
+ android:id="@+id/mapView"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_below="@id/toolbar"
+ mapbox:mapbox_center_latitude="25.7798"
+ mapbox:mapbox_center_longitude="-80.1873"
+ mapbox:mapbox_style_url="@string/mapbox_style_satellite_streets"
+ mapbox:mapbox_zoom="11"/>
+
+ <EditText
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/toolbar"
+ android:layout_margin="16dp"
+ android:background="@color/white"
+ android:inputType="text"
+ android:padding="8dp"/>
+
+</RelativeLayout> \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/strings.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/strings.xml
index a9f639d998..074a1a33c2 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/strings.xml
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/strings.xml
@@ -72,6 +72,7 @@
<string name="activity_navigation_drawer">Android SDK View integration</string>
<string name="activity_video_view">Video View</string>
<string name="activity_map_in_dialog">Dialog with map</string>
+ <string name="activity_keyboard">Open keyboard</string>
<!-- Description -->
<string name="description_user_location_tracking">Tracks the location of the user</string>
@@ -122,12 +123,13 @@
<string name="description_query_rendered_feature_properties_point">Query rendered feature properties on click</string>
<string name="description_query_rendered_features_box_count">Count all rendered features in box</string>
<string name="description_query_rendered_features_box_symbol_count">Count all rendered symbols in box</string>
- <string name="description_query_rendered_features_box_highlight">Hightligh buildings in box</string>
+ <string name="description_query_rendered_features_box_highlight">Highlight buildings in box</string>
<string name="description_car_driving">MyLocationView follow map update example</string>
<string name="description_video_view">Android video view on top of the map view</string>
<string name="description_add_remove_markers">Based on zoom level</string>
<string name="description_style_file">Use a local file as the style</string>
<string name="description_map_in_dialog">Display a map inside a dialog fragment</string>
+ <string name="description_keyboard">Edit text on top of map which opens device keyboard</string>
<string name="menuitem_title_concurrent_infowindow">Concurrent Open InfoWindows</string>
<string name="menuitem_title_deselect_markers_on_tap">Deselect Markers On Tap</string>