├── .gitignore
├── .idea
├── .name
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── encodings.xml
├── gradle.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── README.md
├── Stock.iml
├── app
├── .gitignore
├── app.iml
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── example
│ │ └── zhangchen
│ │ └── stock
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── example
│ │ │ └── zhangchen
│ │ │ └── stock
│ │ │ └── futures
│ │ │ ├── AboutFragment.java
│ │ │ ├── GuideFragment.java
│ │ │ ├── KChartsFragment.java
│ │ │ ├── MyFragmentActivity.java
│ │ │ ├── TimesFragment.java
│ │ │ ├── WelcomeActivity.java
│ │ │ ├── entity
│ │ │ ├── AnnouncementEntity.java
│ │ │ ├── AppInfo.java
│ │ │ ├── FutruesEntity.java
│ │ │ ├── GameLogEntity.java
│ │ │ ├── KDJEntity.java
│ │ │ ├── MACDEntity.java
│ │ │ ├── MALineEntity.java
│ │ │ ├── OHLCEntity.java
│ │ │ ├── PayLogEntity.java
│ │ │ ├── RSIEntity.java
│ │ │ └── TimesEntity.java
│ │ │ ├── http
│ │ │ └── HttpHelper.java
│ │ │ ├── util
│ │ │ └── Tools.java
│ │ │ └── view
│ │ │ ├── GridChart.java
│ │ │ ├── KChartsView.java
│ │ │ └── TimesView.java
│ └── res
│ │ ├── drawable
│ │ ├── back.png
│ │ ├── back_pressed.png
│ │ ├── bg.png
│ │ ├── bg_chart.png
│ │ ├── bg_grid_cell.png
│ │ ├── bg_grid_cell_pressed.png
│ │ ├── bg_main.png
│ │ ├── bg_tab.png
│ │ ├── bg_tab_focused.png
│ │ ├── bg_title.png
│ │ ├── classification.png
│ │ ├── ic_launcher.png
│ │ ├── ic_pink.png
│ │ ├── index.png
│ │ ├── left.png
│ │ ├── left_pressed.png
│ │ ├── messages.png
│ │ ├── my_futures.png
│ │ ├── my_trasanction.png
│ │ ├── plates.png
│ │ ├── ranking.png
│ │ ├── refresh.png
│ │ ├── refresh_pressed.png
│ │ ├── right.png
│ │ ├── right_pressed.png
│ │ ├── selector_bg_cell.xml
│ │ ├── selector_bg_tabs.xml
│ │ ├── selector_btn_back.xml
│ │ ├── selector_btn_left.xml
│ │ ├── selector_btn_refresh.xml
│ │ ├── selector_btn_right.xml
│ │ ├── settings.png
│ │ └── standings.png
│ │ ├── layout
│ │ ├── activity4fragment_my.xml
│ │ ├── activity_welcome.xml
│ │ ├── content_main.xml
│ │ ├── fragment_about.xml
│ │ ├── fragment_guide.xml
│ │ ├── fragment_kcharts.xml
│ │ ├── fragment_times.xml
│ │ ├── selector_text_color.xml
│ │ ├── tab_about.xml
│ │ ├── tab_guide.xml
│ │ ├── tab_kcharts.xml
│ │ └── tab_times.xml
│ │ ├── menu
│ │ └── menu_main.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ │ ├── values-v21
│ │ └── styles.xml
│ │ ├── values-w820dp
│ │ └── dimens.xml
│ │ └── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── example
│ └── zhangchen
│ └── stock
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /local.properties
3 | /.idea/workspace.xml
4 | /.idea/libraries
5 | .DS_Store
6 | /build
7 | /captures
8 |
--------------------------------------------------------------------------------
/.idea/.name:
--------------------------------------------------------------------------------
1 | Stock
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
18 |
19 |
--------------------------------------------------------------------------------
/.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 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.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 | ## 基于开源的股票交易软件
2 |
--------------------------------------------------------------------------------
/Stock.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/app.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | generateDebugAndroidTestSources
19 | generateDebugSources
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 22
5 | buildToolsVersion "22.0.1"
6 |
7 | defaultConfig {
8 | applicationId "com.example.zhangchen.stock"
9 | minSdkVersion 15
10 | targetSdkVersion 22
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | testCompile 'junit:junit:4.12'
25 | compile 'com.android.support:appcompat-v7:22.2.1'
26 | compile 'com.android.support:design:22.2.1'
27 | }
28 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\Installation\adt-bundle-windows\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/example/zhangchen/stock/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.example.zhangchen.stock;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 | android:versionCode="1"
6 | android:versionName="V1.1.0" >
7 |
8 |
11 |
12 |
17 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/zhangchen/stock/futures/AboutFragment.java:
--------------------------------------------------------------------------------
1 | package com.example.zhangchen.stock.futures;
2 |
3 | import android.os.Bundle;
4 | import android.support.v4.app.Fragment;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | import com.example.zhangchen.stock.R;
10 |
11 | public class AboutFragment extends Fragment {
12 |
13 | @Override
14 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
15 | View view = inflater.inflate(R.layout.fragment_about, null);
16 |
17 | return view;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/zhangchen/stock/futures/GuideFragment.java:
--------------------------------------------------------------------------------
1 | package com.example.zhangchen.stock.futures;
2 |
3 | import android.os.Bundle;
4 | import android.support.v4.app.Fragment;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | import com.example.zhangchen.stock.R;
10 |
11 | public class GuideFragment extends Fragment {
12 |
13 | @Override
14 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
15 | View view = inflater.inflate(R.layout.fragment_guide, null);
16 |
17 | return view;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/zhangchen/stock/futures/KChartsFragment.java:
--------------------------------------------------------------------------------
1 | package com.example.zhangchen.stock.futures;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import android.os.Bundle;
7 | import android.support.v4.app.Fragment;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 |
12 | import com.android.futures.entity.OHLCEntity;
13 | import com.android.futures.view.KChartsView;
14 |
15 | public class KChartsFragment extends Fragment {
16 | private KChartsView mMyChartsView;
17 |
18 | @Override
19 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
20 | View view = inflater.inflate(R.layout.fragment_kcharts, null);
21 | mMyChartsView = (KChartsView) view.findViewById(R.id.my_charts_view);
22 |
23 | List ohlc = new ArrayList();
24 | ohlc.add(new OHLCEntity(246, 248, 235, 235, "20110825"));
25 | ohlc.add(new OHLCEntity(240, 242, 236, 242, "20110824"));
26 | ohlc.add(new OHLCEntity(236, 240, 235, 240, "20110823"));
27 | ohlc.add(new OHLCEntity(232, 236, 231, 236, "20110822"));
28 | ohlc.add(new OHLCEntity(240, 240, 235, 235, "20110819"));
29 | ohlc.add(new OHLCEntity(240, 241, 239, 240, "20110818"));
30 | ohlc.add(new OHLCEntity(242, 243, 240, 240, "20110817"));
31 | ohlc.add(new OHLCEntity(239, 242, 238, 242, "20110816"));
32 | ohlc.add(new OHLCEntity(239, 240, 238, 239, "20110815"));
33 | ohlc.add(new OHLCEntity(230, 238, 230, 238, "20110812"));
34 | ohlc.add(new OHLCEntity(236, 237, 234, 234, "20110811"));
35 | ohlc.add(new OHLCEntity(226, 233, 223, 232, "20110810"));
36 | ohlc.add(new OHLCEntity(239, 241, 229, 232, "20110809"));
37 | ohlc.add(new OHLCEntity(242, 244, 240, 242, "20110808"));
38 | ohlc.add(new OHLCEntity(248, 249, 247, 248, "20110805"));
39 | ohlc.add(new OHLCEntity(245, 248, 245, 247, "20110804"));
40 | ohlc.add(new OHLCEntity(249, 249, 245, 247, "20110803"));
41 | ohlc.add(new OHLCEntity(249, 251, 248, 250, "20110802"));
42 | ohlc.add(new OHLCEntity(250, 252, 248, 250, "20110801"));
43 | ohlc.add(new OHLCEntity(250, 251, 248, 250, "20110729"));
44 | ohlc.add(new OHLCEntity(249, 252, 248, 252, "20110728"));
45 | ohlc.add(new OHLCEntity(248, 250, 247, 250, "20110727"));
46 | ohlc.add(new OHLCEntity(256, 256, 248, 248, "20110726"));
47 | ohlc.add(new OHLCEntity(257, 258, 256, 257, "20110725"));
48 | ohlc.add(new OHLCEntity(259, 260, 256, 256, "20110722"));
49 | ohlc.add(new OHLCEntity(261, 261, 257, 259, "20110721"));
50 | ohlc.add(new OHLCEntity(260, 260, 259, 259, "20110720"));
51 | ohlc.add(new OHLCEntity(262, 262, 260, 261, "20110719"));
52 | ohlc.add(new OHLCEntity(260, 262, 259, 262, "20110718"));
53 | ohlc.add(new OHLCEntity(259, 261, 258, 261, "20110715"));
54 | ohlc.add(new OHLCEntity(255, 259, 255, 259, "20110714"));
55 | ohlc.add(new OHLCEntity(258, 258, 255, 255, "20110713"));
56 | ohlc.add(new OHLCEntity(258, 260, 258, 260, "20110712"));
57 | ohlc.add(new OHLCEntity(259, 260, 258, 259, "20110711"));
58 | ohlc.add(new OHLCEntity(261, 262, 259, 259, "20110708"));
59 | ohlc.add(new OHLCEntity(261, 261, 258, 261, "20110707"));
60 | ohlc.add(new OHLCEntity(261, 261, 259, 261, "20110706"));
61 | ohlc.add(new OHLCEntity(257, 261, 257, 261, "20110705"));
62 | ohlc.add(new OHLCEntity(256, 257, 255, 255, "20110704"));
63 | ohlc.add(new OHLCEntity(253, 257, 253, 256, "20110701"));
64 | ohlc.add(new OHLCEntity(255, 255, 252, 252, "20110630"));
65 | ohlc.add(new OHLCEntity(256, 256, 253, 255, "20110629"));
66 | ohlc.add(new OHLCEntity(254, 256, 254, 255, "20110628"));
67 | ohlc.add(new OHLCEntity(247, 256, 247, 254, "20110627"));
68 | ohlc.add(new OHLCEntity(244, 249, 243, 248, "20110624"));
69 | ohlc.add(new OHLCEntity(244, 245, 243, 244, "20110623"));
70 | ohlc.add(new OHLCEntity(242, 244, 241, 244, "20110622"));
71 | ohlc.add(new OHLCEntity(243, 243, 241, 242, "20110621"));
72 | ohlc.add(new OHLCEntity(246, 247, 244, 244, "20110620"));
73 | ohlc.add(new OHLCEntity(248, 249, 246, 246, "20110617"));
74 | ohlc.add(new OHLCEntity(251, 253, 250, 250, "20110616"));
75 | ohlc.add(new OHLCEntity(249, 253, 249, 253, "20110615"));
76 | ohlc.add(new OHLCEntity(248, 250, 246, 250, "20110614"));
77 | ohlc.add(new OHLCEntity(249, 250, 247, 250, "20110613"));
78 | ohlc.add(new OHLCEntity(254, 254, 250, 250, "20110610"));
79 | ohlc.add(new OHLCEntity(254, 255, 251, 255, "20110609"));
80 | ohlc.add(new OHLCEntity(252, 254, 251, 254, "20110608"));
81 | ohlc.add(new OHLCEntity(250, 253, 250, 252, "20110607"));
82 | ohlc.add(new OHLCEntity(251, 252, 247, 250, "20110603"));
83 | ohlc.add(new OHLCEntity(253, 254, 252, 254, "20110602"));
84 | ohlc.add(new OHLCEntity(250, 254, 250, 254, "20110601"));
85 | ohlc.add(new OHLCEntity(250, 252, 248, 250, "20110531"));
86 | ohlc.add(new OHLCEntity(253, 254, 250, 251, "20110530"));
87 | ohlc.add(new OHLCEntity(255, 256, 253, 253, "20110527"));
88 | ohlc.add(new OHLCEntity(256, 257, 253, 254, "20110526"));
89 | ohlc.add(new OHLCEntity(256, 257, 254, 256, "20110525"));
90 | ohlc.add(new OHLCEntity(265, 265, 257, 257, "20110524"));
91 | ohlc.add(new OHLCEntity(265, 266, 265, 265, "20110523"));
92 | ohlc.add(new OHLCEntity(267, 268, 265, 266, "20110520"));
93 | ohlc.add(new OHLCEntity(264, 267, 264, 267, "20110519"));
94 | ohlc.add(new OHLCEntity(264, 266, 262, 265, "20110518"));
95 | ohlc.add(new OHLCEntity(266, 267, 264, 264, "20110517"));
96 | ohlc.add(new OHLCEntity(264, 267, 263, 267, "20110516"));
97 | ohlc.add(new OHLCEntity(266, 267, 264, 264, "20110513"));
98 | ohlc.add(new OHLCEntity(269, 269, 266, 268, "20110512"));
99 | ohlc.add(new OHLCEntity(267, 269, 266, 269, "20110511"));
100 | ohlc.add(new OHLCEntity(266, 268, 266, 267, "20110510"));
101 | ohlc.add(new OHLCEntity(264, 268, 263, 266, "20110509"));
102 | ohlc.add(new OHLCEntity(265, 268, 265, 267, "20110506"));
103 | ohlc.add(new OHLCEntity(271, 271, 266, 266, "20110505"));
104 | ohlc.add(new OHLCEntity(271, 273, 269, 273, "20110504"));
105 | ohlc.add(new OHLCEntity(268, 271, 267, 271, "20110503"));
106 | ohlc.add(new OHLCEntity(273, 275, 268, 268, "20110429"));
107 | ohlc.add(new OHLCEntity(274, 276, 270, 272, "20110428"));
108 | ohlc.add(new OHLCEntity(275, 277, 273, 273, "20110427"));
109 | ohlc.add(new OHLCEntity(280, 280, 276, 276, "20110426"));
110 | ohlc.add(new OHLCEntity(282, 283, 280, 281, "20110425"));
111 | ohlc.add(new OHLCEntity(282, 283, 281, 282, "20110422"));
112 | ohlc.add(new OHLCEntity(280, 281, 279, 280, "20110421"));
113 | ohlc.add(new OHLCEntity(283, 283, 279, 279, "20110420"));
114 | ohlc.add(new OHLCEntity(284, 286, 283, 285, "20110419"));
115 | ohlc.add(new OHLCEntity(283, 286, 282, 285, "20110418"));
116 | ohlc.add(new OHLCEntity(285, 285, 283, 284, "20110415"));
117 | ohlc.add(new OHLCEntity(280, 285, 279, 285, "20110414"));
118 | ohlc.add(new OHLCEntity(281, 283, 280, 282, "20110413"));
119 | ohlc.add(new OHLCEntity(283, 286, 282, 282, "20110412"));
120 | ohlc.add(new OHLCEntity(280, 283, 279, 283, "20110411"));
121 | ohlc.add(new OHLCEntity(280, 281, 279, 280, "20110408"));
122 | ohlc.add(new OHLCEntity(276, 280, 276, 280, "20110407"));
123 | ohlc.add(new OHLCEntity(273, 276, 272, 276, "20110406"));
124 | ohlc.add(new OHLCEntity(275, 276, 271, 272, "20110404"));
125 | ohlc.add(new OHLCEntity(275, 276, 273, 275, "20110401"));
126 |
127 | mMyChartsView.setOHLCData(ohlc);
128 | mMyChartsView.setLowerChartTabTitles(new String[] { "MACD", "KDJ", "RSI" });
129 | mMyChartsView.postInvalidate();
130 |
131 | return view;
132 | }
133 | }
134 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/zhangchen/stock/futures/MyFragmentActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.zhangchen.stock.futures;
2 |
3 | import android.app.AlertDialog;
4 | import android.app.ProgressDialog;
5 | import android.content.DialogInterface;
6 | import android.os.Bundle;
7 | import android.os.Handler;
8 | import android.os.Message;
9 | import android.support.v4.app.FragmentActivity;
10 | import android.support.v4.app.FragmentTabHost;
11 | import android.view.KeyEvent;
12 | import android.view.View;
13 | import android.view.View.OnClickListener;
14 | import android.widget.Button;
15 | import android.widget.Toast;
16 |
17 | public class MyFragmentActivity extends FragmentActivity implements OnClickListener, Handler.Callback {
18 | private static final Integer[] TABS = new Integer[] { R.layout.tab_times, R.layout.tab_kcharts, R.layout.tab_guide,
19 | R.layout.tab_about };
20 | private static final int WHAT = 1987;
21 | private Button mBack;
22 | private Button mLeft;
23 | private Button mRight;
24 | private Button mRefresh;
25 | private ProgressDialog mProgressDialog;
26 | private long mExitTime;
27 |
28 | @Override
29 | protected void onCreate(Bundle bundle) {
30 | super.onCreate(bundle);
31 | setContentView(R.layout.activity4fragment_my);
32 | initViews();
33 |
34 | FragmentTabHost tabHost = (FragmentTabHost) findViewById(android.R.id.tabhost);
35 | tabHost.setup(this, getSupportFragmentManager(), R.id.frame_content);
36 |
37 | tabHost.addTab(
38 | tabHost.newTabSpec(String.valueOf(TABS[0])).setIndicator(getLayoutInflater().inflate(TABS[0], null)),
39 | TimesFragment.class, null);
40 | tabHost.addTab(
41 | tabHost.newTabSpec(String.valueOf(TABS[1])).setIndicator(getLayoutInflater().inflate(TABS[1], null)),
42 | KChartsFragment.class, null);
43 | tabHost.addTab(
44 | tabHost.newTabSpec(String.valueOf(TABS[2])).setIndicator(getLayoutInflater().inflate(TABS[2], null)),
45 | GuideFragment.class, null);
46 | tabHost.addTab(
47 | tabHost.newTabSpec(String.valueOf(TABS[3])).setIndicator(getLayoutInflater().inflate(TABS[3], null)),
48 | AboutFragment.class, null);
49 | }
50 |
51 | private void initViews() {
52 | mBack = (Button) findViewById(R.id.title_back_btn);
53 | mBack.setOnClickListener(this);
54 | mLeft = (Button) findViewById(R.id.title_left_btn);
55 | mLeft.setOnClickListener(this);
56 | mRight = (Button) findViewById(R.id.title_right_btn);
57 | mRight.setOnClickListener(this);
58 | mRefresh = (Button) findViewById(R.id.title_refresh_btn);
59 | mRefresh.setOnClickListener(this);
60 |
61 | }
62 |
63 | @Override
64 | public boolean onKeyDown(int keyCode, KeyEvent event) {
65 | switch (keyCode) {
66 | case KeyEvent.KEYCODE_BACK:
67 | if ((System.currentTimeMillis() - mExitTime) > 2000) {
68 | Toast.makeText(getApplicationContext(), "More once back key to exit", Toast.LENGTH_SHORT).show();
69 | mExitTime = System.currentTimeMillis();
70 | } else {
71 | finish();
72 | }
73 | break;
74 |
75 | default:
76 | return super.onKeyDown(keyCode, event);
77 | }
78 | return true;
79 | }
80 |
81 | public void onClick(View view) {
82 | switch (view.getId()) {
83 | case R.id.title_back_btn:
84 | new AlertDialog.Builder(this).setTitle("退出").setMessage("确定要退出?")
85 | .setPositiveButton("退出", new DialogInterface.OnClickListener() {
86 |
87 | public void onClick(DialogInterface dialog, int which) {
88 | finish();
89 |
90 | }
91 | }).setNegativeButton("取消", new DialogInterface.OnClickListener() {
92 |
93 | public void onClick(DialogInterface dialog, int which) {
94 |
95 | }
96 | }).create().show();
97 | break;
98 |
99 | case R.id.title_left_btn:
100 | Toast.makeText(this, "Left", Toast.LENGTH_SHORT).show();
101 | break;
102 |
103 | case R.id.title_right_btn:
104 | Toast.makeText(this, "Right", Toast.LENGTH_SHORT).show();
105 | break;
106 |
107 | case R.id.title_refresh_btn:
108 | mProgressDialog = new ProgressDialog(this);
109 | mProgressDialog.setTitle("刷新");
110 | mProgressDialog.setMessage("正在刷新,请稍候…");
111 | mProgressDialog.show();
112 | Handler handler = new Handler(this);
113 | handler.sendEmptyMessageDelayed(WHAT, 3 * 1000);
114 | break;
115 |
116 | default:
117 | break;
118 | }
119 |
120 | }
121 |
122 | public boolean handleMessage(Message msg) {
123 | if (msg.what == WHAT) {
124 | if (mProgressDialog != null) {
125 | mProgressDialog.dismiss();
126 | return true;
127 | }
128 | }
129 | return false;
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/zhangchen/stock/futures/TimesFragment.java:
--------------------------------------------------------------------------------
1 | package com.example.zhangchen.stock.futures;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import org.json.JSONArray;
7 | import org.json.JSONException;
8 | import org.json.JSONObject;
9 |
10 | import android.content.Context;
11 | import android.os.Bundle;
12 | import android.support.v4.app.Fragment;
13 | import android.view.LayoutInflater;
14 | import android.view.View;
15 | import android.view.ViewGroup;
16 | import android.widget.Toast;
17 |
18 | import com.android.futures.entity.TimesEntity;
19 | import com.android.futures.view.TimesView;
20 |
21 | public class TimesFragment extends Fragment {
22 | private TimesView mTimesView;
23 | private JSONArray mDatas;
24 | private Context mContext;
25 |
26 | @Override
27 | public void onCreate(Bundle savedInstanceState) {
28 | super.onCreate(savedInstanceState);
29 | mContext = getActivity();
30 | try {
31 | mDatas = new JSONObject(
32 | "{\"error\":\"成功\",\"status\":0,\"data\":[{\"changeAmount\":5,\"weightedIndex\":6855,\"time\":\"09:31\",\"sell\":970,\"buy\":970,\"volume\":30,\"changeRate\":0.073,\"nonWeightedIndex\":6855},{\"changeAmount\":6,\"weightedIndex\":6855,\"time\":\"09:32\",\"sell\":590,\"buy\":590,\"volume\":40,\"changeRate\":0.088,\"nonWeightedIndex\":6855},{\"changeAmount\":6,\"weightedIndex\":6855,\"time\":\"09:33\",\"sell\":580,\"buy\":580,\"volume\":40,\"changeRate\":0.088,\"nonWeightedIndex\":6856},{\"changeAmount\":7,\"weightedIndex\":6856,\"time\":\"09:34\",\"sell\":626,\"buy\":626,\"volume\":54,\"changeRate\":0.102,\"nonWeightedIndex\":6856},{\"changeAmount\":7,\"weightedIndex\":6856,\"time\":\"09:35\",\"sell\":756,\"buy\":756,\"volume\":54,\"changeRate\":0.102,\"nonWeightedIndex\":6857},{\"changeAmount\":8,\"weightedIndex\":6856,\"time\":\"09:36\",\"sell\":778,\"buy\":778,\"volume\":66,\"changeRate\":0.117,\"nonWeightedIndex\":6857},{\"changeAmount\":8,\"weightedIndex\":6856,\"time\":\"09:37\",\"sell\":708,\"buy\":708,\"volume\":66,\"changeRate\":0.117,\"nonWeightedIndex\":6858},{\"changeAmount\":8,\"weightedIndex\":6856,\"time\":\"09:38\",\"sell\":708,\"buy\":708,\"volume\":66,\"changeRate\":0.117,\"nonWeightedIndex\":6858},{\"changeAmount\":9,\"weightedIndex\":6857,\"time\":\"09:39\",\"sell\":684,\"buy\":684,\"volume\":78,\"changeRate\":0.131,\"nonWeightedIndex\":6858},{\"changeAmount\":9,\"weightedIndex\":6857,\"time\":\"09:40\",\"sell\":696,\"buy\":696,\"volume\":88,\"changeRate\":0.131,\"nonWeightedIndex\":6859},{\"changeAmount\":9,\"weightedIndex\":6857,\"time\":\"09:41\",\"sell\":580,\"buy\":580,\"volume\":88,\"changeRate\":0.131,\"nonWeightedIndex\":6859},{\"changeAmount\":10,\"weightedIndex\":6857,\"time\":\"09:42\",\"sell\":540,\"buy\":540,\"volume\":98,\"changeRate\":0.146,\"nonWeightedIndex\":6859},{\"changeAmount\":10,\"weightedIndex\":6857,\"time\":\"09:43\",\"sell\":570,\"buy\":570,\"volume\":98,\"changeRate\":0.146,\"nonWeightedIndex\":6860},{\"changeAmount\":12,\"weightedIndex\":6858,\"time\":\"09:44\",\"sell\":1040,\"buy\":1040,\"volume\":118,\"changeRate\":0.175,\"nonWeightedIndex\":6861},{\"changeAmount\":12,\"weightedIndex\":6858,\"time\":\"09:45\",\"sell\":1180,\"buy\":1180,\"volume\":118,\"changeRate\":0.175,\"nonWeightedIndex\":6862},{\"changeAmount\":10,\"weightedIndex\":6858,\"time\":\"09:46\",\"sell\":928,\"buy\":928,\"volume\":130,\"changeRate\":0.146,\"nonWeightedIndex\":6861},{\"changeAmount\":10,\"weightedIndex\":6858,\"time\":\"09:47\",\"sell\":708,\"buy\":708,\"volume\":130,\"changeRate\":0.146,\"nonWeightedIndex\":6860},{\"changeAmount\":9,\"weightedIndex\":6858,\"time\":\"09:48\",\"sell\":596,\"buy\":596,\"volume\":140,\"changeRate\":0.131,\"nonWeightedIndex\":6859},{\"changeAmount\":9,\"weightedIndex\":6858,\"time\":\"09:49\",\"sell\":590,\"buy\":590,\"volume\":140,\"changeRate\":0.131,\"nonWeightedIndex\":6859},{\"changeAmount\":10,\"weightedIndex\":6858,\"time\":\"09:50\",\"sell\":560,\"buy\":560,\"volume\":150,\"changeRate\":0.146,\"nonWeightedIndex\":6859},{\"changeAmount\":8,\"weightedIndex\":6858,\"time\":\"09:51\",\"sell\":608,\"buy\":608,\"volume\":162,\"changeRate\":0.117,\"nonWeightedIndex\":6859},{\"changeAmount\":8,\"weightedIndex\":6858,\"time\":\"09:52\",\"sell\":708,\"buy\":708,\"volume\":162,\"changeRate\":0.117,\"nonWeightedIndex\":6858},{\"changeAmount\":8,\"weightedIndex\":6858,\"time\":\"09:53\",\"sell\":708,\"buy\":708,\"volume\":174,\"changeRate\":0.117,\"nonWeightedIndex\":6858},{\"changeAmount\":9,\"weightedIndex\":6858,\"time\":\"09:54\",\"sell\":636,\"buy\":636,\"volume\":182,\"changeRate\":0.131,\"nonWeightedIndex\":6858},{\"changeAmount\":9,\"weightedIndex\":6858,\"time\":\"09:55\",\"sell\":488,\"buy\":488,\"volume\":182,\"changeRate\":0.131,\"nonWeightedIndex\":6859},{\"changeAmount\":7,\"weightedIndex\":6858,\"time\":\"09:56\",\"sell\":496,\"buy\":496,\"volume\":196,\"changeRate\":0.102,\"nonWeightedIndex\":6858},{\"changeAmount\":7,\"weightedIndex\":6858,\"time\":\"09:57\",\"sell\":756,\"buy\":756,\"volume\":196,\"changeRate\":0.102,\"nonWeightedIndex\":6857},{\"changeAmount\":8,\"weightedIndex\":6858,\"time\":\"09:58\",\"sell\":796,\"buy\":796,\"volume\":206,\"changeRate\":0.117,\"nonWeightedIndex\":6857},{\"changeAmount\":8,\"weightedIndex\":6858,\"time\":\"09:59\",\"sell\":610,\"buy\":610,\"volume\":206,\"changeRate\":0.117,\"nonWeightedIndex\":6858},{\"changeAmount\":6,\"weightedIndex\":6858,\"time\":\"10:00\",\"sell\":640,\"buy\":640,\"volume\":226,\"changeRate\":0.088,\"nonWeightedIndex\":6857},{\"changeAmount\":6,\"weightedIndex\":6858,\"time\":\"10:01\",\"sell\":1120,\"buy\":1120,\"volume\":226,\"changeRate\":0.088,\"nonWeightedIndex\":6856},{\"changeAmount\":5,\"weightedIndex\":6858,\"time\":\"10:02\",\"sell\":664,\"buy\":664,\"volume\":234,\"changeRate\":0.073,\"nonWeightedIndex\":6855},{\"changeAmount\":4,\"weightedIndex\":6858,\"time\":\"10:03\",\"sell\":664,\"buy\":664,\"volume\":254,\"changeRate\":0.058,\"nonWeightedIndex\":6854},{\"changeAmount\":4,\"weightedIndex\":6858,\"time\":\"10:04\",\"sell\":1180,\"buy\":1180,\"volume\":254,\"changeRate\":0.058,\"nonWeightedIndex\":6854},{\"changeAmount\":5,\"weightedIndex\":6858,\"time\":\"10:05\",\"sell\":850,\"buy\":850,\"volume\":264,\"changeRate\":0.073,\"nonWeightedIndex\":6854},{\"changeAmount\":5,\"weightedIndex\":6858,\"time\":\"10:06\",\"sell\":590,\"buy\":590,\"volume\":264,\"changeRate\":0.073,\"nonWeightedIndex\":6855},{\"changeAmount\":5,\"weightedIndex\":6858,\"time\":\"10:07\",\"sell\":590,\"buy\":590,\"volume\":264,\"changeRate\":0.073,\"nonWeightedIndex\":6855},{\"changeAmount\":6,\"weightedIndex\":6857,\"time\":\"10:08\",\"sell\":492,\"buy\":492,\"volume\":272,\"changeRate\":0.088,\"nonWeightedIndex\":6855},{\"changeAmount\":6,\"weightedIndex\":6857,\"time\":\"10:09\",\"sell\":448,\"buy\":448,\"volume\":272,\"changeRate\":0.088,\"nonWeightedIndex\":6856},{\"changeAmount\":7,\"weightedIndex\":6857,\"time\":\"10:10\",\"sell\":480,\"buy\":480,\"volume\":284,\"changeRate\":0.102,\"nonWeightedIndex\":6856},{\"changeAmount\":7,\"weightedIndex\":6857,\"time\":\"10:11\",\"sell\":708,\"buy\":708,\"volume\":284,\"changeRate\":0.102,\"nonWeightedIndex\":6857},{\"changeAmount\":7,\"weightedIndex\":6857,\"time\":\"10:12\",\"sell\":660,\"buy\":660,\"volume\":284,\"changeRate\":0.102,\"nonWeightedIndex\":6857},{\"changeAmount\":5,\"weightedIndex\":6857,\"time\":\"10:13\",\"sell\":784,\"buy\":784,\"volume\":298,\"changeRate\":0.073,\"nonWeightedIndex\":6855},{\"changeAmount\":5,\"weightedIndex\":6857,\"time\":\"10:14\",\"sell\":826,\"buy\":826,\"volume\":298,\"changeRate\":0.073,\"nonWeightedIndex\":6855},{\"changeAmount\":4,\"weightedIndex\":6857,\"time\":\"10:15\",\"sell\":800,\"buy\":800,\"volume\":308,\"changeRate\":0.058,\"nonWeightedIndex\":6854},{\"changeAmount\":4,\"weightedIndex\":6857,\"time\":\"10:16\",\"sell\":560,\"buy\":560,\"volume\":308,\"changeRate\":0.058,\"nonWeightedIndex\":6854},{\"changeAmount\":4,\"weightedIndex\":6857,\"time\":\"10:17\",\"sell\":590,\"buy\":590,\"volume\":308,\"changeRate\":0.058,\"nonWeightedIndex\":6854},{\"changeAmount\":3,\"weightedIndex\":6857,\"time\":\"10:18\",\"sell\":788,\"buy\":788,\"volume\":324,\"changeRate\":0.044,\"nonWeightedIndex\":6853},{\"changeAmount\":3,\"weightedIndex\":6857,\"time\":\"10:19\",\"sell\":944,\"buy\":944,\"volume\":324,\"changeRate\":0.044,\"nonWeightedIndex\":6853},{\"changeAmount\":3,\"weightedIndex\":6857,\"time\":\"10:20\",\"sell\":764,\"buy\":764,\"volume\":334,\"changeRate\":0.044,\"nonWeightedIndex\":6853},{\"changeAmount\":3,\"weightedIndex\":6857,\"time\":\"10:21\",\"sell\":590,\"buy\":590,\"volume\":334,\"changeRate\":0.044,\"nonWeightedIndex\":6853},{\"changeAmount\":1,\"weightedIndex\":6857,\"time\":\"10:22\",\"sell\":746,\"buy\":746,\"volume\":356,\"changeRate\":0.015,\"nonWeightedIndex\":6852},{\"changeAmount\":1,\"weightedIndex\":6857,\"time\":\"10:23\",\"sell\":1298,\"buy\":1298,\"volume\":356,\"changeRate\":0.015,\"nonWeightedIndex\":6851},{\"changeAmount\":1,\"weightedIndex\":6856,\"time\":\"10:24\",\"sell\":754,\"buy\":754,\"volume\":366,\"changeRate\":0.015,\"nonWeightedIndex\":6851},{\"changeAmount\":1,\"weightedIndex\":6856,\"time\":\"10:25\",\"sell\":590,\"buy\":590,\"volume\":366,\"changeRate\":0.015,\"nonWeightedIndex\":6851},{\"changeAmount\":0,\"weightedIndex\":6856,\"time\":\"10:26\",\"sell\":590,\"buy\":590,\"volume\":376,\"changeRate\":0,\"nonWeightedIndex\":6850},{\"changeAmount\":0,\"weightedIndex\":6856,\"time\":\"10:27\",\"sell\":514,\"buy\":514,\"volume\":384,\"changeRate\":0,\"nonWeightedIndex\":6850},{\"changeAmount\":0,\"weightedIndex\":6856,\"time\":\"10:28\",\"sell\":472,\"buy\":472,\"volume\":384,\"changeRate\":0,\"nonWeightedIndex\":6850},{\"changeAmount\":0,\"weightedIndex\":6856,\"time\":\"10:29\",\"sell\":472,\"buy\":472,\"volume\":384,\"changeRate\":0,\"nonWeightedIndex\":6850},{\"changeAmount\":2,\"weightedIndex\":6856,\"time\":\"10:30\",\"sell\":464,\"buy\":464,\"volume\":392,\"changeRate\":0.029,\"nonWeightedIndex\":6851},{\"changeAmount\":2,\"weightedIndex\":6856,\"time\":\"10:31\",\"sell\":432,\"buy\":432,\"volume\":392,\"changeRate\":0.029,\"nonWeightedIndex\":6852},{\"changeAmount\":3,\"weightedIndex\":6856,\"time\":\"10:32\",\"sell\":660,\"buy\":660,\"volume\":404,\"changeRate\":0.044,\"nonWeightedIndex\":6852},{\"changeAmount\":3,\"weightedIndex\":6856,\"time\":\"10:33\",\"sell\":708,\"buy\":708,\"volume\":404,\"changeRate\":0.044,\"nonWeightedIndex\":6853},{\"changeAmount\":4,\"weightedIndex\":6856,\"time\":\"10:34\",\"sell\":604,\"buy\":604,\"volume\":412,\"changeRate\":0.058,\"nonWeightedIndex\":6853},{\"changeAmount\":4,\"weightedIndex\":6856,\"time\":\"10:35\",\"sell\":448,\"buy\":448,\"volume\":412,\"changeRate\":0.058,\"nonWeightedIndex\":6854},{\"changeAmount\":2,\"weightedIndex\":6856,\"time\":\"10:36\",\"sell\":540,\"buy\":540,\"volume\":422,\"changeRate\":0.029,\"nonWeightedIndex\":6852},{\"changeAmount\":2,\"weightedIndex\":6856,\"time\":\"10:37\",\"sell\":590,\"buy\":590,\"volume\":422,\"changeRate\":0.029,\"nonWeightedIndex\":6852},{\"changeAmount\":2,\"weightedIndex\":6856,\"time\":\"10:38\",\"sell\":560,\"buy\":560,\"volume\":422,\"changeRate\":0.029,\"nonWeightedIndex\":6852},{\"changeAmount\":3,\"weightedIndex\":6856,\"time\":\"10:39\",\"sell\":590,\"buy\":590,\"volume\":432,\"changeRate\":0.044,\"nonWeightedIndex\":6852},{\"changeAmount\":4,\"weightedIndex\":6856,\"time\":\"10:40\",\"sell\":588,\"buy\":588,\"volume\":440,\"changeRate\":0.058,\"nonWeightedIndex\":6853},{\"changeAmount\":4,\"weightedIndex\":6856,\"time\":\"10:41\",\"sell\":472,\"buy\":472,\"volume\":440,\"changeRate\":0.058,\"nonWeightedIndex\":6854},{\"changeAmount\":4,\"weightedIndex\":6856,\"time\":\"10:42\",\"sell\":440,\"buy\":440,\"volume\":440,\"changeRate\":0.058,\"nonWeightedIndex\":6854},{\"changeAmount\":3,\"weightedIndex\":6856,\"time\":\"10:43\",\"sell\":472,\"buy\":472,\"volume\":448,\"changeRate\":0.044,\"nonWeightedIndex\":6853},{\"changeAmount\":3,\"weightedIndex\":6856,\"time\":\"10:44\",\"sell\":472,\"buy\":472,\"volume\":448,\"changeRate\":0.044,\"nonWeightedIndex\":6853},{\"changeAmount\":3,\"weightedIndex\":6856,\"time\":\"10:45\",\"sell\":472,\"buy\":472,\"volume\":448,\"changeRate\":0.044,\"nonWeightedIndex\":6853},{\"changeAmount\":2,\"weightedIndex\":6856,\"time\":\"10:46\",\"sell\":532,\"buy\":532,\"volume\":458,\"changeRate\":0.029,\"nonWeightedIndex\":6852},{\"changeAmount\":2,\"weightedIndex\":6856,\"time\":\"10:47\",\"sell\":590,\"buy\":590,\"volume\":458,\"changeRate\":0.029,\"nonWeightedIndex\":6852},{\"changeAmount\":1,\"weightedIndex\":6855,\"time\":\"10:48\",\"sell\":490,\"buy\":490,\"volume\":466,\"changeRate\":0.015,\"nonWeightedIndex\":6851},{\"changeAmount\":1,\"weightedIndex\":6855,\"time\":\"10:49\",\"sell\":448,\"buy\":448,\"volume\":466,\"changeRate\":0.015,\"nonWeightedIndex\":6851},{\"changeAmount\":1,\"weightedIndex\":6855,\"time\":\"10:50\",\"sell\":472,\"buy\":472,\"volume\":466,\"changeRate\":0.015,\"nonWeightedIndex\":6851},{\"changeAmount\":1,\"weightedIndex\":6855,\"time\":\"10:51\",\"sell\":472,\"buy\":472,\"volume\":466,\"changeRate\":0.015,\"nonWeightedIndex\":6851},{\"changeAmount\":1,\"weightedIndex\":6855,\"time\":\"10:52\",\"sell\":472,\"buy\":472,\"volume\":466,\"changeRate\":0.015,\"nonWeightedIndex\":6851},{\"changeAmount\":1,\"weightedIndex\":6855,\"time\":\"10:53\",\"sell\":448,\"buy\":448,\"volume\":466,\"changeRate\":0.015,\"nonWeightedIndex\":6851},{\"changeAmount\":1,\"weightedIndex\":6855,\"time\":\"10:54\",\"sell\":472,\"buy\":472,\"volume\":466,\"changeRate\":0.015,\"nonWeightedIndex\":6851},{\"changeAmount\":1,\"weightedIndex\":6855,\"time\":\"10:55\",\"sell\":472,\"buy\":472,\"volume\":466,\"changeRate\":0.015,\"nonWeightedIndex\":6851},{\"changeAmount\":-1,\"weightedIndex\":6855,\"time\":\"10:56\",\"sell\":536,\"buy\":536,\"volume\":486,\"changeRate\":-0.015,\"nonWeightedIndex\":6850},{\"changeAmount\":-2,\"weightedIndex\":6855,\"time\":\"10:57\",\"sell\":1168,\"buy\":1168,\"volume\":500,\"changeRate\":-0.029,\"nonWeightedIndex\":6848},{\"changeAmount\":-2,\"weightedIndex\":6855,\"time\":\"10:58\",\"sell\":826,\"buy\":826,\"volume\":500,\"changeRate\":-0.029,\"nonWeightedIndex\":6848},{\"changeAmount\":-2,\"weightedIndex\":6855,\"time\":\"10:59\",\"sell\":826,\"buy\":826,\"volume\":500,\"changeRate\":-0.029,\"nonWeightedIndex\":6848},{\"changeAmount\":-1,\"weightedIndex\":6855,\"time\":\"11:00\",\"sell\":666,\"buy\":666,\"volume\":510,\"changeRate\":-0.015,\"nonWeightedIndex\":6848},{\"changeAmount\":-1,\"weightedIndex\":6855,\"time\":\"11:01\",\"sell\":560,\"buy\":560,\"volume\":510,\"changeRate\":-0.015,\"nonWeightedIndex\":6849},{\"changeAmount\":-1,\"weightedIndex\":6855,\"time\":\"11:02\",\"sell\":590,\"buy\":590,\"volume\":510,\"changeRate\":-0.015,\"nonWeightedIndex\":6849},{\"changeAmount\":-1,\"weightedIndex\":6855,\"time\":\"11:03\",\"sell\":468,\"buy\":468,\"volume\":518,\"changeRate\":-0.015,\"nonWeightedIndex\":6849},{\"changeAmount\":0,\"weightedIndex\":6855,\"time\":\"11:04\",\"sell\":348,\"buy\":348,\"volume\":522,\"changeRate\":0,\"nonWeightedIndex\":6849},{\"changeAmount\":0,\"weightedIndex\":6855,\"time\":\"11:05\",\"sell\":228,\"buy\":228,\"volume\":522,\"changeRate\":0,\"nonWeightedIndex\":6850},{\"changeAmount\":-1,\"weightedIndex\":6855,\"time\":\"11:06\",\"sell\":434,\"buy\":434,\"volume\":532,\"changeRate\":-0.015,\"nonWeightedIndex\":6849},{\"changeAmount\":-1,\"weightedIndex\":6855,\"time\":\"11:07\",\"sell\":590,\"buy\":590,\"volume\":532,\"changeRate\":-0.015,\"nonWeightedIndex\":6849},{\"changeAmount\":-1,\"weightedIndex\":6855,\"time\":\"11:08\",\"sell\":560,\"buy\":560,\"volume\":532,\"changeRate\":-0.015,\"nonWeightedIndex\":6849},{\"changeAmount\":-1,\"weightedIndex\":6855,\"time\":\"11:09\",\"sell\":590,\"buy\":590,\"volume\":532,\"changeRate\":-0.015,\"nonWeightedIndex\":6849},{\"changeAmount\":-1,\"weightedIndex\":6855,\"time\":\"11:10\",\"sell\":590,\"buy\":590,\"volume\":532,\"changeRate\":-0.015,\"nonWeightedIndex\":6849},{\"changeAmount\":-1,\"weightedIndex\":6855,\"time\":\"11:11\",\"sell\":540,\"buy\":540,\"volume\":532,\"changeRate\":-0.015,\"nonWeightedIndex\":6849},{\"changeAmount\":-1,\"weightedIndex\":6855,\"time\":\"11:12\",\"sell\":590,\"buy\":590,\"volume\":532,\"changeRate\":-0.015,\"nonWeightedIndex\":6849},{\"changeAmount\":-2,\"weightedIndex\":6855,\"time\":\"11:13\",\"sell\":590,\"buy\":590,\"volume\":542,\"changeRate\":-0.029,\"nonWeightedIndex\":6848},{\"changeAmount\":-3,\"weightedIndex\":6854,\"time\":\"11:14\",\"sell\":610,\"buy\":610,\"volume\":554,\"changeRate\":-0.044,\"nonWeightedIndex\":6847},{\"changeAmount\":-4,\"weightedIndex\":6854,\"time\":\"11:15\",\"sell\":672,\"buy\":672,\"volume\":564,\"changeRate\":-0.058,\"nonWeightedIndex\":6847},{\"changeAmount\":-4,\"weightedIndex\":6854,\"time\":\"11:16\",\"sell\":590,\"buy\":590,\"volume\":564,\"changeRate\":-0.058,\"nonWeightedIndex\":6846},{\"changeAmount\":-4,\"weightedIndex\":6854,\"time\":\"11:17\",\"sell\":580,\"buy\":580,\"volume\":564,\"changeRate\":-0.058,\"nonWeightedIndex\":6846},{\"changeAmount\":-3,\"weightedIndex\":6854,\"time\":\"11:18\",\"sell\":590,\"buy\":590,\"volume\":574,\"changeRate\":-0.044,\"nonWeightedIndex\":6846},{\"changeAmount\":-3,\"weightedIndex\":6854,\"time\":\"11:19\",\"sell\":560,\"buy\":560,\"volume\":574,\"changeRate\":-0.044,\"nonWeightedIndex\":6847},{\"changeAmount\":-3,\"weightedIndex\":6854,\"time\":\"11:20\",\"sell\":590,\"buy\":590,\"volume\":574,\"changeRate\":-0.044,\"nonWeightedIndex\":6847},{\"changeAmount\":-5,\"weightedIndex\":6854,\"time\":\"11:21\",\"sell\":870,\"buy\":870,\"volume\":594,\"changeRate\":-0.073,\"nonWeightedIndex\":6845},{\"changeAmount\":-5,\"weightedIndex\":6854,\"time\":\"11:22\",\"sell\":1180,\"buy\":1180,\"volume\":594,\"changeRate\":-0.073,\"nonWeightedIndex\":6845},{\"changeAmount\":-5,\"weightedIndex\":6854,\"time\":\"11:23\",\"sell\":568,\"buy\":568,\"volume\":602,\"changeRate\":-0.073,\"nonWeightedIndex\":6845},{\"changeAmount\":-5,\"weightedIndex\":6854,\"time\":\"11:24\",\"sell\":472,\"buy\":472,\"volume\":602,\"changeRate\":-0.073,\"nonWeightedIndex\":6845},{\"changeAmount\":-4,\"weightedIndex\":6854,\"time\":\"11:25\",\"sell\":666,\"buy\":666,\"volume\":616,\"changeRate\":-0.058,\"nonWeightedIndex\":6845},{\"changeAmount\":-4,\"weightedIndex\":6854,\"time\":\"11:26\",\"sell\":756,\"buy\":756,\"volume\":616,\"changeRate\":-0.058,\"nonWeightedIndex\":6846},{\"changeAmount\":-3,\"weightedIndex\":6853,\"time\":\"11:27\",\"sell\":602,\"buy\":602,\"volume\":626,\"changeRate\":-0.044,\"nonWeightedIndex\":6846},{\"changeAmount\":-3,\"weightedIndex\":6853,\"time\":\"11:28\",\"sell\":590,\"buy\":590,\"volume\":626,\"changeRate\":-0.044,\"nonWeightedIndex\":6847},{\"changeAmount\":-5,\"weightedIndex\":6853,\"time\":\"11:29\",\"sell\":1070,\"buy\":1070,\"volume\":646,\"changeRate\":-0.073,\"nonWeightedIndex\":6845},{\"changeAmount\":-6,\"weightedIndex\":6853,\"time\":\"11:30\",\"sell\":1960,\"buy\":1960,\"volume\":686,\"changeRate\":-0.088,\"nonWeightedIndex\":6844},{\"changeAmount\":-6,\"weightedIndex\":6853,\"time\":\"13:31\",\"sell\":2360,\"buy\":2360,\"volume\":686,\"changeRate\":-0.088,\"nonWeightedIndex\":6844},{\"changeAmount\":-6,\"weightedIndex\":6852,\"time\":\"13:32\",\"sell\":1700,\"buy\":1700,\"volume\":696,\"changeRate\":-0.088,\"nonWeightedIndex\":6844},{\"changeAmount\":-6,\"weightedIndex\":6852,\"time\":\"13:33\",\"sell\":560,\"buy\":560,\"volume\":696,\"changeRate\":-0.088,\"nonWeightedIndex\":6844},{\"changeAmount\":-5,\"weightedIndex\":6852,\"time\":\"13:34\",\"sell\":632,\"buy\":632,\"volume\":708,\"changeRate\":-0.073,\"nonWeightedIndex\":6844},{\"changeAmount\":-5,\"weightedIndex\":6852,\"time\":\"13:35\",\"sell\":660,\"buy\":660,\"volume\":708,\"changeRate\":-0.073,\"nonWeightedIndex\":6845},{\"changeAmount\":-6,\"weightedIndex\":6852,\"time\":\"13:36\",\"sell\":756,\"buy\":756,\"volume\":728,\"changeRate\":-0.088,\"nonWeightedIndex\":6844},{\"changeAmount\":-6,\"weightedIndex\":6852,\"time\":\"13:37\",\"sell\":1180,\"buy\":1180,\"volume\":728,\"changeRate\":-0.088,\"nonWeightedIndex\":6844},{\"changeAmount\":-7,\"weightedIndex\":6852,\"time\":\"13:38\",\"sell\":1120,\"buy\":1120,\"volume\":750,\"changeRate\":-0.102,\"nonWeightedIndex\":6843},{\"changeAmount\":-7,\"weightedIndex\":6852,\"time\":\"13:39\",\"sell\":1298,\"buy\":1298,\"volume\":750,\"changeRate\":-0.102,\"nonWeightedIndex\":6843},{\"changeAmount\":-8,\"weightedIndex\":6852,\"time\":\"13:40\",\"sell\":1176,\"buy\":1176,\"volume\":764,\"changeRate\":-0.117,\"nonWeightedIndex\":6842},{\"changeAmount\":-8,\"weightedIndex\":6852,\"time\":\"13:41\",\"sell\":826,\"buy\":826,\"volume\":764,\"changeRate\":-0.117,\"nonWeightedIndex\":6842},{\"changeAmount\":-8,\"weightedIndex\":6852,\"time\":\"13:42\",\"sell\":826,\"buy\":826,\"volume\":764,\"changeRate\":-0.117,\"nonWeightedIndex\":6842},{\"changeAmount\":-10,\"weightedIndex\":6851,\"time\":\"13:43\",\"sell\":1264,\"buy\":1264,\"volume\":798,\"changeRate\":-0.146,\"nonWeightedIndex\":6840},{\"changeAmount\":-10,\"weightedIndex\":6851,\"time\":\"13:44\",\"sell\":2006,\"buy\":2006,\"volume\":798,\"changeRate\":-0.146,\"nonWeightedIndex\":6840},{\"changeAmount\":-10,\"weightedIndex\":6851,\"time\":\"13:45\",\"sell\":1424,\"buy\":1424,\"volume\":812,\"changeRate\":-0.146,\"nonWeightedIndex\":6840},{\"changeAmount\":-10,\"weightedIndex\":6851,\"time\":\"13:46\",\"sell\":826,\"buy\":826,\"volume\":812,\"changeRate\":-0.146,\"nonWeightedIndex\":6840},{\"changeAmount\":-9,\"weightedIndex\":6851,\"time\":\"13:47\",\"sell\":762,\"buy\":762,\"volume\":822,\"changeRate\":-0.131,\"nonWeightedIndex\":6840},{\"changeAmount\":-9,\"weightedIndex\":6851,\"time\":\"13:48\",\"sell\":590,\"buy\":590,\"volume\":822,\"changeRate\":-0.131,\"nonWeightedIndex\":6841},{\"changeAmount\":-8,\"weightedIndex\":6851,\"time\":\"13:49\",\"sell\":618,\"buy\":618,\"volume\":834,\"changeRate\":-0.117,\"nonWeightedIndex\":6841},{\"changeAmount\":-8,\"weightedIndex\":6851,\"time\":\"13:50\",\"sell\":672,\"buy\":672,\"volume\":834,\"changeRate\":-0.117,\"nonWeightedIndex\":6842},{\"changeAmount\":-7,\"weightedIndex\":6851,\"time\":\"13:51\",\"sell\":680,\"buy\":680,\"volume\":844,\"changeRate\":-0.102,\"nonWeightedIndex\":6842},{\"changeAmount\":-7,\"weightedIndex\":6851,\"time\":\"13:52\",\"sell\":550,\"buy\":550,\"volume\":844,\"changeRate\":-0.102,\"nonWeightedIndex\":6843},{\"changeAmount\":-7,\"weightedIndex\":6851,\"time\":\"13:53\",\"sell\":686,\"buy\":686,\"volume\":856,\"changeRate\":-0.102,\"nonWeightedIndex\":6843},{\"changeAmount\":-7,\"weightedIndex\":6851,\"time\":\"13:54\",\"sell\":708,\"buy\":708,\"volume\":856,\"changeRate\":-0.102,\"nonWeightedIndex\":6843},{\"changeAmount\":-7,\"weightedIndex\":6851,\"time\":\"13:55\",\"sell\":672,\"buy\":672,\"volume\":856,\"changeRate\":-0.102,\"nonWeightedIndex\":6843},{\"changeAmount\":-8,\"weightedIndex\":6850,\"time\":\"13:56\",\"sell\":668,\"buy\":668,\"volume\":866,\"changeRate\":-0.117,\"nonWeightedIndex\":6842},{\"changeAmount\":-8,\"weightedIndex\":6850,\"time\":\"13:57\",\"sell\":550,\"buy\":550,\"volume\":866,\"changeRate\":-0.117,\"nonWeightedIndex\":6842},{\"changeAmount\":-8,\"weightedIndex\":6850,\"time\":\"13:58\",\"sell\":706,\"buy\":706,\"volume\":878,\"changeRate\":-0.117,\"nonWeightedIndex\":6842},{\"changeAmount\":-9,\"weightedIndex\":6850,\"time\":\"13:59\",\"sell\":620,\"buy\":620,\"volume\":888,\"changeRate\":-0.131,\"nonWeightedIndex\":6841},{\"changeAmount\":-9,\"weightedIndex\":6850,\"time\":\"14:00\",\"sell\":590,\"buy\":590,\"volume\":888,\"changeRate\":-0.131,\"nonWeightedIndex\":6841},{\"changeAmount\":-9,\"weightedIndex\":6850,\"time\":\"14:01\",\"sell\":590,\"buy\":590,\"volume\":898,\"changeRate\":-0.131,\"nonWeightedIndex\":6841},{\"changeAmount\":-7,\"weightedIndex\":6850,\"time\":\"14:02\",\"sell\":616,\"buy\":616,\"volume\":910,\"changeRate\":-0.102,\"nonWeightedIndex\":6842},{\"changeAmount\":-7,\"weightedIndex\":6850,\"time\":\"14:03\",\"sell\":576,\"buy\":576,\"volume\":918,\"changeRate\":-0.102,\"nonWeightedIndex\":6843},{\"changeAmount\":-7,\"weightedIndex\":6850,\"time\":\"14:04\",\"sell\":448,\"buy\":448,\"volume\":918,\"changeRate\":-0.102,\"nonWeightedIndex\":6843},{\"changeAmount\":-9,\"weightedIndex\":6850,\"time\":\"14:05\",\"sell\":940,\"buy\":940,\"volume\":938,\"changeRate\":-0.131,\"nonWeightedIndex\":6841},{\"changeAmount\":-9,\"weightedIndex\":6850,\"time\":\"14:06\",\"sell\":1052,\"buy\":1052,\"volume\":946,\"changeRate\":-0.131,\"nonWeightedIndex\":6841},{\"changeAmount\":-9,\"weightedIndex\":6850,\"time\":\"14:07\",\"sell\":472,\"buy\":472,\"volume\":946,\"changeRate\":-0.131,\"nonWeightedIndex\":6841},{\"changeAmount\":-10,\"weightedIndex\":6850,\"time\":\"14:08\",\"sell\":472,\"buy\":472,\"volume\":954,\"changeRate\":-0.146,\"nonWeightedIndex\":6840},{\"changeAmount\":-12,\"weightedIndex\":6849,\"time\":\"14:09\",\"sell\":592,\"buy\":592,\"volume\":978,\"changeRate\":-0.175,\"nonWeightedIndex\":6839},{\"changeAmount\":-12,\"weightedIndex\":6849,\"time\":\"14:10\",\"sell\":1416,\"buy\":1416,\"volume\":978,\"changeRate\":-0.175,\"nonWeightedIndex\":6838},{\"changeAmount\":-13,\"weightedIndex\":6849,\"time\":\"14:11\",\"sell\":996,\"buy\":996,\"volume\":990,\"changeRate\":-0.19,\"nonWeightedIndex\":6837},{\"changeAmount\":-13,\"weightedIndex\":6849,\"time\":\"14:12\",\"sell\":708,\"buy\":708,\"volume\":990,\"changeRate\":-0.19,\"nonWeightedIndex\":6837},{\"changeAmount\":-12,\"weightedIndex\":6849,\"time\":\"14:13\",\"sell\":662,\"buy\":662,\"volume\":1000,\"changeRate\":-0.175,\"nonWeightedIndex\":6837},{\"changeAmount\":-12,\"weightedIndex\":6849,\"time\":\"14:14\",\"sell\":570,\"buy\":570,\"volume\":1000,\"changeRate\":-0.175,\"nonWeightedIndex\":6838},{\"changeAmount\":-11,\"weightedIndex\":6849,\"time\":\"14:15\",\"sell\":588,\"buy\":588,\"volume\":1012,\"changeRate\":-0.16,\"nonWeightedIndex\":6838},{\"changeAmount\":-11,\"weightedIndex\":6849,\"time\":\"14:16\",\"sell\":672,\"buy\":672,\"volume\":1012,\"changeRate\":-0.16,\"nonWeightedIndex\":6839},{\"changeAmount\":-11,\"weightedIndex\":6849,\"time\":\"14:17\",\"sell\":684,\"buy\":684,\"volume\":1024,\"changeRate\":-0.16,\"nonWeightedIndex\":6839},{\"changeAmount\":-11,\"weightedIndex\":6849,\"time\":\"14:18\",\"sell\":672,\"buy\":672,\"volume\":1024,\"changeRate\":-0.16,\"nonWeightedIndex\":6839},{\"changeAmount\":-11,\"weightedIndex\":6849,\"time\":\"14:19\",\"sell\":708,\"buy\":708,\"volume\":1024,\"changeRate\":-0.16,\"nonWeightedIndex\":6839},{\"changeAmount\":-10,\"weightedIndex\":6849,\"time\":\"14:20\",\"sell\":568,\"buy\":568,\"volume\":1034,\"changeRate\":-0.146,\"nonWeightedIndex\":6839},{\"changeAmount\":-10,\"weightedIndex\":6849,\"time\":\"14:21\",\"sell\":520,\"buy\":520,\"volume\":1034,\"changeRate\":-0.146,\"nonWeightedIndex\":6840},{\"changeAmount\":-10,\"weightedIndex\":6849,\"time\":\"14:22\",\"sell\":672,\"buy\":672,\"volume\":1046,\"changeRate\":-0.146,\"nonWeightedIndex\":6840},{\"changeAmount\":-9,\"weightedIndex\":6849,\"time\":\"14:23\",\"sell\":682,\"buy\":682,\"volume\":1056,\"changeRate\":-0.131,\"nonWeightedIndex\":6840},{\"changeAmount\":-9,\"weightedIndex\":6849,\"time\":\"14:24\",\"sell\":590,\"buy\":590,\"volume\":1056,\"changeRate\":-0.131,\"nonWeightedIndex\":6841},{\"changeAmount\":-9,\"weightedIndex\":6848,\"time\":\"14:25\",\"sell\":624,\"buy\":624,\"volume\":1068,\"changeRate\":-0.131,\"nonWeightedIndex\":6841},{\"changeAmount\":-9,\"weightedIndex\":6848,\"time\":\"14:26\",\"sell\":708,\"buy\":708,\"volume\":1068,\"changeRate\":-0.131,\"nonWeightedIndex\":6841},{\"changeAmount\":-10,\"weightedIndex\":6848,\"time\":\"14:27\",\"sell\":622,\"buy\":622,\"volume\":1078,\"changeRate\":-0.146,\"nonWeightedIndex\":6840},{\"changeAmount\":-10,\"weightedIndex\":6848,\"time\":\"14:28\",\"sell\":590,\"buy\":590,\"volume\":1078,\"changeRate\":-0.146,\"nonWeightedIndex\":6840},{\"changeAmount\":-12,\"weightedIndex\":6848,\"time\":\"14:29\",\"sell\":700,\"buy\":700,\"volume\":1098,\"changeRate\":-0.175,\"nonWeightedIndex\":6839},{\"changeAmount\":-12,\"weightedIndex\":6848,\"time\":\"14:30\",\"sell\":1180,\"buy\":1180,\"volume\":1098,\"changeRate\":-0.175,\"nonWeightedIndex\":6838},{\"changeAmount\":-12,\"weightedIndex\":6848,\"time\":\"14:31\",\"sell\":1120,\"buy\":1120,\"volume\":1098,\"changeRate\":-0.175,\"nonWeightedIndex\":6838},{\"changeAmount\":-11,\"weightedIndex\":6848,\"time\":\"14:32\",\"sell\":650,\"buy\":650,\"volume\":1108,\"changeRate\":-0.16,\"nonWeightedIndex\":6838},{\"changeAmount\":-11,\"weightedIndex\":6848,\"time\":\"14:33\",\"sell\":590,\"buy\":590,\"volume\":1108,\"changeRate\":-0.16,\"nonWeightedIndex\":6839},{\"changeAmount\":-11,\"weightedIndex\":6848,\"time\":\"14:34\",\"sell\":434,\"buy\":434,\"volume\":1116,\"changeRate\":-0.16,\"nonWeightedIndex\":6839},{\"changeAmount\":-12,\"weightedIndex\":6848,\"time\":\"14:35\",\"sell\":546,\"buy\":546,\"volume\":1126,\"changeRate\":-0.175,\"nonWeightedIndex\":6838},{\"changeAmount\":-12,\"weightedIndex\":6848,\"time\":\"14:36\",\"sell\":560,\"buy\":560,\"volume\":1126,\"changeRate\":-0.175,\"nonWeightedIndex\":6838},{\"changeAmount\":-12,\"weightedIndex\":6848,\"time\":\"14:37\",\"sell\":590,\"buy\":590,\"volume\":1126,\"changeRate\":-0.175,\"nonWeightedIndex\":6838},{\"changeAmount\":-14,\"weightedIndex\":6848,\"time\":\"14:38\",\"sell\":560,\"buy\":560,\"volume\":1136,\"changeRate\":-0.204,\"nonWeightedIndex\":6836},{\"changeAmount\":-14,\"weightedIndex\":6848,\"time\":\"14:39\",\"sell\":590,\"buy\":590,\"volume\":1136,\"changeRate\":-0.204,\"nonWeightedIndex\":6836},{\"changeAmount\":-15,\"weightedIndex\":6848,\"time\":\"14:40\",\"sell\":884,\"buy\":884,\"volume\":1152,\"changeRate\":-0.219,\"nonWeightedIndex\":6835},{\"changeAmount\":-15,\"weightedIndex\":6848,\"time\":\"14:41\",\"sell\":912,\"buy\":912,\"volume\":1152,\"changeRate\":-0.219,\"nonWeightedIndex\":6835},{\"changeAmount\":-15,\"weightedIndex\":6848,\"time\":\"14:42\",\"sell\":820,\"buy\":820,\"volume\":1162,\"changeRate\":-0.219,\"nonWeightedIndex\":6835},{\"changeAmount\":-15,\"weightedIndex\":6848,\"time\":\"14:43\",\"sell\":560,\"buy\":560,\"volume\":1162,\"changeRate\":-0.219,\"nonWeightedIndex\":6835},{\"changeAmount\":-15,\"weightedIndex\":6848,\"time\":\"14:44\",\"sell\":590,\"buy\":590,\"volume\":1162,\"changeRate\":-0.219,\"nonWeightedIndex\":6835},{\"changeAmount\":-17,\"weightedIndex\":6847,\"time\":\"14:45\",\"sell\":550,\"buy\":550,\"volume\":1172,\"changeRate\":-0.248,\"nonWeightedIndex\":6833},{\"changeAmount\":-17,\"weightedIndex\":6847,\"time\":\"14:46\",\"sell\":590,\"buy\":590,\"volume\":1172,\"changeRate\":-0.248,\"nonWeightedIndex\":6833},{\"changeAmount\":-17,\"weightedIndex\":6847,\"time\":\"14:47\",\"sell\":608,\"buy\":608,\"volume\":1184,\"changeRate\":-0.248,\"nonWeightedIndex\":6833},{\"changeAmount\":-17,\"weightedIndex\":6847,\"time\":\"14:48\",\"sell\":708,\"buy\":708,\"volume\":1184,\"changeRate\":-0.248,\"nonWeightedIndex\":6833},{\"changeAmount\":-16,\"weightedIndex\":6847,\"time\":\"14:49\",\"sell\":650,\"buy\":650,\"volume\":1194,\"changeRate\":-0.233,\"nonWeightedIndex\":6833},{\"changeAmount\":-16,\"weightedIndex\":6847,\"time\":\"14:50\",\"sell\":590,\"buy\":590,\"volume\":1194,\"changeRate\":-0.233,\"nonWeightedIndex\":6834},{\"changeAmount\":-15,\"weightedIndex\":6847,\"time\":\"14:51\",\"sell\":498,\"buy\":498,\"volume\":1202,\"changeRate\":-0.219,\"nonWeightedIndex\":6834},{\"changeAmount\":-15,\"weightedIndex\":6847,\"time\":\"14:52\",\"sell\":472,\"buy\":472,\"volume\":1202,\"changeRate\":-0.219,\"nonWeightedIndex\":6835},{\"changeAmount\":-14,\"weightedIndex\":6847,\"time\":\"14:53\",\"sell\":530,\"buy\":530,\"volume\":1212,\"changeRate\":-0.204,\"nonWeightedIndex\":6835},{\"changeAmount\":-14,\"weightedIndex\":6847,\"time\":\"14:54\",\"sell\":560,\"buy\":560,\"volume\":1212,\"changeRate\":-0.204,\"nonWeightedIndex\":6836},{\"changeAmount\":-14,\"weightedIndex\":6847,\"time\":\"14:55\",\"sell\":590,\"buy\":590,\"volume\":1222,\"changeRate\":-0.204,\"nonWeightedIndex\":6836},{\"changeAmount\":-14,\"weightedIndex\":6847,\"time\":\"14:56\",\"sell\":550,\"buy\":550,\"volume\":1222,\"changeRate\":-0.204,\"nonWeightedIndex\":6836},{\"changeAmount\":-14,\"weightedIndex\":6847,\"time\":\"14:57\",\"sell\":590,\"buy\":590,\"volume\":1222,\"changeRate\":-0.204,\"nonWeightedIndex\":6836},{\"changeAmount\":-15,\"weightedIndex\":6847,\"time\":\"14:58\",\"sell\":920,\"buy\":920,\"volume\":1242,\"changeRate\":-0.219,\"nonWeightedIndex\":6835},{\"changeAmount\":-15,\"weightedIndex\":6847,\"time\":\"14:59\",\"sell\":1180,\"buy\":1180,\"volume\":1242,\"changeRate\":-0.219,\"nonWeightedIndex\":6835},{\"changeAmount\":-15,\"weightedIndex\":6847,\"time\":\"15:00\",\"sell\":828,\"buy\":828,\"volume\":1254,\"changeRate\":-0.219,\"nonWeightedIndex\":6835},{\"changeAmount\":-15,\"weightedIndex\":6847,\"time\":\"15:01\",\"sell\":708,\"buy\":708,\"volume\":1254,\"changeRate\":-0.219,\"nonWeightedIndex\":6835},{\"changeAmount\":-14,\"weightedIndex\":6846,\"time\":\"15:02\",\"sell\":904,\"buy\":904,\"volume\":1274,\"changeRate\":-0.204,\"nonWeightedIndex\":6835},{\"changeAmount\":-14,\"weightedIndex\":6846,\"time\":\"15:03\",\"sell\":1160,\"buy\":1160,\"volume\":1274,\"changeRate\":-0.204,\"nonWeightedIndex\":6836},{\"changeAmount\":-13,\"weightedIndex\":6846,\"time\":\"15:04\",\"sell\":804,\"buy\":804,\"volume\":1286,\"changeRate\":-0.19,\"nonWeightedIndex\":6836},{\"changeAmount\":-13,\"weightedIndex\":6846,\"time\":\"15:05\",\"sell\":660,\"buy\":660,\"volume\":1286,\"changeRate\":-0.19,\"nonWeightedIndex\":6837},{\"changeAmount\":-14,\"weightedIndex\":6846,\"time\":\"15:06\",\"sell\":800,\"buy\":800,\"volume\":1306,\"changeRate\":-0.204,\"nonWeightedIndex\":6836},{\"changeAmount\":-14,\"weightedIndex\":6846,\"time\":\"15:07\",\"sell\":1100,\"buy\":1100,\"volume\":1306,\"changeRate\":-0.204,\"nonWeightedIndex\":6836},{\"changeAmount\":-14,\"weightedIndex\":6846,\"time\":\"15:08\",\"sell\":1180,\"buy\":1180,\"volume\":1306,\"changeRate\":-0.204,\"nonWeightedIndex\":6836},{\"changeAmount\":-15,\"weightedIndex\":6846,\"time\":\"15:09\",\"sell\":1080,\"buy\":1080,\"volume\":1326,\"changeRate\":-0.219,\"nonWeightedIndex\":6835},{\"changeAmount\":-15,\"weightedIndex\":6846,\"time\":\"15:10\",\"sell\":1100,\"buy\":1100,\"volume\":1326,\"changeRate\":-0.219,\"nonWeightedIndex\":6835},{\"changeAmount\":-16,\"weightedIndex\":6846,\"time\":\"15:11\",\"sell\":1100,\"buy\":1100,\"volume\":1346,\"changeRate\":-0.233,\"nonWeightedIndex\":6834},{\"changeAmount\":-16,\"weightedIndex\":6846,\"time\":\"15:12\",\"sell\":1180,\"buy\":1180,\"volume\":1346,\"changeRate\":-0.233,\"nonWeightedIndex\":6834},{\"changeAmount\":-16,\"weightedIndex\":6846,\"time\":\"15:13\",\"sell\":844,\"buy\":844,\"volume\":1360,\"changeRate\":-0.233,\"nonWeightedIndex\":6834},{\"changeAmount\":-16,\"weightedIndex\":6846,\"time\":\"15:14\",\"sell\":826,\"buy\":826,\"volume\":1360,\"changeRate\":-0.233,\"nonWeightedIndex\":6834},{\"changeAmount\":-15,\"weightedIndex\":6846,\"time\":\"15:15\",\"sell\":634,\"buy\":634,\"volume\":1370,\"changeRate\":-0.219,\"nonWeightedIndex\":6834},{\"changeAmount\":-14,\"weightedIndex\":6846,\"time\":\"15:16\",\"sell\":650,\"buy\":650,\"volume\":1390,\"changeRate\":-0.204,\"nonWeightedIndex\":6835},{\"changeAmount\":-14,\"weightedIndex\":6846,\"time\":\"15:17\",\"sell\":1180,\"buy\":1180,\"volume\":1390,\"changeRate\":-0.204,\"nonWeightedIndex\":6836},{\"changeAmount\":-16,\"weightedIndex\":6845,\"time\":\"15:18\",\"sell\":1160,\"buy\":1160,\"volume\":1430,\"changeRate\":-0.233,\"nonWeightedIndex\":6835},{\"changeAmount\":-16,\"weightedIndex\":6845,\"time\":\"15:19\",\"sell\":2360,\"buy\":2360,\"volume\":1430,\"changeRate\":-0.233,\"nonWeightedIndex\":6834},{\"changeAmount\":-16,\"weightedIndex\":6845,\"time\":\"15:20\",\"sell\":2200,\"buy\":2200,\"volume\":1430,\"changeRate\":-0.233,\"nonWeightedIndex\":6834},{\"changeAmount\":-17,\"weightedIndex\":6845,\"time\":\"15:21\",\"sell\":1112,\"buy\":1112,\"volume\":1444,\"changeRate\":-0.248,\"nonWeightedIndex\":6833},{\"changeAmount\":-16,\"weightedIndex\":6845,\"time\":\"15:22\",\"sell\":706,\"buy\":706,\"volume\":1454,\"changeRate\":-0.233,\"nonWeightedIndex\":6833},{\"changeAmount\":-16,\"weightedIndex\":6845,\"time\":\"15:23\",\"sell\":590,\"buy\":590,\"volume\":1454,\"changeRate\":-0.233,\"nonWeightedIndex\":6834},{\"changeAmount\":-15,\"weightedIndex\":6845,\"time\":\"15:24\",\"sell\":592,\"buy\":592,\"volume\":1468,\"changeRate\":-0.219,\"nonWeightedIndex\":6834},{\"changeAmount\":-14,\"weightedIndex\":6845,\"time\":\"15:25\",\"sell\":838,\"buy\":838,\"volume\":1484,\"changeRate\":-0.204,\"nonWeightedIndex\":6835},{\"changeAmount\":-14,\"weightedIndex\":6845,\"time\":\"15:26\",\"sell\":880,\"buy\":880,\"volume\":1484,\"changeRate\":-0.204,\"nonWeightedIndex\":6836},{\"changeAmount\":-14,\"weightedIndex\":6845,\"time\":\"15:27\",\"sell\":854,\"buy\":854,\"volume\":1494,\"changeRate\":-0.204,\"nonWeightedIndex\":6836},{\"changeAmount\":-14,\"weightedIndex\":6845,\"time\":\"15:28\",\"sell\":550,\"buy\":550,\"volume\":1494,\"changeRate\":-0.204,\"nonWeightedIndex\":6836},{\"changeAmount\":-13,\"weightedIndex\":6845,\"time\":\"15:29\",\"sell\":590,\"buy\":590,\"volume\":1504,\"changeRate\":-0.19,\"nonWeightedIndex\":6836},{\"changeAmount\":-12,\"weightedIndex\":6845,\"time\":\"15:30\",\"sell\":900,\"buy\":900,\"volume\":1524,\"changeRate\":-0.175,\"nonWeightedIndex\":6837}]}")
33 | .getJSONArray("data");
34 | } catch (JSONException e) {
35 | Toast.makeText(mContext, "数据组装异常", Toast.LENGTH_SHORT).show();
36 | }
37 | }
38 |
39 | @Override
40 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
41 | View view = inflater.inflate(R.layout.fragment_times, null);
42 | List timesList = new ArrayList();
43 | JSONObject data = null;
44 | try {
45 | for (int i = 0; i < mDatas.length(); i++) {
46 | data = mDatas.getJSONObject(i);
47 | timesList.add(new TimesEntity(data.getString("time"), data
48 | .getDouble("weightedIndex"), data.getDouble("nonWeightedIndex"), data
49 | .getInt("buy"), data.getInt("sell"), data.getInt("volume")));
50 | }
51 | } catch (Exception e) {
52 | Toast.makeText(mContext, "数据解析异常", Toast.LENGTH_SHORT).show();
53 | }
54 |
55 | mTimesView = (TimesView) view.findViewById(R.id.my_fenshi_view);
56 | mTimesView.setTimesList(timesList);
57 |
58 | return view;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/zhangchen/stock/futures/WelcomeActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.zhangchen.stock.futures;
2 |
3 | import android.app.Activity;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.os.Handler;
7 | import android.os.Message;
8 |
9 | public class WelcomeActivity extends Activity implements Handler.Callback {
10 |
11 | private Handler handler;
12 | private final int WHAT = 1987;
13 | private final long DELAY_TIME = 1500;
14 |
15 | @Override
16 | protected void onCreate(Bundle savedInstanceState) {
17 | super.onCreate(savedInstanceState);
18 | setContentView(R.layout.activity_welcome);
19 | handler = new Handler(this);
20 | }
21 |
22 | @Override
23 | protected void onResume() {
24 | super.onResume();
25 | new Thread(new Runnable() {
26 |
27 | public void run() {
28 | handler.sendEmptyMessageDelayed(WHAT, DELAY_TIME);
29 |
30 | }
31 | }).start();
32 | }
33 |
34 | @Override
35 | protected void onPause() {
36 | super.onPause();
37 | handler.removeMessages(WHAT);
38 | }
39 |
40 | public boolean handleMessage(Message msg) {
41 |
42 | if (msg.what == WHAT) {
43 | Intent intent = new Intent(WelcomeActivity.this, MyFragmentActivity.class);
44 | startActivity(intent);
45 | finish();
46 | return true;
47 | }
48 | return false;
49 |
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/zhangchen/stock/futures/entity/AnnouncementEntity.java:
--------------------------------------------------------------------------------
1 | package com.example.zhangchen.stock.futures.entity;
2 |
3 | public class AnnouncementEntity {
4 | private String title;// 公告标题
5 | private String date;// 公告日期
6 | private String content;// 公告内容
7 |
8 | public AnnouncementEntity() {
9 | super();
10 | }
11 |
12 | public AnnouncementEntity(String title, String date, String content) {
13 | super();
14 | this.title = title;
15 | this.date = date;
16 | this.content = content;
17 | }
18 |
19 | public String getTitle() {
20 | return title;
21 | }
22 |
23 | public void setTitle(String title) {
24 | this.title = title;
25 | }
26 |
27 | public String getDate() {
28 | return date;
29 | }
30 |
31 | public void setDate(String date) {
32 | this.date = date;
33 | }
34 |
35 | public String getContent() {
36 | return content;
37 | }
38 |
39 | public void setContent(String content) {
40 | this.content = content;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/zhangchen/stock/futures/entity/AppInfo.java:
--------------------------------------------------------------------------------
1 | package com.example.zhangchen.stock.futures.entity;
2 |
3 | public class AppInfo {
4 | private boolean shouldUpdate;// 是否需要更新应用
5 | private String appUri;// 新版本应用地址
6 |
7 | public AppInfo() {
8 | super();
9 | }
10 |
11 | public AppInfo(boolean shouldUpdate, String appUri) {
12 | super();
13 | this.shouldUpdate = shouldUpdate;
14 | this.appUri = appUri;
15 | }
16 |
17 | public boolean isShouldUpdate() {
18 | return shouldUpdate;
19 | }
20 |
21 | public void setShouldUpdate(boolean shouldUpdate) {
22 | this.shouldUpdate = shouldUpdate;
23 | }
24 |
25 | public String getAppUri() {
26 | return appUri;
27 | }
28 |
29 | public void setAppUri(String appUri) {
30 | this.appUri = appUri;
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/zhangchen/stock/futures/entity/FutruesEntity.java:
--------------------------------------------------------------------------------
1 | package com.example.zhangchen.stock.futures.entity;
2 |
3 | public class FutruesEntity {
4 | private String name;// 期货名称
5 | private String code;// 期货代码
6 | private double price;// 当前价格
7 | private double changeAmount;// 涨跌额
8 | private double changeRate;// 涨跌幅
9 |
10 | public FutruesEntity() {
11 | super();
12 | }
13 |
14 | public FutruesEntity(String name, String code, double price, double changeAmount,
15 | double changeRate) {
16 | super();
17 | this.name = name;
18 | this.code = code;
19 | this.price = price;
20 | this.changeAmount = changeAmount;
21 | this.changeRate = changeRate;
22 | }
23 |
24 | public String getName() {
25 | return name;
26 | }
27 |
28 | public void setName(String name) {
29 | this.name = name;
30 | }
31 |
32 | public String getCode() {
33 | return code;
34 | }
35 |
36 | public void setCode(String code) {
37 | this.code = code;
38 | }
39 |
40 | public double getPrice() {
41 | return price;
42 | }
43 |
44 | public void setPrice(double price) {
45 | this.price = price;
46 | }
47 |
48 | public double getChangeAmount() {
49 | return changeAmount;
50 | }
51 |
52 | public void setChangeAmount(double changeAmount) {
53 | this.changeAmount = changeAmount;
54 | }
55 |
56 | public double getChangeRate() {
57 | return changeRate;
58 | }
59 |
60 | public void setChangeRate(double changeRate) {
61 | this.changeRate = changeRate;
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/zhangchen/stock/futures/entity/GameLogEntity.java:
--------------------------------------------------------------------------------
1 | package com.example.zhangchen.stock.futures.entity;
2 |
3 | public class GameLogEntity {
4 | private String time;// 购买时间,如2013-09-18 13:55
5 | private int type;// 购买类型,1代表买涨,0代表买平,-1代表买跌
6 | private int price;// 单注价格
7 | private int count;// 购买数量
8 | private int result;// 游戏结果,1代表赢,2代表输
9 |
10 | public GameLogEntity() {
11 | super();
12 | }
13 |
14 | public GameLogEntity(String time, int type, int price, int count, int result) {
15 | super();
16 | this.time = time;
17 | this.type = type;
18 | this.price = price;
19 | this.count = count;
20 | this.result = result;
21 | }
22 |
23 | public String getTime() {
24 | return time;
25 | }
26 |
27 | public void setTime(String time) {
28 | this.time = time;
29 | }
30 |
31 | public int getType() {
32 | return type;
33 | }
34 |
35 | public void setType(int type) {
36 | this.type = type;
37 | }
38 |
39 | public int getPrice() {
40 | return price;
41 | }
42 |
43 | public void setPrice(int price) {
44 | this.price = price;
45 | }
46 |
47 | public int getCount() {
48 | return count;
49 | }
50 |
51 | public void setCount(int count) {
52 | this.count = count;
53 | }
54 |
55 | public int getResult() {
56 | return result;
57 | }
58 |
59 | public void setResult(int result) {
60 | this.result = result;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/zhangchen/stock/futures/entity/KDJEntity.java:
--------------------------------------------------------------------------------
1 | package com.example.zhangchen.stock.futures.entity;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 |
7 | public class KDJEntity {
8 | private ArrayList Ks;
9 | private ArrayList Ds;
10 | private ArrayList Js;
11 |
12 | public KDJEntity(List OHLCData) {
13 | Ks = new ArrayList();
14 | Ds = new ArrayList();
15 | Js = new ArrayList();
16 |
17 | ArrayList ks = new ArrayList();
18 | ArrayList ds = new ArrayList();
19 | ArrayList js = new ArrayList();
20 |
21 | double k = 0.0;
22 | double d = 0.0;
23 | double j = 0.0;
24 | double rSV = 0.0;
25 |
26 | if (OHLCData != null && OHLCData.size() > 0) {
27 |
28 | OHLCEntity oHLCEntity = OHLCData.get(OHLCData.size() - 1);
29 | double high = oHLCEntity.getHigh();
30 | double low = oHLCEntity.getLow();
31 |
32 | for (int i = OHLCData.size() - 1; i >= 0; i--) {
33 | if (i < OHLCData.size() - 1) {
34 | oHLCEntity = OHLCData.get(i);
35 | high = high > oHLCEntity.getHigh() ? high : oHLCEntity.getHigh();
36 | low = low < oHLCEntity.getLow() ? low : oHLCEntity.getLow();
37 | }
38 | if (high != low) {
39 | rSV = (oHLCEntity.getClose() - low) / (high - low) * 100;
40 | }
41 | if (i == OHLCData.size() - 1) {
42 | k = rSV;
43 | d = k;
44 |
45 | } else {
46 | k = k * 2 / 3 + rSV / 3;
47 | d = d * 2 / 3 + k / 3;
48 | }
49 | j = 3 * k - 2 * d;
50 |
51 | ks.add(k);
52 | ds.add(d);
53 | js.add(j);
54 | }
55 | for (int i = ks.size() - 1; i >= 0; i--) {
56 | Ks.add(ks.get(i));
57 | Ds.add(ds.get(i));
58 | Js.add(js.get(i));
59 | }
60 | }
61 | }
62 |
63 | public ArrayList getK() {
64 | return Ks;
65 | }
66 |
67 | public ArrayList getD() {
68 | return Ds;
69 | }
70 |
71 | public ArrayList getJ() {
72 | return Js;
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/zhangchen/stock/futures/entity/MACDEntity.java:
--------------------------------------------------------------------------------
1 | package com.example.zhangchen.stock.futures.entity;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 |
7 | public class MACDEntity {
8 |
9 | private List DEAs;
10 | private List DIFs;
11 | private List MACDs;
12 |
13 | public MACDEntity(List OHLCData) {
14 | DEAs = new ArrayList();
15 | DIFs = new ArrayList();
16 | MACDs = new ArrayList();
17 |
18 | List dEAs = new ArrayList();
19 | List dIFs = new ArrayList();
20 | List mACDs = new ArrayList();
21 |
22 | double eMA12 = 0.0;
23 | double eMA26 = 0.0;
24 | double close = 0;
25 | double dIF = 0.0;
26 | double dEA = 0.0;
27 | double mACD = 0.0;
28 | if (OHLCData != null && OHLCData.size() > 0) {
29 |
30 | for (int i = OHLCData.size() - 1; i >= 0; i--) {
31 | close = OHLCData.get(i).getClose();
32 | if (i == OHLCData.size() - 1) {
33 | eMA12 = close;
34 | eMA26 = close;
35 | } else {
36 | eMA12 = eMA12 * 11 / 13 + close * 2 / 13;
37 | eMA26 = eMA26 * 25 / 27 + close * 2 / 27;
38 | dIF = eMA12 - eMA26;
39 | dEA = dEA * 8 / 10 + dIF * 2 / 10;
40 | mACD = dIF - dEA;
41 | }
42 | dEAs.add(dEA);
43 | dIFs.add(dIF);
44 | mACDs.add(mACD);
45 | }
46 |
47 | for (int i = dEAs.size() - 1; i >= 0; i--) {
48 | DEAs.add(dEAs.get(i));
49 | DIFs.add(dIFs.get(i));
50 | MACDs.add(mACDs.get(i));
51 | }
52 | }
53 |
54 | }
55 |
56 | public List getDEA() {
57 | return DEAs;
58 | }
59 |
60 | public List getDIF() {
61 | return DIFs;
62 | }
63 |
64 | public List getMACD() {
65 | return MACDs;
66 | }
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/zhangchen/stock/futures/entity/MALineEntity.java:
--------------------------------------------------------------------------------
1 | package com.example.zhangchen.stock.futures.entity;
2 |
3 | import java.util.List;
4 |
5 | public class MALineEntity {
6 |
7 | /** 线表示数据 */
8 | private List lineData;
9 |
10 | /** 线的标题 */
11 | private String title;
12 |
13 | /** 线表示颜色 */
14 | private int lineColor;
15 |
16 | public MALineEntity() {
17 | super();
18 | }
19 |
20 | public MALineEntity(List lineData, String title, int lineColor) {
21 | this.lineData = lineData;
22 | this.title = title;
23 | this.lineColor = lineColor;
24 | }
25 |
26 | public List getLineData() {
27 | return lineData;
28 | }
29 |
30 | public void setLineData(List lineData) {
31 | this.lineData = lineData;
32 | }
33 |
34 | public String getTitle() {
35 | return title;
36 | }
37 |
38 | public void setTitle(String title) {
39 | this.title = title;
40 | }
41 |
42 | public int getLineColor() {
43 | return lineColor;
44 | }
45 |
46 | public void setLineColor(int lineColor) {
47 | this.lineColor = lineColor;
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/zhangchen/stock/futures/entity/OHLCEntity.java:
--------------------------------------------------------------------------------
1 | package com.example.zhangchen.stock.futures.entity;
2 |
3 | public class OHLCEntity {
4 |
5 | private double open;// 开盘价
6 | private double high;// 最高价
7 | private double low;// 最低价
8 | private double close;// 收盘价
9 | private String date;// 日期,如:2013-09-18
10 |
11 | public OHLCEntity() {
12 | super();
13 | }
14 |
15 | public OHLCEntity(double open, double high, double low, double close, String date) {
16 | super();
17 | this.open = open;
18 | this.high = high;
19 | this.low = low;
20 | this.close = close;
21 | this.date = date;
22 | }
23 |
24 | public double getOpen() {
25 | return open;
26 | }
27 |
28 | public void setOpen(double open) {
29 | this.open = open;
30 | }
31 |
32 | public double getHigh() {
33 | return high;
34 | }
35 |
36 | public void setHigh(double high) {
37 | this.high = high;
38 | }
39 |
40 | public double getLow() {
41 | return low;
42 | }
43 |
44 | public void setLow(double low) {
45 | this.low = low;
46 | }
47 |
48 | public double getClose() {
49 | return close;
50 | }
51 |
52 | public void setClose(double close) {
53 | this.close = close;
54 | }
55 |
56 | public String getDate() {
57 | return date;
58 | }
59 |
60 | public void setDate(String date) {
61 | this.date = date;
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/zhangchen/stock/futures/entity/PayLogEntity.java:
--------------------------------------------------------------------------------
1 | package com.example.zhangchen.stock.futures.entity;
2 |
3 | public class PayLogEntity {
4 | private String time;// 交易时间,如:2013-09-18 13:45
5 | private double money;// 交易金额
6 | private int type;// 交易类型,1代表支付,2代表提现消除
7 |
8 | public PayLogEntity() {
9 | super();
10 | }
11 |
12 | public PayLogEntity(String time, double money, int type) {
13 | super();
14 | this.time = time;
15 | this.money = money;
16 | this.type = type;
17 | }
18 |
19 | public String getTime() {
20 | return time;
21 | }
22 |
23 | public void setTime(String time) {
24 | this.time = time;
25 | }
26 |
27 | public double getMoney() {
28 | return money;
29 | }
30 |
31 | public void setMoney(double money) {
32 | this.money = money;
33 | }
34 |
35 | public int getType() {
36 | return type;
37 | }
38 |
39 | public void setType(int type) {
40 | this.type = type;
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/zhangchen/stock/futures/entity/RSIEntity.java:
--------------------------------------------------------------------------------
1 | package com.example.zhangchen.stock.futures.entity;
2 |
3 | import java.util.List;
4 |
5 |
6 | /**
7 | * @author nanjingbiao
8 | *
9 | */
10 | public class RSIEntity {
11 | public RSIEntity(List OHLCData) {
12 |
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/zhangchen/stock/futures/entity/TimesEntity.java:
--------------------------------------------------------------------------------
1 | package com.example.zhangchen.stock.futures.entity;
2 |
3 | /**
4 | * 分时图的每分钟数据
5 | *
6 | * @author nanjingbiao
7 | *
8 | */
9 | public class TimesEntity {
10 | private String time;// 时间
11 | private double weightedIndex;// 大盘加权指数
12 | private double nonWeightedIndex;// 大盘不加权指数
13 | private int buy;// 买入量
14 | private int sell;// 卖出量
15 | private int volume;// 交易量
16 | private float buyRatio;// 买入率
17 | private float sellRatio;// 卖出率
18 |
19 | public TimesEntity() {
20 | super();
21 | }
22 |
23 | public TimesEntity(String time, double weightedIndex, double nonWeightedIndex, int buy,
24 | int sell, int volume) {
25 | super();
26 | this.time = time;
27 | this.weightedIndex = weightedIndex;
28 | this.nonWeightedIndex = nonWeightedIndex;
29 | this.buy = buy;
30 | this.sell = sell;
31 | this.volume = volume;
32 | this.buyRatio = buy * 10.0f / 10.0f / (buy + sell);
33 | this.sellRatio = sell * 10.0f / 10.0f / (buy + sell);
34 | }
35 |
36 | public String getTime() {
37 | return time;
38 | }
39 |
40 | public void setTime(String time) {
41 | this.time = time;
42 | }
43 |
44 | public double getWeightedIndex() {
45 | return weightedIndex;
46 | }
47 |
48 | public void setWeightedIndex(double weightedIndex) {
49 | this.weightedIndex = weightedIndex;
50 | }
51 |
52 | public double getNonWeightedIndex() {
53 | return nonWeightedIndex;
54 | }
55 |
56 | public void setNonWeightedIndex(double nonWeightedIndex) {
57 | this.nonWeightedIndex = nonWeightedIndex;
58 | }
59 |
60 | public int getBuy() {
61 | return buy;
62 | }
63 |
64 | public void setBuy(int buy) {
65 | this.buy = buy;
66 | }
67 |
68 | public int getSell() {
69 | return sell;
70 | }
71 |
72 | public void setSell(int sell) {
73 | this.sell = sell;
74 | }
75 |
76 | public int getVolume() {
77 | return volume;
78 | }
79 |
80 | public void setVolume(int volume) {
81 | this.volume = volume;
82 | }
83 |
84 | public float getBuyRatio() {
85 | return buyRatio;
86 | }
87 |
88 | public void setBuyRatio(float buyRatio) {
89 | this.buyRatio = buyRatio;
90 | }
91 |
92 | public float getSellRatio() {
93 | return sellRatio;
94 | }
95 |
96 | public void setSellRatio(float sellRatio) {
97 | this.sellRatio = sellRatio;
98 | }
99 |
100 | }
101 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/zhangchen/stock/futures/http/HttpHelper.java:
--------------------------------------------------------------------------------
1 | package com.example.zhangchen.stock.futures.http;
2 |
3 | public class HttpHelper {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/zhangchen/stock/futures/util/Tools.java:
--------------------------------------------------------------------------------
1 | package com.example.zhangchen.stock.futures.util;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.content.Intent;
6 |
7 | public class Tools {
8 |
9 | public static void startActivity(Context context, Class extends Activity> cls) {
10 | Intent intent = new Intent(context, cls);
11 | context.startActivity(intent);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/zhangchen/stock/futures/view/GridChart.java:
--------------------------------------------------------------------------------
1 | package com.example.zhangchen.stock.futures.view;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.graphics.Color;
6 | import android.graphics.DashPathEffect;
7 | import android.graphics.Paint;
8 | import android.graphics.PathEffect;
9 | import android.graphics.Rect;
10 | import android.util.AttributeSet;
11 | import android.view.MotionEvent;
12 | import android.view.View;
13 |
14 | import com.android.futures.R;
15 |
16 | /**
17 | * 坐标轴使用的View
18 | *
19 | * @author nanjingbiao
20 | *
21 | */
22 | public class GridChart extends View {
23 |
24 | // ////////////默认值////////////////
25 | /** 默认背景色 */
26 | public static final int DEFAULT_BACKGROUD = R.drawable.bg_chart;
27 |
28 | /** 默认XY轴字体大小 **/
29 | public static final int DEFAULT_AXIS_TITLE_SIZE = 22;
30 |
31 | /** 默认XY坐标轴颜色 */
32 | private static final int DEFAULT_AXIS_COLOR = Color.RED;
33 |
34 | /** 默认经纬线颜色 */
35 | private static final int DEFAULT_LONGI_LAITUDE_COLOR = Color.MAGENTA;
36 |
37 | /** 默认上表纬线数 */
38 | public static final int DEFAULT_UPER_LATITUDE_NUM = 3;
39 |
40 | /** 默认下表纬线数 */
41 | private static final int DEFAULT_LOWER_LATITUDE_NUM = 1;
42 |
43 | /** 默认经线数 */
44 | public static final int DEFAULT_LOGITUDE_NUM = 3;
45 |
46 | /** 默认边框的颜色 */
47 | public static final int DEFAULT_BORDER_COLOR = Color.RED;
48 |
49 | /** 默认虚线效果 */
50 | private static final PathEffect DEFAULT_DASH_EFFECT = new DashPathEffect(new float[] { 3, 3, 3,
51 | 3 }, 1);
52 |
53 | /** 下表的顶部 */
54 | public static float LOWER_CHART_TOP;
55 |
56 | /** 上表的底部 */
57 | public static float UPER_CHART_BOTTOM;
58 |
59 | // /////////////属性////////////////
60 | /** 背景色 */
61 | private int mBackGround;
62 |
63 | /** 坐标轴XY颜色 */
64 | private int mAxisColor;
65 |
66 | /** 经纬线颜色 */
67 | private int mLongiLatitudeColor;
68 |
69 | /** 虚线效果 */
70 | private PathEffect mDashEffect;
71 |
72 | /** 边线色 */
73 | private int mBorderColor;
74 |
75 | /** 上表高度 */
76 | private float mUperChartHeight;
77 |
78 | /** 是否显示下表Tabs */
79 | private boolean showLowerChartTabs;
80 |
81 | /** 是否显示顶部Titles */
82 | private boolean showTopTitles;
83 |
84 | /** 顶部Titles高度 */
85 | private float topTitleHeight;
86 |
87 | /** 下表TabTitles */
88 | private String[] mLowerChartTabTitles;
89 |
90 | /** 下表Tab宽度 */
91 | private float mTabWidth;
92 |
93 | /** 下表Tab高度 */
94 | private float mTabHight;
95 |
96 | /** 下表TabIndex */
97 | private int mTabIndex;
98 |
99 | /** 下表高度 */
100 | private float mLowerChartHeight;
101 |
102 | private float longitudeSpacing;
103 | private float latitudeSpacing;
104 |
105 | private OnTabClickListener mOnTabClickListener;
106 |
107 | public GridChart(Context context) {
108 | super(context);
109 | init();
110 | }
111 |
112 | public GridChart(Context context, AttributeSet attrs, int defStyle) {
113 | super(context, attrs, defStyle);
114 | init();
115 | }
116 |
117 | public GridChart(Context context, AttributeSet attrs) {
118 | super(context, attrs);
119 | init();
120 | }
121 |
122 | private void init() {
123 | mBackGround = DEFAULT_BACKGROUD;
124 | mAxisColor = DEFAULT_AXIS_COLOR;
125 | mLongiLatitudeColor = DEFAULT_LONGI_LAITUDE_COLOR;
126 | mDashEffect = DEFAULT_DASH_EFFECT;
127 | mBorderColor = DEFAULT_BORDER_COLOR;
128 | showLowerChartTabs = true;
129 | showTopTitles = true;
130 | topTitleHeight = 0;
131 | mTabIndex = 0;
132 | mOnTabClickListener = null;
133 |
134 | mTabWidth = 0;
135 | mTabHight = 0;
136 | }
137 |
138 | @Override
139 | protected void onDraw(Canvas canvas) {
140 | super.onDraw(canvas);
141 | setBackgroundResource(mBackGround);
142 | int viewHeight = getHeight();
143 | int viewWidth = getWidth();
144 | mLowerChartHeight = viewHeight - 2 - LOWER_CHART_TOP;
145 | if (showLowerChartTabs) {
146 | mTabHight = viewHeight / 16.0f;
147 | }
148 | if (showTopTitles) {
149 | topTitleHeight = DEFAULT_AXIS_TITLE_SIZE + 2;
150 | } else {
151 | topTitleHeight = 0;
152 | }
153 |
154 | longitudeSpacing = (viewWidth - 2) / (DEFAULT_LOGITUDE_NUM + 1);
155 |
156 | latitudeSpacing = (viewHeight - 4 - DEFAULT_AXIS_TITLE_SIZE - topTitleHeight - mTabHight)
157 | / (DEFAULT_UPER_LATITUDE_NUM + DEFAULT_LOWER_LATITUDE_NUM + 2);
158 | mUperChartHeight = latitudeSpacing * (DEFAULT_UPER_LATITUDE_NUM + 1);
159 | LOWER_CHART_TOP = viewHeight - 1 - latitudeSpacing * (DEFAULT_LOWER_LATITUDE_NUM + 1);
160 | UPER_CHART_BOTTOM = 1 + topTitleHeight + latitudeSpacing * (DEFAULT_UPER_LATITUDE_NUM + 1);
161 |
162 | // 绘制边框
163 | drawBorders(canvas, viewHeight, viewWidth);
164 |
165 | // 绘制经线
166 | drawLongitudes(canvas, viewHeight, longitudeSpacing);
167 |
168 | // 绘制纬线
169 | drawLatitudes(canvas, viewHeight, viewWidth, latitudeSpacing);
170 |
171 | // 绘制X线及LowerChartTitles
172 | drawRegions(canvas, viewHeight, viewWidth);
173 | }
174 |
175 | @Override
176 | public boolean onTouchEvent(MotionEvent event) {
177 |
178 | Rect rect = new Rect();
179 | getGlobalVisibleRect(rect);
180 | float x = event.getRawX();
181 | float y = event.getRawY();
182 |
183 | if (y <= LOWER_CHART_TOP + rect.top + 2
184 | && y >= UPER_CHART_BOTTOM + DEFAULT_AXIS_TITLE_SIZE + rect.top) {
185 | if (mTabWidth <= 0) {
186 | return true;
187 | }
188 | int indext = (int) (x / mTabWidth);
189 |
190 | if (mTabIndex != indext) {
191 | mTabIndex = indext;
192 | mOnTabClickListener.onTabClick(mTabIndex);
193 | }
194 | return true;
195 | }
196 |
197 | return false;
198 | }
199 |
200 | public void setOnTabClickListener(OnTabClickListener onTabClickListener) {
201 | mOnTabClickListener = onTabClickListener;
202 | }
203 |
204 | public interface OnTabClickListener {
205 | void onTabClick(int indext);
206 | }
207 |
208 | /**
209 | * 绘制边框
210 | *
211 | * @param canvas
212 | */
213 | private void drawBorders(Canvas canvas, int viewHeight, int viewWidth) {
214 | Paint paint = new Paint();
215 | paint.setColor(mBorderColor);
216 | paint.setStrokeWidth(2);
217 | canvas.drawLine(1, 1, viewWidth - 1, 1, paint);
218 | canvas.drawLine(1, 1, 1, viewHeight - 1, paint);
219 | canvas.drawLine(viewWidth - 1, viewHeight - 1, viewWidth - 1, 1, paint);
220 | canvas.drawLine(viewWidth - 1, viewHeight - 1, 1, viewHeight - 1, paint);
221 | }
222 |
223 | /**
224 | * 绘制经线
225 | *
226 | * @param canvas
227 | * @param viewHeight
228 | * @param viewWidth
229 | */
230 | private void drawLongitudes(Canvas canvas, int viewHeight, float longitudeSpacing) {
231 | Paint paint = new Paint();
232 | paint.setColor(mLongiLatitudeColor);
233 | paint.setPathEffect(mDashEffect);
234 | for (int i = 1; i <= DEFAULT_LOGITUDE_NUM; i++) {
235 | canvas.drawLine(1 + longitudeSpacing * i, topTitleHeight + 2, 1 + longitudeSpacing * i,
236 | UPER_CHART_BOTTOM, paint);
237 | canvas.drawLine(1 + longitudeSpacing * i, LOWER_CHART_TOP, 1 + longitudeSpacing * i,
238 | viewHeight - 1, paint);
239 | }
240 |
241 | }
242 |
243 | /**
244 | * 绘制纬线
245 | *
246 | * @param canvas
247 | * @param viewHeight
248 | * @param viewWidth
249 | */
250 | private void drawLatitudes(Canvas canvas, int viewHeight, int viewWidth, float latitudeSpacing) {
251 | Paint paint = new Paint();
252 | paint.setColor(mLongiLatitudeColor);
253 | paint.setPathEffect(mDashEffect);
254 | for (int i = 1; i <= DEFAULT_UPER_LATITUDE_NUM; i++) {
255 | canvas.drawLine(1, topTitleHeight + 1 + latitudeSpacing * i, viewWidth - 1,
256 | topTitleHeight + 1 + latitudeSpacing * i, paint);
257 | }
258 | for (int i = 1; i <= DEFAULT_LOWER_LATITUDE_NUM; i++) {
259 | canvas.drawLine(1, viewHeight - 1 - latitudeSpacing, viewWidth - 1, viewHeight - 1
260 | - latitudeSpacing, paint);
261 | }
262 |
263 | }
264 |
265 | private void drawRegions(Canvas canvas, int viewHeight, int viewWidth) {
266 | Paint paint = new Paint();
267 | paint.setColor(mAxisColor);
268 | paint.setAlpha(150);
269 | if (showTopTitles) {
270 | canvas.drawLine(1, 1 + DEFAULT_AXIS_TITLE_SIZE + 2, viewWidth - 1,
271 | 1 + DEFAULT_AXIS_TITLE_SIZE + 2, paint);
272 | }
273 | canvas.drawLine(1, UPER_CHART_BOTTOM, viewWidth - 1, UPER_CHART_BOTTOM, paint);
274 | canvas.drawLine(1, LOWER_CHART_TOP, viewWidth - 1, LOWER_CHART_TOP, paint);
275 | if (showLowerChartTabs) {
276 | canvas.drawLine(1, UPER_CHART_BOTTOM + DEFAULT_AXIS_TITLE_SIZE + 2, viewWidth - 1,
277 | UPER_CHART_BOTTOM + DEFAULT_AXIS_TITLE_SIZE + 2, paint);
278 | if (mLowerChartTabTitles == null || mLowerChartTabTitles.length <= 0) {
279 | return;
280 | }
281 | mTabWidth = (viewWidth - 2) / 10.0f * 10.0f / mLowerChartTabTitles.length;
282 | if (mTabWidth < DEFAULT_AXIS_TITLE_SIZE * 2.5f + 2) {
283 | mTabWidth = DEFAULT_AXIS_TITLE_SIZE * 2.5f + 2;
284 | }
285 |
286 | Paint textPaint = new Paint();
287 | textPaint.setColor(Color.WHITE);
288 | textPaint.setTextSize(DEFAULT_AXIS_TITLE_SIZE);
289 | for (int i = 0; i < mLowerChartTabTitles.length && mTabWidth * (i + 1) <= viewWidth - 2; i++) {
290 | if (i == mTabIndex) {
291 | Paint bgPaint = new Paint();
292 | bgPaint.setColor(Color.MAGENTA);
293 | canvas.drawRect(mTabWidth * i + 1, LOWER_CHART_TOP, mTabWidth * (i + 1) + 1,
294 | UPER_CHART_BOTTOM + DEFAULT_AXIS_TITLE_SIZE + 2, bgPaint);
295 | }
296 | canvas.drawLine(mTabWidth * i + 1, LOWER_CHART_TOP, mTabWidth * i + 1,
297 | UPER_CHART_BOTTOM + DEFAULT_AXIS_TITLE_SIZE + 2, paint);
298 | canvas.drawText(mLowerChartTabTitles[i], mTabWidth * i + mTabWidth / 2.0f
299 | - mLowerChartTabTitles[i].length() / 3.0f * DEFAULT_AXIS_TITLE_SIZE,
300 | LOWER_CHART_TOP - mTabHight / 2.0f + DEFAULT_AXIS_TITLE_SIZE / 2.0f,
301 | textPaint);
302 | }
303 | }
304 | }
305 |
306 | public int getBackGround() {
307 | return mBackGround;
308 | }
309 |
310 | public void setBackGround(int BackGround) {
311 | this.mBackGround = BackGround;
312 | }
313 |
314 | public int getAxisColor() {
315 | return mAxisColor;
316 | }
317 |
318 | public void setAxisColor(int AxisColor) {
319 | this.mAxisColor = AxisColor;
320 | }
321 |
322 | public int getLongiLatitudeColor() {
323 | return mLongiLatitudeColor;
324 | }
325 |
326 | public void setLongiLatitudeColor(int LongiLatitudeColor) {
327 | this.mLongiLatitudeColor = LongiLatitudeColor;
328 | }
329 |
330 | public PathEffect getDashEffect() {
331 | return mDashEffect;
332 | }
333 |
334 | public void setDashEffect(PathEffect DashEffect) {
335 | this.mDashEffect = DashEffect;
336 | }
337 |
338 | public int getBorderColor() {
339 | return mBorderColor;
340 | }
341 |
342 | public void setBorderColor(int BorderColor) {
343 | this.mBorderColor = BorderColor;
344 | }
345 |
346 | public float getUperChartHeight() {
347 | return mUperChartHeight;
348 | }
349 |
350 | public void setUperChartHeight(float UperChartHeight) {
351 | this.mUperChartHeight = UperChartHeight;
352 | }
353 |
354 | public boolean isShowLowerChartTabs() {
355 | return showLowerChartTabs;
356 | }
357 |
358 | public void setShowLowerChartTabs(boolean showLowerChartTabs) {
359 | this.showLowerChartTabs = showLowerChartTabs;
360 | }
361 |
362 | public float getLowerChartHeight() {
363 | return mLowerChartHeight;
364 | }
365 |
366 | public void setLowerChartHeight(float LowerChartHeight) {
367 | this.mLowerChartHeight = LowerChartHeight;
368 | }
369 |
370 | public String[] getLowerChartTabTitles() {
371 | return mLowerChartTabTitles;
372 | }
373 |
374 | public void setLowerChartTabTitles(String[] LowerChartTabTitles) {
375 | this.mLowerChartTabTitles = LowerChartTabTitles;
376 | }
377 |
378 | public float getLongitudeSpacing() {
379 | return longitudeSpacing;
380 | }
381 |
382 | public void setLongitudeSpacing(float longitudeSpacing) {
383 | this.longitudeSpacing = longitudeSpacing;
384 | }
385 |
386 | public float getLatitudeSpacing() {
387 | return latitudeSpacing;
388 | }
389 |
390 | public void setLatitudeSpacing(float latitudeSpacing) {
391 | this.latitudeSpacing = latitudeSpacing;
392 | }
393 |
394 | public void setShowTopTitles(boolean showTopTitles) {
395 | this.showTopTitles = showTopTitles;
396 | }
397 |
398 | public float getTopTitleHeight() {
399 | return topTitleHeight;
400 | }
401 |
402 | }
403 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/zhangchen/stock/futures/view/KChartsView.java:
--------------------------------------------------------------------------------
1 | package com.example.zhangchen.stock.futures.view;
2 |
3 | import java.text.DecimalFormat;
4 | import java.util.ArrayList;
5 | import java.util.List;
6 |
7 | import android.content.Context;
8 | import android.graphics.Canvas;
9 | import android.graphics.Color;
10 | import android.graphics.Paint;
11 | import android.util.AttributeSet;
12 | import android.util.FloatMath;
13 | import android.view.MotionEvent;
14 |
15 | import com.android.futures.entity.KDJEntity;
16 | import com.android.futures.entity.MACDEntity;
17 | import com.android.futures.entity.MALineEntity;
18 | import com.android.futures.entity.OHLCEntity;
19 | import com.android.futures.entity.RSIEntity;
20 |
21 | public class KChartsView extends GridChart implements GridChart.OnTabClickListener {
22 |
23 | /** 触摸模式 */
24 | private static int TOUCH_MODE;
25 | private final static int NONE = 0;
26 | private final static int DOWN = 1;
27 | private final static int MOVE = 2;
28 | private final static int ZOOM = 3;
29 |
30 | /** 默认Y轴字体颜色 **/
31 | private static final int DEFAULT_AXIS_Y_TITLE_COLOR = Color.YELLOW;
32 |
33 | /** 默认X轴字体颜色 **/
34 | private static final int DEFAULT_AXIS_X_TITLE_COLOR = Color.RED;
35 |
36 | /** 显示的最小Candle数 */
37 | private final static int MIN_CANDLE_NUM = 10;
38 |
39 | /** 默认显示的Candle数 */
40 | private final static int DEFAULT_CANDLE_NUM = 50;
41 |
42 | /** 最小可识别的移动距离 */
43 | private final static int MIN_MOVE_DISTANCE = 15;
44 |
45 | /** Candle宽度 */
46 | private double mCandleWidth;
47 |
48 | /** 触摸点 */
49 | private float mStartX;
50 | private float mStartY;
51 |
52 | /** OHLC数据 */
53 | private List mOHLCData;
54 |
55 | /** 显示的OHLC数据起始位置 */
56 | private int mDataStartIndext;
57 |
58 | /** 显示的OHLC数据个数 */
59 | private int mShowDataNum;
60 |
61 | /** 是否显示蜡烛详情 */
62 | private boolean showDetails;
63 |
64 | /** 当前数据的最大最小值 */
65 | private double mMaxPrice;
66 | private double mMinPrice;
67 |
68 | /** MA数据 */
69 | private List MALineData;
70 |
71 | private String mTabTitle;
72 |
73 | // 下部表的数据
74 | MACDEntity mMACDData;
75 | KDJEntity mKDJData;
76 | RSIEntity mRSIData;
77 |
78 | public KChartsView(Context context) {
79 | super(context);
80 | init();
81 | }
82 |
83 | public KChartsView(Context context, AttributeSet attrs) {
84 | super(context, attrs);
85 | init();
86 | }
87 |
88 | public KChartsView(Context context, AttributeSet attrs, int defStyle) {
89 | super(context, attrs, defStyle);
90 | init();
91 | }
92 |
93 | private void init() {
94 | super.setOnTabClickListener(this);
95 | mShowDataNum = DEFAULT_CANDLE_NUM;
96 | mDataStartIndext = 0;
97 | showDetails = false;
98 | mMaxPrice = -1;
99 | mMinPrice = -1;
100 | mTabTitle = "MACD";
101 |
102 | mOHLCData = new ArrayList();
103 | mMACDData = new MACDEntity(null);
104 | mKDJData = new KDJEntity(null);
105 | mRSIData = new RSIEntity(null);
106 | }
107 |
108 | @Override
109 | protected void onDraw(Canvas canvas) {
110 | super.onDraw(canvas);
111 | if (mOHLCData == null || mOHLCData.size() <= 0) {
112 | return;
113 | }
114 | drawUpperRegion(canvas);
115 | drawLowerRegion(canvas);
116 | drawTitles(canvas);
117 | drawCandleDetails(canvas);
118 | }
119 |
120 | private void drawCandleDetails(Canvas canvas) {
121 | if (showDetails) {
122 | float width = getWidth();
123 | float left = 3.0f;
124 | float top = (float) (5.0 + DEFAULT_AXIS_TITLE_SIZE);
125 | float right = 3.0f + 7 * DEFAULT_AXIS_TITLE_SIZE;
126 | float bottom = 8.0f + 7 * DEFAULT_AXIS_TITLE_SIZE;
127 | if (mStartX < width / 2.0f) {
128 | right = width - 4.0f;
129 | left = width - 4.0f - 7 * DEFAULT_AXIS_TITLE_SIZE;
130 | }
131 | int selectIndext = (int) ((width - 2.0f - mStartX) / mCandleWidth + mDataStartIndext);
132 |
133 | // 绘制点击线条及详情区域
134 | Paint paint = new Paint();
135 | paint.setColor(Color.LTGRAY);
136 | paint.setAlpha(150);
137 | canvas.drawLine(mStartX, 2.0f + DEFAULT_AXIS_TITLE_SIZE, mStartX, UPER_CHART_BOTTOM,
138 | paint);
139 | canvas.drawLine(mStartX, getHeight() - 2.0f, mStartX, LOWER_CHART_TOP, paint);
140 | canvas.drawRect(left, top, right, bottom, paint);
141 |
142 | Paint borderPaint = new Paint();
143 | borderPaint.setColor(Color.WHITE);
144 | borderPaint.setStrokeWidth(2);
145 | canvas.drawLine(left, top, left, bottom, borderPaint);
146 | canvas.drawLine(left, top, right, top, borderPaint);
147 | canvas.drawLine(right, bottom, right, top, borderPaint);
148 | canvas.drawLine(right, bottom, left, bottom, borderPaint);
149 |
150 | // 绘制详情文字
151 | Paint textPaint = new Paint();
152 | textPaint.setTextSize(DEFAULT_AXIS_TITLE_SIZE);
153 | textPaint.setColor(Color.WHITE);
154 | textPaint.setFakeBoldText(true);
155 | canvas.drawText("日期: " + mOHLCData.get(selectIndext).getDate(), left + 1, top
156 | + DEFAULT_AXIS_TITLE_SIZE, textPaint);
157 |
158 | canvas.drawText("开盘:", left + 1, top + DEFAULT_AXIS_TITLE_SIZE * 2.0f, textPaint);
159 | double open = mOHLCData.get(selectIndext).getOpen();
160 | try {
161 | double ysdclose = mOHLCData.get(selectIndext + 1).getClose();
162 | if (open >= ysdclose) {
163 | textPaint.setColor(Color.RED);
164 | } else {
165 | textPaint.setColor(Color.GREEN);
166 | }
167 | canvas.drawText(new DecimalFormat("#.##").format(open), left + 1
168 | + DEFAULT_AXIS_TITLE_SIZE * 2.5f, top + DEFAULT_AXIS_TITLE_SIZE * 2.0f,
169 | textPaint);
170 | } catch (Exception e) {
171 | canvas.drawText(new DecimalFormat("#.##").format(open), left + 1
172 | + DEFAULT_AXIS_TITLE_SIZE * 2.5f, top + DEFAULT_AXIS_TITLE_SIZE * 2.0f,
173 | textPaint);
174 | }
175 |
176 | textPaint.setColor(Color.WHITE);
177 | canvas.drawText("最高:", left + 1, top + DEFAULT_AXIS_TITLE_SIZE * 3.0f, textPaint);
178 | double high = mOHLCData.get(selectIndext).getHigh();
179 | if (open < high) {
180 | textPaint.setColor(Color.RED);
181 | } else {
182 | textPaint.setColor(Color.GREEN);
183 | }
184 | canvas.drawText(new DecimalFormat("#.##").format(high), left + 1
185 | + DEFAULT_AXIS_TITLE_SIZE * 2.5f, top + DEFAULT_AXIS_TITLE_SIZE * 3.0f,
186 | textPaint);
187 |
188 | textPaint.setColor(Color.WHITE);
189 | canvas.drawText("最低:", left + 1, top + DEFAULT_AXIS_TITLE_SIZE * 4.0f, textPaint);
190 | double low = mOHLCData.get(selectIndext).getLow();
191 | try {
192 | double yesterday = (mOHLCData.get(selectIndext + 1).getLow() + mOHLCData.get(
193 | selectIndext + 1).getHigh()) / 2.0f;
194 | if (yesterday <= low) {
195 | textPaint.setColor(Color.RED);
196 | } else {
197 | textPaint.setColor(Color.GREEN);
198 | }
199 | } catch (Exception e) {
200 |
201 | }
202 | canvas.drawText(new DecimalFormat("#.##").format(low), left + 1
203 | + DEFAULT_AXIS_TITLE_SIZE * 2.5f, top + DEFAULT_AXIS_TITLE_SIZE * 4.0f,
204 | textPaint);
205 |
206 | textPaint.setColor(Color.WHITE);
207 | canvas.drawText("收盘:", left + 1, top + DEFAULT_AXIS_TITLE_SIZE * 5.0f, textPaint);
208 | double close = mOHLCData.get(selectIndext).getClose();
209 | try {
210 | double yesdopen = (mOHLCData.get(selectIndext + 1).getLow() + mOHLCData.get(
211 | selectIndext + 1).getHigh()) / 2.0f;
212 | if (yesdopen <= close) {
213 | textPaint.setColor(Color.RED);
214 | } else {
215 | textPaint.setColor(Color.GREEN);
216 | }
217 | } catch (Exception e) {
218 |
219 | }
220 | canvas.drawText(new DecimalFormat("#.##").format(close), left + 1
221 | + DEFAULT_AXIS_TITLE_SIZE * 2.5f, top + DEFAULT_AXIS_TITLE_SIZE * 5.0f,
222 | textPaint);
223 |
224 | textPaint.setColor(Color.WHITE);
225 | canvas.drawText("涨跌幅:", left + 1, top + DEFAULT_AXIS_TITLE_SIZE * 6.0f, textPaint);
226 | try {
227 | double yesdclose = mOHLCData.get(selectIndext + 1).getClose();
228 | double priceRate = (close - yesdclose) / yesdclose;
229 | if (priceRate >= 0) {
230 | textPaint.setColor(Color.RED);
231 | } else {
232 | textPaint.setColor(Color.GREEN);
233 | }
234 | canvas.drawText(new DecimalFormat("#.##%").format(priceRate), left + 1
235 | + DEFAULT_AXIS_TITLE_SIZE * 3.5f, top + DEFAULT_AXIS_TITLE_SIZE * 6.0f,
236 | textPaint);
237 | } catch (Exception e) {
238 | canvas.drawText("--", left + 1 + DEFAULT_AXIS_TITLE_SIZE * 3.5f, top
239 | + DEFAULT_AXIS_TITLE_SIZE * 6.0f, textPaint);
240 | }
241 | }
242 |
243 | }
244 |
245 | private void drawTitles(Canvas canvas) {
246 | Paint textPaint = new Paint();
247 | textPaint.setColor(DEFAULT_AXIS_Y_TITLE_COLOR);
248 | textPaint.setTextSize(DEFAULT_AXIS_TITLE_SIZE);
249 |
250 | // Y轴Titles
251 | canvas.drawText(new DecimalFormat("#.##").format(mMinPrice), 1, UPER_CHART_BOTTOM - 1,
252 | textPaint);
253 | canvas.drawText(new DecimalFormat("#.##").format(mMinPrice + (mMaxPrice - mMinPrice) / 4),
254 | 1, UPER_CHART_BOTTOM - getLatitudeSpacing() - 1, textPaint);
255 | canvas.drawText(
256 | new DecimalFormat("#.##").format(mMinPrice + (mMaxPrice - mMinPrice) / 4 * 2), 1,
257 | UPER_CHART_BOTTOM - getLatitudeSpacing() * 2 - 1, textPaint);
258 | canvas.drawText(
259 | new DecimalFormat("#.##").format(mMinPrice + (mMaxPrice - mMinPrice) / 4 * 3), 1,
260 | UPER_CHART_BOTTOM - getLatitudeSpacing() * 3 - 1, textPaint);
261 | canvas.drawText(new DecimalFormat("#.##").format(mMaxPrice), 1,
262 | DEFAULT_AXIS_TITLE_SIZE * 2, textPaint);
263 |
264 | // X轴Titles
265 | textPaint.setColor(DEFAULT_AXIS_X_TITLE_COLOR);
266 | canvas.drawText(mOHLCData.get(mDataStartIndext).getDate(), getWidth() - 4 - 4.5f
267 | * DEFAULT_AXIS_TITLE_SIZE, UPER_CHART_BOTTOM + DEFAULT_AXIS_TITLE_SIZE, textPaint);
268 | try {
269 | canvas.drawText(
270 | String.valueOf(mOHLCData.get(mDataStartIndext + mShowDataNum / 2).getDate()),
271 | getWidth() / 2 - 2.25f * DEFAULT_AXIS_TITLE_SIZE, UPER_CHART_BOTTOM
272 | + DEFAULT_AXIS_TITLE_SIZE, textPaint);
273 | canvas.drawText(
274 | String.valueOf(mOHLCData.get(mDataStartIndext + mShowDataNum - 1).getDate()),
275 | 2, UPER_CHART_BOTTOM + DEFAULT_AXIS_TITLE_SIZE, textPaint);
276 | } catch (Exception e) {
277 |
278 | }
279 | }
280 |
281 | private void drawUpperRegion(Canvas canvas) {
282 | // 绘制蜡烛图
283 | Paint redPaint = new Paint();
284 | redPaint.setColor(Color.RED);
285 | Paint greenPaint = new Paint();
286 | greenPaint.setColor(Color.GREEN);
287 | int width = getWidth();
288 | mCandleWidth = (width - 4) / 10.0 * 10.0 / mShowDataNum;
289 | double rate = (getUperChartHeight() - 2) / (mMaxPrice - mMinPrice);
290 | for (int i = 0; i < mShowDataNum && mDataStartIndext + i < mOHLCData.size(); i++) {
291 | OHLCEntity entity = mOHLCData.get(mDataStartIndext + i);
292 | float open = (float) ((mMaxPrice - entity.getOpen()) * rate + DEFAULT_AXIS_TITLE_SIZE + 4);
293 | float close = (float) ((mMaxPrice - entity.getClose()) * rate + DEFAULT_AXIS_TITLE_SIZE + 4);
294 | float high = (float) ((mMaxPrice - entity.getHigh()) * rate + DEFAULT_AXIS_TITLE_SIZE + 4);
295 | float low = (float) ((mMaxPrice - entity.getLow()) * rate + DEFAULT_AXIS_TITLE_SIZE + 4);
296 |
297 | float left = (float) (width - 2 - mCandleWidth * (i + 1));
298 | float right = (float) (width - 3 - mCandleWidth * i);
299 | float startX = (float) (width - 3 - mCandleWidth * i - (mCandleWidth - 1) / 2);
300 | if (open < close) {
301 | canvas.drawRect(left, close, right, open, greenPaint);
302 | canvas.drawLine(startX, high, startX, low, greenPaint);
303 | } else if (open == close) {
304 | canvas.drawLine(left, open, right, open, redPaint);
305 | canvas.drawLine(startX, high, startX, low, redPaint);
306 | } else {
307 | canvas.drawRect(left, open, right, close, redPaint);
308 | canvas.drawLine(startX, high, startX, low, redPaint);
309 | }
310 |
311 | }
312 |
313 | // 绘制上部曲线图及上部分MA值
314 | float MATitleWidth = width / 10.0f * 10.0f / MALineData.size();
315 | for (int j = 0; j < MALineData.size(); j++) {
316 | MALineEntity lineEntity = MALineData.get(j);
317 |
318 | float startX = 0;
319 | float startY = 0;
320 | Paint paint = new Paint();
321 | paint.setColor(lineEntity.getLineColor());
322 | paint.setTextSize(DEFAULT_AXIS_TITLE_SIZE);
323 | canvas.drawText(
324 | lineEntity.getTitle()
325 | + "="
326 | + new DecimalFormat("#.##").format(lineEntity.getLineData().get(
327 | mDataStartIndext)), 2 + MATitleWidth * j,
328 | DEFAULT_AXIS_TITLE_SIZE, paint);
329 | for (int i = 0; i < mShowDataNum
330 | && mDataStartIndext + i < lineEntity.getLineData().size(); i++) {
331 | if (i != 0) {
332 | canvas.drawLine(
333 | startX,
334 | startY + DEFAULT_AXIS_TITLE_SIZE + 4,
335 | (float) (width - 2 - mCandleWidth * i - mCandleWidth * 0.5f),
336 | (float) ((mMaxPrice - lineEntity.getLineData()
337 | .get(mDataStartIndext + i)) * rate + DEFAULT_AXIS_TITLE_SIZE + 4),
338 | paint);
339 | }
340 | startX = (float) (width - 2 - mCandleWidth * i - mCandleWidth * 0.5f);
341 | startY = (float) ((mMaxPrice - lineEntity.getLineData().get(mDataStartIndext + i)) * rate);
342 | }
343 | }
344 | }
345 |
346 | private void drawLowerRegion(Canvas canvas) {
347 | float lowertop = LOWER_CHART_TOP + 1;
348 | float lowerHight = getHeight() - lowertop - 4;
349 | float viewWidth = getWidth();
350 |
351 | // 下部表的数据
352 | // MACDData mMACDData;
353 | // KDJData mKDJData;
354 | // RSIData mRSIData;
355 | Paint whitePaint = new Paint();
356 | whitePaint.setColor(Color.WHITE);
357 | Paint yellowPaint = new Paint();
358 | yellowPaint.setColor(Color.YELLOW);
359 | Paint magentaPaint = new Paint();
360 | magentaPaint.setColor(Color.MAGENTA);
361 |
362 | Paint textPaint = new Paint();
363 | textPaint.setColor(DEFAULT_AXIS_Y_TITLE_COLOR);
364 | textPaint.setTextSize(DEFAULT_AXIS_TITLE_SIZE);
365 | if (mTabTitle.trim().equalsIgnoreCase("MACD")) {
366 | List MACD = mMACDData.getMACD();
367 | List DEA = mMACDData.getDEA();
368 | List DIF = mMACDData.getDIF();
369 |
370 | double low = DEA.get(mDataStartIndext);
371 | double high = low;
372 | double rate = 0.0;
373 | for (int i = mDataStartIndext; i < mDataStartIndext + mShowDataNum && i < MACD.size(); i++) {
374 | low = low < MACD.get(i) ? low : MACD.get(i);
375 | low = low < DEA.get(i) ? low : DEA.get(i);
376 | low = low < DIF.get(i) ? low : DIF.get(i);
377 |
378 | high = high > MACD.get(i) ? high : MACD.get(i);
379 | high = high > DEA.get(i) ? high : DEA.get(i);
380 | high = high > DIF.get(i) ? high : DIF.get(i);
381 | }
382 | rate = lowerHight / (high - low);
383 |
384 | Paint paint = new Paint();
385 | float zero = (float) (high * rate) + lowertop;
386 | if (zero < lowertop) {
387 | zero = lowertop;
388 | }
389 | // 绘制双线
390 | float dea = 0.0f;
391 | float dif = 0.0f;
392 | for (int i = mDataStartIndext; i < mDataStartIndext + mShowDataNum && i < MACD.size(); i++) {
393 | // 绘制矩形
394 | if (MACD.get(i) >= 0.0) {
395 | paint.setColor(Color.RED);
396 | float top = (float) ((high - MACD.get(i)) * rate) + lowertop;
397 | if (zero - top < 0.55f) {
398 | canvas.drawLine(viewWidth - 1 - (float) mCandleWidth
399 | * (i + 1 - mDataStartIndext), zero, viewWidth - 2
400 | - (float) mCandleWidth * (i - mDataStartIndext), zero, paint);
401 | } else {
402 | canvas.drawRect(viewWidth - 1 - (float) mCandleWidth
403 | * (i + 1 - mDataStartIndext), top, viewWidth - 2
404 | - (float) mCandleWidth * (i - mDataStartIndext), zero, paint);
405 | }
406 |
407 | } else {
408 | paint.setColor(Color.GREEN);
409 | float bottom = (float) ((high - MACD.get(i)) * rate) + lowertop;
410 |
411 | if (bottom - zero < 0.55f) {
412 | canvas.drawLine(viewWidth - 1 - (float) mCandleWidth
413 | * (i + 1 - mDataStartIndext), zero, viewWidth - 2
414 | - (float) mCandleWidth * (i - mDataStartIndext), zero, paint);
415 | } else {
416 | canvas.drawRect(viewWidth - 1 - (float) mCandleWidth
417 | * (i + 1 - mDataStartIndext), zero, viewWidth - 2
418 | - (float) mCandleWidth * (i - mDataStartIndext), bottom, paint);
419 | }
420 | }
421 |
422 | if (i != mDataStartIndext) {
423 | canvas.drawLine(viewWidth - 1 - (float) mCandleWidth
424 | * (i + 1 - mDataStartIndext) + (float) mCandleWidth / 2,
425 | (float) ((high - DEA.get(i)) * rate) + lowertop, viewWidth - 2
426 | - (float) mCandleWidth * (i - mDataStartIndext)
427 | + (float) mCandleWidth / 2, dea, whitePaint);
428 |
429 | canvas.drawLine(viewWidth - 1 - (float) mCandleWidth
430 | * (i + 1 - mDataStartIndext) + (float) mCandleWidth / 2,
431 | (float) ((high - DIF.get(i)) * rate) + lowertop, viewWidth - 2
432 | - (float) mCandleWidth * (i - mDataStartIndext)
433 | + (float) mCandleWidth / 2, dif, yellowPaint);
434 | }
435 | dea = (float) ((high - DEA.get(i)) * rate) + lowertop;
436 | dif = (float) ((high - DIF.get(i)) * rate) + lowertop;
437 | }
438 |
439 | canvas.drawText(new DecimalFormat("#.##").format(high), 2, lowertop
440 | + DEFAULT_AXIS_TITLE_SIZE - 2, textPaint);
441 | canvas.drawText(new DecimalFormat("#.##").format((high + low) / 2), 2, lowertop
442 | + lowerHight / 2 + DEFAULT_AXIS_TITLE_SIZE, textPaint);
443 | canvas.drawText(new DecimalFormat("#.##").format(low), 2, lowertop + lowerHight,
444 | textPaint);
445 |
446 | } else if (mTabTitle.trim().equalsIgnoreCase("KDJ")) {
447 | List Ks = mKDJData.getK();
448 | List Ds = mKDJData.getD();
449 | List Js = mKDJData.getJ();
450 |
451 | double low = Ks.get(mDataStartIndext);
452 | double high = low;
453 | double rate = 0.0;
454 | for (int i = mDataStartIndext; i < mDataStartIndext + mShowDataNum && i < Ks.size(); i++) {
455 | low = low < Ks.get(i) ? low : Ks.get(i);
456 | low = low < Ds.get(i) ? low : Ds.get(i);
457 | low = low < Js.get(i) ? low : Js.get(i);
458 |
459 | high = high > Ks.get(i) ? high : Ks.get(i);
460 | high = high > Ds.get(i) ? high : Ds.get(i);
461 | high = high > Js.get(i) ? high : Js.get(i);
462 | }
463 | rate = lowerHight / (high - low);
464 |
465 | // 绘制白、黄、紫线
466 | float k = 0.0f;
467 | float d = 0.0f;
468 | float j = 0.0f;
469 | for (int i = mDataStartIndext; i < mDataStartIndext + mShowDataNum && i < Ks.size(); i++) {
470 |
471 | if (i != mDataStartIndext) {
472 | canvas.drawLine(viewWidth - 1 - (float) mCandleWidth
473 | * (i + 1 - mDataStartIndext) + (float) mCandleWidth / 2,
474 | (float) ((high - Ks.get(i)) * rate) + lowertop, viewWidth - 2
475 | - (float) mCandleWidth * (i - mDataStartIndext)
476 | + (float) mCandleWidth / 2, k, whitePaint);
477 |
478 | canvas.drawLine(viewWidth - 1 - (float) mCandleWidth
479 | * (i + 1 - mDataStartIndext) + (float) mCandleWidth / 2,
480 | (float) ((high - Ds.get(i)) * rate) + lowertop, viewWidth - 2
481 | - (float) mCandleWidth * (i - mDataStartIndext)
482 | + (float) mCandleWidth / 2, d, yellowPaint);
483 |
484 | canvas.drawLine(viewWidth - 1 - (float) mCandleWidth
485 | * (i + 1 - mDataStartIndext) + (float) mCandleWidth / 2,
486 | (float) ((high - Js.get(i)) * rate) + lowertop, viewWidth - 2
487 | - (float) mCandleWidth * (i - mDataStartIndext)
488 | + (float) mCandleWidth / 2, j, magentaPaint);
489 | }
490 | k = (float) ((high - Ks.get(i)) * rate) + lowertop;
491 | d = (float) ((high - Ds.get(i)) * rate) + lowertop;
492 | j = (float) ((high - Js.get(i)) * rate) + lowertop;
493 | }
494 |
495 | canvas.drawText(new DecimalFormat("#.##").format(high), 2, lowertop
496 | + DEFAULT_AXIS_TITLE_SIZE - 2, textPaint);
497 | canvas.drawText(new DecimalFormat("#.##").format((high + low) / 2), 2, lowertop
498 | + lowerHight / 2 + DEFAULT_AXIS_TITLE_SIZE, textPaint);
499 | canvas.drawText(new DecimalFormat("#.##").format(low), 2, lowertop + lowerHight,
500 | textPaint);
501 |
502 | } else if (mTabTitle.trim().equalsIgnoreCase("RSI")) {
503 |
504 | }
505 |
506 | }
507 |
508 | @Override
509 | public boolean onTouchEvent(MotionEvent event) {
510 | switch (event.getAction() & MotionEvent.ACTION_MASK) {
511 | // 设置触摸模式
512 | case MotionEvent.ACTION_DOWN:
513 | TOUCH_MODE = DOWN;
514 | mStartX = event.getRawX();
515 | mStartY = event.getRawY();
516 | break;
517 | case MotionEvent.ACTION_UP:
518 | case MotionEvent.ACTION_POINTER_UP:
519 | if (TOUCH_MODE == DOWN) {
520 | TOUCH_MODE = NONE;
521 | if (!super.onTouchEvent(event)) {
522 | if (mStartX > 2.0f && mStartX < getWidth() - 2.0f) {
523 | showDetails = true;
524 | }
525 | }
526 | postInvalidate();
527 | } else {
528 | TOUCH_MODE = NONE;
529 | }
530 | break;
531 | case MotionEvent.ACTION_CANCEL:
532 | TOUCH_MODE = NONE;
533 | break;
534 | case MotionEvent.ACTION_MOVE:
535 | if (mOHLCData == null || mOHLCData.size() <= 0) {
536 | return true;
537 | }
538 | showDetails = false;
539 | if (TOUCH_MODE == MOVE) {
540 | float horizontalSpacing = event.getRawX() - mStartX;
541 | if (Math.abs(horizontalSpacing) < MIN_MOVE_DISTANCE) {
542 | return true;
543 | }
544 | mStartX = event.getRawX();
545 | mStartY = event.getRawY();
546 | if (horizontalSpacing < 0) {
547 | mDataStartIndext--;
548 | if (mDataStartIndext < 0) {
549 | mDataStartIndext = 0;
550 | }
551 | } else if (horizontalSpacing > 0) {
552 | mDataStartIndext++;
553 | }
554 | setCurrentData();
555 | postInvalidate();
556 | } else if (TOUCH_MODE == ZOOM) {
557 | float verticalSpacing = event.getRawY() - mStartY;
558 | if (Math.abs(verticalSpacing) < MIN_MOVE_DISTANCE) {
559 | return true;
560 | }
561 | mStartX = event.getRawX();
562 | mStartY = event.getRawY();
563 | if (verticalSpacing < 0) {
564 | zoomOut();
565 | } else {
566 | zoomIn();
567 | }
568 | setCurrentData();
569 | postInvalidate();
570 |
571 | } else if (TOUCH_MODE == DOWN) {
572 | setTouchMode(event);
573 | }
574 |
575 | break;
576 | }
577 | return true;
578 | }
579 |
580 | private void setCurrentData() {
581 | if (mShowDataNum > mOHLCData.size()) {
582 | mShowDataNum = mOHLCData.size();
583 | }
584 | if (MIN_CANDLE_NUM > mOHLCData.size()) {
585 | mShowDataNum = MIN_CANDLE_NUM;
586 | }
587 |
588 | if (mShowDataNum > mOHLCData.size()) {
589 | mDataStartIndext = 0;
590 | } else if (mShowDataNum + mDataStartIndext > mOHLCData.size()) {
591 | mDataStartIndext = mOHLCData.size() - mShowDataNum;
592 | }
593 | mMinPrice = mOHLCData.get(mDataStartIndext).getLow();
594 | mMaxPrice = mOHLCData.get(mDataStartIndext).getHigh();
595 | for (int i = mDataStartIndext + 1; i < mOHLCData.size()
596 | && i < mShowDataNum + mDataStartIndext; i++) {
597 | OHLCEntity entity = mOHLCData.get(i);
598 | mMinPrice = mMinPrice < entity.getLow() ? mMinPrice : entity.getLow();
599 | mMaxPrice = mMaxPrice > entity.getHigh() ? mMaxPrice : entity.getHigh();
600 | }
601 |
602 | for (MALineEntity lineEntity : MALineData) {
603 | for (int i = mDataStartIndext; i < lineEntity.getLineData().size()
604 | && i < mShowDataNum + mDataStartIndext; i++) {
605 | mMinPrice = mMinPrice < lineEntity.getLineData().get(i) ? mMinPrice : lineEntity
606 | .getLineData().get(i);
607 | mMaxPrice = mMaxPrice > lineEntity.getLineData().get(i) ? mMaxPrice : lineEntity
608 | .getLineData().get(i);
609 | }
610 | }
611 |
612 | }
613 |
614 | private void zoomIn() {
615 | mShowDataNum++;
616 | if (mShowDataNum > mOHLCData.size()) {
617 | mShowDataNum = MIN_CANDLE_NUM > mOHLCData.size() ? MIN_CANDLE_NUM : mOHLCData.size();
618 | }
619 |
620 | }
621 |
622 | private void zoomOut() {
623 | mShowDataNum--;
624 | if (mShowDataNum < MIN_CANDLE_NUM) {
625 | mShowDataNum = MIN_CANDLE_NUM;
626 | }
627 |
628 | }
629 |
630 | private void setTouchMode(MotionEvent event) {
631 | float daltX = Math.abs(event.getRawX() - mStartX);
632 | float daltY = Math.abs(event.getRawY() - mStartY);
633 | if (FloatMath.sqrt(daltX * daltX + daltY * daltY) > MIN_MOVE_DISTANCE) {
634 | if (daltX < daltY) {
635 | TOUCH_MODE = ZOOM;
636 | } else {
637 | TOUCH_MODE = MOVE;
638 | }
639 | mStartX = event.getRawX();
640 | mStartY = event.getRawY();
641 | }
642 | }
643 |
644 | /**
645 | * 初始化MA值,从数组的最后一个数据开始初始化
646 | *
647 | * @param entityList
648 | * @param days
649 | * @return
650 | */
651 | private List initMA(List entityList, int days) {
652 | if (days < 2 || entityList == null || entityList.size() <= 0) {
653 | return null;
654 | }
655 | List MAValues = new ArrayList();
656 |
657 | float sum = 0;
658 | float avg = 0;
659 | for (int i = entityList.size() - 1; i >= 0; i--) {
660 | float close = (float) entityList.get(i).getClose();
661 | if (i > entityList.size() - days) {
662 | sum = sum + close;
663 | avg = sum / (entityList.size() - i);
664 | } else {
665 | sum = close + avg * (days - 1);
666 | avg = sum / days;
667 | }
668 | MAValues.add(avg);
669 | }
670 |
671 | List result = new ArrayList();
672 | for (int j = MAValues.size() - 1; j >= 0; j--) {
673 | result.add(MAValues.get(j));
674 | }
675 | return result;
676 | }
677 |
678 | public List getOHLCData() {
679 | return mOHLCData;
680 | }
681 |
682 | public void setOHLCData(List OHLCData) {
683 | if (OHLCData == null || OHLCData.size() <= 0) {
684 | return;
685 | }
686 | this.mOHLCData = OHLCData;
687 | initMALineData();
688 | mMACDData = new MACDEntity(mOHLCData);
689 | mKDJData = new KDJEntity(mOHLCData);
690 | mRSIData = new RSIEntity(mOHLCData);
691 |
692 | setCurrentData();
693 | postInvalidate();
694 | }
695 |
696 | private void initMALineData() {
697 | MALineEntity MA5 = new MALineEntity();
698 | MA5.setTitle("MA5");
699 | MA5.setLineColor(Color.WHITE);
700 | MA5.setLineData(initMA(mOHLCData, 5));
701 |
702 | MALineEntity MA10 = new MALineEntity();
703 | MA10.setTitle("MA10");
704 | MA10.setLineColor(Color.CYAN);
705 | MA10.setLineData(initMA(mOHLCData, 10));
706 |
707 | MALineEntity MA20 = new MALineEntity();
708 | MA20.setTitle("MA20");
709 | MA20.setLineColor(Color.BLUE);
710 | MA20.setLineData(initMA(mOHLCData, 20));
711 |
712 | MALineData = new ArrayList();
713 | MALineData.add(MA5);
714 | MALineData.add(MA10);
715 | MALineData.add(MA20);
716 |
717 | }
718 |
719 | public void onTabClick(int indext) {
720 | String[] titles = getLowerChartTabTitles();
721 | mTabTitle = titles[indext];
722 | postInvalidate();
723 | }
724 | }
725 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/zhangchen/stock/futures/view/TimesView.java:
--------------------------------------------------------------------------------
1 | package com.example.zhangchen.stock.futures.view;
2 |
3 | import java.text.DecimalFormat;
4 | import java.util.List;
5 |
6 | import android.content.Context;
7 | import android.graphics.Canvas;
8 | import android.graphics.Color;
9 | import android.graphics.Paint;
10 | import android.util.AttributeSet;
11 | import android.view.MotionEvent;
12 |
13 | import com.android.futures.entity.TimesEntity;
14 |
15 | public class TimesView extends GridChart {
16 | private final int DATA_MAX_COUNT = 4 * 60;
17 | private List timesList;
18 |
19 | private float uperBottom;
20 | private float uperHeight;
21 | private float lowerBottom;
22 | private float lowerHeight;
23 | private float dataSpacing;
24 |
25 | private double initialWeightedIndex;
26 | private float uperHalfHigh;
27 | private float lowerHigh;
28 | private float uperRate;
29 | private float lowerRate;
30 |
31 | private boolean showDetails;
32 | private float touchX;
33 |
34 | public TimesView(Context context) {
35 | super(context);
36 | init();
37 | }
38 |
39 | public TimesView(Context context, AttributeSet attrs) {
40 | super(context, attrs);
41 | init();
42 | }
43 |
44 | public TimesView(Context context, AttributeSet attrs, int defStyle) {
45 | super(context, attrs, defStyle);
46 | init();
47 | }
48 |
49 | private void init() {
50 | super.setShowLowerChartTabs(false);
51 | super.setShowTopTitles(false);
52 |
53 | timesList = null;
54 | uperBottom = 0;
55 | uperHeight = 0;
56 | lowerBottom = 0;
57 | lowerHeight = 0;
58 | dataSpacing = 0;
59 |
60 | initialWeightedIndex = 0;
61 | uperHalfHigh = 0;
62 | lowerHigh = 0;
63 | uperRate = 0;
64 | lowerRate = 0;
65 | showDetails = false;
66 | touchX = 0;
67 |
68 | }
69 |
70 | @Override
71 | protected void onDraw(Canvas canvas) {
72 | super.onDraw(canvas);
73 | if (timesList == null || timesList.size() <= 0) {
74 | return;
75 | }
76 | uperBottom = UPER_CHART_BOTTOM - 2;
77 | uperHeight = getUperChartHeight() - 4;
78 | lowerBottom = getHeight() - 3;
79 | lowerHeight = getLowerChartHeight() - 2;
80 | dataSpacing = (getWidth() - 4) * 10.0f / 10.0f / DATA_MAX_COUNT;
81 |
82 | if (uperHalfHigh > 0) {
83 | uperRate = uperHeight / uperHalfHigh / 2.0f;
84 | }
85 | if (lowerHigh > 0) {
86 | lowerRate = lowerHeight / lowerHigh;
87 | }
88 |
89 | // 绘制上部曲线及下部线条
90 | drawLines(canvas);
91 |
92 | // 绘制坐标标题
93 | drawTitles(canvas);
94 |
95 | // 绘制点击时的详细信息
96 | drawDetails(canvas);
97 | }
98 |
99 | private void drawDetails(Canvas canvas) {
100 | if (showDetails) {
101 | float width = getWidth();
102 | float left = 5.0f;
103 | float top = 4.0f;
104 | float right = 3.0f + 6.5f * DEFAULT_AXIS_TITLE_SIZE;
105 | float bottom = 7.0f + 4 * DEFAULT_AXIS_TITLE_SIZE;
106 | if (touchX < width / 2.0f) {
107 | right = width - 4.0f;
108 | left = width - 4.0f - 6.5f * DEFAULT_AXIS_TITLE_SIZE;
109 | }
110 |
111 | // 绘制点击线条及详情区域
112 | Paint paint = new Paint();
113 | paint.setColor(Color.LTGRAY);
114 | paint.setAlpha(150);
115 | canvas.drawLine(touchX, 2.0f, touchX, UPER_CHART_BOTTOM, paint);
116 | canvas.drawLine(touchX, lowerBottom - lowerHeight, touchX, lowerBottom, paint);
117 | canvas.drawRect(left, top, right, bottom, paint);
118 |
119 | Paint borderPaint = new Paint();
120 | borderPaint.setColor(Color.WHITE);
121 | borderPaint.setStrokeWidth(2);
122 | canvas.drawLine(left, top, left, bottom, borderPaint);
123 | canvas.drawLine(left, top, right, top, borderPaint);
124 | canvas.drawLine(right, bottom, right, top, borderPaint);
125 | canvas.drawLine(right, bottom, left, bottom, borderPaint);
126 |
127 | // 绘制详情文字
128 | Paint textPaint = new Paint();
129 | textPaint.setTextSize(DEFAULT_AXIS_TITLE_SIZE);
130 | textPaint.setColor(Color.WHITE);
131 | textPaint.setFakeBoldText(true);
132 | try {
133 | TimesEntity fenshiData = timesList.get((int) ((touchX - 2) / dataSpacing));
134 | canvas.drawText("时间: " + fenshiData.getTime(), left + 1, top
135 | + DEFAULT_AXIS_TITLE_SIZE, textPaint);
136 |
137 | canvas.drawText("价格:", left + 1, top + DEFAULT_AXIS_TITLE_SIZE * 2.0f, textPaint);
138 | double price = fenshiData.getWeightedIndex();
139 | if (price >= initialWeightedIndex) {
140 | textPaint.setColor(Color.RED);
141 | } else {
142 | textPaint.setColor(Color.GREEN);
143 | }
144 | canvas.drawText(new DecimalFormat("#.##").format(price), left + 1
145 | + DEFAULT_AXIS_TITLE_SIZE * 2.5f, top + DEFAULT_AXIS_TITLE_SIZE * 2.0f,
146 | textPaint);
147 |
148 | textPaint.setColor(Color.WHITE);
149 | canvas.drawText("涨跌:", left + 1, top + DEFAULT_AXIS_TITLE_SIZE * 3.0f, textPaint);
150 | double change = (fenshiData.getWeightedIndex() - initialWeightedIndex)
151 | / initialWeightedIndex;
152 | if (change >= 0) {
153 | textPaint.setColor(Color.RED);
154 | } else {
155 | textPaint.setColor(Color.GREEN);
156 | }
157 | canvas.drawText(new DecimalFormat("#.##%").format(change), left + 1
158 | + DEFAULT_AXIS_TITLE_SIZE * 2.5f, top + DEFAULT_AXIS_TITLE_SIZE * 3.0f,
159 | textPaint);
160 |
161 | textPaint.setColor(Color.WHITE);
162 | canvas.drawText("成交:", left + 1, top + DEFAULT_AXIS_TITLE_SIZE * 4.0f, textPaint);
163 | textPaint.setColor(Color.YELLOW);
164 | canvas.drawText(String.valueOf(fenshiData.getVolume()), left + 1
165 | + DEFAULT_AXIS_TITLE_SIZE * 2.5f, top + DEFAULT_AXIS_TITLE_SIZE * 4.0f,
166 | textPaint);
167 |
168 | } catch (Exception e) {
169 | canvas.drawText("时间: --", left + 1, top + DEFAULT_AXIS_TITLE_SIZE, textPaint);
170 | canvas.drawText("价格: --", left + 1, top + DEFAULT_AXIS_TITLE_SIZE * 2.0f, textPaint);
171 | canvas.drawText("涨跌: --", left + 1, top + DEFAULT_AXIS_TITLE_SIZE * 3.0f, textPaint);
172 | canvas.drawText("成交: --", left + 1, top + DEFAULT_AXIS_TITLE_SIZE * 4.0f, textPaint);
173 | }
174 | }
175 |
176 | }
177 |
178 | private void drawTitles(Canvas canvas) {
179 | // 绘制Y轴titles
180 | float viewWidth = getWidth();
181 | Paint paint = new Paint();
182 | paint.setTextSize(DEFAULT_AXIS_TITLE_SIZE);
183 |
184 | paint.setColor(Color.GREEN);
185 | canvas.drawText(new DecimalFormat("#.##").format(initialWeightedIndex - uperHalfHigh), 2,
186 | uperBottom, paint);
187 | String text = new DecimalFormat("#.##%").format(-uperHalfHigh / initialWeightedIndex);
188 | canvas.drawText(text, viewWidth - 5 - text.length() * DEFAULT_AXIS_TITLE_SIZE / 2.0f,
189 | uperBottom, paint);
190 |
191 | canvas.drawText(
192 | new DecimalFormat("#.##").format(initialWeightedIndex - uperHalfHigh * 0.5f), 2,
193 | uperBottom - getLatitudeSpacing(), paint);
194 | text = new DecimalFormat("#.##%").format(-uperHalfHigh * 0.5f / initialWeightedIndex);
195 | canvas.drawText(text, viewWidth - 5 - text.length() * DEFAULT_AXIS_TITLE_SIZE / 2.0f,
196 | uperBottom - getLatitudeSpacing(), paint);
197 |
198 | paint.setColor(Color.WHITE);
199 | canvas.drawText(new DecimalFormat("#.##").format(initialWeightedIndex), 2, uperBottom
200 | - getLatitudeSpacing() * 2, paint);
201 | text = "0.00%";
202 | canvas.drawText(text, viewWidth - 6 - text.length() * DEFAULT_AXIS_TITLE_SIZE / 2.0f,
203 | uperBottom - getLatitudeSpacing() * 2, paint);
204 |
205 | paint.setColor(Color.RED);
206 | canvas.drawText(
207 | new DecimalFormat("#.##").format(uperHalfHigh * 0.5f + initialWeightedIndex), 2,
208 | uperBottom - getLatitudeSpacing() * 3, paint);
209 | text = new DecimalFormat("#.##%").format(uperHalfHigh * 0.5f / initialWeightedIndex);
210 | canvas.drawText(text, viewWidth - 6 - text.length() * DEFAULT_AXIS_TITLE_SIZE / 2.0f,
211 | uperBottom - getLatitudeSpacing() * 3, paint);
212 |
213 | canvas.drawText(new DecimalFormat("#.##").format(uperHalfHigh + initialWeightedIndex), 2,
214 | DEFAULT_AXIS_TITLE_SIZE, paint);
215 | text = new DecimalFormat("#.##%").format(uperHalfHigh / initialWeightedIndex);
216 | canvas.drawText(text, viewWidth - 6 - text.length() * DEFAULT_AXIS_TITLE_SIZE / 2.0f,
217 | DEFAULT_AXIS_TITLE_SIZE, paint);
218 |
219 | // 绘制X轴Titles
220 | canvas.drawText("09:30", 2, uperBottom + DEFAULT_AXIS_TITLE_SIZE, paint);
221 | canvas.drawText("11:30/13:00", viewWidth / 2.0f - DEFAULT_AXIS_TITLE_SIZE * 2.5f,
222 | uperBottom + DEFAULT_AXIS_TITLE_SIZE, paint);
223 | canvas.drawText("15:00", viewWidth - 2 - DEFAULT_AXIS_TITLE_SIZE * 2.5f, uperBottom
224 | + DEFAULT_AXIS_TITLE_SIZE, paint);
225 | }
226 |
227 | private void drawLines(Canvas canvas) {
228 | float x = 0;
229 | float uperWhiteY = 0;
230 | float uperYellowY = 0;
231 | Paint paint = new Paint();
232 | for (int i = 0; i < timesList.size() && i < DATA_MAX_COUNT; i++) {
233 | TimesEntity fenshiData = timesList.get(i);
234 |
235 | // 绘制上部表中曲线
236 | float endWhiteY = (float) (uperBottom - (fenshiData.getNonWeightedIndex()
237 | + uperHalfHigh - initialWeightedIndex)
238 | * uperRate);
239 | float endYelloY = (float) (uperBottom - (fenshiData.getWeightedIndex() + uperHalfHigh - initialWeightedIndex)
240 | * uperRate);
241 |
242 | if (i != 0) {
243 | paint.setColor(Color.WHITE);
244 | canvas.drawLine(x, uperWhiteY, 3 + dataSpacing * i, endWhiteY, paint);
245 | paint.setColor(Color.YELLOW);
246 | canvas.drawLine(x, uperYellowY, 3 + dataSpacing * i, endYelloY, paint);
247 | }
248 |
249 | x = 3 + dataSpacing * i;
250 | uperWhiteY = endWhiteY;
251 | uperYellowY = endYelloY;
252 |
253 | // 绘制下部表内数据线
254 | int buy = fenshiData.getBuy();
255 | if (i <= 0) {
256 | paint.setColor(Color.RED);
257 | } else if (fenshiData.getNonWeightedIndex() >= timesList.get(i - 1)
258 | .getNonWeightedIndex()) {
259 | paint.setColor(Color.RED);
260 | } else {
261 | paint.setColor(Color.GREEN);
262 | }
263 | canvas.drawLine(x, lowerBottom, x, lowerBottom - buy * lowerRate, paint);
264 | }
265 |
266 | }
267 |
268 | @Override
269 | public boolean onTouchEvent(MotionEvent event) {
270 | switch (event.getAction()) {
271 | case MotionEvent.ACTION_DOWN:
272 | case MotionEvent.ACTION_MOVE:
273 | touchX = event.getRawX();
274 | if (touchX < 2 || touchX > getWidth() - 2) {
275 | return false;
276 | }
277 | showDetails = true;
278 | postInvalidate();
279 | break;
280 |
281 | case MotionEvent.ACTION_UP:
282 | case MotionEvent.ACTION_CANCEL:
283 | case MotionEvent.ACTION_OUTSIDE:
284 | showDetails = false;
285 | break;
286 |
287 | default:
288 | break;
289 | }
290 |
291 | return true;
292 | }
293 |
294 | public void setTimesList(List timesList) {
295 | if (timesList == null || timesList.size() <= 0) {
296 | return;
297 | }
298 | this.timesList = timesList;
299 |
300 | TimesEntity fenshiData = timesList.get(0);
301 | double weightedIndex = fenshiData.getWeightedIndex();
302 | double nonWeightedIndex = fenshiData.getNonWeightedIndex();
303 | int buy = fenshiData.getBuy();
304 | initialWeightedIndex = weightedIndex;
305 | lowerHigh = buy;
306 | for (int i = 1; i < timesList.size() && i < DATA_MAX_COUNT; i++) {
307 | fenshiData = timesList.get(i);
308 | weightedIndex = fenshiData.getWeightedIndex();
309 | nonWeightedIndex = fenshiData.getNonWeightedIndex();
310 | buy = fenshiData.getBuy();
311 |
312 | uperHalfHigh = (float) (uperHalfHigh > Math
313 | .abs(nonWeightedIndex - initialWeightedIndex) ? uperHalfHigh : Math
314 | .abs(nonWeightedIndex - initialWeightedIndex));
315 | uperHalfHigh = (float) (uperHalfHigh > Math.abs(weightedIndex - initialWeightedIndex) ? uperHalfHigh
316 | : Math.abs(weightedIndex - initialWeightedIndex));
317 | lowerHigh = lowerHigh > buy ? lowerHigh : buy;
318 | }
319 | postInvalidate();
320 |
321 | }
322 | }
323 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/drawable/back.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/back_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/drawable/back_pressed.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/drawable/bg.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_chart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/drawable/bg_chart.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_grid_cell.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/drawable/bg_grid_cell.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_grid_cell_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/drawable/bg_grid_cell_pressed.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_main.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/drawable/bg_main.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_tab.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/drawable/bg_tab.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_tab_focused.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/drawable/bg_tab_focused.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_title.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/drawable/bg_title.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/classification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/drawable/classification.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/drawable/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_pink.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/drawable/ic_pink.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/index.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/drawable/index.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/drawable/left.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/left_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/drawable/left_pressed.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/messages.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/drawable/messages.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/my_futures.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/drawable/my_futures.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/my_trasanction.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/drawable/my_trasanction.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/plates.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/drawable/plates.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ranking.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/drawable/ranking.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/refresh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/drawable/refresh.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/refresh_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/drawable/refresh_pressed.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/drawable/right.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/right_pressed.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/drawable/right_pressed.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/selector_bg_cell.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/selector_bg_tabs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/selector_btn_back.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/selector_btn_left.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/selector_btn_refresh.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/selector_btn_right.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/drawable/settings.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/standings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/drawable/standings.png
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity4fragment_my.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
20 |
21 |
30 |
31 |
39 |
40 |
48 |
49 |
57 |
58 |
66 |
67 |
68 |
74 |
75 |
82 |
83 |
91 |
92 |
100 |
101 |
110 |
111 |
112 |
117 |
118 |
124 |
125 |
133 |
134 |
141 |
142 |
151 |
152 |
159 |
160 |
169 |
170 |
171 |
176 |
177 |
183 |
184 |
191 |
192 |
199 |
200 |
209 |
210 |
217 |
218 |
227 |
228 |
229 |
230 |
236 |
237 |
243 |
244 |
250 |
251 |
256 |
257 |
258 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_welcome.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
15 |
16 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_about.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_guide.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_kcharts.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_times.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/selector_text_color.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/tab_about.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/tab_guide.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/tab_kcharts.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/tab_times.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 | >
2 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FF808080
4 | #FFFFFFFF
5 | #FF0000FF
6 | #FF000000
7 | #FFFFC0Cb
8 | #FFFF0000
9 | #FFFF8D00
10 | #FFFFFF00
11 | #FF00FF00
12 | #FFFFFFE0
13 | #FFE3EEFB
14 | #FF5271A5
15 | #FF96FF00
16 | #FF009600
17 | #FFD3D3D3
18 | #00535252
19 |
20 | #123645
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 | 16dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | 期货Demo
3 | {"data":[{"weightedIndex":6840,"changeAmount":-4,"time":"09:31","buy":968,"sell":968,"volume":28,"changeRate":-0.058,"nonWeightedIndex":6840},{"weightedIndex":6840,"changeAmount":-4,"time":"09:32","buy":472,"sell":472,"volume":28,"changeRate":-0.058,"nonWeightedIndex":6840},{"weightedIndex":6840,"changeAmount":-5,"time":"09:33","buy":562,"sell":562,"volume":38,"changeRate":-0.073,"nonWeightedIndex":6839},{"weightedIndex":6840,"changeAmount":-5,"time":"09:34","buy":590,"sell":590,"volume":38,"changeRate":-0.073,"nonWeightedIndex":6839},{"weightedIndex":6839,"changeAmount":-6,"time":"09:35","buy":682,"sell":682,"volume":52,"changeRate":-0.088,"nonWeightedIndex":6838},{"weightedIndex":6839,"changeAmount":-6,"time":"09:36","buy":826,"sell":826,"volume":52,"changeRate":-0.088,"nonWeightedIndex":6838},{"weightedIndex":6839,"changeAmount":-6,"time":"09:37","buy":658,"sell":658,"volume":62,"changeRate":-0.088,"nonWeightedIndex":6838},{"weightedIndex":6839,"changeAmount":-6,"time":"09:38","buy":610,"sell":610,"volume":62,"changeRate":-0.088,"nonWeightedIndex":6838},{"weightedIndex":6839,"changeAmount":-5,"time":"09:39","buy":666,"sell":666,"volume":74,"changeRate":-0.073,"nonWeightedIndex":6838},{"weightedIndex":6839,"changeAmount":-5,"time":"09:40","buy":708,"sell":708,"volume":74,"changeRate":-0.073,"nonWeightedIndex":6839},{"weightedIndex":6839,"changeAmount":-4,"time":"09:41","buy":670,"sell":670,"volume":84,"changeRate":-0.058,"nonWeightedIndex":6839},{"weightedIndex":6839,"changeAmount":-4,"time":"09:42","buy":590,"sell":590,"volume":84,"changeRate":-0.058,"nonWeightedIndex":6840},{"weightedIndex":6839,"changeAmount":-3,"time":"09:43","buy":590,"sell":590,"volume":94,"changeRate":-0.044,"nonWeightedIndex":6840},{"weightedIndex":6839,"changeAmount":-3,"time":"09:44","buy":590,"sell":590,"volume":94,"changeRate":-0.044,"nonWeightedIndex":6841},{"weightedIndex":6840,"changeAmount":-2,"time":"09:45","buy":610,"sell":610,"volume":104,"changeRate":-0.029,"nonWeightedIndex":6841},{"weightedIndex":6840,"changeAmount":-2,"time":"09:46","buy":590,"sell":590,"volume":104,"changeRate":-0.029,"nonWeightedIndex":6842},{"weightedIndex":6840,"changeAmount":-2,"time":"09:47","buy":590,"sell":590,"volume":104,"changeRate":-0.029,"nonWeightedIndex":6842},{"weightedIndex":6840,"changeAmount":-1,"time":"09:48","buy":590,"sell":590,"volume":114,"changeRate":-0.015,"nonWeightedIndex":6842},{"weightedIndex":6840,"changeAmount":-1,"time":"09:49","buy":580,"sell":580,"volume":114,"changeRate":-0.015,"nonWeightedIndex":6843},{"weightedIndex":6840,"changeAmount":-1,"time":"09:50","buy":516,"sell":516,"volume":122,"changeRate":-0.015,"nonWeightedIndex":6843},{"weightedIndex":6840,"changeAmount":-1,"time":"09:51","buy":456,"sell":456,"volume":122,"changeRate":-0.015,"nonWeightedIndex":6843},{"weightedIndex":6840,"changeAmount":-2,"time":"09:52","buy":514,"sell":514,"volume":132,"changeRate":-0.029,"nonWeightedIndex":6842},{"weightedIndex":6840,"changeAmount":-2,"time":"09:53","buy":590,"sell":590,"volume":132,"changeRate":-0.029,"nonWeightedIndex":6842},{"weightedIndex":6840,"changeAmount":-2,"time":"09:54","buy":590,"sell":590,"volume":132,"changeRate":-0.029,"nonWeightedIndex":6842},{"weightedIndex":6840,"changeAmount":-3,"time":"09:55","buy":590,"sell":590,"volume":142,"changeRate":-0.044,"nonWeightedIndex":6841},{"weightedIndex":6840,"changeAmount":-3,"time":"09:56","buy":590,"sell":590,"volume":142,"changeRate":-0.044,"nonWeightedIndex":6841},{"weightedIndex":6840,"changeAmount":-3,"time":"09:57","buy":580,"sell":580,"volume":152,"changeRate":-0.044,"nonWeightedIndex":6841},{"weightedIndex":6840,"changeAmount":-3,"time":"09:58","buy":590,"sell":590,"volume":152,"changeRate":-0.044,"nonWeightedIndex":6841},{"weightedIndex":6841,"changeAmount":-1,"time":"09:59","buy":722,"sell":722,"volume":168,"changeRate":-0.015,"nonWeightedIndex":6841},{"weightedIndex":6841,"changeAmount":-1,"time":"10:00","buy":944,"sell":944,"volume":168,"changeRate":-0.015,"nonWeightedIndex":6843}]}
4 | settings
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/test/java/com/example/zhangchen/stock/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.example.zhangchen.stock;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.3.0'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/a1401601741/Stock/e371ac3e81bb1ff573a4fdec7b63f4a3f6acd659/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Oct 26 21:15:09 CST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
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 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/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 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
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 Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------