├── .idea ├── .name ├── vcs.xml └── gradle.xml ├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── drawable-xhdpi │ │ │ │ ├── icon_add.png │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── icon_arrow_right.png │ │ │ │ ├── icon_header_back.png │ │ │ │ ├── icon_header_pause.png │ │ │ │ ├── icon_header_play.png │ │ │ │ └── divider_headerbar_bottom.9.png │ │ │ ├── drawable-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable-ldpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values │ │ │ │ ├── colorsl.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── arrays.xml │ │ │ │ ├── styles.xml │ │ │ │ └── strings.xml │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ └── layout │ │ │ │ ├── activity_ltab.xml │ │ │ │ ├── activity_lpreference.xml │ │ │ │ ├── activity_ldialog.xml │ │ │ │ ├── activity_limagebutton.xml │ │ │ │ ├── activity_lbutton.xml │ │ │ │ ├── activity_lframelayout.xml │ │ │ │ └── activity_main.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── lion │ │ │ │ └── demo │ │ │ │ └── material │ │ │ │ ├── activity │ │ │ │ ├── BaseActivity.java │ │ │ │ ├── LTabActivity.java │ │ │ │ ├── LPreferenceActivity.java │ │ │ │ ├── LImageButtonActivity.java │ │ │ │ ├── LButtonActivity.java │ │ │ │ ├── LFrameLayoutActivity.java │ │ │ │ ├── LDialogActivity.java │ │ │ │ └── MainActivity.java │ │ │ │ └── tab │ │ │ │ ├── TabPagerAdapter.java │ │ │ │ └── TabFragment.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── lion │ │ │ └── material │ │ │ └── demo │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── lion │ │ └── material │ │ └── demo │ │ └── ApplicationTest.java ├── proguard-rules.pro └── build.gradle ├── material ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── dimens_material.xml │ │ │ │ ├── colors_material.xml │ │ │ │ └── attrs_material.xml │ │ │ ├── drawable-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── icon_dialog_close.png │ │ │ │ ├── icon_dialog_list_checked.png │ │ │ │ └── headerbar_bottom_divider.9.png │ │ │ ├── drawable-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable │ │ │ │ ├── material_dialog_bg.9.png │ │ │ │ └── material_selector_dialog_list_checkbox.xml │ │ │ ├── color │ │ │ │ ├── selecter_preference_summary.xml │ │ │ │ └── selecter_settings_item_text.xml │ │ │ └── layout │ │ │ │ ├── material_dialog_listview.xml │ │ │ │ ├── material_dialog_listview_adapter.xml │ │ │ │ ├── preference_normal.xml │ │ │ │ ├── preference_checkbox.xml │ │ │ │ └── material_alert_dialog.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── lion │ │ │ │ └── material │ │ │ │ ├── extra │ │ │ │ ├── LItemClickListener.java │ │ │ │ ├── IMaterial.java │ │ │ │ └── MaterialStyle.java │ │ │ │ ├── dialog │ │ │ │ ├── LDialogLayout.java │ │ │ │ ├── LDialogListBuilder.java │ │ │ │ ├── LAlertDialog.java │ │ │ │ └── LDialogController.java │ │ │ │ └── widget │ │ │ │ ├── PreferenceNormal.java │ │ │ │ ├── LDrawerButton.java │ │ │ │ ├── PreferenceCheckBox.java │ │ │ │ ├── LButton.java │ │ │ │ ├── LImageButton.java │ │ │ │ ├── LFrameLayout.java │ │ │ │ ├── LLinearLayout.java │ │ │ │ ├── LTabIndicator.java │ │ │ │ └── LSwitch.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── lion │ │ │ └── material │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── lion │ │ └── material │ │ └── ApplicationTest.java ├── build.gradle └── proguard-rules.pro ├── settings.gradle ├── Preview Gif ├── main.gif ├── button.gif └── checkbox.gif ├── Photo_locker_release_1.5.2.apk ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── .gitattributes ├── gradle.properties ├── gradlew.bat ├── README.md └── gradlew /.idea/.name: -------------------------------------------------------------------------------- 1 | MaterialWidget -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /material/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':material' 2 | -------------------------------------------------------------------------------- /Preview Gif/main.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cshxql/MaterialWidget/HEAD/Preview Gif/main.gif -------------------------------------------------------------------------------- /Preview Gif/button.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cshxql/MaterialWidget/HEAD/Preview Gif/button.gif -------------------------------------------------------------------------------- /Preview Gif/checkbox.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cshxql/MaterialWidget/HEAD/Preview Gif/checkbox.gif -------------------------------------------------------------------------------- /Photo_locker_release_1.5.2.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cshxql/MaterialWidget/HEAD/Photo_locker_release_1.5.2.apk -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cshxql/MaterialWidget/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /material/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | MaterialLib 4 | 5 | 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/icon_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cshxql/MaterialWidget/HEAD/app/src/main/res/drawable-xhdpi/icon_add.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cshxql/MaterialWidget/HEAD/app/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cshxql/MaterialWidget/HEAD/app/src/main/res/drawable-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cshxql/MaterialWidget/HEAD/app/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cshxql/MaterialWidget/HEAD/app/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cshxql/MaterialWidget/HEAD/app/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cshxql/MaterialWidget/HEAD/app/src/main/res/drawable-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/icon_arrow_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cshxql/MaterialWidget/HEAD/app/src/main/res/drawable-xhdpi/icon_arrow_right.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/icon_header_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cshxql/MaterialWidget/HEAD/app/src/main/res/drawable-xhdpi/icon_header_back.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/icon_header_pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cshxql/MaterialWidget/HEAD/app/src/main/res/drawable-xhdpi/icon_header_pause.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/icon_header_play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cshxql/MaterialWidget/HEAD/app/src/main/res/drawable-xhdpi/icon_header_play.png -------------------------------------------------------------------------------- /material/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cshxql/MaterialWidget/HEAD/material/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /material/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cshxql/MaterialWidget/HEAD/material/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /material/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cshxql/MaterialWidget/HEAD/material/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /material/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cshxql/MaterialWidget/HEAD/material/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /material/src/main/res/drawable/material_dialog_bg.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cshxql/MaterialWidget/HEAD/material/src/main/res/drawable/material_dialog_bg.9.png -------------------------------------------------------------------------------- /material/src/main/res/drawable-xhdpi/icon_dialog_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cshxql/MaterialWidget/HEAD/material/src/main/res/drawable-xhdpi/icon_dialog_close.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/divider_headerbar_bottom.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cshxql/MaterialWidget/HEAD/app/src/main/res/drawable-xhdpi/divider_headerbar_bottom.9.png -------------------------------------------------------------------------------- /material/src/main/res/drawable-xhdpi/icon_dialog_list_checked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cshxql/MaterialWidget/HEAD/material/src/main/res/drawable-xhdpi/icon_dialog_list_checked.png -------------------------------------------------------------------------------- /material/src/main/res/drawable-xhdpi/headerbar_bottom_divider.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cshxql/MaterialWidget/HEAD/material/src/main/res/drawable-xhdpi/headerbar_bottom_divider.9.png -------------------------------------------------------------------------------- /app/src/main/res/values/colorsl.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #de000000 4 | #8a000000 5 | #607d8b 6 | 7 | 8 | -------------------------------------------------------------------------------- /material/src/main/java/com/lion/material/extra/LItemClickListener.java: -------------------------------------------------------------------------------- 1 | package com.lion.material.extra; 2 | 3 | /** 4 | * Created by Lion on 2015/11/10. 5 | */ 6 | public interface LItemClickListener { 7 | void onItemClickListener(Object object); 8 | } 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/arrays.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | One 6 | Two 7 | Three 8 | 9 | 10 | -------------------------------------------------------------------------------- /material/src/main/java/com/lion/material/extra/IMaterial.java: -------------------------------------------------------------------------------- 1 | package com.lion.material.extra; 2 | 3 | public interface IMaterial { 4 | public void perfirmSuperClick(); 5 | 6 | public void setColor(int fullColor); 7 | 8 | public void setType(int widgetType); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /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.10-all.zip 7 | -------------------------------------------------------------------------------- /material/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /material/src/main/res/color/selecter_preference_summary.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /material/src/main/res/color/selecter_settings_item_text.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /material/src/main/res/drawable/material_selector_dialog_list_checkbox.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /material/src/main/res/values/dimens_material.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 56dp 4 | 56dp 5 | 15sp 6 | 7 | 70dp 8 | 42dp 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /material/src/test/java/com/lion/material/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.lion.material; 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 | } -------------------------------------------------------------------------------- /app/src/test/java/com/lion/material/demo/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.lion.material.demo; 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 | } -------------------------------------------------------------------------------- /material/src/androidTest/java/com/lion/material/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.lion.material; 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 | } -------------------------------------------------------------------------------- /app/src/androidTest/java/com/lion/material/demo/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.lion.material.demo; 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 | } -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /material/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.3" 6 | 7 | defaultConfig { 8 | minSdkVersion 14 9 | targetSdkVersion 23 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 fileTree(dir: 'libs', include: ['*.jar']) 23 | testCompile 'junit:junit:4.12' 24 | compile 'com.android.support:appcompat-v7:23.4.0' 25 | } 26 | -------------------------------------------------------------------------------- /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 E:\development\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 | -------------------------------------------------------------------------------- /material/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:\development\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.3" 6 | 7 | defaultConfig { 8 | applicationId "com.lion.demo.material" 9 | minSdkVersion 14 10 | targetSdkVersion 23 11 | versionCode 1 12 | versionName "1.0" 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 | testCompile 'junit:junit:4.12' 25 | compile 'com.android.support:appcompat-v7:23.4.0' 26 | compile project(path: ':material') 27 | } 28 | -------------------------------------------------------------------------------- /material/src/main/res/layout/material_dialog_listview.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 13 | 14 | 22 | 23 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/lion/demo/material/activity/BaseActivity.java: -------------------------------------------------------------------------------- 1 | package com.lion.demo.material.activity; 2 | 3 | import android.content.Context; 4 | import android.content.pm.ActivityInfo; 5 | import android.os.Bundle; 6 | import android.support.v4.app.FragmentActivity; 7 | import android.view.Window; 8 | 9 | public class BaseActivity extends FragmentActivity { 10 | protected Context mContext; 11 | 12 | @Override 13 | protected void onCreate(Bundle savedInstanceState) { 14 | final int orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; 15 | if (getRequestedOrientation() != orientation) { 16 | setRequestedOrientation(orientation); 17 | } 18 | requestWindowFeature(Window.FEATURE_NO_TITLE); 19 | super.onCreate(savedInstanceState); 20 | mContext = this; 21 | } 22 | 23 | private boolean mCalled = false; 24 | 25 | @Override 26 | public void setRequestedOrientation(int requestedOrientation) { 27 | if (!mCalled) { 28 | super.setRequestedOrientation(requestedOrientation); 29 | mCalled = true; 30 | } 31 | } 32 | 33 | 34 | } 35 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/lion/demo/material/tab/TabPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.lion.demo.material.tab; 2 | 3 | import android.content.Context; 4 | import android.support.v4.app.Fragment; 5 | import android.support.v4.app.FragmentManager; 6 | import android.support.v4.app.FragmentPagerAdapter; 7 | 8 | import com.lion.demo.material.R; 9 | 10 | 11 | public class TabPagerAdapter extends FragmentPagerAdapter { 12 | private String[] mTitles; 13 | private final String[] mContent = new String[] { "One", "Two", "Three" }; 14 | 15 | private Context mContext; 16 | 17 | public TabPagerAdapter(Context context, FragmentManager fm) { 18 | super(fm); 19 | this.mContext = context; 20 | mTitles = mContext.getResources().getStringArray(R.array.title); 21 | } 22 | 23 | @Override 24 | public Fragment getItem(int position) { 25 | return TabFragment.newInstance(mContent[position % mContent.length]); 26 | } 27 | 28 | @Override 29 | public CharSequence getPageTitle(int position) { 30 | return mTitles[position]; 31 | } 32 | 33 | @Override 34 | public int getCount() { 35 | return mTitles.length; 36 | } 37 | } -------------------------------------------------------------------------------- /material/src/main/res/values/colors_material.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #00000000 4 | 5 | #FF9800 6 | #09314B 7 | #5A7384 8 | 9 | 10 | 12 | #1d311b92 13 | #de000000 14 | #8a000000 15 | #30000000 16 | #30ffffff 17 | #dcdcdc 18 | #3d000000 19 | #de000000 20 | #8a000000 21 | #de000000 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/lion/demo/material/activity/LTabActivity.java: -------------------------------------------------------------------------------- 1 | package com.lion.demo.material.activity; 2 | 3 | import android.os.Bundle; 4 | import android.support.v4.view.ViewPager; 5 | import android.view.View; 6 | import android.view.View.OnClickListener; 7 | 8 | import com.lion.demo.material.R; 9 | import com.lion.demo.material.tab.TabPagerAdapter; 10 | import com.lion.material.widget.LTabIndicator; 11 | 12 | 13 | public class LTabActivity extends BaseActivity { 14 | private LTabIndicator lineTabIndicator; 15 | private ViewPager viewPager; 16 | 17 | @Override 18 | protected void onCreate(Bundle bundle) { 19 | super.onCreate(bundle); 20 | setContentView(R.layout.activity_ltab); 21 | findViews(); 22 | } 23 | 24 | private void findViews() { 25 | findViewById(R.id.header_left).setOnClickListener( 26 | new OnClickListener() { 27 | 28 | @Override 29 | public void onClick(View v) { 30 | finish(); 31 | } 32 | }); 33 | lineTabIndicator = (LTabIndicator) findViewById(R.id.tab_indicator); 34 | viewPager = (ViewPager) findViewById(R.id.view_pager); 35 | viewPager.setAdapter(new TabPagerAdapter(this, 36 | getSupportFragmentManager())); 37 | lineTabIndicator.setViewPager(viewPager); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /material/src/main/res/layout/material_dialog_listview_adapter.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 21 | 22 | 30 | 31 | -------------------------------------------------------------------------------- /material/src/main/java/com/lion/material/dialog/LDialogLayout.java: -------------------------------------------------------------------------------- 1 | package com.lion.material.dialog; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.util.DisplayMetrics; 6 | import android.widget.LinearLayout; 7 | 8 | import static android.view.View.MeasureSpec.EXACTLY; 9 | 10 | public class LDialogLayout extends LinearLayout { 11 | private float mMaxWidthWeight = 0.9f; 12 | private float mMinWidthWeight = 0.55f; 13 | // private float mMaxHeightWeight = 0.8f; 14 | private DisplayMetrics metrics; 15 | 16 | public LDialogLayout(Context context) { 17 | super(context); 18 | } 19 | 20 | public LDialogLayout(Context context, AttributeSet attrs) { 21 | super(context, attrs); 22 | metrics = getContext().getResources().getDisplayMetrics(); 23 | } 24 | 25 | @Override 26 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 27 | 28 | float widthWeight = metrics.widthPixels < metrics.heightPixels ? mMaxWidthWeight 29 | : mMinWidthWeight; 30 | widthMeasureSpec = MeasureSpec.makeMeasureSpec( 31 | (int) (metrics.widthPixels * widthWeight), EXACTLY); 32 | 33 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 34 | // if (getMeasuredHeight() > metrics.heightPixels * mMaxHeightWeight) { 35 | // super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec( 36 | // (int) (metrics.heightPixels * mMaxHeightWeight), EXACTLY)); 37 | // } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /material/src/main/res/values/attrs_material.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 31 | 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/lion/demo/material/tab/TabFragment.java: -------------------------------------------------------------------------------- 1 | package com.lion.demo.material.tab; 2 | 3 | import android.os.Bundle; 4 | import android.support.v4.app.Fragment; 5 | import android.view.Gravity; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.LinearLayout; 10 | import android.widget.LinearLayout.LayoutParams; 11 | import android.widget.TextView; 12 | 13 | public class TabFragment extends Fragment { 14 | private static final String KEY_CONTENT = "MyContent"; 15 | 16 | public static TabFragment newInstance(String content) { 17 | TabFragment fragment = new TabFragment(); 18 | fragment.mContent = content; 19 | return fragment; 20 | } 21 | 22 | private String mContent = "One"; 23 | 24 | @Override 25 | public void onCreate(Bundle savedInstanceState) { 26 | super.onCreate(savedInstanceState); 27 | 28 | if ((savedInstanceState != null) 29 | && savedInstanceState.containsKey(KEY_CONTENT)) { 30 | mContent = savedInstanceState.getString(KEY_CONTENT); 31 | } 32 | } 33 | 34 | @Override 35 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 36 | Bundle savedInstanceState) { 37 | TextView text = new TextView(getActivity()); 38 | text.setGravity(Gravity.CENTER); 39 | text.setText(mContent); 40 | text.setTextSize(20 * getResources().getDisplayMetrics().density); 41 | text.setPadding(20, 20, 20, 20); 42 | 43 | LinearLayout layout = new LinearLayout(getActivity()); 44 | layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, 45 | LayoutParams.MATCH_PARENT)); 46 | layout.setGravity(Gravity.CENTER); 47 | layout.addView(text); 48 | 49 | return layout; 50 | } 51 | 52 | @Override 53 | public void onSaveInstanceState(Bundle outState) { 54 | super.onSaveInstanceState(outState); 55 | outState.putString(KEY_CONTENT, mContent); 56 | } 57 | } -------------------------------------------------------------------------------- /app/src/main/java/com/lion/demo/material/activity/LPreferenceActivity.java: -------------------------------------------------------------------------------- 1 | package com.lion.demo.material.activity; 2 | 3 | import android.os.Bundle; 4 | import android.view.View; 5 | import android.view.View.OnClickListener; 6 | import android.widget.Toast; 7 | 8 | import com.lion.demo.material.R; 9 | import com.lion.material.widget.PreferenceCheckBox; 10 | import com.lion.material.widget.PreferenceNormal; 11 | 12 | 13 | public class LPreferenceActivity extends BaseActivity implements 14 | OnClickListener { 15 | private PreferenceCheckBox mPreferenceCheckBox; 16 | private PreferenceNormal mPreferenceNormal; 17 | 18 | @Override 19 | protected void onCreate(Bundle savedInstanceState) { 20 | super.onCreate(savedInstanceState); 21 | setContentView(R.layout.activity_lpreference); 22 | initView(); 23 | } 24 | 25 | private void initView() { 26 | findViewById(R.id.header_left).setOnClickListener(this); 27 | mPreferenceCheckBox = (PreferenceCheckBox) findViewById(R.id.lpreference_checkbox); 28 | mPreferenceCheckBox 29 | .setOnCheckedChangeListener(new PreferenceCheckBox.OnLPreferenceSwitchListener() { 30 | 31 | @Override 32 | public void onLCheckedChanged(View v, boolean isChecked) { 33 | // Toast.makeText(mContext, "checked-->" + isChecked, 34 | // Toast.LENGTH_SHORT).show(); 35 | mPreferenceCheckBox.setSummary("status:" + isChecked); 36 | } 37 | }); 38 | mPreferenceNormal = (PreferenceNormal) findViewById(R.id.lpreference_normal); 39 | mPreferenceNormal.setOnClickListener(this); 40 | } 41 | 42 | @Override 43 | public void onClick(View v) { 44 | switch (v.getId()) { 45 | case R.id.header_left: 46 | finish(); 47 | break; 48 | case R.id.lpreference_normal: 49 | Toast.makeText(mContext, R.string.lpreference_toast_normal_click, 50 | Toast.LENGTH_SHORT).show(); 51 | break; 52 | default: 53 | break; 54 | } 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_ltab.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 14 | 15 | 23 | 24 | 30 | 31 | 32 | 37 | 38 | 41 | 42 | 46 | 47 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /app/src/main/java/com/lion/demo/material/activity/LImageButtonActivity.java: -------------------------------------------------------------------------------- 1 | package com.lion.demo.material.activity; 2 | 3 | import android.os.Bundle; 4 | import android.view.View; 5 | import android.view.View.OnClickListener; 6 | import android.widget.ImageButton; 7 | import android.widget.Toast; 8 | 9 | import com.lion.demo.material.R; 10 | import com.lion.material.widget.LImageButton; 11 | 12 | public class LImageButtonActivity extends BaseActivity implements 13 | OnClickListener { 14 | private ImageButton imageButton1; 15 | private LImageButton imageButton2; 16 | private LImageButton imageButton3; 17 | private LImageButton imageButton4; 18 | 19 | // private Random mRandom = new Random(); 20 | // private int[] randomColor = new int[] { 0x1d000000, 0x1d00ff00, 21 | // 0xff00ffff, 22 | // 0xffffff00, 0x1dff0000 }; 23 | 24 | @Override 25 | protected void onCreate(Bundle savedInstanceState) { 26 | super.onCreate(savedInstanceState); 27 | setContentView(R.layout.activity_limagebutton); 28 | initView(); 29 | } 30 | 31 | private void initView() { 32 | findViewById(R.id.header_left).setOnClickListener(this); 33 | imageButton1 = (ImageButton) findViewById(R.id.imagebutton1); 34 | imageButton2 = (LImageButton) findViewById(R.id.imagebutton2); 35 | imageButton3 = (LImageButton) findViewById(R.id.imagebutton3); 36 | imageButton4 = (LImageButton) findViewById(R.id.imagebutton4); 37 | imageButton1.setOnClickListener(this); 38 | imageButton2.setOnClickListener(this); 39 | imageButton3.setOnClickListener(this); 40 | imageButton4.setOnClickListener(this); 41 | } 42 | 43 | @Override 44 | public void onClick(View v) { 45 | switch (v.getId()) { 46 | case R.id.header_left: 47 | finish(); 48 | break; 49 | case R.id.imagebutton1: 50 | Toast.makeText(mContext, R.string.limagebutton_toast_system_button, 51 | Toast.LENGTH_SHORT).show(); 52 | break; 53 | case R.id.imagebutton2: 54 | case R.id.imagebutton3: 55 | case R.id.imagebutton4: 56 | // if (v instanceof LImageButton) { 57 | // ((LImageButton) v).setColor(randomColor[mRandom 58 | // .nextInt(randomColor.length)]); 59 | // } 60 | break; 61 | default: 62 | break; 63 | } 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /app/src/main/java/com/lion/demo/material/activity/LButtonActivity.java: -------------------------------------------------------------------------------- 1 | package com.lion.demo.material.activity; 2 | 3 | import android.os.Bundle; 4 | import android.view.View; 5 | import android.view.View.OnClickListener; 6 | import android.widget.Button; 7 | import android.widget.Toast; 8 | 9 | import com.lion.demo.material.R; 10 | import com.lion.material.widget.LButton; 11 | 12 | import java.util.Random; 13 | 14 | 15 | public class LButtonActivity extends BaseActivity implements OnClickListener { 16 | private Button button1; 17 | private LButton button2; 18 | private LButton button3; 19 | private LButton button4; 20 | 21 | private Random mRandom = new Random(); 22 | private int[] randomColor = new int[] { 0x1d000000, 0x1d00ff00, 0xff00ffff, 23 | 0xffffff00, 0x1dff0000 }; 24 | 25 | @Override 26 | protected void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | setContentView(R.layout.activity_lbutton); 29 | 30 | initView(); 31 | } 32 | 33 | private void initView() { 34 | findViewById(R.id.header_left).setOnClickListener(this); 35 | button1 = (Button) findViewById(R.id.button1); 36 | button2 = (LButton) findViewById(R.id.button2); 37 | button3 = (LButton) findViewById(R.id.button3); 38 | button4 = (LButton) findViewById(R.id.button4); 39 | button1.setOnClickListener(this); 40 | button2.setOnClickListener(this); 41 | button3.setOnClickListener(this); 42 | button4.setOnClickListener(this); 43 | } 44 | 45 | @Override 46 | public void onClick(View v) { 47 | switch (v.getId()) { 48 | case R.id.header_left: 49 | finish(); 50 | break; 51 | case R.id.button1: 52 | Toast.makeText(mContext, R.string.lbutton_toast_system_button, 53 | Toast.LENGTH_SHORT).show(); 54 | break; 55 | case R.id.button2: 56 | case R.id.button3: 57 | button2.setEnabled(!button2.isEnabled()); 58 | button2.setText(button2.isEnabled() ? R.string.lbutton_enabled 59 | : R.string.lbutton_disabled); 60 | break; 61 | case R.id.button4: 62 | if (v instanceof LButton) { 63 | int fullColor = randomColor[mRandom.nextInt(randomColor.length)]; 64 | ((LButton) v).setColor(fullColor); 65 | } 66 | break; 67 | default: 68 | break; 69 | } 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | MaterialWidget 2 | ============== 3 | 4 | Materical style widget use before Android 5.0 5 | 6 | MaterialWidget is a library to provide Android5.0 Material style widget, you can use this library in sdk>=10.(actually, it should be support sdk<10, if you need,you can change the minSdkVersion to try!) 7 | 8 | This library provide some android widget but not all of them.Don't worry, you can wirte other you need widget like LButton, it's so easy! 9 | 10 | Developed By 11 | ============== 12 | Lion - cshxql@gmail.com 13 | 14 | Preview 15 | ============== 16 | ![](https://github.com/cshxql/MaterialWidget/raw/master/Preview Gif/main.gif) 17 | ![](https://github.com/cshxql/MaterialWidget/raw/master/Preview Gif/button.gif) 18 | ![](https://github.com/cshxql/MaterialWidget/raw/master/Preview Gif/checkbox.gif) 19 | 20 | 21 | Usage 22 | ============== 23 | * 1.Include library 24 | 25 | * 2.Add namespace into your xml which use MaterialWidget.
xmlns:material="http://schemas.android.com/apk/res-auto" 26 | 27 | * 3.Add widget in xml: 28 | ``` 29 | 40 | 41 | material:widget_type---some type ,you can see use in demo. default is normal. 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | material:widget_background---no explain(default is null) 50 | material:widget_animColor---the animation color, you can try it! 51 | ``` 52 | 53 | * 4.add code in Java:
`same as system widget because every Material widget is extends system widget!` 54 | ```java 55 | findViewById(R.id.header_left).setOnClickListener(this); 56 | 57 | @Override 58 | public void onClick(View v) { 59 | switch (v.getId()) { 60 | case R.id.header_left: 61 | finish(); 62 | break; 63 | default: 64 | break; 65 | } 66 | } 67 | ``` 68 | 69 | Known bug 70 | ============== 71 | * 1.Singleline has some bug but i don't know why, if you find this bug reason please tell me,TKS! 72 | * please use maxLine="1" instead of singleLine="true" 73 | 74 | 75 | -------------------------------------------------------------------------------- /material/src/main/java/com/lion/material/widget/PreferenceNormal.java: -------------------------------------------------------------------------------- 1 | package com.lion.material.widget; 2 | 3 | import android.content.Context; 4 | import android.content.res.TypedArray; 5 | import android.graphics.drawable.Drawable; 6 | import android.text.TextUtils; 7 | import android.util.AttributeSet; 8 | import android.view.View; 9 | import android.widget.TextView; 10 | 11 | import com.lion.material.R; 12 | 13 | public class PreferenceNormal extends LFrameLayout { 14 | private final String TAG = "PreferenceNormal"; 15 | private Context mContext; 16 | private TextView mTitleTextView; 17 | private TextView mSummaryTextView; 18 | private View mDividerView; 19 | 20 | public PreferenceNormal(Context context, AttributeSet attrs) { 21 | super(context, attrs); 22 | mContext = context; 23 | initView(); 24 | TypedArray a = context.obtainStyledAttributes(attrs, 25 | R.styleable.PreferenceStyle); 26 | mTitleTextView.setText(a 27 | .getString(R.styleable.PreferenceStyle_preference_title)); 28 | String summary = a 29 | .getString(R.styleable.PreferenceStyle_preference_summary); 30 | mSummaryTextView.setVisibility(TextUtils.isEmpty(summary) ? View.GONE 31 | : View.VISIBLE); 32 | mSummaryTextView.setText(summary); 33 | mDividerView 34 | .setVisibility(a.getBoolean( 35 | R.styleable.PreferenceStyle_preference_show_divider, 36 | true) ? View.VISIBLE : View.GONE); 37 | a.recycle(); 38 | } 39 | 40 | private void initView() { 41 | View.inflate(mContext, R.layout.preference_normal, this); 42 | mTitleTextView = (TextView) findViewById(R.id.preference_title); 43 | mSummaryTextView = (TextView) findViewById(R.id.preference_summary); 44 | mDividerView = findViewById(R.id.preference_divider); 45 | } 46 | 47 | @Override 48 | public void setEnabled(boolean enabled) { 49 | super.setEnabled(enabled); 50 | mTitleTextView.setEnabled(enabled); 51 | mSummaryTextView.setEnabled(enabled); 52 | } 53 | 54 | public void setSummary(int resId) { 55 | setSummary(mContext.getString(resId)); 56 | } 57 | 58 | public void setSummary(String summary) { 59 | mSummaryTextView.setVisibility(TextUtils.isEmpty(summary) ? View.GONE 60 | : View.VISIBLE); 61 | mSummaryTextView.setText(summary); 62 | } 63 | 64 | /** 65 | * 设置title右边的图片 66 | * 67 | * @param drawable 68 | */ 69 | public void setTitleRightDrawable(Drawable drawable) { 70 | mTitleTextView.setCompoundDrawablesWithIntrinsicBounds(null, null, drawable, null); 71 | } 72 | 73 | public void setTitleDrawablePadding(int padding) { 74 | mTitleTextView.setCompoundDrawablePadding(padding); 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MaterialDemo 5 | Hello world! 6 | Settings 7 | 8 | 9 | Material Style 10 | Setting 11 | 12 | 13 | Back 14 | Material Button 15 | This is a long menu 16 | System style 17 | Enabled 18 | Disabled 19 | With background color 20 | Change color dynamically 21 | This is a tall button! 22 | This is system style Button! 23 | 24 | 25 | Material ImageButton 26 | This is system style ImageButton! 27 | 28 | 29 | Material FrameLayout 30 | This is system style FrameLayout! 31 | 32 | 33 | Material Preference 34 | Checkbox 35 | status:true 36 | Normal 37 | this is normal! 38 | Click preference item! 39 | 40 | 41 | Material Drawer 42 | MenuItem One 43 | MenuItem Two 44 | MenuItem Three 45 | MenuItem Four 46 | This is right DrawerLayout 47 | 48 | Material Dialog 49 | System Dialog 50 | Normal Dialog 51 | Normal Dialog width long message 52 | List Dialog 53 | Single choice Dialog 54 | 55 | Material TabIndicator 56 | 57 | 58 | -------------------------------------------------------------------------------- /material/src/main/res/layout/preference_normal.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 14 | 15 | 20 | 21 | 27 | 28 | 36 | 37 | 42 | 43 | 53 | 54 | 55 | 56 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /app/src/main/java/com/lion/demo/material/activity/LFrameLayoutActivity.java: -------------------------------------------------------------------------------- 1 | package com.lion.demo.material.activity; 2 | 3 | import android.os.Bundle; 4 | import android.view.View; 5 | import android.view.View.OnClickListener; 6 | import android.widget.FrameLayout; 7 | import android.widget.ImageView; 8 | import android.widget.Toast; 9 | 10 | import com.lion.demo.material.R; 11 | import com.lion.material.widget.LFrameLayout; 12 | 13 | import java.util.Random; 14 | 15 | 16 | public class LFrameLayoutActivity extends BaseActivity implements 17 | OnClickListener { 18 | private FrameLayout mFrameLayout1; 19 | private LFrameLayout mFrameLayout2; 20 | private LFrameLayout mFrameLayout3; 21 | private LFrameLayout mFrameLayout4; 22 | private LFrameLayout mHeaderFrameLayout; 23 | 24 | private ImageView mPauseImageView; 25 | private ImageView mPlayImageView; 26 | 27 | private Random mRandom = new Random(); 28 | private int[] randomColor = new int[] { 0x1d000000, 0x1d00ff00, 0xff00ffff, 29 | 0xffffff00, 0x1dff0000 }; 30 | 31 | private boolean isPlaying = false; 32 | 33 | @Override 34 | protected void onCreate(Bundle savedInstanceState) { 35 | super.onCreate(savedInstanceState); 36 | setContentView(R.layout.activity_lframelayout); 37 | initView(); 38 | } 39 | 40 | private void initView() { 41 | findViewById(R.id.header_left).setOnClickListener(this); 42 | mHeaderFrameLayout = (LFrameLayout) findViewById(R.id.header_framelayout); 43 | mFrameLayout1 = (FrameLayout) findViewById(R.id.framelayout1); 44 | mFrameLayout2 = (LFrameLayout) findViewById(R.id.framelayout2); 45 | mFrameLayout3 = (LFrameLayout) findViewById(R.id.framelayout3); 46 | mFrameLayout4 = (LFrameLayout) findViewById(R.id.framelayout4); 47 | mHeaderFrameLayout.setOnClickListener(this); 48 | mFrameLayout1.setOnClickListener(this); 49 | mFrameLayout2.setOnClickListener(this); 50 | mFrameLayout3.setOnClickListener(this); 51 | mFrameLayout4.setOnClickListener(this); 52 | 53 | mPauseImageView = (ImageView) findViewById(R.id.header_pause); 54 | mPlayImageView = (ImageView) findViewById(R.id.header_play); 55 | 56 | } 57 | 58 | @Override 59 | public void onClick(View v) { 60 | switch (v.getId()) { 61 | case R.id.header_left: 62 | finish(); 63 | break; 64 | case R.id.framelayout1: 65 | Toast.makeText(mContext, R.string.lframelayout_toast_system_button, 66 | Toast.LENGTH_SHORT).show(); 67 | break; 68 | case R.id.framelayout2: 69 | break; 70 | case R.id.framelayout3: 71 | break; 72 | case R.id.framelayout4: 73 | if (v instanceof LFrameLayout) { 74 | ((LFrameLayout) v).setColor(randomColor[mRandom 75 | .nextInt(randomColor.length)]); 76 | } 77 | break; 78 | case R.id.header_framelayout: 79 | isPlaying = !isPlaying; 80 | mPauseImageView.setVisibility(isPlaying ? View.VISIBLE : View.GONE); 81 | mPlayImageView.setVisibility(isPlaying ? View.GONE : View.VISIBLE); 82 | break; 83 | default: 84 | break; 85 | } 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /material/src/main/res/layout/preference_checkbox.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 14 | 15 | 20 | 21 | 27 | 28 | 36 | 37 | 43 | 44 | 53 | 54 | 55 | 56 | 66 | 67 | 68 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_lpreference.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 14 | 15 | 25 | 26 | 32 | 33 | 37 | 38 | 39 | 42 | 43 | 48 | 49 | 57 | 58 | 65 | 66 | 70 | 71 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_ldialog.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 14 | 15 | 24 | 25 | 31 | 32 | 33 | 36 | 37 | 41 | 42 | 48 | 54 | 60 | 61 | 67 | 68 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_limagebutton.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 14 | 15 | 24 | 25 | 31 | 32 | 40 | 41 | 42 | 45 | 46 | 51 | 52 | 58 | 59 | 65 | 66 | 74 | 75 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /material/src/main/java/com/lion/material/widget/LDrawerButton.java: -------------------------------------------------------------------------------- 1 | package com.lion.material.widget; 2 | 3 | import android.content.Context; 4 | import android.content.res.TypedArray; 5 | import android.graphics.Canvas; 6 | import android.graphics.Paint; 7 | import android.util.AttributeSet; 8 | 9 | import com.lion.material.R; 10 | import com.lion.material.extra.MaterialStyle; 11 | 12 | public class LDrawerButton extends LButton { 13 | private final String TAG = "LDrawerButton"; 14 | 15 | private Paint mLinePaint = new Paint(); 16 | private int mCenterX; 17 | private int mCenterY; 18 | private int mStrokeWidth; 19 | private int mLineSplit;// split between line 20 | private int mLineHalfWidth;// Half width of line 21 | private int mSplitHalfHeight;// Half height of line 22 | private int mLineLeftBase;// Left base pointX of line 23 | private int mLineRightBase;// Right base pointX of line 24 | private int mLine1TopBase;// line1 base pointY 25 | private int mLine2TopBase;// line2 base pointY 26 | private int mLine3TopBase;// line3 base pointY 27 | private float mLineLeftOffset; 28 | 29 | private float mLeftOffsetY; 30 | private float mRightOffsetY; 31 | private int mCurrentDegrees = 0; 32 | private boolean mIsLeftGravity = true; 33 | private int mBaseDegrees = 0; 34 | 35 | public LDrawerButton(Context context, AttributeSet attrs) { 36 | super(context, attrs); 37 | mLinePaint.setColor(0xffffffff); 38 | if (attrs != null) { 39 | TypedArray a = context.obtainStyledAttributes(attrs, 40 | R.styleable.LButtonStyle); 41 | mIsLeftGravity = a.getInt(R.styleable.LButtonStyle_widget_type, 42 | MaterialStyle.TYPE_HEADBAR_BACK_BTN) != MaterialStyle.TYPE_HEADBAR_RIGHT_BTN; 43 | setDelayClick(a.getBoolean( 44 | R.styleable.LButtonStyle_widget_delayclick, false)); 45 | mBaseDegrees = mIsLeftGravity ? 0 : 180; 46 | a.recycle(); 47 | 48 | } 49 | } 50 | 51 | private void initDrawer() { 52 | if (getWidth() == 0 || getHeight() == 0) 53 | return; 54 | mCenterX = getWidth() / 2; 55 | mCenterY = getHeight() / 2; 56 | mStrokeWidth = getHeight() / 35; 57 | mLinePaint.setStrokeWidth(mStrokeWidth); 58 | mLineSplit = mStrokeWidth * 3;// getHeight() / 15 59 | mLineHalfWidth = (int) (getHeight() / 4.5f); 60 | mLineLeftBase = mCenterX - mLineHalfWidth; 61 | mLineRightBase = mCenterX + mLineHalfWidth; 62 | 63 | mLine1TopBase = mCenterY - mLineSplit - mStrokeWidth; 64 | mLine2TopBase = mCenterY; 65 | mLine3TopBase = mCenterY + mLineSplit + mStrokeWidth; 66 | mSplitHalfHeight = mLine3TopBase - mLine2TopBase; 67 | } 68 | 69 | @Override 70 | protected void onDraw(Canvas canvas) { 71 | super.onDraw(canvas); 72 | if (mCenterX == 0 || mCenterY == 0) { 73 | initDrawer(); 74 | } 75 | canvas.rotate(mCurrentDegrees, mCenterX, mCenterY); 76 | 77 | canvas.drawLine(mLineLeftBase + mLineLeftOffset, mLine1TopBase 78 | - mLeftOffsetY, mLineRightBase, mLine1TopBase + mRightOffsetY, 79 | mLinePaint); 80 | canvas.drawLine(mLineLeftBase + mLineLeftOffset / 3, mLine2TopBase, 81 | mLineRightBase, mLine2TopBase, mLinePaint); 82 | canvas.drawLine(mLineLeftBase + mLineLeftOffset, mLine3TopBase 83 | + mLeftOffsetY, mLineRightBase, mLine3TopBase - mRightOffsetY, 84 | mLinePaint); 85 | } 86 | 87 | public void onDrag(boolean isOpened, float progress) { 88 | if (progress < 0) { 89 | progress = 0; 90 | } else if (progress > 1) { 91 | progress = 1; 92 | } 93 | mLineLeftOffset = (mLineHalfWidth * progress); 94 | mLeftOffsetY = (mSplitHalfHeight / 1.5f * progress); 95 | mRightOffsetY = (mSplitHalfHeight * progress); 96 | float degreesProgress = isOpened ? (1 - progress) : progress; 97 | mCurrentDegrees = (int) (180 * degreesProgress) + (isOpened ? 180 : 0) 98 | + mBaseDegrees; 99 | invalidate(); 100 | } 101 | 102 | } 103 | -------------------------------------------------------------------------------- /material/src/main/java/com/lion/material/widget/PreferenceCheckBox.java: -------------------------------------------------------------------------------- 1 | package com.lion.material.widget; 2 | 3 | 4 | import android.content.Context; 5 | import android.content.res.TypedArray; 6 | import android.text.TextUtils; 7 | import android.util.AttributeSet; 8 | import android.view.View; 9 | import android.widget.CompoundButton; 10 | import android.widget.CompoundButton.OnCheckedChangeListener; 11 | import android.widget.TextView; 12 | 13 | import com.lion.material.R; 14 | 15 | public class PreferenceCheckBox extends LFrameLayout { 16 | private Context mContext; 17 | private LSwitch mCustomSwitch; 18 | private TextView mTitleTextView; 19 | private TextView mSummaryTextView; 20 | private View mDividerView; 21 | 22 | private OnLPreferenceSwitchListener mListener; 23 | 24 | 25 | public PreferenceCheckBox(Context context, AttributeSet attrs) { 26 | super(context, attrs); 27 | mContext = context; 28 | initView(); 29 | TypedArray a = context.obtainStyledAttributes(attrs, 30 | R.styleable.PreferenceStyle); 31 | mTitleTextView.setText(a 32 | .getString(R.styleable.PreferenceStyle_preference_title)); 33 | String summary = a 34 | .getString(R.styleable.PreferenceStyle_preference_summary); 35 | mSummaryTextView.setVisibility(TextUtils.isEmpty(summary) ? View.GONE 36 | : View.VISIBLE); 37 | mSummaryTextView.setText(summary); 38 | mCustomSwitch.setChecked(a.getBoolean( 39 | R.styleable.PreferenceStyle_preference_checked, false)); 40 | mDividerView 41 | .setVisibility(a.getBoolean( 42 | R.styleable.PreferenceStyle_preference_show_divider, 43 | true) ? View.VISIBLE : View.GONE); 44 | a.recycle(); 45 | mCustomSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() { 46 | 47 | @Override 48 | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { 49 | if (mListener != null) { 50 | mListener.onLCheckedChanged(PreferenceCheckBox.this, isChecked); 51 | } 52 | } 53 | }); 54 | } 55 | 56 | private void initView() { 57 | View.inflate(mContext, R.layout.preference_checkbox, this); 58 | mTitleTextView = (TextView) findViewById(R.id.preference_title); 59 | mSummaryTextView = (TextView) findViewById(R.id.preference_summary); 60 | mCustomSwitch = (LSwitch) findViewById(R.id.preference_checkbox); 61 | mDividerView = findViewById(R.id.preference_divider); 62 | } 63 | 64 | @Override 65 | public boolean performClick() { 66 | mCustomSwitch.performClick(); 67 | return super.performClick(); 68 | } 69 | 70 | public void setOnCheckedChangeListener(OnLPreferenceSwitchListener listener) { 71 | mListener = listener; 72 | 73 | } 74 | 75 | public void setChecked(boolean checked) { 76 | mCustomSwitch.setChecked(checked); 77 | } 78 | 79 | @Override 80 | public void setEnabled(boolean enabled) { 81 | super.setEnabled(enabled); 82 | mCustomSwitch.setEnabled(enabled); 83 | mTitleTextView.setEnabled(enabled); 84 | mSummaryTextView.setEnabled(enabled); 85 | } 86 | 87 | public void setSummary(int resId) { 88 | setSummary(mContext.getString(resId)); 89 | } 90 | 91 | public void setSummary(String summary) { 92 | mSummaryTextView.setVisibility(TextUtils.isEmpty(summary) ? View.GONE 93 | : View.VISIBLE); 94 | mSummaryTextView.setText(summary); 95 | } 96 | 97 | /** 98 | * check值改变的回调 99 | */ 100 | public interface OnLPreferenceSwitchListener { 101 | void onLCheckedChanged(View v, boolean isChecked); 102 | } 103 | 104 | } 105 | -------------------------------------------------------------------------------- /material/src/main/java/com/lion/material/widget/LButton.java: -------------------------------------------------------------------------------- 1 | package com.lion.material.widget; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.content.Context; 5 | import android.graphics.Canvas; 6 | import android.graphics.drawable.Drawable; 7 | import android.util.AttributeSet; 8 | import android.view.MotionEvent; 9 | import android.view.View; 10 | import android.widget.Button; 11 | 12 | import com.lion.material.extra.IMaterial; 13 | import com.lion.material.extra.MaterialStyle; 14 | 15 | public class LButton extends Button implements IMaterial { 16 | private MaterialStyle mMaterialStyle; 17 | 18 | public LButton(Context context) { 19 | this(context, null); 20 | } 21 | 22 | public LButton(Context context, AttributeSet attrs) { 23 | super(context, attrs); 24 | mMaterialStyle = new MaterialStyle(this, attrs); 25 | } 26 | 27 | public void perfirmSuperClick() { 28 | super.performClick(); 29 | } 30 | 31 | public void setColor(int fullColor) { 32 | mMaterialStyle.setColor(fullColor); 33 | } 34 | 35 | public void setType(int widgetType) { 36 | mMaterialStyle.setType(widgetType); 37 | } 38 | 39 | @Override 40 | protected void onDraw(Canvas canvas) { 41 | if (!isEnabled()) { 42 | canvas.drawColor(0xffCFCFCF); 43 | super.onDraw(canvas); 44 | return; 45 | } 46 | mMaterialStyle.doDraw(canvas); 47 | super.onDraw(canvas); 48 | } 49 | 50 | @SuppressLint("ClickableViewAccessibility") 51 | @Override 52 | public boolean performClick() { 53 | if (mMaterialStyle != null) { 54 | mMaterialStyle.performClick(); 55 | } else { 56 | return super.performClick(); 57 | } 58 | return true; 59 | } 60 | 61 | @SuppressLint("ClickableViewAccessibility") 62 | @Override 63 | public boolean onTouchEvent(MotionEvent event) { 64 | if (mMaterialStyle != null) 65 | mMaterialStyle.onTouchEvent(event); 66 | return super.onTouchEvent(event); 67 | } 68 | 69 | @Override 70 | public void onWindowFocusChanged(boolean hasWindowFocus) { 71 | super.onWindowFocusChanged(hasWindowFocus); 72 | if (mMaterialStyle != null) 73 | mMaterialStyle.onWindowFocusChanged(hasWindowFocus); 74 | } 75 | 76 | @Override 77 | protected void onVisibilityChanged(View changedView, int visibility) { 78 | super.onVisibilityChanged(changedView, visibility); 79 | if (mMaterialStyle != null) 80 | mMaterialStyle.onVisibilityChanged(changedView, visibility); 81 | } 82 | 83 | /** 84 | * set click event delay to animation end 85 | * 86 | * @param delayClick 87 | */ 88 | public void setDelayClick(boolean delayClick) { 89 | mMaterialStyle.setDelayClick(delayClick); 90 | } 91 | 92 | @Override 93 | public void setBackgroundResource(int resId) { 94 | setBackground(this.getResources().getDrawable(resId)); 95 | } 96 | 97 | @Override 98 | public void setBackground(Drawable background) { 99 | if (mMaterialStyle != null) 100 | mMaterialStyle.setBackground(background); 101 | } 102 | 103 | @Override 104 | public void setBackgroundColor(int color) { 105 | if (mMaterialStyle != null) 106 | mMaterialStyle.setBackgroundColor(color); 107 | } 108 | 109 | @Override 110 | @Deprecated 111 | public void setBackgroundDrawable(Drawable background) { 112 | // super.setBackgroundDrawable(background); 113 | this.setBackground(background); 114 | } 115 | 116 | @Override 117 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 118 | if (mMaterialStyle != null) { 119 | if (mMaterialStyle.needBackgroundMeasure()) { 120 | int[] size = mMaterialStyle.getMeasureSize(widthMeasureSpec, 121 | heightMeasureSpec); 122 | setMeasuredDimension(size[0], size[1]); 123 | } else { 124 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 125 | } 126 | } else { 127 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 128 | } 129 | 130 | } 131 | 132 | @Override 133 | public boolean dispatchTouchEvent(MotionEvent event) { 134 | if (!isEnabled()) 135 | return false; 136 | return super.dispatchTouchEvent(event); 137 | } 138 | 139 | } 140 | -------------------------------------------------------------------------------- /app/src/main/java/com/lion/demo/material/activity/LDialogActivity.java: -------------------------------------------------------------------------------- 1 | package com.lion.demo.material.activity; 2 | 3 | import android.app.AlertDialog; 4 | import android.content.Context; 5 | import android.content.DialogInterface; 6 | import android.os.Bundle; 7 | import android.view.View; 8 | import android.view.View.OnClickListener; 9 | import android.widget.Toast; 10 | 11 | import com.lion.demo.material.R; 12 | import com.lion.material.dialog.LAlertDialog; 13 | import com.lion.material.dialog.LDialogListBuilder; 14 | 15 | 16 | public class LDialogActivity extends BaseActivity implements OnClickListener { 17 | private Context mContext; 18 | private int mSelectedIndex = 0; 19 | 20 | @Override 21 | protected void onCreate(Bundle savedInstanceState) { 22 | super.onCreate(savedInstanceState); 23 | mContext = this; 24 | setContentView(R.layout.activity_ldialog); 25 | initView(); 26 | } 27 | 28 | private void initView() { 29 | findViewById(R.id.header_left).setOnClickListener(this); 30 | findViewById(R.id.ldialog_system).setOnClickListener(this); 31 | findViewById(R.id.ldialog_normal).setOnClickListener(this); 32 | findViewById(R.id.ldialog_normal_longmsg).setOnClickListener(this); 33 | findViewById(R.id.ldialog_list).setOnClickListener(this); 34 | findViewById(R.id.ldialog_single_choice).setOnClickListener(this); 35 | 36 | } 37 | 38 | @Override 39 | public void onClick(View v) { 40 | switch (v.getId()) { 41 | case R.id.header_left: 42 | finish(); 43 | break; 44 | case R.id.ldialog_system: 45 | showSystemDialog(); 46 | break; 47 | case R.id.ldialog_normal: 48 | showNormal(false); 49 | break; 50 | case R.id.ldialog_normal_longmsg: 51 | showNormal(true); 52 | break; 53 | case R.id.ldialog_list: 54 | showSingleList(false); 55 | break; 56 | case R.id.ldialog_single_choice: 57 | showSingleList(true); 58 | break; 59 | default: 60 | break; 61 | } 62 | } 63 | 64 | private void showSystemDialog() { 65 | new AlertDialog.Builder(this).setTitle("This is title") 66 | .setMessage("This is message.").setPositiveButton("OK", null) 67 | .setNegativeButton("Cancel", null).show(); 68 | } 69 | 70 | private void showNormal(boolean longMsg) { 71 | String longContent = "1.If you don't make the time to work on creating the life you want, you're eventually going to be forced to spend a lot of time dealing with a life you don't want.\n" 72 | + "2.One needs 3 things to be truly happy living in the world: some thing to do, some one to love, some thing to hope for.\n" 73 | + "3.Slow the pace of your life and give yourself some time for meditating .It's not death that aman should fear ,but he should fear never live truly. \n"; 74 | String message = longMsg ? longContent : "This is message."; 75 | new LAlertDialog.Builder(this) 76 | .setTitle("This is title") 77 | .setMessage(message) 78 | .setPositiveButton("OK", new DialogInterface.OnClickListener() { 79 | 80 | @Override 81 | public void onClick(DialogInterface dialog, int which) { 82 | Toast.makeText(mContext, "OK Clicked", 83 | Toast.LENGTH_SHORT).show(); 84 | } 85 | }) 86 | .setNegativeButton("Cancel", 87 | new DialogInterface.OnClickListener() { 88 | 89 | @Override 90 | public void onClick(DialogInterface dialog, 91 | int which) { 92 | Toast.makeText(mContext, "Cancel Clicked", 93 | Toast.LENGTH_SHORT).show(); 94 | } 95 | }).show(); 96 | } 97 | 98 | private void showSingleList(boolean chooseMode) { 99 | final String[] items = new String[] { "Item 1", "Item 2", "Item 3" }; 100 | new LDialogListBuilder(this, mSelectedIndex, chooseMode) 101 | .setItems(items, new DialogInterface.OnClickListener() { 102 | 103 | @Override 104 | public void onClick(DialogInterface arg0, int position) { 105 | Toast.makeText(mContext, items[position], 106 | Toast.LENGTH_SHORT).show(); 107 | mSelectedIndex = position; 108 | 109 | } 110 | }).showCloseButton(true).setTitle("Title").show(); 111 | // .show(); 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /material/src/main/java/com/lion/material/widget/LImageButton.java: -------------------------------------------------------------------------------- 1 | package com.lion.material.widget; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.content.Context; 5 | import android.graphics.Canvas; 6 | import android.graphics.drawable.Drawable; 7 | import android.util.AttributeSet; 8 | import android.view.MotionEvent; 9 | import android.view.View; 10 | import android.widget.ImageView; 11 | 12 | import com.lion.material.extra.IMaterial; 13 | import com.lion.material.extra.MaterialStyle; 14 | 15 | public class LImageButton extends ImageView implements IMaterial { 16 | private MaterialStyle mMaterialStyle; 17 | 18 | public LImageButton(Context context) { 19 | this(context, null); 20 | } 21 | 22 | @SuppressLint("NewApi") 23 | public LImageButton(Context context, AttributeSet attrs) { 24 | super(context, attrs); 25 | mMaterialStyle = new MaterialStyle(this, attrs); 26 | } 27 | 28 | public void perfirmSuperClick() { 29 | super.performClick(); 30 | } 31 | 32 | public void setColor(int fullColor) { 33 | mMaterialStyle.setColor(fullColor); 34 | } 35 | 36 | public void setType(int widgetType) { 37 | mMaterialStyle.setType(widgetType); 38 | } 39 | 40 | @Override 41 | protected void onDraw(Canvas canvas) { 42 | if (!isEnabled()) { 43 | super.onDraw(canvas); 44 | return; 45 | } 46 | mMaterialStyle.doDraw(canvas); 47 | super.onDraw(canvas); 48 | } 49 | 50 | @SuppressLint("ClickableViewAccessibility") 51 | @Override 52 | public boolean performClick() { 53 | if (mMaterialStyle != null) { 54 | mMaterialStyle.performClick(); 55 | } else { 56 | return super.performClick(); 57 | } 58 | return true; 59 | } 60 | 61 | @SuppressLint("ClickableViewAccessibility") 62 | @Override 63 | public boolean onTouchEvent(MotionEvent event) { 64 | if (mMaterialStyle != null) 65 | mMaterialStyle.onTouchEvent(event); 66 | return super.onTouchEvent(event); 67 | } 68 | 69 | @Override 70 | public void onWindowFocusChanged(boolean hasWindowFocus) { 71 | super.onWindowFocusChanged(hasWindowFocus); 72 | if (mMaterialStyle != null) 73 | mMaterialStyle.onWindowFocusChanged(hasWindowFocus); 74 | } 75 | 76 | @Override 77 | protected void onVisibilityChanged(View changedView, int visibility) { 78 | super.onVisibilityChanged(changedView, visibility); 79 | if (mMaterialStyle != null) 80 | mMaterialStyle.onVisibilityChanged(changedView, visibility); 81 | } 82 | 83 | /** 84 | * set click event delay to animation end 85 | * 86 | * @param delayClick 87 | */ 88 | public void setDelayClick(boolean delayClick) { 89 | mMaterialStyle.setDelayClick(delayClick); 90 | } 91 | 92 | @Override 93 | public void setBackgroundResource(int resId) { 94 | setBackground(this.getResources().getDrawable(resId)); 95 | } 96 | 97 | @Override 98 | public void setBackground(Drawable background) { 99 | if (mMaterialStyle != null) 100 | mMaterialStyle.setBackground(background); 101 | } 102 | 103 | @Override 104 | public void setBackgroundColor(int color) { 105 | if (mMaterialStyle != null) 106 | mMaterialStyle.setBackgroundColor(color); 107 | } 108 | 109 | @Override 110 | @Deprecated 111 | public void setBackgroundDrawable(Drawable background) { 112 | // super.setBackgroundDrawable(background); 113 | this.setBackground(background); 114 | } 115 | 116 | @Override 117 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 118 | if (mMaterialStyle != null) { 119 | if (mMaterialStyle.needBackgroundMeasure()) { 120 | int[] size = mMaterialStyle.getMeasureSize(widthMeasureSpec, 121 | heightMeasureSpec); 122 | setMeasuredDimension(size[0], size[1]); 123 | } else { 124 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 125 | } 126 | } else { 127 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 128 | } 129 | 130 | } 131 | 132 | public int mImageResId; 133 | 134 | @Override 135 | public void setImageResource(int resId) { 136 | super.setImageResource(resId); 137 | mImageResId = resId; 138 | } 139 | 140 | @Override 141 | public boolean dispatchTouchEvent(MotionEvent event) { 142 | if (!isEnabled()) 143 | return false; 144 | return super.dispatchTouchEvent(event); 145 | } 146 | 147 | } 148 | -------------------------------------------------------------------------------- /material/src/main/java/com/lion/material/widget/LFrameLayout.java: -------------------------------------------------------------------------------- 1 | package com.lion.material.widget; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.content.Context; 5 | import android.graphics.Canvas; 6 | import android.graphics.drawable.Drawable; 7 | import android.util.AttributeSet; 8 | import android.view.MotionEvent; 9 | import android.view.View; 10 | import android.widget.FrameLayout; 11 | 12 | import com.lion.material.extra.IMaterial; 13 | import com.lion.material.extra.MaterialStyle; 14 | 15 | public class LFrameLayout extends FrameLayout implements IMaterial { 16 | private MaterialStyle mMaterialStyle; 17 | 18 | public LFrameLayout(Context context) { 19 | this(context, null); 20 | } 21 | 22 | @SuppressLint("NewApi") 23 | public LFrameLayout(Context context, AttributeSet attrs) { 24 | super(context, attrs); 25 | mMaterialStyle = new MaterialStyle(this, attrs); 26 | } 27 | 28 | public void perfirmSuperClick() { 29 | super.performClick(); 30 | } 31 | 32 | public void setColor(int fullColor) { 33 | mMaterialStyle.setColor(fullColor); 34 | } 35 | 36 | public void setType(int widgetType) { 37 | mMaterialStyle.setType(widgetType); 38 | } 39 | 40 | @Override 41 | protected void onDraw(Canvas canvas) { 42 | if (!isEnabled()) { 43 | super.onDraw(canvas); 44 | return; 45 | } 46 | mMaterialStyle.doDraw(canvas); 47 | super.onDraw(canvas); 48 | } 49 | 50 | @SuppressLint("ClickableViewAccessibility") 51 | @Override 52 | public boolean performClick() { 53 | if (mMaterialStyle != null) { 54 | mMaterialStyle.performClick(); 55 | } else { 56 | return super.performClick(); 57 | } 58 | return true; 59 | } 60 | 61 | // @Override 62 | // public void setOnClickListener(OnClickListener l) { 63 | // super.setOnClickListener(l); 64 | // if (mMaterialStyle != null) { 65 | // mMaterialStyle.setOnclickListener(l); 66 | // } 67 | // } 68 | 69 | @SuppressLint("ClickableViewAccessibility") 70 | @Override 71 | public boolean onTouchEvent(MotionEvent event) { 72 | //if (mMaterialStyle != null) { 73 | // return mMaterialStyle.onTouchEvent(event) ? super 74 | // .onTouchEvent(event) : false; 75 | //} 76 | if (mMaterialStyle != null) 77 | mMaterialStyle.onTouchEvent(event); 78 | return super.onTouchEvent(event); 79 | } 80 | 81 | @Override 82 | public void onWindowFocusChanged(boolean hasWindowFocus) { 83 | super.onWindowFocusChanged(hasWindowFocus); 84 | if (mMaterialStyle != null) 85 | mMaterialStyle.onWindowFocusChanged(hasWindowFocus); 86 | } 87 | 88 | @Override 89 | protected void onVisibilityChanged(View changedView, int visibility) { 90 | super.onVisibilityChanged(changedView, visibility); 91 | if (mMaterialStyle != null) 92 | mMaterialStyle.onVisibilityChanged(changedView, visibility); 93 | } 94 | 95 | /** 96 | * set click event delay to animation end 97 | * 98 | * @param need 99 | */ 100 | public void setDelayClick(boolean delayClick) { 101 | mMaterialStyle.setDelayClick(delayClick); 102 | } 103 | 104 | @Override 105 | public void setBackgroundResource(int resId) { 106 | setBackground(this.getResources().getDrawable(resId)); 107 | } 108 | 109 | @Override 110 | public void setBackground(Drawable background) { 111 | if (mMaterialStyle != null) 112 | mMaterialStyle.setBackground(background); 113 | } 114 | 115 | @Override 116 | public void setBackgroundColor(int color) { 117 | if (mMaterialStyle != null) 118 | mMaterialStyle.setBackgroundColor(color); 119 | } 120 | 121 | @Override 122 | @Deprecated 123 | public void setBackgroundDrawable(Drawable background) { 124 | // super.setBackgroundDrawable(background); 125 | this.setBackground(background); 126 | } 127 | 128 | @Override 129 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 130 | if (mMaterialStyle != null) { 131 | if (mMaterialStyle.needBackgroundMeasure()) { 132 | int[] size = mMaterialStyle.getMeasureSize(widthMeasureSpec, 133 | heightMeasureSpec); 134 | setMeasuredDimension(size[0], size[1]); 135 | } else { 136 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 137 | } 138 | } else { 139 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 140 | } 141 | 142 | } 143 | 144 | @Override 145 | public boolean dispatchTouchEvent(MotionEvent event) { 146 | if (!isEnabled()) 147 | return false; 148 | return super.dispatchTouchEvent(event); 149 | } 150 | 151 | } 152 | -------------------------------------------------------------------------------- /material/src/main/java/com/lion/material/dialog/LDialogListBuilder.java: -------------------------------------------------------------------------------- 1 | package com.lion.material.dialog; 2 | 3 | import android.content.Context; 4 | import android.content.DialogInterface; 5 | import android.content.DialogInterface.OnClickListener; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.BaseAdapter; 9 | import android.widget.ImageView; 10 | import android.widget.ListView; 11 | import android.widget.TextView; 12 | 13 | import com.lion.material.R; 14 | import com.lion.material.dialog.LAlertDialog.Builder; 15 | 16 | public class LDialogListBuilder extends Builder { 17 | private Context mContext; 18 | private ListView mListView; 19 | private OnClickListener mListener; 20 | private LDialogController mController; 21 | private int mSelectedIndex = -1; 22 | private boolean mIsChooseMode; 23 | private ListItemAdapter mAdapter; 24 | 25 | public LDialogListBuilder(Context context, int selectedIndex, 26 | boolean isChooseMode) { 27 | super(context); 28 | this.mContext = context; 29 | View v = View.inflate(mContext, R.layout.material_dialog_listview, null); 30 | mListView = (ListView) v.findViewById(R.id.dialog_listview); 31 | this.setView(v); 32 | this.mSelectedIndex = selectedIndex; 33 | this.mIsChooseMode = isChooseMode; 34 | } 35 | 36 | public Builder setItems(String[] items, OnClickListener listener) { 37 | this.mListener = listener; 38 | mAdapter = new ListItemAdapter(mContext, items, mSelectedIndex, 39 | mIsChooseMode); 40 | mListView.setAdapter(mAdapter); 41 | return this; 42 | } 43 | 44 | public void setSelectedIndex(int index) { 45 | this.mSelectedIndex = index; 46 | if (mAdapter != null) { 47 | mAdapter.setSelectedIndex(index); 48 | } 49 | 50 | } 51 | 52 | /** 53 | * 创建dialog 54 | * 55 | * @return 56 | */ 57 | public LAlertDialog create() { 58 | LAlertDialog dialog = super.create(); 59 | mController = dialog.getController(); 60 | return dialog; 61 | } 62 | 63 | /** 64 | * 创建并显示dialog 65 | * 66 | * @return 67 | */ 68 | public LAlertDialog show() { 69 | LAlertDialog dialog = create(); 70 | dialog.show(); 71 | return dialog; 72 | } 73 | 74 | public class ListItemAdapter extends BaseAdapter { 75 | private Context mContext; 76 | private String[] items; 77 | private int selectedIndex = -1; 78 | private boolean isChooseMode; 79 | 80 | public ListItemAdapter(Context context, String[] items, 81 | int selectedIndex, boolean isChooseMode) { 82 | this.mContext = context; 83 | this.items = items; 84 | this.selectedIndex = selectedIndex; 85 | this.isChooseMode = isChooseMode; 86 | } 87 | 88 | @Override 89 | public int getCount() { 90 | return items.length; 91 | } 92 | 93 | @Override 94 | public Object getItem(int arg0) { 95 | return null; 96 | } 97 | 98 | @Override 99 | public long getItemId(int arg0) { 100 | return 0; 101 | } 102 | 103 | @Override 104 | public View getView(final int position, View convertView, ViewGroup arg2) { 105 | 106 | ViewHolder viewHolder = null; 107 | if (convertView == null) { 108 | viewHolder = new ViewHolder(); 109 | convertView = View.inflate(mContext, 110 | R.layout.material_dialog_listview_adapter, null); 111 | viewHolder.mTextView = (TextView) convertView 112 | .findViewById(R.id.dialog_listview_adapter_content); 113 | viewHolder.mIconImageView = (ImageView) convertView 114 | .findViewById(R.id.dialog_listview_adapter_checkbox); 115 | if (isChooseMode) { 116 | viewHolder.mIconImageView.setVisibility(View.VISIBLE); 117 | } 118 | convertView.setTag(viewHolder); 119 | } else { 120 | viewHolder = (ViewHolder) convertView.getTag(); 121 | } 122 | viewHolder.mIconImageView.setSelected(selectedIndex == position); 123 | viewHolder.mTextView.setText(items[position]); 124 | convertView.setOnClickListener(new View.OnClickListener() { 125 | 126 | @Override 127 | public void onClick(View arg0) { 128 | if (mListener != null) { 129 | DialogInterface dialogInterface = mController == null ? null 130 | : mController.getDialogInterface(); 131 | mListener.onClick(dialogInterface, position); 132 | if (dialogInterface != null) { 133 | dialogInterface.dismiss(); 134 | } 135 | } 136 | } 137 | }); 138 | 139 | return convertView; 140 | } 141 | 142 | private class ViewHolder { 143 | TextView mTextView; 144 | ImageView mIconImageView; 145 | } 146 | 147 | public void setSelectedIndex(int index) { 148 | this.selectedIndex = index; 149 | notifyDataSetChanged(); 150 | } 151 | } 152 | 153 | } 154 | -------------------------------------------------------------------------------- /material/src/main/java/com/lion/material/widget/LLinearLayout.java: -------------------------------------------------------------------------------- 1 | package com.lion.material.widget; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.content.Context; 5 | import android.graphics.Canvas; 6 | import android.graphics.drawable.Drawable; 7 | import android.util.AttributeSet; 8 | import android.view.MotionEvent; 9 | import android.view.View; 10 | import android.widget.LinearLayout; 11 | 12 | import com.lion.material.extra.IMaterial; 13 | import com.lion.material.extra.MaterialStyle; 14 | 15 | public class LLinearLayout extends LinearLayout implements IMaterial { 16 | private MaterialStyle mMaterialStyle; 17 | 18 | public LLinearLayout(Context context) { 19 | this(context, null); 20 | } 21 | 22 | public LLinearLayout(Context context, AttributeSet attrs) { 23 | super(context, attrs); 24 | mMaterialStyle = new MaterialStyle(this, attrs); 25 | } 26 | 27 | public void perfirmSuperClick() { 28 | super.performClick(); 29 | } 30 | 31 | public void setColor(int fullColor) { 32 | mMaterialStyle.setColor(fullColor); 33 | } 34 | 35 | public void setType(int widgetType) { 36 | mMaterialStyle.setType(widgetType); 37 | } 38 | 39 | @Override 40 | protected void onDraw(Canvas canvas) { 41 | if (!isEnabled()) { 42 | super.onDraw(canvas); 43 | return; 44 | } 45 | mMaterialStyle.doDraw(canvas); 46 | super.onDraw(canvas); 47 | } 48 | 49 | @SuppressLint("ClickableViewAccessibility") 50 | @Override 51 | public boolean performClick() { 52 | if (mMaterialStyle != null) { 53 | mMaterialStyle.performClick(); 54 | } else { 55 | return super.performClick(); 56 | } 57 | return true; 58 | } 59 | 60 | // @Override 61 | //public void setOnClickListener(OnClickListener l) { 62 | // super.setOnClickListener(l); 63 | // if (mMaterialStyle != null) { 64 | // mMaterialStyle.setOnclickListener(l); 65 | // } 66 | // } 67 | 68 | @SuppressLint("ClickableViewAccessibility") 69 | @Override 70 | public boolean onTouchEvent(MotionEvent event) { 71 | // if (mMaterialStyle != null) { 72 | // return mMaterialStyle.onTouchEvent(event) ? super 73 | // .onTouchEvent(event) : false; 74 | // } 75 | if (mMaterialStyle != null) 76 | mMaterialStyle.onTouchEvent(event); 77 | return super.onTouchEvent(event); 78 | } 79 | 80 | @Override 81 | public void onWindowFocusChanged(boolean hasWindowFocus) { 82 | super.onWindowFocusChanged(hasWindowFocus); 83 | if (mMaterialStyle != null) 84 | mMaterialStyle.onWindowFocusChanged(hasWindowFocus); 85 | } 86 | 87 | @Override 88 | protected void onVisibilityChanged(View changedView, int visibility) { 89 | super.onVisibilityChanged(changedView, visibility); 90 | if (mMaterialStyle != null) 91 | mMaterialStyle.onVisibilityChanged(changedView, visibility); 92 | } 93 | 94 | /** 95 | * set click event delay to animation end 96 | * 97 | * @param delayClick 98 | */ 99 | public void setDelayClick(boolean delayClick) { 100 | mMaterialStyle.setDelayClick(delayClick); 101 | } 102 | 103 | @Override 104 | public void setBackgroundResource(int resId) { 105 | setBackground(this.getResources().getDrawable(resId)); 106 | } 107 | 108 | @Override 109 | public void setBackground(Drawable background) { 110 | if (mMaterialStyle != null) 111 | mMaterialStyle.setBackground(background); 112 | } 113 | 114 | @Override 115 | public void setBackgroundColor(int color) { 116 | if (mMaterialStyle != null) 117 | mMaterialStyle.setBackgroundColor(color); 118 | } 119 | 120 | @Override 121 | @Deprecated 122 | public void setBackgroundDrawable(Drawable background) { 123 | // super.setBackgroundDrawable(background); 124 | this.setBackground(background); 125 | } 126 | 127 | @Override 128 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 129 | if (mMaterialStyle != null) { 130 | if (mMaterialStyle.needBackgroundMeasure()) { 131 | int[] size = mMaterialStyle.getMeasureSize(widthMeasureSpec, 132 | heightMeasureSpec); 133 | setMeasuredDimension(size[0], size[1]); 134 | } else { 135 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 136 | } 137 | } else { 138 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 139 | } 140 | 141 | } 142 | 143 | @Override 144 | public boolean dispatchTouchEvent(MotionEvent event) { 145 | if (!isEnabled()) 146 | return false; 147 | return super.dispatchTouchEvent(event); 148 | } 149 | 150 | } 151 | -------------------------------------------------------------------------------- /app/src/main/java/com/lion/demo/material/activity/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.lion.demo.material.activity; 2 | 3 | import android.content.Intent; 4 | import android.net.Uri; 5 | import android.os.Bundle; 6 | import android.support.v4.widget.DrawerLayout; 7 | import android.support.v4.widget.DrawerLayout.DrawerListener; 8 | import android.view.Gravity; 9 | import android.view.View; 10 | import android.view.View.OnClickListener; 11 | 12 | import com.lion.demo.material.R; 13 | import com.lion.material.widget.LDrawerButton; 14 | 15 | public class MainActivity extends BaseActivity implements OnClickListener { 16 | private String TAG = "MainActivity"; 17 | private DrawerLayout mDrawerLayout; 18 | private View mLeftGravityView; 19 | private LDrawerButton drawerButtonLeft; 20 | private LDrawerButton drawerButtonRight; 21 | 22 | @Override 23 | protected void onCreate(Bundle savedInstanceState) { 24 | super.onCreate(savedInstanceState); 25 | setContentView(R.layout.activity_main); 26 | initView(); 27 | } 28 | 29 | private void initView() { 30 | mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); 31 | // init left headerButton 32 | drawerButtonLeft = (LDrawerButton) findViewById(R.id.header_left); 33 | drawerButtonLeft.setOnClickListener(this); 34 | // init right headerButton 35 | drawerButtonRight = (LDrawerButton) findViewById(R.id.header_right); 36 | drawerButtonRight.setOnClickListener(this); 37 | mLeftGravityView = findViewById(R.id.main_menu_left); 38 | findViewById(R.id.main_add).setOnClickListener(this); 39 | findViewById(R.id.main_item_lbutton).setOnClickListener(this); 40 | findViewById(R.id.main_item_limagebutton).setOnClickListener(this); 41 | findViewById(R.id.main_item_lframelayout).setOnClickListener(this); 42 | findViewById(R.id.main_item_lpreference).setOnClickListener(this); 43 | findViewById(R.id.main_item_ldialog).setOnClickListener(this); 44 | findViewById(R.id.main_item_ltab).setOnClickListener(this); 45 | 46 | mDrawerLayout.setDrawerListener(new DrawerListener() { 47 | 48 | @Override 49 | public void onDrawerStateChanged(int drawerStatus) { 50 | } 51 | 52 | @Override 53 | public void onDrawerSlide(View v, float progress) { 54 | if (v == mLeftGravityView) { 55 | drawerButtonLeft.onDrag( 56 | mDrawerLayout.isDrawerOpen(Gravity.LEFT), progress); 57 | } else { 58 | drawerButtonRight.onDrag( 59 | mDrawerLayout.isDrawerOpen(Gravity.RIGHT), progress); 60 | } 61 | 62 | } 63 | 64 | @Override 65 | public void onDrawerOpened(View v) { 66 | } 67 | 68 | @Override 69 | public void onDrawerClosed(View v) { 70 | } 71 | }); 72 | } 73 | 74 | @Override 75 | public void onClick(View v) { 76 | switch (v.getId()) { 77 | case R.id.main_add: 78 | case R.id.header_left: 79 | if (mDrawerLayout.isDrawerOpen(Gravity.RIGHT)) { 80 | mDrawerLayout.closeDrawer(Gravity.RIGHT); 81 | } 82 | if (mDrawerLayout.isDrawerOpen(Gravity.LEFT)) { 83 | mDrawerLayout.closeDrawer(Gravity.LEFT); 84 | } else { 85 | mDrawerLayout.openDrawer(Gravity.LEFT); 86 | } 87 | break; 88 | case R.id.header_right: 89 | if (mDrawerLayout.isDrawerOpen(Gravity.LEFT)) { 90 | mDrawerLayout.closeDrawer(Gravity.LEFT); 91 | } 92 | if (mDrawerLayout.isDrawerOpen(Gravity.RIGHT)) { 93 | mDrawerLayout.closeDrawer(Gravity.RIGHT); 94 | } else { 95 | mDrawerLayout.openDrawer(Gravity.RIGHT); 96 | } 97 | break; 98 | case R.id.main_item_lbutton: 99 | startActivity(new Intent(mContext, LButtonActivity.class)); 100 | break; 101 | case R.id.main_item_limagebutton: 102 | startActivity(new Intent(mContext, LImageButtonActivity.class)); 103 | break; 104 | case R.id.main_item_lframelayout: 105 | startActivity(new Intent(mContext, LFrameLayoutActivity.class)); 106 | break; 107 | case R.id.main_item_lpreference: 108 | startActivity(new Intent(mContext, LPreferenceActivity.class)); 109 | break; 110 | case R.id.main_item_ldialog: 111 | startActivity(new Intent(mContext, LDialogActivity.class)); 112 | break; 113 | case R.id.main_item_ltab: 114 | startActivity(new Intent(mContext, LTabActivity.class)); 115 | break; 116 | default: 117 | break; 118 | } 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_lbutton.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 14 | 15 | 24 | 25 | 31 | 32 | 44 | 45 | 46 | 49 | 50 | 55 | 56 |