├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── drawable │ │ │ │ ├── add.png │ │ │ │ └── bg.png │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── dimens.xml │ │ │ │ └── styles.xml │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── layout │ │ │ │ ├── activity_main.xml │ │ │ │ ├── fragment_first.xml │ │ │ │ ├── fragment_fourth.xml │ │ │ │ ├── fragment_second.xml │ │ │ │ ├── fragment_third.xml │ │ │ │ ├── fragment_main.xml │ │ │ │ ├── layout_bottom.xml │ │ │ │ └── popup_menu.xml │ │ │ └── values-w820dp │ │ │ │ └── dimens.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── lichenglin │ │ │ │ └── easyapp │ │ │ │ ├── base │ │ │ │ └── BaseFragment.java │ │ │ │ ├── utils │ │ │ │ └── StartBrotherEvent.java │ │ │ │ ├── activity │ │ │ │ └── MainActivity.java │ │ │ │ └── ui │ │ │ │ ├── ThirdFragment.java │ │ │ │ ├── FirstFragment.java │ │ │ │ ├── FouthFragment.java │ │ │ │ ├── SecondFragment.java │ │ │ │ ├── view │ │ │ │ ├── BottomBar.java │ │ │ │ └── PopupMenuUtil.java │ │ │ │ └── MainFragment.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── lichenglin │ │ │ └── easyapp │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── lichenglin │ │ └── easyapp │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro ├── build.gradle └── app.iml ├── settings.gradle ├── .gradle └── 2.14.1 │ ├── taskArtifacts │ ├── cache.properties │ ├── fileHashes.bin │ ├── fileSnapshots.bin │ ├── taskArtifacts.bin │ ├── cache.properties.lock │ └── fileSnapshotsToTreeSnapshotsIndex.bin │ └── tasks │ └── _app_compileDebugJavaWithJavac │ ├── localClassSetAnalysis │ ├── localClassSetAnalysis.bin │ └── localClassSetAnalysis.lock │ └── localJarClasspathSnapshot │ ├── localJarClasspathSnapshot.bin │ └── localJarClasspathSnapshot.lock ├── README.md ├── .idea ├── dictionaries │ └── dell.xml ├── copyright │ └── profiles_settings.xml ├── libraries │ ├── android_android_25.xml │ ├── javax_inject_1.xml │ ├── jsr305_2_0_1.xml │ ├── javawriter_2_1_1.xml │ ├── hamcrest_library_1_3.xml │ ├── hamcrest_integration_1_3.xml │ ├── javax_annotation_api_1_2.xml │ ├── support_v4_25_3_0.xml │ ├── junit_4_12.xml │ ├── eventbus_3_0_0.xml │ ├── hamcrest_core_1_3.xml │ ├── support_annotations_25_3_0.xml │ ├── espresso_core_2_2_2.xml │ ├── support_vector_drawable_25_3_0.xml │ ├── animated_vector_drawable_25_3_0.xml │ ├── espresso_idling_resource_2_2_2.xml │ ├── exposed_instrumentation_api_publish_0_5.xml │ ├── rules_0_5.xml │ ├── runner_0_5.xml │ ├── appcompat_v7_25_3_0.xml │ ├── fragmentation_0_10_2.xml │ ├── support_compat_25_3_0.xml │ ├── support_core_ui_25_3_0.xml │ ├── support_fragment_25_3_0.xml │ ├── support_core_utils_25_3_0.xml │ └── support_media_compat_25_3_0.xml ├── modules.xml ├── runConfigurations.xml ├── gradle.xml ├── compiler.xml └── misc.xml ├── gradle └── wrapper │ └── gradle-wrapper.properties ├── .gitattributes ├── local.properties ├── gradle.properties ├── EasyApp.iml ├── .gitignore ├── gradlew.bat └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /.gradle/2.14.1/taskArtifacts/cache.properties: -------------------------------------------------------------------------------- 1 | #Fri Apr 07 10:50:03 CST 2017 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # EasyApp 2 | 基于Fragmentation的app简易框架 3 | 效果图: 4 | ![](http://i.imgur.com/Vo61rcm.gif) 5 | -------------------------------------------------------------------------------- /.idea/dictionaries/dell.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiFaFa/EasyApp/HEAD/app/src/main/res/drawable/add.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiFaFa/EasyApp/HEAD/app/src/main/res/drawable/bg.png -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | EasyApp 3 | 4 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.gradle/2.14.1/taskArtifacts/fileHashes.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiFaFa/EasyApp/HEAD/.gradle/2.14.1/taskArtifacts/fileHashes.bin -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiFaFa/EasyApp/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiFaFa/EasyApp/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /.gradle/2.14.1/taskArtifacts/fileSnapshots.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiFaFa/EasyApp/HEAD/.gradle/2.14.1/taskArtifacts/fileSnapshots.bin -------------------------------------------------------------------------------- /.gradle/2.14.1/taskArtifacts/taskArtifacts.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiFaFa/EasyApp/HEAD/.gradle/2.14.1/taskArtifacts/taskArtifacts.bin -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiFaFa/EasyApp/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiFaFa/EasyApp/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiFaFa/EasyApp/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /.gradle/2.14.1/taskArtifacts/cache.properties.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiFaFa/EasyApp/HEAD/.gradle/2.14.1/taskArtifacts/cache.properties.lock -------------------------------------------------------------------------------- /.gradle/2.14.1/taskArtifacts/fileSnapshotsToTreeSnapshotsIndex.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiFaFa/EasyApp/HEAD/.gradle/2.14.1/taskArtifacts/fileSnapshotsToTreeSnapshotsIndex.bin -------------------------------------------------------------------------------- /.gradle/2.14.1/tasks/_app_compileDebugJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiFaFa/EasyApp/HEAD/.gradle/2.14.1/tasks/_app_compileDebugJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.bin -------------------------------------------------------------------------------- /.gradle/2.14.1/tasks/_app_compileDebugJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiFaFa/EasyApp/HEAD/.gradle/2.14.1/tasks/_app_compileDebugJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.lock -------------------------------------------------------------------------------- /.gradle/2.14.1/tasks/_app_compileDebugJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiFaFa/EasyApp/HEAD/.gradle/2.14.1/tasks/_app_compileDebugJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.bin -------------------------------------------------------------------------------- /.gradle/2.14.1/tasks/_app_compileDebugJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiFaFa/EasyApp/HEAD/.gradle/2.14.1/tasks/_app_compileDebugJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.lock -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Dec 28 10:00:20 PST 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip 7 | -------------------------------------------------------------------------------- /.idea/libraries/android_android_25.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/java/com/lichenglin/easyapp/base/BaseFragment.java: -------------------------------------------------------------------------------- 1 | package com.lichenglin.easyapp.base;/** 2 | * Created by dell on 2017/4/5/0005. 3 | */ 4 | 5 | import me.yokeyword.fragmentation.SupportFragment; 6 | 7 | /** 8 | * created by LiChengalin at 2017/4/5/0005 9 | */ 10 | public class BaseFragment extends SupportFragment{ 11 | 12 | } 13 | -------------------------------------------------------------------------------- /.idea/libraries/javax_inject_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/jsr305_2_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/javawriter_2_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/hamcrest_library_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /.idea/libraries/hamcrest_integration_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/javax_annotation_api_1_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /app/src/main/java/com/lichenglin/easyapp/utils/StartBrotherEvent.java: -------------------------------------------------------------------------------- 1 | package com.lichenglin.easyapp.utils; 2 | 3 | import me.yokeyword.fragmentation.SupportFragment; 4 | 5 | /** 6 | * created by LiChengalin at 2017/4/5/0005 7 | */ 8 | public class StartBrotherEvent { 9 | public SupportFragment targetFragment; 10 | 11 | public StartBrotherEvent(SupportFragment targetFragment) { 12 | this.targetFragment = targetFragment; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /.idea/libraries/support_v4_25_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/test/java/com/lichenglin/easyapp/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.lichenglin.easyapp; 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 | } -------------------------------------------------------------------------------- /.idea/libraries/junit_4_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_first.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_fourth.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_second.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_third.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.idea/libraries/eventbus_3_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /local.properties: -------------------------------------------------------------------------------- 1 | ## This file is automatically generated by Android Studio. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must *NOT* be checked into Version Control Systems, 5 | # as it contains information specific to your local configuration. 6 | # 7 | # Location of the SDK. This is only used by Gradle. 8 | # For customization when using a Version Control System, please read the 9 | # header note. 10 | #Fri Apr 07 10:49:59 CST 2017 11 | ndk.dir=C\:\\Users\\dell\\AppData\\Local\\Android\\Sdk\\ndk-bundle 12 | sdk.dir=C\:\\Users\\dell\\AppData\\Local\\Android\\Sdk 13 | -------------------------------------------------------------------------------- /.idea/libraries/hamcrest_core_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/support_annotations_25_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /.idea/libraries/espresso_core_2_2_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/lichenglin/easyapp/activity/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.lichenglin.easyapp.activity; 2 | 3 | import android.os.Bundle; 4 | 5 | import com.lichenglin.easyapp.R; 6 | import com.lichenglin.easyapp.ui.MainFragment; 7 | 8 | import me.yokeyword.fragmentation.SupportActivity; 9 | 10 | public class MainActivity extends SupportActivity { 11 | 12 | @Override 13 | protected void onCreate(Bundle savedInstanceState) { 14 | super.onCreate(savedInstanceState); 15 | setContentView(R.layout.activity_main); 16 | if (savedInstanceState == null) { 17 | loadRootFragment(R.id.fragment_container, MainFragment.newInstance()); 18 | } 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /.idea/libraries/support_vector_drawable_25_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/animated_vector_drawable_25_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /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 C:\Users\dell\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /.idea/libraries/espresso_idling_resource_2_2_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /.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/libraries/exposed_instrumentation_api_publish_0_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/rules_0_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.idea/libraries/runner_0_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/appcompat_v7_25_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/fragmentation_0_10_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/support_compat_25_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/support_core_ui_25_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/support_fragment_25_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/support_core_utils_25_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /.idea/libraries/support_media_compat_25_3_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/lichenglin/easyapp/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.lichenglin.easyapp; 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.lichenglin.easyapp", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /EasyApp.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/lichenglin/easyapp/ui/ThirdFragment.java: -------------------------------------------------------------------------------- 1 | package com.lichenglin.easyapp.ui;/** 2 | * Created by dell on 2017/4/5/0005. 3 | */ 4 | 5 | import android.os.Bundle; 6 | import android.support.annotation.Nullable; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | 11 | import com.lichenglin.easyapp.R; 12 | import com.lichenglin.easyapp.base.BaseFragment; 13 | 14 | 15 | /** 16 | * created by LiChengalin at 2017/4/5/0005 17 | */ 18 | public class ThirdFragment extends BaseFragment { 19 | 20 | public static ThirdFragment newInstance() { 21 | 22 | Bundle args = new Bundle(); 23 | 24 | ThirdFragment fragment = new ThirdFragment(); 25 | fragment.setArguments(args); 26 | return fragment; 27 | } 28 | @Nullable 29 | @Override 30 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 31 | View view = inflater.inflate(R.layout.fragment_third, container, false); 32 | return view; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/java/com/lichenglin/easyapp/ui/FirstFragment.java: -------------------------------------------------------------------------------- 1 | package com.lichenglin.easyapp.ui;/** 2 | * Created by dell on 2017/4/5/0005. 3 | */ 4 | 5 | import android.os.Bundle; 6 | import android.support.annotation.Nullable; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | 11 | import com.lichenglin.easyapp.R; 12 | import com.lichenglin.easyapp.base.BaseFragment; 13 | 14 | 15 | /** 16 | * created by LiChengalin at 2017/4/5/0005 17 | */ 18 | public class FirstFragment extends BaseFragment { 19 | 20 | public static FirstFragment newInstance() { 21 | 22 | Bundle bundle = new Bundle(); 23 | 24 | FirstFragment fragment = new FirstFragment(); 25 | fragment.setArguments(bundle); 26 | return fragment; 27 | } 28 | 29 | @Nullable 30 | @Override 31 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 32 | View view = inflater.inflate(R.layout.fragment_first, container, false); 33 | return view; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/lichenglin/easyapp/ui/FouthFragment.java: -------------------------------------------------------------------------------- 1 | package com.lichenglin.easyapp.ui;/** 2 | * Created by dell on 2017/4/5/0005. 3 | */ 4 | 5 | import android.os.Bundle; 6 | import android.support.annotation.Nullable; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | 11 | import com.lichenglin.easyapp.R; 12 | import com.lichenglin.easyapp.base.BaseFragment; 13 | 14 | 15 | /** 16 | * created by LiChengalin at 2017/4/5/0005 17 | */ 18 | public class FouthFragment extends BaseFragment { 19 | 20 | public static FouthFragment newInstance() { 21 | 22 | Bundle bundle = new Bundle(); 23 | 24 | FouthFragment fragment = new FouthFragment(); 25 | fragment.setArguments(bundle); 26 | return fragment; 27 | } 28 | 29 | @Nullable 30 | @Override 31 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 32 | View view = inflater.inflate(R.layout.fragment_fourth, container, false); 33 | return view; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/lichenglin/easyapp/ui/SecondFragment.java: -------------------------------------------------------------------------------- 1 | package com.lichenglin.easyapp.ui;/** 2 | * Created by dell on 2017/4/5/0005. 3 | */ 4 | 5 | import android.os.Bundle; 6 | import android.support.annotation.Nullable; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | 11 | import com.lichenglin.easyapp.R; 12 | import com.lichenglin.easyapp.base.BaseFragment; 13 | 14 | 15 | /** 16 | * created by LiChengalin at 2017/4/5/0005 17 | */ 18 | public class SecondFragment extends BaseFragment { 19 | 20 | public static SecondFragment newInstance() { 21 | 22 | Bundle bundle = new Bundle(); 23 | 24 | SecondFragment fragment = new SecondFragment(); 25 | fragment.setArguments(bundle); 26 | return fragment; 27 | } 28 | 29 | @Nullable 30 | @Override 31 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 32 | View view = inflater.inflate(R.layout.fragment_second, container, false); 33 | return view; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Mobile Tools for Java (J2ME) 4 | .mtj.tmp/ 5 | 6 | # Package Files # 7 | *.jar 8 | *.war 9 | *.ear 10 | 11 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 12 | hs_err_pid* 13 | 14 | # ========================= 15 | # Operating System Files 16 | # ========================= 17 | 18 | # OSX 19 | # ========================= 20 | 21 | .DS_Store 22 | .AppleDouble 23 | .LSOverride 24 | 25 | # Thumbnails 26 | ._* 27 | 28 | # Files that might appear in the root of a volume 29 | .DocumentRevisions-V100 30 | .fseventsd 31 | .Spotlight-V100 32 | .TemporaryItems 33 | .Trashes 34 | .VolumeIcon.icns 35 | 36 | # Directories potentially created on remote AFP share 37 | .AppleDB 38 | .AppleDesktop 39 | Network Trash Folder 40 | Temporary Items 41 | .apdisk 42 | 43 | # Windows 44 | # ========================= 45 | 46 | # Windows image file caches 47 | Thumbs.db 48 | ehthumbs.db 49 | 50 | # Folder config file 51 | Desktop.ini 52 | 53 | # Recycle Bin used on file shares 54 | $RECYCLE.BIN/ 55 | 56 | # Windows Installer files 57 | *.cab 58 | *.msi 59 | *.msm 60 | *.msp 61 | 62 | # Windows shortcuts 63 | *.lnk 64 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25.0.2" 6 | defaultConfig { 7 | applicationId "com.lichenglin.easyapp" 8 | minSdkVersion 18 9 | targetSdkVersion 25 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 25 | exclude group: 'com.android.support', module: 'support-annotations' 26 | }) 27 | // appcompat v7包是必须的 28 | // 如果想使用SwipeBack 滑动边缘退出Fragment/Activity功能,请再添加下面的库 29 | // compile 'me.yokeyword:fragmentation-swipeback:0.7.9' 30 | compile 'com.android.support:appcompat-v7:25.3.0' 31 | compile 'me.yokeyword:fragmentation:0.10.2' 32 | // EventBus 33 | compile 'org.greenrobot:eventbus:3.0.0' 34 | testCompile 'junit:junit:4.12' 35 | } 36 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /app/src/main/java/com/lichenglin/easyapp/ui/view/BottomBar.java: -------------------------------------------------------------------------------- 1 | package com.lichenglin.easyapp.ui.view;/** 2 | * Created by dell on 2017/4/6/0006. 3 | */ 4 | 5 | import android.content.Context; 6 | import android.util.AttributeSet; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.widget.FrameLayout; 10 | import android.widget.LinearLayout; 11 | 12 | import com.lichenglin.easyapp.R; 13 | 14 | /** 15 | * created by LiChengalin at 2017/4/6/0006 16 | */ 17 | public class BottomBar extends LinearLayout { 18 | 19 | private Context mContext; 20 | 21 | private FrameLayout mFirst_bottom, mSecond_bottom, mThird_bottom, mFouth_bottom, mCenter_bottom; 22 | private OnBottonbarClick mOnBottonbarClick; 23 | 24 | public BottomBar(Context context) { 25 | super(context); 26 | init(context); 27 | } 28 | 29 | public BottomBar(Context context, AttributeSet attrs) { 30 | super(context, attrs); 31 | init(context); 32 | 33 | } 34 | 35 | private void init(Context context) { 36 | mContext = context; 37 | LayoutInflater.from(mContext).inflate(R.layout.layout_bottom, this, true); 38 | //获取控件id 39 | initId(); 40 | onBottomBarClick(); 41 | } 42 | 43 | 44 | 45 | private void initId() { 46 | 47 | mFirst_bottom = (FrameLayout) findViewById(R.id.first); 48 | mSecond_bottom = (FrameLayout) findViewById(R.id.second); 49 | mThird_bottom = (FrameLayout) findViewById(R.id.third); 50 | mFouth_bottom = (FrameLayout) findViewById(R.id.fouth); 51 | mCenter_bottom = (FrameLayout) findViewById(R.id.center); 52 | 53 | } 54 | 55 | /** 56 | * 底部按钮点击监听器 57 | */ 58 | private void onBottomBarClick() { 59 | 60 | mFirst_bottom.setOnClickListener(new OnClickListener() { 61 | @Override 62 | public void onClick(View v) { 63 | if (mOnBottonbarClick != null) { 64 | mOnBottonbarClick.onFirstClick(); 65 | } 66 | } 67 | }); 68 | mSecond_bottom.setOnClickListener(new OnClickListener() { 69 | @Override 70 | public void onClick(View v) { 71 | if (mOnBottonbarClick != null) { 72 | mOnBottonbarClick.onSecondClick(); 73 | } 74 | } 75 | }); 76 | mThird_bottom.setOnClickListener(new OnClickListener() { 77 | @Override 78 | public void onClick(View v) { 79 | if (mOnBottonbarClick != null) { 80 | mOnBottonbarClick.onThirdClick(); 81 | } 82 | } 83 | }); 84 | mFouth_bottom.setOnClickListener(new OnClickListener() { 85 | @Override 86 | public void onClick(View v) { 87 | if (mOnBottonbarClick != null) { 88 | mOnBottonbarClick.onFouthClick(); 89 | } 90 | } 91 | }); 92 | mCenter_bottom.setOnClickListener(new OnClickListener() { 93 | @Override 94 | public void onClick(View v) { 95 | if (mOnBottonbarClick != null) { 96 | mOnBottonbarClick.onCenterClick(); 97 | } 98 | } 99 | }); 100 | 101 | } 102 | public void setOnBottombarOnclick(OnBottonbarClick onBottonbarClick) { 103 | 104 | mOnBottonbarClick = onBottonbarClick; 105 | } 106 | 107 | public interface OnBottonbarClick { 108 | void onFirstClick(); 109 | 110 | void onSecondClick(); 111 | 112 | void onThirdClick(); 113 | 114 | void onFouthClick(); 115 | 116 | void onCenterClick(); 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /app/src/main/java/com/lichenglin/easyapp/ui/MainFragment.java: -------------------------------------------------------------------------------- 1 | package com.lichenglin.easyapp.ui;/** 2 | * Created by dell on 2017/4/5/0005. 3 | */ 4 | 5 | import android.os.Bundle; 6 | import android.support.annotation.Nullable; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | import android.widget.ImageView; 11 | 12 | import com.lichenglin.easyapp.R; 13 | import com.lichenglin.easyapp.base.BaseFragment; 14 | import com.lichenglin.easyapp.ui.view.BottomBar; 15 | import com.lichenglin.easyapp.ui.view.PopupMenuUtil; 16 | import com.lichenglin.easyapp.utils.StartBrotherEvent; 17 | 18 | import org.greenrobot.eventbus.EventBus; 19 | import org.greenrobot.eventbus.Subscribe; 20 | 21 | import me.yokeyword.fragmentation.SupportFragment; 22 | 23 | /** 24 | * created by LiChengalin at 2017/4/5/0005 25 | */ 26 | public class MainFragment extends BaseFragment { 27 | 28 | private static final int FIRST = 0; 29 | private static final int SECOND = 1; 30 | private static final int THIRD = 2; 31 | private static final int FOURTH = 3; 32 | private BottomBar mBottomBar; 33 | private ImageView mCenterImage; 34 | private SupportFragment[] mFragments = new SupportFragment[5]; 35 | 36 | private int mSelectPosition,mCurrentPosition=0; 37 | 38 | public static MainFragment newInstance() { 39 | 40 | Bundle bundle = new Bundle(); 41 | 42 | MainFragment fragment = new MainFragment(); 43 | fragment.setArguments(bundle); 44 | return fragment; 45 | } 46 | 47 | @Nullable 48 | @Override 49 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 50 | View view = inflater.inflate(R.layout.fragment_main, container, false); 51 | 52 | mCenterImage = (ImageView) view.findViewById (R.id.center_img); 53 | if (savedInstanceState == null) { 54 | mFragments[FIRST] = FirstFragment.newInstance(); 55 | mFragments[SECOND] = SecondFragment.newInstance(); 56 | mFragments[THIRD] = ThirdFragment.newInstance(); 57 | mFragments[FOURTH] = FouthFragment.newInstance(); 58 | loadMultipleRootFragment(R.id.fl_tab_container, FIRST, 59 | mFragments[FIRST], 60 | mFragments[SECOND], 61 | mFragments[THIRD], mFragments[FOURTH]); 62 | } else { 63 | // 这里库已经做了Fragment恢复,所有不需要额外的处理了, 不会出现重叠问题 64 | // 这里我们需要拿到mFragments的引用,也可以通过getChildFragmentManager.getFragments()自行进行判断查找(效率更高些),用下面的方法查找更方便些 65 | mFragments[FIRST] = findChildFragment(FirstFragment.class); 66 | mFragments[SECOND] = findChildFragment(SecondFragment.class); 67 | mFragments[THIRD] = findChildFragment(ThirdFragment.class); 68 | mFragments[FOURTH] = findChildFragment(FouthFragment.class); 69 | } 70 | //注册 71 | EventBus.getDefault().register(this); 72 | initView(view); 73 | return view; 74 | 75 | } 76 | 77 | private void initView(final View view) { 78 | 79 | mBottomBar = (BottomBar) view.findViewById(R.id.bottomBar); 80 | 81 | mBottomBar.setOnBottombarOnclick(new BottomBar.OnBottonbarClick() { 82 | @Override 83 | public void onFirstClick() { 84 | mSelectPosition = 0; 85 | showHideFragment(mFragments[mSelectPosition], mFragments[mCurrentPosition]); 86 | mCurrentPosition = 0; 87 | } 88 | 89 | @Override 90 | public void onSecondClick() { 91 | mSelectPosition = 1; 92 | showHideFragment(mFragments[mSelectPosition], mFragments[mCurrentPosition]); 93 | mCurrentPosition = 1; 94 | } 95 | 96 | @Override 97 | public void onThirdClick() { 98 | mSelectPosition = 2; 99 | showHideFragment(mFragments[mSelectPosition], mFragments[mCurrentPosition]); 100 | mCurrentPosition = 2; 101 | } 102 | 103 | @Override 104 | public void onFouthClick() { 105 | mSelectPosition = 3; 106 | showHideFragment(mFragments[mSelectPosition], mFragments[mCurrentPosition]); 107 | mCurrentPosition = 3; 108 | } 109 | 110 | @Override 111 | public void onCenterClick() { 112 | PopupMenuUtil.getInstance()._show(getContext(), mCenterImage); 113 | } 114 | 115 | 116 | }); 117 | 118 | } 119 | /** 120 | * start other BrotherFragment 121 | */ 122 | @Subscribe 123 | public void startBrother(StartBrotherEvent event) { 124 | start(event.targetFragment); 125 | } 126 | @Override 127 | public void onDestroy() { 128 | super.onDestroy(); 129 | EventBus.getDefault().unregister(this); 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_bottom.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 14 | 15 | 20 | 21 | 28 | 29 | 37 | 38 | 39 | 45 | 46 | 53 | 54 | 62 | 63 | 64 | 68 | 69 | 75 | 76 | 82 | 83 | 90 | 91 | 92 | 97 | 98 | 104 | 105 | 112 | 113 | 114 | 115 | 121 | 122 | 128 | 129 | 135 | 136 | 142 | 143 | 144 | 151 | 152 | 153 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | Abstraction issuesJava 39 | 40 | 41 | Android > Lint > Correctness 42 | 43 | 44 | Android > Lint > Correctness > Messages 45 | 46 | 47 | Android > Lint > Internationalization 48 | 49 | 50 | Android > Lint > Performance 51 | 52 | 53 | Android > Lint > Security 54 | 55 | 56 | Android > Lint > Usability 57 | 58 | 59 | Android > Lint > Usability > Typography 60 | 61 | 62 | Class metricsJava 63 | 64 | 65 | Control FlowGroovy 66 | 67 | 68 | Control flow issuesJava 69 | 70 | 71 | Declaration redundancyJava 72 | 73 | 74 | Dependency issuesJava 75 | 76 | 77 | Error handlingJava 78 | 79 | 80 | General 81 | 82 | 83 | Groovy 84 | 85 | 86 | J2ME issuesJava 87 | 88 | 89 | Java 90 | 91 | 92 | Java language level issuesJava 93 | 94 | 95 | Java language level migration aidsJava 96 | 97 | 98 | Logging issuesJava 99 | 100 | 101 | Manifest 102 | 103 | 104 | Method MetricsGroovy 105 | 106 | 107 | Method metricsJava 108 | 109 | 110 | Modularization issuesJava 111 | 112 | 113 | Naming conventionsJava 114 | 115 | 116 | Numeric issuesJava 117 | 118 | 119 | Packaging issuesJava 120 | 121 | 122 | Portability issuesJava 123 | 124 | 125 | Potentially confusing code constructsGroovy 126 | 127 | 128 | Probable bugsJava 129 | 130 | 131 | Properties Files 132 | 133 | 134 | Security issuesJava 135 | 136 | 137 | Threading issuesGroovy 138 | 139 | 140 | Threading issuesJava 141 | 142 | 143 | Visibility issuesJava 144 | 145 | 146 | 147 | 148 | Android 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 170 | 171 | 172 | 173 | 174 | 175 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 191 | 192 | 193 | 194 | 195 | 196 | -------------------------------------------------------------------------------- /app/src/main/java/com/lichenglin/easyapp/ui/view/PopupMenuUtil.java: -------------------------------------------------------------------------------- 1 | package com.lichenglin.easyapp.ui.view; 2 | 3 | import android.animation.ObjectAnimator; 4 | import android.content.Context; 5 | import android.graphics.drawable.BitmapDrawable; 6 | import android.view.Gravity; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.widget.ImageView; 10 | import android.widget.LinearLayout; 11 | import android.widget.PopupWindow; 12 | import android.widget.RelativeLayout; 13 | import android.widget.Toast; 14 | 15 | import com.lichenglin.easyapp.R; 16 | 17 | /** 18 | * Created by mj 19 | * on 2016/10/28. 20 | */ 21 | public class PopupMenuUtil { 22 | 23 | private static final String TAG = "PopupMenuUtil"; 24 | 25 | public static PopupMenuUtil getInstance() { 26 | return MenuUtilHolder.INSTANCE; 27 | } 28 | 29 | private static class MenuUtilHolder { 30 | public static PopupMenuUtil INSTANCE = new PopupMenuUtil(); 31 | } 32 | 33 | private View rootVew; 34 | private PopupWindow popupWindow; 35 | 36 | private RelativeLayout rlClick; 37 | private ImageView ivBtn; 38 | private LinearLayout llTest1, llTest2, llTest3, llTest4, llTest5, llTest6, llTest7, llTest8; 39 | 40 | /** 41 | * 动画执行的 属性值数组 42 | */ 43 | float animatorProperty[] = null; 44 | /** 45 | * 第一排图 距离屏幕底部的距离 46 | */ 47 | int top = 0; 48 | /** 49 | * 第二排图 距离屏幕底部的距离 50 | */ 51 | int bottom = 0; 52 | 53 | /** 54 | * 创建 popupWindow 内容 55 | * 56 | * @param context context 57 | */ 58 | private void _createView(final Context context) { 59 | rootVew = LayoutInflater.from(context).inflate(R.layout.popup_menu, null); 60 | popupWindow = new PopupWindow(rootVew, 61 | LinearLayout.LayoutParams.MATCH_PARENT, 62 | LinearLayout.LayoutParams.MATCH_PARENT); 63 | //设置为失去焦点 方便监听返回键的监听 64 | popupWindow.setFocusable(false); 65 | 66 | // 如果想要popupWindow 遮挡住状态栏可以加上这句代码 67 | //popupWindow.setClippingEnabled(false); 68 | popupWindow.setBackgroundDrawable(new BitmapDrawable()); 69 | popupWindow.setOutsideTouchable(false); 70 | 71 | if (animatorProperty == null) { 72 | top = dip2px(context, 310); 73 | bottom = dip2px(context, 210); 74 | animatorProperty = new float[]{bottom, 60, -30, -20 - 10, 0}; 75 | } 76 | 77 | initLayout(context); 78 | } 79 | 80 | /** 81 | * dp转化为px 82 | * 83 | * @param context context 84 | * @param dipValue dp value 85 | * @return 转换之后的px值 86 | */ 87 | public static int dip2px(Context context, float dipValue) { 88 | final float scale = context.getResources().getDisplayMetrics().density; 89 | return (int) (dipValue * scale + 0.5f); 90 | } 91 | 92 | /** 93 | * 初始化 view 94 | */ 95 | private void initLayout(Context context) { 96 | rlClick = (RelativeLayout) rootVew.findViewById(R.id.pop_rl_click); 97 | ivBtn = (ImageView) rootVew.findViewById(R.id.pop_iv_img); 98 | llTest1 = (LinearLayout) rootVew.findViewById(R.id.test1); 99 | llTest2 = (LinearLayout) rootVew.findViewById(R.id.test2); 100 | llTest3 = (LinearLayout) rootVew.findViewById(R.id.test3); 101 | llTest4 = (LinearLayout) rootVew.findViewById(R.id.test4); 102 | llTest5 = (LinearLayout) rootVew.findViewById(R.id.test5); 103 | llTest6 = (LinearLayout) rootVew.findViewById(R.id.test6); 104 | llTest7 = (LinearLayout) rootVew.findViewById(R.id.test7); 105 | llTest8 = (LinearLayout) rootVew.findViewById(R.id.test8); 106 | 107 | rlClick.setOnClickListener(new MViewClick(0, context)); 108 | 109 | llTest1.setOnClickListener(new MViewClick(1, context)); 110 | llTest2.setOnClickListener(new MViewClick(2, context)); 111 | llTest3.setOnClickListener(new MViewClick(3, context)); 112 | llTest4.setOnClickListener(new MViewClick(4, context)); 113 | llTest5.setOnClickListener(new MViewClick(5, context)); 114 | llTest6.setOnClickListener(new MViewClick(6, context)); 115 | llTest7.setOnClickListener(new MViewClick(7, context)); 116 | llTest8.setOnClickListener(new MViewClick(8, context)); 117 | 118 | } 119 | 120 | /** 121 | * 点击事件 122 | */ 123 | private class MViewClick implements View.OnClickListener { 124 | 125 | public int index; 126 | public Context context; 127 | 128 | public MViewClick(int index, Context context) { 129 | this.index = index; 130 | this.context = context; 131 | } 132 | 133 | @Override 134 | public void onClick(View v) { 135 | if (index == 0) { 136 | //加号按钮点击之后的执行 137 | _rlClickAction(); 138 | } else { 139 | showToast(context, "index=" + index); 140 | } 141 | } 142 | } 143 | 144 | Toast toast = null; 145 | 146 | /** 147 | * 防止toast 多次被创建 148 | * 149 | * @param context context 150 | * @param str str 151 | */ 152 | private void showToast(Context context, String str) { 153 | if (toast == null) { 154 | toast = Toast.makeText(context, str, Toast.LENGTH_SHORT); 155 | } else { 156 | toast.setText(str); 157 | } 158 | toast.show(); 159 | } 160 | 161 | /** 162 | * 刚打开popupWindow 执行的动画 163 | */ 164 | private void _openPopupWindowAction() { 165 | ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(ivBtn, "rotation", 0f, 135f); 166 | objectAnimator.setDuration(200); 167 | objectAnimator.start(); 168 | 169 | _startAnimation(llTest1, 500, animatorProperty); 170 | _startAnimation(llTest2, 430, animatorProperty); 171 | _startAnimation(llTest3, 430, animatorProperty); 172 | _startAnimation(llTest4, 500, animatorProperty); 173 | 174 | _startAnimation(llTest5, 500, animatorProperty); 175 | _startAnimation(llTest6, 430, animatorProperty); 176 | _startAnimation(llTest7, 430, animatorProperty); 177 | _startAnimation(llTest8, 500, animatorProperty); 178 | } 179 | 180 | 181 | /** 182 | * 关闭 popupWindow执行的动画 183 | */ 184 | public void _rlClickAction() { 185 | if (ivBtn != null && rlClick != null) { 186 | 187 | ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(ivBtn, "rotation", 135f, 0f); 188 | objectAnimator.setDuration(300); 189 | objectAnimator.start(); 190 | 191 | _closeAnimation(llTest1, 300, top); 192 | _closeAnimation(llTest2, 200, top); 193 | _closeAnimation(llTest3, 200, top); 194 | _closeAnimation(llTest4, 300, top); 195 | _closeAnimation(llTest5, 300, bottom); 196 | _closeAnimation(llTest6, 200, bottom); 197 | _closeAnimation(llTest7, 200, bottom); 198 | _closeAnimation(llTest8, 300, bottom); 199 | 200 | rlClick.postDelayed(new Runnable() { 201 | @Override 202 | public void run() { 203 | _close(); 204 | } 205 | }, 300); 206 | 207 | } 208 | } 209 | 210 | 211 | /** 212 | * 弹起 popupWindow 213 | * 214 | * @param context context 215 | * @param parent parent 216 | */ 217 | public void _show(Context context, View parent) { 218 | _createView(context); 219 | if (popupWindow != null && !popupWindow.isShowing()) { 220 | popupWindow.showAtLocation(parent, Gravity.NO_GRAVITY, 0, 0); 221 | _openPopupWindowAction(); 222 | } 223 | } 224 | 225 | /** 226 | * 关闭popupWindow 227 | */ 228 | 229 | public void _close() { 230 | if (popupWindow != null && popupWindow.isShowing()) { 231 | popupWindow.dismiss(); 232 | popupWindow = null; 233 | } 234 | } 235 | 236 | /** 237 | * @return popupWindow 是否显示了 238 | */ 239 | public boolean _isShowing() { 240 | if (popupWindow == null) { 241 | return false; 242 | } else { 243 | return popupWindow.isShowing(); 244 | } 245 | } 246 | 247 | /** 248 | * 关闭 popupWindow 时的动画 249 | * 250 | * @param view mView 251 | * @param duration 动画执行时长 252 | * @param next 平移量 253 | */ 254 | private void _closeAnimation(View view, int duration, int next) { 255 | ObjectAnimator anim = ObjectAnimator.ofFloat(view, "translationY", 0f, next); 256 | anim.setDuration(duration); 257 | anim.start(); 258 | } 259 | 260 | /** 261 | * 启动动画 262 | * 263 | * @param view view 264 | * @param duration 执行时长 265 | * @param distance 执行的轨迹数组 266 | */ 267 | private void _startAnimation(View view, int duration, float[] distance) { 268 | ObjectAnimator anim = ObjectAnimator.ofFloat(view, "translationY", distance); 269 | anim.setDuration(duration); 270 | anim.start(); 271 | } 272 | 273 | 274 | } 275 | -------------------------------------------------------------------------------- /app/src/main/res/layout/popup_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 16 | 17 | 25 | 26 | 30 | 31 | 38 | 39 | 40 | 48 | 49 | 50 | 54 | 55 | 62 | 63 | 64 | 72 | 73 | 74 | 78 | 79 | 86 | 87 | 88 | 96 | 97 | 101 | 102 | 109 | 110 | 111 | 112 | 113 | 114 | 121 | 122 | 130 | 131 | 135 | 136 | 143 | 144 | 145 | 153 | 154 | 155 | 159 | 160 | 167 | 168 | 169 | 177 | 178 | 179 | 183 | 184 | 191 | 192 | 193 | 201 | 202 | 206 | 207 | 214 | 215 | 216 | 217 | 218 | 219 | 227 | 228 | 233 | 234 | 240 | 241 | 242 | -------------------------------------------------------------------------------- /app/app.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | --------------------------------------------------------------------------------