├── .gitignore
├── LICENSE
├── README.md
├── app
├── .gitignore
├── app.iml
├── build.gradle
├── libs
│ └── joda-time-2.8.2.jar
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── me
│ │ └── silencedut
│ │ └── nbaplus
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java-gen
│ │ └── com
│ │ │ └── me
│ │ │ └── silencedut
│ │ │ └── greendao
│ │ │ ├── DBHelper.java
│ │ │ ├── DaoMaster.java
│ │ │ ├── DaoSession.java
│ │ │ ├── GreenNews.java
│ │ │ ├── GreenNewsDao.java
│ │ │ ├── GreenStat.java
│ │ │ └── GreenStatDao.java
│ ├── java
│ │ └── com
│ │ │ └── me
│ │ │ └── silencedut
│ │ │ └── nbaplus
│ │ │ ├── app
│ │ │ ├── App.java
│ │ │ └── AppService.java
│ │ │ ├── data
│ │ │ └── Constant.java
│ │ │ ├── event
│ │ │ ├── DrawerClickEvent.java
│ │ │ ├── Event.java
│ │ │ ├── GamesEvent.java
│ │ │ ├── NewsAnimatEndEvent.java
│ │ │ ├── NewsDetailEvent.java
│ │ │ ├── NewsEvent.java
│ │ │ ├── RhythmPositonEvent.java
│ │ │ ├── StatEvent.java
│ │ │ └── TeamSortEvent.java
│ │ │ ├── model
│ │ │ ├── Games.java
│ │ │ ├── News.java
│ │ │ ├── NewsDetile.java
│ │ │ ├── Statistics.java
│ │ │ └── Teams.java
│ │ │ ├── network
│ │ │ ├── NbaplusAPI.java
│ │ │ ├── NbaplusClient.java
│ │ │ ├── NbaplusFactory.java
│ │ │ └── NewsDetileAPI.java
│ │ │ ├── rxmethod
│ │ │ ├── RxGames.java
│ │ │ ├── RxNews.java
│ │ │ ├── RxStats.java
│ │ │ └── RxTeamSort.java
│ │ │ ├── ui
│ │ │ ├── activity
│ │ │ │ ├── AboutActivity.java
│ │ │ │ ├── BaseActivity.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ ├── NewsDetileActivity.java
│ │ │ │ ├── SettingsActivity.java
│ │ │ │ └── SwipeBackActivity.java
│ │ │ ├── adapter
│ │ │ │ ├── FragmentAdapter
│ │ │ │ │ ├── FragmentSortAdapter.java
│ │ │ │ │ └── StatPageAdapter.java
│ │ │ │ └── RecycleAdapter
│ │ │ │ │ ├── BlogAdapter.java
│ │ │ │ │ ├── DrawerAdapter.java
│ │ │ │ │ ├── GamesAdapter.java
│ │ │ │ │ ├── LoadAdapter.java
│ │ │ │ │ ├── MainAdapter.java
│ │ │ │ │ └── TeamSortAdapter.java
│ │ │ ├── fragment
│ │ │ │ ├── BlogFragment.java
│ │ │ │ ├── DrawerFragment.java
│ │ │ │ ├── GamesFragment.java
│ │ │ │ ├── MainFragment.java
│ │ │ │ ├── NewsFragment.java
│ │ │ │ ├── TeamSortFragment.java
│ │ │ │ ├── base
│ │ │ │ │ ├── BaseFragment.java
│ │ │ │ │ ├── SwipeRefreshBaseFragment.java
│ │ │ │ │ └── ToorbarBaseFragment.java
│ │ │ │ └── playersort
│ │ │ │ │ ├── BarFragment.java
│ │ │ │ │ └── StatisticsFragment.java
│ │ │ ├── listener
│ │ │ │ └── RecyclerViewLoadMoreListener.java
│ │ │ └── wigdets
│ │ │ │ ├── RevealBackgroundView.java
│ │ │ │ ├── RhythmAdapter.java
│ │ │ │ ├── RhythmLayout.java
│ │ │ │ └── SwipeBackLayout.java
│ │ │ └── utils
│ │ │ ├── AnimatorUtils.java
│ │ │ ├── AppUtils.java
│ │ │ ├── DataClearManager.java
│ │ │ ├── DateFormatter.java
│ │ │ ├── LollipopUtils.java
│ │ │ ├── NumericalUtil.java
│ │ │ ├── PreferenceUtils.java
│ │ │ ├── ShareUtils.java
│ │ │ └── blur
│ │ │ ├── BitmapUtils.java
│ │ │ └── Blur.java
│ └── res
│ │ ├── drawable
│ │ ├── bg_card.xml
│ │ ├── bg_gamestatus.xml
│ │ ├── bottom_shadow.9.png
│ │ ├── btn_default_light.xml
│ │ ├── drawer_icon_about.xml
│ │ ├── drawer_icon_advice.xml
│ │ ├── drawer_icon_blog.xml
│ │ ├── drawer_icon_gamedate.xml
│ │ ├── drawer_icon_news.xml
│ │ ├── drawer_icon_setting.xml
│ │ ├── drawer_icon_sort.xml
│ │ ├── drawer_icon_summary.xml
│ │ ├── drawer_item_background.xml
│ │ ├── drawer_shadow.9.png
│ │ ├── drawer_text_color.xml
│ │ ├── setting_arrow.png
│ │ └── shot_item_background.xml
│ │ ├── layout
│ │ ├── activity_about.xml
│ │ ├── activity_detile.xml
│ │ ├── activity_detile_noimage.xml
│ │ ├── activity_main.xml
│ │ ├── activity_setting.xml
│ │ ├── adapter_rhythm_icon.xml
│ │ ├── appbar_toolbar.xml
│ │ ├── barchart_one_tooltip.xml
│ │ ├── drawer_item.xml
│ │ ├── fragment_bar.xml
│ │ ├── fragment_drawer.xml
│ │ ├── fragment_main.xml
│ │ ├── fragment_playersort.xml
│ │ ├── fragment_sort.xml
│ │ ├── fragment_team_sort.xml
│ │ ├── item_fragment_blog_normal.xml
│ │ ├── item_fragment_games.xml
│ │ ├── item_fragment_news_load_more.xml
│ │ ├── item_fragment_news_morepic.xml
│ │ ├── item_fragment_news_nopic.xml
│ │ ├── item_fragment_news_normal.xml
│ │ ├── item_fragment_teamsort_entity.xml
│ │ ├── item_fragment_teamsort_title.xml
│ │ ├── preference_category_widget.xml
│ │ ├── preference_list_item.xml
│ │ └── toolbar.xml
│ │ ├── menu
│ │ ├── menu_date.xml
│ │ └── menu_main.xml
│ │ ├── mipmap-xhdpi
│ │ ├── applink.png
│ │ ├── atlanta.webp
│ │ ├── boston.webp
│ │ ├── brooklyn.webp
│ │ ├── charlotte.webp
│ │ ├── chicago.webp
│ │ ├── cleveland.webp
│ │ ├── common_icon_right_arrow.png
│ │ ├── dallas.webp
│ │ ├── denver.webp
│ │ ├── detroit.webp
│ │ ├── drawer_icon_about.png
│ │ ├── drawer_icon_aboutfalse.png
│ │ ├── drawer_icon_advice.png
│ │ ├── drawer_icon_advicefalse.png
│ │ ├── drawer_icon_blog.png
│ │ ├── drawer_icon_blogfalse.png
│ │ ├── drawer_icon_gamedate.png
│ │ ├── drawer_icon_gamedatefalse.png
│ │ ├── drawer_icon_likes.png
│ │ ├── drawer_icon_news.png
│ │ ├── drawer_icon_newsfalse.png
│ │ ├── drawer_icon_settings.png
│ │ ├── drawer_icon_settingsfalse.png
│ │ ├── drawer_icon_sort.png
│ │ ├── drawer_icon_sortfalse.png
│ │ ├── drawer_icon_summary.png
│ │ ├── drawer_icon_summaryfalse.png
│ │ ├── goldenstate.webp
│ │ ├── houston.webp
│ │ ├── ic_event_white_24dp.png
│ │ ├── ic_launcher.webp
│ │ ├── ic_menu_white.png
│ │ ├── ic_more_vert_white_24dp.png
│ │ ├── ic_refresh_white.png
│ │ ├── ic_share_white_18dp.png
│ │ ├── ic_swap_horiz_white_18dp.png
│ │ ├── icon_title.png
│ │ ├── indiana.webp
│ │ ├── laclippers.webp
│ │ ├── lalakers.webp
│ │ ├── main_left_header_bg.webp
│ │ ├── memphis.webp
│ │ ├── miami.webp
│ │ ├── milwaukee.webp
│ │ ├── minnesota.webp
│ │ ├── myteam.png
│ │ ├── neworleans.webp
│ │ ├── newyork.webp
│ │ ├── notice.png
│ │ ├── okc.webp
│ │ ├── orlando.webp
│ │ ├── phila.webp
│ │ ├── phoenix.webp
│ │ ├── placeholder_biger.png
│ │ ├── placeholder_small.png
│ │ ├── play_chart.png
│ │ ├── portland.webp
│ │ ├── sacramento.webp
│ │ ├── sanantonio.webp
│ │ ├── shadow_left.png
│ │ ├── suqun.webp
│ │ ├── toronto.webp
│ │ ├── utah.webp
│ │ ├── washington.webp
│ │ └── zhangjiawei.webp
│ │ ├── raw
│ │ └── notices.xml
│ │ ├── values-v21
│ │ ├── dimens.xml
│ │ ├── settings_pref.xml
│ │ └── styles.xml
│ │ ├── values-w820dp
│ │ └── dimens.xml
│ │ ├── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── settings_pref.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ │ └── xml
│ │ └── preferences.xml
│ └── test
│ └── java
│ └── com
│ └── me
│ └── silencedut
│ └── nbaplus
│ └── ExampleUnitTest.java
├── build.gradle
├── buildconfig.gradle
├── chartlibrary
├── AndroidManifest.xml
├── build.gradle
├── chartlibrary.iml
├── gradle.properties
├── proguard-project.txt
├── project.properties
├── res
│ └── values
│ │ ├── attrs.xml
│ │ └── dimens.xml
└── src
│ └── com
│ └── db
│ └── chart
│ ├── Tools.java
│ ├── listener
│ ├── OnEntryClickListener.java
│ └── OnTooltipEventListener.java
│ ├── model
│ ├── Bar.java
│ ├── BarSet.java
│ ├── ChartEntry.java
│ └── ChartSet.java
│ └── view
│ ├── AxisController.java
│ ├── BarChartView.java
│ ├── BaseBarChartView.java
│ ├── ChartView.java
│ ├── Tooltip.java
│ ├── XController.java
│ ├── YController.java
│ └── animation
│ ├── Animation.java
│ ├── easing
│ ├── BaseEasingMethod.java
│ ├── BounceEase.java
│ ├── CircEase.java
│ ├── CubicEase.java
│ ├── ElasticEase.java
│ ├── ExpoEase.java
│ ├── LinearEase.java
│ ├── QuadEase.java
│ ├── QuartEase.java
│ ├── QuintEase.java
│ └── SineEase.java
│ └── style
│ └── BaseStyleAnimation.java
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── greendaogeneration
├── .gitignore
├── build.gradle
├── greendaogeneration.iml
└── src
│ └── main
│ └── java
│ └── com
│ └── greendao
│ └── DaoGeneration.java
├── raw
└── nbaplus_architecture.png
├── screenshot
├── 1.png
└── 2.png
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea
5 | .DS_Store
6 | /build
7 | /captures
8 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## [Deprecated]
2 | 由于最近发现这个应用被别人直接拿来稍作修改后上传到应用商店。这个项目里的新闻等数据来源也未获取授权,最初的开源的目的是用来学习交流的,
3 | 也未考虑过到应用商店发布,所以现在的情况违背了当初的初衷,所以决定关闭web服务器,此项目的效果将无法再呈现。
4 |
5 | # NBAPlus
6 | A concise APP about NBA News and Event with RxJava and EventBus,
7 | follow android-best-practices
8 | # 效果图
9 | 
10 | 
11 |
12 | # 特点
13 | * 遵循Android开发最佳实践的一种具体实践
14 | * Retrofit2.0+RxJava+EventBus+GreenDao的使用
15 | * 代码结构清晰,扩展性强,易复用到其他项目
16 | * 结合[NBAPlus Server](https://github.com/SilenceDut/nbaplus-server) 学习后台开发知识和接口的设计
17 | * 动态Blur效果。
18 |
19 | # 关于
20 | NBA资讯和赛事信息的平台。
21 | 全面、方便、快捷的获取新闻动态、比赛数据。
22 | 无广告、推送信息,不后台常驻,空间占用小。
23 | 所有数据均来自网络,并尽量注明信息来源,如有侵权,请告知!
24 |
25 | web后台部分在这:[NBAPlus Server](https://github.com/SilenceDut/nbaplus-server)
26 |
27 | # License
28 |
29 | Copyright 2015 SilenceDut
30 |
31 | Licensed under the Apache License, Version 2.0 (the "License");you may not use this
32 |
33 | file except in compliance with the License.You may obtain a copy of the License at
34 |
35 | [http://www.apache.org/licenses/LICENSE-2.0]
36 |
37 | Unless required by applicable law or agreed to in writing, software distributed under
38 |
39 | the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
40 |
41 | ANY KIND, either express or implied. See the License for the specific language
42 |
43 | governing permissions and limitations under the License.
44 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | def globalConfiguration = rootProject.ext.android
5 | compileSdkVersion globalConfiguration.AndroidCompileSdkVersion
6 | buildToolsVersion globalConfiguration.AndroidBuildToolsVersion
7 |
8 | defaultConfig {
9 |
10 | applicationId globalConfiguration.applicationId
11 | minSdkVersion globalConfiguration.AndridMinSdkVersion
12 | targetSdkVersion globalConfiguration.AndroidTargetSdkVersion
13 | versionCode globalConfiguration.versionCode
14 | versionName globalConfiguration.versionName
15 |
16 | }
17 |
18 | lintOptions {
19 | disable 'InvalidPackage'
20 | }
21 | packagingOptions {
22 | exclude 'META-INF/services/javax.annotation.processing.Processor'
23 | }
24 |
25 | applicationVariants.all { variant ->
26 | variant.outputs.each { output ->
27 | output.outputFile = new File(
28 | output.outputFile.parent,
29 | "nbaplus-${variant.versionName}.apk".toLowerCase())
30 | }
31 | }
32 |
33 | buildTypes {
34 | release {
35 | applicationIdSuffix ".release"
36 | minifyEnabled false
37 |
38 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
39 | }
40 |
41 | dev{
42 | applicationIdSuffix ".dev"
43 | minifyEnabled false
44 |
45 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
46 |
47 | }
48 | }
49 | sourceSets {
50 | main {
51 | java.srcDirs = ['src/main/java', 'src/main/java-gen']
52 | }
53 | }
54 | }
55 |
56 | dependencies {
57 |
58 | compile fileTree(include: ['*.jar'], dir: 'libs')
59 | def googleDependencies = rootProject.ext.goodleDependencies
60 | def otherDependencies = rootProject.ext.otherDependdencies
61 | compile googleDependencies.support_v4
62 | compile googleDependencies.appcompat_v7
63 | compile googleDependencies.design
64 | compile googleDependencies.recyclerview_v7
65 | compile googleDependencies.cardview_v7
66 | compile otherDependencies.butterknife
67 | compile otherDependencies.glide
68 | compile otherDependencies.eventbus
69 | compile otherDependencies.materialish_progress
70 | compile otherDependencies.circleimageview
71 | compile otherDependencies.licensesdialog
72 | compile otherDependencies.fir_sdk
73 | compile otherDependencies.retrofit_2_0
74 | compile otherDependencies.retrofit_converter_gson
75 | compile otherDependencies.rxandroid
76 | compile otherDependencies.rxjava
77 | compile otherDependencies.adapter_rxjava
78 | compile otherDependencies.greendao
79 | compile otherDependencies.pickview
80 | compile otherDependencies.finestwebview
81 | debugCompile otherDependencies.leakcanary_debug
82 | releaseCompile otherDependencies.leakcanary_release
83 | compile files('libs/joda-time-2.8.2.jar')
84 | compile project(':chartlibrary')
85 | }
86 |
--------------------------------------------------------------------------------
/app/libs/joda-time-2.8.2.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/libs/joda-time-2.8.2.jar
--------------------------------------------------------------------------------
/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 E:\developingsoftware\newsdk\android-sdk-windows/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/me/silencedut/nbaplus/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
20 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
38 |
39 |
40 |
46 |
47 |
48 |
54 |
55 |
56 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/app/src/main/java-gen/com/me/silencedut/greendao/DBHelper.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.greendao;
2 |
3 | import android.content.Context;
4 | import android.database.sqlite.SQLiteDatabase;
5 | import android.util.Config;
6 |
7 | import de.greenrobot.dao.query.QueryBuilder;
8 |
9 | /**
10 | * Created by SilenceDut on 2015/12/3.
11 | */
12 | public class DBHelper {
13 |
14 | private static DBHelper sInstance;
15 | private static final Object WATCH_DOG=new Object();
16 | private static final String DB_NAME = "nbaplus";
17 | private DaoSession daoSession;
18 | private SQLiteDatabase db;
19 | public static DBHelper getInstance(Context context) {
20 | synchronized (WATCH_DOG) {
21 | if(sInstance==null) {
22 | sInstance=new DBHelper(context);
23 | }
24 | return sInstance;
25 | }
26 | }
27 |
28 | private DBHelper(Context context) {
29 | DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(context, DB_NAME, null);
30 | db = helper.getWritableDatabase();
31 | // 注意:该数据库连接属于 DaoMaster,所以多个 Session 指的是相同的数据库连接。
32 | DaoMaster daoMaster = new DaoMaster(db);
33 | daoSession = daoMaster.newSession();
34 | if(Config.DEBUG) {
35 | QueryBuilder.LOG_SQL = true;
36 | QueryBuilder.LOG_VALUES = true;
37 | }
38 | }
39 | public DaoSession getDaoSession() {
40 | return daoSession;
41 | }
42 |
43 | public SQLiteDatabase getDb() {
44 | return db;
45 | }
46 |
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/app/src/main/java-gen/com/me/silencedut/greendao/DaoMaster.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.greendao;
2 |
3 | import android.content.Context;
4 | import android.database.sqlite.SQLiteDatabase;
5 | import android.database.sqlite.SQLiteDatabase.CursorFactory;
6 | import android.database.sqlite.SQLiteOpenHelper;
7 | import android.util.Log;
8 |
9 | import de.greenrobot.dao.AbstractDaoMaster;
10 | import de.greenrobot.dao.identityscope.IdentityScopeType;
11 |
12 | // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
13 | /**
14 | * Master of DAO (schema version 1): knows all DAOs.
15 | */
16 | public class DaoMaster extends AbstractDaoMaster {
17 | public static final int SCHEMA_VERSION = 3;
18 |
19 | /** Creates underlying database table using DAOs. */
20 | public static void createAllTables(SQLiteDatabase db, boolean ifNotExists) {
21 | GreenNewsDao.createTable(db, ifNotExists);
22 | GreenStatDao.createTable(db, ifNotExists);
23 | }
24 |
25 | /** Drops underlying database table using DAOs. */
26 | public static void dropAllTables(SQLiteDatabase db, boolean ifExists) {
27 | GreenNewsDao.dropTable(db, ifExists);
28 | GreenStatDao.dropTable(db, ifExists);
29 | }
30 |
31 | public static abstract class OpenHelper extends SQLiteOpenHelper {
32 |
33 | public OpenHelper(Context context, String name, CursorFactory factory) {
34 | super(context, name, factory, SCHEMA_VERSION);
35 | }
36 |
37 | @Override
38 | public void onCreate(SQLiteDatabase db) {
39 | Log.i("greenDAO", "Creating tables for schema version " + SCHEMA_VERSION);
40 | createAllTables(db, true);
41 | }
42 | }
43 |
44 | /** WARNING: Drops all table on Upgrade! Use only during development. */
45 | public static class DevOpenHelper extends OpenHelper {
46 | public DevOpenHelper(Context context, String name, CursorFactory factory) {
47 | super(context, name, factory);
48 | }
49 |
50 | @Override
51 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
52 | Log.i("greenDAO", "Upgrading schema from version " + oldVersion + " to " + newVersion + " by dropping all tables");
53 | // dropAllTables(db, true);
54 | onCreate(db);
55 | }
56 | }
57 |
58 | public DaoMaster(SQLiteDatabase db) {
59 | super(db, SCHEMA_VERSION);
60 | registerDaoClass(GreenNewsDao.class);
61 | registerDaoClass(GreenStatDao.class);
62 | }
63 |
64 | public DaoSession newSession() {
65 | return new DaoSession(db, IdentityScopeType.Session, daoConfigMap);
66 | }
67 |
68 | public DaoSession newSession(IdentityScopeType type) {
69 | return new DaoSession(db, type, daoConfigMap);
70 | }
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/app/src/main/java-gen/com/me/silencedut/greendao/DaoSession.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.greendao;
2 |
3 | import android.database.sqlite.SQLiteDatabase;
4 |
5 | import java.util.Map;
6 |
7 | import de.greenrobot.dao.AbstractDao;
8 | import de.greenrobot.dao.AbstractDaoSession;
9 | import de.greenrobot.dao.identityscope.IdentityScopeType;
10 | import de.greenrobot.dao.internal.DaoConfig;
11 |
12 | // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
13 |
14 | /**
15 | * {@inheritDoc}
16 | *
17 | * @see de.greenrobot.dao.AbstractDaoSession
18 | */
19 | public class DaoSession extends AbstractDaoSession {
20 |
21 | private final DaoConfig greenNewsDaoConfig;
22 | private final DaoConfig greenStatDaoConfig;
23 |
24 | private final GreenNewsDao greenNewsDao;
25 | private final GreenStatDao greenStatDao;
26 |
27 | public DaoSession(SQLiteDatabase db, IdentityScopeType type, Map>, DaoConfig>
28 | daoConfigMap) {
29 | super(db);
30 |
31 | greenNewsDaoConfig = daoConfigMap.get(GreenNewsDao.class).clone();
32 | greenNewsDaoConfig.initIdentityScope(type);
33 |
34 | greenStatDaoConfig = daoConfigMap.get(GreenStatDao.class).clone();
35 | greenStatDaoConfig.initIdentityScope(type);
36 |
37 | greenNewsDao = new GreenNewsDao(greenNewsDaoConfig, this);
38 | greenStatDao = new GreenStatDao(greenStatDaoConfig, this);
39 |
40 | registerDao(GreenNews.class, greenNewsDao);
41 | registerDao(GreenStat.class, greenStatDao);
42 | }
43 |
44 | public void clear() {
45 | greenNewsDaoConfig.getIdentityScope().clear();
46 | greenStatDaoConfig.getIdentityScope().clear();
47 | }
48 |
49 | public GreenNewsDao getGreenNewsDao() {
50 | return greenNewsDao;
51 | }
52 |
53 | public GreenStatDao getGreenStatDao() {
54 | return greenStatDao;
55 | }
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/app/src/main/java-gen/com/me/silencedut/greendao/GreenNews.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.greendao;
2 |
3 | // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. Enable "keep" sections if you want to edit.
4 | /**
5 | * Entity mapped to table "GREEN_NEWS".
6 | */
7 | public class GreenNews {
8 |
9 | private Long id;
10 | private String newslist;
11 | private String type;
12 |
13 | public GreenNews() {
14 | }
15 |
16 | public GreenNews(Long id) {
17 | this.id = id;
18 | }
19 |
20 | public GreenNews(Long id, String newslist, String type) {
21 | this.id = id;
22 | this.newslist = newslist;
23 | this.type = type;
24 | }
25 |
26 | public Long getId() {
27 | return id;
28 | }
29 |
30 | public void setId(Long id) {
31 | this.id = id;
32 | }
33 |
34 | public String getNewslist() {
35 | return newslist;
36 | }
37 |
38 | public void setNewslist(String newslist) {
39 | this.newslist = newslist;
40 | }
41 |
42 | public String getType() {
43 | return type;
44 | }
45 |
46 | public void setType(String type) {
47 | this.type = type;
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/app/src/main/java-gen/com/me/silencedut/greendao/GreenStat.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.greendao;
2 |
3 | // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. Enable "keep" sections if you want to edit.
4 | /**
5 | * Entity mapped to table "GREEN_STAT".
6 | */
7 | public class GreenStat {
8 |
9 | private Long id;
10 | private String statentity;
11 | private String statkind;
12 |
13 | public GreenStat() {
14 | }
15 |
16 | public GreenStat(Long id) {
17 | this.id = id;
18 | }
19 |
20 | public GreenStat(Long id, String statentity, String statkind) {
21 | this.id = id;
22 | this.statentity = statentity;
23 | this.statkind = statkind;
24 | }
25 |
26 | public Long getId() {
27 | return id;
28 | }
29 |
30 | public void setId(Long id) {
31 | this.id = id;
32 | }
33 |
34 | public String getStatentity() {
35 | return statentity;
36 | }
37 |
38 | public void setStatentity(String statentity) {
39 | this.statentity = statentity;
40 | }
41 |
42 | public String getStatkind() {
43 | return statkind;
44 | }
45 |
46 | public void setStatkind(String statkind) {
47 | this.statkind = statkind;
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/app/App.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.app;
2 |
3 | import android.app.Application;
4 | import android.content.Context;
5 |
6 | //import com.squareup.leakcanary.LeakCanary;
7 | //import com.squareup.leakcanary.RefWatcher;
8 |
9 | import im.fir.sdk.FIR;
10 |
11 | /**
12 | * Created by SilenceDut on 2015/11/28.
13 | */
14 | public class App extends Application {
15 | private static Application sInstance;
16 | @Override
17 | public void onCreate() {
18 | super.onCreate();
19 | FIR.init(this);
20 | // mRefWatcher = LeakCanary.install(this);
21 | sInstance = this;
22 | AppService.getInstance().initService();
23 |
24 | }
25 | public static Context getContext() {
26 | return sInstance.getApplicationContext();
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/data/Constant.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.data;
2 |
3 | import com.me.silencedut.nbaplus.R;
4 |
5 | import java.util.HashMap;
6 | import java.util.Map;
7 |
8 | /**
9 | * Created by SilenceDut on 2015/11/28.
10 | */
11 | public class Constant {
12 |
13 | public static final String APP_FIR_IM_URL="http://fir.im/nbaplus";
14 | public static final String API_TOKEN_FIR="ff55b0c5cb165ec0b04c473cf77c8995";
15 |
16 | public static final String LOADIMAGE = "LOADIMAGE";
17 | public static final String ACTILEFONTSIZE = "ACTILEFONTSIZE";
18 |
19 | public static final String CSS_STYLE ="";
20 |
21 | public final static String[] TEAM_NAMES={"骑士","猛龙","老鹰","步行者","热火","活塞","公牛","魔术"
22 | ,"黄蜂","凯尔特人","尼克斯","奇才","雄鹿","篮网","76人","勇士","马刺","雷霆","快船","小牛"
23 | ,"灰熊","火箭","爵士","太阳","掘金","森林狼","国王","开拓者","鹈鹕","湖人"};
24 | public final static int[] TEAM_ICONS={R.mipmap.cleveland,R.mipmap.toronto,R.mipmap.atlanta,R.mipmap.indiana
25 | ,R.mipmap.miami,R.mipmap.detroit,R.mipmap.chicago,R.mipmap.orlando,R.mipmap.charlotte,R.mipmap.boston
26 | ,R.mipmap.newyork,R.mipmap.washington,R.mipmap.milwaukee,R.mipmap.brooklyn,R.mipmap.phila,R.mipmap.goldenstate
27 | ,R.mipmap.sanantonio,R.mipmap.okc,R.mipmap.laclippers,R.mipmap.dallas,R.mipmap.memphis,R.mipmap.houston
28 | ,R.mipmap.utah,R.mipmap.phoenix,R.mipmap.denver,R.mipmap.minnesota,R.mipmap.sacramento,R.mipmap.portland
29 | ,R.mipmap.neworleans,R.mipmap.lalakers};
30 |
31 | private static final Map sTeamIconMap=new HashMap<>();
32 |
33 | static {
34 | for (int index=0;index getTeamIcons() {
40 | return sTeamIconMap;
41 | }
42 |
43 | public enum NEWSTYPE {
44 | NEWS("news"),BLOG("blog");
45 | private String newsType;
46 | NEWSTYPE(String newsType) {
47 | this.newsType=newsType;
48 | }
49 | public String getNewsType() {
50 | return newsType;
51 | }
52 | }
53 |
54 | public enum GETNEWSWAY {
55 | INIT,UPDATE,LOADMORE;
56 | }
57 |
58 | public enum Result {
59 | SUCCESS,FAIL,NORMAL;
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/event/DrawerClickEvent.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.event;
2 |
3 | /**
4 | * Created by SilenceDut on 2015/11/28.
5 | */
6 | public class DrawerClickEvent extends Event {
7 | private int drawId;
8 |
9 | public DrawerClickEvent(int drawId) {
10 | this.drawId = drawId;
11 | }
12 |
13 | public int getDrawId() {
14 | return drawId;
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/event/Event.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.event;
2 | import com.me.silencedut.nbaplus.data.Constant.Result;
3 | /**
4 | * Created by SilenceDut on 2015/11/28.
5 | */
6 | public class Event {
7 | protected Result mEventResult;
8 |
9 | public void setEventResult(Result eventResult) {
10 | this.mEventResult=eventResult;
11 | }
12 |
13 | public Result getEventResult() {
14 | return mEventResult;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/event/GamesEvent.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.event;
2 |
3 | import com.me.silencedut.nbaplus.data.Constant;
4 | import com.me.silencedut.nbaplus.model.Games;
5 |
6 | /**
7 | * Created by SilenceDut on 2015/12/26.
8 | */
9 | public class GamesEvent extends Event {
10 | private Games mAllGames;
11 | public GamesEvent(Games games,Constant.Result result) {
12 | this.mAllGames=games;
13 | this.mEventResult=result;
14 | }
15 |
16 | public Games getAllGames() {
17 | return mAllGames;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/event/NewsAnimatEndEvent.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.event;
2 |
3 | /**
4 | * Created by SilenceDut on 2015/12/9.
5 | */
6 | public class NewsAnimatEndEvent extends Event{
7 | }
8 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/event/NewsDetailEvent.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.event;
2 |
3 | /**
4 | * Created by SilenceDut on 2015/12/9.
5 | */
6 | public class NewsDetailEvent extends Event {
7 | private String mNewsContent;
8 | public NewsDetailEvent(String newsContent) {
9 | this.mNewsContent=newsContent;
10 | }
11 | public String getContent() {
12 | return mNewsContent;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/event/NewsEvent.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.event;
2 |
3 | import com.me.silencedut.nbaplus.model.News;
4 | import com.me.silencedut.nbaplus.data.Constant.GETNEWSWAY;
5 | /**
6 | * Created by Silencedut on 2015/11/28.
7 | */
8 | public class NewsEvent extends Event {
9 |
10 | private News news;
11 | private GETNEWSWAY getNewsWay;
12 | private String newsType;
13 |
14 | public String getNewsType() {
15 | return newsType;
16 | }
17 |
18 | public NewsEvent(News news,GETNEWSWAY getNewsWay,String newsType) {
19 | this.news=news;
20 | this.newsType=newsType;
21 | this.getNewsWay=getNewsWay;
22 |
23 | }
24 |
25 | public News getNews() {
26 | return news;
27 | }
28 |
29 | public GETNEWSWAY getNewsWay() {
30 | return getNewsWay;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/event/RhythmPositonEvent.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.event;
2 |
3 | /**
4 | * Created by SilenceDut on 2015/12/17.
5 | */
6 | public class RhythmPositonEvent extends Event{
7 | private int mPosition;
8 | public RhythmPositonEvent(int position) {
9 | this.mPosition=position;
10 | }
11 |
12 | public int getPosition() {
13 | return mPosition;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/event/StatEvent.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.event;
2 |
3 | import com.me.silencedut.nbaplus.data.Constant;
4 |
5 | /**
6 | * Created by SilenceDut on 2015/12/18.
7 | */
8 | public class StatEvent extends Event {
9 | private String mStatKind;
10 | private String[][] mLables;
11 | private String[][] mPlayerUrls;
12 | private float[][] mStatValues;
13 | private Constant.GETNEWSWAY getNewsWay;
14 | public StatEvent (String statKind,String[][] lables,float[][] statValues,String[][] playerUrls) {
15 | this.mStatKind=statKind;
16 | this.mLables=lables;
17 | this.mStatValues=statValues;
18 | this.mPlayerUrls=playerUrls;
19 | }
20 |
21 | public Constant.GETNEWSWAY getGetNewsWay() {
22 | return getNewsWay;
23 | }
24 |
25 | public void setGetNewsWay(Constant.GETNEWSWAY getNewsWay) {
26 | this.getNewsWay = getNewsWay;
27 | }
28 |
29 | public String getStatKind() {
30 | return mStatKind;
31 | }
32 |
33 | public String[][] getLables() {
34 | return mLables;
35 | }
36 |
37 | public float[][] getStatValues() {
38 | return mStatValues;
39 | }
40 |
41 | public String[][] getPlayerUrls() {
42 | return mPlayerUrls;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/event/TeamSortEvent.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.event;
2 |
3 | import com.me.silencedut.nbaplus.data.Constant;
4 | import com.me.silencedut.nbaplus.model.Teams;
5 |
6 | /**
7 | * Created by SilenceDut on 2015/12/23.
8 | */
9 | public class TeamSortEvent extends Event {
10 | private Teams mTeams;
11 | public TeamSortEvent(Teams teams,Constant.Result result) {
12 | this.mTeams=teams;
13 | this.mEventResult=result;
14 | }
15 |
16 | public Teams getmTeams() {
17 | return mTeams;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/model/Games.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.model;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * Created by SilenceDut on 2015/12/26.
7 | */
8 | public class Games {
9 | /**
10 | * status :
11 | * stateUrl :
12 | * rightTeam :
13 | * statusText :
14 | * statusUrl :
15 | * leftTeam :
16 | * rightScore :
17 | * stateText :
18 | * date : 12-26
19 | * type : 0
20 | */
21 |
22 | private List games;
23 |
24 | public void setGames(List games) {
25 | this.games = games;
26 | }
27 |
28 | public List getGames() {
29 | return games;
30 | }
31 |
32 | public static class GamesEntity {
33 | private String status;
34 | private String stateUrl;
35 | private String rightTeam;
36 | private String statusText;
37 | private String statusUrl;
38 | private String leftTeam;
39 | private String leftScore;
40 | private String rightScore;
41 | private String stateText;
42 | private String date;
43 | private int type;
44 |
45 | public void setStatus(String status) {
46 | this.status = status;
47 | }
48 |
49 | public void setStateUrl(String stateUrl) {
50 | this.stateUrl = stateUrl;
51 | }
52 |
53 | public void setRightTeam(String rightTeam) {
54 | this.rightTeam = rightTeam;
55 | }
56 |
57 | public void setStatusText(String statusText) {
58 | this.statusText = statusText;
59 | }
60 |
61 | public void setStatusUrl(String statusUrl) {
62 | this.statusUrl = statusUrl;
63 | }
64 |
65 | public void setLeftTeam(String leftTeam) {
66 | this.leftTeam = leftTeam;
67 | }
68 |
69 | public void setLeftScore(String leftScore) {
70 | this.leftScore = leftScore;
71 | }
72 |
73 | public void setRightScore(String rightScore) {
74 | this.rightScore = rightScore;
75 | }
76 |
77 | public void setStateText(String stateText) {
78 | this.stateText = stateText;
79 | }
80 |
81 | public void setDate(String date) {
82 | this.date = date;
83 | }
84 |
85 | public void setType(int type) {
86 | this.type = type;
87 | }
88 |
89 | public String getStatus() {
90 | return status;
91 | }
92 |
93 | public String getStateUrl() {
94 | return stateUrl;
95 | }
96 |
97 | public String getRightTeam() {
98 | return rightTeam;
99 | }
100 |
101 | public String getStatusText() {
102 | return statusText;
103 | }
104 |
105 | public String getStatusUrl() {
106 | return statusUrl;
107 | }
108 |
109 | public String getLeftTeam() {
110 | return leftTeam;
111 | }
112 |
113 | public String getLeftScore() {
114 | return leftScore;
115 | }
116 |
117 | public String getRightScore() {
118 | return rightScore;
119 | }
120 |
121 | public String getStateText() {
122 | return stateText;
123 | }
124 |
125 | public String getDate() {
126 | return date;
127 | }
128 |
129 | public int getType() {
130 | return type;
131 | }
132 | }
133 | }
134 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/model/NewsDetile.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.model;
2 |
3 | import org.joda.time.DateTime;
4 |
5 | import java.util.Map;
6 |
7 | /**
8 | * Created by SilenceDut on 2015/12/9.
9 | */
10 | public class NewsDetile {
11 |
12 | private String author;
13 |
14 | private Map articleMediaMap;
15 |
16 | private String content;
17 |
18 | public String getAuthor() {
19 | return author;
20 | }
21 |
22 | public void setAuthor(String author) {
23 | this.author = author;
24 | }
25 |
26 | public Map getArticleMediaMap() {
27 | return articleMediaMap;
28 | }
29 |
30 | public void setArticleMediaMap(Map articleMediaMap) {
31 | this.articleMediaMap = articleMediaMap;
32 | }
33 |
34 | public String getContent() {
35 | return content;
36 | }
37 |
38 | public void setContent(String content) {
39 | this.content = content;
40 | }
41 |
42 | public static class ContentImage {
43 | String url;
44 | int id;
45 |
46 | public String getUrl() {
47 | return url;
48 | }
49 |
50 | public void setUrl(String url) {
51 | this.url = url;
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/model/Statistics.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.model;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * Created by SilenceDut on 2015/12/17.
7 | */
8 | public class Statistics {
9 |
10 | /**
11 | * place : 1
12 | * statkind : points
13 | * name : 杰里米-林
14 | * statdata : 35
15 | * team : 黄蜂
16 | */
17 |
18 | private List dailyStat;
19 | /**
20 | * place : 1
21 | * statkind : points
22 | * name : 斯蒂芬-库里
23 | * statdata : 32
24 | * team : 勇士
25 | */
26 |
27 | private List everageStat;
28 |
29 | public void setDailyStat(List dailyStat) {
30 | this.dailyStat = dailyStat;
31 | }
32 |
33 | public void setEverageStat(List everageStat) {
34 | this.everageStat = everageStat;
35 | }
36 |
37 | public List getDailyStat() {
38 | return dailyStat;
39 | }
40 |
41 | public List getEverageStat() {
42 | return everageStat;
43 | }
44 |
45 | public static class StatEntity {
46 | private String place;
47 | private String statkind;
48 | private String playerurl;
49 | private String name;
50 | private String statdata;
51 | private String team;
52 |
53 | public String getPlayerurl() {
54 | return playerurl;
55 | }
56 |
57 | public void setPlayerurl(String playerurl) {
58 | this.playerurl = playerurl;
59 | }
60 |
61 | public void setPlace(String place) {
62 | this.place = place;
63 | }
64 |
65 | public void setStatkind(String statkind) {
66 | this.statkind = statkind;
67 | }
68 |
69 | public void setName(String name) {
70 | this.name = name;
71 | }
72 |
73 | public void setStatdata(String statdata) {
74 | this.statdata = statdata;
75 | }
76 |
77 | public void setTeam(String team) {
78 | this.team = team;
79 | }
80 |
81 | public String getPlace() {
82 | return place;
83 | }
84 |
85 | public String getStatkind() {
86 | return statkind;
87 | }
88 |
89 | public String getName() {
90 | return name;
91 | }
92 |
93 | public String getStatdata() {
94 | return statdata;
95 | }
96 |
97 | public String getTeam() {
98 | return team;
99 | }
100 | }
101 |
102 | }
103 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/model/Teams.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.model;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * Created by SilenceDut on 2015/12/23.
7 | */
8 | public class Teams {
9 | /**
10 | * sort : 排名
11 | * winPercent : 胜率
12 | * win : 胜
13 | * lose : 负
14 | * gap : 胜差
15 | * team : 球队
16 | */
17 |
18 | private List teamsort;
19 |
20 | public void setTeamsort(List teamsort) {
21 | this.teamsort = teamsort;
22 | }
23 |
24 | public List getTeamsort() {
25 | return teamsort;
26 | }
27 |
28 | public static class TeamsortEntity {
29 | private String teamurl;
30 | private String sort;
31 | private String winPercent;
32 | private String win;
33 | private String lose;
34 | private String gap;
35 | private String team;
36 |
37 | public String getTeamurl() {
38 | return teamurl;
39 | }
40 |
41 | public void setTeamurl(String teamurl) {
42 | this.teamurl = teamurl;
43 | }
44 |
45 | public void setSort(String sort) {
46 | this.sort = sort;
47 | }
48 |
49 | public void setWinPercent(String winPercent) {
50 | this.winPercent = winPercent;
51 | }
52 |
53 | public void setWin(String win) {
54 | this.win = win;
55 | }
56 |
57 | public void setLose(String lose) {
58 | this.lose = lose;
59 | }
60 |
61 | public void setGap(String gap) {
62 | this.gap = gap;
63 | }
64 |
65 | public void setTeam(String team) {
66 | this.team = team;
67 | }
68 |
69 | public String getSort() {
70 | return sort;
71 | }
72 |
73 | public String getWinPercent() {
74 | return winPercent;
75 | }
76 |
77 | public String getWin() {
78 | return win;
79 | }
80 |
81 | public String getLose() {
82 | return lose;
83 | }
84 |
85 | public String getGap() {
86 | return gap;
87 | }
88 |
89 | public String getTeam() {
90 | return team;
91 | }
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/network/NbaplusAPI.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.network;
2 |
3 |
4 | import com.me.silencedut.nbaplus.model.Games;
5 | import com.me.silencedut.nbaplus.model.News;
6 | import com.me.silencedut.nbaplus.model.Statistics;
7 | import com.me.silencedut.nbaplus.model.Teams;
8 |
9 | import retrofit.http.GET;
10 | import retrofit.http.Path;
11 | import rx.Observable;
12 |
13 | /**
14 | * Created by SilenceDut on 2015/11/28.
15 | */
16 | public interface NbaplusAPI {
17 | @GET("api/v1.0/{type}/update")
18 | Observable updateNews(@Path("type") String type);
19 | @GET("api/v1.0/{type}/loadmore/{newsId}")
20 | Observable loadMoreNews(@Path("type") String type,@Path("newsId") String newsId );
21 | @GET("api/v1.0/nbastat/perstat/{statKind}")
22 | Observable getPerStats(@Path("statKind") String statKind);
23 | @GET("api/v1.0/teamsort/sort")
24 | Observable getTeamSort();
25 | @GET("api/v1.0/gamesdate/{date}")
26 | Observable getGames(@Path("date") String date);
27 |
28 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/network/NbaplusClient.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.network;
2 |
3 |
4 | import retrofit.GsonConverterFactory;
5 | import retrofit.Retrofit;
6 | import retrofit.RxJavaCallAdapterFactory;
7 |
8 | /**
9 | * Created by SilenceDut on 2015/11/28.
10 | */
11 | public class NbaplusClient {
12 | final NbaplusAPI nbaplus ;
13 | final NewsDetileAPI newsDetileAPI;
14 | NbaplusClient() {
15 | Retrofit retrofit0 = new Retrofit.Builder()
16 | .baseUrl("http://nbaplus.sinaapp.com/")
17 | .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
18 | .addConverterFactory(GsonConverterFactory.create())
19 | .build();
20 |
21 | nbaplus=retrofit0.create(NbaplusAPI.class);
22 |
23 | Retrofit retrofit1 = new Retrofit.Builder()
24 | .baseUrl("http://reader.res.meizu.com/reader/articlecontent/")
25 | .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
26 | .addConverterFactory(GsonConverterFactory.create())
27 | .build();
28 |
29 | newsDetileAPI=retrofit1.create(NewsDetileAPI.class);
30 |
31 | }
32 |
33 | public NbaplusAPI getCilent() {
34 | return nbaplus;
35 | }
36 |
37 | public NewsDetileAPI getNewsDetileClient() {
38 | return newsDetileAPI;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/network/NbaplusFactory.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.network;
2 |
3 | /**
4 | * Created by SilenceDut on 2015/11/28.
5 | */
6 | public class NbaplusFactory {
7 | private static NbaplusAPI sInstanceInstance=null;
8 | private static NewsDetileAPI sNewsSetileInStance=null;
9 | private static final Object WATCH_DOG=new Object();
10 |
11 | private NbaplusFactory(){}
12 |
13 | public static NbaplusAPI getNbaplusInstance() {
14 | synchronized (WATCH_DOG) {
15 | if(sInstanceInstance==null){
16 | NbaplusClient nbaplusClient = new NbaplusClient();
17 | sInstanceInstance= nbaplusClient.getCilent();
18 | sNewsSetileInStance= nbaplusClient.getNewsDetileClient();
19 | }
20 | return sInstanceInstance;
21 | }
22 | }
23 |
24 | public static NewsDetileAPI getNewsDetileInstance() {
25 | synchronized (WATCH_DOG) {
26 | if(sNewsSetileInStance==null){
27 | NbaplusClient nbaplusClient = new NbaplusClient();
28 | sInstanceInstance= nbaplusClient.getCilent();
29 | sNewsSetileInStance= nbaplusClient.getNewsDetileClient();
30 | }
31 | return sNewsSetileInStance;
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/network/NewsDetileAPI.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.network;
2 |
3 | import com.me.silencedut.nbaplus.model.NewsDetile;
4 |
5 | import retrofit.http.GET;
6 | import retrofit.http.Path;
7 | import rx.Observable;
8 |
9 | /**
10 | * Created by SilenceDut on 2015/12/10.
11 | */
12 | public interface NewsDetileAPI {
13 | @GET("{date}/{detileId}")
14 | Observable getNewsDetile(@Path("date") String type,@Path("detileId") String newsId);
15 | }
16 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/rxmethod/RxGames.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.rxmethod;
2 |
3 | import com.me.silencedut.nbaplus.app.AppService;
4 | import com.me.silencedut.nbaplus.data.Constant;
5 | import com.me.silencedut.nbaplus.event.GamesEvent;
6 | import com.me.silencedut.nbaplus.model.Games;
7 |
8 | import rx.Subscription;
9 | import rx.android.schedulers.AndroidSchedulers;
10 | import rx.functions.Action1;
11 | import rx.schedulers.Schedulers;
12 |
13 | /**
14 | * Created by SilenceDut on 2015/12/26.
15 | */
16 | public class RxGames {
17 | public static Subscription getTeams(String date) {
18 |
19 | Subscription subscription = AppService.getNbaplus().getGames(date)
20 | .subscribeOn(Schedulers.io())
21 | .observeOn(AndroidSchedulers.mainThread())
22 | .subscribe(new Action1() {
23 | @Override
24 | public void call(Games games) {
25 | AppService.getBus().post(new GamesEvent(games, Constant.Result.SUCCESS));
26 | }
27 | }, new Action1() {
28 | @Override
29 | public void call(Throwable throwable) {
30 | AppService.getBus().post(new GamesEvent(null, Constant.Result.FAIL));
31 | }
32 | });
33 | return subscription;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/rxmethod/RxTeamSort.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.rxmethod;
2 |
3 | import com.me.silencedut.nbaplus.app.AppService;
4 | import com.me.silencedut.nbaplus.data.Constant;
5 | import com.me.silencedut.nbaplus.event.TeamSortEvent;
6 | import com.me.silencedut.nbaplus.model.Teams;
7 |
8 | import rx.Subscription;
9 | import rx.android.schedulers.AndroidSchedulers;
10 | import rx.functions.Action1;
11 | import rx.schedulers.Schedulers;
12 |
13 | /**
14 | * Created by SlienceDut on 2015/12/23.
15 | */
16 | public class RxTeamSort {
17 | public static Subscription getTeams() {
18 | Subscription subscription = AppService.getNbaplus().getTeamSort()
19 | .subscribeOn(Schedulers.io())
20 | .doOnNext(new Action1() {
21 | @Override
22 | public void call(Teams teams) {
23 | cacheTeams();
24 | }
25 | })
26 | .observeOn(AndroidSchedulers.mainThread())
27 | .subscribe(new Action1() {
28 | @Override
29 | public void call(Teams news) {
30 | AppService.getBus().post(new TeamSortEvent(news, Constant.Result.SUCCESS));
31 | }
32 | }, new Action1() {
33 | @Override
34 | public void call(Throwable throwable) {
35 | AppService.getBus().post(new TeamSortEvent(null, Constant.Result.FAIL));
36 | }
37 | });
38 | return subscription;
39 | }
40 |
41 | private static void cacheTeams() {
42 |
43 | }
44 | }
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/ui/activity/AboutActivity.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.ui.activity;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.view.View;
6 | import android.view.ViewTreeObserver;
7 | import android.widget.TextView;
8 |
9 | import com.me.silencedut.nbaplus.R;
10 | import com.me.silencedut.nbaplus.event.Event;
11 | import com.me.silencedut.nbaplus.ui.wigdets.RevealBackgroundView;
12 | import com.me.silencedut.nbaplus.utils.AppUtils;
13 |
14 | import butterknife.Bind;
15 | import de.psdev.licensesdialog.LicensesDialog;
16 | /**
17 | * Created by SilenceDut on 2015/9/28.
18 | */
19 | public class AboutActivity extends SwipeBackActivity implements RevealBackgroundView.OnStateChangeListener{
20 |
21 | @Bind(R.id.tv_version)
22 | TextView mVersionTextView;
23 | @Bind(R.id.revealBackgroundView)
24 | RevealBackgroundView mRevealBackgroundView;
25 | @Bind(R.id.aboutView)
26 | View aboutView;
27 |
28 | public static void navigateFrom(Context context) {
29 | Intent intent = new Intent(context, AboutActivity.class);
30 | context.startActivity(intent);
31 | }
32 |
33 |
34 | @Override
35 | protected void initViews() {
36 | super.initViews();
37 | setTitle();
38 | setupRevealBackground();
39 | }
40 |
41 | @Override
42 | void setTitle() {
43 | mToolBar.setTitle(getResources().getString(R.string.about));
44 | mVersionTextView.setText("Version " + AppUtils.getVersionName(this));
45 | }
46 |
47 | @Override
48 | protected int getContentViewId() {
49 | return R.layout.activity_about;
50 | }
51 |
52 |
53 | public void onMultipleClick(final View view) {
54 | new LicensesDialog.Builder(this)
55 | .setNotices(R.raw.notices)
56 | .setIncludeOwnLicense(true)
57 | .build()
58 | .showAppCompat();
59 | }
60 |
61 | private void setupRevealBackground() {
62 | mRevealBackgroundView.setOnStateChangeListener(this);
63 | int screenWidth = this.getWindowManager().getDefaultDisplay().getWidth();
64 | final int[] startingLocation = {screenWidth,0};
65 | mRevealBackgroundView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
66 | @Override
67 | public boolean onPreDraw() {
68 | mRevealBackgroundView.getViewTreeObserver().removeOnPreDrawListener(this);
69 | mRevealBackgroundView.startFromLocation(startingLocation);
70 | return true;
71 | }
72 | });
73 |
74 | }
75 |
76 | @Override
77 | public void onStateChange(int state) {
78 |
79 | if (RevealBackgroundView.STATE_FINISHED == state) {
80 | aboutView.setVisibility(View.VISIBLE);
81 | }else {
82 | aboutView.setVisibility(View.INVISIBLE);
83 | }
84 | }
85 |
86 |
87 | public void onEventMainThread(Event event) {
88 |
89 | }
90 |
91 | }
92 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/ui/activity/BaseActivity.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.ui.activity;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 |
6 | import com.me.silencedut.nbaplus.app.AppService;
7 | import com.me.silencedut.nbaplus.event.Event;
8 |
9 | import butterknife.ButterKnife;
10 |
11 | /**
12 | * Created by SilenceDut on 2015/11/28.
13 | */
14 | public abstract class BaseActivity extends AppCompatActivity {
15 |
16 | protected abstract void initViews();
17 | protected abstract int getContentViewId();
18 |
19 | @Override
20 | protected void onCreate(Bundle savedInstanceState) {
21 | super.onCreate(savedInstanceState);
22 | setContentView(getContentViewId());
23 | AppService.getInstance().addCompositeSub(getTaskId());
24 | AppService.getBus().register(this);
25 | ButterKnife.bind(this);
26 | initViews();
27 | }
28 |
29 | @Override
30 | protected void onDestroy() {
31 | super.onDestroy();
32 | AppService.getInstance().removeCompositeSub(getTaskId());
33 | AppService.getBus().unregister(this);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/ui/activity/SwipeBackActivity.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.ui.activity;
2 |
3 | import android.support.v7.widget.Toolbar;
4 | import android.view.View;
5 |
6 | import com.me.silencedut.nbaplus.R;
7 | import com.me.silencedut.nbaplus.ui.wigdets.SwipeBackLayout;
8 |
9 | import butterknife.Bind;
10 |
11 | /**
12 | * Created by SilenceDut on 2015/12/8.
13 | */
14 | public abstract class SwipeBackActivity extends BaseActivity {
15 | @Bind(R.id.swipBackLayout)
16 | SwipeBackLayout mSwipeBackLayout;
17 | @Bind(R.id.toolbar)
18 | Toolbar mToolBar;
19 |
20 |
21 | abstract void setTitle();
22 |
23 | @Override
24 | protected void initViews() {
25 |
26 | initToolBar();
27 | mSwipeBackLayout.setCallBack(new SwipeBackLayout.CallBack() {
28 | @Override
29 | public void onFinish() {
30 | finish();
31 | }
32 | });
33 |
34 | }
35 |
36 | protected void initToolBar() {
37 | setTitle();
38 | setSupportActionBar(mToolBar);
39 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
40 | mToolBar.setNavigationOnClickListener(new View.OnClickListener() {
41 | @Override
42 | public void onClick(View v) {
43 | onBackPressed();
44 | }
45 | });
46 |
47 | }
48 |
49 |
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/ui/adapter/FragmentAdapter/FragmentSortAdapter.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.ui.adapter.FragmentAdapter;
2 |
3 | import android.support.v4.app.Fragment;
4 | import android.support.v4.app.FragmentManager;
5 | import android.support.v4.app.FragmentStatePagerAdapter;
6 |
7 | import com.me.silencedut.nbaplus.ui.fragment.base.BaseFragment;
8 |
9 | import java.util.List;
10 |
11 | public class FragmentSortAdapter extends FragmentStatePagerAdapter {
12 | private List mFragments;
13 | private List mTitles;
14 |
15 | public FragmentSortAdapter(FragmentManager fm, List fragments, List titles) {
16 | super(fm);
17 | mFragments = fragments;
18 | mTitles = titles;
19 | }
20 |
21 | @Override
22 | public Fragment getItem(int position) {
23 | return mFragments.get(position);
24 | }
25 |
26 | @Override
27 | public int getCount() {
28 | return mFragments.size();
29 | }
30 |
31 | @Override
32 | public CharSequence getPageTitle(int position) {
33 | return mTitles.get(position);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/ui/adapter/FragmentAdapter/StatPageAdapter.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.ui.adapter.FragmentAdapter;
2 |
3 | import android.support.v4.app.Fragment;
4 | import android.support.v4.app.FragmentManager;
5 | import android.support.v4.app.FragmentStatePagerAdapter;
6 |
7 | import com.me.silencedut.nbaplus.ui.fragment.playersort.BarFragment;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * Created by SlienceDut on 2015/12/16.
13 | */
14 | public class StatPageAdapter extends FragmentStatePagerAdapter {
15 |
16 | private List mBarFragments;
17 |
18 | public StatPageAdapter(FragmentManager fm, List barFragments) {
19 | super(fm);
20 | this.mBarFragments=barFragments;
21 | }
22 |
23 | @Override
24 | public Fragment getItem(int position) {
25 | return mBarFragments.get(position);
26 | }
27 |
28 | @Override
29 | public int getCount() {
30 | return mBarFragments.size();
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/ui/adapter/RecycleAdapter/BlogAdapter.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.ui.adapter.RecycleAdapter;
2 |
3 | import android.content.Context;
4 | import android.util.TypedValue;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.ImageView;
8 | import android.widget.TextView;
9 |
10 | import com.bumptech.glide.Glide;
11 | import com.me.silencedut.nbaplus.R;
12 | import com.me.silencedut.nbaplus.model.News;
13 |
14 | import org.joda.time.DateTime;
15 |
16 | import java.util.List;
17 |
18 | import butterknife.Bind;
19 | import de.hdodenhof.circleimageview.CircleImageView;
20 |
21 | /**
22 | * Created by SilenceDut on 2015/12/10.
23 | */
24 | public class BlogAdapter extends LoadAdapter {
25 |
26 | public BlogAdapter(Context context,List newsList) {
27 | super(context,newsList);
28 | setAnimateEndCount(1);
29 | }
30 |
31 | @Override
32 | public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
33 | LoadAdapter.BaseViewHolder viewHolder=null;
34 | switch (VIEWTYPE.values()[viewType]) {
35 | case LOADMORE:
36 | viewHolder= new LoadMoreViewHolder(mInflater.inflate(R.layout.item_fragment_news_load_more, parent,false));break;
37 | case NOPIC:
38 | viewHolder= new NormalBlogViewHolder(mInflater.inflate(R.layout.item_fragment_blog_normal, parent, false),false);break;
39 | case NORMAL:
40 | viewHolder= new NormalBlogViewHolder(mInflater.inflate(R.layout.item_fragment_blog_normal, parent, false),true);break;
41 | default:
42 | break;
43 | }
44 | return viewHolder;
45 | }
46 |
47 | class NormalBlogViewHolder extends EntityHolder {
48 |
49 | @Bind(R.id.newsImage)
50 | ImageView mNewsImage;
51 | @Bind(R.id.newsTitle)
52 | TextView mNwsTitle;
53 | @Bind(R.id.newsTime) TextView mNewsTime;
54 | @Bind(R.id.description) TextView description;
55 | @Bind(R.id.profile_image)
56 | CircleImageView profileImage;
57 | @Bind(R.id.author) TextView author;
58 | View itemView;
59 | boolean hasImage=true;
60 | String showTime;
61 | public NormalBlogViewHolder(View view,Boolean hasImage) {
62 | super(view);
63 | itemView = view;
64 | this.hasImage = hasImage;
65 | if (!hasImage) {
66 | mNewsImage.setVisibility(View.GONE);
67 | description.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
68 | }
69 |
70 | }
71 | @Override
72 | protected void update(int position) {
73 | super.update(position);
74 | boolean isZhangJiaWei = newEntity.getContentSourceName().equals("张佳玮的博客");
75 | if(hasImage) {
76 | mNewsImage.setVisibility(View.VISIBLE);
77 | Glide.with(mContext).load(newEntity.getImgUrlList().get(0))
78 | .placeholder(R.mipmap.placeholder_biger)
79 | .into(mNewsImage);
80 | }
81 | profileImage.setImageResource(isZhangJiaWei ? R.mipmap.zhangjiawei : R.mipmap.suqun);
82 | author.setText(isZhangJiaWei ? "张佳玮 " : "苏群 ");
83 | mNwsTitle.setText(newEntity.getTitle());
84 | showTime = new DateTime(Long.parseLong(newEntity.getPutdate())).toString("yyyy年MM月dd日");
85 | mNewsTime.setText(showTime);
86 | description.setText(newEntity.getDescription() + "......");
87 | }
88 | }
89 |
90 |
91 |
92 | }
93 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/ui/fragment/BlogFragment.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.ui.fragment;
2 |
3 | import com.me.silencedut.nbaplus.R;
4 | import com.me.silencedut.nbaplus.app.AppService;
5 | import com.me.silencedut.nbaplus.data.Constant;
6 | import com.me.silencedut.nbaplus.event.NewsEvent;
7 | import com.me.silencedut.nbaplus.ui.adapter.RecycleAdapter.BlogAdapter;
8 |
9 | /**
10 | * Created by SilenceDut on 2015/12/4.
11 | */
12 | public class BlogFragment extends NewsFragment {
13 | private static boolean mFirstAnimate=true;
14 | public static BlogFragment newInstance() {
15 | BlogFragment blogFragment;
16 | blogFragment = new BlogFragment();
17 | return blogFragment;
18 | }
19 |
20 | @Override
21 | void setAdapter() {
22 | mLoadAdapter=new BlogAdapter(getActivity(),mNewsListEntity);
23 | mNewsListView.setAdapter(mLoadAdapter);
24 | mNewsListView.setVerticalScrollBarEnabled(false);
25 | mLoadAdapter.setAnimate(mFirstAnimate);
26 | mFirstAnimate=false;
27 | initCaChe();
28 | }
29 |
30 | private void initCaChe() {
31 | AppService.getInstance().initNews(getTaskId(), Constant.NEWSTYPE.BLOG.getNewsType());
32 | }
33 |
34 | @Override
35 | public void onRefresh() {
36 | AppService.getInstance().updateNews(getTaskId(), Constant.NEWSTYPE.BLOG.getNewsType());
37 | }
38 |
39 |
40 | @Override
41 | public void onLoadMore() {
42 | if (mLoadAdapter.canLoadMore()) {
43 | mLoadAdapter.setLoading(true);
44 | mLoadAdapter.notifyItemChanged(mLoadAdapter.getItemCount() - 1);
45 | AppService.getInstance().loadMoreNews(getTaskId(),Constant.NEWSTYPE.BLOG.getNewsType(), mNewsId);
46 | }
47 | }
48 |
49 | public void onEventMainThread(NewsEvent newsEvent) {
50 | if(newsEvent!=null&&Constant.NEWSTYPE.BLOG.getNewsType().equals(newsEvent.getNewsType())) {
51 | updateView(newsEvent);
52 | }
53 | }
54 |
55 | @Override
56 | protected int getTitle() {
57 | return R.string.blog;
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/ui/fragment/TeamSortFragment.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.ui.fragment;
2 |
3 | import android.support.v7.widget.LinearLayoutManager;
4 | import android.support.v7.widget.RecyclerView;
5 |
6 | import com.me.silencedut.nbaplus.R;
7 | import com.me.silencedut.nbaplus.app.AppService;
8 | import com.me.silencedut.nbaplus.data.Constant;
9 | import com.me.silencedut.nbaplus.event.TeamSortEvent;
10 | import com.me.silencedut.nbaplus.model.Teams;
11 | import com.me.silencedut.nbaplus.ui.adapter.RecycleAdapter.TeamSortAdapter;
12 | import com.me.silencedut.nbaplus.ui.fragment.base.SwipeRefreshBaseFragment;
13 |
14 | import java.util.ArrayList;
15 | import java.util.List;
16 |
17 | import butterknife.Bind;
18 |
19 | /**
20 | * Created by SilenceDut on 2015/12/12.
21 | */
22 | public class TeamSortFragment extends SwipeRefreshBaseFragment {
23 |
24 | @Bind(R.id.rv_news)
25 | RecyclerView mTeamsListView;
26 | private TeamSortAdapter mTeamSortAdapter;
27 | protected List mTeamsSortEntity = new ArrayList<>();
28 | public static TeamSortFragment newInstance() {
29 | TeamSortFragment teamSortFragment = new TeamSortFragment();
30 | return teamSortFragment;
31 | }
32 |
33 | @Override
34 | protected int getTitle() {
35 | return R.string.sort;
36 | }
37 |
38 | @Override
39 | protected void initViews() {
40 | super.initViews();
41 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(mTeamsListView.getContext());
42 | mTeamsListView.setLayoutManager(linearLayoutManager);
43 | mTeamSortAdapter=new TeamSortAdapter(getActivity(),mTeamsSortEntity);
44 | mTeamsListView.setAdapter(mTeamSortAdapter);
45 | setRefreshing();
46 | }
47 |
48 | @Override
49 | protected int getContentViewId() {
50 | return R.layout.fragment_main;
51 | }
52 |
53 |
54 | public void onEventMainThread(TeamSortEvent teamSortEvent) {
55 | stopRefreshing();
56 | if(Constant.Result.FAIL.equals(teamSortEvent.getEventResult())){
57 | return;
58 | }
59 | mTeamsSortEntity.clear();
60 | mTeamsSortEntity.addAll(teamSortEvent.getmTeams().getTeamsort());
61 | mTeamSortAdapter.notifyDataSetChanged();
62 | }
63 |
64 | @Override
65 | public void onRefresh() {
66 | AppService.getInstance().getTeamSort(getTaskId());
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/ui/fragment/base/BaseFragment.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.ui.fragment.base;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v4.app.Fragment;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 |
10 | import com.me.silencedut.nbaplus.app.AppService;
11 |
12 | import butterknife.ButterKnife;
13 |
14 | /**
15 | * Created by SilenceDut on 2015/11/28.
16 | */
17 | public abstract class BaseFragment extends Fragment {
18 |
19 | private int mTaskId;
20 | protected View rootView;
21 | protected abstract void initViews() ;
22 |
23 | protected abstract int getContentViewId();
24 |
25 | protected int getTaskId (){
26 | return mTaskId;
27 | }
28 |
29 | @Override
30 | public void onCreate(@Nullable Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 | mTaskId=getActivity().getTaskId();
33 | AppService.getInstance().getBus().register(this);
34 |
35 | }
36 | @Nullable
37 | @Override
38 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
39 | rootView = inflater.inflate(getContentViewId(),container,false);
40 | ButterKnife.bind(this, rootView);
41 | initViews();
42 | return rootView;
43 | }
44 | @Override
45 | public void onDestroy() {
46 | super.onDestroy();
47 | AppService.getInstance().getBus().unregister(this);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/ui/fragment/base/SwipeRefreshBaseFragment.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.ui.fragment.base;
2 |
3 | import android.support.v4.widget.SwipeRefreshLayout;
4 |
5 | import com.me.silencedut.nbaplus.R;
6 |
7 | import butterknife.Bind;
8 |
9 | /**
10 | * Created by SilenceDut on 2015/11/28.
11 | */
12 | public abstract class SwipeRefreshBaseFragment extends ToorbarBaseFragment implements SwipeRefreshLayout.OnRefreshListener {
13 | @Bind(R.id.swipeRefreshLayout)
14 | protected SwipeRefreshLayout mSwipeRefreshLayout;
15 | protected void setRefreshing() {
16 | mSwipeRefreshLayout.post(new Runnable() {
17 | @Override
18 | public void run() {
19 | mSwipeRefreshLayout.setRefreshing(true);
20 | onRefresh();
21 | }
22 | });
23 | }
24 |
25 | protected boolean isRefreshing() {
26 | return mSwipeRefreshLayout.isRefreshing();
27 | }
28 |
29 | protected void stopRefreshing() {
30 | mSwipeRefreshLayout.setRefreshing(false);
31 | }
32 | @Override
33 | protected void initViews() {
34 | super.initViews();
35 | mSwipeRefreshLayout.setOnRefreshListener(this);
36 | mSwipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary, R.color.colorPrimaryLight);
37 | }
38 |
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/ui/fragment/base/ToorbarBaseFragment.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.ui.fragment.base;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.support.v7.widget.Toolbar;
5 | import android.view.Menu;
6 | import android.view.MenuInflater;
7 | import android.view.MenuItem;
8 |
9 | import com.me.silencedut.nbaplus.R;
10 | import com.me.silencedut.nbaplus.ui.activity.AboutActivity;
11 | import com.me.silencedut.nbaplus.ui.activity.SettingsActivity;
12 |
13 | import butterknife.Bind;
14 |
15 | /**
16 | * Created by SlienceDut on 2015/12/12.
17 | */
18 | public abstract class ToorbarBaseFragment extends BaseFragment {
19 | @Bind(R.id.toolbar)
20 | protected
21 | Toolbar mToolBar;
22 |
23 |
24 | protected abstract int getTitle();
25 |
26 | @Override
27 | protected void initViews() {
28 | initToolbar();
29 | setHasOptionsMenu(true);
30 |
31 | }
32 |
33 | protected void initToolbar() {
34 | ((AppCompatActivity)getActivity()).setSupportActionBar(mToolBar);
35 | ((AppCompatActivity) getActivity()).getSupportActionBar().setTitle(getTitle());
36 | mToolBar.setNavigationIcon(R.mipmap.ic_menu_white);
37 | }
38 |
39 | @Override
40 | public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
41 | super.onCreateOptionsMenu(menu, inflater);
42 | inflater.inflate(R.menu.menu_main, menu);
43 | }
44 |
45 | @Override
46 | public boolean onOptionsItemSelected(MenuItem item) {
47 | // Handle action fragment_bar item clicks here. The action fragment_bar will
48 | // automatically handle clicks on the Home/Up button, so long
49 | // as you specify a parent activity in AndroidManifest.xml.
50 | int id = item.getItemId();
51 | switch (id) {
52 | case R.id.about :
53 | AboutActivity.navigateFrom(getActivity());
54 | break;
55 | case R.id.setting:
56 | SettingsActivity.navigateFrom(getActivity());
57 | break;
58 | default:break;
59 |
60 | }
61 | return super.onOptionsItemSelected(item);
62 | }
63 |
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/ui/listener/RecyclerViewLoadMoreListener.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.ui.listener;
2 |
3 | import android.support.annotation.NonNull;
4 | import android.support.v7.widget.LinearLayoutManager;
5 | import android.support.v7.widget.RecyclerView;
6 |
7 | /**
8 | * Created by SilenceDut on 2015/12/8.
9 | */
10 | public class RecyclerViewLoadMoreListener extends RecyclerView.OnScrollListener {
11 |
12 | private LinearLayoutManager linearLayoutManager;
13 | private OnLoadMoreListener onLoadMoreListener;
14 | private int limit;
15 |
16 | public RecyclerViewLoadMoreListener(@NonNull LinearLayoutManager linearLayoutManager, @NonNull OnLoadMoreListener onLoadMoreListener, int limit) {
17 | super();
18 | this.linearLayoutManager = linearLayoutManager;
19 | this.onLoadMoreListener = onLoadMoreListener;
20 | this.limit = limit;
21 | }
22 |
23 | @Override
24 | public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
25 | if (linearLayoutManager.getItemCount() >= limit && linearLayoutManager.findLastVisibleItemPosition() == linearLayoutManager.getItemCount() - 1) { // 向下滑动,判断最后一个item是不是显示中
26 | onLoadMoreListener.onLoadMore();
27 | }
28 | }
29 |
30 | public interface OnLoadMoreListener {
31 |
32 | void onLoadMore();
33 |
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/ui/wigdets/RhythmAdapter.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.ui.wigdets;
2 |
3 | import android.content.Context;
4 | import android.support.v7.widget.CardView;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.BaseAdapter;
9 | import android.widget.RelativeLayout;
10 | import android.widget.TextView;
11 |
12 | import com.me.silencedut.nbaplus.R;
13 |
14 | public class RhythmAdapter extends BaseAdapter {
15 |
16 | /**
17 | * item的宽度
18 | */
19 | private float itemWidth;
20 | /**
21 | * 数据源
22 | */
23 | private int[] mColorList;
24 | private static final String[] sStatNames={"得分","篮板","助攻","抢断","盖帽"};
25 | private LayoutInflater mInflater;
26 | private Context mContext;
27 |
28 |
29 | public RhythmAdapter(Context context, int[] colorList) {
30 | this.mContext = context;
31 | this.mColorList=colorList;
32 | if (context != null)
33 | this.mInflater = LayoutInflater.from(context);
34 | }
35 |
36 | public int getCount() {
37 | return this.mColorList.length;
38 | }
39 |
40 | public Object getItem(int position) {
41 | return this.mColorList[position];
42 | }
43 |
44 | @Override
45 | public long getItemId(int position) {
46 | return position;
47 | }
48 |
49 |
50 | @Override
51 | public View getView(int position, View convertView, ViewGroup parent) {
52 | RelativeLayout relativeLayout = (RelativeLayout) this.mInflater.inflate(R.layout.adapter_rhythm_icon, null);
53 |
54 | //设置item布局的大小以及Y轴的位置
55 | relativeLayout.setLayoutParams(new RelativeLayout.LayoutParams((int) itemWidth, mContext.getResources().getDimensionPixelSize(R.dimen.rhythm_item_height)));
56 | relativeLayout.setTranslationY(itemWidth*3/7);
57 |
58 | //设置第二层RelativeLayout布局的宽和高
59 | RelativeLayout childRelativeLayout = (RelativeLayout) relativeLayout.getChildAt(0);
60 | CardView cardRhythm = (CardView)relativeLayout.findViewById(R.id.card_rhythm);
61 | TextView statName=(TextView)relativeLayout.findViewById(R.id.stat_name);
62 | cardRhythm.setCardBackgroundColor(mColorList[position]);
63 | statName.setText(sStatNames[position]);
64 | int relativeLayoutWidth = (int) itemWidth - 2 * mContext.getResources().getDimensionPixelSize(R.dimen.rhythm_icon_margin);
65 | childRelativeLayout.setLayoutParams(new RelativeLayout.LayoutParams(relativeLayoutWidth, mContext.getResources().getDimensionPixelSize(R.dimen.rhythm_item_height) - 2 * mContext.getResources().getDimensionPixelSize(R.dimen.rhythm_icon_margin)));
66 | return relativeLayout;
67 | }
68 |
69 | public void notifyDataSetChanged() {
70 | super.notifyDataSetChanged();
71 | }
72 |
73 | /**
74 | * 设置每个item的宽度
75 | */
76 | public void setItemWidth(float width) {
77 | this.itemWidth = width;
78 | }
79 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/utils/AppUtils.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.utils;
2 |
3 | import android.content.Context;
4 | import android.content.pm.PackageManager;
5 | import android.content.res.Resources;
6 | import android.graphics.Color;
7 | import android.support.design.widget.Snackbar;
8 | import android.view.View;
9 | import android.widget.TextView;
10 |
11 | import com.me.silencedut.nbaplus.R;
12 | import com.me.silencedut.nbaplus.app.App;
13 |
14 |
15 |
16 | /**
17 | * Created by SilenceDut on 2015/12/11.
18 | */
19 | public class AppUtils {
20 |
21 | public static String getVersionName(Context context) {
22 | String versionName = null;
23 | try {
24 | versionName = context.getApplicationContext().getPackageManager()
25 | .getPackageInfo(context.getApplicationContext().getPackageName(), 0).versionName;
26 | } catch (PackageManager.NameNotFoundException e) {
27 | e.printStackTrace();
28 | }
29 | return versionName;
30 | }
31 |
32 |
33 | public static void showSnackBar(View view,int id) {
34 | Resources resources =App.getContext().getResources();
35 | Snackbar sb = Snackbar.make(view, resources.getString(id), Snackbar.LENGTH_SHORT);
36 | setSnackbarMessageTextColor(sb);
37 | sb.getView().setBackgroundColor(resources.getColor( R.color.main_bg));
38 | sb.show();
39 | }
40 |
41 | public static void setSnackbarMessageTextColor(Snackbar snackbar) {
42 | View view = snackbar.getView();
43 | ((TextView) view.findViewById(R.id.snackbar_text)).setTextColor(Color.parseColor("#448AFF"));
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/utils/DateFormatter.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.utils;
2 |
3 | import android.text.TextUtils;
4 |
5 | import org.joda.time.DateTime;
6 |
7 | import java.util.Date;
8 |
9 |
10 | /**
11 | * Created by SlienceDut on 2015/12/9.
12 | */
13 | public class DateFormatter {
14 |
15 | public static String formatDate(String format) {
16 | if(TextUtils.isEmpty(format)) {
17 | format="yyyy/MM/dd hh:mm:ss";
18 | }
19 | DateTime data = new DateTime();
20 |
21 | return data.toString(format);
22 |
23 | }
24 |
25 | private static final long minute = 60 * 1000; //分钟
26 | private static final long hour = 60 * minute; //小时
27 | private static final long day = 24 * hour; //天
28 | private static final long week = 7 * day; //周
29 | private static final long month = 31 * day; //月
30 | private static final long year = 12 * month; //年
31 |
32 | public static String getRecentlyTimeFormatText(DateTime date) {
33 | if (date == null) {
34 | return null;
35 | }
36 | long diff = new Date().getTime() - date.getMillis();
37 | long r = 0;
38 | if (diff > year) {
39 |
40 | return date.toString("yyyy年MM月dd日");
41 | }
42 | if (diff > day) {
43 |
44 | return date.toString("MM月dd日");
45 | }
46 | if (diff > hour) {
47 | r = (diff / hour);
48 | return r + "小时前";
49 | }
50 | if (diff > minute) {
51 | r = (diff / minute);
52 | return r + "分钟前";
53 | }
54 | return "刚刚";
55 | }
56 |
57 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/utils/LollipopUtils.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.utils;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.os.Build;
6 | import android.util.Log;
7 | import android.view.View;
8 | import android.view.Window;
9 | import android.view.WindowManager;
10 | /**
11 | * Created by SlienceDut on 2015/12/4.
12 | */
13 | public class LollipopUtils {
14 |
15 | public static int getStatusBarHeight(Context context) {
16 | Context appContext = context.getApplicationContext();
17 | int result = 0;
18 | int resourceId =
19 | appContext.getResources().getIdentifier("status_bar_height", "dimen", "android");
20 | if (resourceId > 0) {
21 | result = appContext.getResources().getDimensionPixelSize(resourceId);
22 | }
23 | Log.d("ScreenUtils", result + "");
24 | return result;
25 | }
26 |
27 | public static void setStatusBarColor(Activity activity,int statusBarColor) {
28 |
29 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
30 | // If both system bars are black, we can remove these from our layout,
31 | // removing or shrinking the SurfaceFlinger overlay required for our views.
32 |
33 | Window window = activity.getWindow();
34 | window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
35 | window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
36 | window.setStatusBarColor(statusBarColor);
37 | }
38 | }
39 |
40 | public static void setStatusbarColor(Activity activity, View holder) {
41 |
42 | //对于Lollipop 的设备,只需要在style.xml中设置colorPrimaryDark即可
43 |
44 | //对于4.4的设备,如下设置padding即可,颜色同样在style.xml中配置
45 | Window w = activity.getWindow();
46 | if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
47 | w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
48 | WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
49 | int statusBarHeight = getStatusBarHeight(activity);
50 | holder.setPadding(0, statusBarHeight, 0, 0);
51 | return;
52 | }
53 | }
54 |
55 | public static void hideStatusbar(Activity activity) {
56 |
57 | //对于Lollipop的设备,只需要在style.xml中设置colorPrimaryDark即可
58 |
59 | //对于4.4的设备,如下即可
60 | Window w = activity.getWindow();
61 |
62 | if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
63 | w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
64 | WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
65 | return;
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/utils/NumericalUtil.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.utils;
2 |
3 | import android.content.Context;
4 | import android.content.res.Resources;
5 | import android.graphics.Point;
6 | import android.os.Build;
7 | import android.view.Display;
8 | import android.view.WindowManager;
9 |
10 | /**
11 | * Created by SlienceDut on 2015/12/9.
12 | */
13 | public class NumericalUtil {
14 | private static int screenWidth = 0;
15 | private static int screenHeight = 0;
16 |
17 | public static int dp2px(int dp) {
18 | return (int) (dp * Resources.getSystem().getDisplayMetrics().density);
19 | }
20 |
21 | public static int getScreenHeight(Context c) {
22 | if (screenHeight == 0) {
23 | WindowManager wm = (WindowManager) c.getSystemService(Context.WINDOW_SERVICE);
24 | Display display = wm.getDefaultDisplay();
25 | Point size = new Point();
26 | display.getSize(size);
27 | screenHeight = size.y;
28 | }
29 |
30 | return screenHeight;
31 | }
32 |
33 | public static int getScreenWidth(Context c) {
34 | if (screenWidth == 0) {
35 | WindowManager wm = (WindowManager) c.getSystemService(Context.WINDOW_SERVICE);
36 | Display display = wm.getDefaultDisplay();
37 | Point size = new Point();
38 | display.getSize(size);
39 | screenWidth = size.x;
40 | }
41 |
42 | return screenWidth;
43 | }
44 |
45 | public static boolean isAndroid5() {
46 | return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/utils/PreferenceUtils.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.utils;
2 |
3 | import android.content.Context;
4 | import android.content.SharedPreferences;
5 | import android.preference.PreferenceManager;
6 |
7 | /**
8 | * Created by SlienceDut on 2015/12/15.
9 | */
10 | public class PreferenceUtils {
11 |
12 |
13 |
14 | public static String getPrefString(Context context,String key, final String defaultValue) {
15 | final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
16 | return settings.getString(key, defaultValue);
17 | }
18 |
19 | public static void setPrefString(Context context, final String key, final String value) {
20 | final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
21 | settings.edit().putString(key, value).commit();
22 | }
23 |
24 | public static boolean getPrefBoolean(Context context, final String key,
25 | final boolean defaultValue) {
26 | final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
27 | return settings.getBoolean(key, defaultValue);
28 | }
29 |
30 | public static boolean hasKey(Context context, final String key) {
31 | return PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext()).contains(key);
32 | }
33 |
34 | public static void setPrefBoolean(Context context, final String key, final boolean value) {
35 | final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
36 | settings.edit().putBoolean(key, value).commit();
37 | }
38 |
39 | public static void setPrefInt(Context context, final String key, final int value) {
40 | final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
41 | settings.edit().putInt(key, value).commit();
42 | }
43 |
44 | public static int getPrefInt(Context context, final String key, final int defaultValue) {
45 | final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
46 | return settings.getInt(key, defaultValue);
47 | }
48 |
49 | public static void setPrefFloat(Context context, final String key, final float value) {
50 | final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
51 | settings.edit().putFloat(key, value).commit();
52 | }
53 |
54 | public static float getPrefFloat(Context context, final String key, final float defaultValue) {
55 | final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
56 | return settings.getFloat(key, defaultValue);
57 | }
58 |
59 | public static void setSettingLong(Context context, final String key, final long value) {
60 | final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
61 | settings.edit().putLong(key, value).commit();
62 | }
63 |
64 | public static long getPrefLong(Context context, final String key, final long defaultValue) {
65 | final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext());
66 | return settings.getLong(key, defaultValue);
67 | }
68 |
69 | public static void clearPreference(Context context, final SharedPreferences p) {
70 | final SharedPreferences.Editor editor = p.edit();
71 | editor.clear();
72 | editor.commit();
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/utils/ShareUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 Drakeet
3 | *
4 | * This file is part of Meizhi
5 | *
6 | * Meizhi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Meizhi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Meizhi. If not, see .
18 | */
19 |
20 | package com.me.silencedut.nbaplus.utils;
21 |
22 | /**
23 | * Created by SlienceDut on 2015/12/9.
24 | */
25 | public class ShareUtils {
26 |
27 | // public static void share(Context context) {
28 | // share(context, context.getString(R.string.share_text));
29 | // }
30 | //
31 | // public static void share(Context context, String extraText) {
32 | // Intent intent = new Intent(Intent.ACTION_SEND);
33 | // intent.setType("text/plain");
34 | // intent.putExtra(Intent.EXTRA_SUBJECT, context.getString(R.string.action_share));
35 | // intent.putExtra(Intent.EXTRA_TEXT, extraText);
36 | // intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
37 | // context.startActivity(
38 | // Intent.createChooser(intent, context.getString(R.string.action_share)));
39 | // }
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/java/com/me/silencedut/nbaplus/utils/blur/BitmapUtils.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus.utils.blur;
2 |
3 | import android.graphics.Bitmap;
4 | import android.graphics.Canvas;
5 | import android.graphics.Color;
6 | import android.graphics.Paint;
7 | import android.graphics.PorterDuff;
8 | import android.graphics.PorterDuffColorFilter;
9 | import android.view.View;
10 |
11 | /**
12 | * Created by SlienceDut on 2015/12/2.
13 | */
14 | public class BitmapUtils {
15 | public static Bitmap drawViewToBitmap(View view, int width, int height, int downSampling,String color) {
16 | return drawViewToBitmap(view, width, height, 0f, 0f, downSampling,color);
17 | }
18 |
19 | public static Bitmap drawViewToBitmap(View view, int width, int height, float translateX,
20 | float translateY, int downSampling,String color) {
21 | float scale = 1f / downSampling;
22 | int bmpWidth = (int) (width * scale - translateX / downSampling);
23 | int bmpHeight = (int) (height * scale - translateY / downSampling);
24 | Bitmap dest = Bitmap.createBitmap(bmpWidth, bmpHeight, Bitmap.Config.ARGB_8888);
25 | Canvas canvas = new Canvas(dest);
26 | canvas.translate(-translateX / downSampling, -translateY / downSampling);
27 | if (downSampling > 1) {
28 | canvas.scale(scale, scale);
29 | }
30 | Paint paint = new Paint();
31 | paint.setFlags(Paint.FILTER_BITMAP_FLAG | Paint.ANTI_ALIAS_FLAG);
32 | PorterDuffColorFilter filter =
33 | new PorterDuffColorFilter(Color.parseColor(color),PorterDuff.Mode.SRC_ATOP);
34 | paint.setColorFilter(filter);
35 | view.buildDrawingCache();
36 | Bitmap cache = view.getDrawingCache();
37 | canvas.drawBitmap(cache, 0, 0, paint);
38 | cache.recycle();
39 | view.destroyDrawingCache();
40 |
41 | return dest;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_card.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | -
6 |
7 |
8 |
9 |
10 |
11 |
12 | -
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_gamestatus.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
9 |
12 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bottom_shadow.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/drawable/bottom_shadow.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/btn_default_light.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/drawer_icon_about.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/drawer_icon_advice.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/drawer_icon_blog.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/drawer_icon_gamedate.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/drawer_icon_news.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/drawer_icon_setting.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/drawer_icon_sort.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/drawer_icon_summary.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/drawer_item_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/drawer_shadow.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/drawable/drawer_shadow.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/drawer_text_color.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/setting_arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/drawable/setting_arrow.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shot_item_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_detile.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
19 |
20 |
26 |
27 |
36 |
37 |
44 |
49 |
50 |
51 |
52 |
57 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_detile_noimage.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
19 |
20 |
21 |
22 |
27 |
28 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
16 |
17 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_setting.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
11 |
12 |
16 |
17 |
23 |
25 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/adapter_rhythm_icon.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
25 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/appbar_toolbar.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
20 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/barchart_one_tooltip.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/drawer_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
15 |
22 |
29 |
38 |
39 |
49 |
50 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_bar.xml:
--------------------------------------------------------------------------------
1 |
8 |
20 |
25 |
34 |
42 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
14 |
22 |
31 |
32 |
39 |
40 |
49 |
50 |
51 |
52 |
53 |
54 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
16 |
17 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_playersort.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
17 |
25 |
26 |
33 |
39 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_sort.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
12 |
13 |
20 |
21 |
30 |
31 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_team_sort.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_fragment_news_load_more.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
20 |
21 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_fragment_news_nopic.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
20 |
31 |
45 |
46 |
59 |
66 |
67 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_fragment_news_normal.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
18 |
29 |
41 |
48 |
49 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_fragment_teamsort_entity.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
16 |
17 |
23 |
24 |
33 |
34 |
41 |
42 |
49 |
56 |
63 |
70 |
71 |
72 |
78 |
79 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_fragment_teamsort_title.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/preference_category_widget.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/preference_list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
20 |
28 |
34 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/toolbar.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_date.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/applink.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/applink.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/atlanta.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/atlanta.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/boston.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/boston.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/brooklyn.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/brooklyn.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/charlotte.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/charlotte.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/chicago.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/chicago.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/cleveland.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/cleveland.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/common_icon_right_arrow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/common_icon_right_arrow.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/dallas.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/dallas.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/denver.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/denver.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/detroit.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/detroit.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/drawer_icon_about.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/drawer_icon_about.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/drawer_icon_aboutfalse.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/drawer_icon_aboutfalse.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/drawer_icon_advice.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/drawer_icon_advice.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/drawer_icon_advicefalse.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/drawer_icon_advicefalse.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/drawer_icon_blog.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/drawer_icon_blog.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/drawer_icon_blogfalse.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/drawer_icon_blogfalse.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/drawer_icon_gamedate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/drawer_icon_gamedate.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/drawer_icon_gamedatefalse.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/drawer_icon_gamedatefalse.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/drawer_icon_likes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/drawer_icon_likes.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/drawer_icon_news.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/drawer_icon_news.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/drawer_icon_newsfalse.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/drawer_icon_newsfalse.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/drawer_icon_settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/drawer_icon_settings.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/drawer_icon_settingsfalse.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/drawer_icon_settingsfalse.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/drawer_icon_sort.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/drawer_icon_sort.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/drawer_icon_sortfalse.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/drawer_icon_sortfalse.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/drawer_icon_summary.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/drawer_icon_summary.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/drawer_icon_summaryfalse.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/drawer_icon_summaryfalse.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/goldenstate.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/goldenstate.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/houston.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/houston.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_event_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/ic_event_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_menu_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/ic_menu_white.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_more_vert_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/ic_more_vert_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_refresh_white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/ic_refresh_white.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_share_white_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/ic_share_white_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_swap_horiz_white_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/ic_swap_horiz_white_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/icon_title.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/icon_title.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/indiana.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/indiana.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/laclippers.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/laclippers.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/lalakers.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/lalakers.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/main_left_header_bg.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/main_left_header_bg.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/memphis.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/memphis.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/miami.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/miami.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/milwaukee.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/milwaukee.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/minnesota.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/minnesota.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/myteam.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/myteam.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/neworleans.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/neworleans.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/newyork.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/newyork.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/notice.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/notice.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/okc.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/okc.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/orlando.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/orlando.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/phila.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/phila.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/phoenix.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/phoenix.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/placeholder_biger.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/placeholder_biger.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/placeholder_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/placeholder_small.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/play_chart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/play_chart.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/portland.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/portland.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/sacramento.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/sacramento.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/sanantonio.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/sanantonio.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/shadow_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/shadow_left.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/suqun.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/suqun.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/toronto.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/toronto.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/utah.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/utah.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/washington.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/washington.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/zhangjiawei.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/app/src/main/res/mipmap-xhdpi/zhangjiawei.webp
--------------------------------------------------------------------------------
/app/src/main/res/raw/notices.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
18 |
19 |
20 | glide
21 | https://github.com/bumptech/glide
22 | Copyright 2014 Google, Inc.
23 | Apache Software License 2.0
24 |
25 |
26 | retrofit2.0
27 | https://github.com/square/retrofit
28 | Copyright 2013 Square, Inc.
29 | Apache Software License 2.0
30 |
31 |
32 | leakcanary
33 | https://github.com/square/leakcanary
34 | Copyright 2015 Square, Inc.
35 | Apache Software License 2.0
36 |
37 |
38 | rxjava
39 | https://github.com/ReactiveX/RxJava
40 | Copyright 2013 Netflix, Inc.
41 | Apache Software License 2.0
42 |
43 |
44 | greendao
45 | https://github.com/greenrobot/greenDAO
46 |
47 | Apache Software License 2.0
48 |
49 |
50 | butterknife
51 | https://github.com/JakeWharton/butterknife
52 | Copyright 2013 Jake Wharton
53 | Apache Software License 2.0
54 |
55 |
56 |
57 | EventBus
58 | https://github.com/greenrobot/EventBus
59 |
60 | Apache Software License 2.0
61 |
62 |
63 |
64 | materialish-progress
65 | https://github.com/pnikosis/materialish-progress
66 | Copyright 2014 Nico Hormazábal
67 | Apache Software License 2.0
68 |
69 |
70 | CircleImageView
71 | https://github.com/hdodenhof/CircleImageView/
72 | Copyright 2014 - 2015 Henning Dodenhof
73 | Apache Software License 2.0
74 |
75 |
76 | Joda Time
77 | http://joda-time.sourceforge.net/
78 | Copyright 2001-2005 Stephen Colebourne
79 | Apache Software License 2.0
80 |
81 |
82 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 8dp
6 | @dimen/margin_0dp
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/settings_pref.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | - 小号
6 | - 中号
7 | - 大号
8 |
9 |
10 |
11 | - 16
12 | - 18
13 | - 20
14 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | @color/red600
5 | @color/red700
6 | @color/red400
7 | #448AFF
8 |
9 | #212121
10 | #727272
11 | #FFFFFF
12 | #8fB6B6B6
13 | #eceff1
14 | #00000000
15 |
16 | #b71c1c
17 | #c62828
18 | #D32F2F
19 | #e53935
20 | #f44336
21 | #ef5350
22 | #e57373
23 | #ef959a
24 | #ffebee
25 |
26 |
27 | #2fffffff
28 | #ffffff
29 | #fafafa
30 | #f5f5f5
31 | #eeeeee
32 | #e0e0e0
33 | #bdbdbd
34 | #616161
35 | #424242
36 | #212121
37 | #40ffffff
38 |
39 |
40 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 160dp
5 |
6 | 16dp
7 | 16dp
8 | 16dp
9 | 4dp
10 | 24dp
11 | 24dp
12 | 32dp
13 | 240dp
14 | 230dp
15 | 48dp
16 | 24dp
17 | 120dp
18 | @dimen/margin_8dp
19 | 40dp
20 | 180dp
21 | 12dp
22 | 10dp
23 | 8dp
24 | 6dp
25 | 4dp
26 | 2dp
27 | 0dp
28 |
29 | @dimen/margin_0dp
30 |
31 | 4dp
32 | 40dp
33 | 0dp
34 | 4dp
35 | 1px
36 |
37 |
38 | 8dp
39 | 50.0dip
40 | 4dp
41 | 120dp
42 | 60dp
43 | 40dp
44 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/res/values/settings_pref.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | - 小号
6 | - 中号
7 | - 大号
8 |
9 |
10 |
11 | - 16
12 | - 18
13 | - 20
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | NBAPlus
3 |
4 | 精选
5 | 推荐
6 | 更多
7 |
8 | Open navigation drawer
9 | Close navigation drawer
10 |
11 | 再按一次退出
12 | 加载成功
13 | 加载更多
14 | 加载失败
15 |
16 |
17 | 新闻
18 |
19 | 博客
20 | 排名
21 | 数据
22 | 球队排行
23 | 收藏
24 | 关于
25 | 赛程
26 | 反馈
27 | 设置
28 |
29 | 球队
30 | 球员
31 | 每日
32 | 场均
33 |
34 |
35 | NBAPlus - 最专注的NBA信息平台
36 | 介绍
37 | NBAPlus 是一款专注于NBA新闻和动态的平台 \n\n更全面、更方便、更快捷是的获取NBA资讯\n\n所有资讯均来自互联网,如有侵权,请告知!
38 | 联系
39 | silencedutchman@foxmail.com
40 | 开源协议
41 | 开放源代码许可
42 |
43 |
44 |
45 | 系统设置
46 | 其他设置
47 | LOADIMAGE
48 | 正文中加载图片
49 | 当前为自动加载正文中的图片(默认)
50 | 当前为不加载正文中的图片
51 |
52 |
53 | ACTILEFONTSIZE
54 | 正文字号
55 | 大号字体
56 | 中号字体
57 | 小号字体
58 | 清除缓存
59 | 检查更新
60 |
61 | 已清除缓存数据
62 | 我的主队
63 |
64 |
65 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
14 |
15 |
16 |
20 |
21 |
22 |
23 |
24 |
30 |
37 |
45 |
46 |
49 |
50 |
54 |
55 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/preferences.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
25 |
30 |
31 |
32 |
33 |
36 |
37 |
42 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/app/src/test/java/com/me/silencedut/nbaplus/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.me.silencedut.nbaplus;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | apply from: "buildconfig.gradle"
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.2.3'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 |
19 | maven {
20 | url "http://maven.bughd.com/public"
21 |
22 | }
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/buildconfig.gradle:
--------------------------------------------------------------------------------
1 | // model config file ,make app build.gradle clean
2 | ext {
3 | android = [
4 | AndroidBuildToolsVersion : "23.0.2",
5 | AndridMinSdkVersion : 15,
6 | AndroidTargetSdkVersion : 23,
7 | AndroidCompileSdkVersion : 23,
8 | applicationId : "me.silencedut.nbaplus",
9 | versionCode:10,
10 | versionName:"1.1.0"
11 | ]
12 |
13 | //LibrariesVersion
14 | googlesupportVersion="23.1.1"
15 |
16 | goodleDependencies =[
17 | appcompat_v7: "com.android.support:appcompat-v7:${googlesupportVersion}",
18 | design : "com.android.support:design:${googlesupportVersion}",
19 | support_v4 :"com.android.support:support-v4:${googlesupportVersion}",
20 | recyclerview_v7: "com.android.support:recyclerview-v7:${googlesupportVersion}",
21 | cardview_v7 :"com.android.support:cardview-v7:${googlesupportVersion}"
22 | ]
23 |
24 | otherDependdencies=[
25 | butterknife :"com.jakewharton:butterknife:7.0.1+",
26 | glide :"com.github.bumptech.glide:glide:3.6.1",
27 | eventbus:"de.greenrobot:eventbus:2.4.0+",
28 | materialish_progress:"com.pnikosis:materialish-progress:1.5+",
29 | circleimageview :"de.hdodenhof:circleimageview:1.3.0+",
30 | licensesdialog :"de.psdev.licensesdialog:licensesdialog:1.8.0+",
31 | fir_sdk:"im.fir:sdk:latest.integration@aar",
32 | retrofit_2_0:"com.squareup.retrofit:retrofit:2.0.0-beta2",
33 | retrofit_converter_gson:"com.squareup.retrofit:converter-gson:2.0.0-beta2",
34 | leakcanary_debug:"com.squareup.leakcanary:leakcanary-android:1.3.1",
35 | leakcanary_release:"com.squareup.leakcanary:leakcanary-android-no-op:1.3.1",
36 | adapter_rxjava:"com.squareup.retrofit:adapter-rxjava:2.0.0-beta2",
37 | rxandroid:"io.reactivex:rxandroid:1.2.1",
38 | rxjava:"io.reactivex:rxjava:1.1.6",
39 | greendao:"de.greenrobot:greendao:2.0.0",
40 | pickview:"com.brucetoo.pickview:library:1.1.1",
41 | finestwebview:"com.thefinestartist:finestwebview:1.1.2"
42 | ]
43 |
44 | }
--------------------------------------------------------------------------------
/chartlibrary/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/chartlibrary/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | def globalConfiguration = rootProject.ext.android
5 | compileSdkVersion globalConfiguration.AndroidCompileSdkVersion
6 | buildToolsVersion globalConfiguration.AndroidBuildToolsVersion
7 |
8 | defaultConfig {
9 |
10 | minSdkVersion globalConfiguration.AndridMinSdkVersion
11 | targetSdkVersion globalConfiguration.AndroidTargetSdkVersion
12 |
13 |
14 | }
15 |
16 | sourceSets {
17 | main {
18 | manifest.srcFile 'AndroidManifest.xml'
19 | java.srcDirs = ['src']
20 | resources.srcDirs = ['src']
21 | aidl.srcDirs = ['src']
22 | renderscript.srcDirs = ['src']
23 | res.srcDirs = ['res']
24 | assets.srcDirs = ['assets']
25 | }
26 |
27 | // Move the tests to tests/java, tests/res, etc...
28 | instrumentTest.setRoot('tests')
29 |
30 | // Move the build types to build-types/
31 | // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
32 | // This moves them out of them default location under src//... which would
33 | // conflict with src/ being used by the main source set.
34 | // Adding new build types or product flavors should be accompanied
35 | // by a similar customization.
36 |
37 | debug.setRoot('build-types/debug')
38 | release.setRoot('build-types/release')
39 | }
40 | }
41 |
42 | dependencies {
43 | compile 'com.android.support:support-annotations:23.1.1'
44 | }
45 |
46 |
--------------------------------------------------------------------------------
/chartlibrary/gradle.properties:
--------------------------------------------------------------------------------
1 | POM_NAME=WilliamChart Library
2 | POM_ARTIFACT_ID=williamchart
3 | POM_PACKAGING=aar
--------------------------------------------------------------------------------
/chartlibrary/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/chartlibrary/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-17
15 | android.library=true
16 |
--------------------------------------------------------------------------------
/chartlibrary/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/chartlibrary/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | 5dp
8 |
9 |
10 | 2dp
11 |
12 |
13 | 10dp
14 |
15 |
16 | 1dp
17 |
18 |
19 |
20 |
21 | 18dp
22 |
23 |
24 |
25 | 6dp
26 | 3dp
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/chartlibrary/src/com/db/chart/Tools.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 Diogo Bernardino
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.db.chart;
18 |
19 | import android.content.res.Resources;
20 | import android.graphics.Bitmap;
21 | import android.graphics.Bitmap.Config;
22 | import android.graphics.Canvas;
23 | import android.graphics.drawable.BitmapDrawable;
24 | import android.graphics.drawable.Drawable;
25 | import android.support.annotation.NonNull;
26 |
27 | public class Tools {
28 |
29 |
30 | /**
31 | * Converts dp size into pixels.
32 | *
33 | * @param dp dp size to get converted
34 | * @return Pixel size
35 | */
36 | public static float fromDpToPx(float dp) {
37 | return dp * Resources.getSystem().getDisplayMetrics().density;
38 | }
39 |
40 |
41 | /**
42 | * Converts a {@link android.graphics.drawable.Drawable} into {@link android.graphics.Bitmap}.
43 | *
44 | * @param drawable {@link android.graphics.drawable.Drawable} to be converted
45 | * @return {@link android.graphics.Bitmap} object
46 | */
47 | public static Bitmap drawableToBitmap (@NonNull Drawable drawable) {
48 |
49 | if (drawable instanceof BitmapDrawable)
50 | return ((BitmapDrawable)drawable).getBitmap();
51 |
52 | Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Config.ARGB_8888);
53 | Canvas canvas = new Canvas(bitmap);
54 | drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
55 | drawable.draw(canvas);
56 |
57 | return bitmap;
58 | }
59 |
60 |
61 | /**
62 | * Find the Greatest Common Denominator.
63 | * https://en.wikipedia.org/wiki/Euclidean_algorithm
64 | *
65 | * @param min Mininum value
66 | * @param max Maximum value
67 | * @return Greatest common denominator
68 | */
69 | public static int GCD(int min, int max) {
70 | return max==0 ? min : GCD(max, min % max);
71 | }
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/chartlibrary/src/com/db/chart/listener/OnEntryClickListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 Diogo Bernardino
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.db.chart.listener;
18 |
19 | import android.graphics.Rect;
20 |
21 | /**
22 | * Interface to define a listener when an chart entry has been clicked
23 | */
24 | public interface OnEntryClickListener{
25 |
26 | /**
27 | * Abstract method to define the code when an entry has been clicked
28 | * @param setIndex - index of the entry set clicked
29 | * @param entryIndex - index of the entry within set(setIndex)
30 | * @param rect - a Rect covering the entry area.
31 | */
32 | void onClick(int setIndex, int entryIndex, Rect rect);
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/chartlibrary/src/com/db/chart/listener/OnTooltipEventListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 Diogo Bernardino
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.db.chart.listener;
18 |
19 | import android.view.View;
20 |
21 | /**
22 | * Interface to define a listener when an chart entry has been clicked
23 | */
24 | public interface OnTooltipEventListener {
25 |
26 | void onEnter(View view);
27 | void onExit(View view);
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/chartlibrary/src/com/db/chart/model/Bar.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 Diogo Bernardino
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.db.chart.model;
18 |
19 | import android.support.annotation.NonNull;
20 |
21 |
22 | /**
23 | * Data model that represents a bar in {@link com.db.chart.view.BaseBarChartView}
24 | */
25 | public class Bar extends ChartEntry{
26 |
27 | private static final String TAG = "chart.model.Bar";
28 |
29 | private boolean mHasGradientColor;
30 | private int[] mGradientColors;
31 | private float[] mGradientPositions;
32 |
33 |
34 | /**
35 | * Constructor.
36 | *
37 | * @param label
38 | * @param value
39 | */
40 | public Bar(String label, float value){
41 | super(label, value);
42 |
43 | isVisible = true;
44 | mHasGradientColor = false;
45 | }
46 |
47 |
48 | /**
49 | * If bar has gradient fill color defined.
50 | *
51 | * @return true if gradient fill property defined.
52 | */
53 | public boolean hasGradientColor(){
54 | return mHasGradientColor;
55 | }
56 |
57 |
58 | /*
59 | * -------------
60 | * Getters
61 | * -------------
62 | */
63 |
64 | /**
65 | * Retrieve set of colors defining the gradient of bar's fill.
66 | * Gradient fill property must have been previously defined.
67 | *
68 | * @return Gradient colors array.
69 | */
70 | public int[] getGradientColors(){
71 | return mGradientColors;
72 | }
73 |
74 |
75 | /**
76 | * Retrieve set of positions to define the gradient of bar's fill.
77 | * Gradient fill property must have been previously defined.
78 | *
79 | * @return Gradient positions.
80 | */
81 | public float[] getGradientPositions(){
82 | return mGradientPositions;
83 | }
84 |
85 |
86 | /*
87 | * -------------
88 | * Setters
89 | * -------------
90 | */
91 |
92 | /**
93 | * Set gradient colors to the fill of the {@link com.db.chart.model.Bar}.
94 | *
95 | * @param colors The colors to be distributed among gradient
96 | * @param positions Position/order from which the colors will be place
97 | * @return {@link com.db.chart.model.Bar} self-reference.
98 | */
99 | public Bar setGradientColor(@NonNull int colors[], float[] positions){
100 |
101 | if(colors == null || colors.length == 0)
102 | throw new IllegalArgumentException("Colors argument can't be null or empty.");
103 |
104 | mHasGradientColor = true;
105 | mGradientColors = colors;
106 | mGradientPositions = positions;
107 | return this;
108 | }
109 |
110 | }
111 |
--------------------------------------------------------------------------------
/chartlibrary/src/com/db/chart/view/animation/easing/BaseEasingMethod.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 Diogo Bernardino
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.db.chart.view.animation.easing;
18 |
19 | /**
20 | * Interface that gives the abstract methods to any possible
21 | * interpolator/easing function
22 | */
23 | public abstract class BaseEasingMethod {
24 |
25 | public final static int ENTER = 0;
26 | public final static int UPDATE = 1;
27 | public final static int EXIT = 2;
28 |
29 | private static int mState;
30 |
31 |
32 | protected abstract float easeOut(float time);
33 | protected abstract float easeInOut(float time);
34 | protected abstract float easeIn(float time);
35 |
36 |
37 | /**
38 | * Method that gives the next interpolated value to be processed by
39 | * the {@link com.db.chart.view.animation.Animation} object.
40 | *
41 | * @param time - time normalized between 0 and 1
42 | * @return the next interpolation.
43 | */
44 | public float next(float time){
45 |
46 | if(mState == BaseEasingMethod.ENTER)
47 | return easeOut(time);
48 | else if(mState == BaseEasingMethod.UPDATE)
49 | return easeInOut(time);
50 | else if(mState == BaseEasingMethod.EXIT)
51 | return easeIn(time);
52 | return 1;
53 | }
54 |
55 | public int getState(){
56 | return mState;
57 | }
58 |
59 |
60 | /**
61 | * Whether interpolation should comply with ENTER, UPDATE, or EXIT animation.
62 | *
63 | * @param state
64 | */
65 | public void setState(int state){
66 | mState = state;
67 | }
68 |
69 | }
--------------------------------------------------------------------------------
/chartlibrary/src/com/db/chart/view/animation/easing/BounceEase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 Diogo Bernardino
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.db.chart.view.animation.easing;
18 |
19 | public class BounceEase extends BaseEasingMethod {
20 |
21 | @Override
22 | protected float easeOut(float time) {
23 |
24 | if ((time/=1) < (1/2.75f))
25 | return (7.5625f*time*time);
26 | else if (time < (2/2.75f))
27 | return (7.5625f*(time-=(1.5f/2.75f))*time + .75f);
28 | else if (time < (2.5/2.75))
29 | return (7.5625f*(time-=(2.25f/2.75f))*time + .9375f);
30 | else
31 | return (7.5625f*(time-=(2.625f/2.75f))*time + .984375f);
32 | }
33 |
34 | @Override
35 | protected float easeInOut(float time) {
36 |
37 | if (time < 0.5f)
38 | return easeIn(time * 2) * .5f;
39 | return easeOut(time * 2 - 1f) * .5f + .5f;
40 | }
41 |
42 | @Override
43 | protected float easeIn(float time) {
44 | return 1.f - easeOut(1.f - time);
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/chartlibrary/src/com/db/chart/view/animation/easing/CircEase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 Diogo Bernardino
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.db.chart.view.animation.easing;
18 |
19 | public class CircEase extends BaseEasingMethod {
20 |
21 | public CircEase() {
22 | super();
23 | }
24 |
25 | @Override
26 | protected float easeOut(float time) {
27 | return 1 * (float) Math.sqrt( 1 - ( time = time - 1) * time);
28 | }
29 |
30 | @Override
31 | protected float easeInOut(float time) {
32 |
33 | float p = time / 0.5f;
34 | if (p < 1.f)
35 | return -0.5f * ((float) Math.sqrt(1.f - p * p) - 1.f);
36 | return 0.5f * ((float) Math.sqrt(1.f - (p -= 2.f) * p) + 1.f);
37 | }
38 |
39 | @Override
40 | protected float easeIn(float time) {
41 | return -((float) Math.sqrt(1.f - time * time) - 1.f);
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/chartlibrary/src/com/db/chart/view/animation/easing/CubicEase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 Diogo Bernardino
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.db.chart.view.animation.easing;
18 |
19 | public class CubicEase extends BaseEasingMethod {
20 |
21 | public CubicEase() {
22 | super();
23 | }
24 |
25 | @Override
26 | protected float easeOut(float time) {
27 | return (float) Math.pow( time - 1, 3) + 1;
28 | }
29 |
30 | @Override
31 | protected float easeInOut(float time) {
32 |
33 | float p = time / 0.5f;
34 | if (p < 1.f)
35 | return 0.5f * p * p * p;
36 |
37 | p -= 2.f;
38 | return 0.5f * (p * p * p + 2.f);
39 | }
40 |
41 | @Override
42 | protected float easeIn(float time) {
43 | return time * time * time;
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/chartlibrary/src/com/db/chart/view/animation/easing/ElasticEase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 Diogo Bernardino
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.db.chart.view.animation.easing;
18 |
19 | public class ElasticEase extends BaseEasingMethod {
20 |
21 | public ElasticEase() {
22 | super();
23 | }
24 |
25 | @Override
26 | protected float easeOut(float time) {
27 |
28 | if (time==0) return 0; if (time==1) return 1;
29 | float p=.3f;
30 | float a=1;
31 | float s=p/4;
32 | return (a*(float)Math.pow(2,-10*time) * (float)Math.sin( (time*1-s)*(2*(float)Math.PI)/p ) + 1);
33 | }
34 |
35 | @Override
36 | protected float easeInOut(float time) {
37 |
38 | if (time == 0)
39 | return 0.f;
40 |
41 | float pos = time / 0.5f;
42 | if (pos == 2)
43 | return 1.f;
44 |
45 | float p = (.3f * 1.5f);
46 | float s = p / (2.f * (float) Math.PI) * (float) Math.asin(1.f);
47 | if (pos < 1.f)
48 | return -.5f * ((float) Math.pow(2.f, 10.f * (pos -= 1.f))
49 | * (float) Math.sin((pos * 1f - s)
50 | * (2.f * Math.PI) / p));
51 |
52 | return (float) Math.pow(2.f, -10.f * (pos -= 1.f))
53 | * (float) Math.sin((pos * 1f - s) * (2.f * Math.PI) / p) * .5f
54 | + 1.f;
55 | }
56 |
57 | @Override
58 | protected float easeIn(float time) {
59 |
60 | if (time == 0) return 0.f;
61 | if (time == 1) return 1.f;
62 | float p=.3f;
63 | float s=p/4;
64 | return - ((float) Math.pow(2, 10.f * (time -= 1.f))
65 | * (float) Math.sin( (time - s) * (2.f * Math.PI)/p ));
66 | }
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/chartlibrary/src/com/db/chart/view/animation/easing/ExpoEase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 Diogo Bernardino
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.db.chart.view.animation.easing;
18 |
19 | public class ExpoEase extends BaseEasingMethod {
20 |
21 | public ExpoEase() {
22 | super();
23 | }
24 |
25 | @Override
26 | protected float easeOut(float time) {
27 | return (time == 1) ? 1 : ( -(float) Math.pow( 2, -10 * time) + 1);
28 | }
29 |
30 | @Override
31 | protected float easeInOut(float time) {
32 |
33 | if (time == 0)
34 | return 0.f;
35 |
36 | if (time == 1f)
37 | return 1.f;
38 |
39 | float p = time / 0.5f;
40 | if (p < 1.f)
41 | return 0.5f * (float) Math.pow(2.f, 10.f * (p - 1.f));
42 |
43 | return 0.5f * ( -(float) Math.pow(2.f, -10.f * --p) + 2.f);
44 | }
45 |
46 | @Override
47 | protected float easeIn(float time) {
48 | return (time == 0.f) ? 0.f : (float) Math.pow( 2, 10.f * (time - 1.f));
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/chartlibrary/src/com/db/chart/view/animation/easing/LinearEase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 Diogo Bernardino
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.db.chart.view.animation.easing;
18 |
19 | public class LinearEase extends BaseEasingMethod {
20 |
21 | @Override
22 | protected float easeOut(float time) {
23 | return time;
24 | }
25 |
26 | @Override
27 | protected float easeInOut(float time) {
28 | return time;
29 | }
30 |
31 | @Override
32 | protected float easeIn(float time) {
33 | return time;
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/chartlibrary/src/com/db/chart/view/animation/easing/QuadEase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 Diogo Bernardino
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.db.chart.view.animation.easing;
18 |
19 | public class QuadEase extends BaseEasingMethod {
20 |
21 | public QuadEase() {
22 | super();
23 | }
24 |
25 | @Override
26 | protected float easeOut(float time) {
27 | return -time * (time - 2);
28 | }
29 |
30 | @Override
31 | protected float easeInOut(float time) {
32 |
33 | float p = time / 0.5f;
34 | if (p < 1.f)
35 | return 0.5f * p * p;
36 |
37 | return -0.5f * ((--p) * (p - 2.f) - 1.f);
38 | }
39 |
40 | @Override
41 | protected float easeIn(float time) {
42 | return time * time;
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/chartlibrary/src/com/db/chart/view/animation/easing/QuartEase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 Diogo Bernardino
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.db.chart.view.animation.easing;
18 |
19 | public class QuartEase extends BaseEasingMethod {
20 |
21 | public QuartEase() {
22 | super();
23 | }
24 |
25 | @Override
26 | protected float easeOut(float time) {
27 | return (float) -(Math.pow( time - 1, 4) - 1);
28 | }
29 |
30 | @Override
31 | protected float easeInOut(float time) {
32 |
33 | float p = time / 0.5f;
34 | if (p < 1.f)
35 | return 0.5f * p * p * p * p;
36 |
37 | p -= 2.f;
38 | return -0.5f * (p * p * p * p - 2.f);
39 | }
40 |
41 | @Override
42 | protected float easeIn(float time) {
43 | return time * time * time * time;
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/chartlibrary/src/com/db/chart/view/animation/easing/QuintEase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 Diogo Bernardino
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.db.chart.view.animation.easing;
18 |
19 | public class QuintEase extends BaseEasingMethod {
20 |
21 | public QuintEase() {
22 | super();
23 | }
24 |
25 | @Override
26 | protected float easeOut(float time) {
27 | return (float) Math.pow(time - 1, 5) + 1;
28 | }
29 |
30 | @Override
31 | protected float easeInOut(float time) {
32 |
33 | float p = time / 0.5f;
34 | if (p < 1.f)
35 | return 0.5f * p * p * p * p * p;
36 |
37 | p -= 2.f;
38 | return 0.5f * (p * p * p * p * p + 2.f);
39 | }
40 |
41 | @Override
42 | protected float easeIn(float time) {
43 | return time * time * time * time * time;
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/chartlibrary/src/com/db/chart/view/animation/easing/SineEase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 Diogo Bernardino
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.db.chart.view.animation.easing;
18 |
19 | public class SineEase extends BaseEasingMethod {
20 |
21 | public SineEase() {
22 | super();
23 | }
24 |
25 | @Override
26 | protected float easeOut(float time) {
27 | return (float)Math.sin(time * (Math.PI/2));
28 | }
29 |
30 | @Override
31 | protected float easeInOut(float time) {
32 | return -0.5f * ((float) Math.cos(Math.PI * time) - 1.f);
33 | }
34 |
35 | @Override
36 | protected float easeIn(float time) {
37 | return -(float) Math.cos(time * (Math.PI / 2.f)) + 1.f;
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/chartlibrary/src/com/db/chart/view/animation/style/BaseStyleAnimation.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2015 Diogo Bernardino
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.db.chart.view.animation.style;
18 |
19 | import com.db.chart.model.ChartSet;
20 | import com.db.chart.view.ChartView;
21 |
22 | public abstract class BaseStyleAnimation {
23 |
24 | private static final long DELAY_BETWEEN_UPDATES = 100;
25 |
26 | private ChartView mChartView;
27 |
28 | private ChartSet mSet;
29 |
30 | /** Control animation updates */
31 | final private Runnable mAnimator = new Runnable() {
32 | @Override
33 | public void run() {
34 | if(mChartView.canIPleaseAskYouToDraw()){
35 | mChartView.postInvalidate();
36 | getUpdate(mSet);
37 | }
38 | }
39 | };
40 |
41 |
42 |
43 | public void play(ChartView lineChartView, ChartSet set){
44 | mChartView = lineChartView;
45 | mSet = set;
46 | getUpdate(mSet);
47 | }
48 |
49 |
50 | private void getUpdate(ChartSet set){
51 | nextUpdate(set);
52 | mChartView.postDelayed(mAnimator, DELAY_BETWEEN_UPDATES);
53 | }
54 |
55 |
56 | protected abstract void nextUpdate(ChartSet set);
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun Nov 08 11:24:48 CST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew.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 |
--------------------------------------------------------------------------------
/greendaogeneration/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/greendaogeneration/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java'
2 |
3 | dependencies {
4 | compile fileTree(dir: 'libs', include: ['*.jar'])
5 | compile 'de.greenrobot:greendao-generator:2.0.0'
6 | }
--------------------------------------------------------------------------------
/greendaogeneration/greendaogeneration.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/greendaogeneration/src/main/java/com/greendao/DaoGeneration.java:
--------------------------------------------------------------------------------
1 | package com.greendao;
2 |
3 | import de.greenrobot.daogenerator.DaoGenerator;
4 | import de.greenrobot.daogenerator.Entity;
5 | import de.greenrobot.daogenerator.Schema;
6 |
7 | public class DaoGeneration {
8 | public static void main(String[] args) throws Exception {
9 |
10 | Schema schema = new Schema(1, "com.me.silencedut.greendao");
11 | addNews(schema);
12 | addStats(schema);
13 | new DaoGenerator().generateAll(schema, "/.../NBAPlus/app/src/main/java-gen");
14 | }
15 |
16 | public static void addNews(Schema schema) {
17 | Entity news = schema.addEntity("GreenNews");
18 | news.addIdProperty();
19 | news.addStringProperty("newslist");
20 | news.addStringProperty("type");
21 | }
22 |
23 | public static void addStats(Schema schema) {
24 | Entity stat = schema.addEntity("GreenStat");
25 | stat.addIdProperty();
26 | stat.addStringProperty("statentity");
27 | stat.addStringProperty("statkind");
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/raw/nbaplus_architecture.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/raw/nbaplus_architecture.png
--------------------------------------------------------------------------------
/screenshot/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/screenshot/1.png
--------------------------------------------------------------------------------
/screenshot/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SilenceDut/NBAPlus/2bbb39739d7fff7a9d409186199849f07c8ce8e3/screenshot/2.png
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':greendaogeneration','chartlibrary'
2 |
--------------------------------------------------------------------------------