├── .gitignore
├── LICENSE
├── MaterialDesignLibrary
├── .gitignore
├── MaterialDesign
│ ├── .gitignore
│ ├── build.gradle
│ ├── gradle.properties
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── gc
│ │ │ └── materialdesign
│ │ │ └── ApplicationTest.java
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ └── com
│ │ │ └── gc
│ │ │ └── materialdesign
│ │ │ ├── utils
│ │ │ └── Utils.java
│ │ │ ├── views
│ │ │ ├── AutoHideButtonFloat.java
│ │ │ ├── Button.java
│ │ │ ├── ButtonFlat.java
│ │ │ ├── ButtonFloat.java
│ │ │ ├── ButtonFloatSmall.java
│ │ │ ├── ButtonIcon.java
│ │ │ ├── ButtonRectangle.java
│ │ │ ├── Card.java
│ │ │ ├── CheckBox.java
│ │ │ ├── CustomView.java
│ │ │ ├── LayoutRipple.java
│ │ │ ├── ProgressBarCircularIndeterminate.java
│ │ │ ├── ProgressBarDeterminate.java
│ │ │ ├── ProgressBarIndeterminate.java
│ │ │ ├── ProgressBarIndeterminateDeterminate.java
│ │ │ ├── ScrollView.java
│ │ │ ├── Slider.java
│ │ │ └── Switch.java
│ │ │ └── widgets
│ │ │ ├── ColorSelector.java
│ │ │ ├── Dialog.java
│ │ │ ├── ProgressDialog.java
│ │ │ └── SnackBar.java
│ │ └── res
│ │ ├── anim
│ │ ├── dialog_main_hide_amination.xml
│ │ ├── dialog_main_show_amination.xml
│ │ ├── dialog_root_hide_amin.xml
│ │ ├── dialog_root_show_amin.xml
│ │ ├── progress_indeterminate_animation.xml
│ │ ├── snackbar_hide_animation.xml
│ │ └── snackbar_show_animation.xml
│ │ ├── drawable-hdpi
│ │ └── sprite_check.png
│ │ ├── drawable-ldpi
│ │ └── sprite_check.png
│ │ ├── drawable-mdpi
│ │ └── sprite_check.png
│ │ ├── drawable-xhdpi
│ │ ├── dialog_background.9.png
│ │ ├── float_button1_shadowp.png
│ │ ├── float_button_shadow1.png
│ │ ├── ic_reloj_max.png
│ │ └── sprite_check.png
│ │ ├── drawable-xxhdpi
│ │ └── sprite_check.png
│ │ ├── drawable
│ │ ├── background_button.9.png
│ │ ├── background_button_float.xml
│ │ ├── background_button_rectangle.xml
│ │ ├── background_checkbox.xml
│ │ ├── background_checkbox_check.xml
│ │ ├── background_checkbox_uncheck.xml
│ │ ├── background_progress.xml
│ │ ├── background_switch_ball_uncheck.xml
│ │ ├── background_transparent.xml
│ │ ├── shadow_down.xml
│ │ └── shadow_right.xml
│ │ ├── layout
│ │ ├── color_selector.xml
│ │ ├── dialog.xml
│ │ ├── number_indicator_spinner.xml
│ │ ├── progress_dialog.xml
│ │ └── snackbar.xml
│ │ └── values
│ │ ├── attributes.xml
│ │ ├── colors.xml
│ │ └── strings.xml
├── MaterialDesignDemo
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── gc
│ │ │ └── materialdesigndemo
│ │ │ └── ApplicationTest.java
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ └── com
│ │ │ └── gc
│ │ │ └── materialdesigndemo
│ │ │ └── ui
│ │ │ ├── ButtonsActivity.java
│ │ │ ├── MainActivity.java
│ │ │ ├── ProgressActivity.java
│ │ │ ├── SwitchActivity.java
│ │ │ └── WidgetActivity.java
│ │ └── res
│ │ ├── drawable-xhdpi
│ │ ├── ic_action_new.png
│ │ ├── ic_next.png
│ │ ├── icn_button.png
│ │ ├── icn_progress.png
│ │ ├── icn_select_color.png
│ │ ├── icn_switch.png
│ │ └── icn_widget.png
│ │ ├── drawable
│ │ ├── blue_background.xml
│ │ ├── selector_list.xml
│ │ └── transparent_backgrouns.xml
│ │ ├── layout
│ │ ├── activity_buttons.xml
│ │ ├── activity_main.xml
│ │ ├── activity_progress.xml
│ │ ├── activity_switchs.xml
│ │ └── activity_widgets.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ └── values
│ │ ├── strings.xml
│ │ └── styles.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
├── README.md
├── images
├── body-bg.jpg
├── checkbox.png
├── color_selector.png
├── dialog.png
├── download-button.png
├── flat_button.png
├── float_button.png
├── float_small_button.png
├── github-button.png
├── header-bg.jpg
├── highlight-bg.jpg
├── logo.png
├── progress_bar_circular_indeterminate.png
├── progress_bar_determinate.png
├── progress_bar_indeterminate.png
├── progress_bar_indeterminate_determinate.png
├── rectangle_button.png
├── sidebar-bg.jpg
├── slider.png
├── slider_with_number_indicator.png
├── snackbar.png
└── switch.png
├── index.html
├── javascripts
└── main.js
├── params.json
└── stylesheets
├── github-light.css
├── print.css
└── stylesheet.css
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 |
5 | # Files for the Dalvik VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # Generated files
12 | bin/
13 | gen/
14 |
15 | # Gradle files
16 | .gradle/
17 | build/
18 |
19 | # Local configuration file (sdk path, etc)
20 | local.properties
21 |
22 | # Proguard folder generated by Eclipse
23 | proguard/
24 |
25 | # Log Files
26 | *.log
27 | .idea/
28 | *.iml
--------------------------------------------------------------------------------
/MaterialDesignLibrary/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /local.properties
3 | /.idea/workspace.xml
4 | /.idea/libraries
5 | .DS_Store
6 | /build
7 | /captures
8 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | // COMMENT TO DEVELOPER MODE / UNCOMMENT TO UPLOAD TO BINTARRAY
3 | //apply plugin: 'com.github.dcendents.android-maven'
4 | //apply plugin: 'com.jfrog.bintray'
5 |
6 | android {
7 | compileSdkVersion 22
8 | buildToolsVersion "22.0.1"
9 |
10 | defaultConfig {
11 | minSdkVersion 16
12 | targetSdkVersion 22
13 | versionCode 1
14 | versionName "1.0"
15 | }
16 | buildTypes {
17 | release {
18 | minifyEnabled false
19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
20 | }
21 | }
22 | }
23 |
24 | dependencies {
25 | compile 'com.nineoldandroids:library:2.4.+'
26 | compile 'com.android.support:support-v4:22.+'
27 | compile fileTree(dir: 'libs', include: '*.jar')
28 | }
29 |
30 | // COMMENT TO DEVELOPER MODE / UNCOMMENT TO UPLOAD TO BINTARRAY
31 |
32 | //ext.siteUrl = 'https://github.com/navasmdc/MaterialDesignLibrary'
33 | //ext.issueUrl = 'https://github.com/navasmdc/MaterialDesignLibrary/issues'
34 | //ext.gitUrl = 'https://github.com/navasmdc/MaterialDesignLibrary.git'
35 | //
36 | //bintray {
37 | // user = hasProperty('BINTRAY_USER') ? BINTRAY_USER : "navasmdc"
38 | // key = hasProperty('BINTRAY_KEY') ? BINTRAY_PASSWORD : ""
39 | //
40 | // configurations = ["archives"]
41 | // pkg {
42 | // repo = 'maven'
43 | // name = 'MaterialDesignLibrary'
44 | // desc = 'This is a library with components of Android L to you use in android 2.2'
45 | // websiteUrl = siteUrl
46 | // issueTrackerUrl = issueUrl
47 | // vcsUrl = gitUrl
48 | // licenses = ['Apache-2.0']
49 | // labels = []
50 | // publicDownloadNumbers = true
51 | // }
52 | //}
53 |
54 | //install {
55 | // repositories.mavenInstaller {
56 | // pom {
57 | // project {
58 | // packaging 'aar'
59 | // name 'MaterialDesignLibrary'
60 | // url siteUrl
61 | // licenses {
62 | // license {
63 | // name 'The Apache Software License, Version 2.0'
64 | // url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
65 | // }
66 | // }
67 | // developers {
68 | // developer {
69 | // id 'navasmdc'
70 | // name 'Iván Navas'
71 | // email 'i.navas.mdc@gmail.com'
72 | // }
73 | // }
74 | // scm {
75 | // connection gitUrl
76 | // developerConnection gitUrl
77 | // url siteUrl
78 | // }
79 | // }
80 | // }
81 | // }
82 | //}
83 | //
84 | //task sourcesJar(type: Jar) {
85 | // from android.sourceSets.main.java.srcDirs
86 | // classifier = 'sources'
87 | //}
88 | //
89 | //task javadoc(type: Javadoc) {
90 | // source = android.sourceSets.main.java.srcDirs
91 | // classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
92 | //}
93 | //
94 | //task javadocJar(type: Jar, dependsOn: javadoc) {
95 | // classifier = 'javadoc'
96 | // from javadoc.destinationDir
97 | //}
98 | //
99 | //artifacts {
100 | // archives javadocJar
101 | // archives sourcesJar
102 | //}
103 | //
104 | //task findConventions << {
105 | // println project.getConvention()
106 | //}
107 |
108 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/gradle.properties:
--------------------------------------------------------------------------------
1 | POM_NAME=MaterialDesignLibrary
2 | POM_ARTIFACT_ID=material-design-library
3 | POM_PACKAGING=aar
4 |
5 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/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 /Applications/adt-bundle-mac-x86_64-20140321/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 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/androidTest/java/com/gc/materialdesign/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.gc.materialdesign;
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 | }
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/utils/Utils.java:
--------------------------------------------------------------------------------
1 | package com.gc.materialdesign.utils;
2 |
3 | import android.content.res.Resources;
4 | import android.util.TypedValue;
5 | import android.view.View;
6 |
7 | public class Utils {
8 |
9 |
10 | /**
11 | * Convert Dp to Pixel
12 | */
13 | public static int dpToPx(float dp, Resources resources){
14 | float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, resources.getDisplayMetrics());
15 | return (int) px;
16 | }
17 |
18 | public static int getRelativeTop(View myView) {
19 | // if (myView.getParent() == myView.getRootView())
20 | if(myView.getId() == android.R.id.content)
21 | return myView.getTop();
22 | else
23 | return myView.getTop() + getRelativeTop((View) myView.getParent());
24 | }
25 |
26 | public static int getRelativeLeft(View myView) {
27 | // if (myView.getParent() == myView.getRootView())
28 | if(myView.getId() == android.R.id.content)
29 | return myView.getLeft();
30 | else
31 | return myView.getLeft() + getRelativeLeft((View) myView.getParent());
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/AutoHideButtonFloat.java:
--------------------------------------------------------------------------------
1 | package com.gc.materialdesign.views;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.view.View;
6 | import android.widget.AbsListView;
7 | import android.widget.ListView;
8 |
9 | import com.gc.materialdesign.views.ButtonFloat;
10 | import com.nineoldandroids.view.ViewPropertyAnimator;
11 |
12 | /**
13 | * Created by hamedpc on 4/25/2015.
14 | * This widget uses NineOldAndroid to animate the view so you're gonna need to include it in your project
15 | */
16 | public class AutoHideButtonFloat extends ButtonFloat implements AbsListView.OnScrollListener {
17 | ListView listView;
18 | private boolean floatHiding = false, floatShowing = false;
19 | private int mLastFirstVisibleItem;
20 | private View view = this;
21 | private AbsListView.OnScrollListener onScrollListener;
22 |
23 | public AutoHideButtonFloat(Context context, AttributeSet attrs) {
24 | super(context, attrs);
25 | }
26 |
27 | public void setOnScrollListener(AbsListView.OnScrollListener onScrollListener) {
28 | this.onScrollListener = onScrollListener;
29 | }
30 |
31 | public void setListView(ListView listView) {
32 | this.listView = listView;
33 | this.listView.setOnScrollListener(this);
34 | }
35 |
36 | @Override
37 | public void onScrollStateChanged(AbsListView absListView, int scrollState) {
38 | switch (scrollState) {
39 | case AbsListView.SCROLL_AXIS_NONE:
40 | floatHiding = false;
41 | floatShowing = false;
42 | ViewPropertyAnimator.animate(view).translationY(0).setDuration(300);
43 | break;
44 | }
45 | if (onScrollListener != null)
46 | onScrollListener.onScrollStateChanged(absListView, scrollState);
47 | }
48 |
49 | @Override
50 | public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
51 |
52 | if (mLastFirstVisibleItem < firstVisibleItem) {
53 | if (floatShowing) floatShowing = false;
54 | if (!floatHiding) {
55 | ViewPropertyAnimator.animate(view).translationY(500).setDuration(300);
56 | floatHiding = true;
57 | }
58 | }
59 | if (mLastFirstVisibleItem > firstVisibleItem) {
60 | if (floatHiding) {
61 | floatHiding = false;
62 | }
63 | if (!floatShowing) {
64 | ViewPropertyAnimator.animate(view).translationY(0).setDuration(300);
65 | floatShowing = true;
66 | }
67 | }
68 | mLastFirstVisibleItem = firstVisibleItem;
69 | if (onScrollListener != null)
70 | onScrollListener.onScroll(absListView, firstVisibleItem, visibleItemCount, totalItemCount);
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/Button.java:
--------------------------------------------------------------------------------
1 | package com.gc.materialdesign.views;
2 |
3 | import com.gc.materialdesign.R;
4 | import com.gc.materialdesign.utils.Utils;
5 |
6 | import android.content.Context;
7 | import android.graphics.Bitmap;
8 | import android.graphics.Canvas;
9 | import android.graphics.Color;
10 | import android.graphics.Paint;
11 | import android.graphics.Rect;
12 | import android.graphics.Bitmap.Config;
13 | import android.graphics.drawable.GradientDrawable;
14 | import android.graphics.drawable.LayerDrawable;
15 | import android.util.AttributeSet;
16 | import android.view.MotionEvent;
17 | import android.widget.TextView;
18 |
19 | public abstract class Button extends CustomView {
20 |
21 | final static String ANDROIDXML = "http://schemas.android.com/apk/res/android";
22 |
23 | // Complete in child class
24 | int minWidth;
25 | int minHeight;
26 | int background;
27 | float rippleSpeed = 12f;
28 | int rippleSize = 3;
29 | Integer rippleColor;
30 | OnClickListener onClickListener;
31 | boolean clickAfterRipple = true;
32 | int backgroundColor = Color.parseColor("#1E88E5");
33 | TextView textButton;
34 |
35 | public Button(Context context, AttributeSet attrs) {
36 | super(context, attrs);
37 | setDefaultProperties();
38 | clickAfterRipple = attrs.getAttributeBooleanValue(MATERIALDESIGNXML,
39 | "animate", true);
40 | setAttributes(attrs);
41 | beforeBackground = backgroundColor;
42 | if (rippleColor == null)
43 | rippleColor = makePressColor();
44 | }
45 |
46 | protected void setDefaultProperties() {
47 | // Min size
48 | setMinimumHeight(Utils.dpToPx(minHeight, getResources()));
49 | setMinimumWidth(Utils.dpToPx(minWidth, getResources()));
50 | // Background shape
51 | setBackgroundResource(background);
52 | setBackgroundColor(backgroundColor);
53 | }
54 |
55 | // Set atributtes of XML to View
56 | abstract protected void setAttributes(AttributeSet attrs);
57 |
58 | // ### RIPPLE EFFECT ###
59 |
60 | float x = -1, y = -1;
61 | float radius = -1;
62 |
63 | @Override
64 | public boolean onTouchEvent(MotionEvent event) {
65 | invalidate();
66 | if (isEnabled()) {
67 | isLastTouch = true;
68 | if (event.getAction() == MotionEvent.ACTION_DOWN) {
69 | radius = getHeight() / rippleSize;
70 | x = event.getX();
71 | y = event.getY();
72 | } else if (event.getAction() == MotionEvent.ACTION_MOVE) {
73 | radius = getHeight() / rippleSize;
74 | x = event.getX();
75 | y = event.getY();
76 | if (!((event.getX() <= getWidth() && event.getX() >= 0) && (event
77 | .getY() <= getHeight() && event.getY() >= 0))) {
78 | isLastTouch = false;
79 | x = -1;
80 | y = -1;
81 | }
82 | } else if (event.getAction() == MotionEvent.ACTION_UP) {
83 | if ((event.getX() <= getWidth() && event.getX() >= 0)
84 | && (event.getY() <= getHeight() && event.getY() >= 0)) {
85 | radius++;
86 | if (!clickAfterRipple && onClickListener != null) {
87 | onClickListener.onClick(this);
88 | }
89 | } else {
90 | isLastTouch = false;
91 | x = -1;
92 | y = -1;
93 | }
94 | } else if (event.getAction() == MotionEvent.ACTION_CANCEL) {
95 | isLastTouch = false;
96 | x = -1;
97 | y = -1;
98 | }
99 | }
100 | return true;
101 | }
102 |
103 | @Override
104 | protected void onFocusChanged(boolean gainFocus, int direction,
105 | Rect previouslyFocusedRect) {
106 | if (!gainFocus) {
107 | x = -1;
108 | y = -1;
109 | }
110 | }
111 |
112 | @Override
113 | public boolean onInterceptTouchEvent(MotionEvent ev) {
114 | // super.onInterceptTouchEvent(ev);
115 | return true;
116 | }
117 |
118 | public Bitmap makeCircle() {
119 | Bitmap output = Bitmap.createBitmap(
120 | getWidth() - Utils.dpToPx(6, getResources()), getHeight()
121 | - Utils.dpToPx(7, getResources()), Config.ARGB_8888);
122 | Canvas canvas = new Canvas(output);
123 | canvas.drawARGB(0, 0, 0, 0);
124 | Paint paint = new Paint();
125 | paint.setAntiAlias(true);
126 | paint.setColor(rippleColor);
127 | canvas.drawCircle(x, y, radius, paint);
128 | if (radius > getHeight() / rippleSize)
129 | radius += rippleSpeed;
130 | if (radius >= getWidth()) {
131 | x = -1;
132 | y = -1;
133 | radius = getHeight() / rippleSize;
134 | if (onClickListener != null && clickAfterRipple)
135 | onClickListener.onClick(this);
136 | }
137 | return output;
138 | }
139 |
140 | /**
141 | * Make a dark color to ripple effect
142 | *
143 | * @return
144 | */
145 | protected int makePressColor() {
146 | int r = (this.backgroundColor >> 16) & 0xFF;
147 | int g = (this.backgroundColor >> 8) & 0xFF;
148 | int b = (this.backgroundColor >> 0) & 0xFF;
149 | r = (r - 30 < 0) ? 0 : r - 30;
150 | g = (g - 30 < 0) ? 0 : g - 30;
151 | b = (b - 30 < 0) ? 0 : b - 30;
152 | return Color.rgb(r, g, b);
153 | }
154 |
155 | @Override
156 | public void setOnClickListener(OnClickListener l) {
157 | onClickListener = l;
158 | }
159 |
160 | // Set color of background
161 | public void setBackgroundColor(int color) {
162 | this.backgroundColor = color;
163 | if (isEnabled())
164 | beforeBackground = backgroundColor;
165 | try {
166 | LayerDrawable layer = (LayerDrawable) getBackground();
167 | GradientDrawable shape = (GradientDrawable) layer
168 | .findDrawableByLayerId(R.id.shape_bacground);
169 | shape.setColor(backgroundColor);
170 | rippleColor = makePressColor();
171 | } catch (Exception ex) {
172 | // Without bacground
173 | }
174 | }
175 |
176 | public void setRippleSpeed(float rippleSpeed) {
177 | this.rippleSpeed = rippleSpeed;
178 | }
179 |
180 | public float getRippleSpeed() {
181 | return this.rippleSpeed;
182 | }
183 |
184 | public void setText(String text) {
185 | textButton.setText(text);
186 | }
187 |
188 | public void setTextColor(int color) {
189 | textButton.setTextColor(color);
190 | }
191 |
192 | public TextView getTextView() {
193 | return textButton;
194 | }
195 |
196 | public String getText() {
197 | return textButton.getText().toString();
198 | }
199 | }
200 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonFlat.java:
--------------------------------------------------------------------------------
1 | package com.gc.materialdesign.views;
2 |
3 | import com.gc.materialdesign.R;
4 | import com.gc.materialdesign.utils.Utils;
5 |
6 | import android.content.Context;
7 | import android.graphics.Canvas;
8 | import android.graphics.Color;
9 | import android.graphics.Paint;
10 | import android.graphics.Typeface;
11 | import android.util.AttributeSet;
12 | import android.widget.RelativeLayout;
13 | import android.widget.TextView;
14 |
15 | public class ButtonFlat extends Button {
16 |
17 | TextView textButton;
18 |
19 | public ButtonFlat(Context context, AttributeSet attrs) {
20 | super(context, attrs);
21 |
22 | }
23 |
24 | protected void setDefaultProperties(){
25 | minHeight = 36;
26 | minWidth = 88;
27 | rippleSize = 3;
28 | // Min size
29 | setMinimumHeight(Utils.dpToPx(minHeight, getResources()));
30 | setMinimumWidth(Utils.dpToPx(minWidth, getResources()));
31 | setBackgroundResource(R.drawable.background_transparent);
32 | }
33 |
34 | @Override
35 | protected void setAttributes(AttributeSet attrs) {
36 | // Set text button
37 | String text = null;
38 | int textResource = attrs.getAttributeResourceValue(ANDROIDXML,"text",-1);
39 | if(textResource != -1){
40 | text = getResources().getString(textResource);
41 | }else{
42 | text = attrs.getAttributeValue(ANDROIDXML,"text");
43 | }
44 | if(text != null){
45 | textButton = new TextView(getContext());
46 | textButton.setText(text.toUpperCase());
47 | textButton.setTextColor(backgroundColor);
48 | textButton.setTypeface(null, Typeface.BOLD);
49 | RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
50 | params.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
51 | textButton.setLayoutParams(params);
52 | addView(textButton);
53 | }
54 | int bacgroundColor = attrs.getAttributeResourceValue(ANDROIDXML,"background",-1);
55 | if(bacgroundColor != -1){
56 | setBackgroundColor(getResources().getColor(bacgroundColor));
57 | }else{
58 | // Color by hexadecimal
59 | // Color by hexadecimal
60 | background = attrs.getAttributeIntValue(ANDROIDXML, "background", -1);
61 | if (background != -1)
62 | setBackgroundColor(background);
63 | }
64 | }
65 |
66 |
67 | @Override
68 | protected void onDraw(Canvas canvas) {
69 | super.onDraw(canvas);
70 | if (x != -1) {
71 |
72 | Paint paint = new Paint();
73 | paint.setAntiAlias(true);
74 | paint.setColor(makePressColor());
75 | canvas.drawCircle(x, y, radius, paint);
76 | if(radius > getHeight()/rippleSize)
77 | radius += rippleSpeed;
78 | if(radius >= getWidth()){
79 | x = -1;
80 | y = -1;
81 | radius = getHeight()/rippleSize;
82 | if(onClickListener != null&& clickAfterRipple)
83 | onClickListener.onClick(this);
84 | }
85 | invalidate();
86 | }
87 |
88 | }
89 |
90 | /**
91 | * Make a dark color to ripple effect
92 | * @return
93 | */
94 | @Override
95 | protected int makePressColor(){
96 | return Color.parseColor("#88DDDDDD");
97 | }
98 |
99 | public void setText(String text){
100 | textButton.setText(text.toUpperCase());
101 | }
102 |
103 | // Set color of background
104 | public void setBackgroundColor(int color){
105 | backgroundColor = color;
106 | if(isEnabled())
107 | beforeBackground = backgroundColor;
108 | textButton.setTextColor(color);
109 | }
110 |
111 | @Override
112 | public TextView getTextView() {
113 | return textButton;
114 | }
115 |
116 | public String getText(){
117 | return textButton.getText().toString();
118 | }
119 |
120 | }
121 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonFloat.java:
--------------------------------------------------------------------------------
1 | package com.gc.materialdesign.views;
2 |
3 | import com.gc.materialdesign.R;
4 | import com.gc.materialdesign.utils.Utils;
5 | import com.nineoldandroids.animation.ObjectAnimator;
6 | import com.nineoldandroids.view.ViewHelper;
7 |
8 | import android.annotation.SuppressLint;
9 | import android.content.Context;
10 | import android.graphics.Bitmap;
11 | import android.graphics.Canvas;
12 | import android.graphics.Color;
13 | import android.graphics.Paint;
14 | import android.graphics.PorterDuff.Mode;
15 | import android.graphics.PorterDuffXfermode;
16 | import android.graphics.Rect;
17 | import android.graphics.Bitmap.Config;
18 | import android.graphics.drawable.Drawable;
19 | import android.graphics.drawable.GradientDrawable;
20 | import android.graphics.drawable.LayerDrawable;
21 | import android.util.AttributeSet;
22 | import android.view.animation.BounceInterpolator;
23 | import android.widget.ImageView;
24 | import android.widget.ImageView.ScaleType;
25 | import android.widget.RelativeLayout;
26 | import android.widget.TextView;
27 |
28 |
29 | public class ButtonFloat extends Button{
30 |
31 | int sizeIcon = 24;
32 | int sizeRadius = 28;
33 |
34 |
35 | ImageView icon; // Icon of float button
36 | Drawable drawableIcon;
37 |
38 | public boolean isShow = false;
39 |
40 | float showPosition;
41 | float hidePosition;
42 |
43 |
44 |
45 | public ButtonFloat(Context context, AttributeSet attrs) {
46 | super(context, attrs);
47 | setBackgroundResource(R.drawable.background_button_float);
48 | setBackgroundColor(backgroundColor);
49 | sizeRadius = 28;
50 | setDefaultProperties();
51 | icon = new ImageView(context);
52 | icon.setAdjustViewBounds(true);
53 | icon.setScaleType(ScaleType.CENTER_CROP);
54 | if(drawableIcon != null) {
55 | icon.setImageDrawable(drawableIcon);
56 | }
57 | LayoutParams params = new LayoutParams(Utils.dpToPx(sizeIcon, getResources()),Utils.dpToPx(sizeIcon, getResources()));
58 | params.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
59 | icon.setLayoutParams(params);
60 | addView(icon);
61 |
62 | }
63 |
64 | protected void setDefaultProperties(){
65 | rippleSpeed = Utils.dpToPx(2, getResources());
66 | rippleSize = Utils.dpToPx(5, getResources());
67 | setMinimumWidth(Utils.dpToPx(sizeRadius*2, getResources()));
68 | setMinimumHeight(Utils.dpToPx(sizeRadius*2, getResources()));
69 | super.background = R.drawable.background_button_float;
70 | // super.setDefaultProperties();
71 | }
72 |
73 |
74 | // Set atributtes of XML to View
75 | protected void setAttributes(AttributeSet attrs){
76 | //Set background Color
77 | // Color by resource
78 | int bacgroundColor = attrs.getAttributeResourceValue(ANDROIDXML,"background",-1);
79 | if(bacgroundColor != -1){
80 | setBackgroundColor(getResources().getColor(bacgroundColor));
81 | }else{
82 | // Color by hexadecimal
83 | background = attrs.getAttributeIntValue(ANDROIDXML, "background", -1);
84 | if (background != -1)
85 | setBackgroundColor(background);
86 | }
87 |
88 | // Set Ripple Color
89 | // Color by resource
90 | int rippleColor = attrs.getAttributeResourceValue(MATERIALDESIGNXML,
91 | "rippleColor", -1);
92 | if (rippleColor != -1) {
93 | setRippleColor(getResources().getColor(rippleColor));
94 | } else {
95 | // Color by hexadecimal
96 | int background = attrs.getAttributeIntValue(MATERIALDESIGNXML, "rippleColor", -1);
97 | if (background != -1)
98 | setRippleColor(background);
99 | else
100 | setRippleColor(makePressColor());
101 | }
102 | // Icon of button
103 | int iconResource = attrs.getAttributeResourceValue(MATERIALDESIGNXML,"iconDrawable",-1);
104 | if(iconResource != -1)
105 | drawableIcon = getResources().getDrawable(iconResource);
106 | final boolean animate = attrs.getAttributeBooleanValue(MATERIALDESIGNXML,"animate", false);
107 | post(new Runnable() {
108 |
109 | @Override
110 | public void run() {
111 | showPosition = ViewHelper.getY(ButtonFloat.this) - Utils.dpToPx(24, getResources());
112 | hidePosition = ViewHelper.getY(ButtonFloat.this) + getHeight() * 3;
113 | if(animate){
114 | ViewHelper.setY(ButtonFloat.this, hidePosition);
115 | show();
116 | }
117 | }
118 | });
119 |
120 | }
121 |
122 | Integer height;
123 | Integer width;
124 | @Override
125 | protected void onDraw(Canvas canvas) {
126 | super.onDraw(canvas);
127 | if (x != -1) {
128 | Rect src = new Rect(0, 0, getWidth(), getHeight());
129 | Rect dst = new Rect(Utils.dpToPx(1, getResources()), Utils.dpToPx(2, getResources()), getWidth()-Utils.dpToPx(1, getResources()), getHeight()-Utils.dpToPx(2, getResources()));
130 | canvas.drawBitmap(cropCircle(makeCircle()), src, dst, null);
131 | invalidate();
132 | }
133 | }
134 |
135 |
136 |
137 |
138 | public ImageView getIcon() {
139 | return icon;
140 | }
141 |
142 | public void setIcon(ImageView icon) {
143 | this.icon = icon;
144 | }
145 |
146 | public Drawable getDrawableIcon() {
147 | return drawableIcon;
148 | }
149 |
150 | public void setDrawableIcon(Drawable drawableIcon) {
151 | this.drawableIcon = drawableIcon;
152 | try {
153 | icon.setBackground(drawableIcon);
154 | } catch (NoSuchMethodError e) {
155 | icon.setBackgroundDrawable(drawableIcon);
156 | }
157 | }
158 |
159 | public Bitmap cropCircle(Bitmap bitmap) {
160 | Bitmap output = Bitmap.createBitmap(bitmap.getWidth(),
161 | bitmap.getHeight(), Config.ARGB_8888);
162 | Canvas canvas = new Canvas(output);
163 |
164 | final int color = 0xff424242;
165 | final Paint paint = new Paint();
166 | final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
167 |
168 | paint.setAntiAlias(true);
169 | canvas.drawARGB(0, 0, 0, 0);
170 | paint.setColor(color);
171 | canvas.drawCircle(bitmap.getWidth() / 2, bitmap.getHeight() / 2,
172 | bitmap.getWidth()/2, paint);
173 | paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
174 | canvas.drawBitmap(bitmap, rect, rect, paint);
175 | return output;
176 | }
177 |
178 | @Override
179 | public TextView getTextView() {
180 | return null;
181 | }
182 |
183 | public void setRippleColor(int rippleColor) {
184 | this.rippleColor = rippleColor;
185 | }
186 |
187 | public void show(){
188 | ObjectAnimator animator = ObjectAnimator.ofFloat(ButtonFloat.this, "y", showPosition);
189 | animator.setInterpolator(new BounceInterpolator());
190 | animator.setDuration(1500);
191 | animator.start();
192 | isShow = true;
193 | }
194 |
195 | public void hide(){
196 |
197 | ObjectAnimator animator = ObjectAnimator.ofFloat(ButtonFloat.this, "y", hidePosition);
198 | animator.setInterpolator(new BounceInterpolator());
199 | animator.setDuration(1500);
200 | animator.start();
201 |
202 | isShow = false;
203 | }
204 |
205 | public boolean isShow(){
206 | return isShow;
207 | }
208 |
209 | }
210 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonFloatSmall.java:
--------------------------------------------------------------------------------
1 | package com.gc.materialdesign.views;
2 |
3 | import com.gc.materialdesign.R;
4 | import com.gc.materialdesign.utils.Utils;
5 |
6 | import android.content.Context;
7 | import android.util.AttributeSet;
8 | import android.widget.RelativeLayout;
9 |
10 | public class ButtonFloatSmall extends ButtonFloat {
11 |
12 | public ButtonFloatSmall(Context context, AttributeSet attrs) {
13 | super(context, attrs);
14 | sizeRadius = 20;
15 | sizeIcon = 20;
16 | setDefaultProperties();
17 | LayoutParams params = new LayoutParams(Utils.dpToPx(sizeIcon, getResources()),Utils.dpToPx(sizeIcon, getResources()));
18 | params.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
19 | icon.setLayoutParams(params);
20 | }
21 |
22 | protected void setDefaultProperties(){
23 | rippleSpeed = Utils.dpToPx(2, getResources());
24 | rippleSize = 10;
25 | // Min size
26 | setMinimumHeight(Utils.dpToPx(sizeRadius*2, getResources()));
27 | setMinimumWidth(Utils.dpToPx(sizeRadius*2, getResources()));
28 | // Background shape
29 | setBackgroundResource(R.drawable.background_button_float);
30 | // setBackgroundColor(backgroundColor);
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonIcon.java:
--------------------------------------------------------------------------------
1 | package com.gc.materialdesign.views;
2 |
3 | import com.gc.materialdesign.utils.Utils;
4 |
5 | import android.R;
6 | import android.content.Context;
7 | import android.graphics.Canvas;
8 | import android.graphics.Paint;
9 | import android.graphics.Rect;
10 | import android.graphics.drawable.ColorDrawable;
11 | import android.util.AttributeSet;
12 | import android.view.MotionEvent;
13 |
14 | public class ButtonIcon extends ButtonFloat {
15 |
16 | public ButtonIcon(Context context, AttributeSet attrs) {
17 | super(context, attrs);
18 | try {
19 | setBackground(new ColorDrawable(getResources().getColor(R.color.transparent)));
20 | } catch (NoSuchMethodError e) {
21 | setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.transparent)));
22 | }
23 | rippleSpeed = Utils.dpToPx(2, getResources());
24 | rippleSize = Utils.dpToPx(5, getResources());
25 | }
26 |
27 | @Override
28 | public boolean onTouchEvent(MotionEvent event) {
29 | boolean returnBool = super.onTouchEvent(event);
30 | if(x != -1){
31 | x = getWidth() / 2;
32 | y = getHeight() / 2;
33 | }
34 | return returnBool;
35 | }
36 |
37 | @Override
38 | protected void onDraw(Canvas canvas) {
39 | if (x != -1) {
40 | Paint paint = new Paint();
41 | paint.setAntiAlias(true);
42 | paint.setColor(makePressColor());
43 | canvas.drawCircle(x, y, radius, paint);
44 | if(radius > getHeight()/rippleSize)
45 | radius += rippleSpeed;
46 | if(radius >= getWidth() / 2 - rippleSpeed){
47 | x = -1;
48 | y = -1;
49 | radius = getHeight()/rippleSize;
50 | if(onClickListener != null && clickAfterRipple)
51 | onClickListener.onClick(this);
52 | }
53 | invalidate();
54 | }
55 | }
56 |
57 | @Override
58 | protected int makePressColor() {
59 | return backgroundColor;
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonRectangle.java:
--------------------------------------------------------------------------------
1 | package com.gc.materialdesign.views;
2 |
3 | import com.gc.materialdesign.R;
4 | import com.gc.materialdesign.utils.Utils;
5 |
6 | import android.content.Context;
7 | import android.content.res.TypedArray;
8 | import android.graphics.Canvas;
9 | import android.graphics.Color;
10 | import android.graphics.Rect;
11 | import android.graphics.Typeface;
12 | import android.util.AttributeSet;
13 | import android.widget.RelativeLayout;
14 | import android.widget.TextView;
15 |
16 | public class ButtonRectangle extends Button {
17 |
18 | TextView textButton;
19 |
20 | int paddingTop,paddingBottom, paddingLeft, paddingRight;
21 |
22 |
23 | public ButtonRectangle(Context context, AttributeSet attrs) {
24 | super(context, attrs);
25 | setDefaultProperties();
26 | }
27 | @Override
28 | protected void setDefaultProperties(){
29 | // paddingBottom = Utils.dpToPx(16, getResources());
30 | // paddingLeft = Utils.dpToPx(16, getResources());
31 | // paddingRight = Utils.dpToPx(16, getResources());
32 | // paddingTop = Utils.dpToPx(16, getResources());
33 | super.minWidth = 80;
34 | super.minHeight = 36;
35 | super.background = R.drawable.background_button_rectangle;
36 | super.setDefaultProperties();
37 | }
38 |
39 |
40 | // Set atributtes of XML to View
41 | protected void setAttributes(AttributeSet attrs){
42 |
43 | //Set background Color
44 | // Color by resource
45 | int bacgroundColor = attrs.getAttributeResourceValue(ANDROIDXML,"background",-1);
46 | if(bacgroundColor != -1){
47 | setBackgroundColor(getResources().getColor(bacgroundColor));
48 | }else{
49 | // Color by hexadecimal
50 | // Color by hexadecimal
51 | background = attrs.getAttributeIntValue(ANDROIDXML, "background", -1);
52 | if (background != -1)
53 | setBackgroundColor(background);
54 | }
55 |
56 | // Set Padding
57 | String value = attrs.getAttributeValue(ANDROIDXML,"padding");
58 | // if(value != null){
59 | // float padding = Float.parseFloat(value.replace("dip", ""));
60 | // paddingBottom = Utils.dpToPx(padding, getResources());
61 | // paddingLeft = Utils.dpToPx(padding, getResources());
62 | // paddingRight = Utils.dpToPx(padding, getResources());
63 | // paddingTop = Utils.dpToPx(padding, getResources());
64 | // }else{
65 | // value = attrs.getAttributeValue(ANDROIDXML,"paddingLeft");
66 | // paddingLeft = (value == null) ? paddingLeft : (int) Float.parseFloat(value.replace("dip", ""));
67 | // value = attrs.getAttributeValue(ANDROIDXML,"paddingTop");
68 | // paddingTop = (value == null) ? paddingTop : (int) Float.parseFloat(value.replace("dip", ""));
69 | // value = attrs.getAttributeValue(ANDROIDXML,"paddingRight");
70 | // paddingRight = (value == null) ? paddingRight : (int) Float.parseFloat(value.replace("dip", ""));
71 | // value = attrs.getAttributeValue(ANDROIDXML,"paddingBottom");
72 | // paddingBottom = (value == null) ? paddingBottom : (int) Float.parseFloat(value.replace("dip", ""));
73 | // }
74 |
75 |
76 | // Set text button
77 | String text = null;
78 | int textResource = attrs.getAttributeResourceValue(ANDROIDXML,"text",-1);
79 | if(textResource != -1){
80 | text = getResources().getString(textResource);
81 | }else{
82 | text = attrs.getAttributeValue(ANDROIDXML,"text");
83 | }
84 | if(text != null){
85 | textButton = new TextView(getContext());
86 | textButton.setText(text);
87 | textButton.setTextColor(Color.WHITE);
88 | textButton.setTypeface(null, Typeface.BOLD);
89 | LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
90 | params.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
91 | params.setMargins(Utils.dpToPx(5, getResources()), Utils.dpToPx(5, getResources()), Utils.dpToPx(5, getResources()), Utils.dpToPx(5, getResources()));
92 | textButton.setLayoutParams(params);
93 | addView(textButton);
94 | // FrameLayout.LayoutParams params = (LayoutParams) textView.getLayoutParams();
95 | // params.width = getWidth();
96 | // params.gravity = Gravity.CENTER_HORIZONTAL;
97 | //// params.setMargins(paddingLeft, paddingTop, paddingRight, paddingRight);
98 | // textView.setLayoutParams(params);textColor
99 | int textColor = attrs.getAttributeResourceValue(ANDROIDXML,"textColor",-1);
100 | if(textColor != -1){
101 | textButton.setTextColor(textColor);
102 | }else{
103 | // Color by hexadecimal
104 | // Color by hexadecimal
105 | textColor = attrs.getAttributeIntValue(ANDROIDXML, "textColor", -1);
106 | if (textColor != -1)
107 | textButton.setTextColor(textColor);
108 | }
109 | int[] array = {android.R.attr.textSize};
110 | TypedArray values = getContext().obtainStyledAttributes(attrs, array);
111 | float textSize = values.getDimension(0, -1);
112 | values.recycle();
113 | if(textSize != -1)
114 | textButton.setTextSize(textSize);
115 |
116 | }
117 |
118 | rippleSpeed = attrs.getAttributeFloatValue(MATERIALDESIGNXML,
119 | "rippleSpeed", Utils.dpToPx(6, getResources()));
120 | }
121 |
122 | // /**
123 | // * Center text in button
124 | // */
125 | // boolean txtCenter = false;
126 | // private void centrarTexto(){
127 | // if((textButton.getWidth()+paddingLeft+paddingRight)>Utils.dpToPx(80, getResources()))
128 | // setMinimumWidth(textButton.getWidth()+paddingLeft+paddingRight);
129 | // setMinimumHeight(textButton.getHeight()+paddingBottom+paddingTop);
130 | // textButton.setX(getWidth()/2-textButton.getWidth()/2 - paddingTop + paddingBottom);
131 | // textButton.setY(getHeight()/2-textButton.getHeight()/2 - paddingLeft + paddingRight);
132 | // txtCenter = true;
133 | // }
134 |
135 | Integer height;
136 | Integer width;
137 | @Override
138 | protected void onDraw(Canvas canvas) {
139 | // if(!txtCenter)
140 | // centrarTexto();
141 | super.onDraw(canvas);
142 | if (x != -1) {
143 | Rect src = new Rect(0, 0, getWidth()-Utils.dpToPx(6, getResources()), getHeight()-Utils.dpToPx(7, getResources()));
144 | Rect dst = new Rect(Utils.dpToPx(6, getResources()), Utils.dpToPx(6, getResources()), getWidth()-Utils.dpToPx(6, getResources()), getHeight()-Utils.dpToPx(7, getResources()));
145 | canvas.drawBitmap(makeCircle(), src, dst, null);
146 | invalidate();
147 | }
148 | }
149 |
150 | }
151 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/Card.java:
--------------------------------------------------------------------------------
1 | package com.gc.materialdesign.views;
2 |
3 | import com.gc.materialdesign.R;
4 | import com.gc.materialdesign.utils.Utils;
5 |
6 | import android.content.Context;
7 | import android.graphics.Bitmap;
8 | import android.graphics.Bitmap.Config;
9 | import android.graphics.Canvas;
10 | import android.graphics.Color;
11 | import android.graphics.Paint;
12 | import android.graphics.Rect;
13 | import android.graphics.Typeface;
14 | import android.graphics.drawable.GradientDrawable;
15 | import android.graphics.drawable.LayerDrawable;
16 | import android.util.AttributeSet;
17 | import android.util.Log;
18 | import android.view.Gravity;
19 | import android.view.MotionEvent;
20 | import android.widget.FrameLayout;
21 | import android.widget.LinearLayout;
22 | import android.widget.RelativeLayout;
23 | import android.widget.TextView;
24 | import android.widget.Toast;
25 | import android.widget.RelativeLayout.LayoutParams;
26 |
27 | public class Card extends CustomView {
28 |
29 | TextView textButton;
30 |
31 | int paddingTop,paddingBottom, paddingLeft, paddingRight;
32 | int backgroundColor = Color.parseColor("#FFFFFF");
33 |
34 | public Card(Context context, AttributeSet attrs) {
35 | super(context, attrs);
36 | setAttributes(attrs);
37 | }
38 |
39 |
40 | // Set atributtes of XML to View
41 | protected void setAttributes(AttributeSet attrs){
42 |
43 | setBackgroundResource(R.drawable.background_button_rectangle);
44 | //Set background Color
45 | // Color by resource
46 | int bacgroundColor = attrs.getAttributeResourceValue(ANDROIDXML,"background",-1);
47 | if(bacgroundColor != -1){
48 | setBackgroundColor(getResources().getColor(bacgroundColor));
49 | }else{
50 | // Color by hexadecimal
51 | String background = attrs.getAttributeValue(ANDROIDXML,"background");
52 | if(background != null)
53 | setBackgroundColor(Color.parseColor(background));
54 | else
55 | setBackgroundColor(this.backgroundColor);
56 | }
57 | }
58 |
59 | // Set color of background
60 | public void setBackgroundColor(int color){
61 | this.backgroundColor = color;
62 | if(isEnabled())
63 | beforeBackground = backgroundColor;
64 | LayerDrawable layer = (LayerDrawable) getBackground();
65 | GradientDrawable shape = (GradientDrawable) layer.findDrawableByLayerId(R.id.shape_bacground);
66 | shape.setColor(backgroundColor);
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/CheckBox.java:
--------------------------------------------------------------------------------
1 | package com.gc.materialdesign.views;
2 |
3 | import com.gc.materialdesign.R;
4 | import com.gc.materialdesign.utils.Utils;
5 |
6 | import android.content.Context;
7 | import android.graphics.Bitmap;
8 | import android.graphics.BitmapFactory;
9 | import android.graphics.Canvas;
10 | import android.graphics.Color;
11 | import android.graphics.Paint;
12 | import android.graphics.Rect;
13 | import android.graphics.drawable.GradientDrawable;
14 | import android.graphics.drawable.LayerDrawable;
15 | import android.util.AttributeSet;
16 | import android.view.MotionEvent;
17 | import android.view.View;
18 | import android.widget.RelativeLayout;
19 | import android.widget.TextView;
20 |
21 | public class CheckBox extends CustomView {
22 |
23 | int backgroundColor = Color.parseColor("#4CAF50");
24 |
25 | Check checkView;
26 |
27 | boolean press = false;
28 | boolean check = false;
29 |
30 | OnCheckListener onCheckListener;
31 |
32 | public CheckBox(Context context, AttributeSet attrs) {
33 | super(context, attrs);
34 | setAttributes(attrs);
35 | }
36 |
37 | // Set atributtes of XML to View
38 | protected void setAttributes(AttributeSet attrs) {
39 |
40 | setBackgroundResource(R.drawable.background_checkbox);
41 |
42 | // Set size of view
43 | setMinimumHeight(Utils.dpToPx(48, getResources()));
44 | setMinimumWidth(Utils.dpToPx(48, getResources()));
45 |
46 | // Set background Color
47 | // Color by resource
48 | int bacgroundColor = attrs.getAttributeResourceValue(ANDROIDXML,
49 | "background", -1);
50 | if (bacgroundColor != -1) {
51 | setBackgroundColor(getResources().getColor(bacgroundColor));
52 | } else {
53 | // Color by hexadecimal
54 | // Color by hexadecimal
55 | int background = attrs.getAttributeIntValue(ANDROIDXML, "background", -1);
56 | if (background != -1)
57 | setBackgroundColor(background);
58 | }
59 |
60 | final boolean check = attrs.getAttributeBooleanValue(MATERIALDESIGNXML,
61 | "check", false);
62 | post(new Runnable() {
63 |
64 | @Override
65 | public void run() {
66 | setChecked(check);
67 | setPressed(false);
68 | changeBackgroundColor(getResources().getColor(
69 | android.R.color.transparent));
70 | }
71 | });
72 |
73 | checkView = new Check(getContext());
74 | checkView.setId(View.generateViewId());
75 | RelativeLayout.LayoutParams params = new LayoutParams(Utils.dpToPx(20,
76 | getResources()), Utils.dpToPx(20, getResources()));
77 | params.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
78 | checkView.setLayoutParams(params);
79 | addView(checkView);
80 |
81 | // Adding text view to checkbox
82 | int textResource = attrs.getAttributeResourceValue(ANDROIDXML, "text", -1);
83 | String text = null;
84 |
85 | if(textResource != -1) {
86 | text = getResources().getString(textResource);
87 | } else {
88 | text = attrs.getAttributeValue(ANDROIDXML, "text");
89 | }
90 |
91 | if(text != null) {
92 | params.removeRule(RelativeLayout.CENTER_IN_PARENT);
93 | params.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
94 | TextView textView = new TextView(getContext());
95 | RelativeLayout.LayoutParams textViewLayoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT,
96 | LayoutParams.WRAP_CONTENT);
97 | textViewLayoutParams.addRule(RelativeLayout.RIGHT_OF, checkView.getId());
98 | textViewLayoutParams.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
99 | textViewLayoutParams.setMargins(10, 0, 0, 0);
100 | textView.setLayoutParams(textViewLayoutParams);
101 | textView.setText(text);
102 |
103 | addView(textView);
104 | }
105 | }
106 |
107 | @Override
108 | public void invalidate() {
109 | checkView.invalidate();
110 | super.invalidate();
111 | }
112 |
113 |
114 | @Override
115 | public boolean onTouchEvent(MotionEvent event) {
116 | invalidate();
117 | if (isEnabled()) {
118 | isLastTouch = true;
119 | if (event.getAction() == MotionEvent.ACTION_DOWN) {
120 | changeBackgroundColor((check) ? makePressColor() : Color
121 | .parseColor("#446D6D6D"));
122 | } else if (event.getAction() == MotionEvent.ACTION_UP) {
123 | changeBackgroundColor(getResources().getColor(
124 | android.R.color.transparent));
125 | press = false;
126 | if ((event.getX() <= getWidth() && event.getX() >= 0)
127 | && (event.getY() <= getHeight() && event.getY() >= 0)) {
128 | isLastTouch = false;
129 | check = !check;
130 | if (onCheckListener != null)
131 | onCheckListener.onCheck(CheckBox.this, check);
132 | if (check) {
133 | step = 0;
134 | }
135 | if (check)
136 | checkView.changeBackground();
137 | }
138 | }
139 | }
140 | return true;
141 | }
142 |
143 | @Override
144 | protected void onDraw(Canvas canvas) {
145 | super.onDraw(canvas);
146 | if (press) {
147 | Paint paint = new Paint();
148 | paint.setAntiAlias(true);
149 | paint.setColor((check) ? makePressColor() : Color
150 | .parseColor("#446D6D6D"));
151 | canvas.drawCircle(getWidth() / 2, getHeight() / 2, getWidth() / 2,
152 | paint);
153 | invalidate();
154 | }
155 | }
156 |
157 | private void changeBackgroundColor(int color) {
158 | LayerDrawable layer = (LayerDrawable) getBackground();
159 | GradientDrawable shape = (GradientDrawable) layer
160 | .findDrawableByLayerId(R.id.shape_bacground);
161 | shape.setColor(color);
162 | }
163 |
164 | /**
165 | * Make a dark color to press effect
166 | *
167 | * @return
168 | */
169 | protected int makePressColor() {
170 | int r = (this.backgroundColor >> 16) & 0xFF;
171 | int g = (this.backgroundColor >> 8) & 0xFF;
172 | int b = (this.backgroundColor >> 0) & 0xFF;
173 | r = (r - 30 < 0) ? 0 : r - 30;
174 | g = (g - 30 < 0) ? 0 : g - 30;
175 | b = (b - 30 < 0) ? 0 : b - 30;
176 | return Color.argb(70, r, g, b);
177 | }
178 |
179 | @Override
180 | public void setBackgroundColor(int color) {
181 | backgroundColor = color;
182 | if (isEnabled())
183 | beforeBackground = backgroundColor;
184 | changeBackgroundColor(color);
185 | }
186 |
187 | public void setChecked(boolean check) {
188 | invalidate();
189 | this.check = check;
190 | setPressed(false);
191 | changeBackgroundColor(getResources().getColor(
192 | android.R.color.transparent));
193 | if (check) {
194 | step = 0;
195 | }
196 | if (check)
197 | checkView.changeBackground();
198 |
199 | }
200 |
201 | public boolean isCheck() {
202 | return check;
203 | }
204 |
205 | // Indicate step in check animation
206 | int step = 0;
207 |
208 | // View that contains checkbox
209 | class Check extends View {
210 |
211 | Bitmap sprite;
212 |
213 | public Check(Context context) {
214 | super(context);
215 | setBackgroundResource(R.drawable.background_checkbox_uncheck);
216 | sprite = BitmapFactory.decodeResource(context.getResources(),
217 | R.drawable.sprite_check);
218 | }
219 |
220 | public void changeBackground() {
221 | if (check) {
222 | setBackgroundResource(R.drawable.background_checkbox_check);
223 | LayerDrawable layer = (LayerDrawable) getBackground();
224 | GradientDrawable shape = (GradientDrawable) layer
225 | .findDrawableByLayerId(R.id.shape_bacground);
226 | shape.setColor(backgroundColor);
227 | } else {
228 | setBackgroundResource(R.drawable.background_checkbox_uncheck);
229 | }
230 | }
231 |
232 | @Override
233 | protected void onDraw(Canvas canvas) {
234 | super.onDraw(canvas);
235 |
236 | if (check) {
237 | if (step < 11){
238 | step++;
239 | invalidate();
240 | }
241 | } else {
242 | if (step >= 0){
243 | step--;
244 | invalidate();
245 | }
246 | if (step == -1){
247 | invalidate();
248 | changeBackground();
249 | }
250 | }
251 | Rect src = new Rect(40 * step, 0, (40 * step) + 40, 40);
252 | Rect dst = new Rect(0, 0, this.getWidth() - 2, this.getHeight());
253 | canvas.drawBitmap(sprite, src, dst, null);
254 |
255 | }
256 |
257 | }
258 |
259 | public void setOncheckListener(OnCheckListener onCheckListener) {
260 | this.onCheckListener = onCheckListener;
261 | }
262 |
263 | public interface OnCheckListener {
264 | public void onCheck(CheckBox view, boolean check);
265 | }
266 |
267 | }
268 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/CustomView.java:
--------------------------------------------------------------------------------
1 | package com.gc.materialdesign.views;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.graphics.Color;
6 | import android.util.AttributeSet;
7 | import android.widget.RelativeLayout;
8 |
9 | public class CustomView extends RelativeLayout{
10 |
11 |
12 | final static String MATERIALDESIGNXML = "http://schemas.android.com/apk/res-auto";
13 | final static String ANDROIDXML = "http://schemas.android.com/apk/res/android";
14 |
15 | final int disabledBackgroundColor = Color.parseColor("#E2E2E2");
16 | int beforeBackground;
17 |
18 | // Indicate if user touched this view the last time
19 | public boolean isLastTouch = false;
20 |
21 | public CustomView(Context context, AttributeSet attrs) {
22 | super(context, attrs);
23 | }
24 |
25 | @Override
26 | public void setEnabled(boolean enabled) {
27 | super.setEnabled(enabled);
28 | if(enabled)
29 | setBackgroundColor(beforeBackground);
30 | else
31 | setBackgroundColor(disabledBackgroundColor);
32 | invalidate();
33 | }
34 |
35 | boolean animation = false;
36 |
37 | @Override
38 | protected void onAnimationStart() {
39 | super.onAnimationStart();
40 | animation = true;
41 | }
42 |
43 | @Override
44 | protected void onAnimationEnd() {
45 | super.onAnimationEnd();
46 | animation = false;
47 | }
48 |
49 | @Override
50 | protected void onDraw(Canvas canvas) {
51 | super.onDraw(canvas);
52 | if(animation)
53 | invalidate();
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/LayoutRipple.java:
--------------------------------------------------------------------------------
1 | package com.gc.materialdesign.views;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.graphics.Bitmap.Config;
6 | import android.graphics.Canvas;
7 | import android.graphics.Color;
8 | import android.graphics.Paint;
9 | import android.graphics.Rect;
10 | import android.util.AttributeSet;
11 | import android.view.MotionEvent;
12 |
13 | public class LayoutRipple extends CustomView {
14 |
15 | int background;
16 | float rippleSpeed = 10f;
17 | int rippleSize = 3;
18 |
19 | OnClickListener onClickListener;
20 | int backgroundColor = Color.parseColor("#FFFFFF");
21 |
22 | Integer rippleColor;
23 | Float xRippleOrigin;
24 | Float yRippleOrigin;
25 |
26 | public LayoutRipple(Context context, AttributeSet attrs) {
27 | super(context, attrs);
28 | setAttributes(attrs);
29 | }
30 |
31 | // Set atributtes of XML to View
32 | protected void setAttributes(AttributeSet attrs) {
33 |
34 | // Set background Color
35 | // Color by resource
36 | int bacgroundColor = attrs.getAttributeResourceValue(ANDROIDXML,
37 | "background", -1);
38 | if (bacgroundColor != -1) {
39 | setBackgroundColor(getResources().getColor(bacgroundColor));
40 | } else {
41 | // Color by hexadecimal
42 | background = attrs.getAttributeIntValue(ANDROIDXML, "background", -1);
43 | if (background != -1)
44 | setBackgroundColor(background);
45 | else
46 | setBackgroundColor(this.backgroundColor);
47 | }
48 | // Set Ripple Color
49 | // Color by resource
50 | int rippleColor = attrs.getAttributeResourceValue(MATERIALDESIGNXML,
51 | "rippleColor", -1);
52 | if (rippleColor != -1) {
53 | setRippleColor(getResources().getColor(rippleColor));
54 | } else {
55 | // Color by hexadecimal
56 | int background = attrs.getAttributeIntValue(MATERIALDESIGNXML, "rippleColor", -1);
57 | if (background != -1)
58 | setRippleColor(background);
59 | else
60 | setRippleColor(makePressColor());
61 | }
62 |
63 | rippleSpeed = attrs.getAttributeFloatValue(MATERIALDESIGNXML,
64 | "rippleSpeed", 20f);
65 | }
66 |
67 | // Set color of background
68 | public void setBackgroundColor(int color) {
69 | this.backgroundColor = color;
70 | if (isEnabled())
71 | beforeBackground = backgroundColor;
72 | super.setBackgroundColor(color);
73 | }
74 |
75 | public void setRippleSpeed(int rippleSpeed) {
76 | this.rippleSpeed = rippleSpeed;
77 | }
78 |
79 | // ### RIPPLE EFFECT ###
80 |
81 | float x = -1, y = -1;
82 | float radius = -1;
83 |
84 | @Override
85 | public boolean onTouchEvent(MotionEvent event) {
86 | invalidate();
87 | if (isEnabled()) {
88 | isLastTouch = true;
89 | if (event.getAction() == MotionEvent.ACTION_DOWN) {
90 | radius = getHeight() / rippleSize;
91 | x = event.getX();
92 | y = event.getY();
93 | } else if (event.getAction() == MotionEvent.ACTION_MOVE) {
94 | radius = getHeight() / rippleSize;
95 | x = event.getX();
96 | y = event.getY();
97 | if (!((event.getX() <= getWidth() && event.getX() >= 0) && (event
98 | .getY() <= getHeight() && event.getY() >= 0))) {
99 | isLastTouch = false;
100 | x = -1;
101 | y = -1;
102 | }
103 | } else if (event.getAction() == MotionEvent.ACTION_UP) {
104 | if ((event.getX() <= getWidth() && event.getX() >= 0)
105 | && (event.getY() <= getHeight() && event.getY() >= 0)) {
106 | radius++;
107 | } else {
108 | isLastTouch = false;
109 | x = -1;
110 | y = -1;
111 | }
112 | }if (event.getAction() == MotionEvent.ACTION_CANCEL) {
113 | isLastTouch = false;
114 | x = -1;
115 | y = -1;
116 | }
117 | }
118 | return true;
119 | }
120 |
121 | @Override
122 | protected void onFocusChanged(boolean gainFocus, int direction,
123 | Rect previouslyFocusedRect) {
124 | if (!gainFocus) {
125 | x = -1;
126 | y = -1;
127 | }
128 | }
129 |
130 | @Override
131 | public boolean onInterceptTouchEvent(MotionEvent ev) {
132 | // super.onInterceptTouchEvent(ev);
133 | return true;
134 | }
135 |
136 | public Bitmap makeCircle() {
137 | Bitmap output = Bitmap.createBitmap(getWidth(), getHeight(),
138 | Config.ARGB_8888);
139 | Canvas canvas = new Canvas(output);
140 | canvas.drawARGB(0, 0, 0, 0);
141 | Paint paint = new Paint();
142 | paint.setAntiAlias(true);
143 | if (rippleColor == null)
144 | rippleColor = makePressColor();
145 | paint.setColor(rippleColor);
146 | x = (xRippleOrigin == null) ? x : xRippleOrigin;
147 | y = (yRippleOrigin == null) ? y : yRippleOrigin;
148 | canvas.drawCircle(x, y, radius, paint);
149 | if (radius > getHeight() / rippleSize)
150 | radius += rippleSpeed;
151 | if (radius >= getWidth()) {
152 | x = -1;
153 | y = -1;
154 | radius = getHeight() / rippleSize;
155 | if (onClickListener != null)
156 | onClickListener.onClick(this);
157 | }
158 | return output;
159 | }
160 |
161 | protected void onDraw(Canvas canvas) {
162 | super.onDraw(canvas);
163 | if (x != -1) {
164 | Rect src = new Rect(0, 0, getWidth(), getHeight());
165 | Rect dst = new Rect(0, 0, getWidth(), getHeight());
166 | canvas.drawBitmap(makeCircle(), src, dst, null);
167 | invalidate();
168 | }
169 | }
170 |
171 | /**
172 | * Make a dark color to ripple effect
173 | *
174 | * @return
175 | */
176 | protected int makePressColor() {
177 | int r = (this.backgroundColor >> 16) & 0xFF;
178 | int g = (this.backgroundColor >> 8) & 0xFF;
179 | int b = (this.backgroundColor >> 0) & 0xFF;
180 | r = (r - 30 < 0) ? 0 : r - 30;
181 | g = (g - 30 < 0) ? 0 : g - 30;
182 | b = (b - 30 < 0) ? 0 : b - 30;
183 | return Color.rgb(r, g, b);
184 | }
185 |
186 | @Override
187 | public void setOnClickListener(OnClickListener l) {
188 | onClickListener = l;
189 | }
190 |
191 | public void setRippleColor(int rippleColor) {
192 | this.rippleColor = rippleColor;
193 | }
194 |
195 | public void setxRippleOrigin(Float xRippleOrigin) {
196 | this.xRippleOrigin = xRippleOrigin;
197 | }
198 |
199 | public void setyRippleOrigin(Float yRippleOrigin) {
200 | this.yRippleOrigin = yRippleOrigin;
201 | }
202 |
203 | }
204 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ProgressBarCircularIndeterminate.java:
--------------------------------------------------------------------------------
1 | package com.gc.materialdesign.views;
2 |
3 | import com.gc.materialdesign.utils.Utils;
4 |
5 | import android.content.Context;
6 | import android.graphics.Bitmap;
7 | import android.graphics.Canvas;
8 | import android.graphics.Color;
9 | import android.graphics.Paint;
10 | import android.graphics.PorterDuff;
11 | import android.graphics.PorterDuffXfermode;
12 | import android.graphics.RectF;
13 | import android.util.AttributeSet;
14 |
15 | public class ProgressBarCircularIndeterminate extends CustomView {
16 |
17 |
18 | final static String ANDROIDXML = "http://schemas.android.com/apk/res/android";
19 |
20 | int backgroundColor = Color.parseColor("#1E88E5");
21 |
22 |
23 | public ProgressBarCircularIndeterminate(Context context, AttributeSet attrs) {
24 | super(context, attrs);
25 | setAttributes(attrs);
26 |
27 | }
28 |
29 | // Set atributtes of XML to View
30 | protected void setAttributes(AttributeSet attrs){
31 |
32 | setMinimumHeight(Utils.dpToPx(32, getResources()));
33 | setMinimumWidth(Utils.dpToPx(32, getResources()));
34 |
35 | //Set background Color
36 | // Color by resource
37 | int bacgroundColor = attrs.getAttributeResourceValue(ANDROIDXML,"background",-1);
38 | if(bacgroundColor != -1){
39 | setBackgroundColor(getResources().getColor(bacgroundColor));
40 | }else{
41 | // Color by hexadecimal
42 | int background = attrs.getAttributeIntValue(ANDROIDXML, "background", -1);
43 | if (background != -1)
44 | setBackgroundColor(background);
45 | else
46 | setBackgroundColor(Color.parseColor("#1E88E5"));
47 | }
48 |
49 | setMinimumHeight(Utils.dpToPx(3, getResources()));
50 |
51 |
52 | }
53 |
54 | /**
55 | * Make a dark color to ripple effect
56 | * @return
57 | */
58 | protected int makePressColor(){
59 | int r = (this.backgroundColor >> 16) & 0xFF;
60 | int g = (this.backgroundColor >> 8) & 0xFF;
61 | int b = (this.backgroundColor >> 0) & 0xFF;
62 | // r = (r+90 > 245) ? 245 : r+90;
63 | // g = (g+90 > 245) ? 245 : g+90;
64 | // b = (b+90 > 245) ? 245 : b+90;
65 | return Color.argb(128,r, g, b);
66 | }
67 |
68 |
69 | @Override
70 | protected void onDraw(Canvas canvas) {
71 | super.onDraw(canvas);
72 | if(firstAnimationOver == false)
73 | drawFirstAnimation(canvas);
74 | if(cont > 0)
75 | drawSecondAnimation(canvas);
76 | invalidate();
77 |
78 | }
79 |
80 | float radius1 = 0;
81 | float radius2 = 0;
82 | int cont = 0;
83 | boolean firstAnimationOver = false;
84 | /**
85 | * Draw first animation of view
86 | * @param canvas
87 | */
88 | private void drawFirstAnimation(Canvas canvas){
89 | if(radius1 < getWidth()/2){
90 | Paint paint = new Paint();
91 | paint.setAntiAlias(true);
92 | paint.setColor(makePressColor());
93 | radius1 = (radius1 >= getWidth()/2)? (float)getWidth()/2 : radius1+1;
94 | canvas.drawCircle(getWidth()/2, getHeight()/2, radius1, paint);
95 | }else{
96 | Bitmap bitmap = Bitmap.createBitmap(canvas.getWidth(), canvas.getHeight(), Bitmap.Config.ARGB_8888);
97 | Canvas temp = new Canvas(bitmap);
98 | Paint paint = new Paint();
99 | paint.setAntiAlias(true);
100 | paint.setColor(makePressColor());
101 | temp.drawCircle(getWidth()/2, getHeight()/2, getHeight()/2, paint);
102 | Paint transparentPaint = new Paint();
103 | transparentPaint.setAntiAlias(true);
104 | transparentPaint.setColor(getResources().getColor(android.R.color.transparent));
105 | transparentPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
106 | if(cont >= 50){
107 | radius2 = (radius2 >= getWidth()/2)? (float)getWidth()/2 : radius2+1;
108 | }else{
109 | radius2 = (radius2 >= getWidth()/2-Utils.dpToPx(4, getResources()))? (float)getWidth()/2-Utils.dpToPx(4, getResources()) : radius2+1;
110 | }
111 | temp.drawCircle(getWidth()/2, getHeight()/2, radius2, transparentPaint);
112 | canvas.drawBitmap(bitmap, 0, 0, new Paint());
113 | if(radius2 >= getWidth()/2-Utils.dpToPx(4, getResources()))
114 | cont++;
115 | if(radius2 >= getWidth()/2)
116 | firstAnimationOver = true;
117 | }
118 | }
119 |
120 | int arcD = 1;
121 | int arcO = 0;
122 | float rotateAngle = 0;
123 | int limite = 0;
124 | /**
125 | * Draw second animation of view
126 | * @param canvas
127 | */
128 | private void drawSecondAnimation(Canvas canvas){
129 | if(arcO == limite)
130 | arcD+=6;
131 | if(arcD >= 290 || arcO > limite){
132 | arcO+=6;
133 | arcD-=6;
134 | }
135 | if(arcO > limite + 290){
136 | limite = arcO;
137 | arcO = limite;
138 | arcD = 1;
139 | }
140 | rotateAngle += 4;
141 | canvas.rotate(rotateAngle,getWidth()/2, getHeight()/2);
142 |
143 | Bitmap bitmap = Bitmap.createBitmap(canvas.getWidth(), canvas.getHeight(), Bitmap.Config.ARGB_8888);
144 | Canvas temp = new Canvas(bitmap);
145 | Paint paint = new Paint();
146 | paint.setAntiAlias(true);
147 | paint.setColor(backgroundColor);
148 | // temp.drawARGB(0, 0, 0, 255);
149 | temp.drawArc(new RectF(0, 0, getWidth(), getHeight()), arcO, arcD, true, paint);
150 | Paint transparentPaint = new Paint();
151 | transparentPaint.setAntiAlias(true);
152 | transparentPaint.setColor(getResources().getColor(android.R.color.transparent));
153 | transparentPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
154 | temp.drawCircle(getWidth()/2, getHeight()/2, (getWidth()/2)-Utils.dpToPx(4, getResources()), transparentPaint);
155 |
156 | canvas.drawBitmap(bitmap, 0, 0, new Paint());
157 | }
158 |
159 |
160 |
161 |
162 |
163 | // Set color of background
164 | public void setBackgroundColor(int color){
165 | super.setBackgroundColor(getResources().getColor(android.R.color.transparent));
166 | if(isEnabled())
167 | beforeBackground = backgroundColor;
168 | this.backgroundColor = color;
169 | }
170 |
171 | }
172 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ProgressBarDeterminate.java:
--------------------------------------------------------------------------------
1 | package com.gc.materialdesign.views;
2 |
3 | import com.gc.materialdesign.R;
4 | import com.gc.materialdesign.utils.Utils;
5 |
6 | import android.content.Context;
7 | import android.graphics.Canvas;
8 | import android.graphics.Color;
9 | import android.graphics.drawable.GradientDrawable;
10 | import android.graphics.drawable.LayerDrawable;
11 | import android.util.AttributeSet;
12 | import android.view.View;
13 | import android.widget.RelativeLayout;
14 | import android.widget.RelativeLayout.LayoutParams;
15 |
16 | public class ProgressBarDeterminate extends CustomView {
17 |
18 |
19 | int max = 100;
20 | int min = 0;
21 | int progress = 0;
22 |
23 | int backgroundColor = Color.parseColor("#1E88E5");
24 |
25 | View progressView;
26 |
27 | public ProgressBarDeterminate(Context context, AttributeSet attrs) {
28 | super(context, attrs);
29 | setAttributes(attrs);
30 | }
31 |
32 | // Set atributtes of XML to View
33 | protected void setAttributes(AttributeSet attrs){
34 |
35 | progressView = new View(getContext());
36 | LayoutParams params = new LayoutParams(1,1);
37 | progressView.setLayoutParams(params);
38 | progressView.setBackgroundResource(R.drawable.background_progress);
39 | addView(progressView);
40 |
41 | //Set background Color
42 | // Color by resource
43 | int bacgroundColor = attrs.getAttributeResourceValue(ANDROIDXML,"background",-1);
44 | if(bacgroundColor != -1){
45 | setBackgroundColor(getResources().getColor(bacgroundColor));
46 | }else{
47 | // Color by hexadecimal
48 | int background = attrs.getAttributeIntValue(ANDROIDXML, "background", -1);
49 | if (background != -1)
50 | setBackgroundColor(background);
51 | else
52 | setBackgroundColor(Color.parseColor("#1E88E5"));
53 | }
54 |
55 | min = attrs.getAttributeIntValue(MATERIALDESIGNXML,"min", 0);
56 | max = attrs.getAttributeIntValue(MATERIALDESIGNXML,"max", 100);
57 | progress = attrs.getAttributeIntValue(MATERIALDESIGNXML,"progress", min);
58 |
59 | setMinimumHeight(Utils.dpToPx(3, getResources()));
60 |
61 | post(new Runnable() {
62 |
63 | @Override
64 | public void run() {
65 | LayoutParams params = (LayoutParams) progressView.getLayoutParams();
66 | params.height = getHeight();
67 | progressView.setLayoutParams(params);
68 | }
69 | });
70 |
71 | }
72 |
73 | /**
74 | * Make a dark color to ripple effect
75 | * @return
76 | */
77 | protected int makePressColor(){
78 | int r = (this.backgroundColor >> 16) & 0xFF;
79 | int g = (this.backgroundColor >> 8) & 0xFF;
80 | int b = (this.backgroundColor >> 0) & 0xFF;
81 | return Color.argb(128,r, g, b);
82 | }
83 |
84 | // SETTERS
85 |
86 | @Override
87 | protected void onDraw(Canvas canvas) {
88 | super.onDraw(canvas);
89 | if(pendindProgress!=-1)
90 | setProgress(pendindProgress);
91 | }
92 |
93 | public void setMax(int max){
94 | this.max = max;
95 | }
96 |
97 | public void setMin(int min){
98 | this.min = min;
99 | }
100 |
101 | int pendindProgress = -1;
102 | public void setProgress(int progress){
103 | if(getWidth() == 0){
104 | pendindProgress = progress;
105 | }else{
106 | this.progress = progress;
107 | if(progress > max)
108 | progress = max;
109 | if(progress < min)
110 | progress = min;
111 | int totalWidth = max-min;
112 | double progressPercent = (double)progress/(double)totalWidth;
113 | int progressWidth =(int) (getWidth()*progressPercent);
114 | LayoutParams params = (LayoutParams) progressView.getLayoutParams();
115 | params.width = progressWidth;
116 | params.height = getHeight();
117 | progressView.setLayoutParams(params);
118 | pendindProgress = -1;
119 | }
120 | }
121 |
122 | public int getProgress(){
123 | return progress;
124 | }
125 |
126 | // Set color of background
127 | public void setBackgroundColor(int color){
128 | this.backgroundColor = color;
129 | if(isEnabled())
130 | beforeBackground = backgroundColor;
131 | LayerDrawable layer = (LayerDrawable) progressView.getBackground();
132 | GradientDrawable shape = (GradientDrawable) layer.findDrawableByLayerId(R.id.shape_bacground);
133 | shape.setColor(color);
134 | super.setBackgroundColor(makePressColor());
135 | }
136 |
137 | }
138 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ProgressBarIndeterminate.java:
--------------------------------------------------------------------------------
1 | package com.gc.materialdesign.views;
2 |
3 | import com.gc.materialdesign.R;
4 | import com.nineoldandroids.animation.Animator;
5 | import com.nineoldandroids.animation.Animator.AnimatorListener;
6 | import com.nineoldandroids.animation.ObjectAnimator;
7 | import com.nineoldandroids.view.ViewHelper;
8 |
9 | import android.content.Context;
10 | import android.util.AttributeSet;
11 | import android.view.animation.Animation;
12 | import android.view.animation.AnimationUtils;
13 |
14 | public class ProgressBarIndeterminate extends ProgressBarDeterminate {
15 |
16 | public ProgressBarIndeterminate(Context context, AttributeSet attrs) {
17 | super(context, attrs);
18 | post(new Runnable() {
19 |
20 | @Override
21 | public void run() {
22 | // Make progress animation
23 |
24 | setProgress(60);
25 | Animation anim = AnimationUtils.loadAnimation(getContext(), R.anim.progress_indeterminate_animation);
26 | progressView.startAnimation(anim);
27 | final ObjectAnimator anim2 = ObjectAnimator.ofFloat(progressView, "x", getWidth());
28 | anim2.setDuration(1200);
29 | anim2.addListener(new AnimatorListener() {
30 |
31 | int cont = 1;
32 | int suma = 1;
33 | int duration = 1200;
34 |
35 | public void onAnimationEnd(Animator arg0) {
36 | // Repeat animation
37 | ViewHelper.setX(progressView,-progressView.getWidth()/2);
38 | cont += suma;
39 | try {
40 | ObjectAnimator anim2Repeat = ObjectAnimator.ofFloat(progressView, "x", getWidth());
41 | anim2Repeat.setDuration(duration/cont);
42 | anim2Repeat.addListener(this);
43 | anim2Repeat.start();
44 | } catch (ArrayIndexOutOfBoundsException e) {
45 | // ignore this error that sometimes comes from the NineOldAndroids 2.4 library
46 | }
47 | if(cont == 3 || cont == 1) suma *=-1;
48 |
49 | }
50 |
51 | public void onAnimationStart(Animator arg0) {}
52 | public void onAnimationRepeat(Animator arg0) {}
53 | public void onAnimationCancel(Animator arg0) {}
54 | });
55 |
56 | anim2.start();
57 | }
58 | });
59 | }
60 |
61 | }
62 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ProgressBarIndeterminateDeterminate.java:
--------------------------------------------------------------------------------
1 | package com.gc.materialdesign.views;
2 |
3 | import com.nineoldandroids.animation.Animator;
4 | import com.nineoldandroids.animation.Animator.AnimatorListener;
5 | import com.nineoldandroids.animation.ObjectAnimator;
6 | import com.nineoldandroids.view.ViewHelper;
7 |
8 | import android.content.Context;
9 | import android.util.AttributeSet;
10 |
11 | public class ProgressBarIndeterminateDeterminate extends ProgressBarDeterminate {
12 |
13 | boolean firstProgress = true;
14 | boolean runAnimation = true;
15 | ObjectAnimator animation;
16 |
17 |
18 |
19 | public ProgressBarIndeterminateDeterminate(Context context, AttributeSet attrs) {
20 | super(context, attrs);
21 | post(new Runnable() {
22 |
23 | @Override
24 | public void run() {
25 | // Make progress animation
26 |
27 | setProgress(60);
28 | ViewHelper.setX(progressView,getWidth()+progressView.getWidth()/2);
29 | animation = ObjectAnimator.ofFloat(progressView, "x", -progressView.getWidth()/2);
30 | animation.setDuration(1200);
31 | animation.addListener(new AnimatorListener() {
32 |
33 | int cont = 1;
34 | int suma = 1;
35 | int duration = 1200;
36 |
37 | public void onAnimationEnd(Animator arg0) {
38 | // Repeat animation
39 | if(runAnimation){
40 | ViewHelper.setX(progressView,getWidth()+progressView.getWidth()/2);
41 | cont += suma;
42 | animation = ObjectAnimator.ofFloat(progressView, "x", -progressView.getWidth()/2);
43 | animation.setDuration(duration/cont);
44 | animation.addListener(this);
45 | animation.start();
46 | if(cont == 3 || cont == 1) suma *=-1;
47 | }
48 |
49 | }
50 |
51 | public void onAnimationStart(Animator arg0) {}
52 | public void onAnimationRepeat(Animator arg0) {}
53 | public void onAnimationCancel(Animator arg0) {}
54 | });
55 | animation.start();
56 | }
57 | });
58 | }
59 |
60 | @Override
61 | public void setProgress(int progress) {
62 | if(firstProgress){
63 | firstProgress = false;
64 | }else{
65 | stopIndeterminate();
66 | }
67 | super.setProgress(progress);
68 | }
69 |
70 | /**
71 | * Stop indeterminate animation to convert view in determinate progress bar
72 | */
73 | private void stopIndeterminate(){
74 | animation.cancel();
75 | ViewHelper.setX(progressView,0);
76 | runAnimation = false;
77 | }
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ScrollView.java:
--------------------------------------------------------------------------------
1 | package com.gc.materialdesign.views;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.view.MotionEvent;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 |
10 | public class ScrollView extends android.widget.ScrollView {
11 |
12 | /*
13 | * This class avoid problems in scrollviews with elements in library
14 | * Use it if you want use a ScrollView in your App
15 | */
16 |
17 | public ScrollView(Context context, AttributeSet attrs) {
18 | super(context, attrs);
19 | }
20 |
21 | @Override
22 | public boolean onTouchEvent(MotionEvent ev) {
23 | // if(!onInterceptTouchEvent(ev)){
24 | for(int i = 0; i < ((ViewGroup)getChildAt(0)).getChildCount(); i++){
25 | try {
26 | CustomView child =(CustomView) ((ViewGroup)getChildAt(0)).getChildAt(i);
27 | if(child.isLastTouch){
28 | child.onTouchEvent(ev);
29 | return true;
30 | }
31 | } catch (ClassCastException e) {
32 | }
33 | }
34 | // }
35 | return super.onTouchEvent(ev);
36 | }
37 |
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/Switch.java:
--------------------------------------------------------------------------------
1 | package com.gc.materialdesign.views;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.graphics.Canvas;
6 | import android.graphics.Color;
7 | import android.graphics.Paint;
8 | import android.graphics.PorterDuff;
9 | import android.graphics.PorterDuffXfermode;
10 | import android.graphics.drawable.GradientDrawable;
11 | import android.graphics.drawable.LayerDrawable;
12 | import android.util.AttributeSet;
13 | import android.view.MotionEvent;
14 | import android.view.View;
15 | import android.widget.RelativeLayout;
16 |
17 | import com.gc.materialdesign.R;
18 | import com.gc.materialdesign.utils.Utils;
19 | import com.nineoldandroids.animation.ObjectAnimator;
20 | import com.nineoldandroids.view.ViewHelper;
21 |
22 | public class Switch extends CustomView {
23 |
24 | private int backgroundColor = Color.parseColor("#4CAF50");
25 |
26 | private Ball ball;
27 |
28 | private boolean check = false;
29 | private boolean eventCheck = false;
30 | private boolean press = false;
31 |
32 | private OnCheckListener onCheckListener;
33 | private Bitmap bitmap;
34 |
35 | public Switch(Context context, AttributeSet attrs) {
36 | super(context, attrs);
37 | setAttributes(attrs);
38 | setOnClickListener(new OnClickListener() {
39 |
40 | @Override
41 | public void onClick(View arg0) {
42 | if (check)
43 | setChecked(false);
44 | else
45 | setChecked(true);
46 | }
47 | });
48 | }
49 |
50 | // Set atributtes of XML to View
51 | protected void setAttributes(AttributeSet attrs) {
52 |
53 | setBackgroundResource(R.drawable.background_transparent);
54 |
55 | // Set size of view
56 | setMinimumHeight(Utils.dpToPx(48, getResources()));
57 | setMinimumWidth(Utils.dpToPx(80, getResources()));
58 |
59 | // Set background Color
60 | // Color by resource
61 | int bacgroundColor = attrs.getAttributeResourceValue(ANDROIDXML,
62 | "background", -1);
63 | if (bacgroundColor != -1) {
64 | setBackgroundColor(getResources().getColor(bacgroundColor));
65 | } else {
66 | // Color by hexadecimal
67 | int background = attrs.getAttributeIntValue(ANDROIDXML, "background", -1);
68 | if (background != -1)
69 | setBackgroundColor(background);
70 | }
71 |
72 | check = attrs.getAttributeBooleanValue(MATERIALDESIGNXML, "check",
73 | false);
74 | eventCheck = check;
75 | ball = new Ball(getContext());
76 | RelativeLayout.LayoutParams params = new LayoutParams(Utils.dpToPx(20,
77 | getResources()), Utils.dpToPx(20, getResources()));
78 | params.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
79 | ball.setLayoutParams(params);
80 | addView(ball);
81 |
82 | }
83 |
84 | @Override
85 | public boolean onTouchEvent(MotionEvent event) {
86 | if (isEnabled()) {
87 | isLastTouch = true;
88 | if (event.getAction() == MotionEvent.ACTION_DOWN) {
89 | press = true;
90 | } else if (event.getAction() == MotionEvent.ACTION_MOVE) {
91 | float x = event.getX();
92 | x = (x < ball.xIni) ? ball.xIni : x;
93 | x = (x > ball.xFin) ? ball.xFin : x;
94 | if (x > ball.xCen) {
95 | eventCheck = true;
96 | } else {
97 | eventCheck = false;
98 | }
99 | ViewHelper.setX(ball, x);
100 | ball.changeBackground();
101 | if ((event.getX() <= getWidth() && event.getX() >= 0)) {
102 | isLastTouch = false;
103 | press = false;
104 | }
105 | } else if (event.getAction() == MotionEvent.ACTION_UP ||
106 | event.getAction() == MotionEvent.ACTION_CANCEL) {
107 | press = false;
108 | isLastTouch = false;
109 | if (eventCheck != check) {
110 | check = eventCheck;
111 | if (onCheckListener != null)
112 | onCheckListener.onCheck(Switch.this,check);
113 | }
114 | if ((event.getX() <= getWidth() && event.getX() >= 0)) {
115 | ball.animateCheck();
116 | }
117 | }
118 | }
119 | return true;
120 | }
121 |
122 | @Override
123 | protected void onDraw(Canvas canvas) {
124 | super.onDraw(canvas);
125 | if (!placedBall) {
126 | placeBall();
127 | }
128 |
129 | // Crop line to transparent effect
130 | if(null == bitmap) {
131 | bitmap = Bitmap.createBitmap(canvas.getWidth(),
132 | canvas.getHeight(), Bitmap.Config.ARGB_8888);
133 | }
134 | Canvas temp = new Canvas(bitmap);
135 | Paint paint = new Paint();
136 | paint.setAntiAlias(true);
137 | paint.setColor((eventCheck) ? backgroundColor : Color.parseColor("#B0B0B0"));
138 | paint.setStrokeWidth(Utils.dpToPx(2, getResources()));
139 | temp.drawLine(getHeight() / 2, getHeight() / 2, getWidth()
140 | - getHeight() / 2, getHeight() / 2, paint);
141 | Paint transparentPaint = new Paint();
142 | transparentPaint.setAntiAlias(true);
143 | transparentPaint.setColor(getResources().getColor(
144 | android.R.color.transparent));
145 | transparentPaint.setXfermode(new PorterDuffXfermode(
146 | PorterDuff.Mode.CLEAR));
147 | temp.drawCircle(ViewHelper.getX(ball) + ball.getWidth() / 2,
148 | ViewHelper.getY(ball) + ball.getHeight() / 2,
149 | ball.getWidth() / 2, transparentPaint);
150 |
151 | canvas.drawBitmap(bitmap, 0, 0, new Paint());
152 |
153 | if (press) {
154 | paint.setColor((check) ? makePressColor() : Color
155 | .parseColor("#446D6D6D"));
156 | canvas.drawCircle(ViewHelper.getX(ball) + ball.getWidth() / 2,
157 | getHeight() / 2, getHeight() / 2, paint);
158 | }
159 | invalidate();
160 |
161 | }
162 |
163 | /**
164 | * Make a dark color to press effect
165 | *
166 | * @return
167 | */
168 | protected int makePressColor() {
169 | int r = (this.backgroundColor >> 16) & 0xFF;
170 | int g = (this.backgroundColor >> 8) & 0xFF;
171 | int b = (this.backgroundColor >> 0) & 0xFF;
172 | r = (r - 30 < 0) ? 0 : r - 30;
173 | g = (g - 30 < 0) ? 0 : g - 30;
174 | b = (b - 30 < 0) ? 0 : b - 30;
175 | return Color.argb(70, r, g, b);
176 | }
177 |
178 | // Move ball to first position in view
179 | boolean placedBall = false;
180 |
181 | private void placeBall() {
182 | ViewHelper.setX(ball, getHeight() / 2 - ball.getWidth() / 2);
183 | ball.xIni = ViewHelper.getX(ball);
184 | ball.xFin = getWidth() - getHeight() / 2 - ball.getWidth() / 2;
185 | ball.xCen = getWidth() / 2 - ball.getWidth() / 2;
186 | placedBall = true;
187 | ball.animateCheck();
188 | }
189 |
190 | // SETTERS
191 |
192 | @Override
193 | public void setBackgroundColor(int color) {
194 | backgroundColor = color;
195 | if (isEnabled())
196 | beforeBackground = backgroundColor;
197 |
198 | }
199 |
200 | public void setChecked(boolean check) {
201 | invalidate();
202 | this.check = check;
203 | this.eventCheck = check;
204 | ball.animateCheck();
205 | }
206 |
207 | public boolean isCheck() {
208 | return check;
209 | }
210 |
211 | class Ball extends View {
212 |
213 | float xIni, xFin, xCen;
214 |
215 | public Ball(Context context) {
216 | super(context);
217 | setBackgroundResource(R.drawable.background_switch_ball_uncheck);
218 | }
219 |
220 | public void changeBackground() {
221 | if (eventCheck) {
222 | setBackgroundResource(R.drawable.background_checkbox);
223 | LayerDrawable layer = (LayerDrawable) getBackground();
224 | GradientDrawable shape = (GradientDrawable) layer
225 | .findDrawableByLayerId(R.id.shape_bacground);
226 | shape.setColor(backgroundColor);
227 | } else {
228 | setBackgroundResource(R.drawable.background_switch_ball_uncheck);
229 | }
230 | }
231 |
232 | public void animateCheck() {
233 | changeBackground();
234 | ObjectAnimator objectAnimator;
235 | if (eventCheck) {
236 | objectAnimator = ObjectAnimator.ofFloat(this, "x", ball.xFin);
237 |
238 | } else {
239 | objectAnimator = ObjectAnimator.ofFloat(this, "x", ball.xIni);
240 | }
241 | objectAnimator.setDuration(300);
242 | objectAnimator.start();
243 | }
244 |
245 | }
246 |
247 | public void setOncheckListener(OnCheckListener onCheckListener) {
248 | this.onCheckListener = onCheckListener;
249 | }
250 |
251 | public interface OnCheckListener {
252 | public void onCheck(Switch view, boolean check);
253 | }
254 |
255 | }
256 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/widgets/ColorSelector.java:
--------------------------------------------------------------------------------
1 | package com.gc.materialdesign.widgets;
2 |
3 | import com.gc.materialdesign.R;
4 | import com.gc.materialdesign.views.Slider;
5 | import com.gc.materialdesign.views.Slider.OnValueChangedListener;
6 |
7 | import android.content.Context;
8 | import android.content.DialogInterface;
9 | import android.graphics.Color;
10 | import android.os.Bundle;
11 | import android.view.MotionEvent;
12 | import android.view.View;
13 | import android.view.Window;
14 | import android.view.View.OnTouchListener;
15 | import android.view.animation.Animation;
16 | import android.view.animation.AnimationUtils;
17 | import android.view.animation.Animation.AnimationListener;
18 | import android.widget.LinearLayout;
19 | import android.widget.LinearLayout.LayoutParams;
20 | import android.widget.RelativeLayout;
21 |
22 | public class ColorSelector extends android.app.Dialog implements OnValueChangedListener{
23 |
24 | int color = Color.BLACK;
25 | Context context;
26 | View colorView;
27 | View view, backView;//background
28 |
29 | OnColorSelectedListener onColorSelectedListener;
30 | Slider red, green, blue;
31 |
32 |
33 | public ColorSelector(Context context,Integer color, OnColorSelectedListener onColorSelectedListener) {
34 | super(context, android.R.style.Theme_Translucent);
35 | this.context = context;
36 | this.onColorSelectedListener = onColorSelectedListener;
37 | if(color != null)
38 | this.color = color;
39 | setOnDismissListener(new OnDismissListener() {
40 |
41 | @Override
42 | public void onDismiss(DialogInterface dialog) {
43 | if(ColorSelector.this.onColorSelectedListener != null)
44 | ColorSelector.this.onColorSelectedListener.onColorSelected(ColorSelector.this.color);
45 | }
46 | });
47 | }
48 |
49 |
50 |
51 | @Override
52 | protected void onCreate(Bundle savedInstanceState) {
53 | requestWindowFeature(Window.FEATURE_NO_TITLE);
54 | super.onCreate(savedInstanceState);
55 | setContentView(R.layout.color_selector);
56 |
57 | view = (LinearLayout)findViewById(R.id.contentSelector);
58 | backView = (RelativeLayout)findViewById(R.id.rootSelector);
59 | backView.setOnTouchListener(new OnTouchListener() {
60 |
61 | @Override
62 | public boolean onTouch(View v, MotionEvent event) {
63 | if (event.getX() < view.getLeft() || event.getX() >view.getRight()
64 | || event.getY() > view.getBottom() || event.getY() < view.getTop()) {
65 | dismiss();
66 | }
67 | return false;
68 | }
69 | });
70 |
71 | colorView = findViewById(R.id.viewColor);
72 | colorView.setBackgroundColor(color);
73 | // Resize ColorView
74 | colorView.post(new Runnable() {
75 |
76 | @Override
77 | public void run() {
78 | LayoutParams params = (LayoutParams) colorView.getLayoutParams();
79 | params.height = colorView.getWidth();
80 | colorView.setLayoutParams(params);
81 | }
82 | });
83 |
84 |
85 | // Configure Sliders
86 | red = (Slider) findViewById(R.id.red);
87 | green = (Slider) findViewById(R.id.green);
88 | blue = (Slider) findViewById(R.id.blue);
89 |
90 | int r = (this.color >> 16) & 0xFF;
91 | int g = (this.color >> 8) & 0xFF;
92 | int b = (this.color >> 0) & 0xFF;
93 |
94 | red.setValue(r);
95 | green.setValue(g);
96 | blue.setValue(b);
97 |
98 | red.setOnValueChangedListener(this);
99 | green.setOnValueChangedListener(this);
100 | blue.setOnValueChangedListener(this);
101 | }
102 |
103 | @Override
104 | public void show() {
105 | super.show();
106 | view.startAnimation(AnimationUtils.loadAnimation(context, R.anim.dialog_main_show_amination));
107 | backView.startAnimation(AnimationUtils.loadAnimation(context, R.anim.dialog_root_show_amin));
108 | }
109 |
110 | @Override
111 | public void onValueChanged(int value) {
112 | color = Color.rgb(red.getValue(), green.getValue(), blue.getValue());
113 | colorView.setBackgroundColor(color);
114 | }
115 |
116 |
117 | // Event that execute when color selector is closed
118 | public interface OnColorSelectedListener{
119 | public void onColorSelected(int color);
120 | }
121 |
122 | @Override
123 | public void dismiss() {
124 | Animation anim = AnimationUtils.loadAnimation(context, R.anim.dialog_main_hide_amination);
125 |
126 | anim.setAnimationListener(new AnimationListener() {
127 |
128 | @Override
129 | public void onAnimationStart(Animation animation) {
130 | }
131 |
132 | @Override
133 | public void onAnimationRepeat(Animation animation) {
134 | }
135 |
136 | @Override
137 | public void onAnimationEnd(Animation animation) {
138 | view.post(new Runnable() {
139 | @Override
140 | public void run() {
141 | ColorSelector.super.dismiss();
142 | }
143 | });
144 | }
145 | });
146 |
147 | Animation backAnim = AnimationUtils.loadAnimation(context, R.anim.dialog_root_hide_amin);
148 |
149 | view.startAnimation(anim);
150 | backView.startAnimation(backAnim);
151 | }
152 |
153 | }
154 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/widgets/Dialog.java:
--------------------------------------------------------------------------------
1 | package com.gc.materialdesign.widgets;
2 |
3 | import android.content.Context;
4 | import android.os.Bundle;
5 | import android.view.MotionEvent;
6 | import android.view.View;
7 | import android.view.View.OnTouchListener;
8 | import android.view.Window;
9 | import android.view.animation.Animation;
10 | import android.view.animation.Animation.AnimationListener;
11 | import android.view.animation.AnimationUtils;
12 | import android.widget.RelativeLayout;
13 | import android.widget.TextView;
14 |
15 | import com.gc.materialdesign.R;
16 | import com.gc.materialdesign.views.ButtonFlat;
17 |
18 | public class Dialog extends android.app.Dialog{
19 |
20 | Context context;
21 | View view;
22 | View backView;
23 | String message;
24 | TextView messageTextView;
25 | String title;
26 | TextView titleTextView;
27 |
28 | ButtonFlat buttonAccept;
29 | ButtonFlat buttonCancel;
30 |
31 | String buttonCancelText;
32 |
33 | View.OnClickListener onAcceptButtonClickListener;
34 | View.OnClickListener onCancelButtonClickListener;
35 |
36 |
37 | public Dialog(Context context,String title, String message) {
38 | super(context, android.R.style.Theme_Translucent);
39 | this.context = context;// init Context
40 | this.message = message;
41 | this.title = title;
42 | }
43 |
44 | public void addCancelButton(String buttonCancelText){
45 | this.buttonCancelText = buttonCancelText;
46 | }
47 |
48 | public void addCancelButton(String buttonCancelText, View.OnClickListener onCancelButtonClickListener){
49 | this.buttonCancelText = buttonCancelText;
50 | this.onCancelButtonClickListener = onCancelButtonClickListener;
51 | }
52 |
53 |
54 | @Override
55 | protected void onCreate(Bundle savedInstanceState) {
56 | requestWindowFeature(Window.FEATURE_NO_TITLE);
57 | super.onCreate(savedInstanceState);
58 | setContentView(R.layout.dialog);
59 |
60 | view = (RelativeLayout)findViewById(R.id.contentDialog);
61 | backView = (RelativeLayout)findViewById(R.id.dialog_rootView);
62 | backView.setOnTouchListener(new OnTouchListener() {
63 |
64 | @Override
65 | public boolean onTouch(View v, MotionEvent event) {
66 | if (event.getX() < view.getLeft()
67 | || event.getX() >view.getRight()
68 | || event.getY() > view.getBottom()
69 | || event.getY() < view.getTop()) {
70 | dismiss();
71 | }
72 | return false;
73 | }
74 | });
75 |
76 | this.titleTextView = (TextView) findViewById(R.id.title);
77 | setTitle(title);
78 |
79 | this.messageTextView = (TextView) findViewById(R.id.message);
80 | setMessage(message);
81 |
82 | this.buttonAccept = (ButtonFlat) findViewById(R.id.button_accept);
83 | buttonAccept.setOnClickListener(new View.OnClickListener() {
84 | @Override
85 | public void onClick(View v) {
86 | dismiss();
87 | if(onAcceptButtonClickListener != null)
88 | onAcceptButtonClickListener.onClick(v);
89 | }
90 | });
91 |
92 | if(buttonCancelText != null){
93 | this.buttonCancel = (ButtonFlat) findViewById(R.id.button_cancel);
94 | this.buttonCancel.setVisibility(View.VISIBLE);
95 | this.buttonCancel.setText(buttonCancelText);
96 | buttonCancel.setOnClickListener(new View.OnClickListener() {
97 |
98 | @Override
99 | public void onClick(View v) {
100 | dismiss();
101 | if(onCancelButtonClickListener != null)
102 | onCancelButtonClickListener.onClick(v);
103 | }
104 | });
105 | }
106 | }
107 |
108 | @Override
109 | public void show() {
110 | // TODO 自动生成的方法存根
111 | super.show();
112 | // set dialog enter animations
113 | view.startAnimation(AnimationUtils.loadAnimation(context, R.anim.dialog_main_show_amination));
114 | backView.startAnimation(AnimationUtils.loadAnimation(context, R.anim.dialog_root_show_amin));
115 | }
116 |
117 | // GETERS & SETTERS
118 |
119 | public String getMessage() {
120 | return message;
121 | }
122 |
123 | public void setMessage(String message) {
124 | this.message = message;
125 | messageTextView.setText(message);
126 | }
127 |
128 | public TextView getMessageTextView() {
129 | return messageTextView;
130 | }
131 |
132 | public void setMessageTextView(TextView messageTextView) {
133 | this.messageTextView = messageTextView;
134 | }
135 |
136 | public String getTitle() {
137 | return title;
138 | }
139 |
140 | public void setTitle(String title) {
141 | this.title = title;
142 | if(title == null)
143 | titleTextView.setVisibility(View.GONE);
144 | else{
145 | titleTextView.setVisibility(View.VISIBLE);
146 | titleTextView.setText(title);
147 | }
148 | }
149 |
150 | public TextView getTitleTextView() {
151 | return titleTextView;
152 | }
153 |
154 | public void setTitleTextView(TextView titleTextView) {
155 | this.titleTextView = titleTextView;
156 | }
157 |
158 | public ButtonFlat getButtonAccept() {
159 | return buttonAccept;
160 | }
161 |
162 | public void setButtonAccept(ButtonFlat buttonAccept) {
163 | this.buttonAccept = buttonAccept;
164 | }
165 |
166 | public ButtonFlat getButtonCancel() {
167 | return buttonCancel;
168 | }
169 |
170 | public void setButtonCancel(ButtonFlat buttonCancel) {
171 | this.buttonCancel = buttonCancel;
172 | }
173 |
174 | public void setOnAcceptButtonClickListener(
175 | View.OnClickListener onAcceptButtonClickListener) {
176 | this.onAcceptButtonClickListener = onAcceptButtonClickListener;
177 | if(buttonAccept != null)
178 | buttonAccept.setOnClickListener(onAcceptButtonClickListener);
179 | }
180 |
181 | public void setOnCancelButtonClickListener(
182 | View.OnClickListener onCancelButtonClickListener) {
183 | this.onCancelButtonClickListener = onCancelButtonClickListener;
184 | if(buttonCancel != null)
185 | buttonCancel.setOnClickListener(onCancelButtonClickListener);
186 | }
187 |
188 | @Override
189 | public void dismiss() {
190 | Animation anim = AnimationUtils.loadAnimation(context, R.anim.dialog_main_hide_amination);
191 | anim.setAnimationListener(new AnimationListener() {
192 |
193 | @Override
194 | public void onAnimationStart(Animation animation) {
195 | }
196 |
197 | @Override
198 | public void onAnimationRepeat(Animation animation) {
199 | }
200 |
201 | @Override
202 | public void onAnimationEnd(Animation animation) {
203 | view.post(new Runnable() {
204 | @Override
205 | public void run() {
206 | Dialog.super.dismiss();
207 | }
208 | });
209 |
210 | }
211 | });
212 | Animation backAnim = AnimationUtils.loadAnimation(context, R.anim.dialog_root_hide_amin);
213 |
214 | view.startAnimation(anim);
215 | backView.startAnimation(backAnim);
216 | }
217 |
218 |
219 |
220 | }
221 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/widgets/ProgressDialog.java:
--------------------------------------------------------------------------------
1 | package com.gc.materialdesign.widgets;
2 |
3 | import android.content.Context;
4 | import android.os.Bundle;
5 | import android.view.MotionEvent;
6 | import android.view.View;
7 | import android.view.View.OnTouchListener;
8 | import android.view.Window;
9 | import android.view.animation.Animation;
10 | import android.view.animation.Animation.AnimationListener;
11 | import android.view.animation.AnimationUtils;
12 | import android.widget.RelativeLayout;
13 | import android.widget.TextView;
14 |
15 | import com.gc.materialdesign.R;
16 | import com.gc.materialdesign.views.ButtonFlat;
17 | import com.gc.materialdesign.views.ProgressBarCircularIndeterminate;
18 |
19 | public class ProgressDialog extends android.app.Dialog{
20 |
21 | Context context;
22 | View view;
23 | View backView;
24 | String title;
25 | TextView titleTextView;
26 |
27 | int progressColor = -1;
28 |
29 | public ProgressDialog(Context context,String title) {
30 | super(context, android.R.style.Theme_Translucent);
31 | this.title = title;
32 | this.context = context;
33 | }
34 |
35 | public ProgressDialog(Context context,String title, int progressColor) {
36 | super(context, android.R.style.Theme_Translucent);
37 | this.title = title;
38 | this.progressColor = progressColor;
39 | this.context = context;
40 | }
41 |
42 | @Override
43 | protected void onCreate(Bundle savedInstanceState) {
44 | requestWindowFeature(Window.FEATURE_NO_TITLE);
45 | super.onCreate(savedInstanceState);
46 | setContentView(R.layout.progress_dialog);
47 |
48 | view = (RelativeLayout)findViewById(R.id.contentDialog);
49 | backView = (RelativeLayout)findViewById(R.id.dialog_rootView);
50 | backView.setOnTouchListener(new OnTouchListener() {
51 |
52 | @Override
53 | public boolean onTouch(View v, MotionEvent event) {
54 | if (event.getX() < view.getLeft()
55 | || event.getX() >view.getRight()
56 | || event.getY() > view.getBottom()
57 | || event.getY() < view.getTop()) {
58 | dismiss();
59 | }
60 | return false;
61 | }
62 | });
63 |
64 | this.titleTextView = (TextView) findViewById(R.id.title);
65 | setTitle(title);
66 | if(progressColor != -1){
67 | ProgressBarCircularIndeterminate progressBarCircularIndeterminate = (ProgressBarCircularIndeterminate) findViewById(R.id.progressBarCircularIndetermininate);
68 | progressBarCircularIndeterminate.setBackgroundColor(progressColor);
69 | }
70 |
71 |
72 | }
73 |
74 | @Override
75 | public void show() {
76 | // TODO 自动生成的方法存根
77 | super.show();
78 | // set dialog enter animations
79 | view.startAnimation(AnimationUtils.loadAnimation(context, R.anim.dialog_main_show_amination));
80 | backView.startAnimation(AnimationUtils.loadAnimation(context, R.anim.dialog_root_show_amin));
81 | }
82 |
83 | // GETERS & SETTERS
84 |
85 | public String getTitle() {
86 | return title;
87 | }
88 |
89 | public void setTitle(String title) {
90 | this.title = title;
91 | if(title == null)
92 | titleTextView.setVisibility(View.GONE);
93 | else{
94 | titleTextView.setVisibility(View.VISIBLE);
95 | titleTextView.setText(title);
96 | }
97 | }
98 |
99 | public TextView getTitleTextView() {
100 | return titleTextView;
101 | }
102 |
103 | public void setTitleTextView(TextView titleTextView) {
104 | this.titleTextView = titleTextView;
105 | }
106 |
107 | @Override
108 | public void dismiss() {
109 | Animation anim = AnimationUtils.loadAnimation(context, R.anim.dialog_main_hide_amination);
110 | anim.setAnimationListener(new AnimationListener() {
111 |
112 | @Override
113 | public void onAnimationStart(Animation animation) {
114 | }
115 |
116 | @Override
117 | public void onAnimationRepeat(Animation animation) {
118 | }
119 |
120 | @Override
121 | public void onAnimationEnd(Animation animation) {
122 | view.post(new Runnable() {
123 | @Override
124 | public void run() {
125 | ProgressDialog.super.dismiss();
126 | }
127 | });
128 |
129 | }
130 | });
131 | Animation backAnim = AnimationUtils.loadAnimation(context, R.anim.dialog_root_hide_amin);
132 |
133 | view.startAnimation(anim);
134 | backView.startAnimation(backAnim);
135 | }
136 |
137 |
138 |
139 | }
140 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/widgets/SnackBar.java:
--------------------------------------------------------------------------------
1 | package com.gc.materialdesign.widgets;
2 |
3 | import android.app.Activity;
4 | import android.app.Dialog;
5 | import android.graphics.Color;
6 | import android.os.Bundle;
7 | import android.os.Handler;
8 | import android.os.Message;
9 | import android.view.KeyEvent;
10 | import android.view.MotionEvent;
11 | import android.view.View;
12 | import android.view.Window;
13 | import android.view.animation.Animation;
14 | import android.view.animation.Animation.AnimationListener;
15 | import android.view.animation.AnimationUtils;
16 | import android.widget.TextView;
17 |
18 | import com.gc.materialdesign.R;
19 | import com.gc.materialdesign.views.ButtonFlat;
20 |
21 | public class SnackBar extends Dialog{
22 |
23 | String text;
24 | float textSize = 14;//Roboto Regular 14sp
25 | String buttonText;
26 | View.OnClickListener onClickListener;
27 | Activity activity;
28 | View view;
29 | ButtonFlat button;
30 | int backgroundSnackBar = Color.parseColor("#333333");
31 | int backgroundButton = Color.parseColor("#1E88E5");
32 |
33 | OnHideListener onHideListener;
34 | // Timer
35 | private boolean mIndeterminate = false;
36 | private int mTimer = 3 * 1000;
37 |
38 | // With action button
39 | public SnackBar(Activity activity, String text, String buttonText, View.OnClickListener onClickListener) {
40 | super(activity, android.R.style.Theme_Translucent);
41 | this.activity = activity;
42 | this.text = text;
43 | this.buttonText = buttonText;
44 | this.onClickListener = onClickListener;
45 | }
46 |
47 | // Only text
48 | public SnackBar(Activity activity, String text) {
49 | super(activity, android.R.style.Theme_Translucent);
50 | this.activity = activity;
51 | this.text = text;
52 | }
53 |
54 | @Override
55 | protected void onCreate(Bundle savedInstanceState) {
56 | super.onCreate(savedInstanceState);
57 | requestWindowFeature(Window.FEATURE_NO_TITLE);
58 | setContentView(R.layout.snackbar);
59 | setCanceledOnTouchOutside(false);
60 | ((TextView)findViewById(R.id.text)).setText(text);
61 | ((TextView)findViewById(R.id.text)).setTextSize(textSize); //set textSize
62 | button = (ButtonFlat) findViewById(R.id.buttonflat);
63 | if(text == null || onClickListener == null){
64 | button.setVisibility(View.GONE);
65 | }else{
66 | button.setText(buttonText);
67 | button.setBackgroundColor(backgroundButton);
68 |
69 | button.setOnClickListener(new View.OnClickListener() {
70 |
71 | @Override
72 | public void onClick(View v) {
73 | dismiss();
74 | onClickListener.onClick(v);
75 | }
76 | });
77 | }
78 | view = findViewById(R.id.snackbar);
79 | view.setBackgroundColor(backgroundSnackBar);
80 | }
81 |
82 | @Override
83 | public boolean onTouchEvent(MotionEvent event) {
84 | return activity.dispatchTouchEvent(event);
85 | }
86 |
87 | @Override
88 | public void onBackPressed() {
89 | }
90 |
91 | @Override
92 | public void show() {
93 | super.show();
94 | view.setVisibility(View.VISIBLE);
95 | view.startAnimation(AnimationUtils.loadAnimation(activity, R.anim.snackbar_show_animation));
96 | if (!mIndeterminate) {
97 | dismissTimer.start();
98 | }
99 | }
100 |
101 | // Dismiss timer
102 | Thread dismissTimer = new Thread(new Runnable() {
103 |
104 | @Override
105 | public void run() {
106 | try {
107 | Thread.sleep(mTimer);
108 | } catch (InterruptedException e) {
109 | e.printStackTrace();
110 | }
111 | handler.sendMessage(new Message());
112 | }
113 | });
114 |
115 | Handler handler = new Handler(new Handler.Callback() {
116 |
117 | @Override
118 | public boolean handleMessage(Message msg) {
119 | if(onHideListener != null) {
120 | onHideListener.onHide();
121 | }
122 | dismiss();
123 | return false;
124 | }
125 | });
126 |
127 | /**
128 | * @author Jack Tony
129 | */
130 | @Override
131 | public void dismiss() {
132 | Animation anim = AnimationUtils.loadAnimation(activity, R.anim.snackbar_hide_animation);
133 | anim.setAnimationListener(new AnimationListener() {
134 |
135 | @Override
136 | public void onAnimationStart(Animation animation) {
137 | }
138 |
139 | @Override
140 | public void onAnimationRepeat(Animation animation) {
141 | }
142 |
143 | @Override
144 | public void onAnimationEnd(Animation animation) {
145 | SnackBar.super.dismiss();
146 | }
147 | });
148 | view.startAnimation(anim);
149 | }
150 |
151 | @Override
152 | public boolean onKeyDown(int keyCode, KeyEvent event) {
153 | // TODO 自动生成的方法存根
154 | if (keyCode == KeyEvent.KEYCODE_BACK ) {
155 | dismiss();
156 | }
157 | return super.onKeyDown(keyCode, event);
158 | }
159 |
160 | public void setMessageTextSize(float size) {
161 | textSize = size;
162 | }
163 |
164 | public void setIndeterminate(boolean indeterminate) {
165 | mIndeterminate = indeterminate;
166 | }
167 |
168 | public boolean isIndeterminate() {
169 | return mIndeterminate;
170 | }
171 |
172 | public void setDismissTimer(int time) {
173 | mTimer = time;
174 | }
175 |
176 | public int getDismissTimer() {
177 | return mTimer;
178 | }
179 |
180 | /**
181 | * Change background color of SnackBar
182 | * @param color
183 | */
184 | public void setBackgroundSnackBar(int color){
185 | backgroundSnackBar = color;
186 | if(view != null)
187 | view.setBackgroundColor(color);
188 | }
189 |
190 | /**
191 | * Chage color of FlatButton in Snackbar
192 | * @param color
193 | */
194 | public void setColorButton(int color){
195 | backgroundButton = color;
196 | if(button != null)
197 | button.setBackgroundColor(color);
198 | }
199 |
200 | /**
201 | * This event start when snackbar dismish without push the button
202 | * @author Navas
203 | *
204 | */
205 | public interface OnHideListener{
206 | public void onHide();
207 | }
208 |
209 | public void setOnhideListener(OnHideListener onHideListener){
210 | this.onHideListener = onHideListener;
211 | }
212 | }
213 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/anim/dialog_main_hide_amination.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/anim/dialog_main_show_amination.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
17 |
18 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/anim/dialog_root_hide_amin.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
10 |
11 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/anim/dialog_root_show_amin.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/anim/progress_indeterminate_animation.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/anim/snackbar_hide_animation.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/anim/snackbar_show_animation.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable-hdpi/sprite_check.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable-hdpi/sprite_check.png
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable-ldpi/sprite_check.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable-ldpi/sprite_check.png
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable-mdpi/sprite_check.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable-mdpi/sprite_check.png
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable-xhdpi/dialog_background.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable-xhdpi/dialog_background.9.png
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable-xhdpi/float_button1_shadowp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable-xhdpi/float_button1_shadowp.png
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable-xhdpi/float_button_shadow1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable-xhdpi/float_button_shadow1.png
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable-xhdpi/ic_reloj_max.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable-xhdpi/ic_reloj_max.png
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable-xhdpi/sprite_check.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable-xhdpi/sprite_check.png
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable-xxhdpi/sprite_check.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable-xxhdpi/sprite_check.png
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/background_button.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/background_button.9.png
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/background_button_float.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 | -
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/background_button_rectangle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 | -
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/background_checkbox.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/background_checkbox_check.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/background_checkbox_uncheck.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/background_progress.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/background_switch_ball_uncheck.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/background_transparent.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/shadow_down.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
10 |
11 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/shadow_right.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
11 |
12 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/layout/color_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
17 |
18 |
22 |
23 |
29 |
30 |
35 |
36 |
43 |
44 |
52 |
53 |
54 |
60 |
61 |
68 |
69 |
77 |
78 |
79 |
85 |
86 |
93 |
94 |
102 |
103 |
104 |
105 |
106 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/layout/dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
25 |
26 |
34 |
35 |
39 |
40 |
47 |
48 |
49 |
50 |
57 |
58 |
65 |
66 |
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/layout/number_indicator_spinner.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/layout/progress_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
16 |
17 |
23 |
24 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/layout/snackbar.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
12 |
22 |
23 |
31 |
32 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/values/attributes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #00FF00
4 | #66aaaaaa
5 |
6 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesign/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | MaterialDesign
3 |
4 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 22
5 | buildToolsVersion "22.0.1"
6 |
7 | defaultConfig {
8 | applicationId "com.gc.materialdesigndemo"
9 | minSdkVersion 16
10 | targetSdkVersion 22
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 | compile 'com.android.support:appcompat-v7:22.2.0'
25 | compile project(':MaterialDesign')
26 | }
27 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/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 /Applications/adt-bundle-mac-x86_64-20140321/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 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/src/androidTest/java/com/gc/materialdesigndemo/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.gc.materialdesigndemo;
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 | }
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
6 |
7 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
21 |
22 |
26 |
27 |
31 |
32 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/src/main/java/com/gc/materialdesigndemo/ui/ButtonsActivity.java:
--------------------------------------------------------------------------------
1 | package com.gc.materialdesigndemo.ui;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.app.Activity;
5 | import android.graphics.Color;
6 | import android.os.Bundle;
7 | import android.view.Window;
8 |
9 | import com.gc.materialdesigndemo.R;
10 |
11 |
12 |
13 | public class ButtonsActivity extends Activity {
14 |
15 | int backgroundColor = Color.parseColor("#1E88E5");
16 |
17 | @SuppressLint("NewApi")
18 | @Override
19 | protected void onCreate(Bundle savedInstanceState) {
20 | requestWindowFeature(Window.FEATURE_NO_TITLE);
21 | super.onCreate(savedInstanceState);
22 | setContentView(R.layout.activity_buttons);
23 | int color = getIntent().getIntExtra("BACKGROUND", Color.BLACK);
24 | findViewById(R.id.buttonflat).setBackgroundColor(color);
25 | findViewById(R.id.button).setBackgroundColor(color);
26 | findViewById(R.id.buttonFloatSmall).setBackgroundColor(color);
27 | findViewById(R.id.buttonIcon).setBackgroundColor(color);
28 | findViewById(R.id.buttonFloat).setBackgroundColor(color);
29 | }
30 |
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/src/main/java/com/gc/materialdesigndemo/ui/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.gc.materialdesigndemo.ui;
2 |
3 | import com.gc.materialdesign.views.ButtonFloatSmall;
4 | import com.gc.materialdesign.views.LayoutRipple;
5 | import com.gc.materialdesign.widgets.ColorSelector;
6 | import com.gc.materialdesign.widgets.ColorSelector.OnColorSelectedListener;
7 | import com.gc.materialdesigndemo.R;
8 | import com.nineoldandroids.view.ViewHelper;
9 |
10 | import android.annotation.SuppressLint;
11 | import android.annotation.TargetApi;
12 | import android.app.Activity;
13 | import android.content.Intent;
14 | import android.graphics.Color;
15 | import android.os.Build;
16 | import android.os.Bundle;
17 | import android.view.View;
18 | import android.view.Window;
19 | import android.view.View.OnClickListener;
20 |
21 |
22 | public class MainActivity extends Activity implements OnColorSelectedListener{
23 |
24 | int backgroundColor = Color.parseColor("#1E88E5");
25 | ButtonFloatSmall buttonSelectColor;
26 |
27 | @SuppressLint("NewApi")
28 | @Override
29 | protected void onCreate(Bundle savedInstanceState) {
30 | requestWindowFeature(Window.FEATURE_NO_TITLE);
31 | super.onCreate(savedInstanceState);
32 | setContentView(R.layout.activity_main);
33 |
34 | buttonSelectColor = (ButtonFloatSmall) findViewById(R.id.buttonColorSelector);
35 | buttonSelectColor.setOnClickListener(new OnClickListener() {
36 |
37 | @Override
38 | public void onClick(View arg0) {
39 | ColorSelector colorSelector = new ColorSelector(MainActivity.this, backgroundColor, MainActivity.this);
40 | colorSelector.show();
41 | }
42 | });
43 |
44 | LayoutRipple layoutRipple = (LayoutRipple) findViewById(R.id.itemButtons);
45 |
46 |
47 | setOriginRiple(layoutRipple);
48 |
49 | layoutRipple.setOnClickListener(new OnClickListener() {
50 |
51 | @Override
52 | public void onClick(View arg0) {
53 | Intent intent = new Intent(MainActivity.this,ButtonsActivity.class);
54 | intent.putExtra("BACKGROUND", backgroundColor);
55 | startActivity(intent);
56 | }
57 | });
58 | layoutRipple = (LayoutRipple) findViewById(R.id.itemSwitches);
59 |
60 |
61 | setOriginRiple(layoutRipple);
62 |
63 | layoutRipple.setOnClickListener(new OnClickListener() {
64 |
65 | @Override
66 | public void onClick(View arg0) {
67 | Intent intent = new Intent(MainActivity.this,SwitchActivity.class);
68 | intent.putExtra("BACKGROUND", backgroundColor);
69 | startActivity(intent);
70 | }
71 | });
72 | layoutRipple = (LayoutRipple) findViewById(R.id.itemProgress);
73 |
74 |
75 | setOriginRiple(layoutRipple);
76 |
77 | layoutRipple.setOnClickListener(new OnClickListener() {
78 |
79 | @Override
80 | public void onClick(View arg0) {
81 | Intent intent = new Intent(MainActivity.this,ProgressActivity.class);
82 | intent.putExtra("BACKGROUND", backgroundColor);
83 | startActivity(intent);
84 | }
85 | });
86 | layoutRipple = (LayoutRipple) findViewById(R.id.itemWidgets);
87 |
88 |
89 | setOriginRiple(layoutRipple);
90 |
91 | layoutRipple.setOnClickListener(new OnClickListener() {
92 |
93 | @Override
94 | public void onClick(View arg0) {
95 | Intent intent = new Intent(MainActivity.this,WidgetActivity.class);
96 | intent.putExtra("BACKGROUND", backgroundColor);
97 | startActivity(intent);
98 | }
99 | });
100 | }
101 |
102 | private void setOriginRiple(final LayoutRipple layoutRipple){
103 |
104 | layoutRipple.post(new Runnable() {
105 |
106 | @Override
107 | public void run() {
108 | View v = layoutRipple.getChildAt(0);
109 | layoutRipple.setxRippleOrigin(ViewHelper.getX(v)+v.getWidth()/2);
110 | layoutRipple.setyRippleOrigin(ViewHelper.getY(v)+v.getHeight()/2);
111 |
112 | layoutRipple.setRippleColor(Color.parseColor("#1E88E5"));
113 |
114 | layoutRipple.setRippleSpeed(30);
115 | }
116 | });
117 |
118 | }
119 |
120 | @Override
121 | public void onColorSelected(int color) {
122 | backgroundColor = color;
123 | buttonSelectColor.setBackgroundColor(color);
124 | }
125 |
126 |
127 | }
128 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/src/main/java/com/gc/materialdesigndemo/ui/ProgressActivity.java:
--------------------------------------------------------------------------------
1 | package com.gc.materialdesigndemo.ui;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.app.Activity;
5 | import android.graphics.Color;
6 | import android.os.Bundle;
7 | import android.os.Handler;
8 | import android.os.Message;
9 | import android.view.Window;
10 |
11 | import com.gc.materialdesign.views.ProgressBarDeterminate;
12 | import com.gc.materialdesign.views.ProgressBarIndeterminateDeterminate;
13 | import com.gc.materialdesigndemo.R;
14 |
15 |
16 | public class ProgressActivity extends Activity {
17 |
18 | int backgroundColor = Color.parseColor("#1E88E5");
19 |
20 | @SuppressLint("NewApi")
21 | @Override
22 | protected void onCreate(Bundle savedInstanceState) {
23 | requestWindowFeature(Window.FEATURE_NO_TITLE);
24 | super.onCreate(savedInstanceState);
25 | setContentView(R.layout.activity_progress);
26 |
27 | int color = getIntent().getIntExtra("BACKGROUND", Color.BLACK);
28 | findViewById(R.id.progressBarCircularIndetermininate).setBackgroundColor(color);
29 | findViewById(R.id.progressBarIndeterminate).setBackgroundColor(color);
30 | findViewById(R.id.progressBarIndeterminateDeterminate).setBackgroundColor(color);
31 | findViewById(R.id.progressDeterminate).setBackgroundColor(color);
32 | findViewById(R.id.slider).setBackgroundColor(color);
33 | findViewById(R.id.sliderNumber).setBackgroundColor(color);
34 |
35 |
36 | progreesBarDeterminate = (ProgressBarDeterminate) findViewById(R.id.progressDeterminate);
37 | progressTimer.start();
38 | progressBarIndeterminateDeterminate = (ProgressBarIndeterminateDeterminate) findViewById(R.id.progressBarIndeterminateDeterminate);
39 | progressTimer2.start();
40 | }
41 |
42 |
43 |
44 | ProgressBarDeterminate progreesBarDeterminate;
45 |
46 | Thread progressTimer = new Thread(new Runnable() {
47 |
48 | @Override
49 | public void run() {
50 | for(int i = 0; i <= 100; i++){
51 | try {
52 | Thread.sleep(100);
53 | } catch (InterruptedException e) {
54 | e.printStackTrace();
55 | }
56 | handler.sendMessage(new Message());
57 | }
58 | }
59 | });
60 |
61 | Handler handler = new Handler(new Handler.Callback() {
62 | int progress = 0;
63 | @Override
64 | public boolean handleMessage(Message msg) {
65 | progreesBarDeterminate.setProgress(progress++);
66 | return false;
67 | }
68 | });
69 |
70 | ProgressBarIndeterminateDeterminate progressBarIndeterminateDeterminate;
71 |
72 | Thread progressTimer2 = new Thread(new Runnable() {
73 |
74 | @Override
75 | public void run() {
76 | try {
77 | Thread.sleep(4000);
78 | for(int i = 0; i <= 100; i++){
79 |
80 | Thread.sleep(100);
81 |
82 | handler2.sendMessage(new Message());
83 | }
84 | } catch (InterruptedException e) {
85 | e.printStackTrace();
86 | }
87 | }
88 | });
89 |
90 | Handler handler2 = new Handler(new Handler.Callback() {
91 | int progress = 0;
92 | @Override
93 | public boolean handleMessage(Message msg) {
94 | progressBarIndeterminateDeterminate.setProgress(progress++);
95 | return false;
96 | }
97 | });
98 |
99 |
100 | }
101 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/src/main/java/com/gc/materialdesigndemo/ui/SwitchActivity.java:
--------------------------------------------------------------------------------
1 | package com.gc.materialdesigndemo.ui;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.app.Activity;
5 | import android.graphics.Color;
6 | import android.os.Bundle;
7 | import android.view.Window;
8 |
9 | import com.gc.materialdesigndemo.R;
10 |
11 |
12 |
13 |
14 | public class SwitchActivity extends Activity {
15 |
16 | int backgroundColor = Color.parseColor("#1E88E5");
17 |
18 | @SuppressLint("NewApi")
19 | @Override
20 | protected void onCreate(Bundle savedInstanceState) {
21 | requestWindowFeature(Window.FEATURE_NO_TITLE);
22 | super.onCreate(savedInstanceState);
23 | setContentView(R.layout.activity_switchs);
24 | int color = getIntent().getIntExtra("BACKGROUND", Color.BLACK);
25 | findViewById(R.id.checkBox).setBackgroundColor(color);
26 | findViewById(R.id.switchView).setBackgroundColor(color);
27 | }
28 |
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/src/main/java/com/gc/materialdesigndemo/ui/WidgetActivity.java:
--------------------------------------------------------------------------------
1 | package com.gc.materialdesigndemo.ui;
2 |
3 | import com.gc.materialdesign.views.ButtonFlat;
4 | import com.gc.materialdesign.widgets.ColorSelector;
5 | import com.gc.materialdesign.widgets.Dialog;
6 | import com.gc.materialdesign.widgets.SnackBar;
7 | import com.gc.materialdesigndemo.R;
8 |
9 | import android.annotation.SuppressLint;
10 | import android.app.Activity;
11 | import android.graphics.Color;
12 | import android.os.Bundle;
13 | import android.view.View;
14 | import android.view.Window;
15 | import android.view.View.OnClickListener;
16 | import android.widget.Toast;
17 |
18 | public class WidgetActivity extends Activity {
19 |
20 | private int backgroundColor = Color.parseColor("#1E88E5");
21 |
22 | @SuppressLint("NewApi")
23 | @Override
24 | protected void onCreate(Bundle savedInstanceState) {
25 | requestWindowFeature(Window.FEATURE_NO_TITLE);
26 | super.onCreate(savedInstanceState);
27 | setContentView(R.layout.activity_widgets);
28 |
29 | // SHOW SNACKBAR
30 | findViewById(R.id.buttonSnackBar).setOnClickListener(new OnClickListener() {
31 |
32 | @Override
33 | public void onClick(final View flatButton) {
34 | new SnackBar(WidgetActivity.this,
35 | "Do you want change color of this button to red?",
36 | "yes", new OnClickListener() {
37 |
38 | @Override
39 | public void onClick(View v) {
40 | ButtonFlat btn = (ButtonFlat) findViewById(R.id.buttonSnackBar);
41 | btn.setTextColor(Color.RED);
42 | }
43 | }).show();
44 | }
45 | });
46 | // SHOW DiALOG
47 | findViewById(R.id.buttonDialog).setOnClickListener(new OnClickListener() {
48 |
49 | @Override
50 | public void onClick(final View flatButton) {
51 | Dialog dialog = new Dialog(WidgetActivity.this, "Title", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam");
52 | dialog.setOnAcceptButtonClickListener(new OnClickListener() {
53 |
54 | @Override
55 | public void onClick(View v) {
56 | Toast.makeText(WidgetActivity.this, "Click accept button", 1).show();
57 | }
58 | });
59 | dialog.setOnCancelButtonClickListener(new OnClickListener() {
60 |
61 | @Override
62 | public void onClick(View v) {
63 | Toast.makeText(WidgetActivity.this, "Click cancel button", 1).show();
64 | }
65 | });
66 | dialog.show();
67 | }
68 | });
69 | // SHOW COLOR SEECTOR
70 | findViewById(R.id.buttonColorSelector).setOnClickListener(new OnClickListener() {
71 |
72 | @Override
73 | public void onClick(final View flatButton) {
74 | new ColorSelector(WidgetActivity.this, Color.RED, null).show();
75 | }
76 | });
77 | }
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/drawable-xhdpi/ic_action_new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/drawable-xhdpi/ic_action_new.png
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/drawable-xhdpi/ic_next.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/drawable-xhdpi/ic_next.png
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/drawable-xhdpi/icn_button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/drawable-xhdpi/icn_button.png
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/drawable-xhdpi/icn_progress.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/drawable-xhdpi/icn_progress.png
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/drawable-xhdpi/icn_select_color.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/drawable-xhdpi/icn_select_color.png
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/drawable-xhdpi/icn_switch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/drawable-xhdpi/icn_switch.png
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/drawable-xhdpi/icn_widget.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/drawable-xhdpi/icn_widget.png
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/drawable/blue_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/drawable/selector_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/drawable/transparent_backgrouns.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/layout/activity_buttons.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
11 |
12 |
16 |
17 |
18 |
19 |
23 |
24 |
29 |
30 |
35 |
36 |
37 |
40 |
41 |
48 |
49 |
50 |
51 |
55 |
56 |
61 |
62 |
67 |
68 |
69 |
72 |
73 |
80 |
81 |
82 |
83 |
87 |
88 |
93 |
94 |
99 |
100 |
101 |
104 |
105 |
112 |
113 |
114 |
115 |
116 |
120 |
121 |
126 |
127 |
132 |
133 |
134 |
137 |
138 |
145 |
146 |
147 |
148 |
149 |
153 |
154 |
159 |
160 |
165 |
166 |
167 |
168 |
178 |
179 |
180 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
12 |
13 |
19 |
20 |
27 |
28 |
29 |
34 |
35 |
43 |
44 |
45 |
49 |
50 |
55 |
56 |
61 |
62 |
63 |
69 |
70 |
76 |
77 |
83 |
84 |
85 |
91 |
92 |
98 |
99 |
105 |
106 |
107 |
113 |
114 |
120 |
121 |
127 |
128 |
129 |
135 |
136 |
142 |
143 |
149 |
150 |
151 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/layout/activity_progress.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
13 |
14 |
18 |
19 |
24 |
25 |
30 |
31 |
32 |
35 |
36 |
42 |
43 |
44 |
45 |
49 |
50 |
55 |
56 |
61 |
62 |
63 |
66 |
67 |
73 |
74 |
75 |
76 |
80 |
81 |
86 |
87 |
92 |
93 |
94 |
97 |
98 |
104 |
105 |
106 |
107 |
108 |
112 |
113 |
118 |
119 |
124 |
125 |
126 |
129 |
130 |
136 |
137 |
138 |
139 |
143 |
144 |
149 |
150 |
155 |
156 |
157 |
160 |
161 |
170 |
171 |
172 |
173 |
177 |
178 |
183 |
184 |
189 |
190 |
191 |
194 |
195 |
204 |
205 |
206 |
207 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/layout/activity_switchs.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
14 |
15 |
19 |
20 |
25 |
26 |
31 |
32 |
33 |
36 |
37 |
44 |
45 |
46 |
47 |
51 |
52 |
57 |
58 |
63 |
64 |
65 |
68 |
69 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/layout/activity_widgets.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
14 |
18 |
19 |
24 |
25 |
30 |
31 |
32 |
35 |
36 |
42 |
43 |
47 |
48 |
53 |
54 |
59 |
60 |
61 |
64 |
65 |
71 |
72 |
76 |
77 |
82 |
83 |
88 |
89 |
90 |
93 |
94 |
100 |
101 |
102 |
103 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | MaterialDesignDemo
4 |
5 |
6 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/MaterialDesignDemo/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.+'
9 | // COMMENT TO DEVELOPER MODE / UNCOMMENT TO UPLOAD TO BINTARRAY
10 | // classpath 'org.codehaus.groovy:groovy-backports-compat23:2.3.5'
11 | // classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
12 | // classpath 'com.github.dcendents:android-maven-plugin:1.2'
13 | }
14 | }
15 |
16 | allprojects {
17 | repositories {
18 | jcenter()
19 | mavenCentral()
20 | }
21 |
22 | group = "com.github.navasmdc"
23 | version = "1.5"
24 | }
25 |
26 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Settings specified in this file will override any Gradle settings
5 | # configured through the IDE.
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
19 |
20 | VERSION_NAME=1.4
21 | VERSION_CODE=6
22 |
23 | GROUP=com.github.navasmdc
24 |
25 | POM_DESCRIPTION=This is a library with components of Android L to you use in android 2.2
26 | POM_URL=https://github.com/navasmdc/MaterialDesignLibrary
27 | POM_SCM_URL=https://github.com/navasmdc/MaterialDesignLibrary
28 | POM_SCM_CONNECTION=scm:git@github.com:navasmdc/MaterialDesignLibrary.git
29 | POM_SCM_DEV_CONNECTION=scm:git@github.com:navasmdc/MaterialDesignLibrary.git
30 | POM_LICENCE_NAME=The Apache Software License, Version 2.0
31 | POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
32 | POM_LICENCE_DIST=repo
33 | POM_DEVELOPER_ID=navasmdc
34 | POM_DEVELOPER_NAME=Ivan Navas
35 |
36 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/MaterialDesignLibrary/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/MaterialDesignLibrary/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Aug 22 18:02:59 CEST 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.4-all.zip
7 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/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 |
--------------------------------------------------------------------------------
/MaterialDesignLibrary/settings.gradle:
--------------------------------------------------------------------------------
1 | // DEVELOPER MODE
2 | include ':MaterialDesignDemo', ':MaterialDesign'
3 | // UPLOAd LIBRARY TO BINTARRAY
4 | //include ':MaterialDesign'
5 |
--------------------------------------------------------------------------------
/images/body-bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/images/body-bg.jpg
--------------------------------------------------------------------------------
/images/checkbox.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/images/checkbox.png
--------------------------------------------------------------------------------
/images/color_selector.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/images/color_selector.png
--------------------------------------------------------------------------------
/images/dialog.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/images/dialog.png
--------------------------------------------------------------------------------
/images/download-button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/images/download-button.png
--------------------------------------------------------------------------------
/images/flat_button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/images/flat_button.png
--------------------------------------------------------------------------------
/images/float_button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/images/float_button.png
--------------------------------------------------------------------------------
/images/float_small_button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/images/float_small_button.png
--------------------------------------------------------------------------------
/images/github-button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/images/github-button.png
--------------------------------------------------------------------------------
/images/header-bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/images/header-bg.jpg
--------------------------------------------------------------------------------
/images/highlight-bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/images/highlight-bg.jpg
--------------------------------------------------------------------------------
/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/images/logo.png
--------------------------------------------------------------------------------
/images/progress_bar_circular_indeterminate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/images/progress_bar_circular_indeterminate.png
--------------------------------------------------------------------------------
/images/progress_bar_determinate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/images/progress_bar_determinate.png
--------------------------------------------------------------------------------
/images/progress_bar_indeterminate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/images/progress_bar_indeterminate.png
--------------------------------------------------------------------------------
/images/progress_bar_indeterminate_determinate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/images/progress_bar_indeterminate_determinate.png
--------------------------------------------------------------------------------
/images/rectangle_button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/images/rectangle_button.png
--------------------------------------------------------------------------------
/images/sidebar-bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/images/sidebar-bg.jpg
--------------------------------------------------------------------------------
/images/slider.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/images/slider.png
--------------------------------------------------------------------------------
/images/slider_with_number_indicator.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/images/slider_with_number_indicator.png
--------------------------------------------------------------------------------
/images/snackbar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/images/snackbar.png
--------------------------------------------------------------------------------
/images/switch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/navasmdc/MaterialDesignLibrary/7271050ff486cc4038e13f02b10a28aa4cf5b8cf/images/switch.png
--------------------------------------------------------------------------------
/javascripts/main.js:
--------------------------------------------------------------------------------
1 | console.log('This would be the main JS file.');
2 |
--------------------------------------------------------------------------------
/params.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Materialdesignlibrary",
3 | "tagline": "This is a library with components of Android L to you use in android 2.2",
4 | "body": "\r\n\r\n# Material Design Android Library\r\n\r\n\r\n
\r\n\r\n\r\n\r\n[](https://android-arsenal.com/details/1/1156)\r\n\r\n* [How to use](#howtouse)\r\n* [Components](#components)\r\n * [Buttons](#buttons)\r\n * [Flat Button](#flat-button)\r\n * [Rectangle Button](#rectangle-button)\r\n * [Float Button](#float-button)\r\n * [Float small button](#float-small-button)\r\n * [Switches](#switches)\r\n * [CheckBox](#checkbox)\r\n * [Switch](#switch)\r\n * [Progress indicators](#progress-indicators)\r\n * [Progress bar circular indeterminate](#progress-bar-circula-rindeterminate)\r\n * [Progress bar indeterminate](#progress-bar-indeterminate)\r\n * [Progress bar indeterminate determinate](#progress-bar-indeterminate-determinate)\r\n * [Progress bar determinate](#progress-bar-determinate)\r\n * [Slider](#slider)\r\n * [Slider with number indicator](#slider-with-number-indicator)\r\n* [Widgets](#widgets)\r\n * [SnackBar](#snackbar)\r\n * [Dialog](#dialog)\r\n * [Color selector](#color-selector)\r\n\r\n## How to use\r\n\r\nIf you want use this library, you only have to download MaterialDesign project, import it into your workspace and add the project as a library in your android project settings.\r\n\r\nIf you prefer it, you can use the gradle dependency, you have to add these lines in your build.gradle file:\r\n\r\n```xml\r\nrepositories {\r\n jcenter()\r\n}\r\n\r\ndependencies {\r\n compile 'com.github.navasmdc:MaterialDesign:1.5@aar'\r\n}\r\n```\r\n\r\nSome components have custom attributes, if you want use them, you must add this line in your xml file in the first component:\r\n\r\n```xml\r\n\r\n\r\n```\r\n\r\n>If you are going to use a ScrollView, it is recommended that you use the CustomScrollView provided in this library to avoid problems with the custom components.\r\n>To use this component:\r\n>```xml\r\n> xmlns:android=\"http://schemas.android.com/apk/res/android\"\r\n> xmlns:materialdesign=\"http://schemas.android.com/apk/res-auto\"\r\n> android:id=\"@+id/scroll\"\r\n> android:layout_width=\"match_parent\"\r\n> android:layout_height=\"match_parent\">\r\n>\r\n>```\r\n\r\n##Components\r\n\r\n####Buttons\r\n\r\n######Flat Button\r\n\r\n\r\n```xml\r\n\r\n```\r\n\r\n######Rectangle Button\r\n\r\n\r\n```xml\r\n\r\n```\r\n\r\n######Float Button\r\n\r\n\r\n\r\n>It is recommended to put this component in the right-bottom of the screen. To use this component write this code in your xml file.\r\n>If you don`t want to start this component with animation set the animate attribute to false.\r\n>Put your icon in the icon attribute to set the drawable icon for this component.\r\n\r\n```xml\r\n\r\n \r\n \r\n\r\n```\r\n\r\n######Float small button\r\n\r\n\r\n\r\n```xml\r\n\r\n```\r\n\r\n####Switches\r\n\r\n######CheckBox\r\n\r\n\r\n```xml\r\n\r\n```\r\n\r\n######Switch\r\n\r\n\r\n```xml\r\n\r\n```\r\n\r\n####Progress indicators\r\n\r\n######Progress bar circular indeterminate\r\n\r\n\r\n```xml\r\n\r\n```\r\n\r\n######Progress bar indeterminate\r\n\r\n\r\n```xml\r\n\r\n```\r\n\r\n######Progress bar indeterminate determinate\r\n\r\n\r\n\r\n```xml\r\n\r\n```\r\n\r\n>If you begin progrees, you only have to set progress it\r\n>\r\n>```java\r\n>progressBarIndeterminateDeterminate.setProgress(progress);\r\n>```\r\n\r\n######Progress bar determinate\r\n\r\n\r\n\r\n```xml\r\n\r\n```\r\n\r\n>You can custom max and min progress values with `materialdesign:max=\"50\"` and `materialdesign:min=\"25\"` attributes.\r\n\r\n######Slider\r\n\r\n\r\n\r\n```xml\r\n\r\n```\r\n\r\n######Slider with number indicator\r\n\r\n\r\n\r\n```xml\r\n\r\n```\r\n\r\n##Widgets\r\n\r\n####SnackBar\r\n\r\n\r\n\r\n\r\n```java\r\nSnackBar snackbar = new SnackBar(Activity activity, String text, String buttonText, View.OnClickListener onClickListener);\r\nsnackbar.show();\r\n```\r\n\r\n> If you don't want to show the button, put `null` in `buttonText` attribute\r\n\r\n####Dialog\r\n\r\n\r\n\r\n```java\r\nDialog dialog = new Dialog(Context context,String title, String message);\r\ndialog.show();\r\n```\r\n\r\n>You can set the accept and cancel button on the event listener or change it's text\r\n>```java\r\n> // Set accept click listenner\r\n>dialog.setOnAcceptButtonClickListener(View.OnClickListener onAcceptButtonClickListener);\r\n> // Set cancel click listenner\r\n>dialog.setOnCancelButtonClickListener(View.OnClickListener onCancelButtonClickListener);\r\n> // Acces to accept button\r\n>ButtonFlat acceptButton = dialog.getButtonAccept();\r\n> // Acces to cancel button\r\n>ButtonFlat cancelButton = dialog.getButtonCancel();\r\n>```\r\n\r\n####Color selector\r\n\r\n\r\n\r\n```java\r\nColorSelector colorSelector = new ColorSelector(Context context,int intialColor, OnColorSelectedListener onColorSelectedListener);\r\ncolorSelector.show();\r\n```\r\n\r\n\r\n\r\n\r\n\r\n",
5 | "note": "Don't delete this file! It's used internally to help with page regeneration."
6 | }
--------------------------------------------------------------------------------
/stylesheets/github-light.css:
--------------------------------------------------------------------------------
1 | /*
2 | The MIT License (MIT)
3 |
4 | Copyright (c) 2016 GitHub, Inc.
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in all
14 | copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | SOFTWARE.
23 |
24 | */
25 |
26 | .pl-c /* comment */ {
27 | color: #969896;
28 | }
29 |
30 | .pl-c1 /* constant, variable.other.constant, support, meta.property-name, support.constant, support.variable, meta.module-reference, markup.raw, meta.diff.header */,
31 | .pl-s .pl-v /* string variable */ {
32 | color: #0086b3;
33 | }
34 |
35 | .pl-e /* entity */,
36 | .pl-en /* entity.name */ {
37 | color: #795da3;
38 | }
39 |
40 | .pl-smi /* variable.parameter.function, storage.modifier.package, storage.modifier.import, storage.type.java, variable.other */,
41 | .pl-s .pl-s1 /* string source */ {
42 | color: #333;
43 | }
44 |
45 | .pl-ent /* entity.name.tag */ {
46 | color: #63a35c;
47 | }
48 |
49 | .pl-k /* keyword, storage, storage.type */ {
50 | color: #a71d5d;
51 | }
52 |
53 | .pl-s /* string */,
54 | .pl-pds /* punctuation.definition.string, string.regexp.character-class */,
55 | .pl-s .pl-pse .pl-s1 /* string punctuation.section.embedded source */,
56 | .pl-sr /* string.regexp */,
57 | .pl-sr .pl-cce /* string.regexp constant.character.escape */,
58 | .pl-sr .pl-sre /* string.regexp source.ruby.embedded */,
59 | .pl-sr .pl-sra /* string.regexp string.regexp.arbitrary-repitition */ {
60 | color: #183691;
61 | }
62 |
63 | .pl-v /* variable */ {
64 | color: #ed6a43;
65 | }
66 |
67 | .pl-id /* invalid.deprecated */ {
68 | color: #b52a1d;
69 | }
70 |
71 | .pl-ii /* invalid.illegal */ {
72 | color: #f8f8f8;
73 | background-color: #b52a1d;
74 | }
75 |
76 | .pl-sr .pl-cce /* string.regexp constant.character.escape */ {
77 | font-weight: bold;
78 | color: #63a35c;
79 | }
80 |
81 | .pl-ml /* markup.list */ {
82 | color: #693a17;
83 | }
84 |
85 | .pl-mh /* markup.heading */,
86 | .pl-mh .pl-en /* markup.heading entity.name */,
87 | .pl-ms /* meta.separator */ {
88 | font-weight: bold;
89 | color: #1d3e81;
90 | }
91 |
92 | .pl-mq /* markup.quote */ {
93 | color: #008080;
94 | }
95 |
96 | .pl-mi /* markup.italic */ {
97 | font-style: italic;
98 | color: #333;
99 | }
100 |
101 | .pl-mb /* markup.bold */ {
102 | font-weight: bold;
103 | color: #333;
104 | }
105 |
106 | .pl-md /* markup.deleted, meta.diff.header.from-file */ {
107 | color: #bd2c00;
108 | background-color: #ffecec;
109 | }
110 |
111 | .pl-mi1 /* markup.inserted, meta.diff.header.to-file */ {
112 | color: #55a532;
113 | background-color: #eaffea;
114 | }
115 |
116 | .pl-mdr /* meta.diff.range */ {
117 | font-weight: bold;
118 | color: #795da3;
119 | }
120 |
121 | .pl-mo /* meta.output */ {
122 | color: #1d3e81;
123 | }
124 |
125 |
--------------------------------------------------------------------------------
/stylesheets/print.css:
--------------------------------------------------------------------------------
1 | html, body, div, span, applet, object, iframe,
2 | h1, h2, h3, h4, h5, h6, p, blockquote, pre,
3 | a, abbr, acronym, address, big, cite, code,
4 | del, dfn, em, img, ins, kbd, q, s, samp,
5 | small, strike, strong, sub, sup, tt, var,
6 | b, u, i, center,
7 | dl, dt, dd, ol, ul, li,
8 | fieldset, form, label, legend,
9 | table, caption, tbody, tfoot, thead, tr, th, td,
10 | article, aside, canvas, details, embed,
11 | figure, figcaption, footer, header, hgroup,
12 | menu, nav, output, ruby, section, summary,
13 | time, mark, audio, video {
14 | padding: 0;
15 | margin: 0;
16 | font: inherit;
17 | font-size: 100%;
18 | vertical-align: baseline;
19 | border: 0;
20 | }
21 | /* HTML5 display-role reset for older browsers */
22 | article, aside, details, figcaption, figure,
23 | footer, header, hgroup, menu, nav, section {
24 | display: block;
25 | }
26 | body {
27 | line-height: 1;
28 | }
29 | ol, ul {
30 | list-style: none;
31 | }
32 | blockquote, q {
33 | quotes: none;
34 | }
35 | blockquote:before, blockquote:after,
36 | q:before, q:after {
37 | content: '';
38 | content: none;
39 | }
40 | table {
41 | border-spacing: 0;
42 | border-collapse: collapse;
43 | }
44 | body {
45 | font-family: 'Helvetica Neue', Helvetica, Arial, serif;
46 | font-size: 13px;
47 | line-height: 1.5;
48 | color: #000;
49 | }
50 |
51 | a {
52 | font-weight: bold;
53 | color: #d5000d;
54 | }
55 |
56 | header {
57 | padding-top: 35px;
58 | padding-bottom: 10px;
59 | }
60 |
61 | header h1 {
62 | font-size: 48px;
63 | font-weight: bold;
64 | line-height: 1.2;
65 | color: #303030;
66 | letter-spacing: -1px;
67 | }
68 |
69 | header h2 {
70 | font-size: 24px;
71 | font-weight: normal;
72 | line-height: 1.3;
73 | color: #aaa;
74 | letter-spacing: -1px;
75 | }
76 | #downloads {
77 | display: none;
78 | }
79 | #main_content {
80 | padding-top: 20px;
81 | }
82 |
83 | code, pre {
84 | margin-bottom: 30px;
85 | font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal;
86 | font-size: 12px;
87 | color: #222;
88 | }
89 |
90 | code {
91 | padding: 0 3px;
92 | }
93 |
94 | pre {
95 | padding: 20px;
96 | overflow: auto;
97 | border: solid 1px #ddd;
98 | }
99 | pre code {
100 | padding: 0;
101 | }
102 |
103 | ul, ol, dl {
104 | margin-bottom: 20px;
105 | }
106 |
107 |
108 | /* COMMON STYLES */
109 |
110 | table {
111 | width: 100%;
112 | border: 1px solid #ebebeb;
113 | }
114 |
115 | th {
116 | font-weight: 500;
117 | }
118 |
119 | td {
120 | font-weight: 300;
121 | text-align: center;
122 | border: 1px solid #ebebeb;
123 | }
124 |
125 | form {
126 | padding: 20px;
127 | background: #f2f2f2;
128 |
129 | }
130 |
131 |
132 | /* GENERAL ELEMENT TYPE STYLES */
133 |
134 | h1 {
135 | font-size: 2.8em;
136 | }
137 |
138 | h2 {
139 | margin-bottom: 8px;
140 | font-size: 22px;
141 | font-weight: bold;
142 | color: #303030;
143 | }
144 |
145 | h3 {
146 | margin-bottom: 8px;
147 | font-size: 18px;
148 | font-weight: bold;
149 | color: #d5000d;
150 | }
151 |
152 | h4 {
153 | font-size: 16px;
154 | font-weight: bold;
155 | color: #303030;
156 | }
157 |
158 | h5 {
159 | font-size: 1em;
160 | color: #303030;
161 | }
162 |
163 | h6 {
164 | font-size: .8em;
165 | color: #303030;
166 | }
167 |
168 | p {
169 | margin-bottom: 20px;
170 | font-weight: 300;
171 | }
172 |
173 | a {
174 | text-decoration: none;
175 | }
176 |
177 | p a {
178 | font-weight: 400;
179 | }
180 |
181 | blockquote {
182 | padding: 0 0 0 30px;
183 | margin-bottom: 20px;
184 | font-size: 1.6em;
185 | border-left: 10px solid #e9e9e9;
186 | }
187 |
188 | ul li {
189 | padding-left: 20px;
190 | list-style-position: inside;
191 | list-style: disc;
192 | }
193 |
194 | ol li {
195 | padding-left: 3px;
196 | list-style-position: inside;
197 | list-style: decimal;
198 | }
199 |
200 | dl dd {
201 | font-style: italic;
202 | font-weight: 100;
203 | }
204 |
205 | footer {
206 | padding-top: 20px;
207 | padding-bottom: 30px;
208 | margin-top: 40px;
209 | font-size: 13px;
210 | color: #aaa;
211 | }
212 |
213 | footer a {
214 | color: #666;
215 | }
216 |
217 | /* MISC */
218 | .clearfix:after {
219 | display: block;
220 | height: 0;
221 | clear: both;
222 | visibility: hidden;
223 | content: '.';
224 | }
225 |
226 | .clearfix {display: inline-block;}
227 | * html .clearfix {height: 1%;}
228 | .clearfix {display: block;}
229 |
--------------------------------------------------------------------------------