├── app
├── .gitignore
├── libs
│ ├── stock_sdk.jar
│ └── TransportModule.jar
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── app_icon.png
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── duanluo.png
│ │ │ │ ├── ic_more.png
│ │ │ │ ├── loading.png
│ │ │ │ ├── nav_bg.png
│ │ │ │ ├── qq_icon.png
│ │ │ │ ├── reload.png
│ │ │ │ ├── to_top.png
│ │ │ │ ├── today.png
│ │ │ │ ├── app_icon.png
│ │ │ │ ├── icon_line.png
│ │ │ │ ├── icon_lock.png
│ │ │ │ ├── line_blue.png
│ │ │ │ ├── more_blue.png
│ │ │ │ ├── death_stock.png
│ │ │ │ ├── ic_launcher.png
│ │ │ │ ├── ic_loading.png
│ │ │ │ ├── ic_warning.png
│ │ │ │ ├── icon_launch.png
│ │ │ │ ├── icon_pack_up.png
│ │ │ │ ├── icon_update.png
│ │ │ │ ├── line_black.png
│ │ │ │ ├── login_icon.png
│ │ │ │ ├── quota_stock.png
│ │ │ │ ├── wechat_icon.png
│ │ │ │ ├── one_key_login.png
│ │ │ │ ├── research_stock.png
│ │ │ │ ├── active_stock_icon.png
│ │ │ │ ├── card_view_close.png
│ │ │ │ ├── iocn_close_black.png
│ │ │ │ ├── web_view_reload.png
│ │ │ │ └── stock_handicap_bag.jpg
│ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── app_icon.png
│ │ │ │ ├── icon_ad.png
│ │ │ │ └── ic_launcher.png
│ │ │ ├── values-xxhdpi
│ │ │ │ └── dimens.xml
│ │ │ ├── values-xxxhdpi
│ │ │ │ └── dimens.xml
│ │ │ ├── values-xhdpi
│ │ │ │ └── dimens.xml
│ │ │ ├── drawable
│ │ │ │ ├── dialog_top_normal.xml
│ │ │ │ ├── dialog_top_pressed.xml
│ │ │ │ ├── side_nav_bar.xml
│ │ │ │ ├── ic_menu_send.xml
│ │ │ │ ├── bg_progress_dialog.xml
│ │ │ │ ├── dialog_top_selector.xml
│ │ │ │ ├── handicap_more_bg.xml
│ │ │ │ ├── ic_menu_slideshow.xml
│ │ │ │ ├── ic_menu_gallery.xml
│ │ │ │ ├── dialog_style.xml
│ │ │ │ ├── ic_menu_manage.xml
│ │ │ │ ├── setting_poup_dialog_bg.xml
│ │ │ │ ├── stock_handicap_activity_bg.xml
│ │ │ │ ├── webview_progress_bar.xml
│ │ │ │ ├── bg_blue_solid_btn.xml
│ │ │ │ ├── ic_menu_camera.xml
│ │ │ │ ├── ic_menu_share.xml
│ │ │ │ └── pb_firmware_progress.xml
│ │ │ ├── anim
│ │ │ │ ├── push_bottom_in.xml
│ │ │ │ ├── ratote_view_anmi.xml
│ │ │ │ ├── loading_rotatation.xml
│ │ │ │ ├── popup_menu_hide.xml
│ │ │ │ └── popup_menu_show.xml
│ │ │ ├── values
│ │ │ │ ├── ids.xml
│ │ │ │ └── attrs.xml
│ │ │ ├── menu
│ │ │ │ ├── popup_stock_more_menu.xml
│ │ │ │ ├── history_price_menu.xml
│ │ │ │ ├── stock_handicap_more_menu.xml
│ │ │ │ ├── main.xml
│ │ │ │ └── activity_main_drawer.xml
│ │ │ ├── values-v21
│ │ │ │ └── styles.xml
│ │ │ ├── values-w820dp
│ │ │ │ └── dimens.xml
│ │ │ └── layout
│ │ │ │ ├── fragment_blank.xml
│ │ │ │ ├── content_main.xml
│ │ │ │ ├── activity_pdf_viewer.xml
│ │ │ │ ├── activity_stock_news.xml
│ │ │ │ ├── dialog_load_more.xml
│ │ │ │ ├── fragment_death_squad_stock.xml
│ │ │ │ ├── fragment_stock.xml
│ │ │ │ ├── activity_history_pirce.xml
│ │ │ │ ├── bottom_ad_bar.xml
│ │ │ │ ├── dialog_progress.xml
│ │ │ │ ├── dialog_ad.xml
│ │ │ │ ├── activity_main.xml
│ │ │ │ ├── activity_web_view.xml
│ │ │ │ ├── fragment_lock.xml
│ │ │ │ ├── loading_layout.xml
│ │ │ │ ├── nav_header_main.xml
│ │ │ │ ├── notify_progress_bar.xml
│ │ │ │ ├── stock_title_item.xml
│ │ │ │ ├── activity_login.xml
│ │ │ │ ├── activity_feedback.xml
│ │ │ │ ├── widget_global_dialog.xml
│ │ │ │ ├── activity_stock_handicap_more.xml
│ │ │ │ ├── card_view_stock_news_item.xml
│ │ │ │ └── app_bar_main.xml
│ │ └── java
│ │ │ └── com
│ │ │ ├── app
│ │ │ └── sinkinchan
│ │ │ │ └── smartstock
│ │ │ │ ├── utils
│ │ │ │ ├── SendMailUtil.java
│ │ │ │ ├── ui
│ │ │ │ │ ├── WindowManagerUtil.java
│ │ │ │ │ ├── Rotation.java
│ │ │ │ │ └── DisplayUtil.java
│ │ │ │ ├── TypedValueUtil.java
│ │ │ │ ├── Base.java
│ │ │ │ ├── NetUtils.java
│ │ │ │ ├── ViewUtil.java
│ │ │ │ ├── ThemeUtil.java
│ │ │ │ ├── ZipUtil.java
│ │ │ │ ├── ToastUtil.java
│ │ │ │ ├── http
│ │ │ │ │ └── Netroid.java
│ │ │ │ ├── UserUtil.java
│ │ │ │ ├── PreferenceUtil.java
│ │ │ │ ├── DeviceUtils.java
│ │ │ │ ├── LoadingUtil.java
│ │ │ │ ├── DateUtil.java
│ │ │ │ ├── LogUtil.java
│ │ │ │ └── ResourceManager.java
│ │ │ │ ├── mina
│ │ │ │ ├── service
│ │ │ │ │ ├── HandlerMessage.java
│ │ │ │ │ └── impl
│ │ │ │ │ │ └── HandlerMessageImpl.java
│ │ │ │ ├── modle
│ │ │ │ │ ├── MinaMessage.java
│ │ │ │ │ └── Module.java
│ │ │ │ ├── MinaService.java
│ │ │ │ ├── constant
│ │ │ │ │ └── MinaConstant.java
│ │ │ │ └── MinaClientHandler.java
│ │ │ │ ├── adapters
│ │ │ │ ├── base
│ │ │ │ │ └── BaseAdapter.java
│ │ │ │ ├── ActiveStockAdapter.java
│ │ │ │ ├── ResearchStockAdapter.java
│ │ │ │ ├── DeathSquadStockAdapter.java
│ │ │ │ ├── QuotaType3StockAdapter.java
│ │ │ │ ├── QuotaType1StockAdapter.java
│ │ │ │ ├── QuotaType2StockAdapter.java
│ │ │ │ └── QuotaType4StockAdapter.java
│ │ │ │ ├── constant
│ │ │ │ └── Constants.java
│ │ │ │ ├── dialog
│ │ │ │ ├── LoadMoreDialog.java
│ │ │ │ ├── AdDialog.java
│ │ │ │ ├── ProgressDialog.java
│ │ │ │ ├── DeleteStockDialog.java
│ │ │ │ ├── base
│ │ │ │ │ └── BaseDialog.java
│ │ │ │ └── ResearchStockSettingDialog.java
│ │ │ │ ├── fragments
│ │ │ │ ├── BlankFragment.java
│ │ │ │ └── LockFragment.java
│ │ │ │ ├── views
│ │ │ │ └── CustomRecyclerView.java
│ │ │ │ ├── bean
│ │ │ │ ├── LocalUser.java
│ │ │ │ └── DeleteStockBean.java
│ │ │ │ ├── event
│ │ │ │ └── MessageEvent.java
│ │ │ │ ├── wxapi
│ │ │ │ └── WXEntryActivity.java
│ │ │ │ ├── behaviors
│ │ │ │ └── ScrollAwareFABBehavior.java
│ │ │ │ ├── glide
│ │ │ │ ├── GlideCircleTransform.java
│ │ │ │ └── GlideImgManager.java
│ │ │ │ ├── app
│ │ │ │ └── App.java
│ │ │ │ ├── activitys
│ │ │ │ ├── LoginActivity.java
│ │ │ │ ├── StockHandicapMoreActivity.java
│ │ │ │ └── FeedbackActivity.java
│ │ │ │ └── mode
│ │ │ │ └── StockHandicapModeView.java
│ │ │ └── mina
│ │ │ └── communication
│ │ │ └── bean
│ │ │ └── Test.java
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── app
│ │ │ └── sinkinchan
│ │ │ └── smartstock
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── app
│ │ └── sinkinchan
│ │ └── smartstock
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── screenshot
├── S61120-112355.jpg
├── S61120-112401.jpg
├── S61120-112407.jpg
├── S61120-112416.jpg
├── S61120-112422.jpg
├── S61120-112426.jpg
├── S61120-112434.jpg
├── S61120-112440.jpg
└── S70115-142719.jpg
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .gitignore
├── gradle.properties
├── README.md
└── gradlew.bat
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/app/libs/stock_sdk.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/libs/stock_sdk.jar
--------------------------------------------------------------------------------
/app/libs/TransportModule.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/libs/TransportModule.jar
--------------------------------------------------------------------------------
/screenshot/S61120-112355.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/screenshot/S61120-112355.jpg
--------------------------------------------------------------------------------
/screenshot/S61120-112401.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/screenshot/S61120-112401.jpg
--------------------------------------------------------------------------------
/screenshot/S61120-112407.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/screenshot/S61120-112407.jpg
--------------------------------------------------------------------------------
/screenshot/S61120-112416.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/screenshot/S61120-112416.jpg
--------------------------------------------------------------------------------
/screenshot/S61120-112422.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/screenshot/S61120-112422.jpg
--------------------------------------------------------------------------------
/screenshot/S61120-112426.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/screenshot/S61120-112426.jpg
--------------------------------------------------------------------------------
/screenshot/S61120-112434.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/screenshot/S61120-112434.jpg
--------------------------------------------------------------------------------
/screenshot/S61120-112440.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/screenshot/S61120-112440.jpg
--------------------------------------------------------------------------------
/screenshot/S70115-142719.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/screenshot/S70115-142719.jpg
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/app_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xhdpi/app_icon.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/duanluo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/duanluo.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_more.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/ic_more.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/loading.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/loading.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/nav_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/nav_bg.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/qq_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/qq_icon.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/reload.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/reload.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/to_top.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/to_top.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/today.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/today.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/app_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/app_icon.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/icon_line.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/icon_line.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/icon_lock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/icon_lock.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/line_blue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/line_blue.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/more_blue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/more_blue.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/app_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxxhdpi/app_icon.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/icon_ad.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxxhdpi/icon_ad.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/death_stock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/death_stock.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_loading.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/ic_loading.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_warning.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/ic_warning.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/icon_launch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/icon_launch.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/icon_pack_up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/icon_pack_up.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/icon_update.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/icon_update.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/line_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/line_black.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/login_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/login_icon.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/quota_stock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/quota_stock.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/wechat_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/wechat_icon.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/one_key_login.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/one_key_login.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/research_stock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/research_stock.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/active_stock_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/active_stock_icon.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/card_view_close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/card_view_close.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/iocn_close_black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/iocn_close_black.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/web_view_reload.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/web_view_reload.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/stock_handicap_bag.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/momo145/SmartStock/HEAD/app/src/main/res/mipmap-xxhdpi/stock_handicap_bag.jpg
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values-xxhdpi/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 | 117dp
3 | 116dp
4 | 45
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values-xxxhdpi/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 | 120dp
3 | 117dp
4 | 116dp
5 | 45
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values-xhdpi/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 | 6dp
3 | 120dp
4 | 20dp
5 | 30
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/utils/SendMailUtil.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.utils;
2 |
3 | /**
4 | * @author : 陈欣健
5 | * @describe :
6 | * @since :2016-12-29 下午4:05
7 | **/
8 | public class SendMailUtil {
9 |
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Sep 03 10:15:01 CST 2016
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.14.1-all.zip
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/dialog_top_normal.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/dialog_top_pressed.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/push_bottom_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values/ids.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/side_nav_bar.xml:
--------------------------------------------------------------------------------
1 |
3 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/popup_stock_more_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
{
11 | boolean isLoading();
12 |
13 | void setLoading(boolean loading);
14 |
15 | boolean isRefreshing();
16 |
17 | void setRefreshing(boolean refreshing);
18 |
19 | T getPage();
20 |
21 | SourceManager.StockType getType();
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/webview_progress_bar.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
12 |
13 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_stock_news.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dialog_load_more.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_death_squad_stock.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_blue_solid_btn.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
13 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_camera.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/utils/ui/WindowManagerUtil.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.utils.ui;
2 |
3 | import android.view.Display;
4 | import android.view.View;
5 |
6 | import com.app.sinkinchan.smartstock.utils.ServiceUtil;
7 |
8 | /**
9 | * @author : 陈欣健
10 | * @describe :
11 | * @since :2016-09-10 上午11:53
12 | **/
13 | public class WindowManagerUtil {
14 | public static Display getDefaultDisplay() {
15 | return ServiceUtil.getWindowManager().getDefaultDisplay();
16 | }
17 |
18 | public static void removeViewImmediate(View view) {
19 | ServiceUtil.getWindowManager().removeViewImmediate(view);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/utils/ui/Rotation.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.utils.ui;
2 |
3 | /**
4 | * @author : 陈欣健
5 | * @describe :
6 | * @since :2016-09-10 上午11:59
7 | **/
8 | public enum Rotation {
9 | DEGREES_0(0),
10 | DEGREES_90(1),
11 | DEGREES_180(2),
12 | DEGREES_270(3);
13 |
14 | int value;
15 |
16 | Rotation(int value) {
17 | this.value = value;
18 | }
19 |
20 | public static Rotation fromValue(int value) {
21 | for (Rotation rotation : values())
22 | if (rotation.value == value)
23 | return rotation;
24 |
25 | return DEGREES_0;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/popup_menu_hide.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
9 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/popup_menu_show.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
9 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_stock.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mina/communication/bean/Test.java:
--------------------------------------------------------------------------------
1 | package com.mina.communication.bean;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * @author : 陈欣健
7 | * @describe :
8 | * @since :2016-09-17 上午11:36
9 | **/
10 | public class Test implements Serializable {
11 | private String title;
12 | private String message;
13 |
14 | public String getTitle() {
15 | return title;
16 | }
17 |
18 | public Test setTitle(String title) {
19 | this.title = title;
20 | return this;
21 | }
22 |
23 | public String getMessage() {
24 | return message;
25 | }
26 |
27 | public Test setMessage(String message) {
28 | this.message = message;
29 | return this;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_menu_share.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_history_pirce.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/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 | org.gradle.jvmargs=-Xmx2048M
13 | # When configured, Gradle will run in incubating parallel mode.
14 | # This option should only be used with decoupled projects. More details, visit
15 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
16 | # org.gradle.parallel=true
17 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/constant/Constants.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.constant;
2 |
3 | import android.os.Environment;
4 |
5 | import java.io.File;
6 |
7 | /**
8 | * @author : 陈欣健
9 | * @describe :
10 | * @since :2016-09-10 下午5:17
11 | **/
12 | public class Constants {
13 | public static File APP_FILE_CACHE_DIR = new File(Environment.getExternalStorageDirectory(), "SmartStock");
14 | public static File APP_FILE_PDF_CACHE_DIR = new File(APP_FILE_CACHE_DIR.getAbsolutePath(), "PDF");
15 | public static File APP_UPDATE_URL = new File(APP_FILE_CACHE_DIR.getAbsolutePath(), "SmartStock.apk");
16 |
17 | public static void createDir() {
18 | if (!APP_FILE_PDF_CACHE_DIR.exists()) {
19 | APP_FILE_PDF_CACHE_DIR.mkdirs();
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/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 /Users/apple/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 | -keep class com.baidu.bottom.** { *; }
19 | -keep class com.baidu.kirin.** { *; }
20 | -keep class com.baidu.mobstat.** { *; }
--------------------------------------------------------------------------------
/app/src/main/res/drawable/pb_firmware_progress.xml:
--------------------------------------------------------------------------------
1 |
2 | -
3 |
4 |
5 |
9 |
10 |
11 | -
12 |
13 |
14 |
15 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/app/sinkinchan/smartstock/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.app.sinkinchan.smartstock", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/utils/TypedValueUtil.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.utils;
2 |
3 | import android.util.TypedValue;
4 |
5 | /**
6 | * @author : 陈欣健
7 | * @describe :
8 | * @since :2016-09-10 下午12:08
9 | **/
10 | public class TypedValueUtil {
11 | public static float applyDimension(int unit, float value) {
12 | return TypedValue.applyDimension(unit, value, Base.getDisplayMetrics());
13 | }
14 |
15 | public static float complexToDimension(int data) {
16 | return TypedValue.complexToDimension(data, Base.getDisplayMetrics());
17 | }
18 |
19 | public static int complexToDimensionPixelOffset(int data) {
20 | return TypedValue.complexToDimensionPixelOffset(data, Base.getDisplayMetrics());
21 | }
22 |
23 | public static int complexToDimensionPixelSize(int data) {
24 | return TypedValue.complexToDimensionPixelSize(data, Base.getDisplayMetrics());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/bottom_ad_bar.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
15 |
16 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/mina/modle/MinaMessage.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.mina.modle;
2 |
3 | import java.io.Serializable;
4 |
5 | public class MinaMessage implements Serializable {
6 |
7 | /**
8 | *
9 | */
10 | private static final long serialVersionUID = 1L;
11 |
12 | private int code;
13 | private String message;
14 | public static final int SUCCESS = 1000;
15 | public static final int ERROR = 1001;
16 |
17 | public MinaMessage() {
18 | super();
19 | // TODO Auto-generated constructor stub
20 | }
21 |
22 | public MinaMessage(int code, String message) {
23 | super();
24 | this.code = code;
25 | this.message = message;
26 | }
27 |
28 | public int getCode() {
29 | return code;
30 | }
31 |
32 | public void setCode(int code) {
33 | this.code = code;
34 | }
35 |
36 | public String getMessage() {
37 | return message;
38 | }
39 |
40 | public void setMessage(String message) {
41 | this.message = message;
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/dialog/LoadMoreDialog.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.dialog;
2 |
3 | import android.content.Context;
4 | import android.content.DialogInterface;
5 | import android.os.Bundle;
6 |
7 | import com.app.sinkinchan.smartstock.R;
8 | import com.app.sinkinchan.smartstock.dialog.base.BaseDialog;
9 |
10 | /**
11 | * @author : 陈欣健
12 | * @describe :
13 | * @since :2016-09-04 下午10:49
14 | **/
15 | public class LoadMoreDialog extends BaseDialog {
16 | public LoadMoreDialog(Context context) {
17 | super(context, R.style.CommonDialog);
18 | // setCancelable(false);
19 | setCanceledOnTouchOutside(false);
20 | }
21 |
22 | @Override
23 | protected void onCreate(Bundle savedInstanceState) {
24 | super.onCreate(savedInstanceState);
25 | setContentView(R.layout.dialog_load_more);
26 | }
27 |
28 | @Override
29 | public void onDismiss(DialogInterface dialog) {
30 | super.onDismiss(dialog);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dialog_progress.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
17 |
18 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dialog_ad.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
13 |
17 |
18 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/fragments/BlankFragment.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.fragments;
2 |
3 | import android.os.Bundle;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 |
8 | import com.app.sinkinchan.smartstock.R;
9 | import com.app.sinkinchan.smartstock.fragments.base.BaseFragment;
10 |
11 | /**
12 | * @author : 陈欣健
13 | * @describe :
14 | * @since :2016-09-04 下午4:44
15 | **/
16 | public class BlankFragment extends BaseFragment {
17 |
18 | @Override
19 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
20 | View view = inflater.inflate(R.layout.fragment_blank, container, false);
21 | return view;
22 | }
23 |
24 |
25 | @Override
26 | public void onPause() {
27 | super.onPause();
28 | }
29 |
30 | @Override
31 | public void onResume() {
32 | super.onResume();
33 |
34 | }
35 |
36 | @Override
37 | public void onCreate(Bundle savedInstanceState) {
38 | super.onCreate(savedInstanceState);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/views/CustomRecyclerView.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.views;
2 |
3 |
4 | import android.content.Context;
5 | import android.util.AttributeSet;
6 |
7 | import com.jcodecraeer.xrecyclerview.XRecyclerView;
8 |
9 | /**
10 | * @author : 陈欣健
11 | * @describe :
12 | * @since :2016-09-04 下午10:20
13 | **/
14 | public class CustomRecyclerView extends XRecyclerView {
15 |
16 | public boolean isLoading;
17 | public boolean isRefreshing;
18 |
19 | public CustomRecyclerView(Context context) {
20 | super(context);
21 | }
22 |
23 | public CustomRecyclerView(Context context, AttributeSet attrs) {
24 | super(context, attrs);
25 | }
26 |
27 | public CustomRecyclerView(Context context, AttributeSet attrs, int defStyle) {
28 | super(context, attrs, defStyle);
29 | }
30 |
31 | @Override
32 | public void refreshComplete() {
33 | super.refreshComplete();
34 | isRefreshing = false;
35 | }
36 |
37 | @Override
38 | public void loadMoreComplete() {
39 | super.loadMoreComplete();
40 | isLoading = false;
41 | }
42 |
43 |
44 | }
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/mina/modle/Module.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.mina.modle;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * 传输控制模块
7 | *
8 | * @author 陈欣健 2014年8月9日下午11:01:18
9 | *
10 | */
11 | public class Module implements Serializable{
12 |
13 |
14 | /**
15 | *
16 | */
17 | private static final long serialVersionUID = 5271977975374599931L;
18 | /**
19 | * 控制代码
20 | */
21 | private int code;
22 | /**
23 | * 返回的json
24 | */
25 | private String json;
26 |
27 | public Module(int code, String json) {
28 | super();
29 | this.code = code;
30 | this.json = json;
31 | }
32 |
33 | public Module() {
34 | super();
35 | // TODO Auto-generated constructor stub
36 | }
37 |
38 | public int getCode() {
39 | return code;
40 | }
41 | public void setCode(int code) {
42 | this.code = code;
43 | }
44 | public String getJson() {
45 | return json;
46 | }
47 | public void setJson(String json) {
48 | this.json = json;
49 | }
50 |
51 | @Override
52 | public String toString() {
53 | return "Module [code=" + code + ", json=" + json + "]";
54 | }
55 |
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/bean/LocalUser.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.bean;
2 |
3 | import com.sinkinchan.transport.module.UserBean;
4 |
5 | import java.util.Date;
6 |
7 | /**
8 | * @author : 陈欣健
9 | * @describe :
10 | * @since :2016-10-22 下午8:31
11 | **/
12 | public class LocalUser extends UserBean {
13 | //过时
14 | private Date OutOfDate;
15 |
16 | public LocalUser() {
17 | }
18 |
19 | public LocalUser(UserBean userBean) {
20 | if (userBean != null) {
21 | setId(userBean.getId());
22 | setAddTime(userBean.getAddTime());
23 | setUserName(userBean.getUserName());
24 | setIcon(userBean.getIcon());
25 | setGender(userBean.getGender());
26 | setThird_party_id(userBean.getThird_party_id());
27 | setPlatform(userBean.getPlatform());
28 | setIsOnline(userBean.getIsOnline());
29 | setLoginTime(userBean.getLoginTime());
30 | setLogOutTime(userBean.getLogOutTime());
31 | }
32 | }
33 |
34 |
35 | public Date getOutOfDate() {
36 | return OutOfDate;
37 | }
38 |
39 | public LocalUser setOutOfDate(Date outOfDate) {
40 | OutOfDate = outOfDate;
41 | return this;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/bean/DeleteStockBean.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.bean;
2 |
3 | import com.orm.SugarRecord;
4 | import com.orm.dsl.Table;
5 |
6 | /**
7 | * @author : 陈欣健
8 | * @describe :
9 | * @since :2016-09-19 下午10:05
10 | **/
11 | @Table
12 | public class DeleteStockBean extends SugarRecord {
13 | private String stockCode;
14 | private String time;
15 | private String type;
16 |
17 | public String getStockCode() {
18 | return stockCode;
19 | }
20 |
21 | public DeleteStockBean setStockCode(String stockCode) {
22 | this.stockCode = stockCode;
23 | return this;
24 | }
25 |
26 | public String getTime() {
27 | return time;
28 | }
29 |
30 | public DeleteStockBean setTime(String time) {
31 | this.time = time;
32 | return this;
33 | }
34 |
35 | public String getType() {
36 | return type;
37 | }
38 |
39 | public DeleteStockBean setType(String type) {
40 | this.type = type;
41 | return this;
42 | }
43 |
44 | @Override
45 | public String toString() {
46 | return "DeleteStockBean{" +
47 | "stockCode='" + stockCode + '\'' +
48 | ", time=" + time +
49 | ", type=" + type +
50 | '}';
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/event/MessageEvent.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.event;
2 |
3 | /**
4 | * @author : 陈欣健
5 | * @describe :
6 | * @since :2016-07-16 下午11:40
7 | **/
8 | public class MessageEvent {
9 | public enum Type {
10 | GET_ACTIVE_STOCKS_PAGE_SUCCESS, UPDATE_STOCK_DETAIL, REFRESH_STOCK, GET_STOCK_HISTORY_PRICE_SUCCESS,
11 | GET_STOCK_NEWS_SUCCESS, GET_STOCK_NOTICES_SUCCESS, GET_RESEARCH_STOCKS_PAGE_SUCCESS, GO_TO_TOP,
12 | OPEN_SETTING, HIDE_SETTING, SHOW_SETTING, GET_DEATH_SQUAD_STOCK_SUCCESS, GET_QUOTA_STOCK_SUCCESS,
13 | HIDE_TAB_LAYOUT, SHOW_TAB_LAYOUT, SHOW_MESSAGE, SET_TITLE, DELETE_ITEM, GET_STOCK_QUOTA_SUCCESS, REGISTER_SUCCESS,
14 | LOGIN_SUCCESS, STOCK_HANDICAP, AUTO_REFRESH_DATA_COUNT_DOWN, AUTO_REFRESH_DATA, REWARD_POINTS, SHOW_POINTS_POOL_DIALOG,
15 | USE_FUNCTION,STOCK_HANDICAP_MORE;
16 | }
17 |
18 | private Type type;
19 | private Object args;
20 |
21 | public MessageEvent(Type type) {
22 | this.type = type;
23 | }
24 |
25 | public MessageEvent(Type type, Object args) {
26 | this.type = type;
27 | this.args = args;
28 | }
29 |
30 | public Type getType() {
31 | return type;
32 | }
33 |
34 | public Object getArgs() {
35 | return args;
36 | }
37 |
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_web_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
13 |
14 |
15 |
16 |
23 |
24 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # SmartStock
2 |
3 | #描述
4 | 因为在15年年初被朋(sun)友忽悠了进股市,在经历了15年大跌和几次熔断之后站在了高高的山顶吹风(手动微笑).
5 | 因为我遇到喜欢的事物我就想着能不能在这方面写个app来方便下自己使用,于是就出现了这个选股app了,这里面的数据全是来自于网上,仅供参考.
6 | #app概述
7 | 这个app主要是利用爬虫技术把网上已有的数据进行集合,说智能其实却不是很智能.
8 | #重要
9 | 这个app用到了Android 的DataBinding 但是里面好多地方我没有使用 Observable 来控制view的刷新,而是直接调用刷新,这样是不好的,会导致性能问题
10 | 但是我又懒得改,只有股票详情那里是用了.
11 | #智能选股Sdk
12 | https://github.com/momo145/StockSdk
13 | #通讯类
14 | https://github.com/momo145/TransportModule
15 | #服务端
16 | https://github.com/momo145/SmartStockServer
17 | MinaConstant 这个类修改连接ip,你也可以改成配置文件
18 | #screenshot
19 | 
20 | 
21 | 
22 | 
23 | 
24 | 
25 | 
26 | 
27 | 
28 |
29 |
30 |
31 |
32 | # Change Log
33 | ## 1.1.0
34 | - 添加股票盘口详情
35 | - bug fix
36 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/wxapi/WXEntryActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * 官网地站:http://www.mob.com
3 | * 技术支持QQ: 4006852216
4 | * 官方微信:ShareSDK (如果发布新版本的话,我们将会第一时间通过微信将版本更新内容推送给您。如果使用过程中有任何问题,也可以通过微信与我们取得联系,我们将会在24小时内给予回复)
5 | *
6 | * Copyright (c) 2013年 mob.com. All rights reserved.
7 | */
8 |
9 | package com.app.sinkinchan.smartstock.wxapi;
10 |
11 |
12 |
13 | /** 微信客户端回调activity示例 */
14 | public class WXEntryActivity /*extends WechatHandlerActivity*/ {
15 |
16 | /**
17 | * 处理微信发出的向第三方应用请求app message
18 | *
19 | * 在微信客户端中的聊天页面有“添加工具”,可以将本应用的图标添加到其中
20 | * 此后点击图标,下面的代码会被执行。Demo仅仅只是打开自己而已,但你可
21 | * 做点其他的事情,包括根本不打开任何页面
22 | */
23 | /*public void onGetMessageFromWXReq(WXMediaMessage msg) {
24 | Intent iLaunchMyself = getPackageManager().getLaunchIntentForPackage(getPackageName());
25 | startActivity(iLaunchMyself);
26 | }
27 |
28 | *//**
29 | * 处理微信向第三方应用发起的消息
30 | *
31 | * 此处用来接收从微信发送过来的消息,比方说本demo在wechatpage里面分享
32 | * 应用时可以不分享应用文件,而分享一段应用的自定义信息。接受方的微信
33 | * 客户端会通过这个方法,将这个信息发送回接收方手机上的本demo中,当作
34 | * 回调。
35 | *
36 | * 本Demo只是将信息展示出来,但你可做点其他的事情,而不仅仅只是Toast
37 | *//*
38 | public void onShowMessageFromWXReq(WXMediaMessage msg) {
39 | if (msg != null && msg.mediaObject != null
40 | && (msg.mediaObject instanceof WXAppExtendObject)) {
41 | WXAppExtendObject obj = (WXAppExtendObject) msg.mediaObject;
42 | Toast.makeText(this, obj.extInfo, Toast.LENGTH_SHORT).show();
43 | }
44 | }*/
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/fragments/LockFragment.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.fragments;
2 |
3 | import android.os.Bundle;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 |
8 | import com.app.sinkinchan.smartstock.R;
9 | import com.app.sinkinchan.smartstock.event.MessageEvent;
10 | import com.app.sinkinchan.smartstock.fragments.base.BaseFragment;
11 |
12 | import org.greenrobot.eventbus.EventBus;
13 |
14 | /**
15 | * @author : 陈欣健
16 | * @describe :
17 | * @since :2016-09-04 下午4:44
18 | **/
19 | public class LockFragment extends BaseFragment {
20 |
21 | @Override
22 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
23 | View view = inflater.inflate(R.layout.fragment_lock, container, false);
24 | EventBus.getDefault().post(new MessageEvent(MessageEvent.Type.HIDE_SETTING));
25 | EventBus.getDefault().post(new MessageEvent(MessageEvent.Type.HIDE_TAB_LAYOUT));
26 | EventBus.getDefault().post(new MessageEvent(MessageEvent.Type.SET_TITLE, "解锁功能"));
27 | return view;
28 | }
29 |
30 |
31 | @Override
32 | public void onPause() {
33 | super.onPause();
34 | }
35 |
36 | @Override
37 | public void onResume() {
38 | super.onResume();
39 |
40 | }
41 |
42 | @Override
43 | public void onCreate(Bundle savedInstanceState) {
44 | super.onCreate(savedInstanceState);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/behaviors/ScrollAwareFABBehavior.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.behaviors;
2 |
3 | import android.content.Context;
4 | import android.support.design.widget.CoordinatorLayout;
5 | import android.support.design.widget.FloatingActionButton;
6 | import android.support.v4.view.ViewCompat;
7 | import android.util.AttributeSet;
8 | import android.view.View;
9 |
10 | /**
11 | * @author : 陈欣健
12 | * @describe :
13 | * @since :2016-09-10 下午3:49
14 | **/
15 | public class ScrollAwareFABBehavior extends FloatingActionButton.Behavior {
16 |
17 | public ScrollAwareFABBehavior(Context context, AttributeSet attributeSet){
18 | super();
19 | }
20 |
21 | @Override
22 | public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) {
23 | super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
24 | if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) {
25 | child.hide();
26 | } else if (dyConsumed < 0 && child.getVisibility() == View.GONE) {
27 | child.show();
28 | }
29 | }
30 |
31 | @Override
32 | public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View directTargetChild, View target, int nestedScrollAxes) {
33 | return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL;
34 | }
35 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/utils/Base.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.utils;
2 |
3 | import android.content.Context;
4 | import android.content.res.AssetManager;
5 | import android.content.res.Configuration;
6 | import android.content.res.Resources;
7 | import android.support.annotation.NonNull;
8 | import android.util.DisplayMetrics;
9 |
10 | /**
11 | * @author : 陈欣健
12 | * @describe :
13 | * @since :2016-09-10 下午12:04
14 | **/
15 | public class Base {
16 | private static Context context;
17 |
18 | public static void initialize(@NonNull Context context) {
19 | Base.context = context;
20 | }
21 |
22 | public static Context getContext() {
23 | synchronized (Base.class) {
24 | if (Base.context == null)
25 | throw new NullPointerException("Call Base.initialize(context) within your Application onCreate() method.");
26 |
27 | return Base.context.getApplicationContext();
28 | }
29 | }
30 |
31 | public static Resources getResources() {
32 | return Base.getContext().getResources();
33 | }
34 |
35 | public static Resources.Theme getTheme() {
36 | return Base.getContext().getTheme();
37 | }
38 |
39 | public static AssetManager getAssets() {
40 | return Base.getContext().getAssets();
41 | }
42 |
43 | public static Configuration getConfiguration() {
44 | return Base.getResources().getConfiguration();
45 | }
46 |
47 | public static DisplayMetrics getDisplayMetrics() {
48 | return Base.getResources().getDisplayMetrics();
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_lock.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
15 |
16 |
23 |
24 |
29 |
30 |
36 |
37 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/mina/MinaService.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.mina;
2 |
3 | import com.app.sinkinchan.smartstock.utils.LogUtil;
4 |
5 | import org.apache.mina.core.session.IoSession;
6 |
7 | public class MinaService {
8 |
9 |
10 | private static MinaService minaService = new MinaService();
11 |
12 | private MinaService() {
13 | }
14 |
15 | public static MinaService getInstance() {
16 | return minaService;
17 | }
18 |
19 | /**
20 | * 连接到服务器
21 | */
22 | public void connect() {
23 | IoSession session = MinaClient.getInstance().getSession();
24 | if (session == null || !session.isConnected()) {
25 | new Thread(new Runnable() {
26 | @Override
27 | public void run() {
28 | MinaClient.getInstance().connect();
29 | }
30 | }).start();
31 | }
32 |
33 | }
34 |
35 | /**
36 | * 写出
37 | *
38 | * @param module
39 | */
40 | public void write(Object module, MessageCallBack callBack) {
41 | IoSession session = MinaClient.getInstance().getSession();
42 | if (session != null && session.isConnected()) {
43 | session.write(module);
44 | if (callBack != null) {
45 | callBack.success();
46 | }
47 | LogUtil.d("发送成功=" + session.getId());
48 | } else {
49 | if (callBack != null) {
50 | callBack.failed();
51 | }
52 | LogUtil.e("未连上服务器,发送失败...");
53 | }
54 | }
55 |
56 | public interface MessageCallBack {
57 | void success();
58 |
59 | void failed();
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/loading_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
16 |
17 |
30 |
31 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/activity_main_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
51 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/nav_header_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
21 |
22 |
31 |
32 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/glide/GlideCircleTransform.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.glide;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.graphics.BitmapShader;
6 | import android.graphics.Canvas;
7 | import android.graphics.Paint;
8 |
9 | import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
10 | import com.bumptech.glide.load.resource.bitmap.BitmapTransformation;
11 |
12 | /**
13 | * @author : 陈欣健
14 | * @describe :
15 | * @since :2016-10-22 下午8:14
16 | **/
17 | public class GlideCircleTransform extends BitmapTransformation {
18 | public GlideCircleTransform(Context context) {
19 | super(context);
20 | }
21 |
22 | @Override protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) {
23 | return circleCrop(pool, toTransform);
24 | }
25 |
26 | private static Bitmap circleCrop(BitmapPool pool, Bitmap source) {
27 | if (source == null) return null;
28 |
29 | int size = Math.min(source.getWidth(), source.getHeight());
30 | int x = (source.getWidth() - size) / 2;
31 | int y = (source.getHeight() - size) / 2;
32 |
33 | // TODO this could be acquired from the pool too
34 | Bitmap squared = Bitmap.createBitmap(source, x, y, size, size);
35 |
36 | Bitmap result = pool.get(size, size, Bitmap.Config.ARGB_8888);
37 | if (result == null) {
38 | result = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
39 | }
40 |
41 | Canvas canvas = new Canvas(result);
42 | Paint paint = new Paint();
43 | paint.setShader(new BitmapShader(squared, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP));
44 | paint.setAntiAlias(true);
45 | float r = size / 2f;
46 | canvas.drawCircle(r, r, r, paint);
47 | return result;
48 | }
49 |
50 | @Override public String getId() {
51 | return getClass().getName();
52 | }
53 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/mina/constant/MinaConstant.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.mina.constant;
2 |
3 | public class MinaConstant {
4 |
5 |
6 | public static final String SERVER_IP_ADDRESS = "192.168.1.102";
7 | public static final int SERVER_POST = 1235;
8 | public static final String MINA_MESSAGE_KEY = "mina message key";
9 | // key
10 | /**
11 | * 用户添加或删除书本时用到的传值key
12 | */
13 | public static final String USER_BOOK_KEY = "user book key";
14 | /**
15 | * 用户key
16 | */
17 | public static final String USER_KEY = "user key";
18 | /**
19 | * 连接到服务器
20 | */
21 | public static final int CONNECT = 1000;
22 | /**
23 | * 用户登录
24 | */
25 | public static final int USER_LOGIN = 1001;
26 | /**
27 | * 列出公共社区
28 | */
29 | public static final int LIST_DISCUSSION = 1002;
30 | /**
31 | * 列出帖子
32 | */
33 | public static final int LIST_POST = 1003;
34 | /**
35 | * 列出回复
36 | */
37 | public static final int LIST_REPLYS = 1004;
38 | /**
39 | * 发表一个帖子
40 | */
41 | public static final int PUT_UP_A_POST = 1005;
42 | /**
43 | * 发表一个回复
44 | */
45 | public static final int PUT_UP_A_REPLY = 1006;
46 | /**
47 | * 点赞或者踩
48 | */
49 | public static final int UPDATE_A_LIKE=1007;
50 | /**
51 | * 一键登陆
52 | */
53 | public static final int ONE_KEY_LOGIN=1008;
54 | /**
55 | * 登录失败,昵称重复
56 | */
57 | public static final int LOGIN_ERROR_NAME_REPEAT = 1009;
58 | /**
59 | * 一键注册
60 | */
61 | public static final int ONE_KEY_REGISTER = 1010;
62 | /**
63 | * 用户添加一本书
64 | */
65 | public static final int USER_ADD_BOOK = 1011;
66 | /**
67 | * 用户删除一本书
68 | */
69 | public static final int USER_DELETE_BOOK = 1012;
70 | /**
71 | * 推荐书本
72 | */
73 | public static final int RECOMMEND_THE_BOOK = 1013;
74 | /**
75 | * 同步用户书本
76 | */
77 | public static final int SYN_USERBOOK = 1014;
78 | /**
79 | * 获取版本号,是否有更新
80 | */
81 | public static final int GET_VERSION = 1015;
82 | }
83 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/notify_progress_bar.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
22 |
23 |
26 |
27 |
33 |
34 |
39 |
40 |
41 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/stock_title_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
23 |
24 |
29 |
30 |
36 |
37 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/glide/GlideImgManager.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.glide;
2 |
3 | import android.content.Context;
4 | import android.widget.ImageView;
5 |
6 | import com.bumptech.glide.Glide;
7 |
8 | /**
9 | * @author : 陈欣健
10 | * @describe :
11 | * @since :2016-10-22 下午8:13
12 | **/
13 | public class GlideImgManager {
14 | /**
15 | * load normal for img
16 | *
17 | * @param url
18 | * @param erroImg
19 | * @param emptyImg
20 | * @param iv
21 | */
22 | public static void glideLoader(Context context, String url, int erroImg, int emptyImg, ImageView iv) {
23 | //原生 API
24 | Glide.with(context).load(url).placeholder(emptyImg).error(erroImg).into(iv);
25 | }
26 |
27 | /**
28 | * load normal for circle or round img
29 | *
30 | * @param url
31 | * @param erroImg
32 | * @param emptyImg
33 | * @param iv
34 | * @param type
35 | */
36 | public static void glideLoader(Context context, String url, int erroImg, int emptyImg, ImageView iv, Type type) {
37 | switch (type) {
38 | case Circle:
39 | Glide.with(context).load(url).placeholder(emptyImg).error(erroImg).transform(new GlideCircleTransform(context)).into(iv);
40 | break;
41 | case Normal:
42 | Glide.with(context).load(url).placeholder(emptyImg).error(erroImg).into(iv);
43 | break;
44 | }
45 | }
46 |
47 | /**
48 | * load normal for circle or round img
49 | *
50 | * @param url
51 | * @param iv
52 | * @param type
53 | */
54 | public static void glideLoader(Context context, String url, ImageView iv, Type type) {
55 | switch (type) {
56 | case Circle:
57 | Glide.with(context).load(url).transform(new GlideCircleTransform(context)).into(iv);
58 | break;
59 | case Normal:
60 | Glide.with(context).load(url).into(iv);
61 | break;
62 | }
63 | }
64 |
65 | public enum Type {
66 | Circle, Normal
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/utils/NetUtils.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.utils;
2 |
3 | import android.app.Activity;
4 | import android.content.ComponentName;
5 | import android.content.Context;
6 | import android.content.Intent;
7 | import android.net.ConnectivityManager;
8 | import android.net.NetworkInfo;
9 |
10 | /**
11 | * @author : 陈欣健
12 | * @describe :
13 | * @since :2016-09-16 下午10:23
14 | **/
15 | public class NetUtils {
16 |
17 | private NetUtils() {
18 | /* cannot be instantiated */
19 | throw new UnsupportedOperationException("cannot be instantiated");
20 | }
21 |
22 | public static void setContext(Context context) {
23 | LogUtil.e("init NetUtils");
24 | }
25 |
26 | /**
27 | * 判断网络是否连接
28 | *
29 | * @return
30 | */
31 | public static boolean isConnected() {
32 |
33 | ConnectivityManager connectivity = ServiceUtil.getConnectivityManager();
34 | if (null != connectivity) {
35 |
36 | NetworkInfo info = connectivity.getActiveNetworkInfo();
37 | if (null != info && info.isConnected()) {
38 | if (info.getState() == NetworkInfo.State.CONNECTED) {
39 | return true;
40 | }
41 | }
42 | }
43 | return false;
44 | }
45 |
46 | /**
47 | * 判断是否是wifi连接
48 | */
49 | public static boolean isWifi() {
50 | ConnectivityManager connectivity = ServiceUtil.getConnectivityManager();
51 |
52 | if (connectivity == null)
53 | return false;
54 | return connectivity.getActiveNetworkInfo().getType() == ConnectivityManager.TYPE_WIFI;
55 |
56 | }
57 |
58 | /**
59 | * 打开网络设置界面
60 | */
61 | public static void openSetting(Activity activity) {
62 | Intent intent = new Intent("/");
63 | ComponentName cm = new ComponentName("com.android.settings",
64 | "com.android.settings.WirelessSettings");
65 | intent.setComponent(cm);
66 | intent.setAction("android.intent.action.VIEW");
67 | activity.startActivityForResult(intent, 0);
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_login.xml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
19 |
20 |
24 |
25 |
32 |
33 |
34 |
35 |
45 |
46 |
50 |
51 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/mina/service/impl/HandlerMessageImpl.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.mina.service.impl;
2 |
3 | import com.app.sinkinchan.smartstock.event.MessageEvent;
4 | import com.app.sinkinchan.smartstock.mina.modle.Module;
5 | import com.app.sinkinchan.smartstock.mina.service.HandlerMessage;
6 | import com.app.sinkinchan.smartstock.utils.LogUtil;
7 | import com.sinkinchan.transport.module.ActionResponse;
8 | import com.sinkinchan.transport.module.TransportType;
9 | import com.sinkinchan.transport.module.UserBean;
10 |
11 | import org.apache.mina.core.session.IoSession;
12 | import org.greenrobot.eventbus.EventBus;
13 |
14 | import static com.app.sinkinchan.smartstock.event.MessageEvent.Type.LOGIN_SUCCESS;
15 | import static com.app.sinkinchan.smartstock.event.MessageEvent.Type.REGISTER_SUCCESS;
16 | import static com.app.sinkinchan.smartstock.event.MessageEvent.Type.USE_FUNCTION;
17 |
18 | public class HandlerMessageImpl implements HandlerMessage {
19 |
20 | @Override
21 | public void handlerMessage(IoSession session, Object module) {
22 | if (module instanceof UserBean) {
23 | UserBean userBean = (UserBean) module;
24 | TransportType type = userBean.getType();
25 | switch (type) {
26 | case registerSuccess:
27 | EventBus.getDefault().post(new MessageEvent(REGISTER_SUCCESS, userBean));
28 | break;
29 | case loginSuccess:
30 | EventBus.getDefault().post(new MessageEvent(LOGIN_SUCCESS, userBean));
31 | break;
32 | }
33 |
34 | } else if (module instanceof ActionResponse) {
35 | ActionResponse actionResponse = (ActionResponse) module;
36 | switch (actionResponse.getType()) {
37 | case useFunction:
38 | EventBus.getDefault().post(new MessageEvent(USE_FUNCTION, actionResponse));
39 | break;
40 | }
41 | }
42 | }
43 |
44 |
45 | @Override
46 | public void getVersion(IoSession session, Module module) {
47 | String json = module.getJson();
48 | LogUtil.d("json=" + json);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/dialog/AdDialog.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.dialog;
2 |
3 | import android.app.Activity;
4 | import android.content.DialogInterface;
5 | import android.support.annotation.NonNull;
6 | import android.support.v7.app.AlertDialog;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.widget.LinearLayout;
10 |
11 | import com.app.sinkinchan.smartstock.R;
12 |
13 | /**
14 | * @author : 陈欣健
15 | * @describe :
16 | * @since :2016-09-06 下午9:34
17 | **/
18 | public class AdDialog {
19 |
20 | AlertDialog.Builder adDialog = null;
21 |
22 | public void show(@NonNull Activity activity) {
23 |
24 | adDialog = new AlertDialog.Builder(activity);
25 | adDialog.setTitle("支持作者开发");
26 | adDialog.setCancelable(false);
27 | View v = LayoutInflater.from(activity).inflate(R.layout.dialog_ad, null);
28 |
29 |
30 | // 获取要嵌入广告条的布局
31 | LinearLayout bannerLayout = (LinearLayout) v.findViewById(R.id.ll_banner);
32 |
33 | // 将广告条加入到布局中
34 | // bannerLayout.addView(getBannerView());
35 |
36 | adDialog.setView(v);
37 | adDialog.setPositiveButton("关闭", new DialogInterface.OnClickListener() {
38 | @Override
39 | public void onClick(DialogInterface dialogInterface, int i) {
40 | dialogInterface.dismiss();
41 | }
42 | });
43 | adDialog.show();
44 |
45 | }
46 |
47 | /*private View getBannerView() {
48 | // 获取广告条
49 | View bannerView = BannerManager.getInstance(BaseActivity.currentActivity)
50 | .getBannerView(new BannerViewListener() {
51 | @Override
52 | public void onRequestSuccess() {
53 | LogUtil.d("获取广告条成功.");
54 | }
55 |
56 | @Override
57 | public void onSwitchBanner() {
58 | LogUtil.d("onSwitchBanner.");
59 | }
60 |
61 | @Override
62 | public void onRequestFailed() {
63 | LogUtil.d("获取广告条失败.");
64 | }
65 | });
66 | return bannerView;
67 | }*/
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/utils/ViewUtil.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.utils;
2 |
3 | import android.graphics.Bitmap;
4 | import android.renderscript.Allocation;
5 | import android.renderscript.Element;
6 | import android.renderscript.RenderScript;
7 | import android.renderscript.ScriptIntrinsicBlur;
8 | import android.support.annotation.NonNull;
9 | import android.view.View;
10 |
11 | import com.app.sinkinchan.smartstock.app.App;
12 |
13 | /**
14 | * @author : 陈欣健
15 | * @describe :
16 | * @since :2016-09-21 下午10:26
17 | **/
18 | public class ViewUtil {
19 | public static void setVisibility(int index, @NonNull View... views) {
20 | for (View v : views) {
21 | v.setVisibility(index);
22 | }
23 | }
24 |
25 | /**
26 | * 获取截图
27 | *
28 | * @param view
29 | * @return
30 | */
31 | public static Bitmap getScreenImage(View view) { // 截取一张屏幕的图片
32 | // view.setBackgroundColor(Color.WHITE);
33 | view.setDrawingCacheEnabled(true);
34 | view.buildDrawingCache();
35 | Bitmap bitmap = Bitmap.createBitmap(view.getDrawingCache(), 0, 0, view.getWidth(), view
36 | .getHeight());
37 | view.destroyDrawingCache();
38 | return bitmap;
39 | }
40 |
41 | /**
42 | * 高斯模糊
43 | *
44 | * @param bitmap
45 | * @param radius
46 | * @return
47 | */
48 | public static Bitmap blur(Bitmap bitmap, float radius) {
49 | Bitmap output = Bitmap.createBitmap(bitmap); // 创建输出图片
50 | RenderScript rs = RenderScript.create(App.getInstance()); // 构建一个RenderScript对象
51 | ScriptIntrinsicBlur gaussianBlue = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs)); //
52 | // 创建高斯模糊脚本
53 | Allocation allIn = Allocation.createFromBitmap(rs, bitmap); // 开辟输入内存
54 | Allocation allOut = Allocation.createFromBitmap(rs, output); // 开辟输出内存
55 | gaussianBlue.setRadius(radius); // 设置模糊半径,范围0f=23则使用rs.releaseAllContexts()
60 | return output;
61 | }
62 | }
63 |
64 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/dialog/ProgressDialog.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.dialog;
2 |
3 | import android.app.Dialog;
4 | import android.content.Context;
5 | import android.view.View;
6 | import android.view.Window;
7 | import android.view.animation.Animation;
8 | import android.view.animation.AnimationUtils;
9 | import android.view.animation.LinearInterpolator;
10 | import android.widget.ImageView;
11 | import android.widget.TextView;
12 |
13 | import com.app.sinkinchan.smartstock.R;
14 | import com.app.sinkinchan.smartstock.utils.ResourceManager;
15 |
16 | import org.jsoup.helper.StringUtil;
17 |
18 | /**
19 | * 等待框
20 | */
21 | public class ProgressDialog extends Dialog {
22 | TextView tvInfo;
23 | ImageView loading_icon;
24 | /**
25 | * 标志
26 | */
27 | String info = null;
28 |
29 | public ProgressDialog(Context context, String info) {
30 | super(context, R.style.myDialog);
31 | show();
32 | Window window = getWindow();
33 | window.setContentView(R.layout.dialog_progress);
34 | tvInfo = (TextView) window.findViewById(R.id.tvInfo);
35 | loading_icon = (ImageView) window.findViewById(R.id.loading_icon);
36 | runCircle();
37 | if (StringUtil.isBlank(info)) {
38 | tvInfo.setVisibility(View.GONE);
39 | } else {
40 | tvInfo.setText(info);
41 | }
42 | this.info = info;
43 | }
44 |
45 | Animation operatingAnimForwardRotation;
46 |
47 | public void runCircle() {
48 | operatingAnimForwardRotation = AnimationUtils.loadAnimation(ResourceManager.getContext(), R.anim.loading_rotatation);
49 | LinearInterpolator lin1 = new LinearInterpolator();
50 | operatingAnimForwardRotation.setInterpolator(lin1);
51 | loading_icon.startAnimation(operatingAnimForwardRotation);
52 | }
53 |
54 | /**
55 | * 设置dialog显示的内容
56 | */
57 | public void setMessage(String info) {
58 | if (StringUtil.isBlank(info)) {
59 | tvInfo.setVisibility(View.GONE);
60 | } else {
61 | tvInfo.setText(info);
62 | }
63 |
64 | }
65 |
66 | public String getMessage() {
67 | return info;
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/utils/ThemeUtil.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.utils;
2 |
3 | import android.annotation.TargetApi;
4 | import android.content.res.Resources;
5 | import android.content.res.TypedArray;
6 | import android.graphics.drawable.Drawable;
7 | import android.support.annotation.AttrRes;
8 | import android.support.annotation.DrawableRes;
9 | import android.support.annotation.StyleRes;
10 | import android.support.annotation.StyleableRes;
11 | import android.util.AttributeSet;
12 | import android.util.TypedValue;
13 |
14 | /**
15 | * @author : 陈欣健
16 | * @describe :
17 | * @since :2016-09-10 下午12:07
18 | **/
19 | public class ThemeUtil {
20 | public static void applyStyle(int resId, boolean force) {
21 | Base.getTheme().applyStyle(resId, force);
22 | }
23 |
24 | public static void dump(int priority, String tag, String prefix) {
25 | Base.getTheme().dump(priority, tag, prefix);
26 | }
27 |
28 | @TargetApi(23)
29 | public static int getChangingConfigurations() {
30 | return Base.getTheme().getChangingConfigurations();
31 | }
32 |
33 | public static Drawable getDrawable(@DrawableRes int drawableRes) {
34 | return ResourcesUtil.getDrawable(drawableRes);
35 | }
36 |
37 | public static Resources getResources() {
38 | return Base.getResources();
39 | }
40 |
41 | public static TypedArray obtainStyledAttributes(@StyleableRes int[] attrs) {
42 | return Base.getTheme().obtainStyledAttributes(attrs);
43 | }
44 |
45 | public static TypedArray obtainStyledAttributes(@StyleRes int resid, @StyleableRes int[] attrs) {
46 | return Base.getTheme().obtainStyledAttributes(resid, attrs);
47 | }
48 |
49 | public static TypedArray obtainStyledAttributes(AttributeSet set, @StyleableRes int[] attrs, @AttrRes int defStyleAttr, @StyleRes int defStyleRes) {
50 | return Base.getTheme().obtainStyledAttributes(set, attrs, defStyleAttr, defStyleRes);
51 | }
52 |
53 | public static boolean resolveAttribute(int resid, TypedValue outValue, boolean resolveRefs) {
54 | return Base.getTheme().resolveAttribute(resid, outValue, resolveRefs);
55 | }
56 |
57 | public static void setTo(Resources.Theme other) {
58 | Base.getTheme().setTo(other);
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/utils/ZipUtil.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.utils;
2 |
3 | import java.io.ByteArrayInputStream;
4 | import java.io.ByteArrayOutputStream;
5 | import java.io.IOException;
6 | import java.util.zip.GZIPInputStream;
7 | import java.util.zip.GZIPOutputStream;
8 |
9 | /**
10 | * @author : 陈欣健
11 | * @describe :
12 | * @since :2016-09-16 下午10:27
13 | **/
14 | public class ZipUtil {
15 | /**
16 | * 压缩
17 | *
18 | * @param str
19 | * @return
20 | * @throws IOException
21 | */
22 | public static String compress(String str) throws IOException {
23 | if (str == null || str.length() == 0) {
24 | return str;
25 | }
26 | ByteArrayOutputStream out = new ByteArrayOutputStream();
27 | GZIPOutputStream gzip = new GZIPOutputStream(out);
28 | gzip.write(str.getBytes());
29 | gzip.close();
30 | return out.toString("ISO-8859-1");
31 | }
32 |
33 | /**
34 | * 解压缩
35 | *
36 | * @param str
37 | * @return
38 | * @throws IOException
39 | */
40 | public static String uncompress(String str) throws IOException {
41 | if (str == null || str.length() == 0) {
42 | return str;
43 | }
44 | ByteArrayOutputStream out = new ByteArrayOutputStream();
45 | ByteArrayInputStream in = new ByteArrayInputStream(
46 | str.getBytes("ISO-8859-1"));
47 | GZIPInputStream gunzip = new GZIPInputStream(in);
48 | byte[] buffer = new byte[256];
49 | int n;
50 | while ((n = gunzip.read(buffer)) >= 0) {
51 | out.write(buffer, 0, n);
52 | out.flush();
53 | }
54 | gunzip.close();
55 | // toString()使用平台默认编码,也可以显式的指定如toString("GBK")
56 | return out.toString("UTF-8");
57 | }
58 |
59 | // // 测试方法
60 | // public void main(String[] args) throws IOException {
61 | // String temp = "中文。,、。2145@!#¥¥%%⋯⋯⋯⋯⋯⋯*&“”《》?:“}{+——)()*(&*⋯⋯%¥#@!|";
62 | // System.out.println("原字符串=" + temp);
63 | // System.out.println("原长=" + temp.length());
64 | // String temp1 = ZipUtil.compress(temp);
65 | // System.out.println("压缩后的字符串=" + temp1);
66 | // System.out.println("压缩后的长=" + temp1.length());
67 | // System.out.println("解压后的字符串=" + ZipUtil.uncompress(temp1));
68 | // }
69 | }
70 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/mina/MinaClientHandler.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.mina;
2 |
3 | import com.app.sinkinchan.smartstock.mina.service.HandlerMessage;
4 | import com.app.sinkinchan.smartstock.mina.service.impl.HandlerMessageImpl;
5 | import com.app.sinkinchan.smartstock.utils.DeviceUtils;
6 | import com.app.sinkinchan.smartstock.utils.LogUtil;
7 | import com.sinkinchan.transport.module.TransportType;
8 | import com.sinkinchan.transport.module.UserBean;
9 |
10 | import org.apache.mina.core.service.IoHandlerAdapter;
11 | import org.apache.mina.core.session.IoSession;
12 |
13 |
14 | public class MinaClientHandler extends IoHandlerAdapter {
15 | // 当客户端连接进入时
16 | @Override
17 | public void sessionOpened(IoSession session) throws Exception {
18 | // System.out.println("incomming 客户端: " + session.getRemoteAddress());
19 | // session.write("i am coming");
20 | // 自动登录
21 | oneKeyLogin();
22 | }
23 |
24 | @Override
25 | public void exceptionCaught(IoSession session, Throwable cause)
26 | throws Exception {
27 | LogUtil.d(cause.getMessage());
28 | System.out.println("客户端发送信息异常....");
29 | }
30 |
31 | private void oneKeyLogin() {
32 | String key = DeviceUtils.getUniquePsuedoID();
33 | UserBean userBean = new UserBean();
34 | userBean.setGender("m");
35 | userBean.setUserName("user_" + DeviceUtils.getUniqueID());
36 | userBean.setIcon("");
37 | userBean.setThird_party_id(key);
38 | userBean.setPlatform("oneKeyLogin");
39 | userBean.setType(TransportType.register);
40 | MinaService.getInstance().write(userBean, null);
41 | }
42 |
43 | // 当客户端发送消息到达时
44 | @Override
45 | public void messageReceived(IoSession session, Object message)
46 | throws Exception {
47 | HandlerMessage handlerMessage = new HandlerMessageImpl();
48 | handlerMessage.handlerMessage(session, message);
49 | }
50 |
51 | @Override
52 | public void sessionClosed(IoSession session) throws Exception {
53 | // System.out.println("客户端与服务端断开连接.....");
54 | }
55 |
56 | @Override
57 | public void sessionCreated(IoSession session) throws Exception {
58 | // TODO Auto-generated method stub
59 | // System.out
60 | // .println("one Client Connection" + session.getRemoteAddress());
61 |
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_feedback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
18 |
19 |
28 |
29 |
30 |
38 |
39 |
48 |
49 |
50 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/widget_global_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
22 |
23 |
33 |
34 |
38 |
39 |
49 |
50 |
59 |
60 |
61 |
62 |
63 |
64 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/utils/ToastUtil.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.utils;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.content.Context;
5 | import android.os.Looper;
6 | import android.view.Gravity;
7 | import android.view.View;
8 | import android.widget.Toast;
9 |
10 | public class ToastUtil {
11 | private static Toast toast;
12 | private static View view;
13 |
14 | private ToastUtil() {
15 | }
16 |
17 | @SuppressLint("ShowToast")
18 | private static void getToast(Context context) {
19 | if (toast == null) {
20 | toast = new Toast(context);
21 | }
22 | if (view == null) {
23 | view = Toast.makeText(context, "", Toast.LENGTH_SHORT).getView();
24 | }
25 | toast.setView(view);
26 | }
27 |
28 | public static void showShortToast(Context context, CharSequence msg) {
29 | showToast(context, msg, Toast.LENGTH_SHORT);
30 | }
31 |
32 | public static void showShortToast(Context context, int resId) {
33 | showToast(context, resId, Toast.LENGTH_SHORT);
34 | }
35 |
36 | public static void showLongToast(Context context, CharSequence msg) {
37 | showToast(context, msg, Toast.LENGTH_LONG);
38 | }
39 |
40 | public static void showLongToast(Context context, int resId) {
41 | showToast(context, resId, Toast.LENGTH_LONG);
42 | }
43 |
44 | private static void showToast(Context context, CharSequence msg,
45 | int duration) {
46 | try {
47 | getToast(context);
48 | toast.setText(msg);
49 | toast.setGravity(Gravity.CENTER, 0, 0);
50 | toast.setDuration(duration);
51 | toast.show();
52 | } catch (Exception e) {
53 | e.printStackTrace();
54 | }
55 | }
56 |
57 | private static void showToast(Context context, int resId, int duration) {
58 | try {
59 | // Looper.prepare();
60 | if (resId == 0) {
61 | return;
62 | }
63 | getToast(context);
64 | toast.setText(resId);
65 | toast.setGravity(Gravity.CENTER, 0, 0);
66 | toast.setDuration(duration);
67 | toast.show();
68 | // Looper.loop();
69 | } catch (Exception e) {
70 | }
71 | }
72 |
73 |
74 | public static void showToastThread(Context context, String message) {
75 | Looper.prepare();
76 | ToastUtil.showLongToast(context, message);
77 | Looper.loop();
78 |
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/utils/http/Netroid.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.utils.http;
2 |
3 | /**
4 | * @author : miaozh
5 | * @since : 2016/7/18 14:25
6 | */
7 |
8 | import android.content.Context;
9 |
10 | import com.duowan.mobile.netroid.Listener;
11 | import com.duowan.mobile.netroid.Network;
12 | import com.duowan.mobile.netroid.RequestQueue;
13 | import com.duowan.mobile.netroid.cache.DiskCache;
14 | import com.duowan.mobile.netroid.stack.HurlStack;
15 | import com.duowan.mobile.netroid.toolbox.BasicNetwork;
16 | import com.duowan.mobile.netroid.toolbox.FileDownloader;
17 |
18 | import java.io.File;
19 |
20 | public class Netroid {
21 | // Netroid入口,私有该实例,提供方法对外服务。
22 | private static RequestQueue mRequestQueue;
23 | private static RequestQueue cameraQueue;
24 | // 文件下载管理器,私有该实例,提供方法对外服务。
25 | private static FileDownloader mFileDownloader;
26 |
27 | private Netroid() {
28 | }
29 |
30 | public static void init(Context ctx) {
31 | if (mRequestQueue != null)
32 | throw new IllegalStateException("initialized");
33 |
34 | // 创建Netroid主类,指定硬盘缓存方案
35 | Network network = new BasicNetwork(
36 | new HurlStack(Const.USER_AGENT, null), "UTF-8");
37 | mRequestQueue = new RequestQueue(network, 4, new DiskCache(new File(
38 | ctx.getCacheDir(), Const.HTTP_DISK_CACHE_DIR_NAME),
39 | Const.HTTP_DISK_CACHE_SIZE));
40 | cameraQueue = new RequestQueue(network, 4, new DiskCache(new File(
41 | ctx.getCacheDir(), Const.HTTP_DISK_CACHE_DIR_NAME),
42 | Const.HTTP_DISK_CACHE_SIZE));
43 |
44 | // 创建ImageLoader实例,指定内存缓存方案
45 | // 注:SelfImageLoader的实现示例请查看图片加载的相关文档
46 | // 注:ImageLoader及FileDownloader不是必须初始化的组件,如果没有用处,不需要创建实例
47 | // mImageLoader = new SelfImageLoader(mRequestQueue, new
48 | // BitmapImageCache(
49 | // Const.HTTP_MEMORY_CACHE_SIZE));
50 | //
51 | mFileDownloader = new FileDownloader(mRequestQueue, 2);
52 | mRequestQueue.start();
53 | }
54 |
55 | // 执行文件下载请求
56 | public static FileDownloader.DownloadController addFileDownload(
57 | String storeFilePath, String url, Listener listener) {
58 | return mFileDownloader.add(storeFilePath, url, listener);
59 | }
60 |
61 |
62 | public class Const {
63 | public static final int HTTP_DISK_CACHE_SIZE = 50 * 1024 * 1024; // 50MB
64 | public static final String HTTP_DISK_CACHE_DIR_NAME = "netroid";
65 | public static final String USER_AGENT = "netroid.cn";
66 | }
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/app/App.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.app;
2 |
3 | import android.content.Context;
4 | import android.content.pm.ApplicationInfo;
5 | import android.os.Handler;
6 | import android.os.Looper;
7 |
8 | import com.app.sinkinchan.smartstock.constant.Constants;
9 | import com.app.sinkinchan.smartstock.utils.Base;
10 | import com.app.sinkinchan.smartstock.utils.http.Netroid;
11 | import com.orm.SugarApp;
12 | import com.orm.SugarContext;
13 |
14 | /**
15 | * @author : 陈欣健
16 | * @describe :
17 | * @since :2016-07-16 下午7:54
18 | **/
19 | public class App extends SugarApp {
20 | private static App context;
21 | private boolean IS_DEBUG;
22 | private Handler handler;
23 |
24 | @Override
25 | public void onCreate() {
26 | super.onCreate();
27 |
28 | SugarContext.init(this);
29 | context = (App) getApplicationContext();
30 | Base.initialize(context);
31 | IS_DEBUG = isApkDebugable(context);
32 | handler = new Handler(Looper.getMainLooper());
33 | Netroid.init(this);
34 | //创建app文件目录
35 | Constants.createDir();
36 | //初始化配置文件
37 | /*try {
38 | if (IS_DEBUG) {
39 | GlobalConfig.init(this, GlobalConfig.CONFIG_DEVELOP);
40 | } else {
41 | GlobalConfig.init(this, GlobalConfig.CONFIG_PRODUCTION);
42 | }
43 |
44 | } catch (IOException e) {
45 | e.printStackTrace();
46 | }*/
47 | }
48 |
49 | @Override
50 | public void onTerminate() {
51 | SugarContext.terminate();
52 | super.onTerminate();
53 | }
54 |
55 | public boolean isDebug() {
56 | return IS_DEBUG;
57 | }
58 |
59 | public static App getInstance() {
60 | return context;
61 | }
62 |
63 | /**
64 | * 但是当我们没在AndroidManifest.xml中设置其debug属性时:
65 | * 使用Eclipse运行这种方式打包时其debug属性为true,使用Eclipse导出这种方式打包时其debug属性为法false.
66 | * 在使用ant打包时,其值就取决于ant的打包参数是release还是debug.
67 | * 因此在AndroidMainifest.xml中最好不设置android:debuggable属性置,而是由打包方式来决定其值.
68 | *
69 | * @param context
70 | * @return
71 | * @author SHANHY
72 | * @date 2015-8-7
73 | */
74 | public static boolean isApkDebugable(Context context) {
75 | try {
76 | ApplicationInfo info = context.getApplicationInfo();
77 | return (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
78 | } catch (Exception e) {
79 | e.printStackTrace();
80 | }
81 | return false;
82 | }
83 |
84 | /**
85 | * 主线程上运行
86 | *
87 | * @param runnable
88 | */
89 | public void runInUIThread(Runnable runnable) {
90 | handler.post(runnable);
91 | }
92 |
93 | }
94 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_stock_handicap_more.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
10 |
11 |
12 |
17 |
18 |
19 |
26 |
27 |
31 |
32 |
36 |
37 |
45 |
46 |
54 |
55 |
56 |
57 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/utils/ui/DisplayUtil.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.utils.ui;
2 |
3 | import android.graphics.Point;
4 | import android.util.TypedValue;
5 | import android.view.Display;
6 |
7 | import com.app.sinkinchan.smartstock.utils.APILevel;
8 | import com.app.sinkinchan.smartstock.utils.ResourcesUtil;
9 | import com.app.sinkinchan.smartstock.utils.ThemeUtil;
10 | import com.app.sinkinchan.smartstock.utils.TypedValueUtil;
11 |
12 | /**
13 | * @author : 陈欣健
14 | * @describe :
15 | * @since :2016-09-10 上午11:52
16 | **/
17 | public class DisplayUtil {
18 | public static int getWidth() {
19 | Display display = WindowManagerUtil.getDefaultDisplay();
20 | if (APILevel.require(13)) {
21 | Point size = new Point();
22 | display.getSize(size);
23 | return size.x;
24 | } else {
25 | return display.getWidth();
26 | }
27 | }
28 |
29 | public static int getHeight() {
30 | Display display = WindowManagerUtil.getDefaultDisplay();
31 | if (APILevel.require(13)) {
32 | Point size = new Point();
33 | display.getSize(size);
34 | return size.y;
35 | } else {
36 | return display.getHeight();
37 | }
38 | }
39 |
40 | public static Rotation getRotation() {
41 | if (APILevel.require(8))
42 | return Rotation.fromValue(WindowManagerUtil.getDefaultDisplay().getRotation());
43 | else
44 | return Rotation.fromValue(WindowManagerUtil.getDefaultDisplay().getOrientation());
45 | }
46 |
47 | public static boolean isPortrait() {
48 | return getHeight() >= getWidth();
49 | }
50 |
51 | public static boolean isLandscape() {
52 | return getHeight() < getWidth();
53 | }
54 |
55 | public static int getStatusBarHeight() {
56 | int resourceId = ResourcesUtil.getIdentifier("status_bar_height", "dimen", "android");
57 | return resourceId > 0 ?
58 | ResourcesUtil.getDimensionPixelSize(resourceId) :
59 | 0;
60 | }
61 |
62 | public static int getToolbarHeight() {
63 | return getActionBarHeight();
64 | }
65 |
66 | public static int getActionBarHeight() {
67 | TypedValue tv = new TypedValue();
68 | return ThemeUtil.resolveAttribute(android.R.attr.actionBarSize, tv, true) ?
69 | TypedValueUtil.complexToDimensionPixelSize(tv.data) :
70 | 0;
71 | }
72 |
73 | public static int getNavigationBarHeight() {
74 | int resourceId = ResourcesUtil.getIdentifier("navigation_bar_height", "dimen", "android");
75 | return resourceId > 0 ?
76 | ResourcesUtil.getDimensionPixelSize(resourceId) :
77 | 0;
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/dialog/DeleteStockDialog.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.dialog;
2 |
3 | import android.content.DialogInterface;
4 | import android.support.v7.app.AlertDialog;
5 |
6 | import com.app.sinkinchan.smartstock.activitys.base.BaseActivity;
7 |
8 | /**
9 | * @author : 陈欣健
10 | * @describe :
11 | * @since :2016-09-19 下午9:16
12 | **/
13 | public class DeleteStockDialog {
14 | private String title;
15 | private String message;
16 | private String negativeButtonText;
17 | private String positiveButtonText;
18 | private DialogInterface.OnClickListener negativeButtonListener;
19 | private DialogInterface.OnClickListener positiveButtonListener;
20 |
21 | public String getTitle() {
22 | return title;
23 | }
24 |
25 | public DeleteStockDialog setTitle(String title) {
26 | this.title = title;
27 | return this;
28 | }
29 |
30 | public String getNegativeButtonText() {
31 | return negativeButtonText;
32 | }
33 |
34 | public DeleteStockDialog setNegativeButtonText(String negativeButtonText) {
35 | this.negativeButtonText = negativeButtonText;
36 | return this;
37 | }
38 |
39 | public String getPositiveButtonText() {
40 | return positiveButtonText;
41 | }
42 |
43 | public DeleteStockDialog setPositiveButtonText(String positiveButtonText) {
44 | this.positiveButtonText = positiveButtonText;
45 | return this;
46 | }
47 |
48 | public String getMessage() {
49 | return message;
50 | }
51 |
52 | public DeleteStockDialog setMessage(String message) {
53 | this.message = message;
54 | return this;
55 | }
56 |
57 | public DialogInterface.OnClickListener getNegativeButtonListener() {
58 | return negativeButtonListener;
59 | }
60 |
61 | public DeleteStockDialog setNegativeButtonListener(DialogInterface.OnClickListener negativeButtonListener) {
62 | this.negativeButtonListener = negativeButtonListener;
63 | return this;
64 | }
65 |
66 | public DialogInterface.OnClickListener getPositiveButtonListener() {
67 | return positiveButtonListener;
68 | }
69 |
70 | public DeleteStockDialog setPositiveButtonListener(DialogInterface.OnClickListener positiveButtonListener) {
71 | this.positiveButtonListener = positiveButtonListener;
72 | return this;
73 | }
74 |
75 | public void show() {
76 | AlertDialog.Builder activeStockDialog = new AlertDialog.Builder(BaseActivity.currentActivity);
77 | activeStockDialog.setTitle(title)
78 | .setMessage(message)
79 | .setPositiveButton(positiveButtonText, positiveButtonListener)
80 | .setNegativeButton(negativeButtonText, negativeButtonListener)
81 | .show();
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/activitys/LoginActivity.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.activitys;
2 |
3 | import android.os.Bundle;
4 |
5 | import com.app.sinkinchan.smartstock.R;
6 | import com.app.sinkinchan.smartstock.activitys.base.BaseActivity;
7 |
8 | public class LoginActivity extends BaseActivity {
9 |
10 | // TextView btn_wechat, btn_qq;
11 |
12 | @Override
13 | protected void onCreate(Bundle savedInstanceState) {
14 | super.onCreate(savedInstanceState);
15 | setContentView(R.layout.activity_login);
16 | init();
17 | }
18 |
19 | @Override
20 | protected void init() {
21 | // btn_wechat = (TextView) findViewById(btn_wechat);
22 | // btn_qq = (TextView) findViewById(btn_qq);
23 | // btn_wechat.setOnClickListener(onClickListener);
24 | // btn_qq.setOnClickListener(onClickListener);
25 | }
26 |
27 | /*View.OnClickListener onClickListener = new View.OnClickListener() {
28 | @Override
29 | public void onClick(View v) {
30 | switch (v.getId()) {
31 | case btn_wechat:
32 | ThirdLogin(Wechat.NAME);
33 | break;
34 | case btn_qq:
35 | ThirdLogin(QQ.NAME);
36 | break;
37 | }
38 | }
39 | };*/
40 |
41 | /*
42 | *//**
43 | * 第三方登录
44 | *//*
45 | private void ThirdLogin(String name) {
46 | Platform platform = ShareSDK.getPlatform(getApplicationContext(), name);
47 | *//*if (platform.isValid()) {
48 | platform.removeAccount();
49 | }*//*
50 | platform.setPlatformActionListener(this);
51 | if (platform.isClientValid()) {
52 | platform.SSOSetting(false);
53 | platform.authorize();
54 | } else {
55 | platform.showUser(null);
56 | }
57 |
58 |
59 | // wechat.authorize();
60 | }
61 |
62 | @Override
63 | public void onComplete(Platform platform, int i, HashMap hashMap) {
64 | LogUtil.d("onComplete=" + hashMap);
65 | }
66 |
67 | @Override
68 | public void onError(Platform platform, int i, Throwable throwable) {
69 | LogUtil.d("onError=" + throwable.getLocalizedMessage());
70 | }
71 |
72 | @Override
73 | public void onCancel(Platform platform, int i) {
74 | LogUtil.d("onCancel=" + platform.getName());
75 | }
76 |
77 | @Override
78 | protected void createListener() {
79 | super.createListener();
80 | ShareSDK.initSDK(this);
81 | }
82 |
83 | @Override
84 | protected void destroyListener() {
85 | super.destroyListener();
86 | ShareSDK.stopSDK(this);
87 | }*/
88 |
89 | @Override
90 | protected void registerListener() {
91 |
92 | }
93 |
94 | @Override
95 | protected void unRegisterListener() {
96 |
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/utils/UserUtil.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.utils;
2 |
3 | import android.support.v4.app.ActivityCompat;
4 |
5 | import com.app.sinkinchan.smartstock.app.App;
6 | import com.app.sinkinchan.smartstock.bean.LocalUser;
7 |
8 | import java.io.File;
9 | import java.io.FileInputStream;
10 | import java.io.FileOutputStream;
11 | import java.io.IOException;
12 | import java.io.ObjectInputStream;
13 | import java.io.ObjectOutputStream;
14 | import java.util.regex.Matcher;
15 | import java.util.regex.Pattern;
16 |
17 | /**
18 | * @author : 陈欣健
19 | * @describe :
20 | * @since :2016-10-22 下午8:29
21 | **/
22 | public class UserUtil {
23 | private final static String PATH = new File(ActivityCompat.getExternalFilesDirs(App.getInstance(), null)[0], "files").getAbsolutePath() + "/";
24 | private final static String USER_NAME = "temp.data";
25 |
26 | /**
27 | * 保存在本地
28 | *
29 | * @param user
30 | */
31 | public static void save(LocalUser user) {
32 | if (user == null) {
33 | return;
34 | }
35 | try {
36 | FileOutputStream fos = new FileOutputStream(new File(PATH + USER_NAME));
37 | ObjectOutputStream oos = new ObjectOutputStream(fos);
38 | oos.writeObject(user);
39 | oos.close();
40 | fos.close();
41 | } catch (Exception e) {
42 | e.printStackTrace();
43 | }
44 | }
45 |
46 | /**
47 | * 获取本地用户
48 | *
49 | * @return
50 | */
51 | public static LocalUser getUser() {
52 | LocalUser user = null;
53 | File file = new File(PATH + USER_NAME);
54 | if (!file.exists()) {
55 | return user;
56 | }
57 | FileInputStream fis = null;
58 | ObjectInputStream ois = null;
59 | try {
60 | fis = new FileInputStream(file);
61 | ois = new ObjectInputStream(fis);
62 | user = (LocalUser) ois.readObject();
63 | } catch (IOException e) {
64 | e.printStackTrace();
65 | } catch (ClassNotFoundException e) {
66 | e.printStackTrace();
67 | } finally {
68 | try {
69 | if (ois != null) {
70 | ois.close();
71 | }
72 | if (fis != null) {
73 | fis.close();
74 | }
75 | } catch (Exception e) {
76 | e.printStackTrace();
77 | }
78 |
79 | }
80 | return user;
81 | }
82 |
83 | /**
84 | * 判断是否是邮箱
85 | *
86 | * @return
87 | */
88 | public static boolean isEmail(String email) {
89 | // String check = "^([a-z0-9A-Z]+[-_|.]*[a-z0-9A-Z]*)@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?.)+[a-zA-Z]{2,}$";
90 | String check = "^[a-z'0-9]+([._-][a-z'0-9]+)*@([a-z0-9]+([._-][a-z0-9]+))+$";
91 | Pattern regex = Pattern.compile(check);
92 | Matcher matcher = regex.matcher(email);
93 | boolean isMatched = matcher.matches();
94 | return isMatched;
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/dialog/base/BaseDialog.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.dialog.base;
2 |
3 | import android.app.Activity;
4 | import android.app.Dialog;
5 | import android.content.Context;
6 | import android.content.DialogInterface;
7 | import android.os.Bundle;
8 | import android.util.Log;
9 | import android.view.MotionEvent;
10 | import android.view.View;
11 | import android.widget.RadioGroup;
12 |
13 | import com.app.sinkinchan.smartstock.event.MessageEvent;
14 |
15 | import org.greenrobot.eventbus.EventBus;
16 | import org.greenrobot.eventbus.Subscribe;
17 | import org.greenrobot.eventbus.ThreadMode;
18 |
19 | /**
20 | * @author : 陈欣健
21 | * @describe :
22 | * @since :2016-07-24 上午9:47
23 | **/
24 | public class BaseDialog extends Dialog implements DialogInterface.OnDismissListener, View.OnClickListener, View.OnTouchListener, RadioGroup.OnCheckedChangeListener {
25 | protected Activity context;
26 |
27 | public static String TAG = null;
28 |
29 |
30 | public BaseDialog(Context context) {
31 | super(context);
32 | this.context = (Activity) context;
33 | init();
34 | }
35 |
36 | public BaseDialog(Context context, int theme) {
37 | super(context, theme);
38 | this.context = (Activity) context;
39 | init();
40 | }
41 |
42 |
43 | protected BaseDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
44 | super(context, cancelable, cancelListener);
45 | }
46 |
47 | /**
48 | * 实例化
49 | */
50 | protected void init() {
51 | TAG = this.getClass().getSimpleName();
52 | }
53 |
54 | @Override
55 | protected void onCreate(Bundle savedInstanceState) {
56 | super.onCreate(savedInstanceState);
57 | registerEventBus();
58 | }
59 |
60 | /**
61 | * 处理事件方法
62 | *
63 | * @param event
64 | */
65 | @Subscribe(threadMode = ThreadMode.MAIN)
66 | public void onEventMainThread(MessageEvent event) {
67 |
68 | }
69 |
70 | protected void LogDebug(String msg) {
71 | Log.d(TAG, "LogDebug: " + msg);
72 | }
73 |
74 |
75 | protected void LogError(String msg) {
76 | Log.d(TAG, "LogError: " + msg);
77 | }
78 |
79 | protected void registerEventBus() {
80 | EventBus.getDefault().register(this);
81 | LogError("register dialogEventBus");
82 | }
83 |
84 | protected void unRegisterEventBus() {
85 | EventBus.getDefault().unregister(this);//反注册EventBus
86 | }
87 |
88 | @Override
89 | public void onDismiss(DialogInterface dialog) {
90 | unRegisterEventBus();
91 | LogError("unregister dialogEventBus");
92 | }
93 |
94 | @Override
95 | public void onClick(View v) {
96 |
97 | }
98 |
99 | @Override
100 | public boolean onTouch(View v, MotionEvent event) {
101 | return false;
102 | }
103 |
104 | @Override
105 | public void onCheckedChanged(RadioGroup group, int checkedId) {
106 |
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/utils/PreferenceUtil.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.utils;
2 |
3 | import android.content.SharedPreferences;
4 | import android.preference.PreferenceManager;
5 |
6 | import com.app.sinkinchan.smartstock.app.App;
7 |
8 |
9 | public class PreferenceUtil {
10 | public final static String AREA = "area";
11 |
12 | private static SharedPreferences mSharedPreferences;
13 |
14 | private static synchronized SharedPreferences getPreferneces() {
15 | if (mSharedPreferences == null) {
16 | // mSharedPreferences = App.context.getSharedPreferences(
17 | // PREFERENCE_NAME, Context.MODE_PRIVATE);
18 | mSharedPreferences = PreferenceManager
19 | .getDefaultSharedPreferences(App.getInstance());
20 | }
21 | return mSharedPreferences;
22 | }
23 |
24 | /**
25 | * 打印所有
26 | */
27 | public static void print() {
28 | System.out.println(getPreferneces().getAll());
29 | }
30 |
31 | /**
32 | * 清空保存在默认SharePreference下的所有数据
33 | */
34 | public static void clear() {
35 | getPreferneces().edit().clear().commit();
36 | }
37 |
38 | /**
39 | * 保存字符串
40 | *
41 | * @return
42 | */
43 | public static void putString(String key, String value) {
44 |
45 | getPreferneces().edit().putString(key, value).commit();
46 | }
47 |
48 | /**
49 | * 读取字符串
50 | *
51 | * @param key
52 | * @return
53 | */
54 | public static String getString(String key) {
55 | return getPreferneces().getString(key, null);
56 |
57 | }
58 |
59 | /**
60 | * 保存整型值
61 | *
62 | * @return
63 | */
64 | public static void putInt(String key, int value) {
65 | getPreferneces().edit().putInt(key, value).commit();
66 | }
67 |
68 | /**
69 | * 读取整型值
70 | *
71 | * @param key
72 | * @return
73 | */
74 | public static int getInt(String key) {
75 | return getPreferneces().getInt(key, 0);
76 | }
77 |
78 | /**
79 | * 保存布尔值
80 | *
81 | * @return
82 | */
83 | public static void putBoolean(String key, Boolean value) {
84 | getPreferneces().edit().putBoolean(key, value).commit();
85 | }
86 |
87 | public static void putLong(String key, long value) {
88 | getPreferneces().edit().putLong(key, value).commit();
89 | }
90 |
91 | public static long getLong(String key) {
92 | return getPreferneces().getLong(key, 0);
93 | }
94 |
95 | /**
96 | * t 读取布尔值
97 | *
98 | * @param key
99 | * @return
100 | */
101 | public static boolean getBoolean(String key, boolean defValue) {
102 | return getPreferneces().getBoolean(key, defValue);
103 |
104 | }
105 |
106 | /**
107 | * 移除字段
108 | *
109 | * @return
110 | */
111 | public static void removeString(String key) {
112 | getPreferneces().edit().remove(key).commit();
113 | }
114 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/dialog/ResearchStockSettingDialog.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.dialog;
2 |
3 | import android.app.Activity;
4 | import android.content.DialogInterface;
5 | import android.support.annotation.NonNull;
6 | import android.support.v7.app.AlertDialog;
7 |
8 | import com.app.sinkinchan.smartstock.event.MessageEvent;
9 | import com.app.sinkinchan.smartstock.fragments.ResearchStockFragment;
10 | import com.sinkinchan.stock.sdk.bean.ResearchStockPage;
11 |
12 | import org.greenrobot.eventbus.EventBus;
13 |
14 | /**
15 | * @author : 陈欣健
16 | * @describe :
17 | * @since :2016-09-15 下午5:20
18 | **/
19 | public class ResearchStockSettingDialog {
20 | private static ResearchStockSettingDialog ourInstance = new ResearchStockSettingDialog();
21 |
22 | public static ResearchStockSettingDialog getInstance() {
23 | return ourInstance;
24 | }
25 |
26 | private ResearchStockSettingDialog() {
27 | }
28 |
29 | AlertDialog.Builder settingDialog = null;
30 | int chooseIndex = 1;
31 | ResearchStockPage.Type type = null;
32 |
33 | public void show(@NonNull final Activity activity, @NonNull final ResearchStockPage.Param param) {
34 | if (param == null) {
35 | return;
36 | }
37 | type = null;
38 | chooseIndex = param.getType().ordinal();
39 | settingDialog = new AlertDialog.Builder(activity);
40 | settingDialog.setTitle("研报股设置");
41 | settingDialog.setSingleChoiceItems(new String[]{ResearchStockPage.Type.today.getDesc(),
42 | ResearchStockPage.Type.five.getDesc(), ResearchStockPage.Type.thirty.getDesc()}, chooseIndex, new DialogInterface.OnClickListener() {
43 | @Override
44 | public void onClick(DialogInterface dialog, int which) {
45 | chooseIndex = which;
46 | }
47 | });
48 | settingDialog.setPositiveButton("确定", new DialogInterface.OnClickListener() {
49 | @Override
50 | public void onClick(DialogInterface dialogInterface, int i) {
51 | switch (chooseIndex) {
52 | case 0:
53 | type = ResearchStockPage.Type.today;
54 | break;
55 | case 1:
56 | type = ResearchStockPage.Type.five;
57 | break;
58 | case 2:
59 | type = ResearchStockPage.Type.thirty;
60 | break;
61 | default:
62 | type = ResearchStockPage.Type.five;
63 | break;
64 | }
65 | ResearchStockFragment.param.setType(type);
66 | EventBus.getDefault().post(new MessageEvent(MessageEvent.Type.REFRESH_STOCK));
67 | // ToastUtil.showLongToast(activity, "chooseIndex=" + type.getDesc());
68 | }
69 | });
70 | settingDialog.setNegativeButton("取消", new DialogInterface.OnClickListener() {
71 | @Override
72 | public void onClick(DialogInterface dialog, int which) {
73 | dialog.dismiss();
74 | }
75 | });
76 | settingDialog.show();
77 | }
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/card_view_stock_news_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
21 |
22 |
25 |
26 |
35 |
36 |
46 |
47 |
52 |
53 |
60 |
61 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'me.tatarka.retrolambda'
3 | android {
4 |
5 | compileSdkVersion 24
6 | buildToolsVersion '24.0.2'
7 | defaultConfig {
8 | applicationId "com.app.sinkinchan.smartstock"
9 | minSdkVersion 19
10 | targetSdkVersion 24
11 | versionCode 10
12 | versionName "1.1.0"
13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
14 | renderscriptTargetApi 18
15 | renderscriptSupportModeEnabled true
16 | }
17 | buildTypes {
18 | release {
19 | minifyEnabled false
20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
21 | signingConfig signingConfigs.SmartStock
22 | }
23 | debug {
24 | signingConfig signingConfigs.SmartStock
25 | }
26 | }
27 | productFlavors {
28 | }
29 |
30 | dataBinding {
31 | enabled true
32 | }
33 |
34 | compileOptions {
35 | sourceCompatibility JavaVersion.VERSION_1_8
36 | targetCompatibility JavaVersion.VERSION_1_8
37 | }
38 | productFlavors {
39 | meizu {
40 | manifestPlaceholders = [BAIDU_CHANNEL_VALUE: "10001"]
41 | }
42 | xiaomi {
43 | manifestPlaceholders = [BAIDU_CHANNEL_VALUE: "10002"]
44 | }
45 | qh360 {
46 | manifestPlaceholders = [BAIDU_CHANNEL_VALUE: "10003"]
47 | }
48 | baidu {
49 | manifestPlaceholders = [BAIDU_CHANNEL_VALUE: "10004"]
50 | }
51 | wandoujia {
52 | manifestPlaceholders = [BAIDU_CHANNEL_VALUE: "10005"]
53 | }
54 | baiduyun {
55 | manifestPlaceholders = [BAIDU_CHANNEL_VALUE: "10006"]
56 | }
57 | }
58 | productFlavors.all {
59 | flavor -> flavor.manifestPlaceholders = [BAIDU_CHANNEL_VALUE: name]
60 | }
61 | }
62 |
63 |
64 | repositories {
65 | maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
66 | }
67 |
68 | dependencies {
69 | compile fileTree(include: ['*.jar'], dir: 'libs')
70 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
71 | exclude group: 'com.android.support', module: 'support-annotations'
72 | })
73 | compile 'org.greenrobot:eventbus:3.0.0'
74 | compile 'org.apache.commons:commons-lang3:3.4'
75 | testCompile 'junit:junit:4.12'
76 | compile 'org.jsoup:jsoup:1.9.2'
77 | compile 'com.google.code.gson:gson:2.7'
78 | compile 'com.android.support:appcompat-v7:24.2.0'
79 | compile 'com.android.support:support-v4:24.2.0'
80 | compile 'com.android.support:design:24.2.0'
81 | compile 'com.android.support:cardview-v7:24.2.0'
82 | compile 'com.android.support:recyclerview-v7:24.2.0'
83 | compile 'com.jcodecraeer:xrecyclerview:1.2.7'
84 | compile 'com.github.barteksc:android-pdf-viewer:2.0.3'
85 | compile 'com.duowan.android.netroid:netroid:1.2.1'
86 | compile 'com.romainpiel.shimmer:library:1.4.0@aar'
87 | // 指定下载编译百度移动统计JAR
88 | compile 'com.baidu.mobstat:mtj-sdk:latest.integration'
89 | // mina 支持库
90 | compile('org.apache.mina:mina-core:2.0.7') {
91 | exclude module: 'slf4j-api'
92 | }
93 | compile 'org.slf4j:slf4j-android:1.6.1-RC1'
94 | compile 'com.github.satyan:sugar:1.4'
95 | //图片加载框架
96 | compile 'com.github.bumptech.glide:glide:3.7.0'
97 |
98 | }
99 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/mode/StockHandicapModeView.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.mode;
2 |
3 | import android.databinding.ObservableField;
4 |
5 | import com.sinkinchan.stock.sdk.bean.StockClassify;
6 |
7 | /**
8 | * @author : 陈欣健
9 | * @describe :
10 | * @since :2016-12-29 上午11:19
11 | **/
12 | public class StockHandicapModeView {
13 | public ObservableField cap = new ObservableField<>(null);
14 | public ObservableField classify = new ObservableField<>(null);
15 |
16 |
17 | public static class StockHandicap {
18 | public ObservableField code = new ObservableField<>(null);
19 | public ObservableField name = new ObservableField<>(null);
20 | public ObservableField latestPrice = new ObservableField<>(null);
21 | public ObservableField up = new ObservableField<>(null);
22 | public ObservableField upOrDown = new ObservableField<>(null);
23 | public ObservableField change = new ObservableField<>(null);
24 | public ObservableField highest = new ObservableField<>(null);
25 | public ObservableField minimum = new ObservableField<>(null);
26 | public ObservableField dealQuantity = new ObservableField<>(null);
27 | public ObservableField totalDealAmount = new ObservableField<>(null);
28 | public ObservableField limitUp = new ObservableField<>(null);
29 | public ObservableField limitDown = new ObservableField<>(null);
30 | public ObservableField yesterdayPrice = new ObservableField<>(null);
31 | public ObservableField currentNumber = new ObservableField<>(null);
32 | public ObservableField outerDisc = new ObservableField<>(null);
33 | public ObservableField insideDish = new ObservableField<>(null);
34 | public ObservableField volumeRatioIndex = new ObservableField<>(null);
35 | public ObservableField income = new ObservableField<>(null);
36 | public ObservableField PERatiosDynamic = new ObservableField<>(null);
37 | public ObservableField PERatios = new ObservableField<>(null);
38 | public ObservableField netAssets = new ObservableField<>(null);
39 | public ObservableField PBRatio = new ObservableField<>(null);
40 | public ObservableField generalCapital = new ObservableField<>(null);
41 | public ObservableField capitalization = new ObservableField<>(null);
42 | public ObservableField circulationOfCapitalStock = new ObservableField<>(null);
43 | public ObservableField circulationOfCapitalization = new ObservableField<>(null);
44 | public ObservableField time = new ObservableField<>(null);
45 | public ObservableField open = new ObservableField<>(null);
46 | public ObservableField zllr = new ObservableField<>(null);
47 | public ObservableField zllc = new ObservableField<>(null);
48 | public ObservableField zljlr = new ObservableField<>(null);
49 | public ObservableField cdd = new ObservableField<>(null);
50 | public ObservableField dd = new ObservableField<>(null);
51 | public ObservableField zd = new ObservableField<>(null);
52 | public ObservableField xd = new ObservableField<>(null);
53 | public ObservableField unit = new ObservableField<>(null);
54 |
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/activitys/StockHandicapMoreActivity.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.activitys;
2 |
3 | import android.content.Intent;
4 | import android.databinding.DataBindingUtil;
5 | import android.os.Bundle;
6 | import android.view.View;
7 | import android.widget.AdapterView;
8 | import android.widget.ArrayAdapter;
9 |
10 | import com.app.sinkinchan.smartstock.R;
11 | import com.app.sinkinchan.smartstock.activitys.base.BaseActivity;
12 | import com.app.sinkinchan.smartstock.databinding.ActivityStockHandicapMoreBinding;
13 | import com.app.sinkinchan.smartstock.event.MessageEvent;
14 | import com.sinkinchan.stock.sdk.bean.StockF10;
15 |
16 | import org.apache.commons.lang3.StringUtils;
17 |
18 | import java.io.UnsupportedEncodingException;
19 | import java.net.URLEncoder;
20 | import java.util.List;
21 |
22 | public class StockHandicapMoreActivity extends BaseActivity {
23 |
24 | ActivityStockHandicapMoreBinding binding;
25 | public static List list;
26 | public static String title;
27 | public static String code;
28 | public static String name;
29 |
30 | @Override
31 | protected void onCreate(Bundle savedInstanceState) {
32 | super.onCreate(savedInstanceState);
33 | binding = DataBindingUtil.setContentView(this, R.layout.activity_stock_handicap_more);
34 | binding.listView.setAdapter(new ArrayAdapter(this, android.R.layout.simple_list_item_1, list));
35 | binding.setTitle(title);
36 | binding.listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
37 | @Override
38 | public void onItemClick(AdapterView> parent, View view, int position, long id) {
39 | // https://zhidao.baidu.com/index/?word=粤港澳&uid=wapp_1481025931690_783&step=1
40 | if (StringUtils.equals(STOCK_HANDICAP_MORE_TITLE, title)) {
41 | openF10(position);
42 | } else {
43 | openSearchKeyword(position);
44 | }
45 |
46 |
47 | }
48 | });
49 | binding.btnClose.setOnClickListener(view -> {
50 | onBackPressed();
51 | });
52 | }
53 |
54 | private void openF10(int position) {
55 | String key = list.get(position);
56 | String url = StockF10.getInstance().getUrl(key, code);
57 | Intent intent = new Intent(BaseActivity.currentActivity, WebViewActivity.class);
58 | intent.putExtra(BaseActivity.WEB_VIEW_TITLE, name + " " + key);
59 | intent.putExtra(BaseActivity.WEB_VIEW_LOAD_URL, url);
60 | startActivity(intent);
61 | }
62 |
63 | private void openSearchKeyword(int position) {
64 | try {
65 | Intent intent = new Intent(BaseActivity.currentActivity, WebViewActivity.class);
66 | String keyWord = list.get(position);
67 | intent.putExtra(BaseActivity.WEB_VIEW_TITLE, keyWord + " 概念");
68 | keyWord = URLEncoder.encode(keyWord, "UTF-8");
69 | String url = "https://zhidao.baidu.com/index/?word=" + keyWord + "&uid=wapp_1481025931690_783&step=1";
70 | intent.putExtra(BaseActivity.WEB_VIEW_LOAD_URL, url);
71 | startActivity(intent);
72 | } catch (UnsupportedEncodingException e) {
73 | e.printStackTrace();
74 | }
75 | }
76 |
77 | @Override
78 | protected void init() {
79 | }
80 |
81 |
82 | @Override
83 | protected void registerListener() {
84 |
85 | }
86 |
87 | @Override
88 | protected void unRegisterListener() {
89 |
90 | }
91 |
92 | @Override
93 | public void onEventMainThread(MessageEvent event) {
94 |
95 | }
96 |
97 | }
98 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/utils/DeviceUtils.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.utils;
2 |
3 | import android.os.Build;
4 |
5 | import java.util.UUID;
6 |
7 | /**
8 | * @author : 陈欣健
9 | * @describe :
10 | * @since :2016-10-11 下午10:47
11 | **/
12 | public class DeviceUtils {
13 | /**
14 | * Return pseudo unique ID
15 | *
16 | * @return ID
17 | */
18 | public static String getUniquePsuedoID() {
19 | // If all else fails, if the user does have lower than API 9 (lower
20 | // than Gingerbread), has reset their device or 'Secure.ANDROID_ID'
21 | // returns 'null', then simply the ID returned will be solely based
22 | // off their Android device information. This is where the collisions
23 | // can happen.
24 | // Thanks http://www.pocketmagic.net/?p=1662!
25 | // Try not to use DISPLAY, HOST or ID - these items could change.
26 | // If there are collisions, there will be overlapping data
27 | String m_szDevIDShort = "35" + (Build.BOARD.length() % 10) + (Build.BRAND.length() % 10) + (Build.CPU_ABI.length() % 10) + (Build.DEVICE.length() % 10) + (Build.MANUFACTURER.length() % 10) + (Build.MODEL.length() % 10) + (Build.PRODUCT.length() % 10);
28 |
29 | // Thanks to @Roman SL!
30 | // http://stackoverflow.com/a/4789483/950427
31 | // Only devices with API >= 9 have android.os.Build.SERIAL
32 | // http://developer.android.com/reference/android/os/Build.html#SERIAL
33 | // If a user upgrades software or roots their device, there will be a duplicate entry
34 | String serial = null;
35 | try {
36 | serial = android.os.Build.class.getField("SERIAL").get(null).toString();
37 |
38 | // Go ahead and return the serial for api => 9
39 | return new UUID(m_szDevIDShort.hashCode(), serial.hashCode()).toString();
40 | } catch (Exception exception) {
41 | // String needs to be initialized
42 | serial = "serial"; // some value
43 | }
44 |
45 | // Thanks @Joe!
46 | // http://stackoverflow.com/a/2853253/950427
47 | // Finally, combine the values we have found by using the UUID class to create a unique identifier
48 | return new UUID(m_szDevIDShort.hashCode(), serial.hashCode()).toString();
49 | }
50 |
51 | /**
52 | * Return pseudo unique ID
53 | *
54 | * @return ID
55 | */
56 | public static String getUniqueID() {
57 | // If all else fails, if the user does have lower than API 9 (lower
58 | // than Gingerbread), has reset their device or 'Secure.ANDROID_ID'
59 | // returns 'null', then simply the ID returned will be solely based
60 | // off their Android device information. This is where the collisions
61 | // can happen.
62 | // Thanks http://www.pocketmagic.net/?p=1662!
63 | // Try not to use DISPLAY, HOST or ID - these items could change.
64 | // If there are collisions, there will be overlapping data
65 | String m_szDevIDShort = "35" + (Build.BOARD.length() % 10) + (Build.BRAND.length() % 10) + (Build.CPU_ABI.length() % 10) + (Build.DEVICE.length() % 10) + (Build.MANUFACTURER.length() % 10) + (Build.MODEL.length() % 10) + (Build.PRODUCT.length() % 10);
66 |
67 | // Thanks to @Roman SL!
68 | // http://stackoverflow.com/a/4789483/950427
69 | // Only devices with API >= 9 have android.os.Build.SERIAL
70 | // http://developer.android.com/reference/android/os/Build.html#SERIAL
71 | // If a user upgrades software or roots their device, there will be a duplicate entry
72 | return m_szDevIDShort;
73 | }
74 |
75 |
76 | }
77 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/utils/LoadingUtil.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.utils;
2 |
3 | import android.app.Activity;
4 | import android.view.View;
5 | import android.widget.TextView;
6 |
7 | import com.app.sinkinchan.smartstock.R;
8 | import com.romainpiel.shimmer.Shimmer;
9 | import com.romainpiel.shimmer.ShimmerTextView;
10 |
11 | /**
12 | * @author : 陈欣健
13 | * @describe :
14 | * @since :2016-09-10 下午6:37
15 | **/
16 | public class LoadingUtil {
17 | private Activity activity;
18 | private View view;
19 |
20 | public static LoadingUtil newInstance(View view) {
21 | return new LoadingUtil(view);
22 | }
23 |
24 | public static LoadingUtil newInstance(Activity activity) {
25 | return new LoadingUtil(activity);
26 | }
27 |
28 | private LoadingUtil(Activity activity) {
29 | this.activity = activity;
30 | initLoading(activity);
31 | }
32 |
33 | private LoadingUtil(View view) {
34 | this.view = view;
35 | initLoading(view);
36 | }
37 |
38 |
39 | Shimmer shimmer = null;
40 | ShimmerTextView shimmer_tv;
41 |
42 | protected void initLoading(View view) {
43 | shimmer = new Shimmer();
44 | shimmer_tv = (ShimmerTextView) view.findViewById(R.id.shimmer_tv);
45 | tv_reload = (TextView) view.findViewById(R.id.btn_reload);
46 | tv_none = (TextView) view.findViewById(R.id.tv_none);
47 | startShimmer();
48 | }
49 |
50 | protected void initLoading(Activity activity) {
51 | shimmer = new Shimmer();
52 | shimmer_tv = (ShimmerTextView) activity.findViewById(R.id.shimmer_tv);
53 | tv_reload = (TextView) activity.findViewById(R.id.btn_reload);
54 | tv_none = (TextView) activity.findViewById(R.id.tv_none);
55 | startShimmer();
56 | }
57 |
58 | private void startShimmer() {
59 | if (shimmer != null && shimmer_tv != null) {
60 | shimmer.start(shimmer_tv);
61 | }
62 | }
63 |
64 | public void showLoading() {
65 | hide();
66 | if (shimmer_tv != null && shimmer != null) {
67 | shimmer_tv.setVisibility(View.VISIBLE);
68 | shimmer.start(shimmer_tv);
69 | }
70 | }
71 |
72 | public void hideLoading() {
73 | if (shimmer != null && shimmer_tv != null) {
74 | if (shimmer_tv.getVisibility() == View.VISIBLE) {
75 | shimmer.cancel();
76 | shimmer_tv.setVisibility(View.GONE);
77 | }
78 | }
79 | }
80 |
81 | TextView tv_reload = null;
82 |
83 | public void showReload(View.OnClickListener clickListener) {
84 | hide();
85 | if (tv_reload != null) {
86 | tv_reload.setVisibility(View.VISIBLE);
87 | if (clickListener != null) {
88 | tv_reload.setOnClickListener(clickListener);
89 | }
90 | }
91 | }
92 |
93 | TextView tv_none = null;
94 |
95 | public void showNone() {
96 | hide();
97 | if (tv_none != null) {
98 | tv_none.setVisibility(View.VISIBLE);
99 | }
100 | }
101 |
102 | public void hideNone() {
103 | if (tv_none != null) {
104 | tv_none.setVisibility(View.GONE);
105 | }
106 | }
107 |
108 | public void hide() {
109 | hideLoading();
110 | hideReload();
111 | hideNone();
112 | }
113 |
114 | public void hideReload() {
115 | if (tv_reload != null && tv_reload.getVisibility() == View.VISIBLE) {
116 | tv_reload.setVisibility(View.GONE);
117 |
118 | }
119 | }
120 |
121 | }
122 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/adapters/ActiveStockAdapter.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.adapters;
2 |
3 | import android.content.Context;
4 | import android.databinding.DataBindingUtil;
5 | import android.databinding.ViewDataBinding;
6 | import android.support.v7.widget.RecyclerView;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 |
11 | import com.app.sinkinchan.smartstock.BR;
12 | import com.app.sinkinchan.smartstock.R;
13 | import com.app.sinkinchan.smartstock.adapters.base.BaseAdapter;
14 | import com.app.sinkinchan.smartstock.utils.StockUtil;
15 | import com.sinkinchan.stock.sdk.SourceManager;
16 | import com.sinkinchan.stock.sdk.bean.ActiveStocksPage;
17 |
18 |
19 | /**
20 | * @author : 陈欣健
21 | * @describe :
22 | * @since :2016-09-04 下午5:24
23 | **/
24 | public class ActiveStockAdapter extends RecyclerView.Adapter implements BaseAdapter {
25 | private ActiveStocksPage activeStocksPage;
26 | Context context;
27 | private boolean isLoading = false;
28 | private boolean isRefreshing = false;
29 |
30 | @Override
31 | public boolean isLoading() {
32 | return isLoading;
33 | }
34 |
35 | @Override
36 | public void setLoading(boolean loading) {
37 | this.isLoading = loading;
38 | }
39 |
40 | @Override
41 | public boolean isRefreshing() {
42 | return isRefreshing;
43 | }
44 |
45 | @Override
46 | public void setRefreshing(boolean refreshing) {
47 | this.isRefreshing = refreshing;
48 | }
49 |
50 | @Override
51 | public SourceManager.StockType getType() {
52 | return SourceManager.StockType.ActiveStock;
53 | }
54 |
55 | @Override
56 | public ActiveStocksPage getPage() {
57 | return activeStocksPage;
58 | }
59 |
60 | public ActiveStockAdapter(Context context, ActiveStocksPage activeStocksPage) {
61 | this.activeStocksPage = activeStocksPage;
62 | this.context = context;
63 | }
64 |
65 | public ActiveStocksPage getActiveStocksPage() {
66 | return activeStocksPage;
67 | }
68 |
69 | @Override
70 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
71 |
72 | ViewDataBinding binding = DataBindingUtil.inflate(
73 | LayoutInflater.from(parent.getContext()),
74 | R.layout.card_view_stock_item, parent, false);
75 | binding.setVariable(BR.stockUtil, StockUtil.getInstance());
76 | ViewHolder holder = new ViewHolder(binding.getRoot());
77 | holder.setBinding(binding);
78 | return holder;
79 | }
80 |
81 |
82 | @Override
83 | public void onBindViewHolder(ViewHolder viewHolder, int position) {
84 |
85 | ActiveStocksPage.DataBean dataBean = activeStocksPage.getData().get(position);
86 | viewHolder.getBinding().setVariable(BR.activeStockData, dataBean);
87 | viewHolder.getBinding().executePendingBindings();
88 |
89 | }
90 |
91 | @Override
92 | public int getItemCount() {
93 | return activeStocksPage.getData().size();
94 | }
95 |
96 |
97 | public class ViewHolder extends RecyclerView.ViewHolder {
98 |
99 | private ViewDataBinding binding;
100 |
101 | public ViewHolder(View view) {
102 | super(view);
103 | }
104 |
105 | public ViewDataBinding getBinding() {
106 | return binding;
107 | }
108 |
109 | public void setBinding(ViewDataBinding binding) {
110 | this.binding = binding;
111 | }
112 |
113 | }
114 |
115 |
116 | }
117 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/utils/DateUtil.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.utils;
2 |
3 | import java.text.SimpleDateFormat;
4 | import java.util.Calendar;
5 | import java.util.Date;
6 |
7 | /**
8 | * @author : 陈欣健
9 | * @describe :
10 | * @since :2016-09-16 下午8:43
11 | **/
12 | public class DateUtil extends com.sinkinchan.stock.sdk.utils.DateUtil {
13 |
14 | /**
15 | *
16 | * 1 第一季度 2 第二季度 3 第三季度 4 第四季度
17 | *
18 | * @return
19 | */
20 | public static int getSeason() {
21 |
22 | int season = 0;
23 |
24 | Calendar c = Calendar.getInstance();
25 | c.setTime(getCurDate());
26 | int month = c.get(Calendar.MONTH);
27 | switch (month) {
28 | case Calendar.JANUARY:
29 | case Calendar.FEBRUARY:
30 | case Calendar.MARCH:
31 | season = 1;
32 | break;
33 | case Calendar.APRIL:
34 | case Calendar.MAY:
35 | case Calendar.JUNE:
36 | season = 2;
37 | break;
38 | case Calendar.JULY:
39 | case Calendar.AUGUST:
40 | case Calendar.SEPTEMBER:
41 | season = 3;
42 | break;
43 | case Calendar.OCTOBER:
44 | case Calendar.NOVEMBER:
45 | case Calendar.DECEMBER:
46 | season = 4;
47 | break;
48 | default:
49 | break;
50 | }
51 | return season;
52 | }
53 | private static final String Time_0930 = " 09:30:00";
54 | private static final String Time_2359 = " 23:59:59";
55 |
56 | public static String getDeleteExpiredTime() throws Exception {
57 | Date now = getCurDate(DEFAULT_DATETIME_FORMAT_SEC2);
58 | String today = toString(new Date(), DEFAULT_DATE_FORMAT);
59 | String today_0930 = today + Time_0930;
60 | Date date_0903 = parseDate(today_0930, DEFAULT_DATETIME_FORMAT_SEC2);
61 | Date date_2359 = parseDate(today + Time_2359, DEFAULT_DATETIME_FORMAT_SEC2);
62 | if (date_2359.getTime() > now.getTime() && now.getTime() < date_0903.getTime()) {
63 | LogUtil.d("现在的时间在在23:59到09:30之间");
64 | //判断现在的时间在23:59到09:30的话,过期时间就是当天的9.30
65 | return today_0930;
66 | } else {
67 | LogUtil.d("现在的时间在在09:30到23:59之间");
68 | //判断现在的时间在09:30到23:59之间的话,过期时间就是明天的9.30
69 | return getTomorrow() + Time_0930;
70 | }
71 | }
72 |
73 | public static String getTomorrow() throws Exception {
74 | //获取当前日期
75 | Date date = new Date();
76 | SimpleDateFormat sf = new SimpleDateFormat(DEFAULT_DATE_FORMAT);
77 | String nowDate = sf.format(date);
78 | System.out.println(nowDate);
79 | //通过日历获取下一天日期
80 | Calendar cal = Calendar.getInstance();
81 | cal.setTime(sf.parse(nowDate));
82 | cal.add(Calendar.DAY_OF_YEAR, +1);
83 | String nextDate_1 = sf.format(cal.getTime());
84 | return nextDate_1;
85 | }
86 |
87 | /**
88 | * 获取下月
89 | *
90 | * @return
91 | * @throws Exception
92 | */
93 | public static Date getNextMonth() throws Exception {
94 | //获取当前日期
95 | Date date = new Date();
96 | SimpleDateFormat sf = new SimpleDateFormat(DEFAULT_DATE_FORMAT);
97 | String nowDate = sf.format(date);
98 | System.out.println(nowDate);
99 | //通过日历获取下一天日期
100 | Calendar cal = Calendar.getInstance();
101 | cal.setTime(sf.parse(nowDate));
102 | cal.add(Calendar.DAY_OF_YEAR, +1);
103 | return cal.getTime();
104 | }
105 |
106 | }
107 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/adapters/ResearchStockAdapter.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.adapters;
2 |
3 | import android.content.Context;
4 | import android.databinding.DataBindingUtil;
5 | import android.databinding.ViewDataBinding;
6 | import android.support.v7.widget.RecyclerView;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 |
11 | import com.app.sinkinchan.smartstock.BR;
12 | import com.app.sinkinchan.smartstock.R;
13 | import com.app.sinkinchan.smartstock.adapters.base.BaseAdapter;
14 | import com.app.sinkinchan.smartstock.utils.StockUtil;
15 | import com.sinkinchan.stock.sdk.SourceManager;
16 | import com.sinkinchan.stock.sdk.bean.ResearchStockPage;
17 |
18 |
19 | /**
20 | * @author : 陈欣健
21 | * @describe :
22 | * @since :2016-09-04 下午5:24
23 | **/
24 | public class ResearchStockAdapter extends RecyclerView.Adapter implements BaseAdapter {
25 | private ResearchStockPage researchStockPage;
26 | Context context;
27 | public boolean isLoading;
28 | public boolean isRefreshing;
29 |
30 | @Override
31 | public boolean isLoading() {
32 | return isLoading;
33 | }
34 |
35 | @Override
36 | public void setLoading(boolean loading) {
37 | this.isLoading = loading;
38 | }
39 |
40 | @Override
41 | public boolean isRefreshing() {
42 | return isRefreshing;
43 | }
44 |
45 | @Override
46 | public SourceManager.StockType getType() {
47 | return SourceManager.StockType.ResearchStock;
48 | }
49 |
50 | @Override
51 | public void setRefreshing(boolean refreshing) {
52 | this.isRefreshing = refreshing;
53 | }
54 |
55 | @Override
56 | public ResearchStockPage getPage() {
57 | return researchStockPage;
58 | }
59 |
60 | public ResearchStockAdapter(Context context, ResearchStockPage researchStockPage) {
61 | this.researchStockPage = researchStockPage;
62 | this.context = context;
63 | }
64 |
65 | public ResearchStockPage getResearchStockPage() {
66 | return researchStockPage;
67 | }
68 |
69 | @Override
70 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
71 | ViewDataBinding binding = DataBindingUtil.inflate(
72 | LayoutInflater.from(parent.getContext()),
73 | R.layout.card_view_research_stock_item, parent, false);
74 | binding.setVariable(BR.stockUtil, StockUtil.getInstance());
75 | ResearchStockAdapter.ViewHolder holder = new ResearchStockAdapter.ViewHolder(binding.getRoot());
76 | holder.setBinding(binding);
77 | return holder;
78 | }
79 |
80 |
81 |
82 | @Override
83 | public void onBindViewHolder(ViewHolder viewHolder, int position) {
84 | ResearchStockPage.DataBean dataBean = researchStockPage.getData().get(position);
85 | viewHolder.getBinding().setVariable(BR.researchStock, dataBean);
86 | viewHolder.getBinding().executePendingBindings();
87 |
88 |
89 | }
90 |
91 | @Override
92 | public int getItemCount() {
93 | return researchStockPage.getData().size();
94 | }
95 |
96 | public class ViewHolder extends RecyclerView.ViewHolder {
97 | private ViewDataBinding binding;
98 |
99 | public ViewDataBinding getBinding() {
100 | return binding;
101 | }
102 |
103 | public ResearchStockAdapter.ViewHolder setBinding(ViewDataBinding binding) {
104 | this.binding = binding;
105 | return this;
106 | }
107 |
108 | public ViewHolder(View view) {
109 | super(view);
110 | }
111 | }
112 |
113 |
114 | }
115 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/adapters/DeathSquadStockAdapter.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.adapters;
2 |
3 | import android.content.Context;
4 | import android.databinding.DataBindingUtil;
5 | import android.databinding.ViewDataBinding;
6 | import android.support.v7.widget.RecyclerView;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 |
11 | import com.app.sinkinchan.smartstock.BR;
12 | import com.app.sinkinchan.smartstock.R;
13 | import com.app.sinkinchan.smartstock.adapters.base.BaseAdapter;
14 | import com.app.sinkinchan.smartstock.utils.StockUtil;
15 | import com.sinkinchan.stock.sdk.SourceManager;
16 | import com.sinkinchan.stock.sdk.bean.DeathSquadStockPage;
17 |
18 |
19 | /**
20 | * @author : 陈欣健
21 | * @describe :
22 | * @since :2016-09-04 下午5:24
23 | **/
24 | public class DeathSquadStockAdapter extends RecyclerView.Adapter implements BaseAdapter {
25 | private DeathSquadStockPage deathSquadStockPage;
26 | Context context;
27 | public boolean isLoading;
28 | public boolean isRefreshing;
29 |
30 | @Override
31 | public boolean isLoading() {
32 | return isLoading;
33 | }
34 |
35 | @Override
36 | public void setLoading(boolean loading) {
37 | this.isLoading = loading;
38 | }
39 |
40 | @Override
41 | public boolean isRefreshing() {
42 | return isRefreshing;
43 | }
44 |
45 | @Override
46 | public SourceManager.StockType getType() {
47 | return SourceManager.StockType.DeathSquadStock;
48 | }
49 |
50 | @Override
51 | public void setRefreshing(boolean refreshing) {
52 | this.isRefreshing = refreshing;
53 | }
54 |
55 | @Override
56 | public DeathSquadStockPage getPage() {
57 | return deathSquadStockPage;
58 | }
59 |
60 | public DeathSquadStockAdapter(Context context, DeathSquadStockPage deathSquadStockPage) {
61 | this.deathSquadStockPage = deathSquadStockPage;
62 | this.context = context;
63 | }
64 |
65 | public DeathSquadStockPage getDeathSquadStockPage() {
66 | return deathSquadStockPage;
67 | }
68 |
69 | @Override
70 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
71 |
72 | ViewDataBinding binding = DataBindingUtil.inflate(
73 | LayoutInflater.from(parent.getContext()),
74 | R.layout.death_squad_stock_item, parent, false);
75 | binding.setVariable(BR.stockUtil, StockUtil.getInstance());
76 | DeathSquadStockAdapter.ViewHolder holder = new DeathSquadStockAdapter.ViewHolder(binding.getRoot());
77 | holder.setBinding(binding);
78 | return holder;
79 | }
80 |
81 |
82 | String msg = "";
83 |
84 | @Override
85 | public void onBindViewHolder(ViewHolder viewHolder, int position) {
86 | DeathSquadStockPage.DataBean dataBean = deathSquadStockPage.getData().get(position);
87 | viewHolder.getBinding().setVariable(BR.deathStock, dataBean);
88 | viewHolder.getBinding().executePendingBindings();
89 | }
90 |
91 | @Override
92 | public int getItemCount() {
93 | return deathSquadStockPage.getData().size();
94 | }
95 |
96 |
97 | public class ViewHolder extends RecyclerView.ViewHolder {
98 | private ViewDataBinding binding;
99 |
100 | public ViewDataBinding getBinding() {
101 | return binding;
102 | }
103 |
104 | public DeathSquadStockAdapter.ViewHolder setBinding(ViewDataBinding binding) {
105 | this.binding = binding;
106 | return this;
107 | }
108 |
109 | public ViewHolder(View view) {
110 | super(view);
111 | }
112 | }
113 |
114 |
115 | }
116 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/utils/LogUtil.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.utils;
2 |
3 | import android.text.TextUtils;
4 | import android.util.Log;
5 |
6 | import com.app.sinkinchan.smartstock.app.App;
7 |
8 | /**
9 | * @author : 陈欣健
10 | * @describe :
11 | * @since :2016-09-05 下午8:13
12 | **/
13 | public class LogUtil {
14 |
15 | public static String customTagPrefix = "STOCK_LOG";
16 |
17 | private LogUtil() {
18 | }
19 |
20 | private static String generateTag() {
21 | StackTraceElement caller = new Throwable().getStackTrace()[2];
22 | String tag = "%s.%s(L:%d)";
23 | String callerClazzName = caller.getClassName();
24 | callerClazzName = callerClazzName.substring(callerClazzName.lastIndexOf(".") + 1);
25 | tag = String.format(tag, callerClazzName, caller.getMethodName(), caller.getLineNumber());
26 | tag = TextUtils.isEmpty(customTagPrefix) ? tag : customTagPrefix + ":" + tag;
27 | return tag;
28 | }
29 |
30 | public static void d(String content) {
31 | if (!App.getInstance().isDebug()) return;
32 | String tag = generateTag();
33 |
34 | Log.d(tag, content);
35 | }
36 |
37 | public static void d(String content, Throwable tr) {
38 | if (!App.getInstance().isDebug()) return;
39 | String tag = generateTag();
40 |
41 | Log.d(tag, content, tr);
42 | }
43 |
44 | public static void e(String content) {
45 | if (!App.getInstance().isDebug()) return;
46 | String tag = generateTag();
47 |
48 | Log.e(tag, content);
49 | }
50 |
51 | public static void e(String content, Throwable tr) {
52 | if (!App.getInstance().isDebug()) return;
53 | String tag = generateTag();
54 |
55 | Log.e(tag, content, tr);
56 | }
57 |
58 | public static void i(String content) {
59 | if (!App.getInstance().isDebug()) return;
60 | String tag = generateTag();
61 |
62 | Log.i(tag, content);
63 | }
64 |
65 | public static void i(String content, Throwable tr) {
66 | if (!App.getInstance().isDebug()) return;
67 | String tag = generateTag();
68 |
69 | Log.i(tag, content, tr);
70 | }
71 |
72 | public static void v(String content) {
73 | if (!App.getInstance().isDebug()) return;
74 | String tag = generateTag();
75 |
76 | Log.v(tag, content);
77 | }
78 |
79 | public static void v(String content, Throwable tr) {
80 | if (!App.getInstance().isDebug()) return;
81 | String tag = generateTag();
82 |
83 | Log.v(tag, content, tr);
84 | }
85 |
86 | public static void w(String content) {
87 | if (!App.getInstance().isDebug()) return;
88 | String tag = generateTag();
89 |
90 | Log.w(tag, content);
91 | }
92 |
93 | public static void w(String content, Throwable tr) {
94 | if (!App.getInstance().isDebug()) return;
95 | String tag = generateTag();
96 |
97 | Log.w(tag, content, tr);
98 | }
99 |
100 | public static void w(Throwable tr) {
101 | if (!App.getInstance().isDebug()) return;
102 | String tag = generateTag();
103 |
104 | Log.w(tag, tr);
105 | }
106 |
107 |
108 | public static void wtf(String content) {
109 | if (!App.getInstance().isDebug()) return;
110 | String tag = generateTag();
111 |
112 | Log.wtf(tag, content);
113 | }
114 |
115 | public static void wtf(String content, Throwable tr) {
116 | if (!App.getInstance().isDebug()) return;
117 | String tag = generateTag();
118 |
119 | Log.wtf(tag, content, tr);
120 | }
121 |
122 | public static void wtf(Throwable tr) {
123 | if (!App.getInstance().isDebug()) return;
124 | String tag = generateTag();
125 |
126 | Log.wtf(tag, tr);
127 | }
128 |
129 | }
130 |
131 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/activitys/FeedbackActivity.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.activitys;
2 |
3 | import android.databinding.DataBindingUtil;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AlertDialog;
6 |
7 | import com.app.sinkinchan.smartstock.R;
8 | import com.app.sinkinchan.smartstock.activitys.base.BaseActivity;
9 | import com.app.sinkinchan.smartstock.databinding.ActivityFeedbackBinding;
10 | import com.app.sinkinchan.smartstock.utils.ToastUtil;
11 | import com.app.sinkinchan.smartstock.utils.UserUtil;
12 | import com.baidu.mobstat.StatService;
13 |
14 | import org.apache.commons.lang3.StringUtils;
15 |
16 | /**
17 | * @author : 陈欣健
18 | * @describe :
19 | * @since :2016-12-29 下午4:19
20 | **/
21 | public class FeedbackActivity extends BaseActivity {
22 | ActivityFeedbackBinding binding;
23 |
24 | @Override
25 | protected void onCreate(Bundle savedInstanceState) {
26 | super.onCreate(savedInstanceState);
27 | binding = DataBindingUtil.setContentView(this, R.layout.activity_feedback);
28 | init();
29 |
30 | }
31 |
32 | @Override
33 | protected void init() {
34 | setBackMenu();
35 | setTitle("用户反馈");
36 | binding.btnSend.setOnClickListener(view -> {
37 | String email = binding.edEmail.getText().toString();
38 | String message = binding.edMessage.getText().toString();
39 | if (StringUtils.isBlank(email) || StringUtils.isBlank(message)) {
40 | ToastUtil.showLongToast(getApplicationContext(), "邮箱或者内容不能为空.");
41 | return;
42 | }
43 | if (!UserUtil.isEmail(email)) {
44 | ToastUtil.showLongToast(getApplicationContext(), "请输入合法的邮箱");
45 | return;
46 | }
47 | StatService.onEvent(this, "user_feedback", "反馈邮箱: " + email + " 反馈内容:" + message, 1);
48 | new AlertDialog.Builder(FeedbackActivity.this)
49 | .setTitle("提醒")
50 | .setMessage("提交成功!作者会根据你的邮箱对你进行回复的.")
51 | .setPositiveButton("确定", (dialog, index) -> {
52 | dialog.dismiss();
53 | })
54 | .show();
55 |
56 |
57 | });
58 |
59 | }
60 |
61 | public void sendMail(String fromMail, String user, String password,
62 | String toMail,
63 | String mailTitle,
64 | String mailContent) throws Exception {
65 | /*Properties props = new Properties(); //可以加载一个配置文件
66 | // 使用smtp:简单邮件传输协议
67 | props.put("mail.smtp.host", "smtp.163.com");//存储发送邮件服务器的信息
68 | props.put("mail.smtp.auth", "true");//同时通过验证
69 |
70 | Session session = Session.getInstance(props);//根据属性新建一个邮件会话
71 | // session.setDebug(true); //有他会打印一些调试信息。
72 |
73 | MimeMessage message = new MimeMessage(session);//由邮件会话新建一个消息对象
74 | message.setFrom(new InternetAddress(fromMail));//设置发件人的地址
75 | message.setRecipient(Message.RecipientType.TO, new InternetAddress(toMail));//设置收件人,并设置其接收类型为TO
76 | message.setSubject(mailTitle);//设置标题
77 | //设置信件内容
78 | // message.setText(mailContent); //发送 纯文本 邮件 todo
79 | message.setContent(mailContent, "text/html;charset=gbk"); //发送HTML邮件,内容样式比较丰富
80 | message.setSentDate(new Date());//设置发信时间
81 | message.saveChanges();//存储邮件信息
82 |
83 | //发送邮件
84 | // Transport transport = session.getTransport("smtp");
85 | Transport transport = session.getTransport();
86 | transport.connect(user, password);
87 | transport.sendMessage(message, message.getAllRecipients());//发送邮件,其中第二个参数是所有已设好的收件人地址
88 | transport.close();*/
89 |
90 | }
91 |
92 | @Override
93 | protected void registerListener() {
94 |
95 | }
96 |
97 | @Override
98 | protected void unRegisterListener() {
99 |
100 | }
101 |
102 | }
103 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/adapters/QuotaType3StockAdapter.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.adapters;
2 |
3 | import android.content.Context;
4 | import android.databinding.DataBindingUtil;
5 | import android.databinding.ViewDataBinding;
6 | import android.support.v7.widget.RecyclerView;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 |
11 | import com.app.sinkinchan.smartstock.BR;
12 | import com.app.sinkinchan.smartstock.R;
13 | import com.app.sinkinchan.smartstock.adapters.base.BaseAdapter;
14 | import com.app.sinkinchan.smartstock.utils.StockUtil;
15 | import com.sinkinchan.stock.sdk.SourceManager;
16 | import com.sinkinchan.stock.sdk.bean.QuotaStockPage;
17 |
18 |
19 | /**
20 | * @author : 陈欣健
21 | * @describe :
22 | * @since :2016-09-04 下午5:24
23 | **/
24 | public class QuotaType3StockAdapter extends RecyclerView.Adapter implements BaseAdapter {
25 | // private QuotaStockPage quotaStockPage;
26 | private QuotaStockPage.QuotaStockType3 quotaStockType3;
27 | Context context;
28 | public boolean isLoading;
29 | public boolean isRefreshing;
30 |
31 | @Override
32 | public boolean isLoading() {
33 | return isLoading;
34 | }
35 |
36 | @Override
37 | public void setLoading(boolean loading) {
38 | this.isLoading = loading;
39 | }
40 |
41 | @Override
42 | public boolean isRefreshing() {
43 | return isRefreshing;
44 | }
45 |
46 | @Override
47 | public SourceManager.StockType getType() {
48 | return SourceManager.StockType.QuotaStockType3;
49 | }
50 |
51 | @Override
52 | public void setRefreshing(boolean refreshing) {
53 | this.isRefreshing = refreshing;
54 | }
55 |
56 | @Override
57 | public QuotaStockPage.QuotaStockType3 getPage() {
58 | return quotaStockType3;
59 | }
60 |
61 | public QuotaType3StockAdapter(Context context, QuotaStockPage.QuotaStockType3 quotaStockType3) {
62 | this.quotaStockType3 = quotaStockType3;
63 | this.context = context;
64 | }
65 |
66 | public QuotaStockPage.QuotaStockType3 getQuotaStockType3() {
67 | return quotaStockType3;
68 | }
69 |
70 | public QuotaType3StockAdapter setQuotaStockType3(QuotaStockPage.QuotaStockType3 quotaStockType3) {
71 | this.quotaStockType3 = quotaStockType3;
72 | return this;
73 | }
74 |
75 | @Override
76 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
77 | ViewDataBinding binding = DataBindingUtil.inflate(
78 | LayoutInflater.from(parent.getContext()),
79 | R.layout.quota_type3_item, parent, false);
80 | binding.setVariable(BR.stockUtil, StockUtil.getInstance());
81 | QuotaType3StockAdapter.ViewHolder holder = new QuotaType3StockAdapter.ViewHolder(binding.getRoot());
82 | holder.setBinding(binding);
83 | return holder;
84 | }
85 |
86 |
87 | @Override
88 | public void onBindViewHolder(ViewHolder viewHolder, int position) {
89 | QuotaStockPage.QuotaStockType3.DataBean dataBean = quotaStockType3.getData().get(position);
90 | viewHolder.getBinding().setVariable(BR.quotaType3, dataBean);
91 | viewHolder.getBinding().executePendingBindings();
92 | }
93 |
94 | @Override
95 | public int getItemCount() {
96 | return quotaStockType3.getData().size();
97 | }
98 |
99 |
100 | public class ViewHolder extends RecyclerView.ViewHolder {
101 | private ViewDataBinding binding;
102 |
103 | public ViewDataBinding getBinding() {
104 | return binding;
105 | }
106 |
107 | public QuotaType3StockAdapter.ViewHolder setBinding(ViewDataBinding binding) {
108 | this.binding = binding;
109 | return this;
110 | }
111 |
112 | public ViewHolder(View view) {
113 | super(view);
114 | }
115 | }
116 |
117 |
118 | }
119 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/adapters/QuotaType1StockAdapter.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.adapters;
2 |
3 | import android.content.Context;
4 | import android.databinding.DataBindingUtil;
5 | import android.databinding.ViewDataBinding;
6 | import android.support.v7.widget.RecyclerView;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 |
11 | import com.app.sinkinchan.smartstock.BR;
12 | import com.app.sinkinchan.smartstock.R;
13 | import com.app.sinkinchan.smartstock.adapters.base.BaseAdapter;
14 | import com.app.sinkinchan.smartstock.utils.StockUtil;
15 | import com.sinkinchan.stock.sdk.SourceManager;
16 | import com.sinkinchan.stock.sdk.bean.QuotaStockPage;
17 |
18 |
19 | /**
20 | * @author : 陈欣健
21 | * @describe :
22 | * @since :2016-09-04 下午5:24
23 | **/
24 | public class QuotaType1StockAdapter extends RecyclerView.Adapter implements BaseAdapter {
25 | // private QuotaStockPage quotaStockPage;
26 | private QuotaStockPage.QuotaStockType1 quotaStockType1;
27 | Context context;
28 | public boolean isLoading;
29 | public boolean isRefreshing;
30 |
31 | @Override
32 | public boolean isLoading() {
33 | return isLoading;
34 | }
35 |
36 | @Override
37 | public void setLoading(boolean loading) {
38 | this.isLoading = loading;
39 | }
40 |
41 | @Override
42 | public boolean isRefreshing() {
43 | return isRefreshing;
44 | }
45 |
46 | @Override
47 | public SourceManager.StockType getType() {
48 | return SourceManager.StockType.QuotaStockType1;
49 | }
50 |
51 | @Override
52 | public void setRefreshing(boolean refreshing) {
53 | this.isRefreshing = refreshing;
54 | }
55 |
56 | @Override
57 | public QuotaStockPage.QuotaStockType1 getPage() {
58 | return quotaStockType1;
59 | }
60 |
61 | public QuotaType1StockAdapter(Context context, QuotaStockPage.QuotaStockType1 quotaStockType1) {
62 | this.quotaStockType1 = quotaStockType1;
63 | this.context = context;
64 | }
65 |
66 | public QuotaStockPage.QuotaStockType1 getQuotaStockType1() {
67 | return quotaStockType1;
68 | }
69 |
70 | public QuotaType1StockAdapter setQuotaStockType1(QuotaStockPage.QuotaStockType1 quotaStockType1) {
71 | this.quotaStockType1 = quotaStockType1;
72 | return this;
73 | }
74 |
75 | @Override
76 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
77 | ViewDataBinding binding = DataBindingUtil.inflate(
78 | LayoutInflater.from(parent.getContext()),
79 | R.layout.quota_type1_item, parent, false);
80 | binding.setVariable(BR.stockUtil, StockUtil.getInstance());
81 | QuotaType1StockAdapter.ViewHolder holder = new QuotaType1StockAdapter.ViewHolder(binding.getRoot());
82 | holder.setBinding(binding);
83 | return holder;
84 | }
85 |
86 |
87 |
88 | @Override
89 | public void onBindViewHolder(ViewHolder viewHolder, int position) {
90 | QuotaStockPage.QuotaStockType1.DataBean dataBean = quotaStockType1.getData().get(position);
91 | viewHolder.getBinding().setVariable(BR.quotaType1, dataBean);
92 | viewHolder.getBinding().executePendingBindings();
93 |
94 |
95 | }
96 |
97 | @Override
98 | public int getItemCount() {
99 | return quotaStockType1.getData().size();
100 | }
101 |
102 |
103 | public class ViewHolder extends RecyclerView.ViewHolder {
104 |
105 | private ViewDataBinding binding;
106 |
107 | public ViewDataBinding getBinding() {
108 | return binding;
109 | }
110 |
111 | public ViewHolder setBinding(ViewDataBinding binding) {
112 | this.binding = binding;
113 | return this;
114 | }
115 |
116 | public ViewHolder(View view) {
117 | super(view);
118 | }
119 | }
120 |
121 |
122 | }
123 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/adapters/QuotaType2StockAdapter.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.adapters;
2 |
3 | import android.content.Context;
4 | import android.databinding.DataBindingUtil;
5 | import android.databinding.ViewDataBinding;
6 | import android.support.v7.widget.RecyclerView;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 |
11 | import com.app.sinkinchan.smartstock.BR;
12 | import com.app.sinkinchan.smartstock.R;
13 | import com.app.sinkinchan.smartstock.adapters.base.BaseAdapter;
14 | import com.app.sinkinchan.smartstock.utils.StockUtil;
15 | import com.sinkinchan.stock.sdk.SourceManager;
16 | import com.sinkinchan.stock.sdk.bean.QuotaStockPage;
17 |
18 |
19 | /**
20 | * @author : 陈欣健
21 | * @describe :
22 | * @since :2016-09-04 下午5:24
23 | **/
24 | public class QuotaType2StockAdapter extends RecyclerView.Adapter implements BaseAdapter {
25 | // private QuotaStockPage quotaStockPage;
26 | private QuotaStockPage.QuotaStockType2 quotaStockType2;
27 | Context context;
28 | public boolean isLoading;
29 | public boolean isRefreshing;
30 |
31 | @Override
32 | public boolean isLoading() {
33 | return isLoading;
34 | }
35 |
36 | @Override
37 | public void setLoading(boolean loading) {
38 | this.isLoading = loading;
39 | }
40 |
41 | @Override
42 | public boolean isRefreshing() {
43 | return isRefreshing;
44 | }
45 |
46 | @Override
47 | public SourceManager.StockType getType() {
48 | return SourceManager.StockType.QuotaStockType2;
49 | }
50 |
51 | @Override
52 | public void setRefreshing(boolean refreshing) {
53 | this.isRefreshing = refreshing;
54 | }
55 |
56 | @Override
57 | public QuotaStockPage.QuotaStockType2 getPage() {
58 | return quotaStockType2;
59 | }
60 |
61 | public QuotaType2StockAdapter(Context context, QuotaStockPage.QuotaStockType2 quotaStockType2) {
62 | this.quotaStockType2 = quotaStockType2;
63 | this.context = context;
64 | }
65 |
66 | public QuotaStockPage.QuotaStockType2 getQuotaStockType2() {
67 | return quotaStockType2;
68 | }
69 |
70 | public QuotaType2StockAdapter setQuotaStockType2(QuotaStockPage.QuotaStockType2 quotaStockType2) {
71 | this.quotaStockType2 = quotaStockType2;
72 | return this;
73 | }
74 |
75 | @Override
76 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
77 | ViewDataBinding binding = DataBindingUtil.inflate(
78 | LayoutInflater.from(parent.getContext()),
79 | R.layout.quota_type2_item, parent, false);
80 | binding.setVariable(BR.stockUtil, StockUtil.getInstance());
81 | QuotaType2StockAdapter.ViewHolder holder = new QuotaType2StockAdapter.ViewHolder(binding.getRoot());
82 | holder.setBinding(binding);
83 | return holder;
84 | }
85 |
86 |
87 | @Override
88 | public void onBindViewHolder(ViewHolder viewHolder, int position) {
89 | QuotaStockPage.QuotaStockType2.DataBean dataBean = quotaStockType2.getData().get(position);
90 | viewHolder.getBinding().setVariable(BR.quotaType2, dataBean);
91 | viewHolder.getBinding().executePendingBindings();
92 |
93 | }
94 |
95 | @Override
96 | public int getItemCount() {
97 | return quotaStockType2.getData().size();
98 | }
99 |
100 |
101 | public class ViewHolder extends RecyclerView.ViewHolder {
102 | private ViewDataBinding binding;
103 |
104 | public ViewDataBinding getBinding() {
105 | return binding;
106 | }
107 |
108 | public QuotaType2StockAdapter.ViewHolder setBinding(ViewDataBinding binding) {
109 | this.binding = binding;
110 | return this;
111 | }
112 |
113 | public ViewHolder(View view) {
114 | super(view);
115 | }
116 | }
117 |
118 |
119 | }
120 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/adapters/QuotaType4StockAdapter.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.adapters;
2 |
3 | import android.content.Context;
4 | import android.databinding.DataBindingUtil;
5 | import android.databinding.ViewDataBinding;
6 | import android.support.v7.widget.RecyclerView;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 |
11 | import com.app.sinkinchan.smartstock.BR;
12 | import com.app.sinkinchan.smartstock.R;
13 | import com.app.sinkinchan.smartstock.adapters.base.BaseAdapter;
14 | import com.app.sinkinchan.smartstock.utils.StockUtil;
15 | import com.sinkinchan.stock.sdk.SourceManager;
16 | import com.sinkinchan.stock.sdk.bean.QuotaStockPage;
17 |
18 |
19 | /**
20 | * @author : 陈欣健
21 | * @describe :
22 | * @since :2016-09-04 下午5:24
23 | **/
24 | public class QuotaType4StockAdapter extends RecyclerView.Adapter implements BaseAdapter {
25 | // private QuotaStockPage quotaStockPage;
26 | private QuotaStockPage.QuotaStockType4 quotaStockType4;
27 | Context context;
28 | public boolean isLoading;
29 | public boolean isRefreshing;
30 |
31 | @Override
32 | public boolean isLoading() {
33 | return isLoading;
34 | }
35 |
36 | @Override
37 | public void setLoading(boolean loading) {
38 | this.isLoading = loading;
39 | }
40 |
41 | @Override
42 | public boolean isRefreshing() {
43 | return isRefreshing;
44 | }
45 |
46 | @Override
47 | public SourceManager.StockType getType() {
48 | return SourceManager.StockType.QuotaStockType4;
49 | }
50 |
51 | @Override
52 | public void setRefreshing(boolean refreshing) {
53 | this.isRefreshing = refreshing;
54 | }
55 |
56 | @Override
57 | public QuotaStockPage.QuotaStockType4 getPage() {
58 | return quotaStockType4;
59 | }
60 |
61 | public QuotaType4StockAdapter(Context context, QuotaStockPage.QuotaStockType4 quotaStockType4) {
62 | this.quotaStockType4 = quotaStockType4;
63 | this.context = context;
64 | }
65 |
66 | public QuotaStockPage.QuotaStockType4 getQuotaStockType4() {
67 | return quotaStockType4;
68 | }
69 |
70 | public QuotaType4StockAdapter setQuotaStockType4(QuotaStockPage.QuotaStockType4 quotaStockType4) {
71 | this.quotaStockType4 = quotaStockType4;
72 | return this;
73 | }
74 |
75 | @Override
76 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
77 | ViewDataBinding binding = DataBindingUtil.inflate(
78 | LayoutInflater.from(parent.getContext()),
79 | R.layout.quota_type4_item, parent, false);
80 | binding.setVariable(BR.stockUtil, StockUtil.getInstance());
81 | QuotaType4StockAdapter.ViewHolder holder = new QuotaType4StockAdapter.ViewHolder(binding.getRoot());
82 | holder.setBinding(binding);
83 | return holder;
84 | }
85 |
86 |
87 |
88 | @Override
89 | public void onBindViewHolder(ViewHolder viewHolder, int position) {
90 | QuotaStockPage.QuotaStockType4.DataBean dataBean = quotaStockType4.getData().get(position);
91 | viewHolder.getBinding().setVariable(BR.quotaType4, dataBean);
92 | viewHolder.getBinding().executePendingBindings();
93 |
94 | }
95 |
96 | @Override
97 | public int getItemCount() {
98 | return quotaStockType4.getData().size();
99 | }
100 |
101 |
102 | public class ViewHolder extends RecyclerView.ViewHolder {
103 | private ViewDataBinding binding;
104 |
105 | public ViewDataBinding getBinding() {
106 | return binding;
107 | }
108 |
109 | public QuotaType4StockAdapter.ViewHolder setBinding(ViewDataBinding binding) {
110 | this.binding = binding;
111 | return this;
112 | }
113 |
114 | public ViewHolder(View view) {
115 | super(view);
116 | }
117 | }
118 |
119 |
120 | }
121 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/app_bar_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
15 |
23 |
24 |
29 |
30 |
36 |
37 |
38 |
45 |
46 |
57 |
58 |
69 |
70 |
71 |
72 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/app/src/main/java/com/app/sinkinchan/smartstock/utils/ResourceManager.java:
--------------------------------------------------------------------------------
1 | package com.app.sinkinchan.smartstock.utils;
2 |
3 | import android.content.Context;
4 | import android.content.res.Resources;
5 | import android.hardware.Sensor;
6 | import android.hardware.SensorManager;
7 | import android.view.GestureDetector;
8 | import android.view.MotionEvent;
9 | import android.view.View;
10 | import android.view.WindowManager;
11 | import android.widget.ListView;
12 |
13 | import com.app.sinkinchan.smartstock.app.App;
14 |
15 | import java.util.List;
16 |
17 | /**
18 | * 系统资源管理器
19 | *
20 | * @author : miaozh
21 | * @since : 2015/10/22 10:53
22 | */
23 | public class ResourceManager {
24 |
25 | public static Context getContext() {
26 | return App.getInstance();
27 | }
28 |
29 | /**
30 | * 获取appname
31 | *
32 | * @return
33 | */
34 | public static String getAppName() {
35 | return getContext().getApplicationInfo().loadLabel(getContext().getPackageManager()).toString();
36 | }
37 |
38 | private final static App app = App.getInstance();
39 |
40 | /**
41 | * 获取文本
42 | *
43 | * @param StringId
44 | * @return
45 | */
46 | public static String getString(final int StringId) {
47 | return app.getString(StringId);
48 | }
49 |
50 | /**
51 | * 获取资源
52 | *
53 | * @return
54 | */
55 | public static Resources getResources() {
56 | return app.getResources();
57 | }
58 |
59 | /**
60 | * 获得状态栏高度
61 | */
62 | public static int getStatusBarHeight() {
63 | int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
64 | return getResources().getDimensionPixelSize(resourceId);
65 | }
66 |
67 |
68 | public static View statusBarView = null;
69 |
70 | /**
71 | * 移除TapStatusBarToTop事件
72 | */
73 | public static void removeTapStatusBarToTop() {
74 | final WindowManager windowManager = (WindowManager) App.getInstance().getSystemService(Context.WINDOW_SERVICE);
75 | if (statusBarView != null) {
76 | windowManager.removeView(statusBarView);
77 | statusBarView = null;
78 | }
79 | }
80 |
81 | static GestureDetector gestureDetector = null;
82 |
83 | public static GestureDetector getGestureDetector(final ListView listView) {
84 | gestureDetector = new GestureDetector(App.getInstance(), new GestureDetector.SimpleOnGestureListener() {
85 |
86 | @Override
87 | public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
88 | LogUtil.d("" + velocityX);
89 | return super.onFling(e1, e2, velocityX, velocityY);
90 | }
91 |
92 | @Override
93 | public boolean onDoubleTap(MotionEvent e) {
94 | listView.setSelection(0);
95 | return super.onDoubleTap(e);
96 | }
97 |
98 | @Override
99 | public boolean onDoubleTapEvent(MotionEvent e) {
100 | listView.setSelection(0);
101 | return super.onDoubleTapEvent(e);
102 | }
103 | });
104 | return gestureDetector;
105 | }
106 |
107 | /**
108 | * 判断手机设备是否有陀螺仪
109 | *
110 | * @return
111 | */
112 | public static boolean hasGyroscope() {
113 | return hasSensor(Sensor.TYPE_GYROSCOPE);
114 | }
115 |
116 | /**
117 | * 判断是否有某传感器¬
118 | *
119 | * @param key
120 | * @return
121 | */
122 | private static boolean hasSensor(int key) {
123 | boolean flag = false;
124 | //从系统服务中获得传感器管理器
125 | SensorManager sm = (SensorManager) App.getInstance().getSystemService(Context.SENSOR_SERVICE);
126 | //从传感器管理器中获得全部的传感器列表
127 | List allSensors = sm.getSensorList(key);
128 | if (allSensors != null && allSensors.size() > 0) {
129 | flag = true;
130 | }
131 | return flag;
132 | }
133 | }
134 |
--------------------------------------------------------------------------------