Skip to content

Commit 621447a

Browse files
author
Giovani Gonzalez
committed
Merge pull request #18 from giovas17/feature/material_design
feature/material_design
2 parents f24861b + b4347b4 commit 621447a

26 files changed

+684
-247
lines changed

.idea/misc.xml

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

app/app.iml

+10-6
Original file line numberDiff line numberDiff line change
@@ -71,8 +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/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" />
7678
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-base/8.1.0/jars" />
7779
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-basement/8.1.0/jars" />
7880
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-gcm/8.1.0/jars" />
@@ -91,14 +93,16 @@
9193
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
9294
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
9395
</content>
94-
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
96+
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
9597
<orderEntry type="sourceFolder" forTests="false" />
9698
<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" />
97101
<orderEntry type="library" exported="" name="play-services-basement-8.1.0" level="project" />
98102
<orderEntry type="library" exported="" name="play-services-gcm-8.1.0" level="project" />
99-
<orderEntry type="library" exported="" name="support-v4-22.2.1" level="project" />
100103
<orderEntry type="library" exported="" name="glide-3.5.2" level="project" />
101-
<orderEntry type="library" exported="" name="support-annotations-22.2.1" level="project" />
102-
<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" />
103107
</component>
104108
</module>

app/build.gradle

+7-5
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,9 +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:23.1.0'
30+
compile 'com.android.support:cardview-v7:23.1.0'
2931
}

app/src/main/java/softwaremobility/darkgeat/objects/WindSpeedControl.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package softwaremobility.darkgeat.objects;
22

33
import android.annotation.TargetApi;
4+
import android.app.Activity;
45
import android.content.Context;
56
import android.content.res.TypedArray;
67
import android.graphics.Canvas;
@@ -11,6 +12,7 @@
1112
import android.os.Build;
1213
import android.text.TextPaint;
1314
import android.util.AttributeSet;
15+
import android.util.DisplayMetrics;
1416
import android.view.View;
1517

1618
import softwaremobility.darkgeat.sunshine.R;
@@ -88,6 +90,12 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
8890
int wSpecSize = MeasureSpec.getSize(widthMeasureSpec);
8991
int myWidth = wSpecSize;
9092

93+
DisplayMetrics metrics = mContext.getResources().getDisplayMetrics();
94+
if(metrics.densityDpi >= DisplayMetrics.DENSITY_XHIGH){
95+
width = 300;
96+
height = 300;
97+
}
98+
9199
if(hSpecMode == MeasureSpec.EXACTLY){
92100
height = hSpecSize;
93101
}
@@ -99,7 +107,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
99107
myWidth = width;
100108

101109

102-
setMeasuredDimension(myWidth,myHeight);
110+
setMeasuredDimension(myWidth, myHeight);
103111
}
104112

105113
@Override

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

