├── .gitignore
├── .idea
├── codeStyles
│ └── Project.xml
├── gradle.xml
├── misc.xml
├── runConfigurations.xml
└── vcs.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── libs
│ └── sdk_HeWeather_Public_Android_V2.0.jar
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── example
│ │ └── a19093
│ │ └── project_endofterm
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── example
│ │ │ └── a19093
│ │ │ └── project_endofterm
│ │ │ ├── Add_city.java
│ │ │ ├── City.java
│ │ │ ├── CityAdapter.java
│ │ │ ├── CityOperator.java
│ │ │ ├── Fragment1.java
│ │ │ ├── Fragment2.java
│ │ │ ├── Fragment3.java
│ │ │ ├── GetData.java
│ │ │ ├── MainActivity.java
│ │ │ ├── MyFragmentPagerAdapter.java
│ │ │ ├── MySQHelper.java
│ │ │ ├── Request
│ │ │ ├── HourlyWeatherForecast.java
│ │ │ ├── LifestyleForecast.java
│ │ │ └── WeeklyWeatherForecast.java
│ │ │ ├── StreamTool.java
│ │ │ └── VariableApp.java
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ ├── ._100.png
│ │ ├── add_city.png
│ │ ├── add_city1.png
│ │ ├── add_city2.png
│ │ ├── air.png
│ │ ├── app_list_corner_round.xml
│ │ ├── back.png
│ │ ├── background.jpg
│ │ ├── bgpic.jpg
│ │ ├── bgpic1.jpg
│ │ ├── bgpic2.jpg
│ │ ├── bgpic3.jpg
│ │ ├── bgpic4.jpg
│ │ ├── comf.png
│ │ ├── cw.png
│ │ ├── desktop.png
│ │ ├── desktop1.png
│ │ ├── diag.xml
│ │ ├── dotted_line.xml
│ │ ├── drsg.png
│ │ ├── flu.png
│ │ ├── ic_launcher_background.xml
│ │ ├── list_circle.xml
│ │ ├── sport.png
│ │ ├── tab_menu_better.xml
│ │ ├── tab_menu_bg.xml
│ │ ├── tab_menu_channel.xml
│ │ ├── tab_menu_message.xml
│ │ ├── tab_menu_setting.xml
│ │ ├── tab_menu_text.xml
│ │ ├── trav.png
│ │ ├── uv.png
│ │ ├── x100.png
│ │ ├── x100n.png
│ │ ├── x101.png
│ │ ├── x102.png
│ │ ├── x103.png
│ │ ├── x103n.png
│ │ ├── x104.png
│ │ ├── x104n.png
│ │ ├── x200.png
│ │ ├── x201.png
│ │ ├── x202.png
│ │ ├── x203.png
│ │ ├── x204.png
│ │ ├── x205.png
│ │ ├── x206.png
│ │ ├── x207.png
│ │ ├── x208.png
│ │ ├── x209.png
│ │ ├── x210.png
│ │ ├── x211.png
│ │ ├── x212.png
│ │ ├── x213.png
│ │ ├── x300.png
│ │ ├── x300n.png
│ │ ├── x301.png
│ │ ├── x301n.png
│ │ ├── x302.png
│ │ ├── x303.png
│ │ ├── x304.png
│ │ ├── x305.png
│ │ ├── x306.png
│ │ ├── x307.png
│ │ ├── x309.png
│ │ ├── x310.png
│ │ ├── x311.png
│ │ ├── x312.png
│ │ ├── x313.png
│ │ ├── x314.png
│ │ ├── x315.png
│ │ ├── x316.png
│ │ ├── x317.png
│ │ ├── x318.png
│ │ ├── x399.png
│ │ ├── x400.png
│ │ ├── x401.png
│ │ ├── x402.png
│ │ ├── x403.png
│ │ ├── x404.png
│ │ ├── x405.png
│ │ ├── x406.png
│ │ ├── x406n.png
│ │ ├── x407.png
│ │ ├── x407n.png
│ │ ├── x408.png
│ │ ├── x409.png
│ │ ├── x410.png
│ │ ├── x499.png
│ │ ├── x500.png
│ │ ├── x501.png
│ │ ├── x502.png
│ │ ├── x503.png
│ │ ├── x504.png
│ │ ├── x507.png
│ │ ├── x508.png
│ │ ├── x509.png
│ │ ├── x510.png
│ │ ├── x511.png
│ │ ├── x512.png
│ │ ├── x513.png
│ │ ├── x514.png
│ │ ├── x515.png
│ │ ├── x900.png
│ │ ├── x901.png
│ │ └── x999.png
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ ├── add_city.xml
│ │ ├── city_item.xml
│ │ ├── fragment1.xml
│ │ ├── fragment2.xml
│ │ ├── fragment3.xml
│ │ └── my_dialog.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ ├── ic_launcher_round.png
│ │ ├── tab_better_normal.png
│ │ ├── tab_better_pressed.png
│ │ ├── tab_channel_normal.png
│ │ ├── tab_channel_pressed.png
│ │ ├── tab_message_normal.png
│ │ ├── tab_message_pressed.png
│ │ ├── tab_my_normal.png
│ │ └── tab_my_pressed.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── array.xml
│ │ ├── colors.xml
│ │ ├── id.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── example
│ └── a19093
│ └── project_endofterm
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches/build_file_checksums.ser
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | .DS_Store
9 | /build
10 | /captures
11 | .externalNativeBuild
12 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Project_EndofTerm
2 | 这是我大三上学期安卓的期末大作业,做的是一个天气预报app
3 |
4 | 天气预报
5 | 一、 课题内容和要求
6 | 1. 从api中正确获取天气信息
7 | 2. 主界面上展示天气信息变化
8 | 3. 可以切换地理位置
9 | 4. 可以预报一周内天气
10 | 二、需求分析
11 | 1. 获取天气信息
12 | 2. 可以切换地理位置
13 | 3. 使用折线图展示温度变化
14 | 4. 可以根据输入提示城市
15 | 5. 记录添加的城市显示在列表,方便城市切换及供下次使用
16 | 6. 添加下拉刷新操作,在刷新失败的时候,给出相关提示。
17 |
18 | 实验相关截图如下:
19 | 
20 | 
21 | 
22 | 
23 | 
24 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 28
5 | defaultConfig {
6 | applicationId "com.example.a19093.project_endofterm"
7 | minSdkVersion 23
8 | targetSdkVersion 28
9 | versionCode 1
10 | versionName "1.0"
11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
12 | }
13 | buildTypes {
14 | release {
15 | true
16 | minifyEnabled
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 |
24 | implementation 'com.github.lecho:hellocharts-library:1.5.8@aar'
25 |
26 | implementation fileTree(include: ['*.jar'], dir: 'libs')
27 | implementation 'com.android.support:appcompat-v7:28.0.0'
28 | implementation 'com.android.support.constraint:constraint-layout:1.1.3'
29 |
30 | //下面两行和风天气独有的
31 | implementation 'com.squareup.okhttp3:okhttp:3.9.0'
32 | implementation 'com.google.code.gson:gson:2.6.2'
33 |
34 | implementation 'com.google.code.gson:gson:2.2.+'
35 |
36 | //用Gson框架技术解析JSON
37 | implementation group: 'com.google.code.gson', name: 'gson', version: '2.8.0'
38 |
39 | implementation 'com.android.support:support-v4:28.0.0'
40 | testImplementation 'junit:junit:4.12'
41 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
42 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
43 | implementation files('libs/sdk_HeWeather_Public_Android_V2.0.jar')
44 | }
45 |
--------------------------------------------------------------------------------
/app/libs/sdk_HeWeather_Public_Android_V2.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/libs/sdk_HeWeather_Public_Android_V2.0.jar
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
23 | #下面两段是和风天气的混淆代码
24 | #排除okhttp
25 | -dontwarn com.squareup.**
26 | -dontwarn okio.**
27 | -keep public class org.codehaus.* { *; }
28 | -keep public class java.nio.* { *; }
29 |
30 | #排除HeWeather
31 | -dontwarn interfaces.heweather.com.interfacesmodule.**
32 | -keep class interfaces.heweather.com.interfacesmodule.** { *;}
33 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/example/a19093/project_endofterm/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.example.a19093.project_endofterm;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumented test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.example.a19093.project_endofterm", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/a19093/project_endofterm/Add_city.java:
--------------------------------------------------------------------------------
1 | package com.example.a19093.project_endofterm;
2 |
3 | import android.content.Intent;
4 | import android.content.res.Resources;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.os.Bundle;
7 | import android.view.View;
8 | import android.widget.ArrayAdapter;
9 | import android.widget.AutoCompleteTextView;
10 | import android.widget.Button;
11 |
12 | public class Add_city extends AppCompatActivity implements View.OnClickListener{
13 | private Button btn_add;
14 | private Button btn_back;
15 | private AutoCompleteTextView autoCompleteTextView;
16 |
17 | @Override
18 | protected void onCreate(Bundle savedInstanceState) {
19 | super.onCreate(savedInstanceState);
20 | setContentView(R.layout.add_city);
21 | bindView();
22 | }
23 |
24 | private void bindView(){
25 | this.autoCompleteTextView = this.findViewById(R.id.autoCompleteTextView);
26 | Resources resources = this.getResources();
27 | String[] country = resources.getStringArray(R.array.city_array);
28 | ArrayAdapter adapter = new ArrayAdapter(this,
29 | android.R.layout.simple_list_item_activated_1,
30 | country
31 | );
32 | this.autoCompleteTextView.setAdapter(adapter);
33 | this.autoCompleteTextView.setOnClickListener(this);
34 | autoCompleteTextView = findViewById(R.id.autoCompleteTextView);
35 | btn_add = findViewById(R.id.btn_add);
36 | btn_add.setOnClickListener(this);
37 | btn_back = findViewById(R.id.btn_back);
38 | btn_back.setOnClickListener(this);
39 | }
40 |
41 | @Override
42 | public void onClick(View v) {
43 | switch (v.getId()){
44 | case R.id.btn_add:
45 | Intent intent = new Intent();
46 | String string_city = autoCompleteTextView.getText().toString();
47 | intent.putExtra("cityName",string_city);
48 | setResult(1,intent);
49 | finish();
50 | break;
51 | case R.id.btn_back:
52 | finish();
53 | break;
54 | default:
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/a19093/project_endofterm/City.java:
--------------------------------------------------------------------------------
1 | package com.example.a19093.project_endofterm;
2 |
3 | public class City {
4 | private String name;
5 | private String isSelect;
6 | City(){
7 | }
8 |
9 | City(String name){
10 | this.name = name;
11 | this.isSelect= "否";
12 | }
13 |
14 | City(String name, String isSelect){
15 | this.name = name;
16 | this.isSelect= isSelect;
17 | }
18 |
19 | public String getName() {
20 | return name;
21 | }
22 |
23 | public String getIsSelect() {
24 | return isSelect;
25 | }
26 |
27 | public void setName(String name){
28 | this.name = name;
29 | }
30 |
31 | public void setIsSelect(String isSelect){
32 | this.isSelect = isSelect;
33 | }
34 |
35 | public String toString2(){
36 | String[] s;
37 | s = name.split(" ");
38 | return s[0] + "," + s[1];
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/a19093/project_endofterm/CityAdapter.java:
--------------------------------------------------------------------------------
1 | package com.example.a19093.project_endofterm;
2 |
3 |
4 | import android.util.Log;
5 | import android.view.ContextThemeWrapper;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.BaseAdapter;
10 | import android.widget.ImageView;
11 | import android.widget.TextView;
12 | import android.content.Context;
13 | import android.widget.Toast;
14 |
15 | import java.util.List;
16 |
17 | public class CityAdapter extends BaseAdapter{
18 | private Context context;
19 | private List listCity;
20 | private CityOperator cityOperator;
21 |
22 | public CityAdapter(List listCity, Context context){
23 | this.listCity = listCity;
24 | this.cityOperator = new CityOperator(context);
25 | }
26 |
27 | @Override
28 | public View getView(final int position, View view, ViewGroup viewGroup){
29 | ViewHolder viewHolder = null;
30 | if(context == null){
31 | context = viewGroup.getContext();
32 | }
33 | if(view == null){
34 | view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.city_item,null);
35 | viewHolder = new ViewHolder();
36 | viewHolder.cityName = view.findViewById(R.id.cityName);
37 | viewHolder.cityDelete = view.findViewById(R.id.cityDelete);
38 | viewHolder.citySet = view.findViewById(R.id.citySet);
39 | view.setTag(viewHolder);
40 | }
41 | viewHolder = (ViewHolder)view.getTag();
42 | viewHolder.cityName.setText(listCity.get(position).getName());
43 | if(listCity.get(position).getIsSelect().equals("是")){
44 | viewHolder.citySet.setText("当前位置");
45 | viewHolder.cityDelete.setText("");
46 | }
47 | else if(listCity.get(position).getIsSelect().equals("否")){
48 | viewHolder.citySet.setText("设为当前位置");
49 | viewHolder.citySet.setOnClickListener(new View.OnClickListener() {
50 | @Override
51 | public void onClick(View v) {
52 | City city1 = cityOperator.getIsSelectCity();
53 | cityOperator.update(city1);
54 | City city2 = new City(listCity.get(position).getName(), "否");
55 | cityOperator.update(city2);
56 | listCity = cityOperator.getItemCity();
57 | notifyDataSetChanged();
58 | }
59 | });
60 | viewHolder.cityDelete.setText("点击删除");
61 | viewHolder.cityDelete.setOnClickListener(new View.OnClickListener() {
62 | @Override
63 | public void onClick(View v) {
64 | cityOperator = new CityOperator(context);
65 | cityOperator.delete(listCity.get(position).getName());
66 | listCity = cityOperator.getItemCity();
67 | notifyDataSetChanged();
68 | }
69 | });
70 | }
71 | return view;
72 | }
73 |
74 | @Override
75 | public int getCount(){
76 | return listCity.size();
77 | }
78 |
79 | @Override
80 | public Object getItem(int i){
81 | return listCity.get(i);
82 | }
83 |
84 | @Override
85 | public long getItemId(int i){
86 | return i;
87 | }
88 |
89 | private class ViewHolder{
90 | TextView cityName;
91 | TextView cityDelete;
92 | TextView citySet;
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/a19093/project_endofterm/CityOperator.java:
--------------------------------------------------------------------------------
1 | package com.example.a19093.project_endofterm;
2 |
3 | import android.database.ContentObservable;
4 | import android.database.Cursor;
5 | import android.database.sqlite.SQLiteDatabase;
6 | import android.content.Context;
7 | import android.util.Log;
8 | import android.content.ContentValues;
9 |
10 | import java.util.ArrayList;
11 | import java.util.List;
12 |
13 | public class CityOperator {
14 | private MySQHelper dbHelper;
15 | private SQLiteDatabase db;
16 |
17 | public CityOperator(Context context) {
18 | dbHelper = new MySQHelper(context, "CitySQ", null, 1);
19 | db = dbHelper.getWritableDatabase();
20 | }
21 |
22 | public void add(City city) {
23 | try{
24 | ContentValues cValue = new ContentValues();
25 | cValue.put("name",city.getName());
26 | cValue.put("isSelect",city.getIsSelect());
27 | db.insert("CitySQ",null, cValue);
28 | }catch (Exception e){
29 | e.printStackTrace();
30 | }
31 | }
32 |
33 | public void update(City city) {
34 | try {
35 | ContentValues cValue = new ContentValues();
36 | if (city.getIsSelect().equals("否")) {
37 | cValue.put("isSelect", "是");
38 | } else {
39 | cValue.put("isSelect", "否");
40 | }
41 | String whereClause = "name=?";
42 | String[] whereArgs = {city.getName()};
43 | db.update("CitySQ", cValue, whereClause, whereArgs);
44 | }catch (Exception e){
45 | e.printStackTrace();
46 | }
47 | }
48 |
49 | public void delete(String name) {
50 | try{
51 | db.execSQL("delete from CitySQ where name=?", new String[] { name });
52 | }catch(Exception e){
53 | e.printStackTrace();
54 | }
55 | }
56 |
57 | public List getItemCity() {
58 | ArrayList citys = new ArrayList();
59 | Cursor c = db.rawQuery("select * from CitySQ order by isSelect desc", null);
60 | while (c.moveToNext()) {
61 | City city = new City();
62 | city.setName(c.getString(0));
63 | city.setIsSelect(c.getString(1));
64 | citys.add(city);
65 | }
66 | c.close();
67 | return citys;
68 | }
69 |
70 | public City getIsSelectCity() {
71 | Cursor c = db.rawQuery("select * from CitySQ", null);
72 | City city = null;
73 | String s1 = "",s2 = "";
74 | while (c.moveToNext()) {
75 | s1 = c.getString(0);
76 | s2 = c.getString(1);
77 | if(s2.equals("是")){
78 | break;
79 | }
80 | }
81 | if(s2.equals("是")){
82 | city = new City(s1,"是");
83 | }
84 | c.close();
85 | if(city == null){
86 | city = new City("泾川 平凉 甘肃");
87 | city.setIsSelect("是");
88 | add(city);
89 | }
90 | return city;
91 | }
92 |
93 | public int getIsExist(String name){
94 | Cursor c = db.rawQuery("select * from CitySQ", null);
95 | String s1,s2;
96 | while (c.moveToNext()) {
97 | City city = new City();
98 | s1 = c.getString(0);
99 | s2 = c.getString(1);
100 | if(s1.equals(name)){
101 | c.close();
102 | return 1;
103 | }
104 | }
105 | c.close();
106 | return 0;
107 | }
108 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/a19093/project_endofterm/Fragment1.java:
--------------------------------------------------------------------------------
1 | package com.example.a19093.project_endofterm;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.content.Context;
5 | import android.graphics.Color;
6 | import android.os.Handler;
7 | import android.support.v4.app.Fragment;
8 | import android.os.Bundle;
9 | import android.util.Log;
10 | import android.view.LayoutInflater;
11 | import android.view.View;
12 | import android.view.ViewGroup;
13 | import android.widget.ImageView;
14 | import android.widget.TextView;
15 | import com.example.a19093.project_endofterm.Request.WeeklyWeatherForecast;
16 | import com.google.gson.Gson;
17 | import java.text.ParseException;
18 | import java.text.SimpleDateFormat;
19 | import java.util.ArrayList;
20 | import java.util.Date;
21 | import java.util.List;
22 | import java.util.Objects;
23 |
24 | import interfaces.heweather.com.interfacesmodule.bean.Lang;
25 | import interfaces.heweather.com.interfacesmodule.bean.Unit;
26 | import interfaces.heweather.com.interfacesmodule.view.HeWeather;
27 | import lecho.lib.hellocharts.model.Line;
28 | import lecho.lib.hellocharts.model.LineChartData;
29 | import lecho.lib.hellocharts.model.PointValue;
30 | import lecho.lib.hellocharts.view.LineChartView;
31 |
32 | public class Fragment1 extends Fragment{
33 | private View view;
34 | private TextView day0, day1,day2,day3,day4,day5,day6;
35 | private TextView date0, date1,date2,date3,date4,date5,date6;
36 | private ImageView img_d0, img_d1,img_d2,img_d3,img_d4,img_d5,img_d6;
37 | private TextView cond_txt_d0, cond_txt_d1,cond_txt_d2,cond_txt_d3,cond_txt_d4,cond_txt_d5,cond_txt_d6;
38 | private ImageView img_n0, img_n1,img_n2,img_n3,img_n4,img_n5,img_n6;
39 | private TextView cond_txt_n0, cond_txt_n1,cond_txt_n2,cond_txt_n3,cond_txt_n4,cond_txt_n5,cond_txt_n6;
40 | private TextView wind_dir0, wind_dir1,wind_dir2,wind_dir3,wind_dir4,wind_dir5,wind_dir6;
41 | private TextView tmp_max0, tmp_max1,tmp_max2,tmp_max3,tmp_max4,tmp_max5,tmp_max6;
42 | private TextView tmp_min0, tmp_min1,tmp_min2,tmp_min3,tmp_min4,tmp_min5,tmp_min6;
43 | private TextView wind_sc0, wind_sc1,wind_sc2,wind_sc3,wind_sc4,wind_sc5,wind_sc6;
44 | private WeeklyWeatherForecast weeklyWeatherForecast;
45 | private volatile String string_weather_forcast;
46 | private TextView tv_updata;
47 | private float[] y1;
48 | private float[] y2;
49 | private float[] x;
50 | private List value1;
51 | private List value2;
52 | String string_city;
53 |
54 | @SuppressLint("HandlerLeak")
55 | private Handler handler = new Handler() {
56 | public void handleMessage(android.os.Message msg) {
57 | switch (msg.what) {
58 | case 0x001:
59 | parseData();
60 | break;
61 | default:
62 | break;
63 | }
64 | };
65 | };
66 |
67 | public Fragment1() { }
68 |
69 | @Override
70 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
71 | view = inflater.inflate(R.layout.fragment1, container, false);
72 | bindView();
73 | getData();
74 | return view;
75 | }
76 |
77 | private void bindView(){
78 | tv_updata = view.findViewById(R.id.tv_update);
79 | day0 = view.findViewById(R.id.day0);
80 | day1 = view.findViewById(R.id.day1);
81 | day2 = view.findViewById(R.id.day2);
82 | day3 = view.findViewById(R.id.day3);
83 | day4 = view.findViewById(R.id.day4);
84 | day5 = view.findViewById(R.id.day5);
85 | day6 = view.findViewById(R.id.day6);
86 | date0 = view.findViewById(R.id.date0);
87 | date1 = view.findViewById(R.id.date1);
88 | date2 = view.findViewById(R.id.date2);
89 | date3 = view.findViewById(R.id.date3);
90 | date4 = view.findViewById(R.id.date4);
91 | date5 = view.findViewById(R.id.date5);
92 | date6 = view.findViewById(R.id.date6);
93 | img_d0 = view.findViewById(R.id.img_d0);
94 | img_d1 = view.findViewById(R.id.img_d1);
95 | img_d2 = view.findViewById(R.id.img_d2);
96 | img_d3 = view.findViewById(R.id.img_d3);
97 | img_d4 = view.findViewById(R.id.img_d4);
98 | img_d5 = view.findViewById(R.id.img_d5);
99 | img_d6 = view.findViewById(R.id.img_d6);
100 | cond_txt_d0 = view.findViewById(R.id.cond_txt_d0);
101 | cond_txt_d1 = view.findViewById(R.id.cond_txt_d1);
102 | cond_txt_d2 = view.findViewById(R.id.cond_txt_d2);
103 | cond_txt_d3 = view.findViewById(R.id.cond_txt_d3);
104 | cond_txt_d4 = view.findViewById(R.id.cond_txt_d4);
105 | cond_txt_d5 = view.findViewById(R.id.cond_txt_d5);
106 | cond_txt_d6 = view.findViewById(R.id.cond_txt_d6);
107 | img_n0 = view.findViewById(R.id.img_n0);
108 | img_n1 = view.findViewById(R.id.img_n1);
109 | img_n2 = view.findViewById(R.id.img_n2);
110 | img_n3 = view.findViewById(R.id.img_n3);
111 | img_n4 = view.findViewById(R.id.img_n4);
112 | img_n5 = view.findViewById(R.id.img_n5);
113 | img_n6 = view.findViewById(R.id.img_n6);
114 | cond_txt_n0 = view.findViewById(R.id.cond_txt_n0);
115 | cond_txt_n1 = view.findViewById(R.id.cond_txt_n1);
116 | cond_txt_n2 = view.findViewById(R.id.cond_txt_n2);
117 | cond_txt_n3 = view.findViewById(R.id.cond_txt_n3);
118 | cond_txt_n4 = view.findViewById(R.id.cond_txt_n4);
119 | cond_txt_n5 = view.findViewById(R.id.cond_txt_n5);
120 | cond_txt_n6 = view.findViewById(R.id.cond_txt_n6);
121 | wind_dir0 = view.findViewById(R.id.wind_dir0);
122 | wind_dir1 = view.findViewById(R.id.wind_dir1);
123 | wind_dir2 = view.findViewById(R.id.wind_dir2);
124 | wind_dir3 = view.findViewById(R.id.wind_dir3);
125 | wind_dir4 = view.findViewById(R.id.wind_dir4);
126 | wind_dir5 = view.findViewById(R.id.wind_dir5);
127 | wind_dir6 = view.findViewById(R.id.wind_dir6);
128 | wind_sc0 = view.findViewById(R.id.wind_sc0);
129 | wind_sc1 = view.findViewById(R.id.wind_sc1);
130 | wind_sc2 = view.findViewById(R.id.wind_sc2);
131 | wind_sc3 = view.findViewById(R.id.wind_sc3);
132 | wind_sc4 = view.findViewById(R.id.wind_sc4);
133 | wind_sc5 = view.findViewById(R.id.wind_sc5);
134 | wind_sc6 = view.findViewById(R.id.wind_sc6);
135 | tmp_max0 = view.findViewById(R.id.tmp_max0);
136 | tmp_max1 = view.findViewById(R.id.tmp_max1);
137 | tmp_max2 = view.findViewById(R.id.tmp_max2);
138 | tmp_max3 = view.findViewById(R.id.tmp_max3);
139 | tmp_max4 = view.findViewById(R.id.tmp_max4);
140 | tmp_max5 = view.findViewById(R.id.tmp_max5);
141 | tmp_max6 = view.findViewById(R.id.tmp_max6);
142 | tmp_min0 = view.findViewById(R.id.tmp_min0);
143 | tmp_min1 = view.findViewById(R.id.tmp_min1);
144 | tmp_min2 = view.findViewById(R.id.tmp_min2);
145 | tmp_min3 = view.findViewById(R.id.tmp_min3);
146 | tmp_min4 = view.findViewById(R.id.tmp_min4);
147 | tmp_min5 = view.findViewById(R.id.tmp_min5);
148 | tmp_min6 = view.findViewById(R.id.tmp_min6);
149 | }
150 |
151 | private void draw(){
152 | try {
153 | SimpleDateFormat sd1 = new SimpleDateFormat("yyyy-MM-dd HH:mm");
154 | SimpleDateFormat sd2 = new SimpleDateFormat("HH:mm");
155 | Date upd = sd1.parse(weeklyWeatherForecast.getHeWeather6().get(0).getUpdate().getLoc());
156 | tv_updata.setText(sd2.format(upd)+" 发布");
157 |
158 | SimpleDateFormat std1 = new SimpleDateFormat("yyyy-MM-dd");
159 | SimpleDateFormat std2 = new SimpleDateFormat("EEEE");
160 | SimpleDateFormat std3 = new SimpleDateFormat("MM/dd");
161 | Date d;
162 | String string_date0 = weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(0).getDate();
163 | d = std1.parse(string_date0);
164 | date0.setText(std3.format(d));
165 | day0.setText("今天");
166 | String string_date1 = weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(1).getDate();
167 | d = std1.parse(string_date1);
168 | date1.setText(std3.format(d));
169 | day1.setText("明天");
170 | String string_date2 = weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(2).getDate();
171 | d = std1.parse(string_date2);
172 | date2.setText(std3.format(d));
173 | day2.setText("后天");
174 | String string_date3 = weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(3).getDate();
175 | d = std1.parse(string_date3);
176 | date3.setText(std3.format(d));
177 | day3.setText(std2.format(d));
178 | String string_date4 = weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(4).getDate();
179 | d = std1.parse(string_date4);
180 | date4.setText(std3.format(d));
181 | day4.setText(std2.format(d));
182 | String string_date5 = weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(5).getDate();
183 | d = std1.parse(string_date5);
184 | date5.setText(std3.format(d));
185 | day5.setText(std2.format(d));
186 | String string_date6 = weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(6).getDate();
187 | d = std1.parse(string_date6);
188 | date6.setText(std3.format(d));
189 | day6.setText(std2.format(d));
190 | } catch (ParseException e) {
191 | e.printStackTrace();
192 | }
193 |
194 | setImgView(img_d0,0,0);
195 | setImgView(img_d1,1,0);
196 | setImgView(img_d2,2,0);
197 | setImgView(img_d3,3,0);
198 | setImgView(img_d4,4,0);
199 | setImgView(img_d5,5,0);
200 | setImgView(img_d6,6,0);
201 |
202 |
203 | setImgView(img_n0,0,1);
204 | setImgView(img_n1,1,1);
205 | setImgView(img_n2,2,1);
206 | setImgView(img_n3,3,1);
207 | setImgView(img_n4,4,1);
208 | setImgView(img_n5,5,1);
209 | setImgView(img_n6,6,1);
210 |
211 |
212 | cond_txt_d0.setText(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(0).getCond_txt_d());
213 | cond_txt_d1.setText(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(1).getCond_txt_d());
214 | cond_txt_d2.setText(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(2).getCond_txt_d());
215 | cond_txt_d3.setText(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(3).getCond_txt_d());
216 | cond_txt_d4.setText(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(4).getCond_txt_d());
217 | cond_txt_d5.setText(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(5).getCond_txt_d());
218 | cond_txt_d6.setText(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(6).getCond_txt_d());
219 |
220 | cond_txt_n0.setText(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(0).getCond_txt_n());
221 | cond_txt_n1.setText(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(1).getCond_txt_n());
222 | cond_txt_n2.setText(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(2).getCond_txt_n());
223 | cond_txt_n3.setText(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(3).getCond_txt_n());
224 | cond_txt_n4.setText(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(4).getCond_txt_n());
225 | cond_txt_n5.setText(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(5).getCond_txt_n());
226 | cond_txt_n6.setText(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(6).getCond_txt_n());
227 |
228 | wind_dir0.setText(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(0).getWind_dir());
229 | wind_dir1.setText(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(1).getWind_dir());
230 | wind_dir2.setText(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(2).getWind_dir());
231 | wind_dir3.setText(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(3).getWind_dir());
232 | wind_dir4.setText(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(4).getWind_dir());
233 | wind_dir5.setText(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(5).getWind_dir());
234 | wind_dir6.setText(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(6).getWind_dir());
235 |
236 | wind_sc0.setText(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(0).getWind_sc()+"级");
237 | wind_sc1.setText(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(1).getWind_sc()+"级");
238 | wind_sc2.setText(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(2).getWind_sc()+"级");
239 | wind_sc3.setText(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(3).getWind_sc()+"级");
240 | wind_sc4.setText(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(4).getWind_sc()+"级");
241 | wind_sc5.setText(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(5).getWind_sc()+"级");
242 | wind_sc6.setText(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(6).getWind_sc()+"级");
243 | y1 = new float[7];
244 | y2 = new float[7];
245 | x = new float [7];
246 | for(int i = 0; i < 7; i ++) x[i] = (float)i;
247 | y1[0] = Integer.parseInt(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(0).getTmp_max());
248 | y1[1] = Integer.parseInt(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(1).getTmp_max());
249 | y1[2] = Integer.parseInt(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(2).getTmp_max());
250 | y1[3] = Integer.parseInt(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(3).getTmp_max());
251 | y1[4] = Integer.parseInt(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(4).getTmp_max());
252 | y1[5] = Integer.parseInt(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(5).getTmp_max());
253 | y1[6] = Integer.parseInt(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(6).getTmp_max());
254 |
255 | y2[0] = Integer.parseInt(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(0).getTmp_min());
256 | y2[1] = Integer.parseInt(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(1).getTmp_min());
257 | y2[2] = Integer.parseInt(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(2).getTmp_min());
258 | y2[3] = Integer.parseInt(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(3).getTmp_min());
259 | y2[4] = Integer.parseInt(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(4).getTmp_min());
260 | y2[5] = Integer.parseInt(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(5).getTmp_min());
261 | y2[6] = Integer.parseInt(weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(6).getTmp_min());
262 |
263 | String degree = "℃";
264 | tmp_max0.setText((int)y1[0]+degree);
265 | tmp_max1.setText((int)y1[1]+degree);
266 | tmp_max2.setText((int)y1[2]+degree);
267 | tmp_max3.setText((int)y1[3]+degree);
268 | tmp_max4.setText((int)y1[4]+degree);
269 | tmp_max5.setText((int)y1[5]+degree);
270 | tmp_max6.setText((int)y1[6]+degree);
271 |
272 | tmp_min0.setText((int)y2[0]+degree);
273 | tmp_min1.setText((int)y2[1]+degree);
274 | tmp_min2.setText((int)y2[2]+degree);
275 | tmp_min3.setText((int)y2[3]+degree);
276 | tmp_min4.setText((int)y2[4]+degree);
277 | tmp_min5.setText((int)y2[5]+degree);
278 | tmp_min6.setText((int)y2[6]+degree);
279 |
280 | value1 = new ArrayList<>();
281 | value2 = new ArrayList<>();
282 | for(int i = 0; i < 7; i ++){
283 | value1.add(new PointValue(x[i],y1[i]));
284 | value2.add(new PointValue(x[i],y2[i]));
285 | }
286 | List lines = new ArrayList<>();
287 | LineChartView chart = view.findViewById(R.id.chart);
288 | Line line1 = new Line(value1).setColor(Color.YELLOW);
289 | line1.setHasLines(true);
290 | line1.setHasPoints(true);
291 | line1.setHasLabels(false);
292 | Line line2 = new Line(value2).setColor(Color.BLUE);
293 | line2.setHasLines(true);
294 | line2.setHasPoints(true);
295 | line2.setHasLabels(false);
296 | line1.setPointColor(Color.WHITE);
297 | line2.setPointColor(Color.WHITE);
298 | line1.setPointRadius(4);
299 | line2.setPointRadius(4);
300 | lines.add(line1);
301 | lines.add(line2);
302 | line1.setStrokeWidth(2);
303 | line2.setStrokeWidth(2);
304 | line1.setCubic(false);
305 | line2.setCubic(false);
306 | LineChartData data = new LineChartData(lines);
307 | data.setValueLabelBackgroundEnabled(false);
308 | data.setValueLabelsTextColor(R.color.text_yellow);
309 | data.setBaseValue(Float.NEGATIVE_INFINITY);
310 | data.setValueLabelsTextColor(Color.WHITE);
311 | data.setValueLabelTextSize(15);
312 | chart.setLineChartData(data);
313 | chart.setInteractive(false);
314 | }
315 |
316 | private void getData(){
317 | new Thread() {
318 | public void run() {
319 | try {
320 | CityOperator cityOperator = new CityOperator(getContext());
321 | string_city = cityOperator.getIsSelectCity().toString2();
322 | string_weather_forcast = GetData.getJson("https://free-api.heweather.com/s6/weather/forecast?location="
323 | + string_city
324 | + "&key=2d7b37b322a04de1ab17fca5f2e0f0ea");
325 | } catch (Exception e) {
326 | e.printStackTrace();
327 | }
328 | handler.sendEmptyMessage(0x001);
329 | }
330 | }.start();
331 | }
332 |
333 | @Override
334 | public void setUserVisibleHint(boolean isVisibleToUser) {
335 | super.setUserVisibleHint(isVisibleToUser);
336 | if (isVisibleToUser){
337 | getData();
338 | }
339 | }
340 |
341 | private void parseData(){
342 | Gson gson = new Gson();
343 | weeklyWeatherForecast = gson.fromJson(string_weather_forcast,WeeklyWeatherForecast.class);
344 | if(weeklyWeatherForecast != null)
345 | draw();
346 | }
347 | public int getResource(String imageName){
348 | Context ctx=Objects.requireNonNull(getActivity()).getBaseContext();
349 | return getResources().getIdentifier(imageName, "drawable", ctx.getPackageName());
350 | }
351 | private void setImgView(ImageView ig,int i, int flag){
352 | if(flag == 0){
353 | String img1 = "x" + weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(i).getCond_code_d();
354 | ig.setImageResource(getResource(img1));
355 | }
356 | else{
357 | String img1 = "x" + weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(i).getCond_code_n() + "n";
358 | String img2 = "x" + weeklyWeatherForecast.getHeWeather6().get(0).getDaily_forecast().get(i).getCond_code_n();
359 | if(getResource(img1) == 0){
360 | ig.setImageResource(getResource(img2));
361 | }
362 | else{
363 | ig.setImageResource(getResource(img1));
364 | }
365 | }
366 |
367 | }
368 | }
369 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/a19093/project_endofterm/Fragment2.java:
--------------------------------------------------------------------------------
1 | package com.example.a19093.project_endofterm;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.os.Bundle;
5 | import android.os.Handler;
6 | import android.support.annotation.NonNull;
7 | import android.support.v4.app.Fragment;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 | import android.widget.TextView;
12 | import com.example.a19093.project_endofterm.Request.HourlyWeatherForecast;
13 | import com.example.a19093.project_endofterm.Request.LifestyleForecast;
14 | import com.google.gson.Gson;
15 | import java.text.ParseException;
16 | import java.text.SimpleDateFormat;
17 | import java.util.Date;
18 |
19 |
20 | public class Fragment2 extends Fragment {
21 |
22 | private TextView time0,time1,time2,time3,time4,time5,time6,time7;
23 | private TextView tmp0,tmp1,tmp2,tmp3,tmp4,tmp5,tmp6,tmp7;
24 | private TextView cond_txt0,cond_txt1,cond_txt2,cond_txt3,cond_txt4,cond_txt5,cond_txt6,cond_txt7;
25 | private TextView wind_dir0,wind_dir1,wind_dir2,wind_dir3,wind_dir4,wind_dir5,wind_dir6,wind_dir7;
26 | private TextView wind_sc0,wind_sc1,wind_sc2,wind_sc3,wind_sc4,wind_sc5,wind_sc6,wind_sc7;
27 | private TextView comf_type,comf_txt;
28 | private TextView drsg_type,drsg_txt;
29 | private TextView flu_type,flu_txt;
30 | private TextView sport_type,sport_txt;
31 | private TextView trav_type,trav_txt;
32 | private TextView uv_type,uv_txt;
33 | private TextView cw_type,cw_txt;
34 | private TextView air_type,air_txt;
35 | private TextView tv_update;
36 |
37 | private HourlyWeatherForecast hourlyWeatherForecast;
38 | private LifestyleForecast lifestyleForecast;
39 | private volatile String string_hourly_weather_forcast;
40 | private volatile String string_Lifestyle_forcast;
41 | String string_city;
42 | View view;
43 |
44 | @SuppressLint("HandlerLeak")
45 | private Handler handler = new Handler() {
46 | public void handleMessage(android.os.Message msg) {
47 | switch (msg.what) {
48 | case 0x001:
49 | parseData();
50 | break;
51 | default:
52 | break;
53 | }
54 | };
55 | };
56 |
57 |
58 | public Fragment2() { }
59 |
60 | @Override
61 | public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
62 | view = inflater.inflate(R.layout.fragment2, container, false);
63 | bindView();
64 | getData();
65 | return view;
66 | }
67 |
68 | @Override
69 | public void setUserVisibleHint(boolean isVisibleToUser) {
70 | super.setUserVisibleHint(isVisibleToUser);
71 | if (isVisibleToUser){
72 | getData();
73 | }
74 | }
75 |
76 | void bindView(){
77 | tv_update = view.findViewById(R.id.tv_update);
78 | time0 = view.findViewById(R.id.time0);
79 | time1 = view.findViewById(R.id.time1);
80 | time2 = view.findViewById(R.id.time2);
81 | time3 = view.findViewById(R.id.time3);
82 | time4 = view.findViewById(R.id.time4);
83 | time5 = view.findViewById(R.id.time5);
84 | time6 = view.findViewById(R.id.time6);
85 | time7 = view.findViewById(R.id.time7);
86 |
87 | tmp0 = view.findViewById(R.id.tmp0);
88 | tmp1 = view.findViewById(R.id.tmp1);
89 | tmp2 = view.findViewById(R.id.tmp2);
90 | tmp3 = view.findViewById(R.id.tmp3);
91 | tmp4 = view.findViewById(R.id.tmp4);
92 | tmp5 = view.findViewById(R.id.tmp5);
93 | tmp6 = view.findViewById(R.id.tmp6);
94 | tmp7 = view.findViewById(R.id.tmp7);
95 |
96 | cond_txt0 = view.findViewById(R.id.cond_txt0);
97 | cond_txt1 = view.findViewById(R.id.cond_txt1);
98 | cond_txt2 = view.findViewById(R.id.cond_txt2);
99 | cond_txt3 = view.findViewById(R.id.cond_txt3);
100 | cond_txt4 = view.findViewById(R.id.cond_txt4);
101 | cond_txt5 = view.findViewById(R.id.cond_txt5);
102 | cond_txt6 = view.findViewById(R.id.cond_txt6);
103 | cond_txt7 = view.findViewById(R.id.cond_txt7);
104 |
105 | wind_dir0 = view.findViewById(R.id.wind_dir0);
106 | wind_dir1 = view.findViewById(R.id.wind_dir1);
107 | wind_dir2 = view.findViewById(R.id.wind_dir2);
108 | wind_dir3 = view.findViewById(R.id.wind_dir3);
109 | wind_dir4 = view.findViewById(R.id.wind_dir4);
110 | wind_dir5 = view.findViewById(R.id.wind_dir5);
111 | wind_dir6 = view.findViewById(R.id.wind_dir6);
112 | wind_dir7 = view.findViewById(R.id.wind_dir7);
113 |
114 | wind_sc0 = view.findViewById(R.id.wind_sc0);
115 | wind_sc1 = view.findViewById(R.id.wind_sc1);
116 | wind_sc2 = view.findViewById(R.id.wind_sc2);
117 | wind_sc3 = view.findViewById(R.id.wind_sc3);
118 | wind_sc4 = view.findViewById(R.id.wind_sc4);
119 | wind_sc5 = view.findViewById(R.id.wind_sc5);
120 | wind_sc6 = view.findViewById(R.id.wind_sc6);
121 | wind_sc7 = view.findViewById(R.id.wind_sc7);
122 |
123 | comf_type = view.findViewById(R.id.comf_type);
124 | comf_txt = view.findViewById(R.id.comf_txt);
125 | drsg_type = view.findViewById(R.id.drsg_type);
126 | drsg_txt = view.findViewById(R.id.drsg_txt);
127 | flu_type = view.findViewById(R.id.flu_type);
128 | flu_txt = view.findViewById(R.id.flu_txt);
129 | sport_type = view.findViewById(R.id.sport_type);
130 | sport_txt = view.findViewById(R.id.sport_txt);
131 | trav_type = view.findViewById(R.id.trav_type);
132 | trav_txt = view.findViewById(R.id.trav_txt);
133 | uv_type = view.findViewById(R.id.uv_type);
134 | uv_txt = view.findViewById(R.id.uv_txt);
135 | cw_type = view.findViewById(R.id.cw_type);
136 | cw_txt = view.findViewById(R.id.cw_txt);
137 | air_type = view.findViewById(R.id.air_type);
138 | air_txt = view.findViewById(R.id.air_txt);
139 | }
140 |
141 | void draw(){
142 | if(hourlyWeatherForecast == null || lifestyleForecast == null) return ;
143 | try{
144 | SimpleDateFormat sd1 = new SimpleDateFormat("yyyy-MM-dd HH:mm");
145 | SimpleDateFormat sd2 = new SimpleDateFormat("HH:mm");
146 | Date upd = sd1.parse(hourlyWeatherForecast.getHeWeather6().get(0).getUpdate().getLoc());
147 | tv_update.setText(sd2.format(upd)+" 发布");
148 | } catch (ParseException e) {
149 | e.printStackTrace();
150 | }
151 | String tm;
152 | String[] s;
153 | tm = hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(0).getTime();
154 | s = tm.split(" ");
155 | time0.setText(s[1]);
156 | tm = hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(1).getTime();
157 | s = tm.split(" ");
158 | time1.setText(s[1]);
159 | tm = hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(2).getTime();
160 | s = tm.split(" ");
161 | time2.setText(s[1]);
162 | tm = hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(3).getTime();
163 | s = tm.split(" ");
164 | time3.setText(s[1]);
165 | tm = hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(4).getTime();
166 | s = tm.split(" ");
167 | time4.setText(s[1]);
168 | tm = hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(5).getTime();
169 | s = tm.split(" ");
170 | time5.setText(s[1]);
171 | tm = hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(6).getTime();
172 | s = tm.split(" ");
173 | time6.setText(s[1]);
174 | tm = hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(7).getTime();
175 | s = tm.split(" ");
176 | time7.setText(s[1]);
177 |
178 | String degree = "℃";
179 |
180 | tmp0.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(0).getTmp()+degree);
181 | tmp1.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(1).getTmp()+degree);
182 | tmp2.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(2).getTmp()+degree);
183 | tmp3.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(3).getTmp()+degree);
184 | tmp4.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(4).getTmp()+degree);
185 | tmp5.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(5).getTmp()+degree);
186 | tmp6.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(6).getTmp()+degree);
187 | tmp7.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(7).getTmp()+degree);
188 |
189 | cond_txt0.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(0).getCond_txt());
190 | cond_txt1.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(1).getCond_txt());
191 | cond_txt2.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(2).getCond_txt());
192 | cond_txt3.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(3).getCond_txt());
193 | cond_txt4.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(4).getCond_txt());
194 | cond_txt5.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(5).getCond_txt());
195 | cond_txt6.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(6).getCond_txt());
196 | cond_txt7.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(7).getCond_txt());
197 |
198 | wind_dir0.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(0).getWind_dir());
199 | wind_dir1.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(1).getWind_dir());
200 | wind_dir2.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(2).getWind_dir());
201 | wind_dir3.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(3).getWind_dir());
202 | wind_dir4.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(4).getWind_dir());
203 | wind_dir5.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(5).getWind_dir());
204 | wind_dir6.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(6).getWind_dir());
205 | wind_dir7.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(7).getWind_dir());
206 |
207 | wind_sc0.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(0).getWind_sc()+"级");
208 | wind_sc1.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(1).getWind_sc()+"级");
209 | wind_sc2.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(2).getWind_sc()+"级");
210 | wind_sc3.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(3).getWind_sc()+"级");
211 | wind_sc4.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(4).getWind_sc()+"级");
212 | wind_sc5.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(5).getWind_sc()+"级");
213 | wind_sc6.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(6).getWind_sc()+"级");
214 | wind_sc7.setText(hourlyWeatherForecast.getHeWeather6().get(0).getHourly().get(7).getWind_sc()+"级");
215 |
216 | comf_type.setText(lifestyleForecast.getHeWeather6().get(0).getLifestyle().get(0).getBrf());
217 | comf_txt.setText(lifestyleForecast.getHeWeather6().get(0).getLifestyle().get(0).getTxt());
218 | drsg_type.setText(lifestyleForecast.getHeWeather6().get(0).getLifestyle().get(1).getBrf());
219 | drsg_txt.setText(lifestyleForecast.getHeWeather6().get(0).getLifestyle().get(1).getTxt());
220 | flu_type.setText(lifestyleForecast.getHeWeather6().get(0).getLifestyle().get(2).getBrf());
221 | flu_txt.setText(lifestyleForecast.getHeWeather6().get(0).getLifestyle().get(2).getTxt());
222 | sport_type.setText(lifestyleForecast.getHeWeather6().get(0).getLifestyle().get(3).getBrf());
223 | sport_txt.setText(lifestyleForecast.getHeWeather6().get(0).getLifestyle().get(3).getTxt());
224 | trav_type.setText(lifestyleForecast.getHeWeather6().get(0).getLifestyle().get(4).getBrf());
225 | trav_txt.setText(lifestyleForecast.getHeWeather6().get(0).getLifestyle().get(4).getTxt());
226 | uv_type.setText(lifestyleForecast.getHeWeather6().get(0).getLifestyle().get(5).getBrf());
227 | uv_txt.setText(lifestyleForecast.getHeWeather6().get(0).getLifestyle().get(5).getTxt());
228 | cw_type.setText(lifestyleForecast.getHeWeather6().get(0).getLifestyle().get(6).getBrf());
229 | cw_txt.setText(lifestyleForecast.getHeWeather6().get(0).getLifestyle().get(6).getTxt());
230 | air_type.setText(lifestyleForecast.getHeWeather6().get(0).getLifestyle().get(7).getBrf());
231 | air_txt.setText(lifestyleForecast.getHeWeather6().get(0).getLifestyle().get(7).getTxt());
232 | }
233 |
234 | void getData(){
235 | new Thread() {
236 | public void run() {
237 | try {
238 | CityOperator cityOperator = new CityOperator(getContext());
239 | string_city = cityOperator.getIsSelectCity().toString2();
240 | string_hourly_weather_forcast = GetData.getJson("https://free-api.heweather.com/s6/weather/hourly?location=" + string_city + "&key=2d7b37b322a04de1ab17fca5f2e0f0ea");
241 | string_Lifestyle_forcast = GetData.getJson("https://free-api.heweather.com/s6/weather/lifestyle?location=" + string_city + "&key=2d7b37b322a04de1ab17fca5f2e0f0ea");
242 | } catch (Exception e) {
243 | e.printStackTrace();
244 | }
245 | handler.sendEmptyMessage(0x001);
246 | };
247 | }.start();
248 | }
249 |
250 | void parseData(){
251 | Gson gson = new Gson();
252 | hourlyWeatherForecast = gson.fromJson(string_hourly_weather_forcast,HourlyWeatherForecast.class);
253 | lifestyleForecast = gson.fromJson(string_Lifestyle_forcast,LifestyleForecast.class);
254 | draw();
255 | }
256 | }
257 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/a19093/project_endofterm/Fragment3.java:
--------------------------------------------------------------------------------
1 | package com.example.a19093.project_endofterm;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.content.res.Resources;
7 | import android.net.Uri;
8 | import android.os.Bundle;
9 | import android.support.v4.app.Fragment;
10 | import android.view.LayoutInflater;
11 | import android.view.View;
12 | import android.view.ViewGroup;
13 |
14 |
15 | import android.support.v4.app.Fragment;
16 | import android.support.v7.app.AppCompatActivity;
17 | import android.os.Bundle;
18 | import android.util.Log;
19 | import android.view.LayoutInflater;
20 | import android.view.View;
21 | import android.view.ViewGroup;
22 | import android.widget.Button;
23 | import android.widget.ListView;
24 | import android.widget.TextView;
25 |
26 | import java.util.List;
27 |
28 | public class Fragment3 extends Fragment implements View.OnClickListener{
29 | private ListView list_city;
30 | private Button button;
31 | private View view;
32 | private CityOperator cityOperator;
33 | private List cityList;
34 | CityAdapter adapter;
35 |
36 | public Fragment3() { }
37 |
38 | @Override
39 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
40 | view = inflater.inflate(R.layout.fragment3, container, false);
41 | bindView();
42 | draw();
43 | return view;
44 | }
45 |
46 | @Override
47 | public void onActivityResult(int requestCode, int resultCode, Intent data) {
48 | super.onActivityResult(requestCode, resultCode, data);
49 | switch (resultCode) {
50 | case 1:
51 | String string_city = data.getStringExtra("cityName");
52 | if(nameExistInList(string_city)){
53 | break;
54 | }
55 | else if(!nameExistInList(string_city)){
56 | updateCurrentCity(string_city);
57 | draw();
58 | }
59 | break;
60 | default:
61 | break;
62 | }
63 |
64 | }
65 |
66 | private void bindView(){
67 | cityOperator = new CityOperator(getContext());
68 | list_city = view.findViewById(R.id.list_city);
69 | button = view.findViewById(R.id.add_city);
70 | button.setOnClickListener(this);
71 | }
72 |
73 | private void draw(){
74 | cityList = cityOperator.getItemCity();
75 | adapter = new CityAdapter(cityList,getContext());
76 | list_city.setAdapter(adapter);
77 | }
78 |
79 | private boolean nameExistInList(String name){
80 | for(int i = 1; i < cityList.size(); i ++){
81 | if(cityList.get(i).getName().equals(name)){
82 | return true;
83 | }
84 | }
85 | return false;
86 | }
87 |
88 | private void updateCurrentCity(String string_city){
89 | if(cityOperator.getIsExist(string_city) == 1){
90 | City city1 = cityOperator.getIsSelectCity();
91 | cityOperator.update(city1);
92 | City city2 = new City(string_city,"否");
93 | cityOperator.update(city2);
94 | }
95 | else if(cityOperator.getIsExist(string_city) == 0){
96 | City city1 = cityOperator.getIsSelectCity();
97 | cityOperator.update(city1);
98 | City city2 = new City(string_city, "是");
99 | cityOperator.add(city2);
100 | }
101 | }
102 |
103 | @Override
104 | public void onClick(View v) {
105 | switch (v.getId()){
106 | case R.id.add_city:
107 | Intent intent = new Intent(getActivity(),Add_city.class);
108 | startActivityForResult(intent,1);
109 | break;
110 | }
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/a19093/project_endofterm/GetData.java:
--------------------------------------------------------------------------------
1 | package com.example.a19093.project_endofterm;
2 |
3 | import java.io.InputStream;
4 | import java.net.HttpURLConnection;
5 | import java.net.URL;
6 |
7 | public class GetData {
8 | public static String getJson(String path) throws Exception {
9 | URL url = new URL(path);
10 | HttpURLConnection conn = (HttpURLConnection) url.openConnection();
11 | conn.setConnectTimeout(5000);
12 | conn.setRequestMethod("GET");
13 | if (conn.getResponseCode() == 200) {
14 | InputStream in = conn.getInputStream();
15 | byte[] data = StreamTool.read(in);
16 | return new String(data, "UTF-8");
17 | }
18 | return null;
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/a19093/project_endofterm/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.a19093.project_endofterm;
2 |
3 | import android.app.AlertDialog;
4 | import android.content.DialogInterface;
5 | import android.content.Intent;
6 | import android.net.ConnectivityManager;
7 | import android.net.NetworkInfo;
8 | import android.preference.DialogPreference;
9 | import android.provider.Settings;
10 | import android.support.v4.app.Fragment;
11 | import android.support.v4.view.ViewPager;
12 | import android.support.v7.app.AppCompatActivity;
13 | import android.os.Bundle;
14 | import android.view.LayoutInflater;
15 | import android.view.View;
16 | import android.widget.Button;
17 | import android.widget.LinearLayout;
18 | import android.widget.RadioButton;
19 | import android.widget.RadioGroup;
20 | import android.widget.TextView;
21 |
22 | import java.util.ArrayList;
23 | import java.util.List;
24 |
25 |
26 | public class MainActivity extends AppCompatActivity implements RadioGroup.OnCheckedChangeListener,
27 | ViewPager.OnPageChangeListener {
28 |
29 | private RadioGroup rg_tab_bar;
30 | private RadioButton rb0;
31 | private RadioButton rb1;
32 | private RadioButton rb2;
33 | private ViewPager vpager;
34 | private TextView textView;
35 |
36 | private MyFragmentPagerAdapter mAdapter;
37 | private List fragments;
38 |
39 | public static final int PAGE_ONE = 0;
40 | public static final int PAGE_TWO = 1;
41 | public static final int PAGE_THREE = 2;
42 |
43 |
44 | @Override
45 | protected void onCreate(Bundle savedInstanceState) {
46 | super.onCreate(savedInstanceState);
47 | setContentView(R.layout.activity_main);
48 | if(!isNetworkConnected()){
49 | showDialog();
50 | }
51 | Fragment1 f1 = new Fragment1();
52 | Fragment2 f2 = new Fragment2();
53 | Fragment3 f3 = new Fragment3();
54 | fragments = new ArrayList<>();
55 | bindViews();
56 | fragments.add(f1);
57 | fragments.add(f2);
58 | fragments.add(f3);
59 | mAdapter = new MyFragmentPagerAdapter(getSupportFragmentManager(),fragments);
60 | vpager = findViewById(R.id.vpager);
61 | vpager.setAdapter(mAdapter);
62 | vpager.addOnPageChangeListener(this);
63 | rb1.setChecked(true);
64 | vpager.setCurrentItem(1);
65 | }
66 |
67 | private void bindViews() {
68 | rg_tab_bar = findViewById(R.id.rg_tab_bar);
69 | rb0 = findViewById(R.id.rb0);
70 | rb1 = findViewById(R.id.rb1);
71 | rb2 = findViewById(R.id.rb2);
72 | rg_tab_bar.setOnCheckedChangeListener(this);
73 | textView = findViewById(R.id.textView);
74 | }
75 |
76 | @Override
77 | public void onCheckedChanged(RadioGroup group, int checkedId) {
78 | switch (checkedId) {
79 | case R.id.rb0:
80 | vpager.setCurrentItem(PAGE_ONE);
81 | textView.setText("多天预报");
82 | break;
83 | case R.id.rb1:
84 | vpager.setCurrentItem(PAGE_TWO);
85 | textView.setText("今日详情");
86 | break;
87 | case R.id.rb2:
88 | vpager.setCurrentItem(PAGE_THREE);
89 | textView.setText("设定位置");
90 | break;
91 | }
92 | }
93 |
94 | @Override
95 | public void onPageScrolled(int i, float v, int i1) {
96 |
97 | }
98 |
99 | @Override
100 | public void onPageSelected(int i) {
101 |
102 | }
103 |
104 | @Override
105 | public void onPageScrollStateChanged(int state) {
106 | //state的状态有三个,0表示什么都没做,1正在滑动,2滑动完毕
107 | if (state == 2) {
108 | switch (vpager.getCurrentItem()) {
109 | case PAGE_ONE:
110 | rb0.setChecked(true);
111 | break;
112 | case PAGE_TWO:
113 | rb1.setChecked(true);
114 | break;
115 | case PAGE_THREE:
116 | rb2.setChecked(true);
117 | break;
118 | }
119 | }
120 | }
121 |
122 | private boolean isNetworkConnected() {
123 |
124 | ConnectivityManager manager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);
125 | NetworkInfo info = manager.getActiveNetworkInfo();
126 | return (info != null && info.isConnected());
127 |
128 | }
129 |
130 | private void showDialog(){
131 | View view = LayoutInflater.from(this).inflate(R.layout.my_dialog,null,false);
132 | final AlertDialog dialog = new AlertDialog.Builder(this).setView(view).create();
133 | getWindow().setBackgroundDrawableResource(android.R.color.transparent);
134 | Button btn_setting = view.findViewById(R.id.btn_setting);
135 | Button btn_cancel = view.findViewById(R.id.btn_cancel);
136 |
137 | btn_setting.setOnClickListener(new View.OnClickListener() {
138 | public void onClick(View v) {
139 | Intent intent = new Intent();
140 | intent.setAction(Settings.ACTION_DATA_ROAMING_SETTINGS);
141 | startActivityForResult(intent, 0);
142 | finish();
143 | }
144 | });
145 | btn_cancel.setOnClickListener(new View.OnClickListener() {
146 | @Override
147 | public void onClick(View v) {
148 | finish();
149 | }
150 | });
151 | dialog.setCancelable(false);
152 | dialog.show();
153 | }
154 | }
155 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/a19093/project_endofterm/MyFragmentPagerAdapter.java:
--------------------------------------------------------------------------------
1 | package com.example.a19093.project_endofterm;
2 |
3 | import android.support.v4.app.Fragment;
4 | import android.support.v4.app.FragmentManager;
5 | import android.support.v4.app.FragmentPagerAdapter;
6 | import android.view.ViewGroup;
7 |
8 | import java.util.List;
9 |
10 | public class MyFragmentPagerAdapter extends FragmentPagerAdapter {
11 |
12 | private final int PAGER_COUNT = 3;
13 | private Fragment1 myFragment1 = null;
14 | private Fragment2 myFragment2 = null;
15 | private Fragment3 myFragment3 = null;
16 | private List fragments;
17 |
18 |
19 | public MyFragmentPagerAdapter(FragmentManager fm, List fragments) {
20 | super(fm);
21 |
22 | myFragment1 = new Fragment1();
23 | myFragment2 = new Fragment2();
24 | myFragment3 = new Fragment3();
25 | }
26 |
27 |
28 | @Override
29 | public int getCount() {
30 | return PAGER_COUNT;
31 | }
32 |
33 | @Override
34 | public Object instantiateItem(ViewGroup vg, int position) {
35 | return super.instantiateItem(vg, position);
36 | }
37 |
38 | @Override
39 | public void destroyItem(ViewGroup container, int position, Object object) {
40 | super.destroyItem(container, position, object);
41 | }
42 |
43 | @Override
44 | public Fragment getItem(int position) {
45 | Fragment fragment = null;
46 | switch (position) {
47 | case MainActivity.PAGE_ONE:
48 | fragment = myFragment1;
49 | break;
50 | case MainActivity.PAGE_TWO:
51 | fragment = myFragment2;
52 | break;
53 | case MainActivity.PAGE_THREE:
54 | fragment = myFragment3;
55 | break;
56 | }
57 | return fragment;
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/a19093/project_endofterm/MySQHelper.java:
--------------------------------------------------------------------------------
1 | package com.example.a19093.project_endofterm;
2 |
3 | import android.content.Context;
4 | import android.database.sqlite.SQLiteDatabase;
5 | import android.database.sqlite.SQLiteDatabase.CursorFactory;
6 | import android.database.sqlite.SQLiteOpenHelper;
7 |
8 | public class MySQHelper extends SQLiteOpenHelper {
9 | public static final String CREATE_USERDATA = "create table if not exists CitySQ(name varchar(80) primary key, isSelect varchar(8))";
10 | private Context mContext;
11 |
12 | public MySQHelper(Context context, String name, CursorFactory factory, int version) {
13 | super(context, name, factory, version);
14 | mContext = context;
15 | }
16 |
17 | @Override
18 | public void onCreate(SQLiteDatabase db) {
19 | db.execSQL(CREATE_USERDATA);
20 | }
21 |
22 | @Override
23 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
24 | }
25 |
26 | }
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/a19093/project_endofterm/Request/HourlyWeatherForecast.java:
--------------------------------------------------------------------------------
1 | package com.example.a19093.project_endofterm.Request;
2 |
3 | import java.util.List;
4 |
5 | public class HourlyWeatherForecast {
6 | private List HeWeather6;
7 |
8 | public List getHeWeather6() {
9 | return HeWeather6;
10 | }
11 |
12 | public void setHeWeather6(List HeWeather6) {
13 | this.HeWeather6 = HeWeather6;
14 | }
15 |
16 | public static class HeWeather6Bean {
17 | /**
18 | * basic : {"cid":"CN101010100","location":"北京","parent_city":"北京","admin_area":"北京","cnty":"中国","lat":"39.90498734","lon":"116.4052887","tz":"+8.00"}
19 | * update : {"loc":"2018-12-14 19:46","utc":"2018-12-14 11:46"}
20 | * status : ok
21 | * hourly : [{"cloud":"8","cond_code":"100","cond_txt":"晴","dew":"-19","hum":"72","pop":"0","pres":"1028","time":"2018-12-14 22:00","tmp":"-4","wind_deg":"190","wind_dir":"南风","wind_sc":"1-2","wind_spd":"3"},{"cloud":"10","cond_code":"101","cond_txt":"多云","dew":"-20","hum":"74","pop":"0","pres":"1031","time":"2018-12-15 01:00","tmp":"-5","wind_deg":"171","wind_dir":"南风","wind_sc":"1-2","wind_spd":"6"},{"cloud":"56","cond_code":"101","cond_txt":"多云","dew":"-19","hum":"74","pop":"0","pres":"1029","time":"2018-12-15 04:00","tmp":"-5","wind_deg":"94","wind_dir":"东风","wind_sc":"1-2","wind_spd":"10"},{"cloud":"55","cond_code":"101","cond_txt":"多云","dew":"-17","hum":"71","pop":"0","pres":"1029","time":"2018-12-15 07:00","tmp":"-7","wind_deg":"82","wind_dir":"东风","wind_sc":"1-2","wind_spd":"3"},{"cloud":"33","cond_code":"502","cond_txt":"霾","dew":"-17","hum":"67","pop":"0","pres":"1029","time":"2018-12-15 10:00","tmp":"-3","wind_deg":"116","wind_dir":"东南风","wind_sc":"1-2","wind_spd":"1"},{"cloud":"57","cond_code":"502","cond_txt":"霾","dew":"-16","hum":"61","pop":"0","pres":"1027","time":"2018-12-15 13:00","tmp":"0","wind_deg":"174","wind_dir":"南风","wind_sc":"1-2","wind_spd":"10"},{"cloud":"89","cond_code":"502","cond_txt":"霾","dew":"-10","hum":"57","pop":"0","pres":"1025","time":"2018-12-15 16:00","tmp":"1","wind_deg":"186","wind_dir":"南风","wind_sc":"1-2","wind_spd":"2"},{"cloud":"97","cond_code":"502","cond_txt":"霾","dew":"-11","hum":"54","pop":"0","pres":"1026","time":"2018-12-15 19:00","tmp":"-1","wind_deg":"185","wind_dir":"南风","wind_sc":"1-2","wind_spd":"10"}]
22 | */
23 |
24 | private BasicBean basic;
25 | private UpdateBean update;
26 | private String status;
27 | private List hourly;
28 |
29 | public BasicBean getBasic() {
30 | return basic;
31 | }
32 |
33 | public void setBasic(BasicBean basic) {
34 | this.basic = basic;
35 | }
36 |
37 | public UpdateBean getUpdate() {
38 | return update;
39 | }
40 |
41 | public void setUpdate(UpdateBean update) {
42 | this.update = update;
43 | }
44 |
45 | public String getStatus() {
46 | return status;
47 | }
48 |
49 | public void setStatus(String status) {
50 | this.status = status;
51 | }
52 |
53 | public List getHourly() {
54 | return hourly;
55 | }
56 |
57 | public void setHourly(List hourly) {
58 | this.hourly = hourly;
59 | }
60 |
61 | public static class BasicBean {
62 | /**
63 | * cid : CN101010100
64 | * location : 北京
65 | * parent_city : 北京
66 | * admin_area : 北京
67 | * cnty : 中国
68 | * lat : 39.90498734
69 | * lon : 116.4052887
70 | * tz : +8.00
71 | */
72 |
73 | private String cid;
74 | private String location;
75 | private String parent_city;
76 | private String admin_area;
77 | private String cnty;
78 | private String lat;
79 | private String lon;
80 | private String tz;
81 |
82 | public String getCid() {
83 | return cid;
84 | }
85 |
86 | public void setCid(String cid) {
87 | this.cid = cid;
88 | }
89 |
90 | public String getLocation() {
91 | return location;
92 | }
93 |
94 | public void setLocation(String location) {
95 | this.location = location;
96 | }
97 |
98 | public String getParent_city() {
99 | return parent_city;
100 | }
101 |
102 | public void setParent_city(String parent_city) {
103 | this.parent_city = parent_city;
104 | }
105 |
106 | public String getAdmin_area() {
107 | return admin_area;
108 | }
109 |
110 | public void setAdmin_area(String admin_area) {
111 | this.admin_area = admin_area;
112 | }
113 |
114 | public String getCnty() {
115 | return cnty;
116 | }
117 |
118 | public void setCnty(String cnty) {
119 | this.cnty = cnty;
120 | }
121 |
122 | public String getLat() {
123 | return lat;
124 | }
125 |
126 | public void setLat(String lat) {
127 | this.lat = lat;
128 | }
129 |
130 | public String getLon() {
131 | return lon;
132 | }
133 |
134 | public void setLon(String lon) {
135 | this.lon = lon;
136 | }
137 |
138 | public String getTz() {
139 | return tz;
140 | }
141 |
142 | public void setTz(String tz) {
143 | this.tz = tz;
144 | }
145 | }
146 |
147 | public static class UpdateBean {
148 | /**
149 | * loc : 2018-12-14 19:46
150 | * utc : 2018-12-14 11:46
151 | */
152 |
153 | private String loc;
154 | private String utc;
155 |
156 | public String getLoc() {
157 | return loc;
158 | }
159 |
160 | public void setLoc(String loc) {
161 | this.loc = loc;
162 | }
163 |
164 | public String getUtc() {
165 | return utc;
166 | }
167 |
168 | public void setUtc(String utc) {
169 | this.utc = utc;
170 | }
171 | }
172 |
173 | public static class HourlyBean {
174 | /**
175 | * cloud : 8
176 | * cond_code : 100
177 | * cond_txt : 晴
178 | * dew : -19
179 | * hum : 72
180 | * pop : 0
181 | * pres : 1028
182 | * time : 2018-12-14 22:00
183 | * tmp : -4
184 | * wind_deg : 190
185 | * wind_dir : 南风
186 | * wind_sc : 1-2
187 | * wind_spd : 3
188 | */
189 |
190 | private String cloud;
191 | private String cond_code;
192 | private String cond_txt;
193 | private String dew;
194 | private String hum;
195 | private String pop;
196 | private String pres;
197 | private String time;
198 | private String tmp;
199 | private String wind_deg;
200 | private String wind_dir;
201 | private String wind_sc;
202 | private String wind_spd;
203 |
204 | public String getCloud() {
205 | return cloud;
206 | }
207 |
208 | public void setCloud(String cloud) {
209 | this.cloud = cloud;
210 | }
211 |
212 | public String getCond_code() {
213 | return cond_code;
214 | }
215 |
216 | public void setCond_code(String cond_code) {
217 | this.cond_code = cond_code;
218 | }
219 |
220 | public String getCond_txt() {
221 | return cond_txt;
222 | }
223 |
224 | public void setCond_txt(String cond_txt) {
225 | this.cond_txt = cond_txt;
226 | }
227 |
228 | public String getDew() {
229 | return dew;
230 | }
231 |
232 | public void setDew(String dew) {
233 | this.dew = dew;
234 | }
235 |
236 | public String getHum() {
237 | return hum;
238 | }
239 |
240 | public void setHum(String hum) {
241 | this.hum = hum;
242 | }
243 |
244 | public String getPop() {
245 | return pop;
246 | }
247 |
248 | public void setPop(String pop) {
249 | this.pop = pop;
250 | }
251 |
252 | public String getPres() {
253 | return pres;
254 | }
255 |
256 | public void setPres(String pres) {
257 | this.pres = pres;
258 | }
259 |
260 | public String getTime() {
261 | return time;
262 | }
263 |
264 | public void setTime(String time) {
265 | this.time = time;
266 | }
267 |
268 | public String getTmp() {
269 | return tmp;
270 | }
271 |
272 | public void setTmp(String tmp) {
273 | this.tmp = tmp;
274 | }
275 |
276 | public String getWind_deg() {
277 | return wind_deg;
278 | }
279 |
280 | public void setWind_deg(String wind_deg) {
281 | this.wind_deg = wind_deg;
282 | }
283 |
284 | public String getWind_dir() {
285 | return wind_dir;
286 | }
287 |
288 | public void setWind_dir(String wind_dir) {
289 | this.wind_dir = wind_dir;
290 | }
291 |
292 | public String getWind_sc() {
293 | return wind_sc;
294 | }
295 |
296 | public void setWind_sc(String wind_sc) {
297 | this.wind_sc = wind_sc;
298 | }
299 |
300 | public String getWind_spd() {
301 | return wind_spd;
302 | }
303 |
304 | public void setWind_spd(String wind_spd) {
305 | this.wind_spd = wind_spd;
306 | }
307 | }
308 | }
309 | }
310 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/a19093/project_endofterm/Request/LifestyleForecast.java:
--------------------------------------------------------------------------------
1 | package com.example.a19093.project_endofterm.Request;
2 |
3 | import java.util.List;
4 |
5 | public class LifestyleForecast {
6 | private List HeWeather6;
7 |
8 | public List getHeWeather6() {
9 | return HeWeather6;
10 | }
11 |
12 | public void setHeWeather6(List HeWeather6) {
13 | this.HeWeather6 = HeWeather6;
14 | }
15 |
16 | public static class HeWeather6Bean {
17 | /**
18 | * basic : {"cid":"CN101010100","location":"北京","parent_city":"北京","admin_area":"北京","cnty":"中国","lat":"39.90498734","lon":"116.4052887","tz":"+8.00"}
19 | * update : {"loc":"2018-12-14 19:46","utc":"2018-12-14 11:46"}
20 | * status : ok
21 | * lifestyle : [{"type":"comf","brf":"较不舒适","txt":"白天天气晴好,但仍会使您感觉偏冷,不很舒适,请注意适时添加衣物,以防感冒。"},{"type":"drsg","brf":"冷","txt":"天气冷,建议着棉服、羽绒服、皮夹克加羊毛衫等冬季服装。年老体弱者宜着厚棉衣、冬大衣或厚羽绒服。"},{"type":"flu","brf":"少发","txt":"各项气象条件适宜,无明显降温过程,发生感冒机率较低。"},{"type":"sport","brf":"较不宜","txt":"天气较好,但考虑天气寒冷,推荐您进行室内运动,户外运动时请注意保暖并做好准备活动。"},{"type":"trav","brf":"适宜","txt":"天气较好,气温稍低,会感觉稍微有点凉,不过也是个好天气哦。适宜旅游,可不要错过机会呦!"},{"type":"uv","brf":"弱","txt":"紫外线强度较弱,建议出门前涂擦SPF在12-15之间、PA+的防晒护肤品。"},{"type":"cw","brf":"较适宜","txt":"较适宜洗车,未来一天无雨,风力较小,擦洗一新的汽车至少能保持一天。"},{"type":"air","brf":"很差","txt":"气象条件不利于空气污染物稀释、扩散和清除,请尽量避免在室外长时间活动。"}]
22 | */
23 |
24 | private BasicBean basic;
25 | private UpdateBean update;
26 | private String status;
27 | private List lifestyle;
28 |
29 | public BasicBean getBasic() {
30 | return basic;
31 | }
32 |
33 | public void setBasic(BasicBean basic) {
34 | this.basic = basic;
35 | }
36 |
37 | public UpdateBean getUpdate() {
38 | return update;
39 | }
40 |
41 | public void setUpdate(UpdateBean update) {
42 | this.update = update;
43 | }
44 |
45 | public String getStatus() {
46 | return status;
47 | }
48 |
49 | public void setStatus(String status) {
50 | this.status = status;
51 | }
52 |
53 | public List getLifestyle() {
54 | return lifestyle;
55 | }
56 |
57 | public void setLifestyle(List lifestyle) {
58 | this.lifestyle = lifestyle;
59 | }
60 |
61 | public static class BasicBean {
62 | /**
63 | * cid : CN101010100
64 | * location : 北京
65 | * parent_city : 北京
66 | * admin_area : 北京
67 | * cnty : 中国
68 | * lat : 39.90498734
69 | * lon : 116.4052887
70 | * tz : +8.00
71 | */
72 |
73 | private String cid;
74 | private String location;
75 | private String parent_city;
76 | private String admin_area;
77 | private String cnty;
78 | private String lat;
79 | private String lon;
80 | private String tz;
81 |
82 | public String getCid() {
83 | return cid;
84 | }
85 |
86 | public void setCid(String cid) {
87 | this.cid = cid;
88 | }
89 |
90 | public String getLocation() {
91 | return location;
92 | }
93 |
94 | public void setLocation(String location) {
95 | this.location = location;
96 | }
97 |
98 | public String getParent_city() {
99 | return parent_city;
100 | }
101 |
102 | public void setParent_city(String parent_city) {
103 | this.parent_city = parent_city;
104 | }
105 |
106 | public String getAdmin_area() {
107 | return admin_area;
108 | }
109 |
110 | public void setAdmin_area(String admin_area) {
111 | this.admin_area = admin_area;
112 | }
113 |
114 | public String getCnty() {
115 | return cnty;
116 | }
117 |
118 | public void setCnty(String cnty) {
119 | this.cnty = cnty;
120 | }
121 |
122 | public String getLat() {
123 | return lat;
124 | }
125 |
126 | public void setLat(String lat) {
127 | this.lat = lat;
128 | }
129 |
130 | public String getLon() {
131 | return lon;
132 | }
133 |
134 | public void setLon(String lon) {
135 | this.lon = lon;
136 | }
137 |
138 | public String getTz() {
139 | return tz;
140 | }
141 |
142 | public void setTz(String tz) {
143 | this.tz = tz;
144 | }
145 | }
146 |
147 | public static class UpdateBean {
148 | /**
149 | * loc : 2018-12-14 19:46
150 | * utc : 2018-12-14 11:46
151 | */
152 |
153 | private String loc;
154 | private String utc;
155 |
156 | public String getLoc() {
157 | return loc;
158 | }
159 |
160 | public void setLoc(String loc) {
161 | this.loc = loc;
162 | }
163 |
164 | public String getUtc() {
165 | return utc;
166 | }
167 |
168 | public void setUtc(String utc) {
169 | this.utc = utc;
170 | }
171 | }
172 |
173 | public static class LifestyleBean {
174 | /**
175 | * type : comf
176 | * brf : 较不舒适
177 | * txt : 白天天气晴好,但仍会使您感觉偏冷,不很舒适,请注意适时添加衣物,以防感冒。
178 | */
179 |
180 | private String type;
181 | private String brf;
182 | private String txt;
183 |
184 | public String getType() {
185 | return type;
186 | }
187 |
188 | public void setType(String type) {
189 | this.type = type;
190 | }
191 |
192 | public String getBrf() {
193 | return brf;
194 | }
195 |
196 | public void setBrf(String brf) {
197 | this.brf = brf;
198 | }
199 |
200 | public String getTxt() {
201 | return txt;
202 | }
203 |
204 | public void setTxt(String txt) {
205 | this.txt = txt;
206 | }
207 | }
208 | }
209 | }
210 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/a19093/project_endofterm/Request/WeeklyWeatherForecast.java:
--------------------------------------------------------------------------------
1 | package com.example.a19093.project_endofterm.Request;
2 |
3 |
4 | import java.util.List;
5 |
6 | public class WeeklyWeatherForecast {
7 |
8 | private List HeWeather6;
9 |
10 | public List getHeWeather6() {
11 | return HeWeather6;
12 | }
13 |
14 | public void setHeWeather6(List HeWeather6) {
15 | this.HeWeather6 = HeWeather6;
16 | }
17 |
18 | public static class HeWeather6Bean {
19 | /**
20 | * basic : {"cid":"CN101010100","location":"北京","parent_city":"北京","admin_area":"北京","cnty":"中国","lat":"39.90498734","lon":"116.4052887","tz":"+8.00"}
21 | * update : {"loc":"2018-12-12 19:46","utc":"2018-12-12 11:46"}
22 | * status : ok
23 | * daily_forecast : [{"cond_code_d":"100","cond_code_n":"100","cond_txt_d":"晴","cond_txt_n":"晴","date":"2018-12-12","hum":"17","mr":"11:01","ms":"21:15","pcpn":"0.0","pop":"0","pres":"1037","sr":"07:27","ss":"16:49","tmp_max":"1","tmp_min":"-8","uv_index":"3","vis":"20","wind_deg":"-1","wind_dir":"无持续风向","wind_sc":"1-2","wind_spd":"8"},{"cond_code_d":"100","cond_code_n":"100","cond_txt_d":"晴","cond_txt_n":"晴","date":"2018-12-13","hum":"18","mr":"11:35","ms":"22:12","pcpn":"0.0","pop":"0","pres":"1037","sr":"07:28","ss":"16:50","tmp_max":"3","tmp_min":"-7","uv_index":"4","vis":"20","wind_deg":"186","wind_dir":"南风","wind_sc":"1-2","wind_spd":"11"},{"cond_code_d":"100","cond_code_n":"100","cond_txt_d":"晴","cond_txt_n":"晴","date":"2018-12-14","hum":"23","mr":"12:06","ms":"23:09","pcpn":"0.0","pop":"0","pres":"1037","sr":"07:28","ss":"16:50","tmp_max":"3","tmp_min":"-6","uv_index":"2","vis":"20","wind_deg":"170","wind_dir":"南风","wind_sc":"1-2","wind_spd":"8"},{"cond_code_d":"101","cond_code_n":"101","cond_txt_d":"多云","cond_txt_n":"多云","date":"2018-12-15","hum":"31","mr":"12:35","ms":"00:00","pcpn":"0.0","pop":"0","pres":"1029","sr":"07:29","ss":"16:50","tmp_max":"3","tmp_min":"-5","uv_index":"2","vis":"20","wind_deg":"355","wind_dir":"北风","wind_sc":"1-2","wind_spd":"8"},{"cond_code_d":"101","cond_code_n":"101","cond_txt_d":"多云","cond_txt_n":"多云","date":"2018-12-16","hum":"29","mr":"13:03","ms":"00:07","pcpn":"0.0","pop":"0","pres":"1027","sr":"07:30","ss":"16:50","tmp_max":"6","tmp_min":"-5","uv_index":"2","vis":"20","wind_deg":"6","wind_dir":"北风","wind_sc":"1-2","wind_spd":"3"},{"cond_code_d":"100","cond_code_n":"100","cond_txt_d":"晴","cond_txt_n":"晴","date":"2018-12-17","hum":"28","mr":"13:30","ms":"01:07","pcpn":"0.0","pop":"0","pres":"1026","sr":"07:30","ss":"16:51","tmp_max":"5","tmp_min":"-5","uv_index":"2","vis":"20","wind_deg":"220","wind_dir":"西南风","wind_sc":"1-2","wind_spd":"3"},{"cond_code_d":"101","cond_code_n":"101","cond_txt_d":"多云","cond_txt_n":"多云","date":"2018-12-18","hum":"28","mr":"13:59","ms":"02:07","pcpn":"0.0","pop":"0","pres":"1017","sr":"07:31","ss":"16:51","tmp_max":"5","tmp_min":"-4","uv_index":"2","vis":"10","wind_deg":"314","wind_dir":"西北风","wind_sc":"4-5","wind_spd":"30"}]
24 | */
25 |
26 | private BasicBean basic;
27 | private UpdateBean update;
28 | private String status;
29 | private List daily_forecast;
30 |
31 | public BasicBean getBasic() {
32 | return basic;
33 | }
34 |
35 | public void setBasic(BasicBean basic) {
36 | this.basic = basic;
37 | }
38 |
39 | public UpdateBean getUpdate() {
40 | return update;
41 | }
42 |
43 | public void setUpdate(UpdateBean update) {
44 | this.update = update;
45 | }
46 |
47 | public String getStatus() {
48 | return status;
49 | }
50 |
51 | public void setStatus(String status) {
52 | this.status = status;
53 | }
54 |
55 | public List getDaily_forecast() {
56 | return daily_forecast;
57 | }
58 |
59 | public void setDaily_forecast(List daily_forecast) {
60 | this.daily_forecast = daily_forecast;
61 | }
62 |
63 | public static class BasicBean {
64 | /**
65 | * cid : CN101010100
66 | * location : 北京
67 | * parent_city : 北京
68 | * admin_area : 北京
69 | * cnty : 中国
70 | * lat : 39.90498734
71 | * lon : 116.4052887
72 | * tz : +8.00
73 | */
74 |
75 | private String cid;
76 | private String location;
77 | private String parent_city;
78 | private String admin_area;
79 | private String cnty;
80 | private String lat;
81 | private String lon;
82 | private String tz;
83 |
84 | public String getCid() {
85 | return cid;
86 | }
87 |
88 | public void setCid(String cid) {
89 | this.cid = cid;
90 | }
91 |
92 | public String getLocation() {
93 | return location;
94 | }
95 |
96 | public void setLocation(String location) {
97 | this.location = location;
98 | }
99 |
100 | public String getParent_city() {
101 | return parent_city;
102 | }
103 |
104 | public void setParent_city(String parent_city) {
105 | this.parent_city = parent_city;
106 | }
107 |
108 | public String getAdmin_area() {
109 | return admin_area;
110 | }
111 |
112 | public void setAdmin_area(String admin_area) {
113 | this.admin_area = admin_area;
114 | }
115 |
116 | public String getCnty() {
117 | return cnty;
118 | }
119 |
120 | public void setCnty(String cnty) {
121 | this.cnty = cnty;
122 | }
123 |
124 | public String getLat() {
125 | return lat;
126 | }
127 |
128 | public void setLat(String lat) {
129 | this.lat = lat;
130 | }
131 |
132 | public String getLon() {
133 | return lon;
134 | }
135 |
136 | public void setLon(String lon) {
137 | this.lon = lon;
138 | }
139 |
140 | public String getTz() {
141 | return tz;
142 | }
143 |
144 | public void setTz(String tz) {
145 | this.tz = tz;
146 | }
147 | }
148 |
149 | public static class UpdateBean {
150 | /**
151 | * loc : 2018-12-12 19:46
152 | * utc : 2018-12-12 11:46
153 | */
154 |
155 | private String loc;
156 | private String utc;
157 |
158 | public String getLoc() {
159 | return loc;
160 | }
161 |
162 | public void setLoc(String loc) {
163 | this.loc = loc;
164 | }
165 |
166 | public String getUtc() {
167 | return utc;
168 | }
169 |
170 | public void setUtc(String utc) {
171 | this.utc = utc;
172 | }
173 | }
174 |
175 | public static class DailyForecastBean {
176 | /**
177 | * cond_code_d : 100
178 | * cond_code_n : 100
179 | * cond_txt_d : 晴
180 | * cond_txt_n : 晴
181 | * date : 2018-12-12
182 | * hum : 17
183 | * mr : 11:01
184 | * ms : 21:15
185 | * pcpn : 0.0
186 | * pop : 0
187 | * pres : 1037
188 | * sr : 07:27
189 | * ss : 16:49
190 | * tmp_max : 1
191 | * tmp_min : -8
192 | * uv_index : 3
193 | * vis : 20
194 | * wind_deg : -1
195 | * wind_dir : 无持续风向
196 | * wind_sc : 1-2
197 | * wind_spd : 8
198 | */
199 |
200 | private String cond_code_d;
201 | private String cond_code_n;
202 | private String cond_txt_d;
203 | private String cond_txt_n;
204 | private String date;
205 | private String hum;
206 | private String mr;
207 | private String ms;
208 | private String pcpn;
209 | private String pop;
210 | private String pres;
211 | private String sr;
212 | private String ss;
213 | private String tmp_max;
214 | private String tmp_min;
215 | private String uv_index;
216 | private String vis;
217 | private String wind_deg;
218 | private String wind_dir;
219 | private String wind_sc;
220 | private String wind_spd;
221 |
222 | public String getCond_code_d() {
223 | return cond_code_d;
224 | }
225 |
226 | public void setCond_code_d(String cond_code_d) {
227 | this.cond_code_d = cond_code_d;
228 | }
229 |
230 | public String getCond_code_n() {
231 | return cond_code_n;
232 | }
233 |
234 | public void setCond_code_n(String cond_code_n) {
235 | this.cond_code_n = cond_code_n;
236 | }
237 |
238 | public String getCond_txt_d() {
239 | return cond_txt_d;
240 | }
241 |
242 | public void setCond_txt_d(String cond_txt_d) {
243 | this.cond_txt_d = cond_txt_d;
244 | }
245 |
246 | public String getCond_txt_n() {
247 | return cond_txt_n;
248 | }
249 |
250 | public void setCond_txt_n(String cond_txt_n) {
251 | this.cond_txt_n = cond_txt_n;
252 | }
253 |
254 | public String getDate() {
255 | return date;
256 | }
257 |
258 | public void setDate(String date) {
259 | this.date = date;
260 | }
261 |
262 | public String getHum() {
263 | return hum;
264 | }
265 |
266 | public void setHum(String hum) {
267 | this.hum = hum;
268 | }
269 |
270 | public String getMr() {
271 | return mr;
272 | }
273 |
274 | public void setMr(String mr) {
275 | this.mr = mr;
276 | }
277 |
278 | public String getMs() {
279 | return ms;
280 | }
281 |
282 | public void setMs(String ms) {
283 | this.ms = ms;
284 | }
285 |
286 | public String getPcpn() {
287 | return pcpn;
288 | }
289 |
290 | public void setPcpn(String pcpn) {
291 | this.pcpn = pcpn;
292 | }
293 |
294 | public String getPop() {
295 | return pop;
296 | }
297 |
298 | public void setPop(String pop) {
299 | this.pop = pop;
300 | }
301 |
302 | public String getPres() {
303 | return pres;
304 | }
305 |
306 | public void setPres(String pres) {
307 | this.pres = pres;
308 | }
309 |
310 | public String getSr() {
311 | return sr;
312 | }
313 |
314 | public void setSr(String sr) {
315 | this.sr = sr;
316 | }
317 |
318 | public String getSs() {
319 | return ss;
320 | }
321 |
322 | public void setSs(String ss) {
323 | this.ss = ss;
324 | }
325 |
326 | public String getTmp_max() {
327 | return tmp_max;
328 | }
329 |
330 | public void setTmp_max(String tmp_max) {
331 | this.tmp_max = tmp_max;
332 | }
333 |
334 | public String getTmp_min() {
335 | return tmp_min;
336 | }
337 |
338 | public void setTmp_min(String tmp_min) {
339 | this.tmp_min = tmp_min;
340 | }
341 |
342 | public String getUv_index() {
343 | return uv_index;
344 | }
345 |
346 | public void setUv_index(String uv_index) {
347 | this.uv_index = uv_index;
348 | }
349 |
350 | public String getVis() {
351 | return vis;
352 | }
353 |
354 | public void setVis(String vis) {
355 | this.vis = vis;
356 | }
357 |
358 | public String getWind_deg() {
359 | return wind_deg;
360 | }
361 |
362 | public void setWind_deg(String wind_deg) {
363 | this.wind_deg = wind_deg;
364 | }
365 |
366 | public String getWind_dir() {
367 | return wind_dir;
368 | }
369 |
370 | public void setWind_dir(String wind_dir) {
371 | this.wind_dir = wind_dir;
372 | }
373 |
374 | public String getWind_sc() {
375 | return wind_sc;
376 | }
377 |
378 | public void setWind_sc(String wind_sc) {
379 | this.wind_sc = wind_sc;
380 | }
381 |
382 | public String getWind_spd() {
383 | return wind_spd;
384 | }
385 |
386 | public void setWind_spd(String wind_spd) {
387 | this.wind_spd = wind_spd;
388 | }
389 | }
390 | }
391 | }
392 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/a19093/project_endofterm/StreamTool.java:
--------------------------------------------------------------------------------
1 | package com.example.a19093.project_endofterm;
2 |
3 | import java.io.ByteArrayOutputStream;
4 | import java.io.InputStream;
5 |
6 | public class StreamTool {
7 | public static byte[] read(InputStream inStream) throws Exception{
8 | ByteArrayOutputStream outStream = new ByteArrayOutputStream();
9 | byte[] buffer = new byte[1024];
10 | int len = 0;
11 | while((len = inStream.read(buffer)) != -1)
12 | {
13 | outStream.write(buffer,0,len);
14 | }
15 | inStream.close();
16 | byte[] out = outStream.toByteArray();
17 | outStream.close();
18 | return out;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/a19093/project_endofterm/VariableApp.java:
--------------------------------------------------------------------------------
1 | package com.example.a19093.project_endofterm;
2 |
3 | import android.app.Application;
4 | import android.util.Log;
5 |
6 | import com.example.a19093.project_endofterm.Request.HourlyWeatherForecast;
7 | import com.example.a19093.project_endofterm.Request.WeeklyWeatherForecast;
8 |
9 | import java.util.List;
10 |
11 | public class VariableApp extends Application {
12 | private static VariableApp instance = null;
13 | public static VariableApp getInstance(){
14 | return instance;
15 | }
16 | @Override
17 | public void onCreate(){
18 | super.onCreate();
19 | instance = this;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/._100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/._100.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/add_city.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/add_city.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/add_city1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/add_city1.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/add_city2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/add_city2.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/air.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/air.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/app_list_corner_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
9 |
10 |
11 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/back.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/background.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/background.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bgpic.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/bgpic.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bgpic1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/bgpic1.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bgpic2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/bgpic2.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bgpic3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/bgpic3.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bgpic4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/bgpic4.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/comf.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/comf.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/cw.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/cw.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/desktop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/desktop.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/desktop1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/desktop1.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/diag.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/dotted_line.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/drsg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/drsg.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/flu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/flu.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/list_circle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/sport.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/sport.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tab_menu_better.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tab_menu_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 | -
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tab_menu_channel.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tab_menu_message.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tab_menu_setting.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/tab_menu_text.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/trav.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/trav.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/uv.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/uv.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x100.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x100n.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x100n.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x101.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x101.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x102.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x102.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x103.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x103.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x103n.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x103n.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x104.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x104.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x104n.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x104n.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x200.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x201.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x201.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x202.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x202.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x203.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x203.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x204.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x204.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x205.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x205.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x206.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x206.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x207.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x207.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x208.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x208.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x209.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x209.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x210.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x210.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x211.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x211.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x212.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x212.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x213.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x213.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x300.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x300.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x300n.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x300n.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x301.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x301.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x301n.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x301n.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x302.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x302.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x303.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x303.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x304.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x304.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x305.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x305.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x306.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x306.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x307.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x307.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x309.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x309.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x310.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x310.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x311.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x311.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x312.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x312.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x313.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x313.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x314.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x314.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x315.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x315.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x316.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x316.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x317.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x317.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x318.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x318.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x399.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x399.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x400.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x401.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x401.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x402.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x402.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x403.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x403.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x404.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x404.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x405.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x405.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x406.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x406.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x406n.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x406n.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x407.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x407.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x407n.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x407n.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x408.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x408.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x409.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x409.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x410.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x410.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x499.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x499.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x500.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x500.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x501.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x501.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x502.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x502.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x503.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x503.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x504.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x504.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x507.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x507.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x508.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x508.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x509.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x509.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x510.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x510.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x511.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x511.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x512.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x513.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x513.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x514.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x514.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x515.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x515.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x900.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x900.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x901.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x901.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/x999.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/drawable/x999.png
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
12 |
17 |
27 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
44 |
45 |
49 |
50 |
54 |
55 |
59 |
60 |
61 |
62 |
68 |
69 |
74 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/add_city.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
11 |
16 |
21 |
27 |
34 |
35 |
39 |
40 |
41 |
42 |
43 |
44 |
49 |
58 |
66 |
67 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/city_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
15 |
22 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment1.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
18 |
24 |
27 |
31 |
35 |
36 |
42 |
43 |
47 |
48 |
52 |
53 |
59 |
60 |
66 |
67 |
73 |
74 |
80 |
81 |
87 |
88 |
94 |
95 |
96 |
100 |
101 |
107 |
108 |
114 |
115 |
121 |
122 |
128 |
129 |
135 |
136 |
142 |
143 |
149 |
150 |
151 |
155 |
156 |
160 |
161 |
165 |
166 |
170 |
171 |
175 |
176 |
180 |
181 |
185 |
186 |
190 |
191 |
192 |
196 |
197 |
200 |
201 |
204 |
205 |
208 |
209 |
212 |
213 |
216 |
217 |
220 |
221 |
224 |
225 |
229 |
230 |
233 |
234 |
237 |
238 |
241 |
242 |
245 |
246 |
249 |
250 |
253 |
254 |
257 |
258 |
259 |
266 |
271 |
272 |
276 |
277 |
280 |
281 |
284 |
285 |
288 |
289 |
292 |
293 |
296 |
297 |
300 |
301 |
304 |
305 |
306 |
310 |
311 |
314 |
315 |
318 |
319 |
322 |
323 |
326 |
327 |
330 |
331 |
334 |
335 |
338 |
339 |
340 |
344 |
345 |
348 |
349 |
352 |
353 |
356 |
357 |
360 |
361 |
364 |
365 |
368 |
369 |
372 |
373 |
374 |
378 |
379 |
382 |
383 |
386 |
387 |
390 |
391 |
394 |
395 |
398 |
399 |
402 |
403 |
406 |
407 |
408 |
412 |
413 |
416 |
417 |
420 |
421 |
424 |
425 |
428 |
429 |
432 |
433 |
436 |
437 |
440 |
441 |
442 |
443 |
444 |
445 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment2.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
14 |
20 |
28 |
32 |
36 |
41 |
45 |
49 |
53 |
57 |
58 |
62 |
63 |
67 |
68 |
72 |
73 |
77 |
78 |
82 |
83 |
87 |
88 |
92 |
93 |
97 |
98 |
102 |
103 |
107 |
108 |
112 |
113 |
117 |
118 |
122 |
123 |
127 |
128 |
132 |
133 |
137 |
138 |
142 |
143 |
147 |
148 |
152 |
153 |
157 |
158 |
162 |
163 |
167 |
168 |
172 |
173 |
177 |
178 |
182 |
183 |
187 |
188 |
192 |
193 |
197 |
198 |
202 |
203 |
207 |
208 |
212 |
213 |
217 |
218 |
222 |
223 |
227 |
228 |
232 |
233 |
237 |
238 |
242 |
243 |
247 |
248 |
252 |
253 |
257 |
258 |
262 |
263 |
267 |
268 |
269 |
270 |
278 |
282 |
287 |
291 |
295 |
299 |
302 |
307 |
311 |
314 |
317 |
318 |
321 |
322 |
323 |
324 |
328 |
331 |
336 |
340 |
343 |
346 |
347 |
350 |
351 |
352 |
353 |
357 |
360 |
365 |
369 |
372 |
375 |
376 |
379 |
380 |
381 |
382 |
386 |
389 |
394 |
398 |
401 |
404 |
405 |
408 |
409 |
410 |
411 |
415 |
418 |
423 |
427 |
430 |
433 |
434 |
437 |
438 |
439 |
440 |
444 |
447 |
452 |
456 |
459 |
462 |
463 |
466 |
467 |
468 |
469 |
473 |
476 |
481 |
485 |
488 |
491 |
492 |
495 |
496 |
497 |
498 |
502 |
505 |
510 |
514 |
517 |
520 |
521 |
524 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
532 |
533 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment3.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
13 |
17 |
22 |
23 |
27 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/my_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
18 |
27 |
32 |
36 |
37 |
46 |
47 |
51 |
52 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/tab_better_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/mipmap-xhdpi/tab_better_normal.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/tab_better_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/mipmap-xhdpi/tab_better_pressed.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/tab_channel_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/mipmap-xhdpi/tab_channel_normal.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/tab_channel_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/mipmap-xhdpi/tab_channel_pressed.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/tab_message_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/mipmap-xhdpi/tab_message_normal.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/tab_message_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/mipmap-xhdpi/tab_message_pressed.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/tab_my_normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/mipmap-xhdpi/tab_my_normal.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/tab_my_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/mipmap-xhdpi/tab_my_pressed.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #104E8B
5 | #ffffff
6 |
7 | #000000
8 | #FFFFFF
9 | #FCFCFC
10 | #00F1F1F1
11 | #104E8B
12 |
13 | #FFFFFF
14 | #FFFFFF
15 | #696969
16 |
17 | #8D7A71
18 | #FFFFFF
19 | #008577
20 | #FFC800
21 | #694E42
22 | #E5E5E5
23 |
24 | #EEEE00
25 | #87CEFA
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/values/id.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | 内测版
3 |
4 |
5 | Hello blank fragment
6 |
7 | 提醒
8 | 信息
9 | 我的
10 | 设置
11 | 40dp
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
22 |
23 |
29 |
30 |
36 |
43 |
50 |
56 |
57 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/app/src/test/java/com/example/a19093/project_endofterm/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.example.a19093.project_endofterm;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 |
5 | repositories {
6 | google()
7 | jcenter()
8 | maven {
9 | url "https://jitpack.io"
10 | }
11 | }
12 | dependencies {
13 | classpath 'com.android.tools.build:gradle:3.2.1'
14 |
15 |
16 | // NOTE: Do not place your application dependencies here; they belong
17 | // in the individual module build.gradle files
18 | }
19 | }
20 |
21 | allprojects {
22 | repositories {
23 | google()
24 | jcenter()
25 | }
26 | }
27 |
28 | task clean(type: Delete) {
29 | delete rootProject.buildDir
30 | }
31 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx1536m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 |
15 |
16 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/xwda/Project_EndofTerm/2c35a0cf22c0e7989557c6c98c3dc85ee62b3f25/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------