├── .gitignore ├── .idea ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── gradle.xml ├── inspectionProfiles │ ├── Project_Default.xml │ └── profiles_settings.xml ├── markdown-navigator.xml ├── markdown-navigator │ └── profiles_settings.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── Aoplib ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── aop │ │ └── statistics │ │ ├── action │ │ └── ActionHandleAop.java │ │ ├── click │ │ └── ClickHandleAop.java │ │ ├── life │ │ └── LifeCycleHandleAop.java │ │ └── log │ │ ├── AopLog.java │ │ └── AopLogPointcut.java │ └── res │ └── values │ └── strings.xml ├── AppLibrary ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── views │ │ └── danxx │ │ └── com │ │ └── widgetlibrary │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── aidl │ │ └── danxx │ │ │ └── library │ │ │ └── socket │ │ │ └── IBackService.aidl │ ├── java │ │ └── danxx │ │ │ └── library │ │ │ ├── adapter │ │ │ ├── BaseRecyclerViewAdapter.java │ │ │ └── BaseRecyclerViewHolder.java │ │ │ ├── focusview │ │ │ ├── AnimateFactory.java │ │ │ └── FocusHorizontalScrollView.java │ │ │ ├── socket │ │ │ ├── BackService.java │ │ │ ├── BackServiceOkio.java │ │ │ └── SocketTest.java │ │ │ ├── tools │ │ │ ├── AnimTools.java │ │ │ ├── AppUtils.java │ │ │ ├── DeviceUtils.java │ │ │ ├── FocusAnimUtils.java │ │ │ ├── MyLog.java │ │ │ └── UIUtils.java │ │ │ └── widget │ │ │ ├── Bezier.java │ │ │ ├── Bezier2.java │ │ │ ├── CustomImgContainer.java │ │ │ ├── CustomViewPager.java │ │ │ ├── DXPullRefreshMoreView.java │ │ │ ├── DXPullRefreshView.java │ │ │ ├── IPullToRefreshMore.java │ │ │ ├── InvalidateTest.java │ │ │ ├── InvalidateTestViewGroup.java │ │ │ ├── OnePlusCloudy.java │ │ │ ├── RecyclerWheelView.java │ │ │ ├── RefreshMoreLisenter.java │ │ │ ├── SampleCircleImageView.java │ │ │ ├── SelectorFactory.java │ │ │ ├── StackCardContainer.java │ │ │ ├── TabStrip.java │ │ │ ├── VerticalTabIndicator.java │ │ │ └── WaveLoadingView.java │ └── res │ │ ├── drawable-hdpi │ │ ├── refresh_arrow_down.png │ │ ├── refresh_arrow_up.png │ │ └── refresh_success.png │ │ ├── drawable │ │ ├── bg_focus.9.png │ │ ├── default_focus.9.png │ │ ├── focus_bg_test.9.png │ │ ├── focus_shadow.9.png │ │ ├── hehe.png │ │ ├── home_select_focus.9.png │ │ ├── item_foucs_bg.xml │ │ ├── main_page_item_selected.9.png │ │ ├── shape_focus_bg.xml │ │ └── vip_focus.9.png │ │ ├── layout │ │ ├── activity_test.xml │ │ ├── footer_refresh_view.xml │ │ ├── header_refresh_view.xml │ │ ├── item_recycler_wheel.xml │ │ └── refresh_top_item.xml │ │ └── values │ │ ├── attr.xml │ │ ├── attrs.xml │ │ ├── strings.xml │ │ └── values.xml │ └── test │ └── java │ └── views │ └── danxx │ └── com │ └── widgetlibrary │ └── ExampleUnitTest.java ├── Channel1App ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── danxx │ │ └── views │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ ├── App.java │ │ │ ├── danxx │ │ │ └── views │ │ │ │ ├── ActivityCustomImgContainer.java │ │ │ │ ├── ActivityHeartSocket.java │ │ │ │ ├── ActivityTest.java │ │ │ │ ├── ActivityVerticalTabIndicator.java │ │ │ │ ├── ActivityViewPagerIndicator.java │ │ │ │ ├── CircleImageViewActivity.java │ │ │ │ ├── CustomViewPagerActivity.java │ │ │ │ ├── ImageLoadActivity.java │ │ │ │ ├── LooperThread.java │ │ │ │ ├── MainActivity.java │ │ │ │ ├── NdkActivity.java │ │ │ │ ├── RefreshListViewActivity.java │ │ │ │ ├── RefreshScrollActivity.java │ │ │ │ └── SocketActivity.java │ │ │ ├── java │ │ │ ├── decorator │ │ │ │ ├── ChaoFan.java │ │ │ │ ├── ChaoMian.java │ │ │ │ ├── EggDecorator.java │ │ │ │ ├── IFood.java │ │ │ │ ├── IFoodDecorator.java │ │ │ │ └── RoseDecorator.java │ │ │ ├── factory │ │ │ │ ├── ChaoFan.java │ │ │ │ ├── ChuanKitchen.java │ │ │ │ ├── EggChaoFan.java │ │ │ │ ├── Kitchen.java │ │ │ │ └── RoseChaoFan.java │ │ │ └── ui │ │ │ │ ├── ActivityDecorator.java │ │ │ │ └── ActivityFactory.java │ │ │ ├── jzp │ │ │ └── myapplication │ │ │ │ └── JniUtils.java │ │ │ └── ndk │ │ │ └── NdkJniUtils.java │ ├── jni │ │ ├── com_jzp_myapplication_JniUtils.h │ │ ├── com_ndk_NdkJniUtils.h │ │ ├── jnidemo.c │ │ └── jnitest.c │ └── res │ │ ├── drawable │ │ ├── app_bg.png │ │ ├── default_pic_loading.9.png │ │ ├── ic_launcher.png │ │ ├── image.png │ │ ├── item_bg.png │ │ ├── tab_selector.xml │ │ ├── test.png │ │ ├── test2.png │ │ ├── view_shadow.xml │ │ ├── vp1.png │ │ ├── vp2.png │ │ └── vp3.png │ │ ├── layout │ │ ├── activity_activity_recycler_test.xml │ │ ├── activity_custom_view_group.xml │ │ ├── activity_custom_viewpager.xml │ │ ├── activity_decorator.xml │ │ ├── activity_heart_socket.xml │ │ ├── activity_load_image.xml │ │ ├── activity_main.xml │ │ ├── activity_ndk.xml │ │ ├── activity_refresh_list_view.xml │ │ ├── activity_sample_circle_imageview.xml │ │ ├── activity_scroll.xml │ │ ├── activity_socket.xml │ │ ├── activity_vertical_tab_indicator.xml │ │ ├── activity_viewpager.xml │ │ ├── anim_layout.xml │ │ ├── focus_item_view.xml │ │ ├── image_display.xml │ │ ├── layout_invalidate.xml │ │ ├── layout_test.xml │ │ └── layout_three_d.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ ├── mm1.jpg │ │ ├── mm2.jpg │ │ ├── mm3.jpg │ │ ├── mm4.jpg │ │ ├── mm5.jpg │ │ ├── mm6.jpg │ │ ├── mm7.jpg │ │ └── mm8.jpg │ │ ├── mipmap-xxhdpi │ │ ├── card_view_bg0.jpg │ │ ├── card_view_bg1.jpg │ │ ├── card_view_bg2.jpg │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ ├── values-w820dp │ │ └── dimens.xml │ │ └── values │ │ ├── attr.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── danxx │ └── views │ └── ExampleUnitTest.java ├── Channel2App ├── .gitignore ├── build.gradle ├── gradle.properties ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── danxx │ │ └── channelapp │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── aidl │ │ └── com │ │ │ └── anno │ │ │ └── service │ │ │ ├── aidl │ │ │ └── MyAIDLService.aidl │ │ │ └── data │ │ │ └── ServiceData.aidl │ ├── java │ │ └── com │ │ │ └── anno │ │ │ ├── App.java │ │ │ ├── Constant.java │ │ │ ├── annotation │ │ │ ├── AnnotateUtils.java │ │ │ ├── OnClick.java │ │ │ └── ViewInject.java │ │ │ ├── proxy │ │ │ ├── BaseRemote.java │ │ │ ├── IFuncation.java │ │ │ ├── IRemote.java │ │ │ └── RealRemote.java │ │ │ ├── service │ │ │ ├── aidl │ │ │ │ └── AidlService.java │ │ │ ├── binder │ │ │ │ ├── BinderService.java │ │ │ │ ├── BookManager.java │ │ │ │ └── IBookManager.java │ │ │ └── data │ │ │ │ ├── Book.java │ │ │ │ └── ServiceData.java │ │ │ ├── ui │ │ │ ├── ActivityAidlService.java │ │ │ ├── ActivityBinderService.java │ │ │ ├── ActivityDetail.java │ │ │ ├── ActivityRecyclerWheelView.java │ │ │ ├── ItemFragment.java │ │ │ ├── MainActivity.java │ │ │ ├── MyItemRecyclerViewAdapter.java │ │ │ └── dummy │ │ │ │ └── DummyContent.java │ │ │ └── webview │ │ │ └── WebViewActivity.java │ └── res │ │ ├── drawable │ │ ├── ic_launcher_background.xml │ │ └── selector_pressed.xml │ │ ├── layout │ │ ├── activity_binder_service.xml │ │ ├── activity_detail.xml │ │ ├── activity_main.xml │ │ ├── activity_recyclervheelview.xml │ │ ├── activity_service.xml │ │ ├── activity_web_view.xml │ │ ├── fragment_item.xml │ │ ├── fragment_item_list.xml │ │ └── toolbar.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ ├── ic_launcher_foreground.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── color.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── danxx │ └── channelapp │ └── ExampleUnitTest.java ├── Dximageloader ├── .gitignore ├── README.md ├── build.gradle ├── img │ ├── dximageloadimg.png │ └── flow.png ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── dximageloader │ │ ├── DiskLruCache.java │ │ └── DxImageLoader.java │ └── res │ └── values │ └── strings.xml ├── JavaLib ├── .gitignore ├── build.gradle └── src │ └── main │ └── java │ └── com │ └── danxx │ └── thread │ ├── Consumer.java │ ├── MainApp.java │ ├── Producer.java │ └── Storage.java ├── README.md ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── img └── project.png ├── projectFilesBackup └── .idea │ └── workspace.xml └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 13 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /.idea/markdown-navigator/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | 26 | 27 | 28 | 29 | 30 | 31 | 33 | 34 | 35 | 36 | 37 | 1.7 38 | 39 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Aoplib/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /Aoplib/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | buildscript { 4 | repositories { 5 | } 6 | dependencies { 7 | 8 | } 9 | } 10 | 11 | android { 12 | compileSdkVersion rootProject.ext.compileSdkVersion 13 | buildToolsVersion rootProject.ext.buildToolsVersion 14 | 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | lintOptions { 22 | abortOnError false 23 | } 24 | } 25 | 26 | dependencies { 27 | compile fileTree(dir: 'libs', include: ['*.jar']) 28 | compile "org.aspectj:aspectjrt:$rootProject.ext.aspectjrtVersion" 29 | compile 'com.squareup.okhttp3:okhttp:3.6.0' 30 | compile 'com.squareup.okhttp3:logging-interceptor:3.6.0' 31 | compile "com.android.support:support-annotations:$rootProject.ext.supportVersion" 32 | } 33 | android.libraryVariants.all { variant -> 34 | JavaCompile javaCompile = variant.javaCompile 35 | javaCompile.doLast { 36 | String bootclasspath = project.android.bootClasspath.join(File.pathSeparator) 37 | ajc(bootclasspath, javaCompile) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Aoplib/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_Develop\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 | -------------------------------------------------------------------------------- /Aoplib/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Aoplib/src/main/java/aop/statistics/action/ActionHandleAop.java: -------------------------------------------------------------------------------- 1 | package aop.statistics.action; 2 | 3 | import android.os.Build; 4 | import android.support.annotation.RequiresApi; 5 | import android.util.Log; 6 | import android.view.MotionEvent; 7 | 8 | import org.aspectj.lang.JoinPoint; 9 | import org.aspectj.lang.annotation.Aspect; 10 | import org.aspectj.lang.annotation.Before; 11 | 12 | import java.lang.Object; 13 | 14 | /** 15 | * Created by Dawish on 2017/5/11. 16 | * 屏幕操作统计 17 | * http://www.jianshu.com/p/b96a68ba50db 18 | * http://www.jianshu.com/p/6ccfa7b50f0e 19 | */ 20 | 21 | @Aspect //切面注解 22 | public class ActionHandleAop { 23 | 24 | private final static String TAG = "ActionHandleAop"; 25 | 26 | @RequiresApi(api = Build.VERSION_CODES.DONUT) 27 | @Before("execution(* android.app.Activity.onTouchEvent(..))") 28 | public void onTouchEvent(JoinPoint joinPoint){ 29 | Log.e(TAG, "onTouchEvent"); 30 | Object[] args = joinPoint.getArgs(); 31 | if(args == null || args.length == 0){ 32 | return; 33 | } 34 | MotionEvent event = (MotionEvent) args[0]; 35 | //你想做的操作 36 | switch (event.getAction()){ 37 | case MotionEvent.ACTION_DOWN: 38 | Log.d(TAG, "ACTION_DOWN"); 39 | break; 40 | case MotionEvent.ACTION_MOVE: 41 | Log.d(TAG, "ACTION_MOVE"); 42 | break; 43 | case MotionEvent.ACTION_UP: 44 | Log.d(TAG, "ACTION_UP"); 45 | break; 46 | case MotionEvent.ACTION_CANCEL: 47 | Log.d(TAG, "ACTION_CANCEL"); 48 | break; 49 | 50 | } 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /Aoplib/src/main/java/aop/statistics/click/ClickHandleAop.java: -------------------------------------------------------------------------------- 1 | package aop.statistics.click; 2 | 3 | import android.os.Build; 4 | import android.support.annotation.RequiresApi; 5 | import android.util.Log; 6 | import android.view.View; 7 | 8 | import org.aspectj.lang.JoinPoint; 9 | import org.aspectj.lang.annotation.After; 10 | import org.aspectj.lang.annotation.Aspect; 11 | 12 | /** 13 | * Created by Dawish on 2017/5/11. 14 | * 点击统计 15 | */ 16 | @Aspect 17 | public class ClickHandleAop { 18 | 19 | 20 | static final String TAG = "statistics"; 21 | 22 | @RequiresApi(api = Build.VERSION_CODES.DONUT) 23 | 24 | /** 25 | * 26 | * @注解 访问权限 返回值的类型 包名.函数名(参数) 27 | * @注解和访问权限(public/private/protect,以及static/final)属于可选项。如果不设置它们,则默认都会选择。以访问权限为例,如果没有设置访问权限作为条件,那么public,private,protect及static、final的函数都会进行搜索。 28 | * 返回值类型就是普通的函数的返回值类型。如果不限定类型的话,就用*通配符表示 29 | * 包名.函数名用于查找匹配的函数。可以使用通配符,包括*和..以及+号。其中*号用于匹配除.号之外的任意字符,而..则表示任意子package,+号表示子类。 30 | * 比如: 31 | * java.*.Date 可以表示java.sql.Date,也可以表示java.util.Date 32 | * Test* 可以表示TestBase,也可以表示TestDervied 33 | * java..* 表示java任意子类 34 | * java..*Model+ 表示Java任意package中名字以Model结尾的子类,比如TabelModel,TreeModel 等 35 | * 最后来看函数的参数。参数匹配比较简单,主要是参数类型,比如: 36 | * (int, char) 表示参数只有两个,并且第一个参数类型是int,第二个参数类型是char 37 | * (String, ..) 表示至少有一个参数。并且第一个参数类型是String,后面参数类型不限。在参数匹配中, 38 | * ..代表任意参数个数和类型 39 | * (Object ...) 表示不定个数的参数,且类型都是Object,这里的...不是通配符,而是Java中代表不定参数的意思 40 | */ 41 | 42 | /**下面第一个*号表示被切入的方法不限定返回类型**/ 43 | @After("execution(* android.view.View.OnClickListener.onClick(..))") 44 | public void onUserAction(JoinPoint joinPoint){ 45 | Log.e(TAG, "aop statistics click"); 46 | Object[] args = joinPoint.getArgs(); 47 | joinPoint.getTarget(); 48 | if(args == null || args.length == 0){ 49 | return; 50 | } 51 | View clickView = (View) args[0]; 52 | //你想做的操作 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /Aoplib/src/main/java/aop/statistics/life/LifeCycleHandleAop.java: -------------------------------------------------------------------------------- 1 | package aop.statistics.life; 2 | 3 | import android.util.Log; 4 | 5 | import org.aspectj.lang.JoinPoint; 6 | import org.aspectj.lang.annotation.Aspect; 7 | import org.aspectj.lang.annotation.Before; 8 | import org.aspectj.lang.annotation.Pointcut; 9 | 10 | /** 11 | * Created by Dawish on 2017/5/17. 12 | * Activity 生命周期统计 13 | */ 14 | @Aspect 15 | public class LifeCycleHandleAop { 16 | 17 | private final static String TAG = "LifeCycleHandleAop"; 18 | 19 | private long onCreateTime; 20 | 21 | /** 22 | * 使用切片的方式 23 | */ 24 | @Pointcut("execution(* android.app.Activity.onCreate(..))" ) 25 | public void lifeOnCreate(){ 26 | } 27 | 28 | @Pointcut("execution(* android.app.Activity.onDestroy(..))") 29 | public void lifeOnDestroy(){ 30 | } 31 | 32 | @Before("lifeOnCreate()") 33 | public void lifeOnCreateHandle(JoinPoint joinPoint){ 34 | Log.v(TAG, "lifeOnCreate -->"); 35 | onCreateTime = System.currentTimeMillis(); 36 | // Log.v(TAG, "onCreateTime -->"+onCreateTime); 37 | } 38 | 39 | @Before("lifeOnDestroy()") 40 | public void lifeOnDestroyHandle(JoinPoint joinPoint){ 41 | Log.v(TAG, "lifeOnDestroy -->"); 42 | long toatalTime = System.currentTimeMillis() - onCreateTime; 43 | Log.v(TAG, "lifeCycle toatalTime -->"+toatalTime+"ms"); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /Aoplib/src/main/java/aop/statistics/log/AopLog.java: -------------------------------------------------------------------------------- 1 | package aop.statistics.log; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Created by dawish on 2017/8/6. 10 | * 自定义切面 11 | * http://www.jianshu.com/p/e94cdbe67a84 12 | */ 13 | 14 | @Retention(RetentionPolicy.CLASS) 15 | @Target({ElementType.CONSTRUCTOR,ElementType.METHOD}) 16 | public @interface AopLog { 17 | 18 | } -------------------------------------------------------------------------------- /Aoplib/src/main/java/aop/statistics/log/AopLogPointcut.java: -------------------------------------------------------------------------------- 1 | package aop.statistics.log; 2 | 3 | import android.util.Log; 4 | 5 | import org.aspectj.lang.JoinPoint; 6 | import org.aspectj.lang.annotation.After; 7 | import org.aspectj.lang.annotation.Aspect; 8 | import org.aspectj.lang.annotation.Pointcut; 9 | 10 | /** 11 | * Created by dawish on 2017/8/6. 12 | */ 13 | 14 | @Aspect 15 | public class AopLogPointcut { 16 | //在带有AopLog注解的方法进行切入(注:此处的 * *前面都要有一个空格) 17 | @Pointcut("execution(@aop.statistics.log.AopLog * *(..))") 18 | public void logPointcut(){} //注意,这个函数必须要有实现,否则Java编译器会报错 19 | 20 | @After("logPointcut()") 21 | public void onLogPointcutAfter(JoinPoint joinPoint) throws Throwable{ 22 | Log.i("AOP","onLogPointcutAfter:"+joinPoint.getSignature()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Aoplib/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | AopLib 3 | 4 | -------------------------------------------------------------------------------- /AppLibrary/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /AppLibrary/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion rootProject.ext.compileSdkVersion 5 | buildToolsVersion rootProject.ext.buildToolsVersion 6 | 7 | defaultConfig { 8 | minSdkVersion rootProject.ext.minSdkVersion 9 | targetSdkVersion rootProject.ext.targetSdkVersion 10 | versionCode 1 11 | versionName "1.0" 12 | buildConfigField "boolean", "IS_SHOW_LOG", "false" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | buildConfigField "boolean", "IS_SHOW_LOG", NOT_SHOW_LOG 19 | } 20 | debug { 21 | minifyEnabled false 22 | buildConfigField "boolean", "IS_SHOW_LOG", SHOW_LOG 23 | } 24 | } 25 | } 26 | 27 | dependencies { 28 | compile fileTree(dir: 'libs', include: ['*.jar']) 29 | 30 | compile "com.android.support:appcompat-v7:$rootProject.ext.supportVersion" 31 | compile "com.android.support:recyclerview-v7:$rootProject.ext.supportVersion" 32 | compile "com.android.support:support-v4:$rootProject.ext.supportVersion" 33 | 34 | // Because RxAndroid releases are few and far between, it is recommended you also 35 | // explicitly depend on RxJava's latest version for bug fixes and new features. 36 | // compile 'com.github.wangjiegulu:ShadowViewHelper:1.0.1' 37 | 38 | compile 'com.squareup.okio:okio:1.13.0' 39 | compile 'io.reactivex.rxjava2:rxandroid:2.0.1' 40 | compile 'io.reactivex.rxjava2:rxjava:2.1.0' 41 | compile 'com.android.support.constraint:constraint-layout:1.0.2' 42 | testCompile 'junit:junit:4.12' 43 | } 44 | -------------------------------------------------------------------------------- /AppLibrary/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in E:\adt-bundle-windows-x86_64-20131030\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 | -------------------------------------------------------------------------------- /AppLibrary/src/androidTest/java/views/danxx/com/widgetlibrary/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package views.danxx.com.widgetlibrary; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /AppLibrary/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /AppLibrary/src/main/aidl/danxx/library/socket/IBackService.aidl: -------------------------------------------------------------------------------- 1 | package danxx.library.socket; 2 | //aidl接口,用于线程通讯 3 | interface IBackService{ 4 | boolean sendMessage(String message); 5 | } 6 | -------------------------------------------------------------------------------- /AppLibrary/src/main/java/danxx/library/adapter/BaseRecyclerViewHolder.java: -------------------------------------------------------------------------------- 1 | package danxx.library.adapter; 2 | 3 | import android.animation.AnimatorSet; 4 | import android.animation.ObjectAnimator; 5 | import android.support.v7.widget.RecyclerView; 6 | import android.view.View; 7 | 8 | /** 9 | * Base RecyclerViewHolder 10 | * Created by Danxingxi on 2016/3/31. 11 | */ 12 | public abstract class BaseRecyclerViewHolder extends RecyclerView.ViewHolder { 13 | 14 | public BaseRecyclerViewHolder(View itemView) { 15 | super(itemView); 16 | } 17 | 18 | protected abstract View getView(); 19 | 20 | /** 21 | * 为item添加动画 22 | * @param view 需要添加动画的item 23 | * @param scale 是否得到焦点 24 | */ 25 | public void animItem(View view,boolean scale){ 26 | float toValue = 1.0f; 27 | if(scale) { //得到焦点 28 | toValue = 1.1f; 29 | ObjectAnimator animatorX = ObjectAnimator.ofFloat(view, "scaleX", toValue); 30 | ObjectAnimator animatorY = ObjectAnimator.ofFloat(view, "scaleY", toValue); 31 | AnimatorSet animatorSet = new AnimatorSet(); 32 | animatorSet.setDuration(300); 33 | animatorSet.playTogether(animatorX, animatorY); 34 | animatorSet.start(); 35 | }else{ //失去焦点 36 | ObjectAnimator animatorX = ObjectAnimator.ofFloat(view, "scaleX", toValue); 37 | ObjectAnimator animatorY = ObjectAnimator.ofFloat(view, "scaleY", toValue); 38 | AnimatorSet animatorSet = new AnimatorSet(); 39 | animatorSet.setDuration(300); 40 | animatorSet.playTogether(animatorX, animatorY); 41 | animatorSet.start(); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /AppLibrary/src/main/java/danxx/library/focusview/AnimateFactory.java: -------------------------------------------------------------------------------- 1 | package danxx.library.focusview; 2 | 3 | import android.view.View; 4 | import android.view.animation.Animation; 5 | import android.view.animation.CycleInterpolator; 6 | import android.view.animation.ScaleAnimation; 7 | import android.view.animation.TranslateAnimation; 8 | 9 | /** 10 | * 作者:evilbinary on 2015/12/10 17:09 11 | * 邮箱:rootdebug@163.com 12 | */ 13 | public class AnimateFactory { 14 | /** 15 | * 缩放动画,用于缩放控件 16 | * 17 | * @param startScale 控件的起始尺寸倍率 18 | * @param endScale 控件的终点尺寸倍率 19 | * @return 20 | */ 21 | public static Animation zoomAnimation(float startScale, float endScale, long duration) { 22 | ScaleAnimation anim = new ScaleAnimation(startScale, endScale, startScale, endScale, 23 | Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); 24 | anim.setFillAfter(true); 25 | anim.setDuration(duration); 26 | return anim; 27 | } 28 | 29 | public static Animation shakeAnimate() { 30 | TranslateAnimation mAnimate = new TranslateAnimation(0, 5, 0, 0); 31 | mAnimate.setInterpolator(new CycleInterpolator(50)); 32 | mAnimate.setDuration(600); 33 | return mAnimate; 34 | } 35 | 36 | public static void zoomInView(View v) { 37 | zoomInView(v, 1.1f); 38 | } 39 | 40 | public static void zoomOutView(View v) { 41 | zoomOutView(v, 1.1f); 42 | } 43 | 44 | public static void zoomInView(View v, float zoomSize) { 45 | zoomInView(v,zoomSize,200); 46 | } 47 | 48 | public static void zoomOutView(View v, float zoomSize) { 49 | zoomOutView(v,zoomSize,200); 50 | } 51 | public static void zoomInView(View v, float zoomSize, long duration) { 52 | if (v != null) { 53 | v.startAnimation(AnimateFactory.zoomAnimation(1.0f, zoomSize,duration)); 54 | } 55 | } 56 | 57 | public static void zoomOutView(View v, float zoomSize, long duration) { 58 | if (v != null) { 59 | v.startAnimation(AnimateFactory.zoomAnimation(zoomSize, 1.0f, duration)); 60 | } 61 | } 62 | 63 | 64 | public static final int ANIMATION_DEFAULT = 0; 65 | public static final int ANIMATION_TRANSLATE = 1; 66 | 67 | } 68 | -------------------------------------------------------------------------------- /AppLibrary/src/main/java/danxx/library/socket/SocketTest.java: -------------------------------------------------------------------------------- 1 | package danxx.library.socket; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.BufferedWriter; 5 | import java.io.IOException; 6 | import java.io.InputStreamReader; 7 | import java.io.OutputStreamWriter; 8 | import java.io.PrintWriter; 9 | import java.net.ServerSocket; 10 | import java.net.Socket; 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | import java.util.concurrent.ExecutorService; 14 | import java.util.concurrent.Executors; 15 | 16 | /** 17 | * Created by dawish on 2017/7/19. 18 | * SocketTest java 19 | */ 20 | 21 | public class SocketTest { 22 | private static final int PORT = 9999; 23 | private List mList = new ArrayList(); 24 | private ServerSocket server = null; 25 | private ExecutorService mExecutorService = null; 26 | private String receiveMsg; 27 | private String sendMsg; 28 | 29 | public static void main(String[] args) { 30 | new SocketTest(); 31 | } 32 | 33 | public SocketTest() { 34 | try { 35 | server = new ServerSocket(PORT); 36 | mExecutorService = Executors.newCachedThreadPool(); 37 | System.out.println("服务器已启动..."); 38 | Socket client = null; 39 | while (true) { 40 | client = server.accept(); 41 | mList.add(client); 42 | mExecutorService.execute(new Service(client)); 43 | } 44 | } catch (Exception e) { 45 | e.printStackTrace(); 46 | } 47 | } 48 | 49 | class Service implements Runnable { 50 | private Socket socket; 51 | private BufferedReader in = null; 52 | private PrintWriter printWriter=null; 53 | 54 | public Service(Socket socket) { 55 | this.socket = socket; 56 | try { 57 | printWriter = new PrintWriter(new BufferedWriter(new OutputStreamWriter( socket.getOutputStream(), "UTF-8")), true); 58 | in = new BufferedReader(new InputStreamReader( 59 | socket.getInputStream(),"UTF-8")); 60 | printWriter.println("成功连接服务器"+"(服务器发送)"); 61 | System.out.println("成功连接服务器"); 62 | } catch (IOException e) { 63 | e.printStackTrace(); 64 | } 65 | 66 | } 67 | 68 | @Override 69 | public void run() { 70 | try { 71 | while (true) { 72 | if ((receiveMsg = in.readLine())!=null) { 73 | System.out.println("receiveMsg:"+receiveMsg); 74 | if (receiveMsg.equals("0")) { 75 | System.out.println("客户端请求断开连接"); 76 | printWriter.println("服务端断开连接"+"(服务器发送)"); 77 | mList.remove(socket); 78 | in.close(); 79 | socket.close(); 80 | break; 81 | } else { 82 | sendMsg = "我已接收:" + receiveMsg + "(服务器发送)"; 83 | printWriter.println(sendMsg); 84 | } 85 | } 86 | } 87 | } catch (Exception e) { 88 | e.printStackTrace(); 89 | } 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /AppLibrary/src/main/java/danxx/library/tools/AnimTools.java: -------------------------------------------------------------------------------- 1 | package danxx.library.tools; 2 | 3 | import android.animation.Keyframe; 4 | import android.animation.ObjectAnimator; 5 | import android.animation.PropertyValuesHolder; 6 | import android.view.animation.AccelerateInterpolator; 7 | import android.view.animation.Animation; 8 | import android.view.animation.ScaleAnimation; 9 | 10 | public class AnimTools { 11 | public static Animation zoomAnim(float fromX, float toX, float fromY, 12 | float toY, long durationMillis,float pivotX,float pivotY) { 13 | ScaleAnimation myAnimation_Scale = new ScaleAnimation(fromX, toX, 14 | fromY, toY, Animation.RELATIVE_TO_SELF, pivotX, 15 | Animation.RELATIVE_TO_SELF, pivotY); 16 | myAnimation_Scale.setDuration(durationMillis); 17 | myAnimation_Scale.setInterpolator(new AccelerateInterpolator()); 18 | return myAnimation_Scale; 19 | } 20 | 21 | public static ObjectAnimator shock(Object obj) { 22 | //左右抖动范围 23 | int delta = 10; 24 | 25 | PropertyValuesHolder pvhTranslateX = PropertyValuesHolder.ofKeyframe("translationX", 26 | Keyframe.ofFloat(0f, 0), 27 | Keyframe.ofFloat(.10f, -delta), 28 | Keyframe.ofFloat(.26f, delta), 29 | Keyframe.ofFloat(.42f, -delta), 30 | Keyframe.ofFloat(.58f, delta), 31 | Keyframe.ofFloat(.74f, -delta), 32 | Keyframe.ofFloat(.90f, delta), 33 | Keyframe.ofFloat(1f, 0f) 34 | ); 35 | return ObjectAnimator.ofPropertyValuesHolder(obj, pvhTranslateX). 36 | setDuration(500); 37 | } 38 | 39 | /** 40 | * 左右移动 41 | * @param obj 42 | * @param startDelta 43 | * @param endDelta 44 | * @return 45 | */ 46 | public static ObjectAnimator translate(Object obj, int startDelta, int endDelta) { 47 | 48 | PropertyValuesHolder pvhTranslateX = PropertyValuesHolder.ofFloat("translationX", startDelta, endDelta); 49 | return ObjectAnimator.ofPropertyValuesHolder(obj, pvhTranslateX). 50 | setDuration(200); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /AppLibrary/src/main/java/danxx/library/tools/MyLog.java: -------------------------------------------------------------------------------- 1 | package danxx.library.tools; 2 | 3 | import android.util.Log; 4 | 5 | import danxx.library.BuildConfig; 6 | 7 | /** 8 | * Created on 2017/3/28. 9 | */ 10 | 11 | public class MyLog { 12 | public static int v(String tag, String msg) { 13 | if (BuildConfig.IS_SHOW_LOG) { 14 | return Log.v(tag, msg); 15 | } else { 16 | return -1; 17 | } 18 | } 19 | 20 | public static int v(String tag, String msg, Throwable tr) { 21 | if (BuildConfig.IS_SHOW_LOG) { 22 | return Log.v(tag, msg, tr); 23 | } else { 24 | return -1; 25 | } 26 | } 27 | 28 | public static int d(String tag, String msg) { 29 | if (BuildConfig.IS_SHOW_LOG) { 30 | return Log.d(tag, msg); 31 | } else { 32 | return -1; 33 | } 34 | } 35 | 36 | public static int d(String tag, String msg, Throwable tr) { 37 | if (BuildConfig.IS_SHOW_LOG) { 38 | return Log.d(tag, msg, tr); 39 | } else { 40 | return -1; 41 | } 42 | } 43 | 44 | public static int i(String tag, String msg) { 45 | if (BuildConfig.IS_SHOW_LOG) { 46 | return Log.i(tag, msg); 47 | } else { 48 | return -1; 49 | } 50 | } 51 | 52 | public static int i(String tag, String msg, Throwable tr) { 53 | if (BuildConfig.IS_SHOW_LOG) { 54 | return Log.i(tag, msg, tr); 55 | } else { 56 | return -1; 57 | } 58 | } 59 | 60 | public static int w(String tag, String msg) { 61 | if (BuildConfig.IS_SHOW_LOG) { 62 | return Log.w(tag, msg); 63 | } else { 64 | return -1; 65 | } 66 | } 67 | 68 | public static int w(String tag, String msg, Throwable tr) { 69 | if (BuildConfig.IS_SHOW_LOG) { 70 | return Log.w(tag, msg, tr); 71 | } else { 72 | return -1; 73 | } 74 | } 75 | 76 | public static int w(String tag, Throwable tr) { 77 | if (BuildConfig.IS_SHOW_LOG) { 78 | return Log.w(tag, tr); 79 | } else { 80 | return -1; 81 | } 82 | } 83 | 84 | public static int e(String tag, String msg) { 85 | if (BuildConfig.IS_SHOW_LOG) { 86 | return Log.e(tag, msg); 87 | } else { 88 | return -1; 89 | } 90 | } 91 | 92 | public static int e(String tag, String msg, Throwable tr) { 93 | if (BuildConfig.IS_SHOW_LOG) { 94 | return Log.e(tag, msg, tr); 95 | } else { 96 | return -1; 97 | } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /AppLibrary/src/main/java/danxx/library/widget/Bezier.java: -------------------------------------------------------------------------------- 1 | package danxx.library.widget; 2 | 3 | import android.content.Context; 4 | import android.graphics.Canvas; 5 | import android.graphics.Color; 6 | import android.graphics.Paint; 7 | import android.graphics.Path; 8 | import android.graphics.PointF; 9 | import android.util.AttributeSet; 10 | import android.util.Log; 11 | import android.view.KeyEvent; 12 | import android.view.MotionEvent; 13 | import android.view.View; 14 | 15 | /** 16 | * Created by Dawish on 2016/12/29. 17 | * 贝塞尔曲线测试 18 | */ 19 | 20 | public class Bezier extends View { 21 | 22 | //画笔 23 | private Paint paint; 24 | // 起始点,结束点,控制点 25 | private PointF startP,endP,controlP; 26 | // 整个view的中心点,别的点以这个点为基础来偏移 27 | private int centerX, centerY; 28 | 29 | public Bezier(Context context) { 30 | super(context); 31 | init(); 32 | } 33 | 34 | public Bezier(Context context, AttributeSet attrs) { 35 | super(context, attrs); 36 | init(); 37 | } 38 | 39 | public Bezier(Context context, AttributeSet attrs, int defStyleAttr) { 40 | super(context, attrs, defStyleAttr); 41 | init(); 42 | } 43 | 44 | private void init(){ 45 | paint = new Paint(); 46 | paint.setStyle(Paint.Style.FILL_AND_STROKE); 47 | paint.setTextSize(60); 48 | 49 | startP = new PointF(0, 0); 50 | endP = new PointF(0, 0); 51 | controlP = new PointF(0, 0); 52 | } 53 | 54 | /** 55 | * View大小改变的时候调用 56 | * @param w 57 | * @param h 58 | * @param oldw 59 | * @param oldh 60 | */ 61 | @Override 62 | protected void onSizeChanged(int w, int h, int oldw, int oldh) { 63 | super.onSizeChanged(w, h, oldw, oldh); 64 | Log.d("danxx", "onSizeChanged--->"); 65 | centerX = w/2; 66 | centerY = h/2; 67 | // 初始化三个点的位置 68 | startP.x = centerX - 400; 69 | startP.y = centerY; 70 | 71 | endP.x = centerX + 400; 72 | endP.y = centerY; 73 | 74 | controlP.x = centerX; 75 | controlP.y = centerY -600; 76 | } 77 | 78 | @Override 79 | public boolean onTouchEvent(MotionEvent event) { 80 | // return super.onTouchEvent(event); 81 | //触摸屏幕时重绘,不断改变控制点的位置 82 | controlP.x = event.getX(); 83 | controlP.y = event.getY(); 84 | invalidate(); 85 | return true; 86 | } 87 | 88 | @Override 89 | protected void onDraw(Canvas canvas) { 90 | super.onDraw(canvas); 91 | // 绘制起点、终点和控制点 92 | paint.setColor(Color.GRAY); 93 | paint.setStrokeWidth(20); 94 | //起点 95 | canvas.drawPoint(startP.x, startP.y, paint); 96 | //终点 97 | canvas.drawPoint(endP.x, endP.y, paint); 98 | //控制点 99 | canvas.drawPoint(controlP.x, controlP.y, paint); 100 | 101 | //绘制辅助线 102 | paint.setStrokeWidth(4); 103 | canvas.drawLine(startP.x, startP.y, controlP.x, controlP.y, paint); 104 | canvas.drawLine(controlP.x, controlP.y, endP.x, endP.y, paint); 105 | 106 | //绘制贝塞尔曲线 107 | paint.setColor(Color.RED); 108 | paint.setStrokeWidth(8); 109 | Path path = new Path(); 110 | //曲线起始点 111 | path.moveTo(startP.x, startP.y); 112 | path.quadTo(controlP.x, controlP.y, endP.x, endP.y); 113 | 114 | canvas.drawPath(path, paint); 115 | 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /AppLibrary/src/main/java/danxx/library/widget/CustomViewPager.java: -------------------------------------------------------------------------------- 1 | package danxx.library.widget; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.MotionEvent; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | 9 | /** 10 | * Created by Danxx on 2016/7/27. 11 | * 自定义Viewpager 12 | */ 13 | public class CustomViewPager extends ViewGroup { 14 | 15 | private int mLastX; 16 | 17 | public CustomViewPager(Context context) { 18 | super(context); 19 | init(context); 20 | } 21 | 22 | public CustomViewPager(Context context, AttributeSet attrs) { 23 | super(context, attrs); 24 | init(context); 25 | } 26 | 27 | public CustomViewPager(Context context, AttributeSet attrs, int defStyleAttr) { 28 | super(context, attrs, defStyleAttr); 29 | init(context); 30 | } 31 | 32 | private void init(Context mContext){ 33 | 34 | } 35 | 36 | @Override 37 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 38 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 39 | int count = getChildCount(); 40 | for(int i=0;i (getChildCount() - 1) * getWidth()){ 81 | preScrollX = (getChildCount() - 1) * getWidth(); 82 | } 83 | if(preScrollX < 0){ 84 | preScrollX = 0; 85 | } 86 | scrollTo(preScrollX,getScrollY()); 87 | mLastX = x; 88 | break; 89 | } 90 | return true; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /AppLibrary/src/main/java/danxx/library/widget/IPullToRefreshMore.java: -------------------------------------------------------------------------------- 1 | package danxx.library.widget; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.View; 6 | 7 | /** 8 | * 下拉刷新和上拉加载更多自定义控件的功能定义接口 9 | * ------------------------------- 10 | * @Description: IPullToRefreshMore 11 | * @Author: Danxingxi 12 | * @CreateDate: 2016/8/5 10:12 13 | */ 14 | public interface IPullToRefreshMore { 15 | 16 | /**init初始化**/ 17 | void init(Context context, AttributeSet attrs, int defStyleAttr); 18 | 19 | /**添加刷新View**/ 20 | void addHeaderRefreshView(); 21 | 22 | /**添加加载更多View**/ 23 | void addFooterRefreshView(); 24 | 25 | /**测量子控件大小**/ 26 | void measureView(View child); 27 | 28 | /**是否可以下拉或者上拉**/ 29 | boolean canScroll(int pullY); 30 | 31 | // /**获取当然的刷新情况**/ 32 | // void getRefreshStatus(); 33 | // 34 | // /**获取当前是下拉还是上拉**/ 35 | // void getPullStatus(); 36 | 37 | /**下拉手指还在移动没有抬起来,此过程中需要改变箭头的方向**/ 38 | void pullHeaderToRefresh(int pullY); 39 | 40 | /**上拉手指还在移动没有抬起来,此过程中需要改变箭头的方向**/ 41 | void pullFooterToRefresh(int pullY); 42 | 43 | /**在pullHeaderToRefresh动态改变HeaderView的TopMargin值**/ 44 | int changeHeaderViewTopMargin(int pullY); 45 | 46 | /** 47 | * 在刷新中或者刷新完成后设置HeaderView的TopMargin值, 48 | * 上拉实现加载更多的动画也是设置setHeaderViewTopMargin的值, 49 | * 这样就会使整个ViewGroup往上升,这样就可以显示出FooterView了, 50 | */ 51 | void setHeaderViewTopMargin(int margin); 52 | 53 | /**设置开始下拉刷新**/ 54 | void setHeaderRefreshing(); 55 | 56 | /**下拉刷新完成,提供给别的类外调**/ 57 | void onHeaderRefreshFinish(); 58 | 59 | /**设置开始上拉加载**/ 60 | void setFooterRefreshing(); 61 | 62 | /**上拉加载完成,提供给别的类外调**/ 63 | void onFootrRefreshFinish(); 64 | 65 | /**获取当前header view 的topMargin**/ 66 | int getHeaderTopMargin(); 67 | 68 | /**设置会点监听器**/ 69 | void setRefreshListener(RefreshMoreLisenter refreshListener); 70 | } 71 | -------------------------------------------------------------------------------- /AppLibrary/src/main/java/danxx/library/widget/InvalidateTest.java: -------------------------------------------------------------------------------- 1 | package danxx.library.widget; 2 | 3 | import android.content.Context; 4 | import android.graphics.Canvas; 5 | import android.graphics.Color; 6 | import android.graphics.Paint; 7 | import android.util.AttributeSet; 8 | import android.util.Log; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.LinearLayout; 12 | 13 | /** 14 | * Created by Dawish on 2016/12/27. 15 | */ 16 | 17 | public class InvalidateTest extends View { 18 | 19 | private Paint paint; 20 | 21 | private boolean isFirstDraw = true; 22 | 23 | public InvalidateTest(Context context) { 24 | super(context); 25 | init(); 26 | } 27 | 28 | public InvalidateTest(Context context, AttributeSet attrs) { 29 | super(context, attrs); 30 | init(); 31 | } 32 | 33 | public InvalidateTest(Context context, AttributeSet attrs, int defStyleAttr) { 34 | super(context, attrs, defStyleAttr); 35 | init(); 36 | } 37 | 38 | @Override 39 | protected void onLayout(boolean changed, int l, int t, int r, int b) { 40 | 41 | } 42 | 43 | private void init(){ 44 | Log.d("danxx", "init---->"); 45 | paint = new Paint(); 46 | 47 | } 48 | 49 | @Override 50 | protected void onDraw(Canvas canvas) { 51 | // super.onDraw(canvas); 52 | Log.d("danxx", "onDraw---->"); 53 | if(isFirstDraw){ 54 | paint.setColor(Color.parseColor("#212121")); 55 | isFirstDraw = false; 56 | }else{ 57 | paint.setColor(Color.parseColor("#aa2cc1")); 58 | } 59 | canvas.drawCircle(280, 380, 180, paint); 60 | canvas.drawCircle(280, 480, 180, paint); 61 | } 62 | 63 | @Override 64 | public void draw(Canvas canvas) { 65 | Log.d("danxx", "draw---->"); 66 | super.draw(canvas); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /AppLibrary/src/main/java/danxx/library/widget/InvalidateTestViewGroup.java: -------------------------------------------------------------------------------- 1 | package danxx.library.widget; 2 | 3 | import android.content.Context; 4 | import android.graphics.Canvas; 5 | import android.graphics.Color; 6 | import android.graphics.Paint; 7 | import android.util.AttributeSet; 8 | import android.util.Log; 9 | import android.widget.LinearLayout; 10 | 11 | /** 12 | * Created by Dawish on 2016/12/28. 13 | */ 14 | 15 | public class InvalidateTestViewGroup extends LinearLayout { 16 | private Paint paint; 17 | private boolean isFirstDraw = true; 18 | public InvalidateTestViewGroup(Context context) { 19 | super(context); 20 | init(); 21 | } 22 | 23 | public InvalidateTestViewGroup(Context context, AttributeSet attrs) { 24 | super(context, attrs); 25 | init(); 26 | } 27 | 28 | public InvalidateTestViewGroup(Context context, AttributeSet attrs, int defStyleAttr) { 29 | super(context, attrs, defStyleAttr); 30 | init(); 31 | } 32 | 33 | private void init(){ 34 | Log.d("danxx", "init---->2"); 35 | paint = new Paint(); 36 | 37 | } 38 | 39 | @Override 40 | protected void dispatchDraw(Canvas canvas) { 41 | Log.d("danxx", "dispatchDraw---->2"); 42 | super.dispatchDraw(canvas); 43 | } 44 | 45 | @Override 46 | protected void onDraw(Canvas canvas) { 47 | Log.d("danxx", "onDraw---->2"); 48 | super.onDraw(canvas); 49 | 50 | if(isFirstDraw){ 51 | paint.setColor(Color.parseColor("#ee2121")); 52 | isFirstDraw = false; 53 | }else{ 54 | paint.setColor(Color.parseColor("#aaccdd")); 55 | } 56 | 57 | canvas.drawCircle(380, 480, 180, paint); 58 | canvas.drawCircle(380, 980, 180, paint); 59 | } 60 | 61 | @Override 62 | public void draw(Canvas canvas) { 63 | Log.d("danxx", "draw---->2"); 64 | super.draw(canvas); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /AppLibrary/src/main/java/danxx/library/widget/RefreshMoreLisenter.java: -------------------------------------------------------------------------------- 1 | package danxx.library.widget; 2 | 3 | /** 4 | * 下拉刷新和上拉加载更多的回调接口 5 | * ------------------------------- 6 | * @Description: RefreshMoreLisenter 7 | * @Author: Danxingxi 8 | * @CreateDate: 2016/8/5 10:12 9 | */ 10 | public interface RefreshMoreLisenter { 11 | /**下拉刷新**/ 12 | void onRefresh(); 13 | /**上拉加载更多**/ 14 | void onLoadMore(); 15 | /**重度上拉,一般是做跳转到新页面**/ 16 | void onLongPullUp(); 17 | } 18 | -------------------------------------------------------------------------------- /AppLibrary/src/main/java/danxx/library/widget/SelectorFactory.java: -------------------------------------------------------------------------------- 1 | package danxx.library.widget; 2 | 3 | import android.content.Context; 4 | import android.content.res.ColorStateList; 5 | import android.graphics.drawable.Drawable; 6 | import android.graphics.drawable.StateListDrawable; 7 | 8 | /** 9 | * Created by Danxx on 2016/8/1. 10 | * Android代码实现Selector效果 11 | */ 12 | public class SelectorFactory { 13 | 14 | public static StateListDrawable newSelector(Context context, int idNormal, int idPressed, int idFocused, int idUnable) { 15 | StateListDrawable bg = new StateListDrawable(); 16 | Drawable normal = idNormal == -1 ? null : context.getResources().getDrawable(idNormal); 17 | Drawable pressed = idPressed == -1 ? null : context.getResources().getDrawable(idPressed); 18 | Drawable focused = idFocused == -1 ? null : context.getResources().getDrawable(idFocused); 19 | Drawable unable = idUnable == -1 ? null : context.getResources().getDrawable(idUnable); 20 | // View.PRESSED_ENABLED_STATE_SET 21 | bg.addState(new int[] { android.R.attr.state_pressed, android.R.attr.state_enabled }, pressed); 22 | // View.ENABLED_FOCUSED_STATE_SET 23 | bg.addState(new int[] { android.R.attr.state_enabled, android.R.attr.state_focused }, focused); 24 | // View.ENABLED_STATE_SET 25 | bg.addState(new int[] { android.R.attr.state_enabled }, normal); 26 | // View.FOCUSED_STATE_SET 27 | bg.addState(new int[] { android.R.attr.state_focused }, focused); 28 | // View.WINDOW_FOCUSED_STATE_SET 29 | bg.addState(new int[] { android.R.attr.state_window_focused }, unable); 30 | // View.EMPTY_STATE_SET 31 | bg.addState(new int[] {}, normal); 32 | return bg; 33 | } 34 | public static ColorStateList createColorStateList(int normal, int pressed, int focused, int unable) { 35 | int[] colors = new int[] { pressed, focused, normal, focused, unable, normal }; 36 | int[][] states = new int[6][]; 37 | states[0] = new int[] { android.R.attr.state_pressed, android.R.attr.state_enabled }; 38 | states[1] = new int[] { android.R.attr.state_enabled, android.R.attr.state_focused }; 39 | states[2] = new int[] { android.R.attr.state_enabled }; 40 | states[3] = new int[] { android.R.attr.state_focused }; 41 | states[4] = new int[] { android.R.attr.state_window_focused }; 42 | states[5] = new int[] {}; 43 | ColorStateList colorList = new ColorStateList(states, colors); 44 | return colorList; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /AppLibrary/src/main/res/drawable-hdpi/refresh_arrow_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/AndroidLearn/b380f8ee58f2a8a87807baf89a42bf0ee4aff301/AppLibrary/src/main/res/drawable-hdpi/refresh_arrow_down.png -------------------------------------------------------------------------------- /AppLibrary/src/main/res/drawable-hdpi/refresh_arrow_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/AndroidLearn/b380f8ee58f2a8a87807baf89a42bf0ee4aff301/AppLibrary/src/main/res/drawable-hdpi/refresh_arrow_up.png -------------------------------------------------------------------------------- /AppLibrary/src/main/res/drawable-hdpi/refresh_success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/AndroidLearn/b380f8ee58f2a8a87807baf89a42bf0ee4aff301/AppLibrary/src/main/res/drawable-hdpi/refresh_success.png -------------------------------------------------------------------------------- /AppLibrary/src/main/res/drawable/bg_focus.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/AndroidLearn/b380f8ee58f2a8a87807baf89a42bf0ee4aff301/AppLibrary/src/main/res/drawable/bg_focus.9.png -------------------------------------------------------------------------------- /AppLibrary/src/main/res/drawable/default_focus.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/AndroidLearn/b380f8ee58f2a8a87807baf89a42bf0ee4aff301/AppLibrary/src/main/res/drawable/default_focus.9.png -------------------------------------------------------------------------------- /AppLibrary/src/main/res/drawable/focus_bg_test.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/AndroidLearn/b380f8ee58f2a8a87807baf89a42bf0ee4aff301/AppLibrary/src/main/res/drawable/focus_bg_test.9.png -------------------------------------------------------------------------------- /AppLibrary/src/main/res/drawable/focus_shadow.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/AndroidLearn/b380f8ee58f2a8a87807baf89a42bf0ee4aff301/AppLibrary/src/main/res/drawable/focus_shadow.9.png -------------------------------------------------------------------------------- /AppLibrary/src/main/res/drawable/hehe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/AndroidLearn/b380f8ee58f2a8a87807baf89a42bf0ee4aff301/AppLibrary/src/main/res/drawable/hehe.png -------------------------------------------------------------------------------- /AppLibrary/src/main/res/drawable/home_select_focus.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/AndroidLearn/b380f8ee58f2a8a87807baf89a42bf0ee4aff301/AppLibrary/src/main/res/drawable/home_select_focus.9.png -------------------------------------------------------------------------------- /AppLibrary/src/main/res/drawable/item_foucs_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /AppLibrary/src/main/res/drawable/main_page_item_selected.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/AndroidLearn/b380f8ee58f2a8a87807baf89a42bf0ee4aff301/AppLibrary/src/main/res/drawable/main_page_item_selected.9.png -------------------------------------------------------------------------------- /AppLibrary/src/main/res/drawable/shape_focus_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 8 | 9 | 10 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /AppLibrary/src/main/res/drawable/vip_focus.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/AndroidLearn/b380f8ee58f2a8a87807baf89a42bf0ee4aff301/AppLibrary/src/main/res/drawable/vip_focus.9.png -------------------------------------------------------------------------------- /AppLibrary/src/main/res/layout/footer_refresh_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 12 | 13 | 19 | 27 | 28 | 29 | 30 | 36 | 45 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /AppLibrary/src/main/res/layout/header_refresh_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 12 | 13 | 19 | 27 | 28 | 29 | 30 | 36 | 46 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /AppLibrary/src/main/res/layout/item_recycler_wheel.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /AppLibrary/src/main/res/layout/refresh_top_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 12 | 13 | 19 | 27 | 28 | 29 | 30 | 36 | 45 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /AppLibrary/src/main/res/values/attr.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 | -------------------------------------------------------------------------------- /AppLibrary/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /AppLibrary/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | AppLibrary 3 | 下拉刷新 4 | 松开后刷新 5 | 刷新\u2026 6 | 松开后加载 7 | 上拉加载更多 8 | 加载中\u2026 9 | 10 | -------------------------------------------------------------------------------- /AppLibrary/src/main/res/values/values.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 | -------------------------------------------------------------------------------- /AppLibrary/src/test/java/views/danxx/com/widgetlibrary/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package views.danxx.com.widgetlibrary; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /Channel1App/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /Channel1App/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | buildscript { 4 | repositories { 5 | } 6 | dependencies { 7 | 8 | } 9 | tasks.withType(JavaCompile) { 10 | options.encoding = "UTF-8" 11 | } 12 | } 13 | 14 | android { 15 | compileSdkVersion rootProject.ext.compileSdkVersion 16 | buildToolsVersion rootProject.ext.buildToolsVersion 17 | 18 | defaultConfig { 19 | applicationId "com.danxx.views" 20 | minSdkVersion rootProject.ext.minSdkVersion 21 | targetSdkVersion rootProject.ext.targetSdkVersion 22 | versionCode 1 23 | versionName "1.0" 24 | 25 | ndk{ 26 | moduleName "DanxxJniLibName" //生成的so名字 27 | abiFilters "armeabi", "armeabi-v7a", "x86" //输出指定三种abi体系结构下的so库。目前可有可无。 28 | } 29 | 30 | } 31 | 32 | aaptOptions { 33 | cruncherEnabled = false 34 | useNewCruncher = false 35 | } 36 | 37 | buildTypes { 38 | release { 39 | minifyEnabled false 40 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 41 | } 42 | } 43 | } 44 | 45 | dependencies { 46 | compile fileTree(include: ['*.jar'], dir: 'libs') 47 | testCompile 'junit:junit:4.12' 48 | compile "com.android.support:appcompat-v7:$rootProject.ext.supportVersion" 49 | compile "com.android.support:recyclerview-v7:$rootProject.ext.supportVersion" 50 | compile "com.android.support:cardview-v7:$rootProject.ext.supportVersion" 51 | compile 'com.squareup.okio:okio:1.13.0' 52 | 53 | compile project(':AppLibrary') 54 | compile project(':Aoplib') 55 | compile project(':Dximageloader') 56 | } 57 | 58 | android.applicationVariants.all { variant -> 59 | JavaCompile javaCompile = variant.javaCompile 60 | javaCompile.doLast { 61 | String bootclasspath = project.android.bootClasspath.join(File.pathSeparator) 62 | ajc(bootclasspath, javaCompile) 63 | } 64 | } -------------------------------------------------------------------------------- /Channel1App/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in E:\adt-bundle-windows-x86_64-20131030\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 | -------------------------------------------------------------------------------- /Channel1App/src/androidTest/java/com/danxx/views/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.danxx.views; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /Channel1App/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Channel1App/src/main/java/com/App.java: -------------------------------------------------------------------------------- 1 | package com; 2 | 3 | import android.app.Application; 4 | 5 | import com.dximageloader.DxImageLoader; 6 | 7 | /** 8 | * Created by Administrator on 2017/6/27. 9 | */ 10 | 11 | public class App extends Application { 12 | @Override 13 | public void onCreate() { 14 | super.onCreate(); 15 | //初始化图片加载库 16 | DxImageLoader.getInstance().init(getApplicationContext()); 17 | //改动了 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Channel1App/src/main/java/com/danxx/views/ActivityCustomImgContainer.java: -------------------------------------------------------------------------------- 1 | package com.danxx.views; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.view.View; 7 | import android.widget.Toast; 8 | 9 | import danxx.library.widget.StackCardContainer; 10 | 11 | /** 12 | * @Description: 13 | * @Author: Danxingxi 14 | * @CreateDate: 2016/12/13 19:51 15 | */ 16 | public class ActivityCustomImgContainer extends AppCompatActivity { 17 | 18 | @Override 19 | protected void onCreate(Bundle savedInstanceState) { 20 | super.onCreate(savedInstanceState); 21 | setContentView(R.layout.layout_three_d); 22 | 23 | StackCardContainer threeDViewContainer = (StackCardContainer) findViewById(R.id.threeDViewContainer); 24 | threeDViewContainer.setOnItemViewClickListener(new StackCardContainer.OnItemViewClickListener() { 25 | @Override 26 | public void onItemViewOnClickListener(View itemView, int position) { 27 | Toast.makeText(ActivityCustomImgContainer.this, "Position->"+position, Toast.LENGTH_SHORT).show(); 28 | if(2 == position){ 29 | Intent intent = new Intent(ActivityCustomImgContainer.this, ActivityViewPagerIndicator.class); 30 | startActivity(intent); 31 | } 32 | } 33 | }); 34 | 35 | } 36 | 37 | 38 | } 39 | -------------------------------------------------------------------------------- /Channel1App/src/main/java/com/danxx/views/ActivityTest.java: -------------------------------------------------------------------------------- 1 | package com.danxx.views; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.util.Log; 6 | import android.view.MotionEvent; 7 | import android.view.View; 8 | import android.widget.LinearLayout; 9 | import android.widget.Toast; 10 | 11 | import danxx.library.widget.InvalidateTest; 12 | import danxx.library.widget.OnePlusCloudy; 13 | import danxx.library.widget.StackCardContainer; 14 | 15 | /** 16 | * Created by Dawish on 2016/12/27. 17 | */ 18 | 19 | public class ActivityTest extends AppCompatActivity { 20 | OnePlusCloudy onePlusCloudy; 21 | @Override 22 | protected void onCreate(Bundle savedInstanceState) { 23 | super.onCreate(savedInstanceState); 24 | setContentView(R.layout.layout_invalidate); 25 | onePlusCloudy = (OnePlusCloudy) findViewById(R.id.onePlusCloudy); 26 | } 27 | public void start(View view){ 28 | onePlusCloudy.start(); 29 | } 30 | public void stop(View view){ 31 | onePlusCloudy.stop(); 32 | } 33 | 34 | @Override 35 | public boolean onTouchEvent(MotionEvent event) { 36 | return super.onTouchEvent(event); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Channel1App/src/main/java/com/danxx/views/ActivityVerticalTabIndicator.java: -------------------------------------------------------------------------------- 1 | package com.danxx.views; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.util.Log; 7 | import android.util.SparseArray; 8 | import android.view.View; 9 | import android.widget.Toast; 10 | 11 | import danxx.library.widget.VerticalTabIndicator; 12 | 13 | /** 14 | * Created by Dawish on 2016/7/31. 15 | */ 16 | public class ActivityVerticalTabIndicator extends AppCompatActivity { 17 | 18 | private SparseArray mData = new SparseArray(); 19 | private VerticalTabIndicator tabIndicator; 20 | @Override 21 | protected void onCreate(@Nullable Bundle savedInstanceState) { 22 | super.onCreate(savedInstanceState); 23 | setContentView(R.layout.activity_vertical_tab_indicator); 24 | 25 | tabIndicator = (VerticalTabIndicator) findViewById(R.id.tabIndicator); 26 | 27 | for(int i=0 ; i<21 ; i++){ 28 | mData.put(i, "电影频道 "+i); 29 | } 30 | 31 | tabIndicator.setTabSelectListrner(new VerticalTabIndicator.TabSelectListrner() { 32 | @Override 33 | public void onItemSelect(int index) { 34 | Log.d("danxx","选中位置: "+index); 35 | } 36 | }); 37 | 38 | tabIndicator.setTabClickListrner(new VerticalTabIndicator.TabClickListrner() { 39 | @Override 40 | public void onItemClick(int index) { 41 | Toast.makeText(ActivityVerticalTabIndicator.this, "点击了第"+index+"项", Toast.LENGTH_SHORT).show(); 42 | } 43 | }); 44 | 45 | tabIndicator.setData(mData); 46 | 47 | } 48 | 49 | public void setTwoSelected(View view){ 50 | tabIndicator.setCurrentTabItemSelect(1); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /Channel1App/src/main/java/com/danxx/views/CircleImageViewActivity.java: -------------------------------------------------------------------------------- 1 | package com.danxx.views; 2 | 3 | import android.graphics.Bitmap; 4 | import android.graphics.BitmapFactory; 5 | import android.os.Bundle; 6 | import android.support.annotation.Nullable; 7 | import android.support.v7.app.AppCompatActivity; 8 | import android.util.Log; 9 | import android.widget.FrameLayout; 10 | 11 | import danxx.library.widget.SampleCircleImageView; 12 | 13 | /** 14 | * Created by Danxx on 2016/7/29. 15 | */ 16 | public class CircleImageViewActivity extends AppCompatActivity { 17 | 18 | @Override 19 | protected void onCreate(@Nullable Bundle savedInstanceState) { 20 | super.onCreate(savedInstanceState); 21 | Log.d("danxx" ,"CircleImageViewActivity"); 22 | Bitmap bitmap = BitmapFactory.decodeResource(getResources(),R.drawable.vp1); 23 | SampleCircleImageView circleImageView = new SampleCircleImageView(CircleImageViewActivity.this, bitmap); 24 | FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT); 25 | params.setMargins(20,20,20,20); 26 | // setContentView(circleImageView ,params); 27 | setContentView(R.layout.activity_sample_circle_imageview); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Channel1App/src/main/java/com/danxx/views/CustomViewPagerActivity.java: -------------------------------------------------------------------------------- 1 | package com.danxx.views; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v7.app.AppCompatActivity; 6 | 7 | /** 8 | * Created by Danxx on 2016/7/27. 9 | */ 10 | public class CustomViewPagerActivity extends AppCompatActivity { 11 | @Override 12 | protected void onCreate(@Nullable Bundle savedInstanceState) { 13 | super.onCreate(savedInstanceState); 14 | setContentView(R.layout.activity_custom_viewpager); 15 | } 16 | 17 | @Override 18 | public void finish() { 19 | super.finish(); 20 | } 21 | 22 | @Override 23 | protected void onDestroy() { 24 | super.onDestroy(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Channel1App/src/main/java/com/danxx/views/LooperThread.java: -------------------------------------------------------------------------------- 1 | package com.danxx.views; 2 | 3 | import android.os.Handler; 4 | import android.os.Looper; 5 | import android.os.Message; 6 | 7 | /** 8 | * @Description: 一个looper线程 9 | * @Author: Danxingxi 10 | * @CreateDate: 2016/8/31 9:58 11 | */ 12 | public class LooperThread extends Thread { 13 | /**public属性的Handler,其他线程可以通过此handler给本线程的消息队列发送message**/ 14 | /**只有looper线程才可以创建handler,应为一个handler需要持有queue的引用**/ 15 | public Handler handler; 16 | @Override 17 | public void run() { 18 | Looper.prepare(); 19 | /**需要在线程进入死循环之前,创建一个Handler实例供外界线程给自己发消息**/ 20 | handler = new Handler(){ 21 | @Override 22 | public void handleMessage(Message msg) { 23 | super.handleMessage(msg); 24 | //Handler 对象在这个线程构建,那么handleMessage回调方法就在这个线程执行 25 | } 26 | }; 27 | Looper.loop(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Channel1App/src/main/java/com/danxx/views/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.danxx.views; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.util.Log; 7 | import android.view.MotionEvent; 8 | import android.view.View; 9 | 10 | import aop.statistics.log.AopLog; 11 | 12 | public class MainActivity extends AppCompatActivity { 13 | 14 | @Override 15 | protected void onCreate(Bundle savedInstanceState) { 16 | super.onCreate(savedInstanceState); 17 | setContentView(R.layout.activity_main); 18 | 19 | findViewById(R.id.aopBtn).setOnClickListener(new View.OnClickListener() { 20 | @Override 21 | public void onClick(View view) { 22 | Log.d("danxx", "onClick--->"); 23 | } 24 | }); 25 | 26 | } 27 | 28 | @AopLog 29 | public void CustomViewPagerActivity(View v){ 30 | Intent intent = new Intent(MainActivity.this,CustomViewPagerActivity.class); 31 | startActivity(intent); 32 | } 33 | 34 | public void CircleImageViewActivity(View view){ 35 | Intent intent = new Intent(MainActivity.this,CircleImageViewActivity.class); 36 | startActivity(intent); 37 | } 38 | 39 | public void ActivityVerticalTabIndicator(View view){ 40 | Intent intent = new Intent(MainActivity.this,ActivityVerticalTabIndicator.class); 41 | startActivity(intent); 42 | } 43 | 44 | public void RefreshScrollActivity(View view){ 45 | Intent intent = new Intent(MainActivity.this,RefreshScrollActivity.class); 46 | startActivity(intent); 47 | } 48 | 49 | public void RefreshListViewActivity(View view){ 50 | Intent intent = new Intent(MainActivity.this,RefreshListViewActivity.class); 51 | startActivity(intent); 52 | } 53 | 54 | public void ImageLoadActivity(View view){ 55 | Intent intent = new Intent(MainActivity.this,ImageLoadActivity.class); 56 | startActivity(intent); 57 | } 58 | 59 | public void scoket(View v){ 60 | Intent intent = new Intent(MainActivity.this, ActivityHeartSocket.class); 61 | startActivity(intent); 62 | } 63 | 64 | @Override 65 | public boolean dispatchTouchEvent(MotionEvent ev) { 66 | return super.dispatchTouchEvent(ev); 67 | } 68 | 69 | @Override 70 | public boolean onTouchEvent(MotionEvent event) { 71 | return super.onTouchEvent(event); 72 | } 73 | 74 | @Override 75 | protected void onDestroy() { 76 | super.onDestroy(); 77 | } 78 | 79 | @Override 80 | protected void onPause() { 81 | super.onPause(); 82 | } 83 | 84 | @Override 85 | public void finish() { 86 | super.finish(); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /Channel1App/src/main/java/com/danxx/views/NdkActivity.java: -------------------------------------------------------------------------------- 1 | package com.danxx.views; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.widget.TextView; 6 | 7 | import com.jzp.myapplication.JniUtils; 8 | 9 | /** 10 | * Created by Dawish on 2017/2/4. 11 | */ 12 | 13 | public class NdkActivity extends AppCompatActivity { 14 | private TextView mTextView; 15 | @Override 16 | protected void onCreate(Bundle savedInstanceState) { 17 | super.onCreate(savedInstanceState); 18 | setContentView(R.layout.activity_ndk); 19 | mTextView = (TextView) this.findViewById(R.id.ndkText); 20 | 21 | String encrypt = JniUtils.myEncrypt("123456"); 22 | String decrypt = JniUtils.myDecrypt(encrypt); 23 | 24 | mTextView.setText(JniUtils.getStringC()+"\n未加密:\t123456"+"\n加密:\t"+encrypt 25 | +"\n解密:\t"+decrypt); 26 | 27 | // mTextView.setText(jni.getCLanguageString()); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /Channel1App/src/main/java/com/danxx/views/RefreshScrollActivity.java: -------------------------------------------------------------------------------- 1 | package com.danxx.views; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | import android.os.Bundle; 7 | import android.os.Handler; 8 | import android.os.Message; 9 | import android.widget.Toast; 10 | 11 | import danxx.library.widget.DXPullRefreshMoreView; 12 | import danxx.library.widget.DXPullRefreshView; 13 | import danxx.library.widget.RefreshMoreLisenter; 14 | 15 | 16 | /** 17 | * 18 | * @author Nono 19 | * 20 | */ 21 | public class RefreshScrollActivity extends Activity implements RefreshMoreLisenter { 22 | /** Called when the activity is first created. */ 23 | private DXPullRefreshMoreView mRefreshableView; 24 | private Context mContext; 25 | 26 | 27 | Handler handler = new Handler() { 28 | public void handleMessage(Message message) { 29 | super.handleMessage(message); 30 | if(message.what == 1){ 31 | mRefreshableView.onHeaderRefreshFinish(); 32 | }else if(message.what == 2){ 33 | mRefreshableView.onFootrRefreshFinish(); 34 | } 35 | 36 | 37 | Toast.makeText(mContext, "刷新完成", Toast.LENGTH_SHORT).show(); 38 | }; 39 | }; 40 | 41 | @Override 42 | public void onCreate(Bundle savedInstanceState) { 43 | super.onCreate(savedInstanceState); 44 | setContentView(R.layout.activity_scroll); 45 | mContext = this; 46 | init(); 47 | } 48 | private void init() { 49 | // TODO Auto-generated method stub 50 | initView(); 51 | } 52 | private void initView() { 53 | // TODO Auto-generated method stub 54 | mRefreshableView = (DXPullRefreshMoreView) findViewById(R.id.refresh_root); 55 | initData(); 56 | } 57 | private void initData() { 58 | mRefreshableView.setRefreshListener(this); 59 | 60 | } 61 | 62 | @Override 63 | public void onRefresh() { 64 | handler.sendEmptyMessageDelayed(1, 2000); 65 | } 66 | 67 | @Override 68 | public void onLoadMore() { 69 | handler.sendEmptyMessageDelayed(2, 2000); 70 | } 71 | 72 | @Override 73 | public void onLongPullUp() { 74 | Intent intent = new Intent(RefreshScrollActivity.this,CircleImageViewActivity.class); 75 | startActivity(intent); 76 | mRefreshableView.onFootrRefreshFinish(); 77 | } 78 | } -------------------------------------------------------------------------------- /Channel1App/src/main/java/com/java/decorator/ChaoFan.java: -------------------------------------------------------------------------------- 1 | package com.java.decorator; 2 | 3 | /** 4 | * @Description: 素炒饭 价格 5 元 5 | * @Author: Danxingxi 6 | * @CreateDate: 2016/10/13 9:26 7 | */ 8 | public class ChaoFan implements IFood { 9 | /** 10 | * 主食价格 11 | */ 12 | @Override 13 | public int caculatePrice() { 14 | return 5; 15 | } 16 | 17 | /** 18 | * 主食描述 19 | */ 20 | @Override 21 | public String description() { 22 | return "炒饭"; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Channel1App/src/main/java/com/java/decorator/ChaoMian.java: -------------------------------------------------------------------------------- 1 | package com.java.decorator; 2 | 3 | /** 4 | * @Description: 素炒面 价格 4 元 5 | * @Author: Danxingxi 6 | * @CreateDate: 2016/10/13 9:27 7 | */ 8 | public class ChaoMian implements IFood { 9 | /** 10 | * 主食价格 11 | */ 12 | @Override 13 | public int caculatePrice() { 14 | return 4; 15 | } 16 | 17 | /** 18 | * 主食描述 19 | */ 20 | @Override 21 | public String description() { 22 | return "炒面"; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Channel1App/src/main/java/com/java/decorator/EggDecorator.java: -------------------------------------------------------------------------------- 1 | package com.java.decorator; 2 | 3 | /** 4 | * @Description: 鸡蛋食材 价格 3 元 5 | * @Author: Danxingxi 6 | * @CreateDate: 2016/10/13 9:53 7 | */ 8 | public class EggDecorator implements IFoodDecorator { 9 | 10 | private IFood iFood; 11 | 12 | /** 13 | * 在构建食材的时候告诉是用于在什么主食中, 14 | * 我们只需要使用IFood接口就可以来修改主食的价格和描述,这就是IFood超类的好处 15 | * @param food 16 | */ 17 | public EggDecorator(IFood food){ 18 | this.iFood = food; 19 | } 20 | 21 | /** 22 | * 修改 主食价格 23 | */ 24 | @Override 25 | public int caculatePrice() { 26 | return iFood.caculatePrice() + 3; 27 | } 28 | 29 | /** 30 | * 修改 主食描述 31 | */ 32 | @Override 33 | public String description() { 34 | return "鸡蛋 " + iFood.description() ; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Channel1App/src/main/java/com/java/decorator/IFood.java: -------------------------------------------------------------------------------- 1 | package com.java.decorator; 2 | 3 | /** 4 | * @Description: 主食接口超类 5 | * @Author: Danxingxi 6 | * @CreateDate: 2016/10/13 9:11 7 | */ 8 | public interface IFood { 9 | /** 10 | * 主食价格 11 | */ 12 | int caculatePrice(); 13 | 14 | /** 15 | * 主食描述 16 | */ 17 | String description(); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /Channel1App/src/main/java/com/java/decorator/IFoodDecorator.java: -------------------------------------------------------------------------------- 1 | package com.java.decorator; 2 | 3 | /** 4 | * @Description: 添加食材的超类接口,就是继承了IFood接口,当 5 | * 食材实现这个接口的时候需要用到IFood中的方法来对价格和描述做出修改 6 | * @Author: Danxingxi 7 | * @CreateDate: 2016/10/13 9:31 8 | */ 9 | public interface IFoodDecorator extends IFood { 10 | 11 | //这里也可以为食材添加别的功能,比如食材的功效之类的 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Channel1App/src/main/java/com/java/decorator/RoseDecorator.java: -------------------------------------------------------------------------------- 1 | package com.java.decorator; 2 | 3 | /** 4 | * @Description: 肉丝添加食材 5 | * 价格: 5 元 6 | * @Author: Danxingxi 7 | * @CreateDate: 2016/10/13 9:35 8 | */ 9 | public class RoseDecorator implements IFoodDecorator { 10 | 11 | private IFood iFood; 12 | 13 | /** 14 | * 在构建食材的时候告诉是用于在什么主食中, 15 | * 我们只需要使用IFood接口就可以来修改主食的价格和描述,这就是IFood超类的好处 16 | * @param food 17 | */ 18 | public RoseDecorator(IFood food){ 19 | this.iFood = food; 20 | } 21 | 22 | /** 23 | * 主食价格 24 | */ 25 | @Override 26 | public int caculatePrice() { 27 | /**在主食本来具有的价格上增加 5 元**/ 28 | return iFood.caculatePrice() + 5; 29 | } 30 | 31 | /** 32 | * 主食描述 33 | */ 34 | @Override 35 | public String description() { 36 | /**在主食本来具有的描述上增加 '肉丝' 描述 **/ 37 | return "肉丝 "+iFood.description(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Channel1App/src/main/java/com/java/factory/ChaoFan.java: -------------------------------------------------------------------------------- 1 | package com.java.factory; 2 | 3 | import android.util.Log; 4 | 5 | /** 6 | * 炒饭接口,做所有炒饭需要的步骤 7 | * Created by Dawish on 2016/10/16. 8 | */ 9 | 10 | public abstract class ChaoFan { 11 | 12 | /** 13 | * 什么炒饭 14 | */ 15 | String name; 16 | 17 | /** 18 | * 顾客的信息 19 | */ 20 | String userData; 21 | 22 | /** 23 | * 做炒饭之前的准备 24 | */ 25 | void prepare(){ 26 | Log.d( name, name+" prepare..."); 27 | } 28 | 29 | /** 30 | * 开始炒饭 31 | */ 32 | void fry(){ 33 | Log.d( name, name+" fry"); 34 | } 35 | 36 | /** 37 | * 打包 38 | */ 39 | void box(){ 40 | Log.d( name, name+" box"); 41 | Log.d( name, name+" 打包贴上顾客信息:"+userData); 42 | } 43 | 44 | public String getUserData(){ 45 | return userData; 46 | } 47 | 48 | 49 | } 50 | -------------------------------------------------------------------------------- /Channel1App/src/main/java/com/java/factory/ChuanKitchen.java: -------------------------------------------------------------------------------- 1 | package com.java.factory; 2 | 3 | /** 4 | * 川菜厨房做炒饭 5 | * Created by Dawish on 2016/10/16. 6 | */ 7 | 8 | public class ChuanKitchen extends Kitchen { 9 | @Override 10 | protected ChaoFan createChaoFan(String type, String userData) { 11 | 12 | if(type.equals("EggChaoFan")){ 13 | return new EggChaoFan(userData); 14 | }else if(type.equals("ChilliEggChaoFan")){ //加辣椒的蛋炒饭 15 | return new EggChaoFan(userData).addChilli(); 16 | }else if(type.equals("RoseChaoFan")){ 17 | return new RoseChaoFan(userData); 18 | }else if(type.equals("ChilliRoseChaoFan")){ 19 | return new RoseChaoFan(userData).addChilli(); //加辣椒的肉丝炒饭 20 | }else { 21 | return null; 22 | } 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Channel1App/src/main/java/com/java/factory/EggChaoFan.java: -------------------------------------------------------------------------------- 1 | package com.java.factory; 2 | 3 | import android.util.Log; 4 | 5 | /** 6 | * 鸡蛋炒饭 7 | * Created by Dawish on 2016/10/16. 8 | */ 9 | 10 | public class EggChaoFan extends ChaoFan { 11 | 12 | private final static String TAG = "EggChaoFan"; 13 | 14 | /** 15 | * 16 | * @param mUserData 在做炒饭的时候把用户信息高速厨房,方便在打包的时候贴上用户信息 17 | */ 18 | public EggChaoFan(String mUserData){ 19 | name = TAG; 20 | userData = mUserData; 21 | addEgg(); 22 | } 23 | 24 | public void addEgg(){ 25 | Log.d(TAG, "加鸡蛋>>>"); 26 | } 27 | 28 | /** 29 | * 是否加辣椒 30 | */ 31 | public ChaoFan addChilli(){ 32 | Log.d(TAG, "鸡蛋炒饭加辣椒>>>"); 33 | return this; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Channel1App/src/main/java/com/java/factory/Kitchen.java: -------------------------------------------------------------------------------- 1 | package com.java.factory; 2 | 3 | /** 4 | * 厨房,一个饭店可能会有好多个厨房 5 | * Created by Dawish on 2016/10/16. 6 | */ 7 | 8 | public abstract class Kitchen { 9 | 10 | /** 11 | * 所有厨房对外的方法,顾客向厨房下单,具体的做炒饭在具体的厨房实行, 12 | * @param type 13 | * @param userData 14 | * @return 15 | */ 16 | public ChaoFan orderChaoFan(String type, String userData){ 17 | ChaoFan chaoFan; 18 | chaoFan = createChaoFan(type, userData); 19 | /**我们不管是什么炒饭,下面的三个方法都会有**/ 20 | chaoFan.prepare(); 21 | chaoFan.fry(); 22 | chaoFan.box(); 23 | return chaoFan; 24 | } 25 | 26 | /**川菜 粤菜 厨房等需要实现的方法,来做炒饭 27 | * 这样,ChaoFan超类的代码就和鸡蛋炒饭、肉丝炒饭这些子类对象创建代码解耦了。 28 | * 29 | **/ 30 | protected abstract ChaoFan createChaoFan(String type, String userData); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /Channel1App/src/main/java/com/java/factory/RoseChaoFan.java: -------------------------------------------------------------------------------- 1 | package com.java.factory; 2 | 3 | import android.util.Log; 4 | 5 | /** 6 | * Created by Dawish on 2016/10/16. 7 | */ 8 | 9 | public class RoseChaoFan extends ChaoFan { 10 | 11 | private final static String TAG = "RoseChaoFan"; 12 | 13 | /** 14 | * 15 | * @param mUserData 在做炒饭的时候把用户信息告诉厨房,方便在打包的时候贴上用户信息 16 | */ 17 | public RoseChaoFan(String mUserData){ 18 | name = TAG; 19 | userData = mUserData; 20 | addRose(); 21 | } 22 | 23 | public void addRose(){ 24 | Log.d(TAG, "加肉丝>>>"); 25 | } 26 | 27 | /** 28 | * 是否加辣椒 29 | */ 30 | public ChaoFan addChilli(){ 31 | Log.d(TAG, "肉丝炒饭加辣椒>>>"); 32 | return this; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /Channel1App/src/main/java/com/java/ui/ActivityDecorator.java: -------------------------------------------------------------------------------- 1 | package com.java.ui; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.view.View; 6 | import android.widget.TextView; 7 | 8 | import com.danxx.views.R; 9 | import com.java.decorator.ChaoFan; 10 | import com.java.decorator.ChaoMian; 11 | import com.java.decorator.EggDecorator; 12 | import com.java.decorator.IFood; 13 | import com.java.decorator.RoseDecorator; 14 | 15 | /** 16 | * 17 | * 顾客点单 18 | * 19 | * @Description: 装饰者设计模式测试 20 | * @Author: Danxingxi 21 | * @CreateDate: 2016/10/13 10:00 22 | */ 23 | public class ActivityDecorator extends AppCompatActivity { 24 | 25 | private TextView name,price; 26 | 27 | @Override 28 | protected void onCreate(Bundle savedInstanceState) { 29 | super.onCreate(savedInstanceState); 30 | setContentView(R.layout.activity_decorator); 31 | name = (TextView) findViewById(R.id.name); 32 | price = (TextView) findViewById(R.id.price); 33 | } 34 | 35 | /** 36 | * 做一份肉丝炒饭 37 | * @return 38 | */ 39 | public void roseChaoFan(View view){ 40 | IFood iFood = new RoseDecorator(new ChaoFan()); 41 | name.setText("主食: "+ iFood.description()); 42 | price.setText("价格: "+ iFood.caculatePrice() +" 元"); 43 | } 44 | 45 | /** 46 | * 做一份肉丝鸡蛋炒饭 47 | * @return 48 | */ 49 | public void roseEggChaoFan(View view){ 50 | IFood iFood = new RoseDecorator(new EggDecorator(new ChaoFan())); 51 | name.setText("主食: "+ iFood.description()); 52 | price.setText("价格: "+ iFood.caculatePrice() +" 元"); 53 | } 54 | 55 | /** 56 | * 做一份鸡蛋肉丝炒面 57 | * @return 58 | */ 59 | public void eggRoseChaoMian(View view){ 60 | IFood iFood = new EggDecorator(new RoseDecorator(new ChaoMian())); 61 | name.setText("主食: "+ iFood.description()); 62 | price.setText("价格: "+ iFood.caculatePrice() +" 元"); 63 | } 64 | 65 | @Override 66 | public void finish() { 67 | super.finish(); 68 | //完成 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Channel1App/src/main/java/com/java/ui/ActivityFactory.java: -------------------------------------------------------------------------------- 1 | package com.java.ui; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.util.Log; 6 | 7 | import com.java.factory.ChaoFan; 8 | import com.java.factory.ChuanKitchen; 9 | 10 | /** 11 | * Created by Dawish on 2016/10/16. 12 | */ 13 | 14 | public class ActivityFactory extends AppCompatActivity { 15 | 16 | @Override 17 | protected void onCreate( Bundle savedInstanceState) { 18 | super.onCreate(savedInstanceState); 19 | 20 | ChuanKitchen chuanKitchen = new ChuanKitchen(); 21 | 22 | ChaoFan eggChaoFan = chuanKitchen.orderChaoFan("EggChaoFan" , "西湖区西溪湿地"); 23 | 24 | Log.d("danxx", ""+eggChaoFan.getUserData()); 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Channel1App/src/main/java/com/jzp/myapplication/JniUtils.java: -------------------------------------------------------------------------------- 1 | package com.jzp.myapplication; 2 | 3 | import android.util.Log; 4 | 5 | /** 6 | * Created by Dawish on 2017/2/11. 7 | */ 8 | 9 | public class JniUtils { 10 | 11 | public static native String getStringC(); 12 | 13 | public static native String myEncrypt(String content); 14 | 15 | public static native String myDecrypt(String content); 16 | 17 | static { 18 | System.loadLibrary("DanxxJniLibName");//之前在build.gradle里面设置的so名字,必须一致 19 | } 20 | 21 | public static String encrypt(String key, String plainText) throws Exception{ 22 | //TODO 加密 23 | Log.i("danxx", "加密--->"+plainText); 24 | return "这是加密前的字符串"; 25 | } 26 | 27 | public static String decrypt(String key, String cryptedText) throws Exception{ 28 | //TODO 解密 29 | Log.i("danxx", "解密--->"+cryptedText); 30 | return "这是解密后的字符串"; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Channel1App/src/main/java/com/ndk/NdkJniUtils.java: -------------------------------------------------------------------------------- 1 | package com.ndk; 2 | 3 | /** 4 | * Created by Dawish on 2017/2/4. 5 | */ 6 | 7 | public class NdkJniUtils { 8 | static { 9 | System.loadLibrary("DanxxJniLibName"); //defaultConfig.ndk.moduleName 10 | } 11 | public native String getCLanguageString(); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Channel1App/src/main/jni/com_jzp_myapplication_JniUtils.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class com_jzp_myapplication_JniUtils */ 4 | 5 | #ifndef _Included_com_jzp_myapplication_JniUtils 6 | #define _Included_com_jzp_myapplication_JniUtils 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: com_jzp_myapplication_JniUtils 12 | * Method: getStringC 13 | * Signature: ()Ljava/lang/String; 14 | */ 15 | JNIEXPORT jstring JNICALL Java_com_jzp_myapplication_JniUtils_getStringC 16 | (JNIEnv *, jclass); 17 | 18 | /* 19 | * Class: com_jzp_myapplication_JniUtils 20 | * Method: myEncrypt 21 | * Signature: (Ljava/lang/String;)Ljava/lang/String; 22 | */ 23 | JNIEXPORT jstring JNICALL Java_com_jzp_myapplication_JniUtils_myEncrypt 24 | (JNIEnv *, jclass, jstring); 25 | 26 | /* 27 | * Class: com_jzp_myapplication_JniUtils 28 | * Method: myDecrypt 29 | * Signature: (Ljava/lang/String;)Ljava/lang/String; 30 | */ 31 | JNIEXPORT jstring JNICALL Java_com_jzp_myapplication_JniUtils_myDecrypt 32 | (JNIEnv *, jclass, jstring); 33 | 34 | #ifdef __cplusplus 35 | } 36 | #endif 37 | #endif 38 | -------------------------------------------------------------------------------- /Channel1App/src/main/jni/com_ndk_NdkJniUtils.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class com_ndk_NdkJniUtils */ 4 | 5 | #ifndef _Included_com_ndk_NdkJniUtils 6 | #define _Included_com_ndk_NdkJniUtils 7 | #ifdef __cplusplus 8 | extern "C" { /* 指定 C 调用约定 */ 9 | #endif 10 | /* 11 | * Class: com_ndk_NdkJniUtils 12 | * Method: getCLanguageString 13 | * Signature: ()Ljava/lang/String; 14 | * JNIEnv* 和 jobject 是所有 jni 函数必有的两个参数,分别表示 jni 环境和对应的 java 类(或对象)本身) 15 | * 接口指针 16 | */ 17 | JNIEXPORT jstring JNICALL Java_com_ndk_NdkJniUtils_getCLanguageString(JNIEnv *, jobject); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | #endif 23 | -------------------------------------------------------------------------------- /Channel1App/src/main/jni/jnidemo.c: -------------------------------------------------------------------------------- 1 | #include "com_jzp_myapplication_JniUtils.h" 2 | #include 3 | const char *DES_KEY = "12345678912345678912345678912345"; 4 | /* 5 | * Class: com_jzp_myapplication_JniUtils 6 | * Method: getString 7 | * Signature: ()Ljava/lang/String; 8 | */ 9 | JNIEXPORT jstring JNICALL Java_com_jzp_myapplication_JniUtils_getStringC 10 | (JNIEnv *env, jobject obj){ 11 | return (*env)->NewStringUTF(env,"这里是来自jni的string"); 12 | } 13 | JNIEXPORT jstring JNICALL Java_com_jzp_myapplication_JniUtils_myEncrypt 14 | (JNIEnv *env, jclass jclass1, jstring jstr) 15 | { 16 | if (jstr == NULL) { 17 | return NULL; 18 | } 19 | jstring key; 20 | jstring result; 21 | jclass AESencrypt; 22 | jmethodID mid; 23 | 24 | AESencrypt = (*env)->FindClass(env, "com/jzp/myapplication/JniUtils"); 25 | if (NULL == AESencrypt) { 26 | return NULL; 27 | } 28 | mid = (*env)->GetStaticMethodID(env, AESencrypt, "encrypt", 29 | "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;"); 30 | if (NULL == mid) { 31 | (*env)->DeleteLocalRef(env, AESencrypt); 32 | return NULL; 33 | } 34 | key = (*env)->NewStringUTF(env, DES_KEY); 35 | result = (*env)->CallStaticObjectMethod(env, AESencrypt, mid, key, jstr); 36 | (*env)->DeleteLocalRef(env, AESencrypt); 37 | (*env)->DeleteLocalRef(env, key); 38 | return result; 39 | // return (*env)->NewStringUTF(env,"加密返回"); 40 | } 41 | 42 | JNIEXPORT jstring JNICALL Java_com_jzp_myapplication_JniUtils_myDecrypt 43 | (JNIEnv *env, jclass jclass1, jstring jstr) 44 | { 45 | if (jstr == NULL) { 46 | return NULL; 47 | } 48 | jstring key; 49 | jstring result; 50 | jclass AESencrypt; 51 | jmethodID mid; 52 | 53 | AESencrypt = (*env)->FindClass(env, "com/jzp/myapplication/JniUtils"); 54 | if (NULL == AESencrypt) { 55 | return NULL; 56 | } 57 | mid = (*env)->GetStaticMethodID(env, AESencrypt, "decrypt", 58 | "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;"); 59 | if (NULL == mid) { 60 | (*env)->DeleteLocalRef(env, AESencrypt); 61 | // return NULL; 62 | return (*env)->NewStringUTF(env,"返回为空1"); 63 | } 64 | key = (*env)->NewStringUTF(env, DES_KEY); 65 | result = (*env)->CallStaticObjectMethod(env, AESencrypt, mid, key, jstr); 66 | (*env)->DeleteLocalRef(env, AESencrypt); 67 | (*env)->DeleteLocalRef(env, key); 68 | return result; 69 | // return (*env)->NewStringUTF(env,"返回为空2"); 70 | } -------------------------------------------------------------------------------- /Channel1App/src/main/jni/jnitest.c: -------------------------------------------------------------------------------- 1 | #include "com_ndk_NdkJniUtils.h" 2 | 3 | /* 4 | * Class: com_ndk_NdkJniUtils 5 | * Method: getCLanguageString 6 | * Signature: ()Ljava/lang/String; 7 | * JNIEnv *env 接口指针 8 | * object obj “this”指针 9 | * JNIEXPORT 和 JNICALL 是 jni 的宏,在 android 的 jni 中不需要,当然写上去也不会有错。 10 | */ 11 | JNIEXPORT jstring JNICALL Java_com_ndk_NdkJniUtils_getCLanguageString(JNIEnv *env, jobject obj) 12 | { 13 | return (*env)->NewStringUTF(env,"This just a test for Android Studio NDK JNI developer!"); 14 | } -------------------------------------------------------------------------------- /Channel1App/src/main/res/drawable/app_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/AndroidLearn/b380f8ee58f2a8a87807baf89a42bf0ee4aff301/Channel1App/src/main/res/drawable/app_bg.png -------------------------------------------------------------------------------- /Channel1App/src/main/res/drawable/default_pic_loading.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/AndroidLearn/b380f8ee58f2a8a87807baf89a42bf0ee4aff301/Channel1App/src/main/res/drawable/default_pic_loading.9.png -------------------------------------------------------------------------------- /Channel1App/src/main/res/drawable/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/AndroidLearn/b380f8ee58f2a8a87807baf89a42bf0ee4aff301/Channel1App/src/main/res/drawable/ic_launcher.png -------------------------------------------------------------------------------- /Channel1App/src/main/res/drawable/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/AndroidLearn/b380f8ee58f2a8a87807baf89a42bf0ee4aff301/Channel1App/src/main/res/drawable/image.png -------------------------------------------------------------------------------- /Channel1App/src/main/res/drawable/item_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/AndroidLearn/b380f8ee58f2a8a87807baf89a42bf0ee4aff301/Channel1App/src/main/res/drawable/item_bg.png -------------------------------------------------------------------------------- /Channel1App/src/main/res/drawable/tab_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Channel1App/src/main/res/drawable/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/AndroidLearn/b380f8ee58f2a8a87807baf89a42bf0ee4aff301/Channel1App/src/main/res/drawable/test.png -------------------------------------------------------------------------------- /Channel1App/src/main/res/drawable/test2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/AndroidLearn/b380f8ee58f2a8a87807baf89a42bf0ee4aff301/Channel1App/src/main/res/drawable/test2.png -------------------------------------------------------------------------------- /Channel1App/src/main/res/drawable/view_shadow.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Channel1App/src/main/res/drawable/vp1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/AndroidLearn/b380f8ee58f2a8a87807baf89a42bf0ee4aff301/Channel1App/src/main/res/drawable/vp1.png -------------------------------------------------------------------------------- /Channel1App/src/main/res/drawable/vp2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/AndroidLearn/b380f8ee58f2a8a87807baf89a42bf0ee4aff301/Channel1App/src/main/res/drawable/vp2.png -------------------------------------------------------------------------------- /Channel1App/src/main/res/drawable/vp3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dawish/AndroidLearn/b380f8ee58f2a8a87807baf89a42bf0ee4aff301/Channel1App/src/main/res/drawable/vp3.png -------------------------------------------------------------------------------- /Channel1App/src/main/res/layout/activity_activity_recycler_test.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Channel1App/src/main/res/layout/activity_custom_view_group.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 16 | 17 | 26 | 27 | 36 | 37 | 46 | 47 | -------------------------------------------------------------------------------- /Channel1App/src/main/res/layout/activity_custom_viewpager.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 9 | 14 | 19 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Channel1App/src/main/res/layout/activity_decorator.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 21 | 22 | 29 | 36 | 37 | 45 | 46 | 7 | -------------------------------------------------------------------------------- /Channel1App/src/main/res/layout/image_display.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /Channel1App/src/main/res/layout/layout_invalidate.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 20 | 21 |