Search in sources :

Example 11 with ConstraintLayout

use of androidx.constraintlayout.widget.ConstraintLayout in project mapbox-plugins-android by mapbox.

the class OfflineActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Hide any toolbar an apps theme might automatically place in activities. Typically creating an
    // activity style would cover this issue but this seems to prevent us from getting the users
    // application colorPrimary color.
    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
    getSupportActionBar().hide();
    setContentView(R.layout.mapbox_offline_activity);
    ConstraintLayout toolbar = findViewById(R.id.place_picker_toolbar);
    int color = ColorUtils.getMaterialColor(this, R.attr.colorPrimary);
    toolbar.setBackgroundColor(color);
    // Add autocomplete fragment if this is first creation
    if (savedInstanceState == null) {
        RegionSelectionFragment fragment;
        RegionSelectionOptions regionSelectionOptions = getIntent().getParcelableExtra(OfflinePluginConstants.REGION_SELECTION_OPTIONS);
        if (regionSelectionOptions != null) {
            fragment = RegionSelectionFragment.newInstance(regionSelectionOptions);
        } else {
            fragment = RegionSelectionFragment.newInstance();
        }
        getSupportFragmentManager().beginTransaction().add(R.id.fragment_container, fragment, RegionSelectionFragment.TAG).commit();
        fragment.setSelectedCallback(this);
    }
}
Also used : RegionSelectionOptions(com.mapbox.mapboxsdk.plugins.offline.model.RegionSelectionOptions) ConstraintLayout(androidx.constraintlayout.widget.ConstraintLayout)

Example 12 with ConstraintLayout

use of androidx.constraintlayout.widget.ConstraintLayout in project mapbox-plugins-android by mapbox.

the class PlacePickerActivity method customizeViews.

private void customizeViews() {
    ConstraintLayout toolbar = findViewById(R.id.place_picker_toolbar);
    if (options != null && options.toolbarColor() != null) {
        toolbar.setBackgroundColor(options.toolbarColor());
    } else {
        int color = ColorUtils.getMaterialColor(this, R.attr.colorPrimary);
        toolbar.setBackgroundColor(color);
    }
}
Also used : Point(com.mapbox.geojson.Point) ConstraintLayout(androidx.constraintlayout.widget.ConstraintLayout)

Aggregations

ConstraintLayout (androidx.constraintlayout.widget.ConstraintLayout)12 TextView (android.widget.TextView)5 View (android.view.View)4 LinearLayout (android.widget.LinearLayout)4 Bundle (android.os.Bundle)3 ImageView (android.widget.ImageView)3 Toolbar (androidx.appcompat.widget.Toolbar)3 ConstraintSet (androidx.constraintlayout.widget.ConstraintSet)3 ViewModelProvider (androidx.lifecycle.ViewModelProvider)3 AlertDialog (android.app.AlertDialog)2 Drawable (android.graphics.drawable.Drawable)2 TextUtils (android.text.TextUtils)2 LayoutInflater (android.view.LayoutInflater)2 Spinner (android.widget.Spinner)2 NonNull (androidx.annotation.NonNull)2 Nullable (androidx.annotation.Nullable)2 AppCompatResources (androidx.appcompat.content.res.AppCompatResources)2 ContextCompat (androidx.core.content.ContextCompat)2 DrawableCompat (androidx.core.graphics.drawable.DrawableCompat)2 NavDirections (androidx.navigation.NavDirections)2