Skip to content

Commit b4347b4

Browse files
committed
layouts for portrait and landscape mode (phones and tablets)
1 parent 1164036 commit b4347b4

File tree

9 files changed

+102
-22
lines changed

9 files changed

+102
-22
lines changed

.idea/misc.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/app.iml

+10-8
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,10 @@
7171
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
7272
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
7373
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
74-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.2.1/jars" />
75-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/gridlayout-v7/22.2.1/jars" />
76-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.1/jars" />
74+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.1.0/jars" />
75+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/cardview-v7/23.1.0/jars" />
76+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/gridlayout-v7/23.1.0/jars" />
77+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.1.0/jars" />
7778
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-base/8.1.0/jars" />
7879
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-basement/8.1.0/jars" />
7980
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-gcm/8.1.0/jars" />
@@ -92,15 +93,16 @@
9293
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
9394
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
9495
</content>
95-
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
96+
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
9697
<orderEntry type="sourceFolder" forTests="false" />
9798
<orderEntry type="library" exported="" name="play-services-base-8.1.0" level="project" />
99+
<orderEntry type="library" exported="" name="support-annotations-23.1.0" level="project" />
100+
<orderEntry type="library" exported="" name="appcompat-v7-23.1.0" level="project" />
98101
<orderEntry type="library" exported="" name="play-services-basement-8.1.0" level="project" />
99102
<orderEntry type="library" exported="" name="play-services-gcm-8.1.0" level="project" />
100-
<orderEntry type="library" exported="" name="support-v4-22.2.1" level="project" />
101103
<orderEntry type="library" exported="" name="glide-3.5.2" level="project" />
102-
<orderEntry type="library" exported="" name="gridlayout-v7-22.2.1" level="project" />
103-
<orderEntry type="library" exported="" name="support-annotations-22.2.1" level="project" />
104-
<orderEntry type="library" exported="" name="appcompat-v7-22.2.1" level="project" />
104+
<orderEntry type="library" exported="" name="cardview-v7-23.1.0" level="project" />
105+
<orderEntry type="library" exported="" name="support-v4-23.1.0" level="project" />
106+
<orderEntry type="library" exported="" name="gridlayout-v7-23.1.0" level="project" />
105107
</component>
106108
</module>

app/build.gradle

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 22
4+
compileSdkVersion 23
55
buildToolsVersion "22.0.1"
66

77
defaultConfig {
88
applicationId "softwaremobility.darkgeat.sunshine"
99
minSdkVersion 10
10-
targetSdkVersion 22
10+
targetSdkVersion 23
1111
versionCode 1
1212
versionName "1.0"
1313
}
@@ -21,10 +21,11 @@ android {
2121

2222
dependencies {
2323
compile fileTree(dir: 'libs', include: ['*.jar'])
24-
compile 'com.android.support:appcompat-v7:22.+'
24+
compile 'com.android.support:appcompat-v7:23.1.0'
2525
compile 'com.github.bumptech.glide:glide:3.5.2'
26-
compile 'com.android.support:support-v4:22.0.1'
27-
compile 'com.android.support:support-annotations:22.0.1'
26+
compile 'com.android.support:support-v4:23.1.0'
27+
compile 'com.android.support:support-annotations:23.1.0'
2828
compile 'com.google.android.gms:play-services-gcm:8.1.0'
29-
compile 'com.android.support:gridlayout-v7:22.+'
29+
compile 'com.android.support:gridlayout-v7:23.1.0'
30+
compile 'com.android.support:cardview-v7:23.1.0'
3031
}

app/src/main/java/softwaremobility/darkgeat/sunshine/DetailFragment.java

+11
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import android.support.v4.content.CursorLoader;
1111
import android.support.v4.content.Loader;
1212
import android.support.v4.view.MenuItemCompat;
13+
import android.support.v7.widget.CardView;
1314
import android.support.v7.widget.ShareActionProvider;
1415
import android.util.Log;
1516
import android.view.LayoutInflater;
@@ -18,6 +19,7 @@
1819
import android.view.MenuItem;
1920
import android.view.View;
2021
import android.view.ViewGroup;
22+
import android.view.ViewParent;
2123
import android.widget.ImageView;
2224
import android.widget.TextView;
2325

@@ -144,6 +146,10 @@ public Loader<Cursor> onCreateLoader(int id, Bundle args) {
144146
null
145147
);
146148
}
149+
ViewParent viewParent = getView().getParent();
150+
if(viewParent instanceof CardView){
151+
((View)viewParent).setVisibility(View.INVISIBLE);
152+
}
147153
return null;
148154

