Skip to content

Commit

Permalink
Merge pull request #84 from CaptainHuangsh/34-do-todo
Browse files Browse the repository at this point in the history
34 do todo
  • Loading branch information
CaptainHuangsh authored Jun 3, 2017
2 parents 98c2d43 + 29c1ac9 commit b341c11
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 16 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ android {
applicationId "com.example.owen.weathergo"
minSdkVersion 15
targetSdkVersion 24
versionCode 8
versionName '1.2.07.3050'
versionCode 10
versionName '1.3.01.3130'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
/*jackOptions {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.example.owen.weathergo.modules.dao;

import android.content.Context;
import android.text.format.DateFormat;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
Expand All @@ -20,6 +21,7 @@ public class DailyWeatherHolder extends BaseViewHolder<Weather> {
private Context mContext;
private LinearLayout dailyWeather;
private ImageView img[] = new ImageView[7];
private ImageView imgN[] = new ImageView[7];
private TextView dayView[] = new TextView[7];
private TextView tempView[] = new TextView[7];
private TextView moreInfoView[] = new TextView[7];
Expand All @@ -34,6 +36,7 @@ public DailyWeatherHolder(View view, Weather weather) {
for (int i = 0; i < weather.getDailyForecast().size(); i++) {
View v = View.inflate(mContext, R.layout.items_weeklyforecast, null);
img[i] = (ImageView) v.findViewById(R.id.forecast_icon);
imgN[i] = (ImageView) v.findViewById(R.id.forecast_icon_n);
dayView[i] = (TextView) v.findViewById(R.id.forecast_date);
tempView[i] = (TextView) v.findViewById(R.id.forecast_temp);
moreInfoView[i] = (TextView) v.findViewById(R.id.forecast_txt);
Expand All @@ -52,12 +55,18 @@ public void bind(Weather weather) {
dayView[i].setText(weather.getDailyForecast().get(i).getDate() + "");
}
img[i].setImageResource(IconGet.getWeaIcon(weather.getDailyForecast().get(i)
.getCond().getTxtD()));//TODO 图标为上午图标,需要改成全天适用
.getCond().getTxtD()));
if (weather.getDailyForecast().get(i).getCond().getTxtD().equals(weather.getDailyForecast().get(i).getCond().getTxtN())) {
imgN[i].setVisibility(View.INVISIBLE);
} else {
imgN[i].setImageResource(IconGet.getWeaIcon(weather.getDailyForecast().get(i)
.getCond().getTxtN()));
}
tempView[i].setText(mContext.getResources().getString(R.string.temp_min)
+ weather.getDailyForecast().get(i).getTmp().getMin()
+ mContext.getResources().getString(R.string.c)
+ mContext.getResources().getString(R.string.temp_max)
+ weather.getDailyForecast().get(i).getTmp().getMin()
+ weather.getDailyForecast().get(i).getTmp().getMax()
+ mContext.getResources().getString(R.string.c));
moreInfoView[i].setText(weather.getDailyForecast().get(i).getWind().getDir() + (weather.getDailyForecast().get(i).getWind().getSc().equals("微风")
? weather.getDailyForecast().get(i).getWind().getSc() : weather.getDailyForecast().get(i).getWind().getSc() + mContext.getResources().getString(R.string.m_s))
Expand All @@ -71,4 +80,5 @@ public void bind(Weather weather) {
e.printStackTrace();
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.os.Handler;
import android.os.Message;
import android.preference.PreferenceManager;
import android.text.format.DateFormat;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
Expand All @@ -30,8 +31,7 @@
*/

public class TodayWeatherHolder extends BaseViewHolder<Weather> {
//TODO 每日首次实时刷新图片的问题
//TODO 字体颜色的问题

private final String TAG = TodayWeatherHolder.class.getSimpleName();
private Context mContext;
private TextView mTemp_min;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {

@Override
public void onStart() {
//TODO onStart中只通过sharedPreference取在service中存储的jsonText
//以节省流量和访问次数(因为每次打开app时用户的位置数据是基本不会改变的)
super.onStart();
String Ccity = SharedPreferenceUtil.getInstance().getCityName();
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/layout/dialog_search_city.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
<!--http://blog.csdn.net/hanjieson/article/details/10045847-->
<EditText
android:id="@+id/city_name"
android:inputType="text"
android:textColor="@color/black"
android:maxLines="1"
android:background="@drawable/bg_edittext"
android:textCursorDrawable="@null"
Expand Down
3 changes: 0 additions & 3 deletions app/src/main/res/layout/forecast_weekly.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/zero"
android:layout_marginRight="@dimen/zero"
android:layout_marginTop="@dimen/card_view_margin_top"
android:elevation="@dimen/card_view_elevation"
card_view:cardCornerRadius="@dimen/card_view_radius"
tools:targetApi="lollipop">

<LinearLayout
Expand Down
10 changes: 9 additions & 1 deletion app/src/main/res/layout/items_weeklyforecast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@
android:id="@+id/forecast_icon"
android:layout_width="@dimen/weekly_image_width"
android:layout_height="@dimen/weekly_image_height"
android:layout_gravity="center_vertical" />
android:layout_gravity="center_vertical"
android:src="@mipmap/icon_weather_sunny" />
<ImageView
android:layout_marginLeft="@dimen/fab_margin"
android:id="@+id/forecast_icon_n"
android:layout_width="@dimen/weekly_image_width"
android:layout_height="@dimen/weekly_image_height"
android:layout_gravity="center_vertical"
android:src="@mipmap/icon_weather_sunny" />

<RelativeLayout
android:layout_width="match_parent"
Expand Down
10 changes: 5 additions & 5 deletions app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
<dimen name="suggestion_image_width">32dp</dimen>
<dimen name="suggestion_image_height">32dp</dimen>
<dimen name="suggestion_text_margin_left">36dp</dimen>
<dimen name="suggestion_text_size">16sp</dimen>
<dimen name="suggestion_text_size">14sp</dimen>
<dimen name="suggestion_text_more_margin_top">2dp</dimen>
<dimen name="suggestion_text_more_size">16sp</dimen>
<dimen name="suggestion_text_more_size">14sp</dimen>

<dimen name="items_hour_text_margin_left">42dp</dimen>
<dimen name="items_hour_text_padding">12dp</dimen>
Expand All @@ -50,9 +50,9 @@
<dimen name="weekly_padding_top">16dp</dimen>
<dimen name="weekly_image_width">32dp</dimen>
<dimen name="weekly_image_height">32dp</dimen>
<dimen name="weekly_more_left">36dp</dimen>
<dimen name="weekly_text_size">16sp</dimen>
<dimen name="weekly_text_temp_size">18sp</dimen>
<dimen name="weekly_more_left">24dp</dimen>
<dimen name="weekly_text_size">14sp</dimen>
<dimen name="weekly_text_temp_size">14sp</dimen>
<dimen name="weekly_text_more_margin_top">4dp</dimen>

<dimen name="about_margin_bottom">32dp</dimen>
Expand Down

0 comments on commit b341c11

Please sign in to comment.