Widget configuration view, using ToolBar
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 4 Sep 2016 06:16:15 +0000 (08:16 +0200)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 4 Sep 2016 06:16:15 +0000 (08:16 +0200)
app/src/main/java/name/gumartinm/weather/information/widget/WidgetConfigure.java
app/src/main/res/layout/appwidget_configure.xml

index a16a5b4..df079d5 100644 (file)
@@ -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);
index 95be9d3..ecc928c 100644 (file)
@@ -19,6 +19,8 @@
     android:layout_width="fill_parent"
     android:layout_height="fill_parent">
 
+    <include layout="@layout/weather_general_toolbar"/>
+
     <LinearLayout android:id="@+id/weather_appwidget_configure_button_layout"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
@@ -38,7 +40,8 @@
     <ScrollView
         android:layout_width="fill_parent"
         android:layout_height="fill_parent"
-        android:layout_above="@id/weather_appwidget_configure_button_layout">
+        android:layout_above="@id/weather_appwidget_configure_button_layout"
+        android:layout_below="@+id/weather_main_toolbar">
 
         <LinearLayout
             android:layout_width="fill_parent"