├── .gitignore
├── .idea
├── gradle.xml
├── runConfigurations.xml
└── vcs.xml
├── README.md
├── build.gradle
├── gif
└── qr_code.png
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── notes
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── wuzhanglao
│ │ ├── adapter
│ │ ├── BaseAdapter.java
│ │ ├── ImageHolderAdapter.java
│ │ ├── LoadImageHelper.java
│ │ ├── MultiTypeAdapter.java
│ │ ├── SubMultiTypeAdapter.java
│ │ └── TextHolderAdatpter.java
│ │ ├── base
│ │ ├── BaseActivity.java
│ │ ├── BaseFragment.java
│ │ ├── DefaultToolbar.java
│ │ ├── TransparentStatusActivity.java
│ │ └── mvp
│ │ │ ├── BaseMvpModel.java
│ │ │ ├── BaseMvpPresenter.java
│ │ │ └── BaseMvpView.java
│ │ ├── bean
│ │ ├── RxBusBean.java
│ │ └── TextBean.java
│ │ ├── event
│ │ ├── BaseEvent.java
│ │ └── TextEvent.java
│ │ ├── fragment
│ │ ├── ApproveListFragment.java
│ │ ├── BannerFragment.java
│ │ ├── BaseMvpFragment.java
│ │ ├── BezierFragment.java
│ │ ├── BottomBarFragment.java
│ │ ├── CountDownFragment.java
│ │ ├── DragRefreshFragment.java
│ │ ├── FloatViewFragment.java
│ │ ├── GuaGuaKaFragment.java
│ │ ├── LearnPatternFragment.java
│ │ ├── LoadImageFragment.java
│ │ ├── NavigationFragment.java
│ │ ├── NetworkFragment.java
│ │ ├── TBHeadlineFragment.java
│ │ ├── TestMeasureLayoutFragment.java
│ │ ├── TimerViewFragment.java
│ │ ├── TranslationFragment.java
│ │ └── ViewPagerFragment.java
│ │ ├── holder
│ │ ├── EmptyViewHolder.java
│ │ ├── HeadlineHolder.java
│ │ ├── ImageHolder.java
│ │ └── TextHolder.java
│ │ ├── home
│ │ ├── HomeActivity.java
│ │ ├── HomeMvpModel.java
│ │ ├── HomeMvpPresenter.java
│ │ ├── HomeMvpView.java
│ │ ├── TestRxActivity1.java
│ │ ├── TestRxActivity2.java
│ │ ├── ThirdActivity.java
│ │ └── TransparentStatusActivity.java
│ │ ├── misc
│ │ ├── DemoActivity.java
│ │ ├── RectCornerLayout.java
│ │ ├── RoundCornerLayout.java
│ │ ├── SplashActivity.java
│ │ └── StartTempQQChatActivity.java
│ │ ├── mvp
│ │ ├── model
│ │ │ ├── HeWeatherBean.java
│ │ │ ├── HeadlineBean.java
│ │ │ └── ShanbayResp.java
│ │ ├── presenter
│ │ │ ├── ApproveListFragmentPresenter.java
│ │ │ ├── BaseMvpPresenter.java
│ │ │ ├── HighlightFragmentPresenter.java
│ │ │ ├── LoadImageFragmentPresenter.java
│ │ │ └── NetworkFragmentPresenter.java
│ │ └── view
│ │ │ ├── ApproveListFragmentView.java
│ │ │ ├── BaseMvpView.java
│ │ │ ├── HighlightFragmentView.java
│ │ │ ├── LoadImageFragmentView.java
│ │ │ └── NetworkFragmentView.java
│ │ ├── utils
│ │ ├── AppUtils.java
│ │ ├── BitmapFileCache.java
│ │ ├── GlobleConfig.java
│ │ ├── ITest.java
│ │ ├── LogUtils.java
│ │ ├── NetworkRequest.java
│ │ ├── NetworkService.java
│ │ ├── NetworkUtil.java
│ │ ├── NoteApplication.java
│ │ ├── RxBus.java
│ │ ├── ToastUtil.java
│ │ ├── UIUtils.java
│ │ ├── nine_old_android
│ │ │ ├── AnimatorProxy.java
│ │ │ ├── FloatProperty.java
│ │ │ ├── IntProperty.java
│ │ │ ├── NoSuchPropertyException.java
│ │ │ ├── PreHoneycombCompat.java
│ │ │ ├── Property.java
│ │ │ ├── ReflectiveProperty.java
│ │ │ └── ViewHelper.java
│ │ └── transformer
│ │ │ ├── BaseTransformer.java
│ │ │ ├── CubeInTransformer.java
│ │ │ ├── CubeOutTransformer.java
│ │ │ └── RotateUpTransformer.java
│ │ ├── view
│ │ ├── ExoPlayerDemo.java
│ │ ├── HorizontalProgressDemo.java
│ │ ├── PatternDemo.java
│ │ └── TimerDemo.java
│ │ └── widget
│ │ ├── ApproveListLayout.java
│ │ ├── ArrowView.java
│ │ ├── Banner.java
│ │ ├── BezierView.java
│ │ ├── BiliBiliBarrage.java
│ │ ├── BottomBar.java
│ │ ├── ClickableTextView.java
│ │ ├── CountDownView.java
│ │ ├── CustomClock.java
│ │ ├── DragRefreshLayout.java
│ │ ├── ExpandableTextView.java
│ │ ├── FloatViewLayout.java
│ │ ├── GuaGuaKa.java
│ │ ├── HighlightPhraseView.java
│ │ ├── HorizontalProgressView.java
│ │ ├── IndicatorDialog.java
│ │ ├── NumberTipView.java
│ │ ├── ProgressChartView.java
│ │ ├── RippleView.java
│ │ ├── RoundCornerLayout.java
│ │ ├── RoundDrawable.java
│ │ ├── RoundImageView.java
│ │ ├── TaobaoHeadline.java
│ │ ├── TestMeasureLayout.java
│ │ ├── TimerView.java
│ │ └── TranslationDialog.java
│ └── res
│ ├── anim
│ ├── cube_in.xml
│ ├── cube_out.xml
│ ├── headline_in.xml
│ ├── headline_out.xml
│ ├── ios_dialog_enter.xml
│ └── ios_dialog_exit.xml
│ ├── drawable
│ ├── arrow.png
│ ├── avatar.jpg
│ ├── bg_splash.xml
│ ├── bottom_dialog_cancel.xml
│ ├── bottom_dialog_option1.xml
│ ├── bottom_dialog_option13.xml
│ ├── bottom_dialog_option2.xml
│ ├── bottom_dialog_option3.xml
│ ├── btn_bg_colorfff_radius3.xml
│ ├── default_avatar.png
│ ├── default_img.jpg
│ ├── headline.jpg
│ ├── headline_title.xml
│ ├── heart.png
│ ├── ic_toolbar_share_light.xml
│ ├── icon_app.png
│ ├── icon_down.png
│ ├── icon_right.png
│ ├── icon_toolbar_back_light.xml
│ ├── icon_update.png
│ ├── img1.jpg
│ ├── img2.jpg
│ ├── img3.jpg
│ ├── img4.jpg
│ ├── mail.png
│ ├── navi_bg.jpg
│ ├── red_dot.xml
│ ├── shape_gradient_white.xml
│ ├── shape_headline.xml
│ ├── shape_white_border_with_corner.xml
│ ├── shape_white_border_with_corner2.xml
│ ├── splash_logo.png
│ └── splash_text.png
│ ├── layout
│ ├── activity_demo.xml
│ ├── activity_home.xml
│ ├── activity_splash.xml
│ ├── activity_start_temp_qq_chat.xml
│ ├── activity_test_rxbus1.xml
│ ├── activity_test_rxbus2.xml
│ ├── activity_third.xml
│ ├── activity_translucent_status.xml
│ ├── bottom_bar_view.xml
│ ├── dialog_translation.xml
│ ├── fragment_anim.xml
│ ├── fragment_approve_list.xml
│ ├── fragment_bezier.xml
│ ├── fragment_bottom_bar.xml
│ ├── fragment_bottom_dialog.xml
│ ├── fragment_countdown.xml
│ ├── fragment_drag_refresh.xml
│ ├── fragment_float_view.xml
│ ├── fragment_glide.xml
│ ├── fragment_guaguaka.xml
│ ├── fragment_highlight.xml
│ ├── fragment_learn_pattern.xml
│ ├── fragment_loadimage.xml
│ ├── fragment_navigation.xml
│ ├── fragment_network.xml
│ ├── fragment_taobao_headline.xml
│ ├── fragment_test_measure_layout.xml
│ ├── fragment_viewpager.xml
│ ├── headline_holder.xml
│ ├── image_holder.xml
│ ├── ios_bottom_dialog.xml
│ ├── ios_dialog_item.xml
│ ├── layout_center.xml
│ ├── layout_demo_exo_player.xml
│ ├── layout_demo_horizontal_progress.xml
│ ├── layout_demo_pattern.xml
│ ├── layout_demo_timer.xml
│ ├── layout_footer.xml
│ ├── layout_header.xml
│ ├── layout_toolbar_default.xml
│ ├── refresh_layout_header.xml
│ ├── taobao_headline_layout.xml
│ ├── text_holder.xml
│ └── toolbar_general.xml
│ ├── mipmap-hdpi
│ └── notes.png
│ ├── mipmap-mdpi
│ └── notes.png
│ ├── mipmap-xhdpi
│ └── notes.png
│ ├── mipmap-xxhdpi
│ └── notes.png
│ ├── mipmap-xxxhdpi
│ └── notes.png
│ ├── values-v19
│ └── styles.xml
│ ├── values-v21
│ └── styles.xml
│ └── values
│ ├── attrs.xml
│ ├── colors.xml
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle/
3 | /local.properties
4 | .idea/
5 | .DS_Store
6 | /build
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | google()
4 | jcenter()
5 | }
6 | dependencies {
7 | classpath 'com.android.tools.build:gradle:3.1.3'
8 | classpath 'com.antfortune.freeline:gradle:0.8.8'
9 | }
10 | }
11 |
12 | allprojects {
13 | repositories {
14 | google()
15 | jcenter()
16 | mavenCentral()
17 | }
18 | }
--------------------------------------------------------------------------------
/gif/qr_code.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Elder-Wu/Notes/eadf51ce3190fcf4d7724249b37b1c4e2c385cbe/gif/qr_code.png
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Elder-Wu/Notes/eadf51ce3190fcf4d7724249b37b1c4e2c385cbe/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Thu Sep 28 11:19:21 CST 2017
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-4.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 |
--------------------------------------------------------------------------------
/notes/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/notes/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 27
5 | buildToolsVersion '27.0.3'
6 | defaultConfig {
7 | applicationId "com.wuzhanglao.niubi"
8 | minSdkVersion 16
9 | targetSdkVersion 27
10 | versionCode 1
11 | versionName "1.0.0"
12 |
13 | manifestPlaceholders = [KEY_UMENG: '5810166a7666132fe5002154']
14 | }
15 |
16 | signingConfigs {
17 | release {
18 | Properties properties = new Properties()
19 | properties.load(project.rootProject.file("local.properties").newDataInputStream())
20 | if (properties.getProperty("FLAG") != null) {
21 | storeFile file(KEYSTORE_FILE)
22 | storePassword KEYSTORE_PASSWORD
23 | keyAlias KEYSTORE_ALIAS
24 | keyPassword KEYSTORE_ALIAS_PASSWORD
25 | }
26 | }
27 | }
28 |
29 | buildTypes {
30 | debug {
31 | debuggable true
32 | versionNameSuffix "-debug"
33 | applicationIdSuffix ".debug"
34 | resValue "string", "app_name", "Notes测试版"
35 | }
36 |
37 | release {
38 | debuggable false
39 | //混淆
40 | minifyEnabled true
41 | //Zipalign优化
42 | zipAlignEnabled true
43 | //移除无用的resource文件
44 | shrinkResources true
45 | //加载默认混淆配置文件
46 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
47 | //apk打包的时候需要签名
48 | signingConfig signingConfigs.release
49 |
50 | resValue "string", "app_name", "Notes正式版本"
51 | }
52 | }
53 |
54 | dexOptions {
55 | preDexLibraries true
56 | dexInProcess = true
57 | javaMaxHeapSize "4g"
58 | }
59 | }
60 |
61 | dependencies {
62 | implementation fileTree(include: ['*.jar'], dir: 'libs')
63 | // compile 'com.android.support:multidex:1.0.1'
64 | implementation 'com.android.support:cardview-v7:27.1.1'
65 | implementation 'com.android.support:support-v4:27.1.1'
66 | implementation 'com.android.support:appcompat-v7:27.1.1'
67 | implementation 'com.android.support:recyclerview-v7:27.1.1'
68 | implementation 'com.android.support:design:27.1.1'
69 | //glide
70 | implementation 'com.github.bumptech.glide:glide:4.7.1'
71 | //rxjava
72 | implementation 'io.reactivex:rxjava:1.3.0'
73 | implementation 'io.reactivex:rxandroid:1.2.1'
74 | //rx-lifecycle
75 | implementation 'com.trello:rxlifecycle:0.5.0'
76 | implementation 'com.trello:rxlifecycle-components:0.5.0'
77 | //retrofit
78 | implementation 'com.squareup.retrofit2:retrofit:2.3.0'
79 | implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
80 | implementation 'com.squareup.retrofit2:adapter-rxjava:2.3.0'
81 | //okhttp
82 | implementation 'com.squareup.okhttp3:okhttp:3.9.0'
83 | implementation 'com.squareup.okhttp3:logging-interceptor:3.9.0'
84 | //友盟统计
85 | //compile 'com.umeng.analytics:analytics:latest.integration'
86 | //监听网络状态
87 | implementation 'com.github.pwittchen:reactivenetwork:0.8.0'
88 | //event bus
89 | implementation 'org.greenrobot:eventbus:3.0.0'
90 | //logger
91 | implementation 'com.orhanobut:logger:1.15'
92 | //blur
93 | implementation 'jp.wasabeef:blurry:2.1.1'
94 | }
95 |
--------------------------------------------------------------------------------
/notes/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/wuming/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | #友盟混淆
20 | -keep public class com.wuzhanglao.niubi.R$*{
21 | public static final int *;
22 | }
23 | -keepclassmembers enum * {
24 | public static **[] values();
25 | public static ** valueOf(java.lang.Strgiing);
26 | }
27 |
28 | -dontwarn okio.**
29 | -dontwarn retrofit2.**
30 |
31 | #RxJava混淆
32 | #-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
33 | # rx.internal.util.atomic.LinkedQueueNode producerNode;
34 | #}
35 | #-keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueConsumerNodeRef {
36 | # rx.internal.util.atomic.LinkedQueueNode consumerNode;
37 | #}
38 | -keepclassmembers class rx.internal.util.unsafe.** {
39 | long producerIndex;
40 | long consumerIndex;
41 | }
42 | -dontwarn rx.internal.util.unsafe.**
43 |
--------------------------------------------------------------------------------
/notes/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
21 |
24 |
25 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
39 |
40 |
44 |
45 |
48 |
49 |
52 |
53 |
56 |
57 |
60 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/adapter/ImageHolderAdapter.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.adapter;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 | import android.view.ViewGroup;
6 |
7 | import com.wuzhanglao.niubi.R;
8 | import com.wuzhanglao.niubi.holder.ImageHolder;
9 |
10 | /*
11 | * Created by wuming on 2016/12/3.
12 | */
13 |
14 | public class ImageHolderAdapter extends BaseAdapter {
15 |
16 | public ImageHolderAdapter(Context context) {
17 | super(context);
18 | }
19 |
20 | @Override
21 | protected ImageHolder onCreateHolder(ViewGroup parent, int viewType) {
22 | return new ImageHolder(mInflater.inflate(R.layout.image_holder, parent, false));
23 | }
24 |
25 | @Override
26 | protected void onBindHolder(ImageHolder holder, int position_in_data) {
27 | final String url = getItem(position_in_data);
28 | if (position_in_data == getItemCount() - 1) {
29 | holder.line.setVisibility(View.GONE);
30 | } else {
31 | holder.line.setVisibility(View.VISIBLE);
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/adapter/LoadImageHelper.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.adapter;
2 |
3 | import android.content.Context;
4 | import android.os.Handler;
5 | import android.support.v4.widget.SwipeRefreshLayout;
6 | import android.support.v7.widget.LinearLayoutManager;
7 | import android.support.v7.widget.RecyclerView;
8 | import android.util.Log;
9 |
10 | /**
11 | * Created by wuming on 2016/12/3.
12 | */
13 |
14 | public class LoadImageHelper extends RecyclerView.OnScrollListener implements SwipeRefreshLayout.OnRefreshListener {
15 | private static final String TAG = LoadImageHelper.class.getSimpleName();
16 | private Context context;
17 | private SwipeRefreshLayout swipeRefreshLayout;
18 | private ImageHolderAdapter adapter;
19 | private RecyclerView recyclerView;
20 | private LinearLayoutManager layoutManager;
21 | private Handler handler = new Handler();
22 | private boolean isLoading = false;
23 |
24 | public LoadImageHelper(Context context) {
25 | this.context = context;
26 | }
27 |
28 | public void setSwipeRefreshLayout(SwipeRefreshLayout swipeRefreshLayout) {
29 | this.swipeRefreshLayout = swipeRefreshLayout;
30 | }
31 |
32 | public void setAdapter(ImageHolderAdapter adapter) {
33 | this.adapter = adapter;
34 | }
35 |
36 | public void setRecyclerView(RecyclerView recyclerView) {
37 | this.recyclerView = recyclerView;
38 | }
39 |
40 | public void init() {
41 | layoutManager = new LinearLayoutManager(context);
42 | recyclerView.setLayoutManager(layoutManager);
43 | recyclerView.setAdapter(adapter);
44 | recyclerView.addOnScrollListener(this);
45 | swipeRefreshLayout.setOnRefreshListener(this);
46 | }
47 |
48 | @Override
49 | public void onRefresh() {
50 | handler.postDelayed(new Runnable() {
51 | @Override
52 | public void run() {
53 | swipeRefreshLayout.setRefreshing(false);
54 | }
55 | }, 3000);
56 | }
57 |
58 | @Override
59 | public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
60 | if (layoutManager.findLastVisibleItemPosition() == adapter.getItemCount() - 1) {
61 | if (!isLoading) {
62 | isLoading = true;
63 | Log.d(TAG, "加载更多...");
64 | handler.postDelayed(new Runnable() {
65 | @Override
66 | public void run() {
67 | isLoading = false;
68 | }
69 | }, 10000);
70 | }
71 | }
72 |
73 | int a = 0;
74 |
75 | {
76 | System.out.print("");
77 | }
78 | }
79 | }
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/adapter/SubMultiTypeAdapter.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.adapter;
2 |
3 | import android.app.Activity;
4 | import android.support.annotation.NonNull;
5 | import android.view.ViewGroup;
6 |
7 | /**
8 | * Created by ming.wu@shanbay.com on 2017/6/23.
9 | */
10 |
11 | public class SubMultiTypeAdapter extends MultiTypeAdapter {
12 |
13 | public static final int Type_ITEM_A = 0x011;
14 | public static final int Type_ITEM_B = 0x022;
15 | public static final int Type_ITEM_C = 0x033;
16 |
17 | public SubMultiTypeAdapter(Activity activity) {
18 | super(activity);
19 | }
20 |
21 | /**
22 | * register sub item type here
23 | *
24 | * @param type
25 | */
26 | @Override
27 | protected void registerItemType(int type) {
28 | }
29 |
30 | public interface Callback extends MultiTypeAdapter.Callback {
31 | void onAction();
32 | }
33 |
34 | private class MultiTypeSubManager extends MultiTypeAdapter.Manager {
35 |
36 | @NonNull
37 | @Override
38 | public Class bindData() {
39 | return getClass();
40 | }
41 |
42 | @Override
43 | public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent) {
44 |
45 | return null;
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/adapter/TextHolderAdatpter.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.adapter;
2 |
3 | import android.content.Context;
4 | import android.graphics.Color;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 |
8 | import com.wuzhanglao.niubi.R;
9 | import com.wuzhanglao.niubi.bean.TextBean;
10 | import com.wuzhanglao.niubi.holder.TextHolder;
11 |
12 | /**
13 | * Created by wuming on 16/10/13.
14 | */
15 |
16 | public class TextHolderAdatpter extends BaseAdapter {
17 | private TextHolderClickListener mListener;
18 |
19 | public TextHolderAdatpter(Context context) {
20 | super(context);
21 | }
22 |
23 | @Override
24 | protected TextHolder onCreateHolder(ViewGroup parent, int viewType) {
25 | return new TextHolder(mInflater.inflate(R.layout.text_holder, parent, false));
26 | }
27 |
28 | @Override
29 | protected void onBindHolder(TextHolder holder, int position) {
30 | holder.num_tv.setText(position + 1 < 10 ? "0" + (position + 1) : "" + (position + 1));
31 | holder.title_tv.setText(getItem(position).getTitle());
32 | holder.subtitle_tv.setText(getItem(position).getSubTitle());
33 | if (position < 2) {
34 | holder.num_tv.setTextColor(Color.WHITE);
35 | holder.num_tv.setBackgroundColor(Color.parseColor("#FF1111"));
36 | } else {
37 | holder.num_tv.setTextColor(Color.DKGRAY);
38 | holder.num_tv.setBackgroundColor(Color.WHITE);
39 | }
40 | if (position + 1 == getItemCount()) {
41 | holder.line.setVisibility(View.GONE);
42 | } else {
43 | holder.line.setVisibility(View.VISIBLE);
44 | }
45 | ((ViewGroup) holder.num_tv.getParent()).setOnClickListener(new OnTextClick(position));
46 | }
47 |
48 | private class OnTextClick implements View.OnClickListener {
49 |
50 | private int position;
51 |
52 | public OnTextClick(int position) {
53 | this.position = position;
54 | }
55 |
56 | @Override
57 | public void onClick(View v) {
58 | if (mListener != null) {
59 | mListener.onTextClick(position);
60 | }
61 | }
62 | }
63 |
64 | public void setTextHolderClickListener(TextHolderClickListener listener) {
65 | this.mListener = listener;
66 | }
67 |
68 | public interface TextHolderClickListener {
69 | void onTextClick(int position);
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/base/BaseActivity.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.base;
2 |
3 | import android.os.Bundle;
4 |
5 | import com.trello.rxlifecycle.components.support.RxAppCompatActivity;
6 |
7 | /*
8 | * Created by wuming on 16/10/13.
9 | */
10 |
11 | public abstract class BaseActivity extends RxAppCompatActivity {
12 |
13 | @Override
14 | protected void onCreate(Bundle savedInstanceState) {
15 | super.onCreate(savedInstanceState);
16 | }
17 |
18 | @Override
19 | protected void onResume() {
20 | super.onResume();
21 | // MobclickAgent.onResume(this);
22 | }
23 |
24 | public void onPause() {
25 | super.onPause();
26 | // MobclickAgent.onPause(this);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/base/BaseFragment.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.base;
2 |
3 | import android.graphics.Color;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v4.app.Fragment;
7 | import android.view.View;
8 |
9 | /**
10 | * Created by wuming on 16/10/14.
11 | */
12 |
13 | public abstract class BaseFragment extends Fragment {
14 |
15 | @Override
16 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
17 | view.setClickable(true);
18 | view.setBackgroundColor(Color.WHITE);
19 | }
20 |
21 | @Override
22 | public void onResume() {
23 | super.onResume();
24 | // MobclickAgent.onPageStart(getClass().getSimpleName());
25 | }
26 |
27 | @Override
28 | public void onPause() {
29 | super.onPause();
30 | // MobclickAgent.onPageEnd(getClass().getSimpleName());
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/base/DefaultToolbar.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.base;
2 |
3 | import android.view.View;
4 | import android.widget.ImageView;
5 | import android.widget.TextView;
6 |
7 | import com.wuzhanglao.niubi.R;
8 |
9 | /**
10 | * Created by ming.wu@shanbay.com on 2017/6/19.
11 | */
12 |
13 | public class DefaultToolbar implements View.OnClickListener {
14 | private BaseActivity mActivity;
15 | private TextView mTvTitle;
16 | private ImageView mIvBack;
17 | private TextView mTvRightText;
18 | private ImageView mIvRightIcon;
19 |
20 | public DefaultToolbar(BaseActivity activity) {
21 | mActivity = activity;
22 | mTvTitle = (TextView) activity.findViewById(R.id.default_toolbar_title);
23 | mIvBack = (ImageView) activity.findViewById(R.id.default_toolbar_back);
24 | mTvRightText = (TextView) activity.findViewById(R.id.default_toolbar_right_text);
25 | mIvRightIcon = (ImageView) activity.findViewById(R.id.default_toolbar_right_icon);
26 |
27 | mIvBack.setOnClickListener(this);
28 | }
29 |
30 | public void setmTvTitle(CharSequence mTvTitle) {
31 | this.mTvTitle.setText(mTvTitle);
32 | }
33 |
34 | @Override
35 | public void onClick(View v) {
36 | switch (v.getId()) {
37 | case R.id.default_toolbar_back:
38 | mActivity.onBackPressed();
39 | break;
40 | }
41 | }
42 |
43 | public void hideBackIcon() {
44 | mIvBack.setVisibility(View.GONE);
45 | }
46 |
47 | public void showRightIcon(View.OnClickListener listener) {
48 | mIvRightIcon.setOnClickListener(listener);
49 | mIvRightIcon.setVisibility(View.VISIBLE);
50 | mTvRightText.setVisibility(View.GONE);
51 | }
52 |
53 | public void showRightText(String text, View.OnClickListener listener) {
54 | mIvRightIcon.setVisibility(View.GONE);
55 | mTvRightText.setText(text);
56 | mTvRightText.setOnClickListener(listener);
57 | mTvRightText.setVisibility(View.VISIBLE);
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/base/TransparentStatusActivity.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.base;
2 |
3 | import android.graphics.Color;
4 | import android.os.Build;
5 | import android.os.Bundle;
6 | import android.view.View;
7 | import android.view.WindowManager;
8 |
9 | /**
10 | * Created by ming.wu@shanbay.com on 2017/5/7.
11 | */
12 |
13 | // TODO: 2017/6/25 这里是abstract
14 | public abstract class TransparentStatusActivity extends BaseActivity {
15 | @Override
16 | protected void onCreate(Bundle savedInstanceState) {
17 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
18 | //全透明状态栏(不带阴影)
19 | getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
20 | getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
21 | getWindow().setStatusBarColor(Color.TRANSPARENT);
22 | } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
23 | //半透明状态栏(带阴影)
24 | getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
25 | }
26 | super.onCreate(savedInstanceState);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/base/mvp/BaseMvpModel.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.base.mvp;
2 |
3 | /**
4 | * create by wuzhanglao at 2017/8/30
5 | */
6 |
7 | public abstract class BaseMvpModel {
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/base/mvp/BaseMvpPresenter.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.base.mvp;
2 |
3 | public abstract class BaseMvpPresenter {
4 |
5 | private V mView;
6 | private M mModel;
7 |
8 | public final void attach() {
9 | onAttach();
10 | }
11 |
12 | public final void detach() {
13 | onDetach();
14 | mView = null;
15 | }
16 |
17 | public void onAttach() {
18 |
19 | }
20 |
21 | public void onDetach() {
22 | }
23 |
24 | public V getView() {
25 | return mView;
26 | }
27 |
28 | public void setView(V view) {
29 | mView = view;
30 | }
31 |
32 | public M getModel(){
33 | return mModel;
34 | }
35 |
36 | public void setModel(M model){
37 | mModel = model;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/base/mvp/BaseMvpView.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.base.mvp;
2 |
3 | import com.wuzhanglao.niubi.base.BaseActivity;
4 |
5 | public abstract class BaseMvpView {
6 |
7 | private BaseActivity mActivity;
8 | private T mCallback;
9 |
10 | public BaseMvpView(BaseActivity activity) {
11 | mActivity = activity;
12 | }
13 |
14 | public BaseActivity getActivity() {
15 | return mActivity;
16 | }
17 |
18 | public void setCallback(T callback) {
19 | mCallback = callback;
20 | }
21 |
22 | public T getCallback() {
23 | return mCallback;
24 | }
25 | }
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/bean/RxBusBean.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.bean;
2 |
3 | import com.google.gson.Gson;
4 |
5 | /**
6 | * Created by wuming on 2016/12/2.
7 | */
8 |
9 | public class RxBusBean {
10 | private String from;
11 | private String to;
12 | private String content;
13 |
14 | public RxBusBean() {
15 |
16 | }
17 |
18 | public RxBusBean(String from, String to, String content) {
19 | this.from = from;
20 | this.to = to;
21 | this.content = content;
22 | }
23 |
24 | public String getFrom() {
25 | return from;
26 | }
27 |
28 | public void setFrom(String from) {
29 | this.from = from;
30 | }
31 |
32 | public String getTo() {
33 | return to;
34 | }
35 |
36 | public void setTo(String to) {
37 | this.to = to;
38 | }
39 |
40 | public String getContent() {
41 | return content;
42 | }
43 |
44 | public void setContent(String content) {
45 | this.content = content;
46 | Gson gson = new Gson();
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/bean/TextBean.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.bean;
2 |
3 | /**
4 | * Created by wuming on 2016/12/6.
5 | */
6 |
7 | public class TextBean {
8 | private String title;
9 | private String subTitle;
10 |
11 | public TextBean() {
12 |
13 | }
14 |
15 | public TextBean(String title, String subTitle) {
16 | this.title = title;
17 | this.subTitle = subTitle;
18 | }
19 |
20 | public String getSubTitle() {
21 | return subTitle;
22 | }
23 |
24 | public void setSubTitle(String subTitle) {
25 | this.subTitle = subTitle;
26 | }
27 |
28 | public String getTitle() {
29 | return title;
30 | }
31 |
32 | public void setTitle(String title) {
33 | this.title = title;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/event/BaseEvent.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.event;
2 |
3 | /**
4 | * Created by ming.wu@shanbay.com on 2017/4/19.
5 | */
6 |
7 | public abstract class BaseEvent {
8 | }
9 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/event/TextEvent.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.event;
2 |
3 | /**
4 | * Created by ming.wu@shanbay.com on 2017/4/19.
5 | */
6 |
7 | public class TextEvent extends BaseEvent {
8 | private String msg;
9 |
10 | public TextEvent(String msg) {
11 | this.msg = msg;
12 | }
13 | }
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/fragment/BannerFragment.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.ImageView;
9 |
10 | import com.wuzhanglao.niubi.R;
11 | import com.wuzhanglao.niubi.base.BaseFragment;
12 | import com.wuzhanglao.niubi.widget.Banner;
13 |
14 | /**
15 | * Created by wuming on 2016/11/10.
16 | */
17 |
18 | public class BannerFragment extends BaseFragment {
19 |
20 | private Banner banner;
21 |
22 | @Nullable
23 | @Override
24 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
25 | View rootView = inflater.inflate(R.layout.fragment_viewpager, container, false);
26 | banner = (Banner) rootView.findViewById(R.id.fragment_viewpager_imagebanner);
27 | banner.addContent(getImageView(R.drawable.img1));
28 | banner.addContent(getImageView(R.drawable.img2));
29 | banner.addContent(getImageView(R.drawable.img4));
30 | banner.startScroll();
31 | return rootView;
32 | }
33 |
34 | private ImageView getImageView(int resId) {
35 | ImageView image = new ImageView(getContext());
36 | image.setImageResource(resId);
37 | ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(100, 100);
38 | image.setLayoutParams(params);
39 | return image;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/fragment/BaseMvpFragment.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 |
6 | import com.wuzhanglao.niubi.base.BaseFragment;
7 | import com.wuzhanglao.niubi.mvp.presenter.BaseMvpPresenter;
8 | import com.wuzhanglao.niubi.mvp.view.BaseMvpView;
9 |
10 | /**
11 | * Created by wuming on 16/10/19.
12 | */
13 |
14 | public abstract class BaseMvpFragment extends BaseFragment {
15 |
16 | public P presenter;
17 |
18 | @Override
19 | public void onCreate(@Nullable Bundle savedInstanceState) {
20 | super.onCreate(savedInstanceState);
21 | presenter = initPresenter();
22 | presenter.attachView((V) this);
23 | }
24 |
25 | @Override
26 | public void onDestroy() {
27 | super.onDestroy();
28 | presenter.detachView();
29 | }
30 |
31 | public abstract P initPresenter();
32 | }
33 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/fragment/BezierFragment.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | import com.wuzhanglao.niubi.R;
10 | import com.wuzhanglao.niubi.base.BaseFragment;
11 |
12 | /**
13 | * Created by wuming on 2016/11/16.
14 | */
15 |
16 | public class BezierFragment extends BaseFragment {
17 | @Nullable
18 | @Override
19 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
20 | return inflater.inflate(R.layout.fragment_bezier, container, false);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/fragment/BottomBarFragment.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | import com.wuzhanglao.niubi.R;
10 | import com.wuzhanglao.niubi.base.BaseFragment;
11 | import com.wuzhanglao.niubi.widget.BottomBar;
12 |
13 | /**
14 | * Created by wuming on 16/10/18.
15 | */
16 |
17 | public class BottomBarFragment extends BaseFragment implements View.OnClickListener {
18 |
19 | private BottomBar bottomBar;
20 |
21 | @Nullable
22 | @Override
23 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
24 | View rootView = inflater.inflate(R.layout.fragment_bottom_bar, container, false);
25 | bottomBar = (BottomBar) rootView.findViewById(R.id.fragment_bottom_bar);
26 | rootView.findViewById(R.id.fragment_bottombar_add1_btn).setOnClickListener(this);
27 | rootView.findViewById(R.id.fragment_bottombar_add10_btn).setOnClickListener(this);
28 | rootView.findViewById(R.id.fragment_bottombar_delete1_btn).setOnClickListener(this);
29 | rootView.findViewById(R.id.fragment_bottombar_deleteall_btn).setOnClickListener(this);
30 | return super.onCreateView(inflater, container, savedInstanceState);
31 | }
32 |
33 | @Override
34 | public void onClick(View v) {
35 | switch (v.getId()) {
36 | case R.id.fragment_bottombar_add1_btn:
37 | bottomBar.add();
38 | break;
39 | case R.id.fragment_bottombar_add10_btn:
40 | try {
41 | bottomBar.add(10);
42 | } catch (Exception e) {
43 | e.printStackTrace();
44 | }
45 | break;
46 | case R.id.fragment_bottombar_delete1_btn:
47 | bottomBar.delete();
48 | break;
49 | case R.id.fragment_bottombar_deleteall_btn:
50 | bottomBar.deleteAll();
51 | break;
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/fragment/CountDownFragment.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | import com.wuzhanglao.niubi.R;
10 | import com.wuzhanglao.niubi.base.BaseFragment;
11 | import com.wuzhanglao.niubi.utils.AppUtils;
12 | import com.wuzhanglao.niubi.widget.CountDownView;
13 |
14 | /**
15 | * Created by wuming on 16/10/18.
16 | */
17 |
18 | public class CountDownFragment extends BaseFragment {
19 |
20 | private CountDownView countDownView;
21 |
22 |
23 | @Nullable
24 | @Override
25 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
26 | View rootView = inflater.inflate(R.layout.fragment_countdown, container, false);
27 | countDownView = (CountDownView) rootView.findViewById(R.id.fragment_count_down);
28 | countDownView.setCountDownTimerListener(new CountDownView.CountDownTimerListener() {
29 | @Override
30 | public void onStartCount() {
31 | AppUtils.showToast("开始了");
32 | }
33 |
34 | @Override
35 | public void onFinishCount() {
36 | AppUtils.showToast("结束了");
37 | }
38 | });
39 | rootView.findViewById(R.id.fragment_count_down_start_btn).setOnClickListener(new View.OnClickListener() {
40 |
41 | @Override
42 | public void onClick(View v) {
43 | countDownView.start();
44 | }
45 | });
46 | return rootView;
47 | }
48 |
49 | @Override
50 | public void onDestroy() {
51 | super.onDestroy();
52 | countDownView.stop();
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/fragment/DragRefreshFragment.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | import com.orhanobut.logger.Logger;
10 | import com.wuzhanglao.niubi.R;
11 | import com.wuzhanglao.niubi.base.BaseFragment;
12 |
13 | /**
14 | * Created by wuming on 2016/11/14.
15 | */
16 |
17 | public class DragRefreshFragment extends BaseFragment {
18 |
19 | @Nullable
20 | @Override
21 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
22 |
23 | Logger.d("测试Logger.d(d)");
24 | Logger.t(1).d("测试Logger.d(d)");
25 | Logger.t(2).d("测试Logger.d(d)");
26 | Logger.t(3).d("测试Logger.d(d)");
27 | Logger.d("message", "测试Logger.d(message,d)");
28 | Logger.d("测试Logger.d(d)");
29 |
30 |
31 | Logger.e("测试Logger.e(e)");
32 | Logger.e("message", "测试Logger.e(message,e)");
33 |
34 |
35 | Logger.i("测试Logger.i(i)");
36 | Logger.i("message", "测试Logger.i(message,i)");
37 |
38 | Logger.json("{\"name\":\"tom\",\"sex\":\"男\",\"age\":\"24\"}");
39 | Logger.xml("\n" +
40 | " \n" +
41 | " \n" +
42 | " MARY\n" +
43 | " \n" +
44 | " \n" +
45 | " SCOTT\n" +
46 | " \n" +
47 | " ");
48 |
49 |
50 | return inflater.inflate(R.layout.fragment_drag_refresh, container, false);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/fragment/FloatViewFragment.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | import com.wuzhanglao.niubi.R;
10 | import com.wuzhanglao.niubi.base.BaseFragment;
11 |
12 | /**
13 | * Created by wuming on 2016/10/26.
14 | */
15 |
16 | public class FloatViewFragment extends BaseFragment {
17 |
18 | @Nullable
19 | @Override
20 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
21 | return inflater.inflate(R.layout.fragment_float_view,container,false);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/fragment/GuaGuaKaFragment.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | import com.wuzhanglao.niubi.R;
10 | import com.wuzhanglao.niubi.base.BaseFragment;
11 |
12 | /**
13 | * Created by wuming on 2016/11/6.
14 | */
15 |
16 | public class GuaGuaKaFragment extends BaseFragment {
17 |
18 | @Nullable
19 | @Override
20 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
21 | return inflater.inflate(R.layout.fragment_guaguaka,container,false);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/fragment/LearnPatternFragment.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.TextView;
9 |
10 | import com.wuzhanglao.niubi.R;
11 | import com.wuzhanglao.niubi.base.BaseFragment;
12 |
13 | import java.util.regex.Matcher;
14 | import java.util.regex.Pattern;
15 |
16 | /**
17 | * Created by ming.wu@shanbay.com on 2017/4/23.
18 | */
19 |
20 | public class LearnPatternFragment extends BaseFragment {
21 | @Nullable
22 | @Override
23 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
24 | View rootView = inflater.inflate(R.layout.fragment_learn_pattern,container,false);
25 | TextView textView = (TextView) rootView.findViewById(R.id.learn_pattern_result);
26 | Pattern pattern = Pattern.compile("\\*\\*[\\w\\-\\.\\s]+\\*\\*");
27 | Matcher matcher = pattern.matcher("word word is a **press**");
28 | String s = "word word is a **press**";
29 | // s.replaceAll("\"\\\\*\\\\*[\\\\w\\\\-\\\\.\\\\s]+\\\\*\\\\*\"")
30 | return rootView;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/fragment/LoadImageFragment.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v4.widget.SwipeRefreshLayout;
6 | import android.support.v7.widget.RecyclerView;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 |
11 | import com.wuzhanglao.niubi.R;
12 | import com.wuzhanglao.niubi.adapter.ImageHolderAdapter;
13 | import com.wuzhanglao.niubi.adapter.LoadImageHelper;
14 | import com.wuzhanglao.niubi.mvp.presenter.LoadImageFragmentPresenter;
15 | import com.wuzhanglao.niubi.mvp.view.LoadImageFragmentView;
16 |
17 | import java.util.ArrayList;
18 | import java.util.Collections;
19 | import java.util.List;
20 |
21 | /*
22 | * Created by wuming on 2016/12/3.
23 | */
24 |
25 | public class LoadImageFragment extends BaseMvpFragment
26 | implements LoadImageFragmentView {
27 |
28 | private LoadImageHelper mLoadImageHelper;
29 | private List mImageList = Collections.EMPTY_LIST;
30 | private ImageHolderAdapter mAdapter;
31 |
32 | @Override
33 | public LoadImageFragmentPresenter initPresenter() {
34 | return new LoadImageFragmentPresenter();
35 | }
36 |
37 | private void initData() {
38 | mImageList = new ArrayList<>();
39 | mImageList.add("https://static.baydn.com/media/media_store/image/f1672263006c6e28bb9dee7652fa4cf6.jpg");
40 | mImageList.add("https://static.baydn.com/media/media_store/image/8c997fae9ebb2b22ecc098a379cc2ca3.jpg");
41 | mImageList.add("https://static.baydn.com/media/media_store/image/2a4616f067285b4bd59fe5401cd7106b.jpeg");
42 | mImageList.add("https://static.baydn.com/media/media_store/image/b0e3ab329c8d8218d2af5c8dfdc21125.jpg");
43 | mImageList.add("https://static.baydn.com/media/media_store/image/670abb28408a9a0fc3dd9666e5ca1584.jpeg");
44 | mImageList.add("https://static.baydn.com/media/media_store/image/1e8d675468ab61f4e5bdebd4bcb5f007.jpeg");
45 | mImageList.add("https://static.baydn.com/media/media_store/image/9b2f93cbfa104dae1e67f540ff14a4c2.jpg");
46 | mImageList.add("https://static.baydn.com/media/media_store/image/f5e0631e00a09edbbf2eb21eb71b4d3c.jpeg");
47 | }
48 |
49 | @Nullable
50 | @Override
51 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
52 | View rootView = inflater.inflate(R.layout.fragment_loadimage, container, false);
53 | mAdapter = new ImageHolderAdapter(getContext());
54 | mLoadImageHelper = new LoadImageHelper(getContext());
55 | mLoadImageHelper.setSwipeRefreshLayout((SwipeRefreshLayout) rootView.findViewById(R.id.fragment_loadimage_refreshlayout));
56 | mLoadImageHelper.setRecyclerView((RecyclerView) rootView.findViewById(R.id.fragment_loadimage_rv));
57 | mLoadImageHelper.setAdapter(mAdapter);
58 | return rootView;
59 | }
60 |
61 | @Override
62 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
63 | initData();
64 | mLoadImageHelper.init();
65 | mAdapter.setDataList(mImageList);
66 | }
67 |
68 | @Override
69 | public void loadImageSuccess() {
70 |
71 | }
72 |
73 | @Override
74 | public void loadImageFailed() {
75 |
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/fragment/NavigationFragment.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v7.app.AlertDialog;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 |
10 | import com.wuzhanglao.niubi.R;
11 | import com.wuzhanglao.niubi.base.BaseFragment;
12 | import com.wuzhanglao.niubi.utils.AppUtils;
13 |
14 | /**
15 | * Created by wuming on 2016/12/2.
16 | */
17 |
18 | public class NavigationFragment extends BaseFragment implements View.OnClickListener {
19 |
20 | @Nullable
21 | @Override
22 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
23 | View rootView = inflater.inflate(R.layout.fragment_navigation, container, false);
24 | rootView.findViewById(R.id.fragment_navi_checkupdate).setOnClickListener(this);
25 | rootView.findViewById(R.id.navi_fragment_contact).setOnClickListener(this);
26 | return rootView;
27 | }
28 |
29 | @Override
30 | public void onClick(View v) {
31 | switch (v.getId()) {
32 | case R.id.navi_fragment_contact:
33 | new AlertDialog.Builder(getContext())
34 | .setTitle("个人主页")
35 | .setMessage("www.wuzhanglao.com")
36 | .setPositiveButton("确定", null).create().show();
37 | break;
38 | case R.id.fragment_navi_checkupdate:
39 | AppUtils.showToast("该功能正在完善中...");
40 | break;
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/fragment/NetworkFragment.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.TextView;
9 |
10 | import com.wuzhanglao.niubi.R;
11 | import com.wuzhanglao.niubi.mvp.presenter.NetworkFragmentPresenter;
12 | import com.wuzhanglao.niubi.mvp.view.NetworkFragmentView;
13 | import com.wuzhanglao.niubi.utils.AppUtils;
14 |
15 | /**
16 | * Created by wuming on 16/10/19.
17 | */
18 |
19 | public class NetworkFragment extends BaseMvpFragment
20 | implements View.OnClickListener, NetworkFragmentView {
21 |
22 | private TextView result;
23 |
24 | @Nullable
25 | @Override
26 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
27 | View rootView = inflater.inflate(R.layout.fragment_network, container, false);
28 | result = (TextView) rootView.findViewById(R.id.fragment_network_result_tv);
29 | rootView.findViewById(R.id.fragment_network_get_btn).setOnClickListener(this);
30 | return rootView;
31 | }
32 |
33 | @Override
34 | public void onClick(View v) {
35 | switch (v.getId()) {
36 | case R.id.fragment_network_get_btn:
37 | presenter.request("北京");
38 | break;
39 | }
40 | }
41 |
42 | @Override
43 | public NetworkFragmentPresenter initPresenter() {
44 | return new NetworkFragmentPresenter();
45 | }
46 |
47 |
48 | @Override
49 | public void requestSuccess(Object obj) {
50 | AppUtils.showToast("请求成功");
51 | }
52 |
53 | @Override
54 | public void requestFailed(String msg) {
55 | AppUtils.showToast("请求失败");
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/fragment/TBHeadlineFragment.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | import com.wuzhanglao.niubi.R;
10 | import com.wuzhanglao.niubi.base.BaseFragment;
11 | import com.wuzhanglao.niubi.mvp.model.HeadlineBean;
12 | import com.wuzhanglao.niubi.utils.AppUtils;
13 | import com.wuzhanglao.niubi.widget.TaobaoHeadline;
14 |
15 | import java.util.ArrayList;
16 | import java.util.List;
17 |
18 | /**
19 | * Created by wuming on 16/10/16.
20 | */
21 |
22 | public class TBHeadlineFragment extends BaseFragment {
23 |
24 | private TaobaoHeadline taobaoHeadline;
25 |
26 | @Nullable
27 | @Override
28 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
29 | View rootView = inflater.inflate(R.layout.fragment_taobao_headline,container,false);
30 | List data = new ArrayList<>();
31 | data.add(new HeadlineBean("热门", "袜子裤子只要998~只要998~"));
32 | data.add(new HeadlineBean("推荐", "秋冬上心,韩流服饰,一折起"));
33 | data.add(new HeadlineBean("好货", "品牌二手车"));
34 | data.add(new HeadlineBean("省钱", "MadCatz MMO7 游戏鼠标键盘套装"));
35 |
36 | taobaoHeadline = (TaobaoHeadline) rootView.findViewById(R.id.fragment_taobao_headline_headline);
37 | taobaoHeadline.setData(data);
38 | taobaoHeadline.setHeadlineClickListener(new TaobaoHeadline.HeadlineClickListener() {
39 | @Override
40 | public void onHeadlineClick(HeadlineBean bean) {
41 | AppUtils.showToast(bean.getTitle() + ":" + bean.getContent());
42 | }
43 |
44 | @Override
45 | public void onMoreClick() {
46 | AppUtils.showToast("更多");
47 | }
48 | });
49 | return rootView;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/fragment/TestMeasureLayoutFragment.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | import com.wuzhanglao.niubi.R;
10 | import com.wuzhanglao.niubi.base.BaseFragment;
11 |
12 | /**
13 | * Created by wuming on 2017/1/16.
14 | */
15 |
16 | public class TestMeasureLayoutFragment extends BaseFragment {
17 |
18 | @Nullable
19 | @Override
20 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
21 | return inflater.inflate(R.layout.fragment_test_measure_layout, container, false);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/fragment/TranslationFragment.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.fragment;
2 |
3 | /**
4 | * Created by wuming on 2016/12/2.
5 | */
6 |
7 | //public class TranslationFragment extends BaseMvpFragment
8 | // implements HighlightFragmentView {
9 | //
10 | // private static final String TAG = TranslationFragment.class.getSimpleName();
11 | // private static final String s = " Any contributions, large or small, #$% 174major 1884 features, bug fixes, additional language translations, unit/integration tests are welcomed and appreciated but will be thoroughly reviewed and discussed.";
12 | // private ClickableTextView englishText;
13 | // private TranslationDialog translationDialog;
14 | //
15 | // @Nullable
16 | // @Override
17 | // public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
18 | // View rootView = inflater.inflate(R.layout.fragment_highlight,container,false);
19 | // englishText = (ClickableTextView) rootView.findViewById(R.id.fragment_highlight_text);
20 | // englishText.setText(s);
21 | // englishText.setHighlightTextClickListener(new ClickableTextView.HighLightTextClickListener() {
22 | // @Override
23 | // public void onHighlightTextClick(String text) {
24 | // translationDialog.showLoading();
25 | // presenter.getTranslation(text);
26 | // }
27 | // });
28 | // translationDialog = new TranslationDialog(getContext());
29 | // return rootView;
30 | // }
31 | //
32 | // //获取翻译结果成功,展示查询结果
33 | // @Override
34 | // public void getTranslationSuccess(Object result) {
35 | // Log.d(TAG, result.toString());
36 | // translationDialog.showTranslation((ShanbayResp) result);
37 | // }
38 | //
39 | // //获取翻译结果失败
40 | // @Override
41 | // public void getTranslationFailed() {
42 | // translationDialog.dismiss();
43 | // if (NetworkUtil.isNetworkAvailable()) {
44 | // AppUtils.showToast("查询失败");
45 | // } else {
46 | // AppUtils.showToast("请检查网络连接");
47 | // }
48 | // }
49 | //
50 | // @Override
51 | // public HighlightFragmentPresenter initPresenter() {
52 | // return new HighlightFragmentPresenter();
53 | // }
54 | //
55 | //
56 | //}
57 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/fragment/ViewPagerFragment.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.fragment;
2 | /*
3 | * date:2017/1/22
4 | * author:wuzhanglao
5 | * website:www.wuzhanglao.com
6 | */
7 |
8 | import com.wuzhanglao.niubi.base.BaseFragment;
9 |
10 | public class ViewPagerFragment extends BaseFragment {
11 | }
12 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/holder/EmptyViewHolder.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.holder;
2 |
3 | import android.support.v7.widget.RecyclerView;
4 | import android.view.View;
5 |
6 | /**
7 | * Created on 2016/9/29.
8 | */
9 |
10 | public class EmptyViewHolder extends RecyclerView.ViewHolder {
11 | public EmptyViewHolder(View itemView) {
12 | super(itemView);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/holder/HeadlineHolder.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.holder;
2 |
3 | import android.support.v7.widget.RecyclerView;
4 | import android.view.View;
5 | import android.widget.TextView;
6 |
7 | import com.wuzhanglao.niubi.R;
8 |
9 |
10 | /**
11 | * Created by wuming on 16/10/16.
12 | */
13 |
14 | public class HeadlineHolder extends RecyclerView.ViewHolder {
15 |
16 | public TextView title;
17 | public TextView content;
18 |
19 | public HeadlineHolder(View itemView) {
20 | super(itemView);
21 | title = (TextView) itemView.findViewById(R.id.headline_title_tv);
22 | content = (TextView) itemView.findViewById(R.id.headline_content_tv);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/holder/ImageHolder.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.holder;
2 |
3 | import android.support.v7.widget.RecyclerView;
4 | import android.view.View;
5 | import android.widget.ImageView;
6 | import android.widget.TextView;
7 |
8 | import com.wuzhanglao.niubi.R;
9 |
10 |
11 | /**
12 | * Created by wuming on 2016/12/3.
13 | */
14 |
15 | public class ImageHolder extends RecyclerView.ViewHolder {
16 |
17 | public TextView title_tv;
18 | public TextView subtitle_tv;
19 | public ImageView image_iv;
20 | public View line;
21 |
22 | public ImageHolder(View itemView) {
23 | super(itemView);
24 | title_tv = (TextView) itemView.findViewById(R.id.image_hoder_title_tv);
25 | subtitle_tv = (TextView) itemView.findViewById(R.id.image_hoder_subtitle_tv);
26 | image_iv = (ImageView) itemView.findViewById(R.id.image_hoder_image_iv);
27 | line = itemView.findViewById(R.id.image_holder_line);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/holder/TextHolder.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.holder;
2 |
3 | import android.support.v7.widget.RecyclerView;
4 | import android.view.View;
5 | import android.widget.TextView;
6 |
7 | import com.wuzhanglao.niubi.R;
8 |
9 | /**
10 | * Created by wuming on 16/10/13.
11 | */
12 |
13 | public class TextHolder extends RecyclerView.ViewHolder {
14 |
15 | public TextView title_tv;
16 | public TextView subtitle_tv;
17 | public TextView num_tv;
18 | public View line;
19 |
20 | public TextHolder(View itemView) {
21 | super(itemView);
22 | num_tv = (TextView) itemView.findViewById(R.id.text_holder_num_tv);
23 | title_tv = (TextView) itemView.findViewById(R.id.text_holder_title_tv);
24 | subtitle_tv = (TextView) itemView.findViewById(R.id.text_holder_subtitle_tv);
25 | line = itemView.findViewById(R.id.text_holder_line);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/home/HomeActivity.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.home;
2 |
3 | import android.app.Activity;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.support.annotation.Nullable;
7 | import android.util.Log;
8 | import android.widget.Toast;
9 |
10 | import com.wuzhanglao.niubi.R;
11 | import com.wuzhanglao.niubi.base.DefaultToolbar;
12 | import com.wuzhanglao.niubi.utils.LogUtils;
13 | import com.wuzhanglao.niubi.utils.ToastUtil;
14 | import com.wuzhanglao.niubi.utils.UIUtils;
15 |
16 | public class HomeActivity extends TransparentStatusActivity {
17 |
18 | private HomeMvpPresenter mPresenter;
19 |
20 | @Override
21 | protected void onCreate(@Nullable Bundle savedInstanceState) {
22 | super.onCreate(savedInstanceState);
23 | setContentView(R.layout.activity_home);
24 | DefaultToolbar toolbar = new DefaultToolbar(this);
25 | toolbar.setmTvTitle("主界面");
26 | toolbar.hideBackIcon();
27 |
28 | mPresenter = new HomeMvpPresenter();
29 | mPresenter.setView(new HomeMvpView(this));
30 | mPresenter.setModel(new HomeMvpModel());
31 | mPresenter.attach();
32 | mPresenter.init();
33 |
34 | Log.d("wuming inject","123123");
35 |
36 | Toast.makeText(this,"哈哈哈",Toast.LENGTH_LONG).show();
37 | }
38 |
39 | @Override
40 | public void onBackPressed() {
41 | if (!UIUtils.isDoubleClick(2000)) {
42 | ToastUtil.showInfo("双击退出");
43 | return;
44 | }
45 | super.onBackPressed();
46 | }
47 |
48 | @Override
49 | protected void onDestroy() {
50 | super.onDestroy();
51 | mPresenter.detach();
52 | }
53 |
54 | public static void launch(Activity activity) {
55 | Intent intent = new Intent(activity, HomeActivity.class);
56 | activity.startActivity(intent);
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/home/HomeMvpModel.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.home;
2 |
3 | import com.wuzhanglao.niubi.base.mvp.BaseMvpModel;
4 |
5 | /**
6 | * create by wuzhanglao at 2017/8/30
7 | */
8 |
9 | public class HomeMvpModel extends BaseMvpModel {
10 | }
11 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/home/HomeMvpView.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.home;
2 | /*
3 | * date:2017/2/17
4 | * author:wuzhanglao
5 | * website:www.wuzhanglao.com
6 | */
7 |
8 | import android.support.v4.app.Fragment;
9 | import android.support.v4.app.FragmentManager;
10 | import android.support.v4.widget.DrawerLayout;
11 | import android.support.v7.widget.LinearLayoutManager;
12 | import android.support.v7.widget.RecyclerView;
13 |
14 | import com.wuzhanglao.niubi.R;
15 | import com.wuzhanglao.niubi.adapter.TextHolderAdatpter;
16 | import com.wuzhanglao.niubi.base.BaseActivity;
17 | import com.wuzhanglao.niubi.base.mvp.BaseMvpView;
18 | import com.wuzhanglao.niubi.bean.TextBean;
19 | import com.wuzhanglao.niubi.misc.DemoActivity;
20 | import com.wuzhanglao.niubi.view.ExoPlayerDemo;
21 |
22 | import java.util.List;
23 |
24 | public class HomeMvpView extends BaseMvpView {
25 |
26 | private TextHolderAdatpter mAdapter;
27 | private DrawerLayout mDrawerLayout;
28 |
29 | private FragmentManager mFragmentManager;
30 |
31 | public HomeMvpView(BaseActivity activity) {
32 | super(activity);
33 | mDrawerLayout = (DrawerLayout) getActivity().findViewById(R.id.activity_main_drawer);
34 | mFragmentManager = activity.getSupportFragmentManager();
35 | }
36 |
37 | public void openFragment(Fragment fragment, String fragmentName) {
38 | mFragmentManager.beginTransaction()
39 | .replace(R.id.main_container, fragment)
40 | .addToBackStack(null)
41 | .commitAllowingStateLoss();
42 | }
43 |
44 | public void setDataList(List dataList, TextHolderAdatpter.TextHolderClickListener listener) {
45 | mAdapter = new TextHolderAdatpter(getActivity());
46 | mAdapter.setTextHolderClickListener(listener);
47 | mAdapter.setDataList(dataList);
48 |
49 | RecyclerView recyclerView = (RecyclerView) getActivity().findViewById(R.id.recycler_view);
50 | recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
51 | recyclerView.setAdapter(mAdapter);
52 | }
53 |
54 | public void startDemoActivity() {
55 | DemoActivity.launch(getActivity(), new ExoPlayerDemo(getActivity()));
56 | }
57 |
58 | public interface Callback {
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/home/TestRxActivity1.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.home;
2 |
3 | import android.content.Intent;
4 | import android.os.Build;
5 | import android.os.Bundle;
6 | import android.support.annotation.Nullable;
7 | import android.view.View;
8 | import android.view.WindowManager;
9 |
10 | import com.wuzhanglao.niubi.R;
11 | import com.wuzhanglao.niubi.base.BaseActivity;
12 |
13 | /*
14 | * Created by wuming on 2016/12/2.
15 | */
16 |
17 | public class TestRxActivity1 extends BaseActivity {
18 |
19 | @Override
20 | protected void onCreate(@Nullable Bundle savedInstanceState) {
21 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
22 | getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
23 | }
24 | super.onCreate(savedInstanceState);
25 | setContentView(R.layout.activity_test_rxbus1);
26 |
27 | findViewById(R.id.activity_rxbus1_btn).setOnClickListener(new View.OnClickListener() {
28 | @Override
29 | public void onClick(View v) {
30 | Intent intent = new Intent(TestRxActivity1.this, TestRxActivity2.class);
31 | startActivity(intent);
32 | }
33 | });
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/home/TestRxActivity2.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.home;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.view.View;
7 |
8 | import com.google.gson.Gson;
9 | import com.wuzhanglao.niubi.R;
10 | import com.wuzhanglao.niubi.base.BaseActivity;
11 | import com.wuzhanglao.niubi.bean.RxBusBean;
12 | import com.wuzhanglao.niubi.utils.AppUtils;
13 | import com.wuzhanglao.niubi.utils.RxBus;
14 |
15 | import java.util.Random;
16 |
17 | /*
18 | * Created by wuming on 2016/12/2.
19 | */
20 |
21 | public class TestRxActivity2 extends BaseActivity {
22 |
23 | @Override
24 | protected void onCreate(@Nullable Bundle savedInstanceState) {
25 | super.onCreate(savedInstanceState);
26 | setContentView(R.layout.activity_test_rxbus2);
27 |
28 | findViewById(R.id.activity_rxbus2_btn).setOnClickListener(new View.OnClickListener() {
29 |
30 | @Override
31 | public void onClick(View v) {
32 | RxBusBean bean = new RxBusBean();
33 | bean.setFrom("MainActivity2");
34 | bean.setTo("MainActivity1");
35 | bean.setContent(new Random().nextInt() + "");
36 | Gson gson = new Gson();
37 | RxBus.send(gson.toJson(bean));
38 | AppUtils.showToast("消息发送成功,消息内容是:" + bean.getContent());
39 | }
40 | });
41 | findViewById(R.id.jump).setOnClickListener(new View.OnClickListener() {
42 | @Override
43 | public void onClick(View v) {
44 | Intent intent = new Intent(TestRxActivity2.this, ThirdActivity.class);
45 | intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
46 | startActivity(intent);
47 | }
48 | });
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/home/ThirdActivity.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.home;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v7.app.AppCompatActivity;
6 |
7 | import com.wuzhanglao.niubi.R;
8 |
9 | /*
10 | * date:2017/2/6
11 | * author:wuzhanglao
12 | * website:www.wuzhanglao.com
13 | */
14 |
15 | public class ThirdActivity extends AppCompatActivity {
16 | @Override
17 | protected void onCreate(@Nullable Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | setContentView(R.layout.activity_third);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/home/TransparentStatusActivity.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.home;
2 |
3 | import android.graphics.Color;
4 | import android.os.Build;
5 | import android.os.Bundle;
6 | import android.view.View;
7 | import android.view.WindowManager;
8 |
9 | import com.wuzhanglao.niubi.base.BaseActivity;
10 |
11 | /**
12 | * Created by ming.wu@shanbay.com on 2017/5/7.
13 | */
14 |
15 | public abstract class TransparentStatusActivity extends BaseActivity {
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
19 | //全透明状态栏(不带阴影)
20 | getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
21 | getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
22 | getWindow().setStatusBarColor(Color.TRANSPARENT);
23 | } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
24 | //半透明状态栏(带阴影)
25 | getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
26 | }
27 | super.onCreate(savedInstanceState);
28 | }
29 | }
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/misc/DemoActivity.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.misc;
2 |
3 | import android.app.Activity;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | import com.wuzhanglao.niubi.R;
10 | import com.wuzhanglao.niubi.base.DefaultToolbar;
11 | import com.wuzhanglao.niubi.home.TransparentStatusActivity;
12 | import com.wuzhanglao.niubi.utils.ToastUtil;
13 |
14 | /**
15 | * Created by ming.wu@shanbay.com on 2017/6/15.
16 | */
17 |
18 | public class DemoActivity extends TransparentStatusActivity {
19 |
20 | private static DemoView sDemoView;
21 |
22 | @Override
23 | protected void onCreate(Bundle savedInstanceState) {
24 | super.onCreate(savedInstanceState);
25 | setContentView(R.layout.activity_demo);
26 |
27 | DefaultToolbar toolbar = new DefaultToolbar(this);
28 | toolbar.setmTvTitle(sDemoView.getTitle());
29 | toolbar.showRightIcon(new View.OnClickListener() {
30 | @Override
31 | public void onClick(View v) {
32 | ToastUtil.showInfo("分享");
33 | }
34 | });
35 |
36 | ((ViewGroup) findViewById(R.id.demo_activity_root)).addView(sDemoView.getView());
37 | }
38 |
39 | @Override
40 | protected void onDestroy() {
41 | super.onDestroy();
42 | sDemoView = null;
43 | }
44 |
45 | public static void launch(Activity activity, DemoView demoView) {
46 | sDemoView = demoView;
47 | Intent intent = new Intent(activity, DemoActivity.class);
48 | activity.startActivity(intent);
49 | }
50 |
51 | public interface DemoView {
52 | View getView();
53 |
54 | String getTitle();
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/misc/RectCornerLayout.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.misc;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.graphics.Canvas;
6 | import android.graphics.Color;
7 | import android.graphics.Paint;
8 | import android.graphics.RectF;
9 | import android.support.annotation.NonNull;
10 | import android.support.annotation.Nullable;
11 | import android.util.AttributeSet;
12 | import android.util.TypedValue;
13 | import android.widget.FrameLayout;
14 |
15 | import com.wuzhanglao.niubi.R;
16 |
17 | /**
18 | * Created by ming.wu@shanbay.com on 2017/6/26.
19 | */
20 |
21 | public class RectCornerLayout extends FrameLayout {
22 | private static final int DEFAULT_COLOR = Color.LTGRAY;
23 | private static final int DEFAULT_RADIUS = 0;
24 |
25 | private RectF mRectF = new RectF();
26 | private Paint mPaint = new Paint();
27 |
28 | private int mCornerColor;
29 | private int mCornerRadius;
30 |
31 | public RectCornerLayout(@NonNull Context context) {
32 | this(context, null);
33 | }
34 |
35 | public RectCornerLayout(@NonNull Context context, @Nullable AttributeSet attrs) {
36 | super(context, attrs);
37 |
38 | TypedArray ta = getResources().obtainAttributes(attrs, R.styleable.cview_RectCornerLayout);
39 | mCornerColor = ta.getColor(R.styleable.cview_RectCornerLayout_cview_rectCornerColor, DEFAULT_COLOR);
40 | mCornerRadius = ta.getDimensionPixelSize(R.styleable.cview_RectCornerLayout_cview_rectCornerRadius, DEFAULT_RADIUS);
41 | ta.recycle();
42 |
43 | mPaint = new Paint();
44 | mPaint.setDither(true);
45 | mPaint.setAntiAlias(true);
46 | mPaint.setStrokeWidth(0);
47 | mPaint.setStyle(Paint.Style.FILL);
48 | mPaint.setColor(mCornerColor);
49 |
50 | setWillNotDraw(false);
51 | }
52 |
53 | @Override
54 | protected void onSizeChanged(int w, int h, int oldw, int oldh) {
55 | super.onSizeChanged(w, h, oldw, oldh);
56 | mRectF.set(0, 0, getMeasuredWidth(), getMeasuredHeight());
57 | }
58 |
59 | public void setCornerRadius(int dip) {
60 | Float value = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dip, getResources().getDisplayMetrics());
61 | mCornerRadius = value.intValue();
62 | invalidate();
63 | }
64 |
65 | public void setCornerColor(int color) {
66 | mCornerColor = color;
67 | mPaint.setColor(mCornerColor);
68 | invalidate();
69 | }
70 |
71 | @Override
72 | protected void onDraw(Canvas canvas) {
73 | canvas.drawRoundRect(mRectF, mCornerRadius, mCornerRadius, mPaint);
74 | super.onDraw(canvas);
75 | }
76 | }
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/misc/RoundCornerLayout.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.misc;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.graphics.Canvas;
6 | import android.graphics.Color;
7 | import android.graphics.Paint;
8 | import android.graphics.RectF;
9 | import android.support.annotation.NonNull;
10 | import android.support.annotation.Nullable;
11 | import android.util.AttributeSet;
12 | import android.widget.FrameLayout;
13 |
14 | import com.wuzhanglao.niubi.R;
15 |
16 | /**
17 | * Created by ming.wu@shanbay.com on 2017/6/26.
18 | */
19 |
20 | public class RoundCornerLayout extends FrameLayout {
21 | private static final int DEFAULT_COLOR = Color.LTGRAY;
22 |
23 | private RectF mRectF = new RectF();
24 | private Paint mPaint = new Paint();
25 |
26 | private int mCornerColor;
27 |
28 | public RoundCornerLayout(@NonNull Context context) {
29 | this(context, null);
30 | }
31 |
32 | public RoundCornerLayout(@NonNull Context context, @Nullable AttributeSet attrs) {
33 | super(context, attrs);
34 |
35 | TypedArray ta = getResources().obtainAttributes(attrs, R.styleable.cview_RoundCornerLayout);
36 | mCornerColor = ta.getColor(R.styleable.cview_RoundCornerLayout_cview_roundCornerColor, DEFAULT_COLOR);
37 | ta.recycle();
38 |
39 | mPaint = new Paint();
40 | mPaint.setDither(true);
41 | mPaint.setAntiAlias(true);
42 | mPaint.setStrokeWidth(0);
43 | mPaint.setStyle(Paint.Style.FILL);
44 | mPaint.setColor(mCornerColor);
45 |
46 | setWillNotDraw(false);
47 | }
48 |
49 | @Override
50 | protected void onSizeChanged(int w, int h, int oldw, int oldh) {
51 | super.onSizeChanged(w, h, oldw, oldh);
52 | mRectF.set(0, 0, getMeasuredWidth(), getMeasuredHeight());
53 | }
54 |
55 | public void setCornerColor(int color) {
56 | mCornerColor = color;
57 | mPaint.setColor(mCornerColor);
58 | invalidate();
59 | }
60 |
61 | @Override
62 | protected void onDraw(Canvas canvas) {
63 | float radius = mRectF.height() / 2.0f;
64 | canvas.drawRoundRect(mRectF, radius, radius, mPaint);
65 | super.onDraw(canvas);
66 | }
67 | }
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/misc/SplashActivity.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.misc;
2 |
3 | import android.os.Bundle;
4 |
5 | import com.wuzhanglao.niubi.base.BaseActivity;
6 | import com.wuzhanglao.niubi.home.HomeActivity;
7 |
8 | /**
9 | * Created by ming.wu@shanbay.com on 2017/5/30.
10 | */
11 |
12 | public class SplashActivity extends BaseActivity {
13 | @Override
14 | protected void onCreate(Bundle savedInstanceState) {
15 | super.onCreate(savedInstanceState);
16 | overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right);
17 | HomeActivity.launch(SplashActivity.this);
18 | finish();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/misc/StartTempQQChatActivity.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.misc;
2 |
3 | import android.content.Intent;
4 | import android.net.Uri;
5 | import android.os.Bundle;
6 |
7 | import com.wuzhanglao.niubi.R;
8 | import com.wuzhanglao.niubi.base.DefaultToolbar;
9 | import com.wuzhanglao.niubi.home.TransparentStatusActivity;
10 |
11 | /**
12 | * Created by ming.wu@shanbay.com on 2017/6/15.
13 | */
14 |
15 | public class StartTempQQChatActivity extends TransparentStatusActivity {
16 |
17 | @Override
18 | protected void onCreate(Bundle savedInstanceState) {
19 | super.onCreate(savedInstanceState);
20 | setContentView(R.layout.activity_start_temp_qq_chat);
21 |
22 | DefaultToolbar toolbar = new DefaultToolbar(this);
23 | toolbar.setmTvTitle("QQ临时对话");
24 |
25 | String qq = getIntent().getDataString();
26 | //mqqwpa://im/chat?chat_type=wpa&uin=910521727&version=1&src_type=web&web_src=qq.com
27 | String url = String.format("mqqwpa://im/chat?chat_type=wpa&uin=%s&version=1&src_type=web&web_src=qq.com",qq);
28 | startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/mvp/model/HeWeatherBean.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.mvp.model;
2 |
3 | /**
4 | * Created by wuming on 16/10/19.
5 | */
6 |
7 | public class HeWeatherBean {
8 |
9 |
10 | /**
11 | * aqi : 71
12 | * co : 1
13 | * no2 : 75
14 | * o3 : 101
15 | * pm10 : 89
16 | * pm25 : 44
17 | * qlty : 良
18 | * so2 : 27
19 | */
20 |
21 | private CityBean city;
22 |
23 | public CityBean getCity() {
24 | return city;
25 | }
26 |
27 | public void setCity(CityBean city) {
28 | this.city = city;
29 | }
30 |
31 | public static class CityBean {
32 | private String aqi;
33 | private String co;
34 | private String no2;
35 | private String o3;
36 | private String pm10;
37 | private String pm25;
38 | private String qlty;
39 | private String so2;
40 |
41 | public String getAqi() {
42 | return aqi;
43 | }
44 |
45 | public void setAqi(String aqi) {
46 | this.aqi = aqi;
47 | }
48 |
49 | public String getCo() {
50 | return co;
51 | }
52 |
53 | public void setCo(String co) {
54 | this.co = co;
55 | }
56 |
57 | public String getNo2() {
58 | return no2;
59 | }
60 |
61 | public void setNo2(String no2) {
62 | this.no2 = no2;
63 | }
64 |
65 | public String getO3() {
66 | return o3;
67 | }
68 |
69 | public void setO3(String o3) {
70 | this.o3 = o3;
71 | }
72 |
73 | public String getPm10() {
74 | return pm10;
75 | }
76 |
77 | public void setPm10(String pm10) {
78 | this.pm10 = pm10;
79 | }
80 |
81 | public String getPm25() {
82 | return pm25;
83 | }
84 |
85 | public void setPm25(String pm25) {
86 | this.pm25 = pm25;
87 | }
88 |
89 | public String getQlty() {
90 | return qlty;
91 | }
92 |
93 | public void setQlty(String qlty) {
94 | this.qlty = qlty;
95 | }
96 |
97 | public String getSo2() {
98 | return so2;
99 | }
100 |
101 | public void setSo2(String so2) {
102 | this.so2 = so2;
103 | }
104 | }
105 |
106 | @Override
107 | public String toString() {
108 | return "HeWeatherBean{" +
109 | "city=" + city +
110 | '}';
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/mvp/model/HeadlineBean.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.mvp.model;
2 |
3 | /**
4 | * Created by wuming on 16/10/16.
5 | */
6 |
7 | public class HeadlineBean {
8 | private String title;
9 | private String content;
10 |
11 | public HeadlineBean() {
12 | }
13 |
14 |
15 | public HeadlineBean(String title, String content) {
16 | this.title = title;
17 | this.content = content;
18 | }
19 |
20 | public String getTitle() {
21 | return title;
22 | }
23 |
24 | public void setTitle(String title) {
25 | this.title = title;
26 | }
27 |
28 | public String getContent() {
29 | return content;
30 | }
31 |
32 | public void setContent(String content) {
33 | this.content = content;
34 | }
35 |
36 | @Override
37 | public String toString() {
38 | return "HeadlineBean{" +
39 | "title='" + title + '\'' +
40 | ", content='" + content + '\'' +
41 | '}';
42 | }
43 |
44 |
45 |
46 |
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/mvp/presenter/ApproveListFragmentPresenter.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.mvp.presenter;
2 |
3 |
4 | import com.wuzhanglao.niubi.mvp.view.ApproveListFragmentView;
5 |
6 | import java.util.ArrayList;
7 | import java.util.List;
8 |
9 | /**
10 | * Created by wuming on 2016/10/23.
11 | */
12 |
13 | public class ApproveListFragmentPresenter extends BaseMvpPresenter {
14 | public List getHeadList() {
15 | List urlList = new ArrayList<>();
16 | urlList.add("");
17 | return urlList;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/mvp/presenter/BaseMvpPresenter.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.mvp.presenter;
2 |
3 | import com.wuzhanglao.niubi.mvp.view.BaseMvpView;
4 |
5 | /**
6 | * Created by wuming on 16/10/20.
7 | */
8 |
9 | public abstract class BaseMvpPresenter {
10 |
11 | V view;
12 |
13 | public void attachView(V view){
14 | this.view = view;
15 | }
16 |
17 | public void detachView(){
18 | view = null;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/mvp/presenter/HighlightFragmentPresenter.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.mvp.presenter;
2 |
3 | import android.text.TextUtils;
4 |
5 | import com.wuzhanglao.niubi.mvp.model.ShanbayResp;
6 | import com.wuzhanglao.niubi.mvp.view.HighlightFragmentView;
7 | import com.wuzhanglao.niubi.utils.NetworkRequest;
8 |
9 | import rx.functions.Action1;
10 |
11 | public class HighlightFragmentPresenter extends BaseMvpPresenter {
12 | public void getTranslation(String word) {
13 | Action1 onNext = new Action1() {
14 | @Override
15 | public void call(ShanbayResp shanbayResp) {
16 | if (TextUtils.isEmpty(shanbayResp.getMsg())) {
17 | view.getTranslationFailed();
18 | } else if (shanbayResp.getMsg().equals("SUCCESS")) {
19 | view.getTranslationSuccess(shanbayResp);
20 | } else {
21 | view.getTranslationFailed();
22 | }
23 | }
24 | };
25 | Action1 onError = new Action1() {
26 | @Override
27 | public void call(Throwable throwable) {
28 | view.getTranslationFailed();
29 | }
30 | };
31 | NetworkRequest.getInstance().getShanbayTranslation(word, onNext, onError);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/mvp/presenter/LoadImageFragmentPresenter.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.mvp.presenter;
2 |
3 | import com.wuzhanglao.niubi.mvp.view.LoadImageFragmentView;
4 |
5 | /**
6 | * Created by wuming on 2016/12/3.
7 | */
8 |
9 | public class LoadImageFragmentPresenter extends BaseMvpPresenter {
10 | }
11 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/mvp/presenter/NetworkFragmentPresenter.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.mvp.presenter;
2 |
3 | import com.wuzhanglao.niubi.mvp.model.HeWeatherBean;
4 | import com.wuzhanglao.niubi.mvp.view.NetworkFragmentView;
5 | import com.wuzhanglao.niubi.utils.NetworkRequest;
6 |
7 | import rx.functions.Action1;
8 |
9 | /**
10 | * Created by wuming on 16/10/19.
11 | */
12 |
13 | public class NetworkFragmentPresenter extends BaseMvpPresenter {
14 |
15 | public void request(String city) {
16 | Action1 onNext = new Action1() {
17 | @Override
18 | public void call(HeWeatherBean weather) {
19 | view.requestSuccess(weather);
20 | }
21 | };
22 | NetworkRequest.getInstance().getWeather(city, onNext);
23 | }
24 | }
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/mvp/view/ApproveListFragmentView.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.mvp.view;
2 |
3 | /**
4 | * Created by wuming on 2016/10/23.
5 | */
6 |
7 | public interface ApproveListFragmentView extends BaseMvpView {
8 | }
9 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/mvp/view/BaseMvpView.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.mvp.view;
2 |
3 | /**
4 | * Created by wuming on 16/10/19.
5 | */
6 |
7 | public interface BaseMvpView {
8 | }
9 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/mvp/view/HighlightFragmentView.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.mvp.view;
2 |
3 | /**
4 | * Created by wuming on 2016/12/2.
5 | */
6 |
7 | public interface HighlightFragmentView extends BaseMvpView {
8 | void getTranslationSuccess(Object result);
9 |
10 | void getTranslationFailed();
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/mvp/view/LoadImageFragmentView.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.mvp.view;
2 |
3 | /**
4 | * Created by wuming on 2016/12/3.
5 | */
6 |
7 | public interface LoadImageFragmentView extends BaseMvpView {
8 | void loadImageSuccess();
9 | void loadImageFailed();
10 | }
11 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/mvp/view/NetworkFragmentView.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.mvp.view;
2 |
3 | import com.wuzhanglao.niubi.mvp.view.BaseMvpView;
4 |
5 | /**
6 | * Created by wuming on 16/10/19.
7 | */
8 |
9 | public interface NetworkFragmentView extends BaseMvpView {
10 | void requestSuccess(Object obj);
11 | void requestFailed(String msg);
12 | }
13 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/utils/AppUtils.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.utils;
2 |
3 | public class AppUtils {
4 |
5 | public static void showToast(String msg) {
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/utils/BitmapFileCache.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.utils;
2 |
3 | import android.graphics.Bitmap;
4 | import android.graphics.Bitmap.CompressFormat;
5 | import android.graphics.BitmapFactory;
6 |
7 | import java.io.File;
8 | import java.io.FileNotFoundException;
9 | import java.io.FileOutputStream;
10 | import java.io.FilenameFilter;
11 | import java.io.IOException;
12 |
13 | public class BitmapFileCache {
14 |
15 | public static final String PATH = NoteApplication.getInstance().getExternalFilesDir("wuzhanglao").getAbsolutePath();
16 | private File rootDir = new File(PATH);
17 |
18 | private BitmapFileCache() {
19 | // 如果Bitmap缓存文件夹不存在的话,就创建这个文件夹
20 | if (!rootDir.exists()) {
21 | rootDir.mkdir();
22 | }
23 | }
24 |
25 | private static final class SingletonHolder {
26 | private static final BitmapFileCache instance = new BitmapFileCache();
27 | }
28 |
29 | public static BitmapFileCache getInstance() {
30 | return SingletonHolder.instance;
31 | }
32 |
33 | public final void put(int hashCode, Bitmap bitmap) {
34 | try {
35 | FileOutputStream fos = new FileOutputStream(new File(rootDir, hashCode + ".jpg"));
36 | bitmap.compress(CompressFormat.JPEG, 100, fos);
37 | fos.flush();
38 | fos.close();
39 | } catch (FileNotFoundException e) {
40 | e.printStackTrace();
41 | } catch (IOException e) {
42 | e.printStackTrace();
43 | }
44 | }
45 |
46 | /**
47 | * 根据文件名获取Bitmap
48 | **/
49 | public final Bitmap get(int hashCode, int defaultImgId) {
50 | String[] files = rootDir.list(new MyFilenameFilter(hashCode));
51 | if (files == null || files.length == 0) {
52 | return null;
53 | } else {
54 | final Bitmap bitmap = BitmapFactory.decodeFile(PATH + "/" + files[0]);
55 | if (bitmap != null) {
56 | return bitmap;
57 | } else {
58 | return BitmapFactory.decodeResource(NoteApplication.getInstance().getResources(), defaultImgId);
59 | }
60 | }
61 | }
62 |
63 | public final Bitmap get(int hashCode) {
64 | String[] files = rootDir.list(new MyFilenameFilter(hashCode));
65 | if (files == null || files.length == 0) {
66 | return null;
67 | } else {
68 | final Bitmap bitmap = BitmapFactory.decodeFile(PATH + "/" + files[0]);
69 | if (bitmap != null) {
70 | return bitmap;
71 | } else {
72 | return null;
73 | }
74 | }
75 | }
76 |
77 | /**
78 | * 文件名过滤器,把想要的文件过滤出来
79 | **/
80 | private final class MyFilenameFilter implements FilenameFilter {
81 |
82 | private int hashCode;
83 |
84 | public MyFilenameFilter(int hashCode) {
85 | this.hashCode = hashCode;
86 | }
87 |
88 | @Override
89 | public boolean accept(File dir, String filename) {
90 | return filename.equals(hashCode + ".jpg");
91 | }
92 |
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/utils/GlobleConfig.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.utils;
2 |
3 | /**
4 | * Created by wuming on 16/10/19.
5 | */
6 |
7 | public class GlobleConfig {
8 | //和风天气AK
9 | public static final String HEFENG_KEY = "7e98176448394ae89cb4046842208fd1";
10 | }
11 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/utils/ITest.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.utils;
2 |
3 | import android.util.Log;
4 |
5 | /**
6 | * Created by wuming on 2018/3/22.
7 | */
8 |
9 | public class ITest {
10 |
11 | private void outerMethod() {
12 | Log.d("TAG", "outer");
13 | }
14 |
15 | private class InnerClass {
16 | private void innerMethod() {
17 | Log.d("TAG", "inner");
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/utils/LogUtils.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.utils;
2 |
3 | import android.util.Log;
4 |
5 | /**
6 | * Created by wuming on 2018/3/22.
7 | */
8 |
9 | public class LogUtils {
10 |
11 | public String bbb;
12 | public int viewType = 7;
13 | public String aaa;
14 |
15 | public static void prtLog(String msg) {
16 | Log.d("inject log", msg);
17 | }
18 |
19 | public static int getInt() {
20 | return 0;
21 | }
22 |
23 | public static Integer getInteger() {
24 | return 0;
25 | }
26 |
27 | public static boolean getBool() {
28 | return false;
29 | }
30 |
31 | public static Boolean getBoolean() {
32 | return false;
33 | }
34 |
35 | public static String getString() {
36 | return "";
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/utils/NetworkRequest.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.utils;
2 |
3 |
4 | import com.wuzhanglao.niubi.mvp.model.HeWeatherBean;
5 | import com.wuzhanglao.niubi.mvp.model.ShanbayResp;
6 |
7 | import rx.Observable;
8 | import rx.android.schedulers.AndroidSchedulers;
9 | import rx.functions.Action1;
10 | import rx.schedulers.Schedulers;
11 |
12 | /**
13 | * Created by wuming on 16/10/19.
14 | */
15 |
16 | public class NetworkRequest {
17 |
18 | public static final NetworkRequest getInstance() {
19 | return SingletonHolder.instance;
20 | }
21 |
22 | private static final NetworkService getHeWeatherService() {
23 | return SingletonHolder.heweather_service;
24 | }
25 |
26 | private static final NetworkService getShanbayService() {
27 | return SingletonHolder.shanbay_service;
28 | }
29 |
30 | public void getWeather(String city, Action1 onNext) {
31 | getHeWeatherService().getWeatherService(city, GlobleConfig.HEFENG_KEY).compose(new ComposeThread()).subscribe(onNext);
32 | }
33 |
34 | public void getScenic(String cityid, Action1 onNext) {
35 | getHeWeatherService().getScenicService(cityid, GlobleConfig.HEFENG_KEY).compose(new ComposeThread()).subscribe(onNext);
36 | }
37 |
38 | public void getShanbayTranslation(String word, Action1 onNext, Action1 onError) {
39 | getShanbayService().getTranslation(word).compose(new ComposeThread()).subscribe(onNext, onError);
40 | }
41 |
42 | private static class SingletonHolder {
43 | private static final NetworkRequest instance = new NetworkRequest();
44 | private static final NetworkService heweather_service = NetworkService.Factory.create(NetworkService.BASE_URL_HeWeather);
45 | private static final NetworkService shanbay_service = NetworkService.Factory.create(NetworkService.BASE_URL_SHANBAY);
46 | }
47 |
48 | private class ComposeThread implements Observable.Transformer {
49 | @Override
50 | public Observable call(Observable observable) {
51 | return observable
52 | .subscribeOn(Schedulers.io())
53 | .unsubscribeOn(Schedulers.io())
54 | .observeOn(AndroidSchedulers.mainThread());
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/utils/NetworkService.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.utils;
2 |
3 | import com.wuzhanglao.niubi.mvp.model.HeWeatherBean;
4 | import com.wuzhanglao.niubi.mvp.model.ShanbayResp;
5 |
6 | import java.io.File;
7 | import java.io.IOException;
8 | import java.util.concurrent.TimeUnit;
9 |
10 | import okhttp3.Cache;
11 | import okhttp3.Interceptor;
12 | import okhttp3.OkHttpClient;
13 | import okhttp3.Request;
14 | import okhttp3.Response;
15 | import okhttp3.logging.HttpLoggingInterceptor;
16 | import retrofit2.Retrofit;
17 | import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
18 | import retrofit2.converter.gson.GsonConverterFactory;
19 | import retrofit2.http.GET;
20 | import retrofit2.http.Query;
21 | import rx.Observable;
22 |
23 | /**
24 | * 包含了一系列的网络请求接口
25 | * Created by wuming on 16/10/19.
26 | */
27 |
28 | public interface NetworkService {
29 |
30 | String CACHE_PATH = "okhttp_cache";
31 | String BASE_URL_HeWeather = "https://api.heweather.com";
32 | String BASE_URL_SHANBAY = "https://api.shanbay.com/";
33 |
34 | class Factory {
35 | public static final NetworkService create(String baseUrl) {
36 | HttpLoggingInterceptor logInterceptor = new HttpLoggingInterceptor();
37 | logInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
38 | OkHttpClient client = new OkHttpClient.Builder()
39 | .addInterceptor(logInterceptor)//日志拦截器
40 | .addNetworkInterceptor(new CacheInterceptor())
41 | .connectTimeout(15, TimeUnit.SECONDS)//设置连接超时
42 | .retryOnConnectionFailure(true)
43 | .cache(new Cache(new File(NoteApplication.getInstance().getCacheDir(), CACHE_PATH), 1024 * 1024 * 10))
44 | .build();
45 | Retrofit retrofit = new Retrofit.Builder()
46 | .baseUrl(baseUrl)
47 | .addConverterFactory(GsonConverterFactory.create())//json数据转换
48 | .addCallAdapterFactory(RxJavaCallAdapterFactory.create())//将Callable接口转换成Observable接口
49 | .client(client)//网络请求客户端为okhttp
50 | .build();
51 | return retrofit.create(NetworkService.class);
52 | }
53 | }
54 |
55 | class CacheInterceptor implements Interceptor {
56 |
57 | @Override
58 | public Response intercept(Chain chain) throws IOException {
59 | //可以进行网络重连接等操作
60 | //@link 这篇博客写的很详细:http://www.jianshu.com/p/faa46bbe8a2e
61 | Request request = chain.request();
62 | Response response = chain.proceed(request);
63 | if (NetworkUtil.isNetworkAvailable()) {
64 | // 有网络时 设置缓存超时时间0个小时
65 | response.newBuilder()
66 | .header("Cache-Control", "public, max-age=" + 0)
67 | .build();
68 | } else {
69 | response.newBuilder()
70 | .header("Cache-Control", "public, only-if-cached, max-stale=" + 60 * 60 * 24)
71 | .build();
72 | }
73 | return response;
74 | }
75 | }
76 |
77 | @GET("x3/weather")
78 | Observable getWeatherService(@Query("city") String city, @Query("key") String key);
79 |
80 | @GET("x3/attractions")
81 | Observable getScenicService(@Query("cityid") String cityid, @Query("key") String key);
82 |
83 | @GET("bdc/search")
84 | Observable getTranslation(@Query("word") String word);
85 | }
86 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/utils/NetworkUtil.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.utils;
2 |
3 | import android.content.Context;
4 | import android.net.ConnectivityManager;
5 | import android.net.NetworkInfo;
6 |
7 | /**
8 | * Created by wuming on 2016/12/6.
9 | */
10 |
11 | public class NetworkUtil {
12 | /**
13 | * 检测网络是否连接
14 | *
15 | * @return
16 | */
17 | public static boolean isNetworkAvailable() {
18 | boolean flag = false;
19 | final ConnectivityManager manager = (ConnectivityManager) NoteApplication.getInstance().getSystemService(Context.CONNECTIVITY_SERVICE);
20 | //去进行判断网络是否连接
21 | if (manager.getActiveNetworkInfo() != null) {
22 | flag = manager.getActiveNetworkInfo().isAvailable();
23 | }
24 | return flag;
25 | }
26 |
27 | /**
28 | * 网络已经连接,然后去判断是wifi连接还是GPRS连接
29 | */
30 | public static String getNetworkType() {
31 | final ConnectivityManager manager = (ConnectivityManager) NoteApplication.getInstance().getSystemService(Context.CONNECTIVITY_SERVICE);
32 | NetworkInfo.State gprs = manager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState();
33 | NetworkInfo.State wifi = manager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState();
34 | if (gprs == NetworkInfo.State.CONNECTED || gprs == NetworkInfo.State.CONNECTING) {
35 | return "GPRS";
36 | }
37 | //判断为wifi状态下才加载广告,如果是GPRS手机网络则不加载!
38 | if (wifi == NetworkInfo.State.CONNECTED || wifi == NetworkInfo.State.CONNECTING) {
39 | return "WIFI";
40 | }
41 | return null;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/utils/NoteApplication.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.utils;
2 |
3 | import android.app.Application;
4 |
5 | /**
6 | * Created by wuming on 16/10/13.
7 | */
8 |
9 | public class NoteApplication extends Application {
10 | private static NoteApplication instance;
11 |
12 | @Override
13 | public void onCreate() {
14 | super.onCreate();
15 | instance = this;
16 | }
17 |
18 | public static NoteApplication getInstance() {
19 | return instance;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/notes/src/main/java/com/wuzhanglao/utils/RxBus.java:
--------------------------------------------------------------------------------
1 | package com.wuzhanglao.niubi.utils;
2 |
3 | import rx.Observable;
4 | import rx.subjects.PublishSubject;
5 | import rx.subjects.SerializedSubject;
6 | import rx.subjects.Subject;
7 |
8 | /**
9 | * Created by wuming on 2016/11/22.
10 | */
11 |
12 | //单例模式的一种写法
13 | public enum RxBus {
14 | INSTANCE;
15 |
16 | private Subject