Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.mapbox.mapboxsdk.plugins.testapp.activity.places

import android.graphics.Color
import android.os.Bundle
import android.support.v4.content.ContextCompat
import android.support.v7.app.AppCompatActivity
Expand All @@ -23,6 +24,7 @@ class AutocompleteFragmentActivity : AppCompatActivity() {
if (savedInstanceState == null) {
val placeOptions = PlaceOptions.builder()
.toolbarColor(ContextCompat.getColor(this, R.color.colorPrimary))
.statusbarColor(Color.YELLOW)
.hint("Begin searching...")
.build()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class AutocompleteLauncherActivity : AppCompatActivity(), OnMapReadyCallback {
.backgroundColor(Color.WHITE)
.addInjectedFeature(home)
.addInjectedFeature(work)
.statusbarColor(Color.MAGENTA)
.build())
.build(this@AutocompleteLauncherActivity)
startActivityForResult(intent, REQUEST_CODE_AUTOCOMPLETE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,15 @@ public abstract class PlaceOptions implements Parcelable {
*/
public abstract int toolbarColor();

/**
* Set the autocomplete's layout status bar color. Defaults {@link Color#BLACK}.
*
* @return the status bar color as a ColorInt
* @since 0.9.0
*/
@ColorInt
public abstract int statusbarColor();

/**
* Optionally set the hint string which is shown before the user inputs a search term inside the
* top edit text.
Expand All @@ -191,6 +200,7 @@ public static Builder builder() {
return new AutoValue_PlaceOptions.Builder()
.backgroundColor(Color.TRANSPARENT)
.toolbarColor(Color.WHITE)
.statusbarColor(Color.BLACK)
.limit(10);
}

Expand Down Expand Up @@ -398,6 +408,15 @@ public Builder addInjectedFeature(CarmenFeature carmenFeature) {
*/
public abstract Builder toolbarColor(@ColorInt int toolbarColor);

/**
* Set the autocomplete's layout status bar color. Defaults {@link Color#BLACK}.
*
* @param statusbarColor the views status bar color as a ColorInt
* @return this builder instance for chaining options together
* @since 0.9.0
*/
public abstract Builder statusbarColor(@ColorInt int statusbarColor);

/**
* Optionally set the hint string which is shown before the user inputs a search term inside the
* top edit text.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
} else {
fragment = PlaceAutocompleteFragment.newInstance(accessToken);
}

getSupportFragmentManager().beginTransaction()
.add(R.id.fragment_container, fragment, PlaceAutocompleteFragment.TAG).commit();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.mapbox.mapboxsdk.plugins.places.autocomplete.ui;

import android.app.Activity;
import android.arch.lifecycle.Observer;
import android.arch.lifecycle.ViewModelProviders;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
Expand Down Expand Up @@ -105,6 +107,11 @@ private void styleView() {
toolbar.setBackgroundColor(placeOptions.toolbarColor());
}

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Activity context = (Activity) rootView.getContext();
context.getWindow().setStatusBarColor(placeOptions.statusbarColor());
}

searchView = rootView.findViewById(R.id.searchView);
searchView.setHint(placeOptions.hint() == null
? getString(R.string.mapbox_plugins_autocomplete_search_hint) : placeOptions.hint());
Expand Down