├── .gitignore
├── .idea
├── codeStyles
│ └── Project.xml
├── gradle.xml
├── libraries
│ ├── Gradle__com_jakewharton_butterknife_annotations_8_8_1_jar.xml
│ ├── Gradle__javax_inject_javax_inject_1_jar.xml
│ ├── Gradle__org_greenrobot_eventbus_3_1_1_jar.xml
│ ├── Gradle__org_greenrobot_greendao_3_2_2_jar.xml
│ └── Gradle__org_greenrobot_greendao_api_3_2_2_jar.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
└── vcs.xml
├── LICENSE
├── README.md
├── app
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── assets
│ ├── OpenSans-Light.ttf
│ ├── OpenSans-Regular.ttf
│ └── html
│ │ └── webtest.html
│ ├── java
│ └── com
│ │ └── sdwfqin
│ │ └── sample
│ │ ├── BaseApp.java
│ │ ├── Config.java
│ │ ├── MainActivity.java
│ │ ├── activitytransition
│ │ ├── T1Activity.java
│ │ └── T2Activity.java
│ │ ├── asynctask
│ │ └── AsyncTaskActivity.java
│ │ ├── biometrics
│ │ ├── BiometricsMainActivity.java
│ │ └── fingerprint
│ │ │ ├── FingerprintActivity.java
│ │ │ └── FingerprintDialogFragment.java
│ │ ├── bottomsheet
│ │ ├── BottomSheetActivity.java
│ │ └── MyBottomSheetDialogFragment.java
│ │ ├── broadcast
│ │ ├── BroadcastActivity.java
│ │ └── broadcast
│ │ │ ├── LocalBroadcastReceiver.java
│ │ │ ├── OrderBroadcastReceiver.java
│ │ │ └── OrdinaryBroadcastReceiver.java
│ │ ├── camera
│ │ ├── CameraActivity.java
│ │ ├── CameraMainActivity.java
│ │ ├── CameraUtils.java
│ │ └── PictureActivity.java
│ │ ├── canvas
│ │ ├── CanvasActivity.java
│ │ └── CanvasView.java
│ │ ├── drag
│ │ ├── DragMainActivity.java
│ │ └── Draw0Activity.java
│ │ ├── eventbus
│ │ ├── EventBusActivity.java
│ │ ├── eventbus
│ │ │ ├── EventBusActivity.java
│ │ │ └── MessageEvent.java
│ │ └── eventbussticky
│ │ │ └── EventBusStickyActivity.java
│ │ ├── gridview
│ │ ├── GridViewActivity.java
│ │ ├── SensorBean.java
│ │ └── SensorGridAdapter.java
│ │ ├── handler
│ │ └── HandlerActivity.java
│ │ ├── notification
│ │ └── NotificationActivity.java
│ │ ├── popupwindow
│ │ ├── BasePopupWindow.java
│ │ ├── LongShowPopupActivity.java
│ │ ├── PopDropDownBgActivity.java
│ │ ├── PopshowAtLocationActivity.java
│ │ ├── PopupAnimActivity.java
│ │ ├── PopupMainActivity.java
│ │ └── PopupShowAsDropDownActivity.java
│ │ ├── recyclerview
│ │ ├── RecyclerActivity.java
│ │ ├── doublelistlinkage
│ │ │ ├── CheckListener.java
│ │ │ ├── ClassifyDetailAdapter.java
│ │ │ ├── DoublelistlinkageActivity.java
│ │ │ ├── ItemHeaderDecoration.java
│ │ │ ├── RvListener.java
│ │ │ ├── SortAdapter.java
│ │ │ ├── SortBean.java
│ │ │ └── SortDetailFragment.java
│ │ ├── recycler
│ │ │ ├── RecyFragment.java
│ │ │ ├── RecyclerActivity.java
│ │ │ └── data
│ │ │ │ ├── MyData.java
│ │ │ │ └── MyDataLab.java
│ │ └── vlayout
│ │ │ ├── SubAdapter.java
│ │ │ ├── VLayoutActivity.java
│ │ │ └── VLayoutFragment.java
│ │ ├── retrofit
│ │ ├── RetrofitActivity.java
│ │ ├── activity
│ │ │ ├── RetrofitActivity.java
│ │ │ ├── RetrofitGetActivity.java
│ │ │ └── RetrofitPostActivity.java
│ │ ├── api
│ │ │ ├── ApiStores.java
│ │ │ ├── RequestGetApi.java
│ │ │ └── RequestPostApi.java
│ │ └── model
│ │ │ ├── RequestModel.java
│ │ │ └── WeatherModel.java
│ │ ├── rxjava
│ │ ├── RxJavaActivity.java
│ │ ├── RxJavaComposeActivity.java
│ │ ├── RxJavaFlowableActivity.java
│ │ ├── RxJavaMainActivity.java
│ │ ├── RxJavaMapActivity.java
│ │ ├── RxJavaSchedulersActivity.java
│ │ └── RxJavaZipActivity.java
│ │ ├── service
│ │ ├── ServiceActivity.java
│ │ └── service
│ │ │ ├── InteractiveService.java
│ │ │ ├── MyIntentService.java
│ │ │ ├── NotInteractiveService.java
│ │ │ └── StageService.java
│ │ ├── spannablestring
│ │ └── SpannableActivity.java
│ │ ├── sqlitetable
│ │ ├── MySqlite.java
│ │ └── SqliteTableActivity.java
│ │ ├── view
│ │ ├── ViewActivity.java
│ │ ├── bottomzoom
│ │ │ └── BottomZoomActivity.java
│ │ ├── courtesycard
│ │ │ ├── CourtesyCardActivity.java
│ │ │ └── CourtesyCardView.java
│ │ ├── delbtn
│ │ │ ├── DeleteButtonActivity.java
│ │ │ └── DeleteButtonView.java
│ │ ├── descircle
│ │ │ ├── DesCircleActivity.java
│ │ │ └── DesCircleView.java
│ │ ├── gesturedetector
│ │ │ ├── GdView.java
│ │ │ └── GestureDetectorActivity.java
│ │ ├── motionslop
│ │ │ ├── MeTsActivity.java
│ │ │ └── MeTsView.java
│ │ ├── paypwdinput
│ │ │ ├── PayPwdInputActivity.java
│ │ │ └── PayPwdInputView.java
│ │ ├── rippleanimation
│ │ │ ├── RippleAnimationActivity.java
│ │ │ ├── RippleAnimationView.java
│ │ │ └── RippleCircleView.java
│ │ ├── scroller
│ │ │ ├── ScrollerActivity.java
│ │ │ └── ScrollerView.java
│ │ ├── surface
│ │ │ ├── MySurfaceView.java
│ │ │ ├── SurfaceActivity.java
│ │ │ └── SurfaceViewTemplate.java
│ │ ├── surfacepalette
│ │ │ ├── PaletteSurfaceView.java
│ │ │ └── SurfacePaletteActivity.java
│ │ ├── viewevent
│ │ │ ├── AView.java
│ │ │ ├── GroupView.java
│ │ │ └── ViewEventActivity.java
│ │ └── viewposition
│ │ │ ├── PositionView.java
│ │ │ ├── TranslationView.java
│ │ │ └── ViewPositionActivity.java
│ │ └── webview
│ │ └── WebViewActivity.java
│ └── res
│ ├── anim
│ ├── anim_layout.xml
│ ├── anim_layout_item.xml
│ ├── context_menu_enter.xml
│ ├── context_menu_exit.xml
│ ├── fade.xml
│ ├── hold.xml
│ ├── hyperspace_in.xml
│ ├── hyperspace_out.xml
│ ├── my_alpha_action.xml
│ ├── my_scale_action.xml
│ ├── push_left_in.xml
│ ├── push_left_out.xml
│ ├── push_up_in.xml
│ ├── push_up_out.xml
│ ├── scale_rotate.xml
│ ├── scale_translate.xml
│ ├── scale_translate_rotate.xml
│ ├── slide_down_out.xml
│ ├── slide_left.xml
│ ├── slide_right.xml
│ ├── slide_up_in.xml
│ ├── wave_scale.xml
│ ├── zoom_enter.xml
│ └── zoom_exit.xml
│ ├── drawable-hdpi
│ ├── img_tm.png
│ ├── list_line.9.png
│ ├── pop_bg.9.png
│ ├── sensor_value_bg.png
│ ├── zuk_1.jpg
│ ├── zuk_2.jpg
│ └── zuk_3.jpg
│ ├── drawable
│ ├── table_bg.xml
│ └── table_frame_gray.xml
│ ├── layout
│ ├── activity_animator1.xml
│ ├── activity_async_task.xml
│ ├── activity_bar_chart.xml
│ ├── activity_bottomsheet.xml
│ ├── activity_camera.xml
│ ├── activity_canvas.xml
│ ├── activity_courtesy_card.xml
│ ├── activity_delete_button.xml
│ ├── activity_des_circle.xml
│ ├── activity_doublelistlinkage.xml
│ ├── activity_drag_main.xml
│ ├── activity_draw0.xml
│ ├── activity_event_bus.xml
│ ├── activity_event_bus_sticky.xml
│ ├── activity_gesture_detector.xml
│ ├── activity_grid_view.xml
│ ├── activity_handler.xml
│ ├── activity_list.xml
│ ├── activity_long_show_popup.xml
│ ├── activity_me_ts.xml
│ ├── activity_pay_pwd_input.xml
│ ├── activity_picture.xml
│ ├── activity_recycler.xml
│ ├── activity_retrofit.xml
│ ├── activity_retrofit_get.xml
│ ├── activity_retrofit_post.xml
│ ├── activity_ripple_animation.xml
│ ├── activity_rx_java.xml
│ ├── activity_scroller.xml
│ ├── activity_spannable.xml
│ ├── activity_sqlite_table.xml
│ ├── activity_surface.xml
│ ├── activity_surface_palette.xml
│ ├── activity_t2.xml
│ ├── activity_view_event.xml
│ ├── activity_view_position.xml
│ ├── activity_viewpager.xml
│ ├── activity_vlayout.xml
│ ├── activity_web_view.xml
│ ├── anim_activity.xml
│ ├── anim_activity_popup.xml
│ ├── dialog_add.xml
│ ├── dialog_bottom_sheet.xml
│ ├── drop_down_bg_activity.xml
│ ├── drop_down_bg_activity_popup.xml
│ ├── fingerprint_dialog.xml
│ ├── fragment_recycler.xml
│ ├── fragment_sort_detail.xml
│ ├── fragment_vlayout.xml
│ ├── item_classify_detail.xml
│ ├── item_list.xml
│ ├── item_recycler.xml
│ ├── item_sensor_grid.xml
│ ├── item_sort_list.xml
│ ├── item_title.xml
│ ├── item_vlayout.xml
│ ├── item_vlayout_banner.xml
│ ├── item_vlayout_sticky.xml
│ ├── notifit_bar.xml
│ ├── page_one.xml
│ ├── page_three.xml
│ ├── page_two.xml
│ ├── show_as_drop_down_activity.xml
│ ├── show_as_drop_down_activity_popup.xml
│ ├── show_at_location_activity.xml
│ └── show_at_location_activity_popup.xml
│ ├── menu
│ └── menu_scrolling.xml
│ ├── mipmap-hdpi
│ ├── arrow_right.png
│ ├── ic_launcher.png
│ └── iv_second.png
│ ├── mipmap-mdpi
│ └── ic_launcher.png
│ ├── mipmap-xhdpi
│ ├── ic_fp_40px.png
│ └── ic_launcher.png
│ ├── mipmap-xxhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxxhdpi
│ └── ic_launcher.png
│ ├── values-v21
│ └── styles.xml
│ ├── values-w820dp
│ └── dimens.xml
│ ├── values
│ ├── arrays.xml
│ ├── attrs.xml
│ ├── colors.xml
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
│ └── xml
│ └── file_paths_public.xml
├── build.gradle
├── config.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── greendaomvp
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── sdwfqin
│ │ └── greendaosample
│ │ ├── BaseApplication.java
│ │ ├── adapter
│ │ └── MainAdapter.java
│ │ ├── model
│ │ ├── entry
│ │ │ └── Student.java
│ │ └── interactor
│ │ │ ├── MainInteractor.java
│ │ │ └── MainInteractorImpl.java
│ │ ├── presenter
│ │ ├── MainPresenter.java
│ │ └── MainPresenterImpl.java
│ │ └── view
│ │ ├── MainActivity.java
│ │ └── MainView.java
│ └── res
│ ├── drawable
│ ├── ic_add_black_24dp.xml
│ └── ic_search_24dp.xml
│ ├── layout
│ ├── activity_main.xml
│ ├── dialog_xg.xml
│ ├── item_home.xml
│ └── sheet_dialog.xml
│ ├── menu
│ └── menu_frist.xml
│ ├── mipmap-hdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ ├── mipmap-mdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ ├── mipmap-xhdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ ├── mipmap-xxhdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ ├── mipmap-xxxhdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ └── values
│ ├── colors.xml
│ ├── strings.xml
│ └── styles.xml
├── local.properties
├── mvpseed
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── sdwfqin
│ │ └── mvpseed
│ │ ├── base
│ │ ├── App.java
│ │ ├── BaseActivity.java
│ │ ├── BaseFragment.java
│ │ ├── BasePresenter.java
│ │ ├── BaseView.java
│ │ ├── Constants.java
│ │ └── RxPresenter.java
│ │ ├── contract
│ │ └── MainContract.java
│ │ ├── di
│ │ ├── component
│ │ │ ├── ActivityComponent.java
│ │ │ ├── AppComponent.java
│ │ │ └── FragmentComponent.java
│ │ ├── module
│ │ │ ├── ActivityModule.java
│ │ │ ├── AppModule.java
│ │ │ ├── FragmentModule.java
│ │ │ └── HttpModule.java
│ │ ├── qualifier
│ │ │ └── TestUrl.java
│ │ └── scope
│ │ │ ├── ActivityScope.java
│ │ │ └── FragmentScope.java
│ │ ├── model
│ │ ├── bean
│ │ │ └── TestBean.java
│ │ └── http
│ │ │ ├── HttpHelper.java
│ │ │ ├── RetrofitHelper.java
│ │ │ └── TestApi.java
│ │ ├── presenter
│ │ └── MainPresenter.java
│ │ ├── ui
│ │ └── MainActivity.java
│ │ └── util
│ │ ├── RxUtil.java
│ │ └── SystemUtil.java
│ └── res
│ ├── layout
│ └── activity_main.xml
│ ├── mipmap-hdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ ├── mipmap-mdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ ├── mipmap-xhdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ ├── mipmap-xxhdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ ├── mipmap-xxxhdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ └── values
│ ├── colors.xml
│ ├── strings.xml
│ └── styles.xml
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by .ignore support plugin (hsz.mobi)
2 | ### Android template
3 | # Built application files
4 | *.apk
5 | *.ap_
6 |
7 | # Files for the ART/Dalvik VM
8 | *.dex
9 |
10 | # Java class files
11 | *.class
12 |
13 | # Generated files
14 | bin/
15 | gen/
16 | out/
17 |
18 | # Gradle files
19 | .gradle/
20 | build/
21 |
22 | # Local configuration file (sdk path, etc)
23 | local.properties
24 |
25 | # Proguard folder generated by Eclipse
26 | proguard/
27 |
28 | # Log Files
29 | *.log
30 |
31 | # Android Studio Navigation editor temp files
32 | .navigation/
33 |
34 | # Android Studio captures folder
35 | captures/
36 |
37 | # IntelliJ
38 | *.iml
39 | .idea/workspace.xml
40 | .idea/tasks.xml
41 | .idea/gradle.xml
42 | .idea/assetWizardSettings.xml
43 | .idea/dictionaries
44 | .idea/libraries
45 | .idea/caches
46 |
47 | # Keystore files
48 | # Uncomment the following line if you do not want to check your keystore files in.
49 | #*.jks
50 |
51 | # External native build folder generated in Android Studio 2.2 and later
52 | .externalNativeBuild
53 |
54 | # Google Services (e.g. APIs or Firebase)
55 | google-services.json
56 |
57 | # Freeline
58 | freeline.py
59 | freeline/
60 | freeline_project_description.json
61 |
62 | # fastlane
63 | fastlane/report.xml
64 | fastlane/Preview.html
65 | fastlane/screenshots
66 | fastlane/test_output
67 | fastlane/readme.md
68 |
69 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/.idea/libraries/Gradle__com_jakewharton_butterknife_annotations_8_8_1_jar.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/libraries/Gradle__javax_inject_javax_inject_1_jar.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/libraries/Gradle__org_greenrobot_eventbus_3_1_1_jar.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/libraries/Gradle__org_greenrobot_greendao_3_2_2_jar.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/libraries/Gradle__org_greenrobot_greendao_api_3_2_2_jar.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\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 |
--------------------------------------------------------------------------------
/app/src/main/assets/OpenSans-Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/app/src/main/assets/OpenSans-Light.ttf
--------------------------------------------------------------------------------
/app/src/main/assets/OpenSans-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/app/src/main/assets/OpenSans-Regular.ttf
--------------------------------------------------------------------------------
/app/src/main/assets/html/webtest.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | (this, R.layout.item_list, R.id.tv_items, mTitle));
38 |
39 | initListener();
40 | }
41 |
42 | private void initListener() {
43 | mList.setOnItemClickListener((adapterView, view, i, l) ->
44 | startActivity(new Intent(this, mClasses[i])
45 | ));
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/bottomsheet/MyBottomSheetDialogFragment.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.bottomsheet;
2 |
3 | import android.app.Dialog;
4 | import android.os.Bundle;
5 | import android.support.design.widget.BottomSheetBehavior;
6 | import android.support.design.widget.BottomSheetDialog;
7 | import android.support.design.widget.BottomSheetDialogFragment;
8 | import android.view.View;
9 |
10 | import com.sdwfqin.sample.R;
11 |
12 | /**
13 | * 描述:BottomSheetDialogFragment
14 | *
15 | * @author zhangqin
16 | * @date 2017/4/24
17 | */
18 | public class MyBottomSheetDialogFragment extends BottomSheetDialogFragment {
19 |
20 | private BottomSheetBehavior mBehavior;
21 |
22 | @Override
23 | public Dialog onCreateDialog(Bundle savedInstanceState)
24 | {
25 | BottomSheetDialog dialog = (BottomSheetDialog) super.onCreateDialog(savedInstanceState);
26 | View view = View.inflate(getContext(), R.layout.dialog_bottom_sheet, null);
27 | dialog.setContentView(view);
28 | mBehavior = BottomSheetBehavior.from((View) view.getParent());
29 | return dialog;
30 | }
31 |
32 | @Override
33 | public void onStart()
34 | {
35 | super.onStart();
36 | //默认全屏展开
37 | mBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/broadcast/broadcast/LocalBroadcastReceiver.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.broadcast.broadcast;
2 |
3 | import android.content.BroadcastReceiver;
4 | import android.content.Context;
5 | import android.content.Intent;
6 |
7 | import com.blankj.utilcode.util.LogUtils;
8 |
9 | /**
10 | * 本地广播
11 | * 在API21的Support v4包中新增本地广播,也就是LocalBroadcastManager。
12 | * 由于之前的广播都是全局的,所有应用程序都可以接收到,这样就会带来安全隐患,
13 | * LocalBroadcastManager只发送给自己应用内的信息广播,限制在进程内使用
14 | *
15 | * 用法:把调用context的sendBroadcast、registerReceiver、unregisterReceiver的地方
16 | * 换为LocalBroadcastManager.getInstance(Context context)中对应的函数
17 | *
18 | * @author zhangqin
19 | * @date 2016/12/10
20 | */
21 |
22 | public class LocalBroadcastReceiver extends BroadcastReceiver {
23 |
24 | @Override
25 | public void onReceive(Context context, Intent intent) {
26 | String str = intent.getStringExtra("name");
27 | LogUtils.i("onReceive(本地广播): " + str);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/broadcast/broadcast/OrdinaryBroadcastReceiver.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.broadcast.broadcast;
2 |
3 | import android.content.BroadcastReceiver;
4 | import android.content.Context;
5 | import android.content.Intent;
6 |
7 | import com.blankj.utilcode.util.LogUtils;
8 |
9 | /**
10 | * 描述:普通广播,静态注册
11 | *
12 | * @author zhangqin
13 | * @date 2016/12/10
14 | */
15 |
16 | public class OrdinaryBroadcastReceiver extends BroadcastReceiver {
17 |
18 | @Override
19 | public void onReceive(Context context, Intent intent) {
20 | String str = intent.getStringExtra("name");
21 | LogUtils.i("onReceive(普通广播,静态注册): " + str);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/camera/CameraMainActivity.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.camera;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.widget.ArrayAdapter;
7 | import android.widget.ListView;
8 |
9 | import com.sdwfqin.sample.R;
10 |
11 | import butterknife.BindView;
12 | import butterknife.ButterKnife;
13 |
14 | /**
15 | * 描述:相机开发
16 | *
17 | * @author 张钦
18 | * @date 2018/12/10
19 | */
20 | public class CameraMainActivity extends AppCompatActivity {
21 |
22 | @BindView(R.id.list)
23 | ListView list;
24 |
25 | private String[] mTitle = new String[]{
26 | "调用系统相机",
27 | "自定义相机",
28 | };
29 | private Class[] mClasses = new Class[]{
30 | PictureActivity.class,
31 | CameraActivity.class,
32 | };
33 |
34 | @Override
35 | protected void onCreate(Bundle savedInstanceState) {
36 | super.onCreate(savedInstanceState);
37 | setContentView(R.layout.activity_list);
38 | ButterKnife.bind(this);
39 |
40 | list.setAdapter(new ArrayAdapter(this, R.layout.item_list, R.id.tv_items, mTitle));
41 | initListener();
42 | }
43 |
44 | private void initListener() {
45 | list.setOnItemClickListener((adapterView, view, i, l) ->
46 | startActivity(new Intent(CameraMainActivity.this, mClasses[i])
47 | ));
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/camera/CameraUtils.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.camera;
2 |
3 | import android.hardware.Camera;
4 | import android.os.Build;
5 |
6 | /**
7 | * 描述:相机工具类
8 | *
9 | * @author 张钦
10 | * @date 2018/12/11
11 | */
12 | public class CameraUtils {
13 |
14 | private static boolean checkCameraFacing(final int facing) {
15 | final int cameraCount = Camera.getNumberOfCameras();
16 | Camera.CameraInfo info = new Camera.CameraInfo();
17 | for (int i = 0; i < cameraCount; i++) {
18 | Camera.getCameraInfo(i, info);
19 | if (facing == info.facing) {
20 | return true;
21 | }
22 | }
23 | return false;
24 | }
25 |
26 | /**
27 | * 检查设备是否有摄像头
28 | *
29 | * @return
30 | */
31 | public static boolean hasCamera() {
32 | return hasBackFacingCamera() || hasFrontFacingCamera();
33 | }
34 |
35 | /**
36 | * 检查设备是否有后置摄像头
37 | *
38 | * @return
39 | */
40 | public static boolean hasBackFacingCamera() {
41 | final int CAMERA_FACING_BACK = 0;
42 | return checkCameraFacing(CAMERA_FACING_BACK);
43 | }
44 |
45 | /**
46 | * 检查设备是否有前置摄像头
47 | *
48 | * @return
49 | */
50 | public static boolean hasFrontFacingCamera() {
51 | final int CAMERA_FACING_BACK = 1;
52 | return checkCameraFacing(CAMERA_FACING_BACK);
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/canvas/CanvasActivity.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.canvas;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | import com.sdwfqin.sample.R;
7 |
8 | /**
9 | * 描述:详细内容请看CanvasView
10 | *
11 | * @author zhangqin
12 | * @date 2017/4/27
13 | */
14 | public class CanvasActivity extends AppCompatActivity {
15 |
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | setContentView(R.layout.activity_canvas);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/drag/DragMainActivity.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.drag;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | import com.sdwfqin.sample.R;
7 |
8 | /**
9 | * Drag手势
10 | *
11 | *
12 | * @author 张钦
13 | * @date 2019-08-23
14 | */
15 | public class DragMainActivity extends AppCompatActivity {
16 |
17 | @Override
18 | protected void onCreate(Bundle savedInstanceState) {
19 | super.onCreate(savedInstanceState);
20 | setContentView(R.layout.activity_drag_main);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/drag/Draw0Activity.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.drag;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | import com.sdwfqin.sample.R;
7 |
8 | public class Draw0Activity extends AppCompatActivity {
9 |
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | setContentView(R.layout.activity_draw0);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/eventbus/EventBusActivity.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.eventbus;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.widget.ArrayAdapter;
7 | import android.widget.ListView;
8 |
9 | import com.sdwfqin.sample.R;
10 | import com.sdwfqin.sample.eventbus.eventbussticky.EventBusStickyActivity;
11 |
12 | import butterknife.BindView;
13 | import butterknife.ButterKnife;
14 |
15 | /**
16 | * EventBus是一个Android端优化的publish/subscribe消息总线,
17 | * 简化了应用程序内各组件间、组件与后台线程间的通信。
18 | *
19 | * 比如请求网络,等网络返回时通过Handler或Broadcast通知UI,
20 | * 两个Fragment之间需要通过Listener通信,这些需求都可以通过EventBus实现。
21 | *
22 | * @author zhangqin
23 | */
24 | public class EventBusActivity extends AppCompatActivity {
25 |
26 | @BindView(R.id.list)
27 | ListView mEventbusList;
28 |
29 | private String[] mTitle = new String[]{"入门", "StickyEvent黏性事件"};
30 | private Class[] mClasses = new Class[]{com.sdwfqin.sample.eventbus.eventbus.EventBusActivity.class, EventBusStickyActivity.class};
31 |
32 | @Override
33 | protected void onCreate(Bundle savedInstanceState) {
34 | super.onCreate(savedInstanceState);
35 | setContentView(R.layout.activity_list);
36 | ButterKnife.bind(this);
37 |
38 | mEventbusList.setAdapter(new ArrayAdapter<>(this, R.layout.item_list, R.id.tv_items, mTitle));
39 |
40 | mEventbusList.setOnItemClickListener((adapterView, view, i, l)
41 | -> startActivity(new Intent(EventBusActivity.this, mClasses[i]))
42 | );
43 |
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/eventbus/eventbus/MessageEvent.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.eventbus.eventbus;
2 |
3 | /**
4 | * 定义 MessageEvent 对象
5 | *
6 | * @author zhangqin
7 | * @date 2017/5/13
8 | */
9 | public class MessageEvent {
10 |
11 | private String id;
12 | private String name;
13 | private String message;
14 |
15 | public MessageEvent() {
16 | }
17 |
18 | public MessageEvent(String id, String name, String message) {
19 | this.id = id;
20 | this.name = name;
21 | this.message = message;
22 | }
23 |
24 | public String getId() {
25 | return id;
26 | }
27 |
28 | public void setId(String id) {
29 | this.id = id;
30 | }
31 |
32 | public String getName() {
33 | return name;
34 | }
35 |
36 | public void setName(String name) {
37 | this.name = name;
38 | }
39 |
40 | public String getMessage() {
41 | return message;
42 | }
43 |
44 | public void setMessage(String message) {
45 | this.message = message;
46 | }
47 |
48 | @Override
49 | public String toString() {
50 | return "MessageEvent{" +
51 | "id=" + id +
52 | ", name='" + name + '\'' +
53 | ", message='" + message + '\'' +
54 | '}';
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/gridview/GridViewActivity.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.gridview;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 | import android.widget.GridView;
6 |
7 | import com.sdwfqin.sample.R;
8 |
9 | import java.util.ArrayList;
10 | import java.util.List;
11 |
12 | /**
13 | * 描述:建议使用RecyclerView替换GridView
14 | *
15 | * @author 张钦
16 | * @date 2017/3/10
17 | */
18 | public class GridViewActivity extends AppCompatActivity {
19 |
20 | List mList;
21 | private GridView mGridView;
22 | private SensorGridAdapter mAdpater;
23 |
24 | @Override
25 | protected void onCreate(Bundle savedInstanceState) {
26 | super.onCreate(savedInstanceState);
27 | setContentView(R.layout.activity_grid_view);
28 |
29 | mGridView = findViewById(R.id.gridview);
30 | initData();
31 | mAdpater = new SensorGridAdapter(this, mList);
32 | mGridView.setAdapter(mAdpater);
33 |
34 |
35 | }
36 |
37 | private void initData() {
38 | mList = new ArrayList<>();
39 | SensorBean mBean;
40 | String[] mStrings = getResources().getStringArray(R.array.sensor);
41 | for (int i = 0; i < mStrings.length; i++) {
42 | mBean = new SensorBean(mStrings[i]);
43 | mBean.setValue(3 * i);
44 | mBean.setMaxValue(2 * i + 3);
45 | mBean.setMinValue(2 * i);
46 | mList.add(mBean);
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/gridview/SensorBean.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.gridview;
2 |
3 | /**
4 | * 传感器信息容器类
5 | *
6 | * @author asus
7 | */
8 | public class SensorBean {
9 | // 传感器名称
10 | private String mNameString = "";
11 | // 传感器的值
12 | private int mValue = 0;
13 | // 传感器阀值的最小值
14 | private int minValue = Integer.MIN_VALUE;
15 | // 传感器阀值的最大值
16 | private int maxValue = Integer.MAX_VALUE;
17 |
18 | /**
19 | * 构造函数
20 | *
21 | * @param name 传感器名称
22 | */
23 | public SensorBean(String name) {
24 | this.mNameString = name;
25 | }
26 |
27 | /**
28 | * 获取传感器名称
29 | *
30 | * @return 传感器名称
31 | */
32 | public String getName() {
33 | return mNameString;
34 | }
35 |
36 | /**
37 | * 设置传感器名称
38 | *
39 | * @param name 传感器名称
40 | */
41 | public void setName(String name) {
42 | this.mNameString = name;
43 | }
44 |
45 | /**
46 | * 获取传感器的值
47 | *
48 | * @return 传感器值
49 | */
50 | public int getValue() {
51 | return mValue;
52 | }
53 |
54 | /**
55 | * 设置传感器的值
56 | *
57 | * @param value 传感器值
58 | */
59 | public void setValue(int value) {
60 | this.mValue = value;
61 | }
62 |
63 | /**
64 | * 获取传感器最小值
65 | *
66 | * @return 传感器最小值
67 | */
68 | public int getMinValue() {
69 | return minValue;
70 | }
71 |
72 | /**
73 | * 设置传感器最小值
74 | *
75 | * @param minValue 传感器最小值
76 | */
77 | public void setMinValue(int minValue) {
78 | this.minValue = minValue;
79 | }
80 |
81 | /**
82 | * 获取传感器最大值
83 | *
84 | * @return 传感器最大值
85 | */
86 | public int getMaxValue() {
87 | return maxValue;
88 | }
89 |
90 | /**
91 | * 设置传感器最大值
92 | *
93 | * @param maxValue 传感器最大值
94 | */
95 | public void setMaxValue(int maxValue) {
96 | this.maxValue = maxValue;
97 | }
98 |
99 | }
100 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/popupwindow/BasePopupWindow.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.popupwindow;
2 |
3 | import android.content.Context;
4 | import android.graphics.Rect;
5 | import android.os.Build;
6 | import android.util.AttributeSet;
7 | import android.view.View;
8 | import android.widget.PopupWindow;
9 |
10 | /**
11 | * 描述:
12 | *
13 | * @author 张钦
14 | * @date 2018/2/3
15 | */
16 | public class BasePopupWindow extends PopupWindow {
17 |
18 | public BasePopupWindow(Context context){
19 | super(context);
20 | }
21 |
22 | public BasePopupWindow(Context context, AttributeSet attrs) {
23 | super(context, attrs);
24 | }
25 |
26 | public BasePopupWindow(Context context, AttributeSet attrs, int defStyleAttr) {
27 | super(context, attrs, defStyleAttr);
28 | }
29 |
30 | public BasePopupWindow(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
31 | super(context, attrs, defStyleAttr, defStyleRes);
32 | }
33 |
34 | public BasePopupWindow(View contentView) {
35 | super(contentView);
36 | }
37 |
38 | public BasePopupWindow(int width, int height) {
39 | super(width, height);
40 | }
41 |
42 | public BasePopupWindow(View contentView, int width, int height) {
43 | super(contentView, width, height);
44 | }
45 |
46 | public BasePopupWindow(View contentView, int width, int height, boolean focusable) {
47 | super(contentView, width, height, focusable);
48 | }
49 |
50 | @Override
51 | public void showAsDropDown(View anchor) {
52 | if (Build.VERSION.SDK_INT >= 24) {
53 | Rect visibleFrame = new Rect();
54 | anchor.getGlobalVisibleRect(visibleFrame);
55 | int height = anchor.getResources().getDisplayMetrics().heightPixels - visibleFrame.bottom;
56 | setHeight(height);
57 | }
58 |
59 | super.showAsDropDown(anchor);
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/popupwindow/PopupMainActivity.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.popupwindow;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.widget.ArrayAdapter;
8 | import android.widget.ListView;
9 |
10 | import com.sdwfqin.sample.R;
11 |
12 | import butterknife.BindView;
13 | import butterknife.ButterKnife;
14 |
15 | public class PopupMainActivity extends AppCompatActivity {
16 |
17 | @BindView(R.id.list)
18 | ListView popupList;
19 | private Context mContext;
20 |
21 | @Override
22 | protected void onCreate(Bundle savedInstanceState) {
23 | super.onCreate(savedInstanceState);
24 | setContentView(R.layout.activity_list);
25 | ButterKnife.bind(this);
26 | mContext = this;
27 |
28 | initView();
29 | }
30 |
31 | private void initView() {
32 |
33 | String[] strings = new String[]{"PopDropDownBg", "PopshowAtLocation", "PopupAnim",
34 | "PopupShowAsDropDown","任意位置长按显示弹窗"};
35 | popupList.setAdapter(new ArrayAdapter<>(this, R.layout.item_list, R.id.tv_items, strings));
36 |
37 | popupList.setOnItemClickListener((parent, view, position, id) -> {
38 | switch (position) {
39 | case 0:
40 | startActivity(new Intent(mContext, PopDropDownBgActivity.class));
41 | break;
42 | case 1:
43 | startActivity(new Intent(mContext, PopshowAtLocationActivity.class));
44 | break;
45 | case 2:
46 | startActivity(new Intent(mContext, PopupAnimActivity.class));
47 | break;
48 | case 3:
49 | startActivity(new Intent(mContext, PopupShowAsDropDownActivity.class));
50 | break;
51 | case 4:
52 | startActivity(new Intent(mContext, LongShowPopupActivity.class));
53 | break;
54 | }
55 | });
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/recyclerview/RecyclerActivity.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.recyclerview;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.annotation.Nullable;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.widget.ArrayAdapter;
8 | import android.widget.ListView;
9 |
10 | import com.sdwfqin.sample.R;
11 | import com.sdwfqin.sample.recyclerview.doublelistlinkage.DoublelistlinkageActivity;
12 | import com.sdwfqin.sample.recyclerview.vlayout.VLayoutActivity;
13 |
14 | import butterknife.BindView;
15 | import butterknife.ButterKnife;
16 |
17 | /**
18 | * 描述:Recycler列表
19 | *
20 | * @author zhangqin
21 | * @date 2017/11/8
22 | */
23 | public class RecyclerActivity extends AppCompatActivity {
24 |
25 | @BindView(R.id.list)
26 | ListView mRecyclerList;
27 |
28 | private String[] mTitle = new String[]{"基本使用", "VLayout", "双列表联动"};
29 | private Class[] mClasses = new Class[]{com.sdwfqin.sample.recyclerview.recycler.RecyclerActivity.class, VLayoutActivity.class,
30 | DoublelistlinkageActivity.class};
31 |
32 | @Override
33 | protected void onCreate(@Nullable Bundle savedInstanceState) {
34 | super.onCreate(savedInstanceState);
35 |
36 | setContentView(R.layout.activity_list);
37 | ButterKnife.bind(this);
38 |
39 | mRecyclerList.setAdapter(new ArrayAdapter<>(this, R.layout.item_list, R.id.tv_items, mTitle));
40 |
41 | mRecyclerList.setOnItemClickListener((parent, view, position, id) ->
42 | startActivity(new Intent(RecyclerActivity.this, mClasses[position]))
43 | );
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/recyclerview/doublelistlinkage/CheckListener.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.recyclerview.doublelistlinkage;
2 |
3 | /**
4 | * title变化
5 | */
6 | public interface CheckListener {
7 | void check(int position);
8 | }
9 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/recyclerview/doublelistlinkage/RvListener.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.recyclerview.doublelistlinkage;
2 |
3 | //RecyclerView的item点击事件
4 | public interface RvListener {
5 |
6 | void onItemClick(int id, int position);
7 | }
8 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/recyclerview/doublelistlinkage/SortBean.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.recyclerview.doublelistlinkage;
2 |
3 |
4 | import java.io.Serializable;
5 |
6 | public class SortBean implements Serializable {
7 | private String name;
8 | private String tag;
9 | private boolean isTitle;
10 |
11 | @Override
12 | public String toString() {
13 | return "SortBean{" +
14 | "name='" + name + '\'' +
15 | ", tag='" + tag + '\'' +
16 | ", isTitle=" + isTitle +
17 | '}' + "\n";
18 | }
19 |
20 | public boolean isTitle() {
21 | return isTitle;
22 | }
23 |
24 | public void setTitle(boolean title) {
25 | isTitle = title;
26 | }
27 |
28 |
29 | public String getTag() {
30 | return tag;
31 | }
32 |
33 | public void setTag(String tag) {
34 | this.tag = tag;
35 | }
36 |
37 |
38 | public SortBean(String name) {
39 | this.name = name;
40 | }
41 |
42 | public String getName() {
43 | return name;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/recyclerview/recycler/RecyclerActivity.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.recyclerview.recycler;
2 |
3 | import android.support.annotation.Nullable;
4 | import android.support.v4.app.Fragment;
5 | import android.support.v4.app.FragmentManager;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.os.Bundle;
8 |
9 | import com.sdwfqin.sample.R;
10 |
11 | /**
12 | * 描述:Recycler学习
13 | *
14 | * @author zhangqin
15 | */
16 | public class RecyclerActivity extends AppCompatActivity {
17 |
18 | @Override
19 | protected void onCreate(@Nullable Bundle savedInstanceState) {
20 | super.onCreate(savedInstanceState);
21 |
22 | setContentView(R.layout.activity_recycler);
23 |
24 | FragmentManager fm = getSupportFragmentManager();
25 | Fragment fragment = fm.findFragmentById(R.id.fragment_container);
26 |
27 | if (fragment == null) {
28 | fragment = new RecyFragment();
29 | fm.beginTransaction()
30 | .add(R.id.fragment_container, fragment)
31 | .commit();
32 | }
33 |
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/recyclerview/recycler/data/MyData.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.recyclerview.recycler.data;
2 |
3 | import java.util.UUID;
4 |
5 | /**
6 | * 描述:实体类
7 | *
8 | * @author zhangqin
9 | * @date 2016/7/7
10 | */
11 | public class MyData {
12 |
13 | private UUID id;
14 | private String title;
15 |
16 | private String text;
17 |
18 | public MyData() {
19 |
20 | this.id = UUID.randomUUID();
21 | }
22 |
23 | public UUID getId() {
24 | return id;
25 | }
26 |
27 | public String getTitle() {
28 | return title;
29 | }
30 |
31 | public void setTitle(String title) {
32 | this.title = title;
33 | }
34 |
35 | public String getText() {
36 | return text;
37 | }
38 |
39 | public void setText(String text) {
40 | this.text = text;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/recyclerview/recycler/data/MyDataLab.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.recyclerview.recycler.data;
2 |
3 | import android.content.Context;
4 |
5 | import java.util.ArrayList;
6 | import java.util.Date;
7 | import java.util.List;
8 | import java.util.UUID;
9 |
10 | /**
11 | * 单例
12 | *
13 | * @author zhangqin
14 | * @date 2016/7/7
15 | */
16 | public class MyDataLab {
17 | private static MyDataLab sMyDataLab;
18 | private List mDatas;
19 |
20 | private MyDataLab(Context context) {
21 | mDatas = new ArrayList<>();
22 |
23 | //加载一点测试数据
24 | for (int i = 0; i < 20; i++) {
25 | MyData data = new MyData();
26 | data.setTitle("测试-" + i);
27 | data.setText(new Date().toString());
28 | mDatas.add(data);
29 | }
30 | }
31 |
32 | public static MyDataLab getMyData(Context context) {
33 | if (sMyDataLab == null) {
34 | sMyDataLab = new MyDataLab(context);
35 | }
36 | return sMyDataLab;
37 | }
38 |
39 | public List getDatas() {
40 | return mDatas;
41 | }
42 |
43 | public MyData getMyData(UUID id) {
44 | for (MyData data : mDatas) {
45 | if (data.getId().equals(id)) {
46 | return data;
47 | }
48 | }
49 | return null;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/recyclerview/vlayout/VLayoutActivity.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.recyclerview.vlayout;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | import com.sdwfqin.sample.R;
7 |
8 | /**
9 | * 描述:天猫VLayout
10 | *
11 | * @author zhangqin
12 | */
13 | public class VLayoutActivity extends AppCompatActivity {
14 |
15 | @Override
16 | protected void onCreate(Bundle savedInstanceState) {
17 | super.onCreate(savedInstanceState);
18 | setContentView(R.layout.activity_vlayout);
19 |
20 | getSupportFragmentManager()
21 | .beginTransaction()
22 | .replace(R.id.main_fl, VLayoutFragment.newInstance())
23 | .commit();
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/retrofit/RetrofitActivity.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.retrofit;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.widget.ArrayAdapter;
7 | import android.widget.ListView;
8 |
9 | import com.sdwfqin.sample.R;
10 | import com.sdwfqin.sample.retrofit.activity.RetrofitGetActivity;
11 | import com.sdwfqin.sample.retrofit.activity.RetrofitPostActivity;
12 |
13 | import butterknife.BindView;
14 | import butterknife.ButterKnife;
15 |
16 | /**
17 | * 描述:Retrofit网络请求
18 | *
19 | * @author zhangqin
20 | * @date 2017/11/8
21 | */
22 | public class RetrofitActivity extends AppCompatActivity {
23 |
24 | @BindView(R.id.list)
25 | ListView mRetrofitList;
26 |
27 | private String[] mTitle = new String[]{"入门例子", "get请求", "post请求+RxJava"};
28 | private Class[] mClasses = new Class[]{com.sdwfqin.sample.retrofit.activity.RetrofitActivity.class, RetrofitGetActivity.class,
29 | RetrofitPostActivity.class};
30 |
31 | @Override
32 | protected void onCreate(Bundle savedInstanceState) {
33 | super.onCreate(savedInstanceState);
34 | setContentView(R.layout.activity_list);
35 | ButterKnife.bind(this);
36 |
37 | mRetrofitList.setAdapter(new ArrayAdapter<>(this, R.layout.item_list, R.id.tv_items, mTitle));
38 |
39 | mRetrofitList.setOnItemClickListener((parent, view, position, id) ->
40 | startActivity(new Intent(RetrofitActivity.this, mClasses[position]))
41 | );
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/retrofit/api/ApiStores.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.retrofit.api;
2 |
3 | import com.sdwfqin.sample.retrofit.model.WeatherModel;
4 |
5 | import retrofit2.Call;
6 | import retrofit2.http.GET;
7 | import retrofit2.http.Path;
8 |
9 | /**
10 | * 描述:测试接口
11 | *
12 | * @author zhangqin
13 | * @date 2017/11/8
14 | */
15 | public interface ApiStores {
16 | /**
17 | * baseUrl
18 | */
19 | String API_SERVER_URL = "http://www.weather.com.cn/";
20 |
21 | /**
22 | * 加载天气
23 | * Path可以用于任何请求,拼接url地址
24 | * GET表示get请求
25 | *
26 | * @param cityIdJson 城市id
27 | * @return
28 | */
29 | @GET("adat/sk/{cityId}.html")
30 | Call loadDataByJson(@Path("cityId") String cityIdJson);
31 |
32 | /**
33 | * 返回字符串
34 | *
35 | * @param cityIdString 城市id
36 | * @return
37 | */
38 | @GET("adat/sk/{cityId}.html")
39 | Call loadDataByString(@Path("cityId") String cityIdString);
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/retrofit/api/RequestGetApi.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.retrofit.api;
2 |
3 | import com.sdwfqin.sample.retrofit.model.RequestModel;
4 |
5 | import retrofit2.Call;
6 | import retrofit2.http.GET;
7 | import retrofit2.http.Query;
8 |
9 | /**
10 | * 描述:get请求
11 | *
12 | * @author zhangqin
13 | * @date 2017/5/14
14 | */
15 | public interface RequestGetApi {
16 |
17 | // @get注解就表示get请求,@query表示请求参数,将会以key=value的方式拼接在url后面
18 | // Query非必填可以用null填充,例如:("小王子", null, 0, 3)
19 | @GET("GetServlet")
20 | Call getData(@Query("name") String name,
21 | @Query("value") String tag);
22 |
23 | // 如果Query参数比较多,那么可以通过@QueryMap方式将所有的参数集成在一个Map统一传递
24 | // public interface BlueService {
25 | // @GET("book/search")
26 | // Call getSearchBooks(@QueryMap Map options);
27 | // }
28 |
29 | // 调用的时候将所有的参数集合在统一的map中即可
30 | // Map options = new HashMap<>();
31 | // map.put("q","小王子");
32 | // map.put("tag",null);
33 | // map.put("start","0");
34 | // map.put("count","3");
35 | // Call call = mBlueService.getSearchBooks(options);
36 |
37 | // 假如你需要添加相同Key值,但是value却有多个的情况,一种方式是添加多个@query参数,
38 | // 还有一种简便的方式是将所有的value放置在列表中,然后在同一个@query下完成添加,
39 | // public interface BlueService {
40 | // @GET("book/search")
41 | // Call getSearchBooks(@Query("q") List name);
42 | // }
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/retrofit/api/RequestPostApi.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.retrofit.api;
2 |
3 | import com.sdwfqin.sample.retrofit.model.RequestModel;
4 |
5 | import io.reactivex.Observable;
6 | import retrofit2.http.Field;
7 | import retrofit2.http.FormUrlEncoded;
8 | import retrofit2.http.POST;
9 |
10 | /**
11 | * 描述:Post请求
12 | *
13 | * @author zhangqin
14 | * @date 2017/5/14
15 | */
16 | public interface RequestPostApi {
17 |
18 | /**
19 | * Post请求需要把请求参数放置在请求体中,而非拼接在url后面
20 | *
21 | * FormUrlEncode将会自动将请求参数的类型调整为application/x-www-form-urlencoded
22 | * FormUrlEncode不能用于get请求
23 | *
24 | * field注解将每一个请求参数都存放至请求体中,还可以添加encoded参数,该参数为boolean型
25 | * 例如:@Field(value = "book", encoded = true) String book
26 | * encoded参数为true的话,key-value-pair将会被编码,即将中文和特殊字符进行编码转换
27 | */
28 | @FormUrlEncoded // @FormUrlEncoded的默认编码方式为UTF-8
29 | @POST("PostServlet")
30 | Observable PostData(@Field("name") String name,
31 | @Field("value") String value);
32 |
33 | // @FieldMap
34 | // 与get请求中的@QueryMap类似
35 | // 假如说有更多的请求参数,那么通过一个一个的参数传递就显得很麻烦而且容易出错,这个时候就可以用FieldMap
36 | // @FormUrlEncoded
37 | // @POST("book/reviews")
38 | // Call addReviews(@FieldMap Map fields);
39 | // 这种方式生成的body格式为text/plain,例如book=123&title=小王子&content=非常好看
40 |
41 |
42 | // @Body(将请求参数封装到类中)
43 | // 如果Post请求参数有多个,那么统一封装到类中应该会更好
44 | // @FormUrlEncoded
45 | // @POST("book/reviews")
46 | // Call addReviews(@Body Reviews reviews);
47 | //
48 | // public class Reviews {
49 | // public String book;
50 | // public String title;
51 | // public String content;
52 | // public String rating;
53 | // }
54 | // 这种方式生成的body格式为json/plain
55 | // {
56 | // "book":"123",
57 | // "title":"小王子",
58 | // "content":"非常好看"
59 | // }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/retrofit/model/RequestModel.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.retrofit.model;
2 |
3 | /**
4 | * 描述:
5 | *
6 | * @author zhangqin
7 | * @date 2017/5/16
8 | */
9 | public class RequestModel {
10 |
11 | /**
12 | * uuid : 92770f95-0b9e-4655-9277-940233053d1a
13 | * name : 码农Mrz
14 | * value : www.sdwfqin.com
15 | * time : 2017-05-16 18:07:09
16 | */
17 |
18 | private String uuid;
19 | private String name;
20 | private String value;
21 | private String time;
22 |
23 | @Override
24 | public String toString() {
25 | return "RequestModel{" +
26 | "uuid='" + uuid + '\'' +
27 | ", name='" + name + '\'' +
28 | ", value='" + value + '\'' +
29 | ", time='" + time + '\'' +
30 | '}';
31 | }
32 |
33 | public String getUuid() {
34 | return uuid;
35 | }
36 |
37 | public void setUuid(String uuid) {
38 | this.uuid = uuid;
39 | }
40 |
41 | public String getName() {
42 | return name;
43 | }
44 |
45 | public void setName(String name) {
46 | this.name = name;
47 | }
48 |
49 | public String getValue() {
50 | return value;
51 | }
52 |
53 | public void setValue(String value) {
54 | this.value = value;
55 | }
56 |
57 | public String getTime() {
58 | return time;
59 | }
60 |
61 | public void setTime(String time) {
62 | this.time = time;
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/rxjava/RxJavaMainActivity.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.rxjava;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.widget.ArrayAdapter;
7 | import android.widget.ListView;
8 |
9 | import com.sdwfqin.sample.R;
10 |
11 | import butterknife.BindView;
12 | import butterknife.ButterKnife;
13 |
14 | /**
15 | * 描述:Rxjava2
16 | *
17 | * @author zhangqin
18 | */
19 | public class RxJavaMainActivity extends AppCompatActivity {
20 |
21 | @BindView(R.id.list)
22 | ListView mRxJavaList;
23 |
24 | private String[] mTitle = new String[]{"基础入门", "线程调度", "Map与FlatMap",
25 | "zip", "Flowable"};
26 | private Class[] mClasses = new Class[]{RxJavaActivity.class, RxJavaSchedulersActivity.class,
27 | RxJavaMapActivity.class, RxJavaZipActivity.class, RxJavaFlowableActivity.class};
28 |
29 | @Override
30 | protected void onCreate(Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 | setContentView(R.layout.activity_list);
33 | ButterKnife.bind(this);
34 |
35 | mRxJavaList.setAdapter(new ArrayAdapter<>(this, R.layout.item_list, R.id.tv_items, mTitle));
36 |
37 | mRxJavaList.setOnItemClickListener((parent, view, position, id) ->
38 | startActivity(new Intent(RxJavaMainActivity.this, mClasses[position]))
39 | );
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/rxjava/RxJavaSchedulersActivity.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.rxjava;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 |
6 | import com.blankj.utilcode.util.LogUtils;
7 | import com.sdwfqin.sample.R;
8 |
9 | import io.reactivex.Observable;
10 | import io.reactivex.android.schedulers.AndroidSchedulers;
11 | import io.reactivex.functions.Consumer;
12 | import io.reactivex.schedulers.Schedulers;
13 |
14 | /**
15 | * 描述:RxJava2线程切换
16 | *
17 | * @author zhangqin
18 | */
19 | public class RxJavaSchedulersActivity extends AppCompatActivity {
20 |
21 | @Override
22 | protected void onCreate(Bundle savedInstanceState) {
23 | super.onCreate(savedInstanceState);
24 | setContentView(R.layout.activity_rx_java);
25 |
26 | Observable observable = Observable.create(emitter -> {
27 | LogUtils.e("Observable thread is : " + Thread.currentThread().getName());
28 | LogUtils.e("emit 1");
29 | emitter.onNext(1);
30 | });
31 |
32 | // Consumer(消费者)表示只关心onNext事件
33 | Consumer consumer = integer -> {
34 | LogUtils.e("Observer thread is :" + Thread.currentThread().getName());
35 | LogUtils.e("onNext: " + integer);
36 | };
37 |
38 | /**
39 | * subscribeOn: 指定Observable发送事件的线程
40 | * observeOn: 指定Observer接收事件的线程
41 | *
42 | * Schedulers.io() 代表io操作的线程, 通常用于网络,读写文件等io密集型的操作
43 | * Schedulers.computation() 代表CPU计算密集型的操作, 例如需要大量计算的操作
44 | * Schedulers.newThread() 代表一个常规的新线程
45 | * AndroidSchedulers.mainThread() 代表Android的主线程
46 | */
47 | observable.subscribeOn(Schedulers.newThread())
48 | .observeOn(AndroidSchedulers.mainThread())
49 | .subscribe(consumer);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/service/service/InteractiveService.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.service.service;
2 |
3 | import android.app.Service;
4 | import android.content.Intent;
5 | import android.os.Binder;
6 | import android.os.IBinder;
7 | import android.support.annotation.Nullable;
8 | import android.widget.Toast;
9 |
10 | import com.blankj.utilcode.util.LogUtils;
11 |
12 | /**
13 | * 可交互的后台服务,返回一个代理对象
14 | *
15 | * startService和bindService -> 混合性交互的后台服务,即可以单独运行后台服务,也可以运行后台服务中提供的方法,
16 | * 其完整的生命周期是:onCreate->onStartCommand->onBind->onUnBind->onDestroy
17 | *
18 | * @author zhangqin
19 | * @date 2016/12/8
20 | */
21 | public class InteractiveService extends Service {
22 |
23 | // 绑定
24 | @Nullable
25 | @Override
26 | public IBinder onBind(Intent intent) {
27 | LogUtils.e("onBind: ");
28 | return new MyBind();
29 | }
30 |
31 | /**
32 | * 代理类
33 | */
34 | public class MyBind extends Binder {
35 | public void showLog() {
36 | LogUtils.e("showLog: ");
37 | }
38 |
39 | public void show(String str) {
40 | Toast.makeText(getApplicationContext(), str, Toast.LENGTH_SHORT).show();
41 | // 调用外部类
42 | callLog(str);
43 | }
44 | }
45 |
46 | public void callLog(String str) {
47 | LogUtils.e("callLog: " + str);
48 | }
49 |
50 | // 解绑
51 | @Override
52 | public boolean onUnbind(Intent intent) {
53 | LogUtils.e("onUnbind: ");
54 | return super.onUnbind(intent);
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/service/service/MyIntentService.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.service.service;
2 |
3 | import android.app.IntentService;
4 | import android.content.Intent;
5 |
6 | import com.blankj.utilcode.util.LogUtils;
7 |
8 | /**
9 | * 描述:后台服务
10 | *
11 | * @author zhangqin
12 | * @date 2016/12/8
13 | */
14 | public class MyIntentService extends IntentService {
15 |
16 | /**
17 | * 需要注意构造方法
18 | */
19 | public MyIntentService() {
20 | super("name");
21 | LogUtils.e("MyIntentService: ");
22 | }
23 |
24 | @Override
25 | protected void onHandleIntent(Intent intent) {
26 | // 在此处执行耗时操作
27 | LogUtils.e("onHandleIntent: " + "开始执行");
28 | try {
29 | Thread.sleep(10*1000);
30 | } catch (InterruptedException e) {
31 | e.printStackTrace();
32 | }
33 | LogUtils.e("onHandleIntent: " + "执行结束");
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/service/service/NotInteractiveService.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.service.service;
2 |
3 | import android.app.Service;
4 | import android.content.Intent;
5 | import android.os.IBinder;
6 | import android.support.annotation.Nullable;
7 |
8 | import com.blankj.utilcode.util.LogUtils;
9 |
10 | import java.util.Timer;
11 | import java.util.TimerTask;
12 |
13 | /**
14 | * 不可交互的后台服务即是普通的Service,Service的生命周期很简单,
15 | * 分别为onCreate、onStartCommand、onDestroy这三个。
16 | * 当我们startService()的时候,首次创建Service会回调onCreate()方法,
17 | * 然后回调onStartCommand()方法,再次startService()的时候,
18 | * 就只会执行一次onStartCommand()。
19 | * 服务一旦开启后,我们就需要通过stopService()方法或者stopSelf()方法,
20 | * 就能把服务关闭,这时就会回调onDestroy()
21 | *
22 | * @author zhangqin
23 | * @date 2016/12/8
24 | */
25 | public class NotInteractiveService extends Service {
26 |
27 | private Timer mTimer;
28 |
29 | @Nullable
30 | @Override
31 | public IBinder onBind(Intent intent) {
32 | LogUtils.e( "onBind: ");
33 | return null;
34 | }
35 |
36 | @Override
37 | public void onCreate() {
38 | LogUtils.e( "onCreate: ");
39 | super.onCreate();
40 | }
41 |
42 | @Override
43 | public int onStartCommand(Intent intent, int flags, int startId) {
44 | LogUtils.e( "onStartCommand: ");
45 | mTimer = new Timer();
46 | mTimer.schedule(new TimerTask() {
47 | @Override
48 | public void run() {
49 | LogUtils.e( "====NotInteractiveService====");
50 | }
51 | }, 0, 1000);
52 | return super.onStartCommand(intent, flags, startId);
53 | }
54 |
55 | @Override
56 | public void onDestroy() {
57 | mTimer.cancel();
58 | LogUtils.e( "onDestroy: ");
59 | super.onDestroy();
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/service/service/StageService.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.service.service;
2 |
3 | import android.app.Notification;
4 | import android.app.NotificationManager;
5 | import android.app.PendingIntent;
6 | import android.app.Service;
7 | import android.app.TaskStackBuilder;
8 | import android.content.Context;
9 | import android.content.Intent;
10 | import android.os.IBinder;
11 | import android.support.annotation.Nullable;
12 |
13 | import com.blankj.utilcode.util.LogUtils;
14 | import com.sdwfqin.sample.MainActivity;
15 | import com.sdwfqin.sample.R;
16 |
17 | /**
18 | * 描述:常驻通知栏
19 | *
20 | * @author zhangqin
21 | * @date 2016/12/8
22 | */
23 | public class StageService extends Service {
24 |
25 | @Nullable
26 | @Override
27 | public IBinder onBind(Intent intent) {
28 | LogUtils.e("onBind: ");
29 | return null;
30 | }
31 |
32 | @Override
33 | public void onCreate() {
34 | LogUtils.e("onCreate: ");
35 | showNotification();
36 | super.onCreate();
37 | }
38 |
39 | private void showNotification() {
40 | // 创建通知栏
41 | Notification.Builder mBuilder = new Notification.Builder(this)
42 | .setSmallIcon(R.drawable.img_tm)
43 | .setContentTitle("标题")
44 | .setContentText("文本");
45 | // 点击跳转到Activity
46 | Intent intent = new Intent(this, MainActivity.class);
47 | // 创建任务栈
48 | TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
49 | stackBuilder.addParentStack(MainActivity.class);
50 | stackBuilder.addNextIntent(intent);
51 | PendingIntent pendingIntent = stackBuilder.getPendingIntent(0,PendingIntent.FLAG_UPDATE_CURRENT);
52 | // 设置跳转
53 | mBuilder.setContentIntent(pendingIntent);
54 |
55 | // 获取通知服务
56 | NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
57 | // 构建通知
58 | Notification notification = mBuilder.build();
59 | // 显示通知
60 | nm.notify(0,notification);
61 |
62 | // 启动前台服务
63 | startForeground(0,notification);
64 | }
65 |
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/sqlitetable/MySqlite.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.sqlitetable;
2 |
3 | import android.content.Context;
4 | import android.database.sqlite.SQLiteDatabase;
5 | import android.database.sqlite.SQLiteOpenHelper;
6 |
7 | /**
8 | * 描述:创建数据库
9 | *
10 | * @author zhangqin
11 | * @date 2017/2/28
12 | */
13 | public class MySqlite extends SQLiteOpenHelper {
14 |
15 | private static final int VERSION = 1;
16 | private static final String DATABASE_NAME = "lights.db";
17 |
18 | public MySqlite(Context context) {
19 | super(context, DATABASE_NAME, null, VERSION);
20 | }
21 |
22 | @Override
23 | public void onCreate(SQLiteDatabase sqLiteDatabase) {
24 |
25 | //创建表SQL语句
26 | String stuTable = "create table usertable" +
27 | "(_id integer primary key autoincrement," +
28 | "name text," +
29 | "red text," +
30 | "green text," +
31 | "yellow text)";
32 | sqLiteDatabase.execSQL(stuTable);
33 | }
34 |
35 | @Override
36 | public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
37 |
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/view/delbtn/DeleteButtonActivity.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.view.delbtn;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.widget.EditText;
6 |
7 | import com.sdwfqin.sample.R;
8 |
9 | import butterknife.BindView;
10 | import butterknife.ButterKnife;
11 |
12 | public class DeleteButtonActivity extends AppCompatActivity {
13 |
14 | @BindView(R.id.btn_del)
15 | DeleteButtonView mBtnDel;
16 | @BindView(R.id.edit)
17 | EditText mEdit;
18 |
19 | @Override
20 | protected void onCreate(Bundle savedInstanceState) {
21 | super.onCreate(savedInstanceState);
22 | setContentView(R.layout.activity_delete_button);
23 | ButterKnife.bind(this);
24 | mBtnDel.setEditText(mEdit);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/view/descircle/DesCircleActivity.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.view.descircle;
2 |
3 | import android.graphics.Color;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 |
7 | import com.sdwfqin.sample.R;
8 |
9 | import butterknife.BindView;
10 | import butterknife.ButterKnife;
11 |
12 | /**
13 | * 描述:自定义View1圆
14 | *
15 | * @author zhangqin
16 | */
17 | public class DesCircleActivity extends AppCompatActivity {
18 |
19 | @BindView(R.id.viewz1)
20 | DesCircleView mViewz1;
21 |
22 | @Override
23 | protected void onCreate(Bundle savedInstanceState) {
24 | super.onCreate(savedInstanceState);
25 | setContentView(R.layout.activity_des_circle);
26 | ButterKnife.bind(this);
27 |
28 | mViewz1.setColor(Color.RED);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/view/gesturedetector/GestureDetectorActivity.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.view.gesturedetector;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | import com.sdwfqin.sample.R;
7 |
8 | /**
9 | * 描述:手势识别
10 | *
11 | * @author zhangqin
12 | * @date 2017/4/26
13 | */
14 | public class GestureDetectorActivity extends AppCompatActivity {
15 |
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | setContentView(R.layout.activity_gesture_detector);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/view/motionslop/MeTsActivity.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.view.motionslop;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 |
6 | import com.sdwfqin.sample.R;
7 |
8 | /**
9 | * 描述:MotionEvent与TouchSlop
10 | *
11 | * @author zhangqin
12 | * @date 2017/4/26
13 | */
14 | public class MeTsActivity extends AppCompatActivity {
15 |
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | setContentView(R.layout.activity_me_ts);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/view/paypwdinput/PayPwdInputActivity.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.view.paypwdinput;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.widget.Toast;
6 |
7 | import com.sdwfqin.sample.R;
8 |
9 | import butterknife.BindView;
10 | import butterknife.ButterKnife;
11 |
12 | /**
13 | * 描述:验证码
14 | *
15 | * @author zhangqin
16 | */
17 | public class PayPwdInputActivity extends AppCompatActivity {
18 |
19 | @BindView(R.id.password)
20 | PayPwdInputView mPassword;
21 |
22 | @Override
23 | protected void onCreate(Bundle savedInstanceState) {
24 | super.onCreate(savedInstanceState);
25 | setContentView(R.layout.activity_pay_pwd_input);
26 | ButterKnife.bind(this);
27 |
28 | mPassword.setComparePassword("123456", new PayPwdInputView.OnPasswordListener() {
29 | @Override
30 | public void onSuccess(String psd) {
31 | Toast.makeText(PayPwdInputActivity.this, "匹配成功", Toast.LENGTH_SHORT).show();
32 | }
33 |
34 | @Override
35 | public void onError() {
36 | Toast.makeText(PayPwdInputActivity.this, "匹配失败", Toast.LENGTH_SHORT).show();
37 | }
38 | });
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/view/rippleanimation/RippleAnimationActivity.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.view.rippleanimation;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 |
6 | import com.sdwfqin.sample.R;
7 |
8 | import butterknife.BindView;
9 | import butterknife.ButterKnife;
10 |
11 | /**
12 | * 描述:波纹动画
13 | *
14 | * @author zhangqin
15 | * @date 2017/7/27
16 | */
17 | public class RippleAnimationActivity extends AppCompatActivity {
18 |
19 | @BindView(R.id.ImageView)
20 | android.widget.ImageView mImageView;
21 | @BindView(R.id.layout_RippleAnimation)
22 | RippleAnimationView mLayoutRippleAnimation;
23 |
24 | @Override
25 | protected void onCreate(Bundle savedInstanceState) {
26 | super.onCreate(savedInstanceState);
27 | setContentView(R.layout.activity_ripple_animation);
28 | ButterKnife.bind(this);
29 |
30 | mImageView = findViewById(R.id.ImageView);
31 | mLayoutRippleAnimation = findViewById(R.id.layout_RippleAnimation);
32 |
33 | mImageView.setOnClickListener(view -> {
34 | if (mLayoutRippleAnimation.isRippleRunning()) {
35 | mLayoutRippleAnimation.stopRippleAnimation();
36 | } else {
37 | mLayoutRippleAnimation.startRippleAnimation();
38 | }
39 | });
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/view/rippleanimation/RippleCircleView.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.view.rippleanimation;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.util.AttributeSet;
6 | import android.view.View;
7 |
8 | /**
9 | * @author zhangqin
10 | * @date 2017/7/27
11 | */
12 | public class RippleCircleView extends View {
13 |
14 | private RippleAnimationView mRippleAnimationView;
15 |
16 | public RippleCircleView(Context context) {
17 | super(context);
18 | }
19 |
20 | public RippleCircleView(Context context, AttributeSet attrs) {
21 | super(context, attrs);
22 | }
23 |
24 | public RippleCircleView(Context context, AttributeSet attrs, int defStyleAttr) {
25 | super(context, attrs, defStyleAttr);
26 | }
27 |
28 | public RippleCircleView(RippleAnimationView rippleAnimationView, Context context) {
29 | super(context);
30 | this.mRippleAnimationView = rippleAnimationView;
31 | this.setVisibility(View.INVISIBLE);
32 | }
33 |
34 | @Override
35 | protected void onDraw(Canvas canvas) {
36 | int radius = (Math.min(getWidth(), getHeight())) / 2;
37 | canvas.drawCircle(radius, radius, radius - mRippleAnimationView.mRippleStrokeWidth, mRippleAnimationView.mPaint);
38 | }
39 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/view/scroller/ScrollerActivity.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.view.scroller;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 |
6 | import com.sdwfqin.sample.R;
7 |
8 | /**
9 | * 描述:View滑动
10 | *
11 | * @author zhangqin
12 | * @date 2017/4/26
13 | */
14 | public class ScrollerActivity extends AppCompatActivity {
15 |
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | setContentView(R.layout.activity_scroller);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/view/surface/SurfaceActivity.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.view.surface;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | import com.sdwfqin.sample.R;
7 |
8 | /**
9 | * 描述:SurfaceView
10 | *
11 | * @author zhangqin
12 | * @date 2017/6/27
13 | */
14 | public class SurfaceActivity extends AppCompatActivity {
15 |
16 | @Override
17 | protected void onCreate(Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | setContentView(R.layout.activity_surface);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/view/surfacepalette/SurfacePaletteActivity.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.view.surfacepalette;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.widget.TextView;
6 |
7 | import com.sdwfqin.sample.R;
8 |
9 | import butterknife.BindView;
10 | import butterknife.ButterKnife;
11 |
12 | /**
13 | * 描述:SurfaceView画板
14 | *
15 | * @author zhangqin
16 | * @date 2017/6/27
17 | */
18 | public class SurfacePaletteActivity extends AppCompatActivity {
19 |
20 | @BindView(R.id.surface)
21 | PaletteSurfaceView mSurface;
22 | @BindView(R.id.btn_save)
23 | TextView mBtnSave;
24 |
25 | @Override
26 | protected void onCreate(Bundle savedInstanceState) {
27 | super.onCreate(savedInstanceState);
28 | setContentView(R.layout.activity_surface_palette);
29 | ButterKnife.bind(this);
30 |
31 | mBtnSave.setOnClickListener(view -> {
32 | // TODO 待实现
33 | // boolean save = ImageUtils.save(bitmap, Config.SAVE_REAL_PATH + "/" + System.currentTimeMillis() + ".jpg", Bitmap.CompressFormat.JPEG);
34 | // if (save) {
35 | // Toast.makeText(this, "保存成功", Toast.LENGTH_SHORT).show();
36 | // } else {
37 | // Toast.makeText(this, "保存失败", Toast.LENGTH_SHORT).show();
38 | // }
39 | });
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/view/viewevent/AView.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.view.viewevent;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.Nullable;
5 | import android.support.v7.widget.AppCompatTextView;
6 | import android.util.AttributeSet;
7 | import android.view.MotionEvent;
8 |
9 | import com.blankj.utilcode.util.LogUtils;
10 |
11 | /**
12 | * @author zhangqin
13 | * @date 2017/5/4
14 | */
15 | public class AView extends AppCompatTextView {
16 |
17 | public AView(Context context) {
18 | super(context);
19 | }
20 |
21 | public AView(Context context, @Nullable AttributeSet attrs) {
22 | super(context, attrs);
23 | }
24 |
25 | public AView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
26 | super(context, attrs, defStyleAttr);
27 | }
28 |
29 | @Override
30 | public boolean dispatchTouchEvent(MotionEvent ev) {
31 | LogUtils.i("dispatchTouchEvent: ");
32 | return super.dispatchTouchEvent(ev);
33 | }
34 |
35 | @Override
36 | public boolean onTouchEvent(MotionEvent event) {
37 | LogUtils.i("onTouchEvent: ");
38 | // 返回true当前view处理,返回false向上传递
39 | return true;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/view/viewevent/GroupView.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.view.viewevent;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.util.Log;
6 | import android.view.MotionEvent;
7 | import android.widget.LinearLayout;
8 |
9 | /**
10 | * @author zhangqin
11 | * @date 2017/5/4
12 | */
13 | public class GroupView extends LinearLayout {
14 |
15 | private static final String TAG = "GroupView";
16 |
17 | public GroupView(Context context) {
18 | super(context);
19 | }
20 |
21 | public GroupView(Context context, AttributeSet attrs) {
22 | super(context, attrs);
23 | }
24 |
25 | public GroupView(Context context, AttributeSet attrs, int defStyleAttr) {
26 | super(context, attrs, defStyleAttr);
27 | }
28 |
29 | // 首先调用这个方法,必须调用super才回继续向下执行,不然不会继续执行
30 | @Override
31 | public boolean dispatchTouchEvent(MotionEvent ev) {
32 | Log.e(TAG, "dispatchTouchEvent: ");
33 |
34 | boolean consume = false;
35 |
36 | if (onInterceptTouchEvent(ev)) {
37 | consume = onTouchEvent(ev);
38 | } else {
39 | consume = super.dispatchTouchEvent(ev);
40 | }
41 | Log.e(TAG, "dispatchTouchEvent: " + consume);
42 | return consume;
43 | }
44 |
45 | @Override
46 | public boolean onInterceptTouchEvent(MotionEvent ev) {
47 | Log.e(TAG, "onInterceptTouchEvent: ");
48 | return true;
49 | }
50 |
51 | @Override
52 | public boolean onTouchEvent(MotionEvent event) {
53 | Log.e(TAG, "onTouchEvent: ");
54 | // 返回true消费事件
55 | return super.onTouchEvent(event);
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/view/viewevent/ViewEventActivity.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.view.viewevent;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | import com.sdwfqin.sample.R;
7 |
8 | /**
9 | * @author zhangqin
10 | * @date 2017/5/4
11 | */
12 | public class ViewEventActivity extends AppCompatActivity {
13 |
14 | @Override
15 | protected void onCreate(Bundle savedInstanceState) {
16 | super.onCreate(savedInstanceState);
17 | setContentView(R.layout.activity_view_event);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/view/viewposition/TranslationView.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.view.viewposition;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.Nullable;
5 | import android.util.AttributeSet;
6 | import android.view.MotionEvent;
7 | import android.widget.LinearLayout;
8 |
9 | /**
10 | * 描述:
11 | *
12 | * @author zhangqin
13 | * @date 2017/4/27
14 | */
15 | public class TranslationView extends LinearLayout {
16 |
17 | public TranslationView(Context context) {
18 | super(context);
19 | }
20 |
21 | public TranslationView(Context context, @Nullable AttributeSet attrs) {
22 | super(context, attrs);
23 | }
24 |
25 | public TranslationView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
26 | super(context, attrs, defStyleAttr);
27 | }
28 |
29 | private float x = 0, y = 0;
30 |
31 | @Override
32 | public boolean onTouchEvent(MotionEvent event) {
33 | switch (event.getAction()) {
34 | case MotionEvent.ACTION_DOWN:
35 | x = event.getRawX();
36 | y = event.getRawY();
37 | break;
38 | case MotionEvent.ACTION_MOVE:
39 |
40 | float rawX = event.getRawX();
41 | float rawY = event.getRawY();
42 |
43 | float translationX = getTranslationX();
44 | float translationY = getTranslationY();
45 |
46 | // 计算偏移量
47 | float deltaX = (rawX - x) + translationX;
48 | float deltaY = (rawY - y) + translationY;
49 |
50 | setTranslation(deltaX, deltaY);
51 |
52 | x = event.getRawX();
53 | y = event.getRawY();
54 | break;
55 | case MotionEvent.ACTION_UP:
56 | break;
57 | default:
58 | break;
59 | }
60 | return true;
61 | }
62 |
63 | private void setTranslation(float deltaX, float deltaY) {
64 | // 正数往右,负数往左
65 | setTranslationX(deltaX);
66 | setTranslationY(deltaY);
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/app/src/main/java/com/sdwfqin/sample/view/viewposition/ViewPositionActivity.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.sample.view.viewposition;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.app.AppCompatActivity;
5 |
6 | import com.sdwfqin.sample.R;
7 |
8 | import butterknife.BindView;
9 | import butterknife.ButterKnife;
10 |
11 | /**
12 | * 描述:View的位置参数
13 | *
14 | * @author zhangqin
15 | * @date 2017/4/27
16 | */
17 | public class ViewPositionActivity extends AppCompatActivity {
18 |
19 | @BindView(R.id.position_view)
20 | PositionView positionView;
21 |
22 | @Override
23 | protected void onCreate(Bundle savedInstanceState) {
24 | super.onCreate(savedInstanceState);
25 | setContentView(R.layout.activity_view_position);
26 | ButterKnife.bind(this);
27 | positionView.setOnClickListener(v -> positionView.setTranslation());
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/anim_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/anim_layout_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/context_menu_enter.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/context_menu_exit.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/fade.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/hold.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/hyperspace_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/hyperspace_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
12 |
16 |
18 |
21 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/my_alpha_action.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/my_scale_action.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/push_left_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/push_left_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/push_up_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/push_up_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/scale_rotate.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
16 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/scale_translate.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
16 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/scale_translate_rotate.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
14 |
21 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_down_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_left.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_right.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
18 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_up_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/wave_scale.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
12 |
14 |
17 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/zoom_enter.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
19 |
20 |
22 |
24 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/zoom_exit.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
24 |
25 |
28 |
32 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/img_tm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/app/src/main/res/drawable-hdpi/img_tm.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/list_line.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/app/src/main/res/drawable-hdpi/list_line.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/pop_bg.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/app/src/main/res/drawable-hdpi/pop_bg.9.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/sensor_value_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/app/src/main/res/drawable-hdpi/sensor_value_bg.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/zuk_1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/app/src/main/res/drawable-hdpi/zuk_1.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/zuk_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/app/src/main/res/drawable-hdpi/zuk_2.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/zuk_3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/app/src/main/res/drawable-hdpi/zuk_3.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/table_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/table_frame_gray.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_animator1.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_async_task.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
17 |
18 |
23 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_bar_chart.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_bottomsheet.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
20 |
21 |
26 |
27 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_camera.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_canvas.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_courtesy_card.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
21 |
22 |
26 |
27 |
28 |
32 |
33 |
37 |
38 |
42 |
43 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_delete_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
18 |
19 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_des_circle.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_doublelistlinkage.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
20 |
21 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_drag_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_draw0.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_event_bus.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
20 |
21 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_event_bus_sticky.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
20 |
21 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_gesture_detector.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_grid_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_handler.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_long_show_popup.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_me_ts.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_pay_pwd_input.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
21 |
22 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_picture.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
19 |
20 |
26 |
27 |
28 |
33 |
34 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_recycler.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_retrofit.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
20 |
21 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_retrofit_get.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
20 |
21 |
24 |
25 |
29 |
30 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_retrofit_post.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_ripple_animation.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
20 |
21 |
28 |
29 |
30 |
31 |
38 |
39 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_rx_java.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_scroller.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_spannable.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_surface.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_surface_palette.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_t2.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_view_event.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_view_position.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_viewpager.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_vlayout.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_web_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/anim_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/anim_activity_popup.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
14 |
15 |
21 |
22 |
26 |
27 |
33 |
34 |
38 |
39 |
45 |
46 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dialog_bottom_sheet.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
19 |
20 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/drop_down_bg_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/drop_down_bg_activity_popup.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
21 |
22 |
26 |
27 |
33 |
34 |
38 |
39 |
45 |
46 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fingerprint_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
21 |
22 |
31 |
32 |
37 |
38 |
46 |
47 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_recycler.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_sort_detail.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_vlayout.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_classify_detail.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
16 |
17 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_recycler.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
14 |
15 |
20 |
21 |
27 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_sort_list.xml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_title.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
18 |
19 |
29 |
30 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_vlayout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_vlayout_banner.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_vlayout_sticky.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/notifit_bar.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
19 |
20 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/page_one.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/page_three.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/page_two.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/show_as_drop_down_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/show_as_drop_down_activity_popup.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
17 |
18 |
22 |
23 |
29 |
30 |
34 |
35 |
41 |
42 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/show_at_location_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/show_at_location_activity_popup.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
16 |
17 |
21 |
22 |
28 |
29 |
33 |
34 |
40 |
41 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_scrolling.xml:
--------------------------------------------------------------------------------
1 |
5 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/arrow_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/app/src/main/res/mipmap-hdpi/arrow_right.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/iv_second.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/app/src/main/res/mipmap-hdpi/iv_second.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_fp_40px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/app/src/main/res/mipmap-xhdpi/ic_fp_40px.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | sdwfqin
3 |
4 | Hello blank fragment
5 | ScrollingActivity
6 | Settings
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
28 |
29 |
32 |
33 |
38 |
39 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/file_paths_public.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | apply from: "config.gradle"
2 | buildscript {
3 | repositories {
4 | google()
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:3.6.3'
9 | classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
10 | }
11 | }
12 |
13 | allprojects {
14 | repositories {
15 | google()
16 | jcenter()
17 | maven { url "https://jitpack.io" }
18 | maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local/' }
19 | mavenCentral()
20 | }
21 | }
22 |
23 | task clean(type: Delete) {
24 | delete rootProject.buildDir
25 | }
--------------------------------------------------------------------------------
/config.gradle:
--------------------------------------------------------------------------------
1 | ext {
2 | // Sdk and tools
3 | minSdkVersion = 17
4 | targetSdkVersion = 28
5 | compileSdkVersion = 28
6 | buildToolsVersion = '28.0.3'
7 |
8 | // App dependencies
9 | support = '28.0.0'
10 | constraint = '1.1.3'
11 | vlayout = '1.2.18'
12 | butterknifeVersion = '8.8.1'
13 | daggerVersion = '2.17'
14 | eventbus = '3.1.1'
15 | greendao = '3.2.2'
16 | brvah = '2.9.42'
17 | SwipeDelMenuLayout = 'V1.3.0'
18 | glide = '4.8.0'
19 | banner = '1.4.10'
20 | matisse = '0.5.2-beta3'
21 | easypermissions = '2.0.0'
22 | utilcode = '1.22.0'
23 | ucrop = '2.2.2'
24 |
25 | // squareup
26 | retrofitVersion = '2.4.0'
27 | okhttpVersion = '3.11.0'
28 |
29 | // rxjava
30 | rxjavaVersion = '2.2.2'
31 | rxandroidVersion = '2.1.0'
32 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Aug 23 16:42:52 CST 2019
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-5.6.4-all.zip
7 |
--------------------------------------------------------------------------------
/greendaomvp/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/greendaomvp/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'org.greenrobot.greendao'
3 |
4 | android {
5 | compileSdkVersion rootProject.ext.compileSdkVersion
6 | buildToolsVersion rootProject.ext.buildToolsVersion
7 |
8 | defaultConfig {
9 | applicationId "com.sdwfqin.greendaosample"
10 | minSdkVersion rootProject.ext.minSdkVersion
11 | targetSdkVersion rootProject.ext.targetSdkVersion
12 | versionCode 1
13 | versionName "1.0"
14 | }
15 | buildTypes {
16 | release {
17 | minifyEnabled false
18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
19 | }
20 | }
21 | compileOptions {
22 | sourceCompatibility JavaVersion.VERSION_1_8
23 | targetCompatibility JavaVersion.VERSION_1_8
24 | }
25 | }
26 |
27 | //greendao配置
28 | greendao {
29 | //版本号,升级时可配置
30 | schemaVersion 1
31 | }
32 |
33 | dependencies {
34 | implementation fileTree(include: ['*.jar'], dir: 'libs')
35 | // support
36 | implementation "com.android.support:appcompat-v7:$support"
37 | implementation "com.android.support:design:$support"
38 | implementation "com.android.support:recyclerview-v7:$support"
39 | implementation "com.android.support.constraint:constraint-layout:$constraint"
40 |
41 | // butterknife
42 | implementation "com.jakewharton:butterknife:$butterknifeVersion"
43 | annotationProcessor "com.jakewharton:butterknife-compiler:$butterknifeVersion"
44 |
45 | // greendao
46 | implementation "org.greenrobot:greendao:$rootProject.ext.greendao"
47 |
48 | // BaseRecyclerViewAdapterHelper
49 | implementation "com.github.CymChad:BaseRecyclerViewAdapterHelper:$brvah"
50 |
51 | // SwipeDelMenuLayout
52 | implementation "com.github.mcxtzhang:SwipeDelMenuLayout:$SwipeDelMenuLayout"
53 | }
54 |
--------------------------------------------------------------------------------
/greendaomvp/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\Android\AndroidSdk/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 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/greendaomvp/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/greendaomvp/src/main/java/com/sdwfqin/greendaosample/BaseApplication.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.greendaosample;
2 |
3 | import android.app.Application;
4 | import android.database.sqlite.SQLiteDatabase;
5 |
6 | import com.sdwfqin.greendaosample.model.entry.DaoMaster;
7 | import com.sdwfqin.greendaosample.model.entry.DaoSession;
8 |
9 | /**
10 | * 描述:Application
11 | *
12 | * @author zhangqin
13 | * @date 2017/5/1
14 | */
15 | public class BaseApplication extends Application {
16 |
17 | /**
18 | * DaoSession:管理所有的Dao对象,Dao对象中存在着增删改查等API
19 | */
20 | private static DaoSession daoSession;
21 |
22 | @Override
23 | public void onCreate() {
24 | super.onCreate();
25 | // 配置数据库
26 | setupDatabase();
27 | }
28 |
29 | /**
30 | * 配置数据库
31 | */
32 | private void setupDatabase() {
33 | // DaoMaster:GreenDao的顶级对象,作为数据库对象、用于创建表和删除表
34 | // DevOpenHelper: 创建SQLite数据库的SQLiteOpenHelper的具体实现
35 | // 创建数据库student.db"
36 | DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(this, "student.db", null);
37 | // 获取可写数据库
38 | SQLiteDatabase db = helper.getWritableDatabase();
39 | // 获取数据库对象
40 | DaoMaster daoMaster = new DaoMaster(db);
41 | // 获取Dao对象管理者
42 | daoSession = daoMaster.newSession();
43 | }
44 |
45 | public static DaoSession getDaoInstant() {
46 | return daoSession;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/greendaomvp/src/main/java/com/sdwfqin/greendaosample/adapter/MainAdapter.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.greendaosample.adapter;
2 |
3 | import android.support.annotation.LayoutRes;
4 | import android.support.annotation.Nullable;
5 |
6 | import com.chad.library.adapter.base.BaseQuickAdapter;
7 | import com.chad.library.adapter.base.BaseViewHolder;
8 | import com.sdwfqin.greendaosample.R;
9 | import com.sdwfqin.greendaosample.model.entry.Student;
10 |
11 | import java.util.List;
12 |
13 | /**
14 | * Created by zhangqin on 2016/12/19.
15 | */
16 | // 第一个参数是实体类,第二个参数是ViewHolder(可以自定义,必须继承BaseViewHolder)
17 | public class MainAdapter extends BaseQuickAdapter {
18 |
19 | public MainAdapter(@LayoutRes int layoutResId, @Nullable List data) {
20 | super(layoutResId, data);
21 | }
22 |
23 | @Override
24 | protected void convert(BaseViewHolder helper, Student item) {
25 | // 添加点击事件
26 | helper.addOnClickListener(R.id.ll_a)
27 | .addOnClickListener(R.id.btn_del)
28 | .addOnClickListener(R.id.btn_xg)
29 | .setText(R.id.tv_xh, item.getId() + "")
30 | .setText(R.id.tv_xm, item.getName() + "")
31 | .setText(R.id.tv_xb, item.getSex() + "")
32 | .setText(R.id.tv_dz, item.getAddress() + "");
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/greendaomvp/src/main/java/com/sdwfqin/greendaosample/model/interactor/MainInteractor.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.greendaosample.model.interactor;
2 |
3 | import com.sdwfqin.greendaosample.model.entry.Student;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * Created by zhangqin on 2017/5/5.
9 | */
10 |
11 | public interface MainInteractor {
12 |
13 | interface OnFinishedListener {
14 | void onFinishedSuccess(List items);
15 |
16 | void onFinishedError(String s);
17 | }
18 |
19 | void initData(OnFinishedListener listener);
20 |
21 | interface OnMesListener {
22 | void onMesSuccess(String s);
23 |
24 | void onMesError(String s);
25 | }
26 |
27 | void upData(Student student, OnMesListener onMesListener);
28 |
29 | void delData(Student student, OnMesListener onMesListener);
30 |
31 | void createData(Student student, OnMesListener onMesListener);
32 | }
33 |
--------------------------------------------------------------------------------
/greendaomvp/src/main/java/com/sdwfqin/greendaosample/presenter/MainPresenter.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.greendaosample.presenter;
2 |
3 | import com.sdwfqin.greendaosample.model.entry.Student;
4 |
5 | /**
6 | * 描述:P层接口
7 | *
8 | * @author zhangqin
9 | * @date 2017/5/5
10 | */
11 | public interface MainPresenter {
12 |
13 | void onResume();
14 |
15 | void OnClickUpData(Student student, int position);
16 |
17 | void OnClickDelData(Student student, int position);
18 |
19 | void OnUpData(Student student, int position);
20 |
21 | void OnDelData(Student student, int position);
22 |
23 | void OnCreateData(Student student);
24 |
25 | void createData();
26 |
27 | void onDestroy();
28 | }
29 |
--------------------------------------------------------------------------------
/greendaomvp/src/main/java/com/sdwfqin/greendaosample/view/MainView.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.greendaosample.view;
2 |
3 | import com.sdwfqin.greendaosample.model.entry.Student;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * 描述:V层接口
9 | *
10 | * @author zhangqin
11 | * @date 2017/5/5
12 | */
13 | public interface MainView {
14 |
15 | /**
16 | * 显示加载动画
17 | */
18 | void showProgress();
19 |
20 | /**
21 | * 隐藏加载动画
22 | */
23 | void hideProgress();
24 |
25 | /**
26 | * 显示底部弹窗
27 | */
28 | void showBottomSheetDialog();
29 |
30 | /**
31 | * 更新数据
32 | *
33 | * @param student
34 | * @param position
35 | */
36 | void upData(Student student, int position);
37 |
38 | /**
39 | * 更新列表
40 | *
41 | * @param student
42 | * @param position
43 | */
44 | void upAdapter(Student student, int position);
45 |
46 | /**
47 | * 更新列表
48 | *
49 | * @param position
50 | */
51 | void upAdapter(int position);
52 |
53 | /**
54 | * 向列表添加数据
55 | *
56 | * @param student
57 | */
58 | void addAdapter(Student student);
59 |
60 | /**
61 | * 删除数据
62 | *
63 | * @param student
64 | * @param position
65 | */
66 | void delData(Student student, int position);
67 |
68 | /**
69 | * 显示吐司
70 | *
71 | * @param message
72 | */
73 | void showMessage(String message);
74 |
75 | /**
76 | * 设置条目
77 | *
78 | * @param items
79 | */
80 | void setItems(List items);
81 | }
82 |
--------------------------------------------------------------------------------
/greendaomvp/src/main/res/drawable/ic_add_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/greendaomvp/src/main/res/drawable/ic_search_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
10 |
11 |
--------------------------------------------------------------------------------
/greendaomvp/src/main/res/menu/menu_frist.xml:
--------------------------------------------------------------------------------
1 |
5 |
11 |
15 |
16 |
--------------------------------------------------------------------------------
/greendaomvp/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/greendaomvp/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/greendaomvp/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/greendaomvp/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/greendaomvp/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/greendaomvp/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/greendaomvp/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/greendaomvp/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/greendaomvp/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/greendaomvp/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/greendaomvp/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/greendaomvp/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/greendaomvp/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/greendaomvp/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/greendaomvp/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/greendaomvp/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/greendaomvp/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/greendaomvp/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/greendaomvp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/greendaomvp/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/greendaomvp/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #3F51B5
6 |
7 | #ffffff
8 | #FFFFFF
9 | #2e2e2e
10 | #000000
11 | #FF0000
12 | #E0FFFF
13 |
14 | #0000
15 |
16 |
--------------------------------------------------------------------------------
/greendaomvp/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | GreenDaoSample
3 |
4 |
--------------------------------------------------------------------------------
/local.properties:
--------------------------------------------------------------------------------
1 | ## This file must *NOT* be checked into Version Control Systems,
2 | # as it contains information specific to your local configuration.
3 | #
4 | # Location of the SDK. This is only used by Gradle.
5 | # For customization when using a Version Control System, please read the
6 | # header note.
7 | #Fri Jan 25 17:00:57 CST 2019
8 | sdk.dir=/Users/zhangqin/Library/Android/sdk
9 |
--------------------------------------------------------------------------------
/mvpseed/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/mvpseed/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in D:\Android\AndroidSdk/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 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/mvpseed/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/mvpseed/src/main/java/com/sdwfqin/mvpseed/base/App.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.mvpseed.base;
2 |
3 | import android.app.Application;
4 |
5 | import com.blankj.utilcode.util.LogUtils;
6 | import com.blankj.utilcode.util.Utils;
7 | import com.sdwfqin.mvpseed.di.component.AppComponent;
8 | import com.sdwfqin.mvpseed.di.component.DaggerAppComponent;
9 | import com.sdwfqin.mvpseed.di.module.AppModule;
10 | import com.sdwfqin.mvpseed.di.module.HttpModule;
11 |
12 | /**
13 | * 描述:
14 | *
15 | * @author zhangqin
16 | * @date 2017/6/9
17 | */
18 | public class App extends Application {
19 |
20 | private static AppComponent appComponent;
21 | private static App instance;
22 |
23 | public static synchronized App getInstance() {
24 | return instance;
25 | }
26 |
27 | @Override
28 | public void onCreate() {
29 | instance = this;
30 | super.onCreate();
31 | Utils.init(this);
32 | initLog();
33 | }
34 |
35 | private void initLog() {
36 | LogUtils.Config config = LogUtils.getConfig()
37 | .setLogSwitch(Constants.LOG_TYPE)
38 | .setConsoleSwitch(Constants.LOG_TYPE);
39 | }
40 |
41 | public static AppComponent getAppComponent() {
42 | if (appComponent == null) {
43 | appComponent = DaggerAppComponent.builder()
44 | .appModule(new AppModule(instance))
45 | .httpModule(new HttpModule())
46 | .build();
47 | }
48 | return appComponent;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/mvpseed/src/main/java/com/sdwfqin/mvpseed/base/BasePresenter.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.mvpseed.base;
2 |
3 | /**
4 | * 描述:Presenter基类
5 | *
6 | * @author zhangqin
7 | */
8 | public interface BasePresenter {
9 |
10 | void attachView(T view);
11 |
12 | void detachView();
13 | }
14 |
--------------------------------------------------------------------------------
/mvpseed/src/main/java/com/sdwfqin/mvpseed/base/BaseView.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.mvpseed.base;
2 |
3 | /**
4 | * 描述:View的基类
5 | *
6 | * @author zhangqin
7 | */
8 | public interface BaseView {
9 |
10 | void showErrorMsg(String msg);
11 | }
12 |
--------------------------------------------------------------------------------
/mvpseed/src/main/java/com/sdwfqin/mvpseed/base/Constants.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.mvpseed.base;
2 |
3 | import java.io.File;
4 |
5 | /**
6 | * 描述:全局变量
7 | *
8 | * @author zhangqin
9 | */
10 | public class Constants {
11 |
12 | public static final boolean LOG_TYPE = true;
13 |
14 | /**
15 | * 路径:/data/data/com.sdwfqin.drrmvp/cache/data
16 | */
17 | public static final String PATH_DATA = App.getInstance().getCacheDir().getAbsolutePath() + File.separator + "data";
18 |
19 | /**
20 | * 路径:/data/data/com.sdwfqin.drrmvp/cache/data/NetCache
21 | */
22 | public static final String PATH_CACHE = PATH_DATA + "/NetCache";
23 | }
24 |
--------------------------------------------------------------------------------
/mvpseed/src/main/java/com/sdwfqin/mvpseed/base/RxPresenter.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.mvpseed.base;
2 |
3 | import io.reactivex.disposables.CompositeDisposable;
4 | import io.reactivex.disposables.Disposable;
5 |
6 | /**
7 | * 描述:RxPresenter
8 | *
9 | * @author zhangqin
10 | */
11 | public class RxPresenter implements BasePresenter {
12 |
13 | protected T mView;
14 | protected CompositeDisposable mCompositeDisposable;
15 |
16 | protected void unSubscribe() {
17 | if (mCompositeDisposable != null) {
18 | mCompositeDisposable.dispose();
19 | }
20 | }
21 |
22 | protected void addSubscribe(Disposable subscription) {
23 | if (mCompositeDisposable == null) {
24 | mCompositeDisposable = new CompositeDisposable();
25 | }
26 | mCompositeDisposable.add(subscription);
27 | }
28 |
29 | @Override
30 | public void attachView(T view) {
31 | this.mView = view;
32 | }
33 |
34 | @Override
35 | public void detachView() {
36 | this.mView = null;
37 | unSubscribe();
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/mvpseed/src/main/java/com/sdwfqin/mvpseed/contract/MainContract.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.mvpseed.contract;
2 |
3 | import com.sdwfqin.mvpseed.base.BasePresenter;
4 | import com.sdwfqin.mvpseed.base.BaseView;
5 | import com.sdwfqin.mvpseed.model.bean.TestBean;
6 |
7 | /**
8 | * 描述:绑定类
9 | *
10 | * @author zhangqin
11 | * @date 2017/6/9
12 | */
13 | public interface MainContract {
14 |
15 | interface View extends BaseView {
16 |
17 | /**
18 | * 设置TextView中的数据
19 | *
20 | * @param testBean
21 | */
22 | void showTextView(TestBean testBean);
23 |
24 | }
25 |
26 | interface Presenter extends BasePresenter {
27 |
28 | /**
29 | * 获取数据
30 | *
31 | * @param cityId
32 | */
33 | void getWeather(String cityId);
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/mvpseed/src/main/java/com/sdwfqin/mvpseed/di/component/ActivityComponent.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.mvpseed.di.component;
2 |
3 | import android.app.Activity;
4 |
5 | import com.sdwfqin.mvpseed.ui.MainActivity;
6 | import com.sdwfqin.mvpseed.di.module.ActivityModule;
7 | import com.sdwfqin.mvpseed.di.scope.ActivityScope;
8 |
9 | import dagger.Component;
10 |
11 | /**
12 | * 描述:Activity注入器
13 | *
14 | * @author zhangqin
15 | * @date 2017/11/9
16 | */
17 | @ActivityScope
18 | @Component(dependencies = AppComponent.class, modules = ActivityModule.class)
19 | public interface ActivityComponent {
20 |
21 | Activity getActivity();
22 |
23 | /**
24 | * MainActivity注入
25 | *
26 | * @param mainActivity
27 | */
28 | void inject(MainActivity mainActivity);
29 | }
30 |
--------------------------------------------------------------------------------
/mvpseed/src/main/java/com/sdwfqin/mvpseed/di/component/AppComponent.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.mvpseed.di.component;
2 |
3 | import com.sdwfqin.mvpseed.base.App;
4 | import com.sdwfqin.mvpseed.di.module.AppModule;
5 | import com.sdwfqin.mvpseed.di.module.HttpModule;
6 | import com.sdwfqin.mvpseed.model.http.RetrofitHelper;
7 |
8 | import javax.inject.Singleton;
9 |
10 | import dagger.Component;
11 |
12 | /**
13 | * 描述:全局注入器
14 | *
15 | * @author zhangqin
16 | */
17 | @Singleton
18 | @Component(modules = {AppModule.class, HttpModule.class})
19 | public interface AppComponent {
20 |
21 | App getContext(); // 提供App的Context
22 |
23 | RetrofitHelper retrofitHelper(); //提供http的帮助类
24 | }
25 |
--------------------------------------------------------------------------------
/mvpseed/src/main/java/com/sdwfqin/mvpseed/di/component/FragmentComponent.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.mvpseed.di.component;
2 |
3 | import android.app.Activity;
4 |
5 | import com.sdwfqin.mvpseed.di.module.FragmentModule;
6 | import com.sdwfqin.mvpseed.di.scope.FragmentScope;
7 |
8 | import dagger.Component;
9 |
10 | /**
11 | * 描述:Fragment注入器
12 | *
13 | * @author zhangqin
14 | */
15 | @FragmentScope
16 | @Component(dependencies = AppComponent.class, modules = FragmentModule.class)
17 | public interface FragmentComponent {
18 |
19 | Activity getActivity();
20 | }
21 |
--------------------------------------------------------------------------------
/mvpseed/src/main/java/com/sdwfqin/mvpseed/di/module/ActivityModule.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.mvpseed.di.module;
2 |
3 | import android.app.Activity;
4 |
5 | import com.sdwfqin.mvpseed.di.scope.ActivityScope;
6 |
7 | import dagger.Module;
8 | import dagger.Provides;
9 |
10 | /**
11 | * 描述:ActivityModule
12 | *
13 | * @author zhangqin
14 | */
15 | @Module
16 | public class ActivityModule {
17 | private Activity mActivity;
18 |
19 | public ActivityModule(Activity activity) {
20 | this.mActivity = activity;
21 | }
22 |
23 | @Provides
24 | @ActivityScope
25 | public Activity provideActivity() {
26 | return mActivity;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/mvpseed/src/main/java/com/sdwfqin/mvpseed/di/module/AppModule.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.mvpseed.di.module;
2 |
3 | import com.sdwfqin.mvpseed.base.App;
4 | import com.sdwfqin.mvpseed.model.http.HttpHelper;
5 | import com.sdwfqin.mvpseed.model.http.RetrofitHelper;
6 |
7 | import javax.inject.Singleton;
8 |
9 | import dagger.Module;
10 | import dagger.Provides;
11 |
12 | /**
13 | * 描述:AppModule
14 | *
15 | * @author zhangqin
16 | */
17 | @Module
18 | public class AppModule {
19 | private final App application;
20 |
21 | public AppModule(App application) {
22 | this.application = application;
23 | }
24 |
25 | @Provides
26 | @Singleton
27 | App provideApplicationContext() {
28 | return application;
29 | }
30 |
31 | @Provides
32 | @Singleton
33 | HttpHelper provideHttpHelper(RetrofitHelper retrofitHelper) {
34 | return retrofitHelper;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/mvpseed/src/main/java/com/sdwfqin/mvpseed/di/module/FragmentModule.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.mvpseed.di.module;
2 |
3 | import android.app.Activity;
4 | import android.support.v4.app.Fragment;
5 |
6 | import com.sdwfqin.mvpseed.di.scope.FragmentScope;
7 |
8 | import dagger.Module;
9 | import dagger.Provides;
10 |
11 | /**
12 | * 描述:FragmentModule
13 | *
14 | * @author zhangqin
15 | */
16 | @Module
17 | public class FragmentModule {
18 |
19 | private Fragment fragment;
20 |
21 | public FragmentModule(Fragment fragment) {
22 | this.fragment = fragment;
23 | }
24 |
25 | @Provides
26 | @FragmentScope
27 | public Activity provideActivity() {
28 | return fragment.getActivity();
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/mvpseed/src/main/java/com/sdwfqin/mvpseed/di/qualifier/TestUrl.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.mvpseed.di.qualifier;
2 |
3 | import java.lang.annotation.Documented;
4 | import java.lang.annotation.Retention;
5 |
6 | import javax.inject.Qualifier;
7 |
8 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
9 |
10 | /**
11 | * 描述:自定义注解,区分不同的BaseUrl
12 | *
13 | * @author zhangqin
14 | */
15 | @Qualifier
16 | @Documented
17 | @Retention(RUNTIME)
18 | public @interface TestUrl {
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/mvpseed/src/main/java/com/sdwfqin/mvpseed/di/scope/ActivityScope.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.mvpseed.di.scope;
2 |
3 | import java.lang.annotation.Retention;
4 |
5 | import javax.inject.Scope;
6 |
7 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
8 |
9 | /**
10 | * 描述:作用域注解
11 | *
12 | * @author zhangqin
13 | */
14 | @Scope
15 | @Retention(RUNTIME)
16 | public @interface ActivityScope {
17 | }
18 |
--------------------------------------------------------------------------------
/mvpseed/src/main/java/com/sdwfqin/mvpseed/di/scope/FragmentScope.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.mvpseed.di.scope;
2 |
3 | import java.lang.annotation.Retention;
4 |
5 | import javax.inject.Scope;
6 |
7 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
8 |
9 | /**
10 | * 描述:作用域注解
11 | *
12 | * @author zhangqin
13 | */
14 | @Scope
15 | @Retention(RUNTIME)
16 | public @interface FragmentScope {
17 | }
18 |
--------------------------------------------------------------------------------
/mvpseed/src/main/java/com/sdwfqin/mvpseed/model/http/HttpHelper.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.mvpseed.model.http;
2 |
3 | import com.sdwfqin.mvpseed.model.bean.TestBean;
4 |
5 | import io.reactivex.Flowable;
6 |
7 | /**
8 | * @author zhangqin
9 | * @date 2017/9/7
10 | */
11 | public interface HttpHelper {
12 |
13 | /**
14 | * 测试
15 | * @param cityId
16 | * @return
17 | */
18 | Flowable fetchTest(String cityId);
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/mvpseed/src/main/java/com/sdwfqin/mvpseed/model/http/RetrofitHelper.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.mvpseed.model.http;
2 |
3 | import com.sdwfqin.mvpseed.model.bean.TestBean;
4 |
5 | import javax.inject.Inject;
6 |
7 | import io.reactivex.Flowable;
8 |
9 | /**
10 | * 描述:Retrofit帮助类
11 | *
12 | * @author zhangqin
13 | * @date 2017/9/7
14 | */
15 | public class RetrofitHelper implements HttpHelper {
16 |
17 | private TestApi mTestApiService;
18 |
19 | /**
20 | * 注入
21 | *
22 | * 详见:HttpModule -> provideTestService
23 | *
24 | * @param testApiService TestApi接口的实现类的实例对象
25 | */
26 | @Inject
27 | public RetrofitHelper(TestApi testApiService) {
28 | this.mTestApiService = testApiService;
29 | }
30 |
31 | /**
32 | * 调用接口中的业务方法
33 | *
34 | * @param cityId
35 | * @return
36 | */
37 | @Override
38 | public Flowable fetchTest(String cityId) {
39 | return mTestApiService.getTest(cityId);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/mvpseed/src/main/java/com/sdwfqin/mvpseed/model/http/TestApi.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.mvpseed.model.http;
2 |
3 | import com.sdwfqin.mvpseed.model.bean.TestBean;
4 |
5 | import io.reactivex.Flowable;
6 | import retrofit2.http.GET;
7 | import retrofit2.http.Path;
8 |
9 | /**
10 | * Created by zhangqin on 2017/6/9.
11 | */
12 |
13 | /**
14 | * 描述:Retrofit接口
15 | *
16 | * @author zhangqin
17 | * @date 2017/6/9
18 | */
19 | public interface TestApi {
20 |
21 | String HOST = "http://www.weather.com.cn/";
22 |
23 | /**
24 | * 测试接口
25 | *
26 | * @param cityId
27 | * @return
28 | */
29 | @GET("adat/sk/{cityId}.html")
30 | Flowable getTest(@Path("cityId") String cityId);
31 | }
32 |
--------------------------------------------------------------------------------
/mvpseed/src/main/java/com/sdwfqin/mvpseed/presenter/MainPresenter.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.mvpseed.presenter;
2 |
3 | import com.blankj.utilcode.util.LogUtils;
4 | import com.sdwfqin.mvpseed.base.RxPresenter;
5 | import com.sdwfqin.mvpseed.contract.MainContract;
6 | import com.sdwfqin.mvpseed.model.http.RetrofitHelper;
7 | import com.sdwfqin.mvpseed.util.RxUtil;
8 |
9 | import javax.inject.Inject;
10 |
11 | /**
12 | * 描述:Presenter
13 | *
14 | * @author zhangqin
15 | * @date 2017/6/9
16 | */
17 | public class MainPresenter extends RxPresenter implements MainContract.Presenter {
18 |
19 | private RetrofitHelper mRetrofitHelper;
20 |
21 | @Inject
22 | public MainPresenter(RetrofitHelper retrofitHelper) {
23 | this.mRetrofitHelper = retrofitHelper;
24 | }
25 |
26 |
27 | @Override
28 | public void getWeather(String cityId) {
29 | addSubscribe(mRetrofitHelper.fetchTest(cityId)
30 | // compose() 是针对 Observable 自身进行变换
31 | .compose(RxUtil.rxSchedulerHelper())
32 | .subscribe(testBean -> {
33 | mView.showTextView(testBean);
34 | LogUtils.i(testBean.toString());
35 | }, throwable -> {
36 | LogUtils.e(throwable.getMessage());
37 | }));
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/mvpseed/src/main/java/com/sdwfqin/mvpseed/ui/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.mvpseed.ui;
2 |
3 | import android.widget.TextView;
4 |
5 | import com.blankj.utilcode.util.LogUtils;
6 | import com.sdwfqin.mvpseed.R;
7 | import com.sdwfqin.mvpseed.base.BaseActivity;
8 | import com.sdwfqin.mvpseed.contract.MainContract;
9 | import com.sdwfqin.mvpseed.model.bean.TestBean;
10 | import com.sdwfqin.mvpseed.presenter.MainPresenter;
11 |
12 | /**
13 | * Dagger2+Rxjava2+Retrofit
14 | *
15 | * @author zhangqin
16 | * @version 1.0.0
17 | * @since 2017-06-09
18 | *
19 | * 博客: www.sdwfqin.com 邮箱: zhangqin@sdwfqin.com
20 | * 项目地址:https://github.com/sdwfqin/AndroidSamples
21 | */
22 | public class MainActivity extends BaseActivity implements MainContract.View {
23 |
24 | private TextView mMain_tv;
25 |
26 | @Override
27 | protected void initInject() {
28 | getActivityComponent().inject(this);
29 | }
30 |
31 | @Override
32 | protected int getLayout() {
33 | return R.layout.activity_main;
34 | }
35 |
36 | @Override
37 | protected void initEventAndData() {
38 |
39 | LogUtils.i("日志测试");
40 |
41 | mMain_tv = (TextView) findViewById(R.id.main_tv);
42 |
43 | mPresenter.getWeather("101190201");
44 | }
45 |
46 | @Override
47 | public void showTextView(TestBean testBean) {
48 | mMain_tv.setText(testBean.getWeatherinfo().toString());
49 | }
50 | }
--------------------------------------------------------------------------------
/mvpseed/src/main/java/com/sdwfqin/mvpseed/util/RxUtil.java:
--------------------------------------------------------------------------------
1 | package com.sdwfqin.mvpseed.util;
2 |
3 | import io.reactivex.FlowableTransformer;
4 | import io.reactivex.android.schedulers.AndroidSchedulers;
5 | import io.reactivex.schedulers.Schedulers;
6 |
7 | /**
8 | * 描述:Rx工具类
9 | *
10 | * @author zhangqin
11 | */
12 | public class RxUtil {
13 |
14 | /**
15 | * 统一线程处理
16 | * @param
17 | * @return
18 | */
19 | public static FlowableTransformer rxSchedulerHelper() { //compose简化线程
20 | return observable -> observable.subscribeOn(Schedulers.io())
21 | .observeOn(AndroidSchedulers.mainThread());
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/mvpseed/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/mvpseed/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/mvpseed/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/mvpseed/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/mvpseed/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/mvpseed/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/mvpseed/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/mvpseed/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/mvpseed/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/mvpseed/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/mvpseed/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/mvpseed/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/mvpseed/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/mvpseed/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/mvpseed/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/mvpseed/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/mvpseed/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/mvpseed/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/mvpseed/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/mvpseed/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sdwfqin/AndroidSamples/913638677a0018e2ab10ff2c66975c1f82c972e2/mvpseed/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/mvpseed/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/mvpseed/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | mvpseed
3 |
4 |
--------------------------------------------------------------------------------
/mvpseed/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':greendaomvp', ':mvpseed'
2 |
--------------------------------------------------------------------------------