├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ └── layout │ │ │ │ ├── fragment_view.xml │ │ │ │ ├── activity_second.xml │ │ │ │ └── activity_main.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── lsyz0021 │ │ │ │ └── eventbusdemo │ │ │ │ ├── EventMessage │ │ │ │ ├── OtherMessage.java │ │ │ │ ├── MessageEvent.java │ │ │ │ └── MyEvent.java │ │ │ │ ├── utils │ │ │ │ └── LogUtils.java │ │ │ │ ├── MyApplication.java │ │ │ │ ├── FristFragment.java │ │ │ │ └── activity │ │ │ │ ├── SecondActivity.java │ │ │ │ └── MainActivity.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── lsyz0021 │ │ │ └── eventbusdemo │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── lsyz0021 │ │ └── eventbusdemo │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── eventbus ├── .gitignore ├── src │ └── main │ │ ├── res │ │ └── values │ │ │ └── strings.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── lsyz0021 │ │ └── eventbus │ │ └── EventBusUtils.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── appKey_release.jks ├── .idea ├── copyright │ └── profiles_settings.xml ├── vcs.xml ├── encodings.xml ├── modules.xml ├── runConfigurations.xml ├── gradle.xml ├── compiler.xml └── misc.xml ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── gradle.properties ├── README.md ├── gradlew.bat └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /eventbus/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':eventbus' 2 | -------------------------------------------------------------------------------- /appKey_release.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsyz0021/EventBusUtils/HEAD/appKey_release.jks -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /eventbus/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | eventbus 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | EventBusUtilsDemo 3 | 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsyz0021/EventBusUtils/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsyz0021/EventBusUtils/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsyz0021/EventBusUtils/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsyz0021/EventBusUtils/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsyz0021/EventBusUtils/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsyz0021/EventBusUtils/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsyz0021/EventBusUtils/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsyz0021/EventBusUtils/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsyz0021/EventBusUtils/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsyz0021/EventBusUtils/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lsyz0021/EventBusUtils/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri May 12 11:01:07 CST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip 7 | -------------------------------------------------------------------------------- /eventbus/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/lsyz0021/eventbusdemo/EventMessage/OtherMessage.java: -------------------------------------------------------------------------------- 1 | package com.lsyz0021.eventbusdemo.EventMessage; 2 | 3 | /** 4 | * 作者: lcw on 2016/7/4. 5 | * 博客: http://blog.csdn.net/lsyz0021/ 6 | */ 7 | public class OtherMessage { 8 | public final String message; 9 | 10 | public OtherMessage(String message) { 11 | this.message = message; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/java/com/lsyz0021/eventbusdemo/EventMessage/MessageEvent.java: -------------------------------------------------------------------------------- 1 | package com.lsyz0021.eventbusdemo.EventMessage; 2 | 3 | /** 4 | * 作者: lcw on 2016/7/4. 5 | * 博客: http://blog.csdn.net/lsyz0021/ 6 | */ 7 | public class MessageEvent { 8 | public final String message; 9 | 10 | public MessageEvent(String message) { 11 | this.message = message; 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/lsyz0021/eventbusdemo/utils/LogUtils.java: -------------------------------------------------------------------------------- 1 | package com.lsyz0021.eventbusdemo.utils; 2 | 3 | import android.util.Log; 4 | 5 | /** 6 | * 作者: lcw on 2016/7/8. 7 | * 博客: http://blog.csdn.net/lsyz0021/ 8 | */ 9 | public class LogUtils { 10 | private static boolean isShow = true; 11 | 12 | private LogUtils() { 13 | } 14 | 15 | public static void v(String tag, String msg) { 16 | if (isShow) { 17 | Log.v(tag, msg); 18 | } 19 | } 20 | 21 | 22 | } 23 | 24 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/test/java/com/lsyz0021/eventbusdemo/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.lsyz0021.eventbusdemo; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /app/src/main/java/com/lsyz0021/eventbusdemo/MyApplication.java: -------------------------------------------------------------------------------- 1 | package com.lsyz0021.eventbusdemo; 2 | 3 | import android.app.Application; 4 | 5 | import org.greenrobot.eventbus.EventBus; 6 | 7 | /** 8 | * 作者: lcw on 2016/7/6. 9 | * 博客: http://blog.csdn.net/lsyz0021/ 10 | */ 11 | public class MyApplication extends Application { 12 | 13 | @Override 14 | public void onCreate() { 15 | super.onCreate(); 16 | // 启用EventBus3.0加速功能 17 | EventBus.builder().addIndex(new MyEventBusIndex()).installDefaultEventBus(); 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/lsyz0021/eventbusdemo/EventMessage/MyEvent.java: -------------------------------------------------------------------------------- 1 | package com.lsyz0021.eventbusdemo.EventMessage; 2 | 3 | /** 4 | * 作者: lcw on 2016/7/7. 5 | * 博客: http://blog.csdn.net/lsyz0021/ 6 | */ 7 | public class MyEvent { 8 | 9 | public static class Message { 10 | 11 | public String msg; 12 | 13 | public Message(String msg) { 14 | this.msg = msg; 15 | } 16 | } 17 | 18 | 19 | public static class OtherMessage { 20 | public String msg; 21 | 22 | public OtherMessage(String msg) { 23 | this.msg = msg; 24 | } 25 | } 26 | 27 | 28 | } 29 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/lsyz0021/eventbusdemo/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.lsyz0021.eventbusdemo; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.lsyz0021.eventbusdemo", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:\Android_Develop_Tools\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /eventbus/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_Tools\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /eventbus/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25.0.3" 6 | 7 | defaultConfig { 8 | minSdkVersion 9 9 | targetSdkVersion 25 10 | versionCode 1 11 | versionName "1.0" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | compile 'org.greenrobot:eventbus:3.0.0' 23 | } 24 | 25 | apply plugin: 'com.novoda.bintray-release' 26 | publish { 27 | bintrayUser = 'hfaxs' // 登陆账号 28 | userOrg = 'hfaxs' // bintray.com/用户名 29 | repoName = 'eventbus' // Repositories名,默认为"maven" 30 | groupId = 'com.lsyz0021.eventbus' // 项目的包名 31 | artifactId = 'eventbus' // 上传到bintray里的Package Name(这里填什么就显示什么) 32 | publishVersion = '1.0' // 版本号(这里填什么就显示什么) 33 | dryRun = false // false:上传,true:不上传 34 | desc = 'this is a eventBus Utils' //描述,不重要 35 | website = 'https://github.com/lsyz0021/EventBusUtils' //项目的地址,不重要 36 | } -------------------------------------------------------------------------------- /app/src/main/java/com/lsyz0021/eventbusdemo/FristFragment.java: -------------------------------------------------------------------------------- 1 | package com.lsyz0021.eventbusdemo; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v4.app.Fragment; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.TextView; 10 | 11 | import com.lsyz0021.eventbus.EventBusUtils; 12 | import com.lsyz0021.eventbusdemo.EventMessage.MessageEvent; 13 | import com.lsyz0021.eventbusdemo.EventMessage.OtherMessage; 14 | 15 | import org.greenrobot.eventbus.Subscribe; 16 | import org.greenrobot.eventbus.ThreadMode; 17 | 18 | /** 19 | * 作者: lcw on 2016/7/5. 20 | * 博客: http://blog.csdn.net/lsyz0021/ 21 | */ 22 | public class FristFragment extends Fragment { 23 | 24 | private TextView text1; 25 | private TextView text2; 26 | 27 | @Nullable 28 | @Override 29 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 30 | 31 | View view = inflater.inflate(R.layout.fragment_view, container, false); 32 | 33 | text1 = (TextView) view.findViewById(R.id.tv_fragment_text1); 34 | text2 = (TextView) view.findViewById(R.id.tv_fragment_text2); 35 | return view; 36 | } 37 | 38 | @Subscribe(threadMode = ThreadMode.MAIN, sticky = true) 39 | public void MessageEvent(MessageEvent event) { 40 | text1.setText(event.message); 41 | } 42 | 43 | @Subscribe(threadMode = ThreadMode.MAIN, sticky = true) 44 | public void MessageEvent(OtherMessage event) { 45 | text2.setText(event.message); 46 | } 47 | 48 | @Override 49 | public void onStart() { 50 | super.onStart(); 51 | EventBusUtils.register(this); 52 | } 53 | 54 | @Override 55 | public void onDestroy() { 56 | super.onDestroy(); 57 | EventBusUtils.unregister(this); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_second.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 |