Update layout file names: weather_main_tabs.xml and weather_notification.xml
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Tue, 18 Nov 2014 04:02:34 +0000 (05:02 +0100)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Tue, 18 Nov 2014 04:02:34 +0000 (05:02 +0100)
app/src/main/java/name/gumartinm/weather/information/activity/MainTabsActivity.java
app/src/main/java/name/gumartinm/weather/information/notification/NotificationIntentService.java
app/src/main/res/layout/fragment_pager.xml [deleted file]
app/src/main/res/layout/notification.xml [deleted file]
app/src/main/res/layout/weather_main_tabs.xml [new file with mode: 0644]
app/src/main/res/layout/weather_notification.xml [new file with mode: 0644]

index d3951cf..3e9956f 100644 (file)
@@ -47,7 +47,7 @@ public class MainTabsActivity extends FragmentActivity {
     @Override
     protected void onCreate(final Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        this.setContentView(R.layout.fragment_pager);
+        this.setContentView(R.layout.weather_main_tabs);
 
         this.mPager = (ViewPager)this.findViewById(R.id.pager);
         this.mPager.setAdapter(new TabsAdapter(this.getSupportFragmentManager()));
index 932b49c..59d6637 100644 (file)
@@ -195,7 +195,7 @@ public class NotificationIntentService extends IntentService {
         final String country = weatherLocation.getCountry();
         
         // 4. Insert data in RemoteViews.
-        final RemoteViews remoteView = new RemoteViews(this.getApplicationContext().getPackageName(), R.layout.notification);
+        final RemoteViews remoteView = new RemoteViews(this.getApplicationContext().getPackageName(), R.layout.weather_notification);
         remoteView.setImageViewBitmap(R.id.weather_notification_image, picture);
         remoteView.setTextViewText(R.id.weather_notification_temperature_max, tempMax);
         remoteView.setTextViewText(R.id.weather_notification_temperature_min, tempMin);
@@ -204,9 +204,7 @@ public class NotificationIntentService extends IntentService {
 
         // 5. Activity launcher.
         final Intent resultIntent =  new Intent(this.getApplicationContext(), MainTabsActivity.class);
-        // The PendingIntent to launch our activity if the user selects this notification
-//        final PendingIntent contentIntent = PendingIntent.getActivity(
-//                     this.getApplicationContext(), 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT);
+        // The PendingIntent to launch our activity if the user selects this notification.
         // The stack builder object will contain an artificial back stack for the started Activity.
         // This ensures that navigating backward from the Activity leads out of
         // your application to the Home screen.
diff --git a/app/src/main/res/layout/fragment_pager.xml b/app/src/main/res/layout/fragment_pager.xml
deleted file mode 100644 (file)
index 272fc03..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-    Copyright 2014 Gustavo Martin Morcuende
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
--->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:orientation="vertical" android:padding="4dip"
-        android:gravity="center_horizontal"
-        android:layout_width="match_parent" android:layout_height="match_parent">
-
-    <android.support.v4.view.ViewPager
-            android:id="@+id/pager"
-            android:layout_width="match_parent"
-            android:layout_height="0px"
-            android:layout_weight="1">
-    </android.support.v4.view.ViewPager>
-
-</LinearLayout>
diff --git a/app/src/main/res/layout/notification.xml b/app/src/main/res/layout/notification.xml
deleted file mode 100644 (file)
index b6a4fba..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-    Copyright 2014 Gustavo Martin Morcuende
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
--->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:layout_gravity="fill"
-    android:baselineAligned="false"
-    android:orientation="horizontal" >
-
-    <LinearLayout
-        android:layout_width="wrap_content"
-        android:layout_height="match_parent"
-        android:layout_gravity="center"
-        android:gravity="center"
-        android:orientation="vertical" >
-    
-       <ImageView
-               android:layout_width="wrap_content"
-               android:layout_height="wrap_content"
-               android:layout_gravity="start"
-               android:contentDescription="@string/icon_weather_description"
-               android:orientation="vertical"
-               android:src="@drawable/ic_launcher" />
-    </LinearLayout>
-    
-
-       
-    <LinearLayout
-        android:layout_width="0dp"
-        android:layout_height="match_parent"
-        android:layout_gravity="center"
-        android:layout_weight="2"
-        android:gravity="center"
-        android:orientation="vertical" >
-        
-        <TextView
-            android:id="@+id/weather_notification_city"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_gravity="center"
-            android:text="Morata de Tajuña"
-            android:textAlignment="center"
-            android:textAppearance="?android:attr/textAppearanceSmall"
-            android:textStyle="bold" />
-    
-        <TextView
-            android:id="@+id/weather_notification_country"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_gravity="center"
-            android:text="Spain"
-            android:textAlignment="center"
-            android:textAppearance="?android:attr/textAppearanceSmall"
-            android:textStyle="normal" />
-    </LinearLayout>
-            
-    <LinearLayout
-        android:layout_width="0dp"
-        android:layout_height="match_parent"
-        android:layout_gravity="center"
-        android:layout_weight="1"
-        android:gravity="center"
-        android:orientation="vertical" >
-        
-        <TextView
-            android:id="@+id/weather_notification_temperature_max"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_gravity="center"
-            android:text="12ºC"
-            android:textAlignment="center"
-            android:textAllCaps="true"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:textStyle="bold" />
-    
-       <TextView
-               android:id="@+id/weather_notification_temperature_min"
-               android:layout_width="wrap_content"
-               android:layout_height="wrap_content"
-               android:layout_gravity="center"
-               android:text="5ºC"
-               android:textAlignment="center"
-               android:textAllCaps="true"
-               android:textAppearance="?android:attr/textAppearanceMedium"
-               android:textStyle="normal" />
-    </LinearLayout>
-    
-    <LinearLayout
-        android:layout_width="wrap_content"
-        android:layout_height="match_parent"
-        android:layout_gravity="center"
-        android:gravity="center"
-        android:orientation="vertical" >
-    
-       <ImageView
-               android:id="@+id/weather_notification_image"
-               android:layout_width="wrap_content"
-               android:layout_height="wrap_content"
-               android:layout_gravity="end"
-               android:contentDescription="@string/icon_weather_description"
-               android:orientation="vertical"
-               android:src="@drawable/ic_launcher" />
-    
-    </LinearLayout>
-
-</LinearLayout>
diff --git a/app/src/main/res/layout/weather_main_tabs.xml b/app/src/main/res/layout/weather_main_tabs.xml
new file mode 100644 (file)
index 0000000..272fc03
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright 2014 Gustavo Martin Morcuende
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:orientation="vertical" android:padding="4dip"
+        android:gravity="center_horizontal"
+        android:layout_width="match_parent" android:layout_height="match_parent">
+
+    <android.support.v4.view.ViewPager
+            android:id="@+id/pager"
+            android:layout_width="match_parent"
+            android:layout_height="0px"
+            android:layout_weight="1">
+    </android.support.v4.view.ViewPager>
+
+</LinearLayout>
diff --git a/app/src/main/res/layout/weather_notification.xml b/app/src/main/res/layout/weather_notification.xml
new file mode 100644 (file)
index 0000000..b6a4fba
--- /dev/null
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    Copyright 2014 Gustavo Martin Morcuende
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:layout_gravity="fill"
+    android:baselineAligned="false"
+    android:orientation="horizontal" >
+
+    <LinearLayout
+        android:layout_width="wrap_content"
+        android:layout_height="match_parent"
+        android:layout_gravity="center"
+        android:gravity="center"
+        android:orientation="vertical" >
+    
+       <ImageView
+               android:layout_width="wrap_content"
+               android:layout_height="wrap_content"
+               android:layout_gravity="start"
+               android:contentDescription="@string/icon_weather_description"
+               android:orientation="vertical"
+               android:src="@drawable/ic_launcher" />
+    </LinearLayout>
+    
+
+       
+    <LinearLayout
+        android:layout_width="0dp"
+        android:layout_height="match_parent"
+        android:layout_gravity="center"
+        android:layout_weight="2"
+        android:gravity="center"
+        android:orientation="vertical" >
+        
+        <TextView
+            android:id="@+id/weather_notification_city"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:text="Morata de Tajuña"
+            android:textAlignment="center"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textStyle="bold" />
+    
+        <TextView
+            android:id="@+id/weather_notification_country"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:text="Spain"
+            android:textAlignment="center"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textStyle="normal" />
+    </LinearLayout>
+            
+    <LinearLayout
+        android:layout_width="0dp"
+        android:layout_height="match_parent"
+        android:layout_gravity="center"
+        android:layout_weight="1"
+        android:gravity="center"
+        android:orientation="vertical" >
+        
+        <TextView
+            android:id="@+id/weather_notification_temperature_max"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            android:text="12ºC"
+            android:textAlignment="center"
+            android:textAllCaps="true"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textStyle="bold" />
+    
+       <TextView
+               android:id="@+id/weather_notification_temperature_min"
+               android:layout_width="wrap_content"
+               android:layout_height="wrap_content"
+               android:layout_gravity="center"
+               android:text="5ºC"
+               android:textAlignment="center"
+               android:textAllCaps="true"
+               android:textAppearance="?android:attr/textAppearanceMedium"
+               android:textStyle="normal" />
+    </LinearLayout>
+    
+    <LinearLayout
+        android:layout_width="wrap_content"
+        android:layout_height="match_parent"
+        android:layout_gravity="center"
+        android:gravity="center"
+        android:orientation="vertical" >
+    
+       <ImageView
+               android:id="@+id/weather_notification_image"
+               android:layout_width="wrap_content"
+               android:layout_height="wrap_content"
+               android:layout_gravity="end"
+               android:contentDescription="@string/icon_weather_description"
+               android:orientation="vertical"
+               android:src="@drawable/ic_launcher" />
+    
+    </LinearLayout>
+
+</LinearLayout>