149155
}
@@ -153,6 +159,11 @@ public void onLoadFinished(android.support.v4.content.Loader<Cursor> loader, Cur
153159
Log.v(LOG_TAG, "In onLoadFinished");
154160
if (data != null && data.moveToFirst()) {
155161

162+
ViewParent viewParent = getView().getParent();
163+
if(viewParent instanceof CardView){
164+
((View)viewParent).setVisibility(View.VISIBLE);
165+
}
166+
156167
int weatherId = data.getInt(data.getColumnIndex(WeatherContract.WeatherEntry.COLUMN_WEATHER_ID));
157168
Utility.loadImageFromIconPack(weatherId,getActivity(),mIconView);
158169
/*Glide.with(this).load(Utility.getAnimationResourceForWeatherCondition(weatherId))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:layout_height="match_parent"
4+
android:layout_width="match_parent"
5+
xmlns:app="http://schemas.android.com/apk/res-auto">
6+
7+
<android.support.v7.widget.Toolbar
8+
android:layout_width="match_parent"
9+
android:layout_height="wrap_content"
10+
android:layout_alignParentLeft="true"
11+
android:layout_alignParentRight="true"
12+
android:layout_alignParentEnd="true"
13+
android:layout_alignParentStart="true"
14+
android:layout_alignParentTop="true"
15+
android:id="@+id/toolbar"
16+
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
17+
18+
<ImageView
19+
android:layout_width="wrap_content"
20+
android:layout_height="?attr/listPreferredItemHeight"
21+
android:layout_marginTop="?attr/actionBarSize"
22+
android:layout_gravity="center_horizontal"
23+
android:src="@drawable/ic_logo"/>
24+
25+
</android.support.v7.widget.Toolbar>
26+
27+
<fragment
28+
android:id="@+id/IdForecastFragment"
29+
android:layout_width="match_parent"
30+
android:layout_height="match_parent"
31+
android:layout_alignParentTop="true"
32+
android:layout_marginTop="@dimen/normal_padding"
33+
android:name="softwaremobility.darkgeat.sunshine.ForecastFragment"
34+
android:layout_marginLeft="@dimen/triple_vertical_padding"
35+
android:layout_marginStart="@dimen/triple_vertical_padding"
36+
android:layout_marginRight="@dimen/triple_vertical_padding"
37+
android:layout_marginEnd="@dimen/triple_vertical_padding"
38+
tools:layout="@android:layout/list_content"/>
39+
40+
</RelativeLayout>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:layout_width="match_parent"
3+
android:layout_height="match_parent">
4+
5+
<ListView
6+
android:id="@+id/listview_forecast"
7+
android:layout_width="match_parent"
8+
android:layout_height="match_parent"
9+
android:layout_alignParentTop="true"
10+
android:elevation="@dimen/appbar_elevation"
11+
android:background="@android:color/white"
12+
style="@style/ForecastListStyle">
13+
</ListView>
14+
15+
<TextView
16+
android:layout_width="match_parent"
17+
android:layout_height="match_parent"
18+
android:layout_gravity="center"
19+
android:id="@+id/emptyDataResponse"
20+
android:gravity="center"
21+
android:text="@string/no_info"/>
22+
23+
</RelativeLayout>

app/src/main/res/layout-sw600dp-port/activity_main.xml

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
android:background="@color/sunshine_blue"
3333
android:layout_below="@+id/imageLogoView"/>
3434

35-
<FrameLayout
35+
<android.support.v7.widget.CardView
3636
android:layout_width="match_parent"
3737
android:layout_height="wrap_content"
3838
android:id="@+id/detail_container"
@@ -42,7 +42,8 @@
4242
android:layout_marginRight="@dimen/double_vertical_padding"
4343
android:layout_marginEnd="@dimen/double_vertical_padding"
4444
android:minHeight="@dimen/max_height_detail_view"
45-
android:elevation="@dimen/appbar_elevation"/>
45+
app:cardElevation="@dimen/appbar_elevation"
46+
app:cardPreventCornerOverlap="false"/>
4647

4748
<fragment
4849
android:layout_width="match_parent"

app/src/main/res/layout-sw600dp/activity_main.xml

+6-5
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,16 @@
6262
android:name="softwaremobility.darkgeat.sunshine.ForecastFragment"
6363
tools:layout="@android:layout/list_content"/>
6464

65-
<FrameLayout
65+
<android.support.v7.widget.CardView
6666
android:layout_width="0dp"
6767
android:layout_height="match_parent"
6868
android:layout_weight="3"
6969
android:id="@+id/detail_container"
70-
android:elevation="@dimen/appbar_elevation"
71-
android:paddingRight="@dimen/abc_list_item_padding_horizontal_material"
72-
android:paddingEnd="@dimen/abc_list_item_padding_horizontal_material"
73-
android:paddingBottom="@dimen/abc_list_item_padding_horizontal_material"/>
70+
app:cardElevation="@dimen/appbar_elevation"
71+
app:cardPreventCornerOverlap="false"
72+
android:layout_marginRight="@dimen/abc_list_item_padding_horizontal_material"
73+
android:layout_marginEnd="@dimen/abc_list_item_padding_horizontal_material"
74+
android:layout_marginBottom="@dimen/abc_list_item_padding_horizontal_material"/>
7475

7576
</LinearLayout>
7677

app/src/main/res/values/dimens.xml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<dimen name="activity_horizontal_margin">16dp</dimen>
44
<dimen name="activity_vertical_margin">16dp</dimen>
55
<dimen name="double_vertical_padding">32dp</dimen>
6+
<dimen name="triple_vertical_padding">48dp</dimen>
67
<dimen name="normal_padding">10dp</dimen>
78
<dimen name="text_detail">22sp</dimen>
89
<dimen name="max_todays_icon">130dp</dimen>

0 commit comments

Comments
 (0)