+6-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
import android.support.v4.view.MenuItemCompat;
1212
import android.support.v7.app.ActionBar;
1313
import android.support.v7.app.ActionBarActivity;
14+
import android.support.v7.app.AppCompatActivity;
1415
import android.support.v7.widget.ShareActionProvider;
16+
import android.support.v7.widget.Toolbar;
1517
import android.util.Log;
1618
import android.view.LayoutInflater;
1719
import android.view.Menu;
@@ -26,15 +28,16 @@
2628
/**
2729
* Created by darkgeat on 26/06/15.
2830
*/
29-
public class DetailActivity extends ActionBarActivity {
31+
public class DetailActivity extends AppCompatActivity {
3032

3133
@Override
3234
protected void onCreate(Bundle savedInstanceState) {
3335
super.onCreate(savedInstanceState);
3436
setContentView(R.layout.activity_detail);
3537

36-
ActionBar bar = getSupportActionBar();
37-
bar.setDisplayHomeAsUpEnabled(true);
38+
Toolbar toolbar = (Toolbar)findViewById(R.id.toolbarDetail);
39+
setSupportActionBar(toolbar);
40+
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
3841

3942
if(savedInstanceState == null){
4043
Bundle args = new Bundle();

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))

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ public ForeCastAdapter(Context context, Cursor c, int flags) {
2828

2929
@Override
3030
public int getItemViewType(int position) {
31-
return (position == 0) ? VIEW_TYPE_TODAY : VIEW_TYPE_FUTURE_DAY;
31+
if(!MainActivity.mTwoPane)
32+
return (position == 0) ? VIEW_TYPE_TODAY : VIEW_TYPE_FUTURE_DAY;
33+
else
34+
return VIEW_TYPE_FUTURE_DAY;
3235
}
3336

3437
@Override

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

+8-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
import android.support.v7.app.ActionBarActivity;
1212
import android.os.Bundle;
1313
import android.support.v7.app.AlertDialog;
14+
import android.support.v7.app.AppCompatActivity;
15+
import android.support.v7.widget.Toolbar;
1416
import android.util.Log;
1517
import android.view.Menu;
1618
import android.view.MenuItem;
@@ -25,10 +27,10 @@
2527
import softwaremobility.darkgeat.sunshine.sync.SyncAdapter;
2628

2729

28-
public class MainActivity extends ActionBarActivity implements ForecastFragment.Callback{
30+
public class MainActivity extends AppCompatActivity implements ForecastFragment.Callback{
2931

3032
private String mLocation;
31-
private boolean mTwoPane;
33+
public static boolean mTwoPane;
3234
public static final String DETAILFRAGMENT_TAG = "DetailFragmentTAG";
3335
public static final String LOG_TAG = MainActivity.class.getSimpleName();
3436
public static final String PROPERTY_REG_ID = "registration_id";
@@ -42,6 +44,10 @@ protected void onCreate(Bundle savedInstanceState) {
4244
super.onCreate(savedInstanceState);
4345
setContentView(R.layout.activity_main);
4446

47+
Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar);
48+
setSupportActionBar(toolbar);
49+
getSupportActionBar().setDisplayShowTitleEnabled(false);
50+
4551
SENDER_ID = getString(R.string.projectIdNumber);
4652

4753
if(findViewById(R.id.detail_container) != null){
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>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:layout_width="match_parent"
4+
android:layout_height="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="?attr/actionBarSize"
10+
android:id="@+id/toolbar"
11+
android:layout_alignParentTop="true"
12+
android:elevation="@dimen/appbar_elevation"
13+
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
14+
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
15+
16+
<ImageView
17+
android:layout_width="match_parent"
18+
android:layout_height="?attr/listPreferredItemHeight"
19+
android:layout_below="@+id/toolbar"
20+
android:background="@color/sunshine_blue"
21+
android:scaleType="center"
22+
android:id="@+id/imageLogoView"
23+
android:elevation="@dimen/appbar_elevation"
24+
android:layout_gravity="center_horizontal"
25+
android:src="@drawable/ic_logo"/>
26+
27+
<View
28+
android:id="@+id/layout_center"
29+
android:layout_width="match_parent"
30+
android:elevation="@dimen/appbar_elevation"
31+
android:layout_height="@dimen/double_vertical_padding"
32+
android:background="@color/sunshine_blue"
33+
android:layout_below="@+id/imageLogoView"/>
34+
35+
<android.support.v7.widget.CardView
36+
android:layout_width="match_parent"
37+
android:layout_height="wrap_content"
38+
android:id="@+id/detail_container"
39+
android:layout_below="@id/imageLogoView"
40+
android:layout_marginLeft="@dimen/double_vertical_padding"
41+
android:layout_marginStart="@dimen/double_vertical_padding"
42+
android:layout_marginRight="@dimen/double_vertical_padding"
43+
android:layout_marginEnd="@dimen/double_vertical_padding"
44+
android:minHeight="@dimen/max_height_detail_view"
45+
app:cardElevation="@dimen/appbar_elevation"
46+
app:cardPreventCornerOverlap="false"/>
47+
48+
<fragment
49+
android:layout_width="match_parent"
50+
android:layout_height="match_parent"
51+
android:id="@+id/IdForecastFragment"
52+
android:name="softwaremobility.darkgeat.sunshine.ForecastFragment"
53+
android:layout_below="@id/detail_container"
54+
tools:layout="@android:layout/list_content"/>
55+
56+
</RelativeLayout>

0 commit comments

Comments
 (0)