From 86b8f535daf83b873e9d5dfc5ef9bf5533312637 Mon Sep 17 00:00:00 2001 From: Gustavo Martin Morcuende Date: Sun, 4 Sep 2016 08:16:15 +0200 Subject: [PATCH] Widget configuration view, using ToolBar --- .../gumartinm/weather/information/widget/WidgetConfigure.java | 10 ++++------ app/src/main/res/layout/appwidget_configure.xml | 5 ++++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/name/gumartinm/weather/information/widget/WidgetConfigure.java b/app/src/main/java/name/gumartinm/weather/information/widget/WidgetConfigure.java index a16a5b4..df079d5 100644 --- a/app/src/main/java/name/gumartinm/weather/information/widget/WidgetConfigure.java +++ b/app/src/main/java/name/gumartinm/weather/information/widget/WidgetConfigure.java @@ -22,6 +22,7 @@ import android.content.SharedPreferences; 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.View; import android.widget.CompoundButton; import android.widget.Spinner; @@ -37,12 +38,6 @@ public class WidgetConfigure extends AppCompatActivity { public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); - final ActionBar actionBar = this.getSupportActionBar(); - actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE); - actionBar.setDisplayHomeAsUpEnabled(true); - actionBar.setDisplayShowHomeEnabled(true); - actionBar.setIcon(R.drawable.ic_launcher); - // Find the widget id from the intent. final Intent intent = getIntent(); final Bundle extras = intent.getExtras(); @@ -69,6 +64,9 @@ public class WidgetConfigure extends AppCompatActivity { // Set the view layout resource to use. this.setContentView(R.layout.appwidget_configure); + final Toolbar toolbar = (Toolbar) findViewById(R.id.weather_main_toolbar); + this.setSupportActionBar(toolbar); + /******************* Show/hide country field *******************/ String keyPreference = this.getApplicationContext().getString( R.string.widget_preferences_country_switch_key); diff --git a/app/src/main/res/layout/appwidget_configure.xml b/app/src/main/res/layout/appwidget_configure.xml index 95be9d3..ecc928c 100644 --- a/app/src/main/res/layout/appwidget_configure.xml +++ b/app/src/main/res/layout/appwidget_configure.xml @@ -19,6 +19,8 @@ android:layout_width="fill_parent" android:layout_height="fill_parent"> + + + android:layout_above="@id/weather_appwidget_configure_button_layout" + android:layout_below="@+id/weather_main_toolbar">