diff options
Diffstat (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils')
6 files changed, 284 insertions, 275 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/FontCache.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/FontCache.java index 3d885dba18..e2271bd5ff 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/FontCache.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/FontCache.java @@ -2,24 +2,25 @@ package com.mapbox.mapboxsdk.testapp.utils; import android.content.Context; import android.graphics.Typeface; + import timber.log.Timber; import java.util.Hashtable; public class FontCache { - private static Hashtable<String, Typeface> fontCache = new Hashtable<>(); + private static Hashtable<String, Typeface> fontCache = new Hashtable<>(); - public static Typeface get(String name, Context context) { - Typeface tf = fontCache.get(name); - if (tf == null) { - try { - tf = Typeface.createFromAsset(context.getAssets(), name); - fontCache.put(name, tf); - } catch (Exception exception) { - Timber.e("Font not found"); - } - } - return tf; + public static Typeface get(String name, Context context) { + Typeface tf = fontCache.get(name); + if (tf == null) { + try { + tf = Typeface.createFromAsset(context.getAssets(), name); + fontCache.put(name, tf); + } catch (Exception exception) { + Timber.e("Font not found"); + } } + return tf; + } }
\ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/GeoParseUtil.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/GeoParseUtil.java index d6a8280c6a..0d21fd2c71 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/GeoParseUtil.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/GeoParseUtil.java @@ -20,54 +20,54 @@ import java.util.List; public class GeoParseUtil { - public static String loadStringFromAssets(final Context context, final String fileName) throws IOException { - if (TextUtils.isEmpty(fileName)) { - throw new NullPointerException("No GeoJSON File Name passed in."); - } - InputStream is = context.getAssets().open(fileName); - BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8"))); - return readAll(rd); + public static String loadStringFromAssets(final Context context, final String fileName) throws IOException { + if (TextUtils.isEmpty(fileName)) { + throw new NullPointerException("No GeoJSON File Name passed in."); } + InputStream is = context.getAssets().open(fileName); + BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8"))); + return readAll(rd); + } - public static List<LatLng> parseGeoJSONCoordinates(String geojsonStr) throws JSONException { - List<LatLng> latLngs = new ArrayList<>(); - JSONObject jsonObject = new JSONObject(geojsonStr); - JSONArray features = jsonObject.getJSONArray("features"); - int featureLength = features.length(); - for (int j = 0; j < featureLength; ++j) { - JSONObject feature = features.getJSONObject(j); - JSONObject geometry = feature.getJSONObject("geometry"); - String type = geometry.getString("type"); - JSONArray coordinates; - if (type.equals("Polygon")) { - coordinates = geometry.getJSONArray("coordinates").getJSONArray(0); - } else { - coordinates = geometry.getJSONArray("coordinates"); - } - int len = coordinates.length(); - for (int i = 0; i < len; ++i) { - if (coordinates.get(i) instanceof JSONArray) { - JSONArray coord = coordinates.getJSONArray(i); - double lng = coord.getDouble(0); - double lat = coord.getDouble(1); - latLngs.add(new LatLng(lat, lng)); - } else { - double lng = coordinates.getDouble(0); - double lat = coordinates.getDouble(1); - latLngs.add(new LatLng(lat, lng)); - break; - } - } + public static List<LatLng> parseGeoJsonCoordinates(String geojsonStr) throws JSONException { + List<LatLng> latLngs = new ArrayList<>(); + JSONObject jsonObject = new JSONObject(geojsonStr); + JSONArray features = jsonObject.getJSONArray("features"); + int featureLength = features.length(); + for (int j = 0; j < featureLength; ++j) { + JSONObject feature = features.getJSONObject(j); + JSONObject geometry = feature.getJSONObject("geometry"); + String type = geometry.getString("type"); + JSONArray coordinates; + if (type.equals("Polygon")) { + coordinates = geometry.getJSONArray("coordinates").getJSONArray(0); + } else { + coordinates = geometry.getJSONArray("coordinates"); + } + int len = coordinates.length(); + for (int i = 0; i < len; ++i) { + if (coordinates.get(i) instanceof JSONArray) { + JSONArray coord = coordinates.getJSONArray(i); + double lng = coord.getDouble(0); + double lat = coord.getDouble(1); + latLngs.add(new LatLng(lat, lng)); + } else { + double lng = coordinates.getDouble(0); + double lat = coordinates.getDouble(1); + latLngs.add(new LatLng(lat, lng)); + break; } - return latLngs; + } } + return latLngs; + } - private static String readAll(Reader rd) throws IOException { - StringBuilder sb = new StringBuilder(); - int cp; - while ((cp = rd.read()) != -1) { - sb.append((char) cp); - } - return sb.toString(); + private static String readAll(Reader rd) throws IOException { + StringBuilder sb = new StringBuilder(); + int cp; + while ((cp = rd.read()) != -1) { + sb.append((char) cp); } + return sb.toString(); + } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/ItemClickSupport.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/ItemClickSupport.java index ba74d1d837..414a781544 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/ItemClickSupport.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/ItemClickSupport.java @@ -6,90 +6,90 @@ import android.view.View; import com.mapbox.mapboxsdk.testapp.R; public class ItemClickSupport { - private final RecyclerView recyclerView; - private OnItemClickListener onItemClickListener; - private OnItemLongClickListener onItemLongClickListener; - private View.OnClickListener onClickListener = new View.OnClickListener() { - @Override - public void onClick(View view) { - if (onItemClickListener != null) { - RecyclerView.ViewHolder holder = recyclerView.getChildViewHolder(view); - onItemClickListener.onItemClicked(recyclerView, holder.getAdapterPosition(), view); - } + private final RecyclerView recyclerView; + private OnItemClickListener onItemClickListener; + private OnItemLongClickListener onItemLongClickListener; + private View.OnClickListener onClickListener = new View.OnClickListener() { + @Override + public void onClick(View view) { + if (onItemClickListener != null) { + RecyclerView.ViewHolder holder = recyclerView.getChildViewHolder(view); + onItemClickListener.onItemClicked(recyclerView, holder.getAdapterPosition(), view); + } + } + }; + private View.OnLongClickListener onLongClickListener = new View.OnLongClickListener() { + @Override + public boolean onLongClick(View view) { + if (onItemLongClickListener != null) { + RecyclerView.ViewHolder holder = recyclerView.getChildViewHolder(view); + return onItemLongClickListener.onItemLongClicked(recyclerView, holder.getAdapterPosition(), view); + } + return false; + } + }; + private RecyclerView.OnChildAttachStateChangeListener attachListener + = new RecyclerView.OnChildAttachStateChangeListener() { + @Override + public void onChildViewAttachedToWindow(View view) { + if (onItemClickListener != null) { + view.setOnClickListener(onClickListener); } - }; - private View.OnLongClickListener onLongClickListener = new View.OnLongClickListener() { - @Override - public boolean onLongClick(View view) { - if (onItemLongClickListener != null) { - RecyclerView.ViewHolder holder = recyclerView.getChildViewHolder(view); - return onItemLongClickListener.onItemLongClicked(recyclerView, holder.getAdapterPosition(), view); - } - return false; - } - }; - private RecyclerView.OnChildAttachStateChangeListener attachListener - = new RecyclerView.OnChildAttachStateChangeListener() { - @Override - public void onChildViewAttachedToWindow(View view) { - if (onItemClickListener != null) { - view.setOnClickListener(onClickListener); - } - if (onItemLongClickListener != null) { - view.setOnLongClickListener(onLongClickListener); - } + if (onItemLongClickListener != null) { + view.setOnLongClickListener(onLongClickListener); } + } - @Override - public void onChildViewDetachedFromWindow(View view) { + @Override + public void onChildViewDetachedFromWindow(View view) { - } + } }; - private ItemClickSupport(RecyclerView recyclerView) { - this.recyclerView = recyclerView; - this.recyclerView.setTag(R.id.item_click_support, this); - this.recyclerView.addOnChildAttachStateChangeListener(attachListener); - } + private ItemClickSupport(RecyclerView recyclerView) { + this.recyclerView = recyclerView; + this.recyclerView.setTag(R.id.item_click_support, this); + this.recyclerView.addOnChildAttachStateChangeListener(attachListener); + } - public static ItemClickSupport addTo(RecyclerView view) { - ItemClickSupport support = (ItemClickSupport) view.getTag(R.id.item_click_support); - if (support == null) { - support = new ItemClickSupport(view); - } - return support; + public static ItemClickSupport addTo(RecyclerView view) { + ItemClickSupport support = (ItemClickSupport) view.getTag(R.id.item_click_support); + if (support == null) { + support = new ItemClickSupport(view); } + return support; + } - public static ItemClickSupport removeFrom(RecyclerView view) { - ItemClickSupport support = (ItemClickSupport) view.getTag(R.id.item_click_support); - if (support != null) { - support.detach(view); - } - return support; + public static ItemClickSupport removeFrom(RecyclerView view) { + ItemClickSupport support = (ItemClickSupport) view.getTag(R.id.item_click_support); + if (support != null) { + support.detach(view); } + return support; + } - public ItemClickSupport setOnItemClickListener(OnItemClickListener listener) { - onItemClickListener = listener; - return this; - } + public ItemClickSupport setOnItemClickListener(OnItemClickListener listener) { + onItemClickListener = listener; + return this; + } - public ItemClickSupport setOnItemLongClickListener(OnItemLongClickListener listener) { - onItemLongClickListener = listener; - return this; - } + public ItemClickSupport setOnItemLongClickListener(OnItemLongClickListener listener) { + onItemLongClickListener = listener; + return this; + } - private void detach(RecyclerView view) { - view.removeOnChildAttachStateChangeListener(attachListener); - view.setTag(R.id.item_click_support, null); - } + private void detach(RecyclerView view) { + view.removeOnChildAttachStateChangeListener(attachListener); + view.setTag(R.id.item_click_support, null); + } - public interface OnItemClickListener { + public interface OnItemClickListener { - void onItemClicked(RecyclerView recyclerView, int position, View view); - } + void onItemClicked(RecyclerView recyclerView, int position, View view); + } - public interface OnItemLongClickListener { + public interface OnItemLongClickListener { - boolean onItemLongClicked(RecyclerView recyclerView, int position, View view); - } + boolean onItemLongClicked(RecyclerView recyclerView, int position, View view); + } }
\ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/OfflineUtils.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/OfflineUtils.java index a00cb230c9..8c6ab3e211 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/OfflineUtils.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/OfflineUtils.java @@ -1,6 +1,7 @@ package com.mapbox.mapboxsdk.testapp.utils; import android.support.annotation.NonNull; + import timber.log.Timber; import org.json.JSONObject; @@ -10,27 +11,27 @@ import static com.mapbox.mapboxsdk.testapp.activity.offline.OfflineActivity.JSON public class OfflineUtils { - public static String convertRegionName(@NonNull byte[] metadata) { - try { - String json = new String(metadata, JSON_CHARSET); - JSONObject jsonObject = new JSONObject(json); - return jsonObject.getString(JSON_FIELD_REGION_NAME); - } catch (Exception exception) { - return null; - } + public static String convertRegionName(@NonNull byte[] metadata) { + try { + String json = new String(metadata, JSON_CHARSET); + JSONObject jsonObject = new JSONObject(json); + return jsonObject.getString(JSON_FIELD_REGION_NAME); + } catch (Exception exception) { + return null; } + } - public static byte[] convertRegionName(String regionName) { - byte[] metadata = null; - try { - JSONObject jsonObject = new JSONObject(); - jsonObject.put(JSON_FIELD_REGION_NAME, regionName); - String json = jsonObject.toString(); - metadata = json.getBytes(JSON_CHARSET); - } catch (Exception exception) { - Timber.e("Failed to encode metadata: " + exception.getMessage()); - } - return metadata; + public static byte[] convertRegionName(String regionName) { + byte[] metadata = null; + try { + JSONObject jsonObject = new JSONObject(); + jsonObject.put(JSON_FIELD_REGION_NAME, regionName); + String json = jsonObject.toString(); + metadata = json.getBytes(JSON_CHARSET); + } catch (Exception exception) { + Timber.e("Failed to encode metadata: " + exception.getMessage()); } - + return metadata; + } + } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/TimingLogger.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/TimingLogger.java index 9d1fee4990..e096aa202d 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/TimingLogger.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/TimingLogger.java @@ -1,3 +1,4 @@ +package com.mapbox.mapboxsdk.testapp.utils; /* * Copyright (C) 2007 The Android Open Source Project * @@ -13,17 +14,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.mapbox.mapboxsdk.testapp.utils; + +import android.os.SystemClock; import java.util.ArrayList; -import android.os.SystemClock; import timber.log.Timber; /** * A utility class to help log timings splits throughout a method call. * Typical usage is: - * + * <p> * <pre> * TimingLogger timings = new TimingLogger(TAG, "methodA"); * // ... do some work A ... @@ -34,9 +35,9 @@ import timber.log.Timber; * timings.addSplit("work C"); * timings.dumpToLog(); * </pre> - * + * <p> * <p>The dumpToLog call would add the following to the log:</p> - * + * <p> * <pre> * D/TAG ( 3459): methodA: begin * D/TAG ( 3459): methodA: 9 ms, work A @@ -46,108 +47,114 @@ import timber.log.Timber; * </pre> */ public class TimingLogger { - /** - * The Log tag to use for checking Log.isLoggable and for - * logging the timings. - */ - private String mTag; - /** - * A label to be included in every log. - */ - private String mLabel; - /** - * Used to track whether Log.isLoggable was enabled at reset time. - */ - private boolean mDisabled; - /** - * Stores the time of each split. - */ - ArrayList<Long> mSplits; - /** - * Stores the labels for each split. - */ - ArrayList<String> mSplitLabels; + /** + * The Log tag to use for checking Log.isLoggable and for + * logging the timings. + */ + private String tag; + /** + * A label to be included in every log. + */ + private String label; + /** + * Used to track whether Log.isLoggable was enabled at reset time. + */ + private boolean disabled; + /** + * Stores the time of each split. + */ + private ArrayList<Long> splits; + /** + * Stores the labels for each split. + */ + private ArrayList<String> splitLabels; - /** - * Create and initialize a TimingLogger object that will log using - * the specific tag. If the Log.isLoggable is not enabled to at - * least the Log.VERBOSE level for that tag at creation time then - * the addSplit and dumpToLog call will do nothing. - * - * @param tag the log tag to use while logging the timings - * @param label a string to be displayed with each log - */ - public TimingLogger(String tag, String label) { - reset(tag, label); - } + /** + * Create and initialize a TimingLogger object that will log using + * the specific tag. If the Log.isLoggable is not enabled to at + * least the Log.VERBOSE level for that tag at creation time then + * the addSplit and dumpToLog call will do nothing. + * + * @param tag the log tag to use while logging the timings + * @param label a string to be displayed with each log + */ + public TimingLogger(String tag, String label) { + reset(tag, label); + } - /** - * Clear and initialize a TimingLogger object that will log using - * the specific tag. If the Log.isLoggable is not enabled to at - * least the Log.VERBOSE level for that tag at creation time then - * the addSplit and dumpToLog call will do nothing. - * - * @param tag the log tag to use while logging the timings - * @param label a string to be displayed with each log - */ - public void reset(String tag, String label) { - mTag = tag; - mLabel = label; - reset(); - } + /** + * Clear and initialize a TimingLogger object that will log using + * the specific tag. If the Log.isLoggable is not enabled to at + * least the Log.VERBOSE level for that tag at creation time then + * the addSplit and dumpToLog call will do nothing. + * + * @param tag the log tag to use while logging the timings + * @param label a string to be displayed with each log + */ + public void reset(String tag, String label) { + this.tag = tag; + this.label = label; + reset(); + } - /** - * Clear and initialize a TimingLogger object that will log using - * the tag and label that was specified previously, either via - * the constructor or a call to reset(tag, label). If the - * Log.isLoggable is not enabled to at least the Log.VERBOSE - * level for that tag at creation time then the addSplit and - * dumpToLog call will do nothing. - */ - public void reset() { - mDisabled = false; //!Log.isLoggable(mTag, Log.VERBOSE); - if (mDisabled) return; - if (mSplits == null) { - mSplits = new ArrayList<Long>(); - mSplitLabels = new ArrayList<String>(); - } else { - mSplits.clear(); - mSplitLabels.clear(); - } - addSplit(null); + /** + * Clear and initialize a TimingLogger object that will log using + * the tag and label that was specified previously, either via + * the constructor or a call to reset(tag, label). If the + * Log.isLoggable is not enabled to at least the Log.VERBOSE + * level for that tag at creation time then the addSplit and + * dumpToLog call will do nothing. + */ + public void reset() { + disabled = false; //!Log.isLoggable(tag, Log.VERBOSE); + if (disabled) { + return; + } + if (splits == null) { + splits = new ArrayList<Long>(); + splitLabels = new ArrayList<String>(); + } else { + splits.clear(); + splitLabels.clear(); } + addSplit(null); + } - /** - * Add a split for the current time, labeled with splitLabel. If - * Log.isLoggable was not enabled to at least the Log.VERBOSE for - * the specified tag at construction or reset() time then this - * call does nothing. - * - * @param splitLabel a label to associate with this split. - */ - public void addSplit(String splitLabel) { - if (mDisabled) return; - long now = SystemClock.elapsedRealtime(); - mSplits.add(now); - mSplitLabels.add(splitLabel); + /** + * Add a split for the current time, labeled with splitLabel. If + * Log.isLoggable was not enabled to at least the Log.VERBOSE for + * the specified tag at construction or reset() time then this + * call does nothing. + * + * @param splitLabel a label to associate with this split. + */ + public void addSplit(String splitLabel) { + if (disabled) { + return; } + long now = SystemClock.elapsedRealtime(); + splits.add(now); + splitLabels.add(splitLabel); + } - /** - * Dumps the timings to the log using Timber.d(). If Log.isLoggable was - * not enabled to at least the Log.VERBOSE for the specified tag at - * construction or reset() time then this call does nothing. - */ - public void dumpToLog() { - if (mDisabled) return; - Timber.d(mLabel + ": begin"); - final long first = mSplits.get(0); - long now = first; - for (int i = 1; i < mSplits.size(); i++) { - now = mSplits.get(i); - final String splitLabel = mSplitLabels.get(i); - final long prev = mSplits.get(i - 1); - Timber.d(mLabel + ": " + (now - prev) + " ms, " + splitLabel); - } - Timber.d(mLabel + ": end, " + (now - first) + " ms"); + /** + * Dumps the timings to the log using Timber.d(). If Log.isLoggable was + * not enabled to at least the Log.VERBOSE for the specified tag at + * construction or reset() time then this call does nothing. + */ + public void dumpToLog() { + if (disabled) { + return; + } + Timber.d(label + ": begin"); + final long first = splits.get(0); + long now = first; + for (int i = 1; i < splits.size(); i++) { + now = splits.get(i); + final String splitLabel = splitLabels.get(i); + final long prev = splits.get(i - 1); + Timber.d(label + ": " + (now - prev) + " ms, " + splitLabel); } + Timber.d(label + ": end, " + (now - first) + " ms"); + } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/ToolbarComposer.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/ToolbarComposer.java index 7822e41bd9..3fa3bcd26f 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/ToolbarComposer.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/ToolbarComposer.java @@ -15,35 +15,35 @@ import com.mapbox.mapboxsdk.testapp.R; public class ToolbarComposer { - /** - * Initialises an up navigation toolbar with id R.id.toolbar on an AppCompatActivity. - * - * @param activity The activity hosting the Toolbar with id R.id.toolbar - */ - @Nullable - public static Toolbar initDefaultUpToolbar(@NonNull AppCompatActivity activity) { - return initDefaultUpToolbar(activity, R.id.toolbar); - } - - /** - * Initialises an up navigation toolbar given a view id on an AppCompatActivity. - * - * @param activity The activity hosting the Toolbar - * @param toolbarRes The view id resource used to look up the Toolbar - */ - @Nullable - public static Toolbar initDefaultUpToolbar(@NonNull AppCompatActivity activity, @IdRes int toolbarRes) { - Toolbar toolbar = (Toolbar) activity.findViewById(toolbarRes); - if (toolbar != null) { - activity.setSupportActionBar(toolbar); - - ActionBar actionBar = activity.getSupportActionBar(); - if (actionBar != null) { - actionBar.setDisplayHomeAsUpEnabled(true); - actionBar.setDisplayShowHomeEnabled(true); - } - } - return toolbar; + /** + * Initialises an up navigation toolbar with id R.id.toolbar on an AppCompatActivity. + * + * @param activity The activity hosting the Toolbar with id R.id.toolbar + */ + @Nullable + public static Toolbar initDefaultUpToolbar(@NonNull AppCompatActivity activity) { + return initDefaultUpToolbar(activity, R.id.toolbar); + } + + /** + * Initialises an up navigation toolbar given a view id on an AppCompatActivity. + * + * @param activity The activity hosting the Toolbar + * @param toolbarRes The view id resource used to look up the Toolbar + */ + @Nullable + public static Toolbar initDefaultUpToolbar(@NonNull AppCompatActivity activity, @IdRes int toolbarRes) { + Toolbar toolbar = (Toolbar) activity.findViewById(toolbarRes); + if (toolbar != null) { + activity.setSupportActionBar(toolbar); + + ActionBar actionBar = activity.getSupportActionBar(); + if (actionBar != null) { + actionBar.setDisplayHomeAsUpEnabled(true); + actionBar.setDisplayShowHomeEnabled(true); + } } + return toolbar; + } } |