Showing preview only (280K chars total). Download the full file or copy to clipboard to get everything.
Repository: navasmdc/MaterialDesignLibrary
Branch: master
Commit: 7271050ff486
Files: 91
Total size: 251.8 KB
Directory structure:
gitextract_cquzdhju/
├── .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/
│ │ │ ├── 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/
│ │ │ ├── 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
│ │ └── values/
│ │ ├── strings.xml
│ │ └── styles.xml
│ ├── build.gradle
│ ├── gradle/
│ │ └── wrapper/
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
│ ├── gradle.properties
│ ├── gradlew
│ ├── gradlew.bat
│ └── settings.gradle
├── README.md
├── index.html
├── javascripts/
│ └── main.js
├── params.json
└── stylesheets/
├── github-light.css
├── print.css
└── stylesheet.css
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
# Built application files
*.apk
*.ap_
# Files for the Dalvik VM
*.dex
# Java class files
*.class
# Generated files
bin/
gen/
# Gradle files
.gradle/
build/
# Local configuration file (sdk path, etc)
local.properties
# Proguard folder generated by Eclipse
proguard/
# Log Files
*.log
.idea/
*.iml
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: MaterialDesignLibrary/.gitignore
================================================
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
================================================
FILE: MaterialDesignLibrary/MaterialDesign/.gitignore
================================================
/build
================================================
FILE: MaterialDesignLibrary/MaterialDesign/build.gradle
================================================
apply plugin: 'com.android.library'
// COMMENT TO DEVELOPER MODE / UNCOMMENT TO UPLOAD TO BINTARRAY
//apply plugin: 'com.github.dcendents.android-maven'
//apply plugin: 'com.jfrog.bintray'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.nineoldandroids:library:2.4.+'
compile 'com.android.support:support-v4:22.+'
compile fileTree(dir: 'libs', include: '*.jar')
}
// COMMENT TO DEVELOPER MODE / UNCOMMENT TO UPLOAD TO BINTARRAY
//ext.siteUrl = 'https://github.com/navasmdc/MaterialDesignLibrary'
//ext.issueUrl = 'https://github.com/navasmdc/MaterialDesignLibrary/issues'
//ext.gitUrl = 'https://github.com/navasmdc/MaterialDesignLibrary.git'
//
//bintray {
// user = hasProperty('BINTRAY_USER') ? BINTRAY_USER : "navasmdc"
// key = hasProperty('BINTRAY_KEY') ? BINTRAY_PASSWORD : ""
//
// configurations = ["archives"]
// pkg {
// repo = 'maven'
// name = 'MaterialDesignLibrary'
// desc = 'This is a library with components of Android L to you use in android 2.2'
// websiteUrl = siteUrl
// issueTrackerUrl = issueUrl
// vcsUrl = gitUrl
// licenses = ['Apache-2.0']
// labels = []
// publicDownloadNumbers = true
// }
//}
//install {
// repositories.mavenInstaller {
// pom {
// project {
// packaging 'aar'
// name 'MaterialDesignLibrary'
// url siteUrl
// licenses {
// license {
// name 'The Apache Software License, Version 2.0'
// url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
// }
// }
// developers {
// developer {
// id 'navasmdc'
// name 'Iván Navas'
// email 'i.navas.mdc@gmail.com'
// }
// }
// scm {
// connection gitUrl
// developerConnection gitUrl
// url siteUrl
// }
// }
// }
// }
//}
//
//task sourcesJar(type: Jar) {
// from android.sourceSets.main.java.srcDirs
// classifier = 'sources'
//}
//
//task javadoc(type: Javadoc) {
// source = android.sourceSets.main.java.srcDirs
// classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
//}
//
//task javadocJar(type: Jar, dependsOn: javadoc) {
// classifier = 'javadoc'
// from javadoc.destinationDir
//}
//
//artifacts {
// archives javadocJar
// archives sourcesJar
//}
//
//task findConventions << {
// println project.getConvention()
//}
================================================
FILE: MaterialDesignLibrary/MaterialDesign/gradle.properties
================================================
POM_NAME=MaterialDesignLibrary
POM_ARTIFACT_ID=material-design-library
POM_PACKAGING=aar
================================================
FILE: MaterialDesignLibrary/MaterialDesign/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Applications/adt-bundle-mac-x86_64-20140321/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/androidTest/java/com/gc/materialdesign/ApplicationTest.java
================================================
package com.gc.materialdesign;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/AndroidManifest.xml
================================================
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gc.materialdesign">
<application android:allowBackup="true" android:label="@string/app_name">
</application>
</manifest>
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/utils/Utils.java
================================================
package com.gc.materialdesign.utils;
import android.content.res.Resources;
import android.util.TypedValue;
import android.view.View;
public class Utils {
/**
* Convert Dp to Pixel
*/
public static int dpToPx(float dp, Resources resources){
float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, resources.getDisplayMetrics());
return (int) px;
}
public static int getRelativeTop(View myView) {
// if (myView.getParent() == myView.getRootView())
if(myView.getId() == android.R.id.content)
return myView.getTop();
else
return myView.getTop() + getRelativeTop((View) myView.getParent());
}
public static int getRelativeLeft(View myView) {
// if (myView.getParent() == myView.getRootView())
if(myView.getId() == android.R.id.content)
return myView.getLeft();
else
return myView.getLeft() + getRelativeLeft((View) myView.getParent());
}
}
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/AutoHideButtonFloat.java
================================================
package com.gc.materialdesign.views;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.AbsListView;
import android.widget.ListView;
import com.gc.materialdesign.views.ButtonFloat;
import com.nineoldandroids.view.ViewPropertyAnimator;
/**
* Created by hamedpc on 4/25/2015.
* This widget uses NineOldAndroid to animate the view so you're gonna need to include it in your project
*/
public class AutoHideButtonFloat extends ButtonFloat implements AbsListView.OnScrollListener {
ListView listView;
private boolean floatHiding = false, floatShowing = false;
private int mLastFirstVisibleItem;
private View view = this;
private AbsListView.OnScrollListener onScrollListener;
public AutoHideButtonFloat(Context context, AttributeSet attrs) {
super(context, attrs);
}
public void setOnScrollListener(AbsListView.OnScrollListener onScrollListener) {
this.onScrollListener = onScrollListener;
}
public void setListView(ListView listView) {
this.listView = listView;
this.listView.setOnScrollListener(this);
}
@Override
public void onScrollStateChanged(AbsListView absListView, int scrollState) {
switch (scrollState) {
case AbsListView.SCROLL_AXIS_NONE:
floatHiding = false;
floatShowing = false;
ViewPropertyAnimator.animate(view).translationY(0).setDuration(300);
break;
}
if (onScrollListener != null)
onScrollListener.onScrollStateChanged(absListView, scrollState);
}
@Override
public void onScroll(AbsListView absListView, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
if (mLastFirstVisibleItem < firstVisibleItem) {
if (floatShowing) floatShowing = false;
if (!floatHiding) {
ViewPropertyAnimator.animate(view).translationY(500).setDuration(300);
floatHiding = true;
}
}
if (mLastFirstVisibleItem > firstVisibleItem) {
if (floatHiding) {
floatHiding = false;
}
if (!floatShowing) {
ViewPropertyAnimator.animate(view).translationY(0).setDuration(300);
floatShowing = true;
}
}
mLastFirstVisibleItem = firstVisibleItem;
if (onScrollListener != null)
onScrollListener.onScroll(absListView, firstVisibleItem, visibleItemCount, totalItemCount);
}
}
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/Button.java
================================================
package com.gc.materialdesign.views;
import com.gc.materialdesign.R;
import com.gc.materialdesign.utils.Utils;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.Bitmap.Config;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.LayerDrawable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.TextView;
public abstract class Button extends CustomView {
final static String ANDROIDXML = "http://schemas.android.com/apk/res/android";
// Complete in child class
int minWidth;
int minHeight;
int background;
float rippleSpeed = 12f;
int rippleSize = 3;
Integer rippleColor;
OnClickListener onClickListener;
boolean clickAfterRipple = true;
int backgroundColor = Color.parseColor("#1E88E5");
TextView textButton;
public Button(Context context, AttributeSet attrs) {
super(context, attrs);
setDefaultProperties();
clickAfterRipple = attrs.getAttributeBooleanValue(MATERIALDESIGNXML,
"animate", true);
setAttributes(attrs);
beforeBackground = backgroundColor;
if (rippleColor == null)
rippleColor = makePressColor();
}
protected void setDefaultProperties() {
// Min size
setMinimumHeight(Utils.dpToPx(minHeight, getResources()));
setMinimumWidth(Utils.dpToPx(minWidth, getResources()));
// Background shape
setBackgroundResource(background);
setBackgroundColor(backgroundColor);
}
// Set atributtes of XML to View
abstract protected void setAttributes(AttributeSet attrs);
// ### RIPPLE EFFECT ###
float x = -1, y = -1;
float radius = -1;
@Override
public boolean onTouchEvent(MotionEvent event) {
invalidate();
if (isEnabled()) {
isLastTouch = true;
if (event.getAction() == MotionEvent.ACTION_DOWN) {
radius = getHeight() / rippleSize;
x = event.getX();
y = event.getY();
} else if (event.getAction() == MotionEvent.ACTION_MOVE) {
radius = getHeight() / rippleSize;
x = event.getX();
y = event.getY();
if (!((event.getX() <= getWidth() && event.getX() >= 0) && (event
.getY() <= getHeight() && event.getY() >= 0))) {
isLastTouch = false;
x = -1;
y = -1;
}
} else if (event.getAction() == MotionEvent.ACTION_UP) {
if ((event.getX() <= getWidth() && event.getX() >= 0)
&& (event.getY() <= getHeight() && event.getY() >= 0)) {
radius++;
if (!clickAfterRipple && onClickListener != null) {
onClickListener.onClick(this);
}
} else {
isLastTouch = false;
x = -1;
y = -1;
}
} else if (event.getAction() == MotionEvent.ACTION_CANCEL) {
isLastTouch = false;
x = -1;
y = -1;
}
}
return true;
}
@Override
protected void onFocusChanged(boolean gainFocus, int direction,
Rect previouslyFocusedRect) {
if (!gainFocus) {
x = -1;
y = -1;
}
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
// super.onInterceptTouchEvent(ev);
return true;
}
public Bitmap makeCircle() {
Bitmap output = Bitmap.createBitmap(
getWidth() - Utils.dpToPx(6, getResources()), getHeight()
- Utils.dpToPx(7, getResources()), Config.ARGB_8888);
Canvas canvas = new Canvas(output);
canvas.drawARGB(0, 0, 0, 0);
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setColor(rippleColor);
canvas.drawCircle(x, y, radius, paint);
if (radius > getHeight() / rippleSize)
radius += rippleSpeed;
if (radius >= getWidth()) {
x = -1;
y = -1;
radius = getHeight() / rippleSize;
if (onClickListener != null && clickAfterRipple)
onClickListener.onClick(this);
}
return output;
}
/**
* Make a dark color to ripple effect
*
* @return
*/
protected int makePressColor() {
int r = (this.backgroundColor >> 16) & 0xFF;
int g = (this.backgroundColor >> 8) & 0xFF;
int b = (this.backgroundColor >> 0) & 0xFF;
r = (r - 30 < 0) ? 0 : r - 30;
g = (g - 30 < 0) ? 0 : g - 30;
b = (b - 30 < 0) ? 0 : b - 30;
return Color.rgb(r, g, b);
}
@Override
public void setOnClickListener(OnClickListener l) {
onClickListener = l;
}
// Set color of background
public void setBackgroundColor(int color) {
this.backgroundColor = color;
if (isEnabled())
beforeBackground = backgroundColor;
try {
LayerDrawable layer = (LayerDrawable) getBackground();
GradientDrawable shape = (GradientDrawable) layer
.findDrawableByLayerId(R.id.shape_bacground);
shape.setColor(backgroundColor);
rippleColor = makePressColor();
} catch (Exception ex) {
// Without bacground
}
}
public void setRippleSpeed(float rippleSpeed) {
this.rippleSpeed = rippleSpeed;
}
public float getRippleSpeed() {
return this.rippleSpeed;
}
public void setText(String text) {
textButton.setText(text);
}
public void setTextColor(int color) {
textButton.setTextColor(color);
}
public TextView getTextView() {
return textButton;
}
public String getText() {
return textButton.getText().toString();
}
}
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonFlat.java
================================================
package com.gc.materialdesign.views;
import com.gc.materialdesign.R;
import com.gc.materialdesign.utils.Utils;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.RelativeLayout;
import android.widget.TextView;
public class ButtonFlat extends Button {
TextView textButton;
public ButtonFlat(Context context, AttributeSet attrs) {
super(context, attrs);
}
protected void setDefaultProperties(){
minHeight = 36;
minWidth = 88;
rippleSize = 3;
// Min size
setMinimumHeight(Utils.dpToPx(minHeight, getResources()));
setMinimumWidth(Utils.dpToPx(minWidth, getResources()));
setBackgroundResource(R.drawable.background_transparent);
}
@Override
protected void setAttributes(AttributeSet attrs) {
// Set text button
String text = null;
int textResource = attrs.getAttributeResourceValue(ANDROIDXML,"text",-1);
if(textResource != -1){
text = getResources().getString(textResource);
}else{
text = attrs.getAttributeValue(ANDROIDXML,"text");
}
if(text != null){
textButton = new TextView(getContext());
textButton.setText(text.toUpperCase());
textButton.setTextColor(backgroundColor);
textButton.setTypeface(null, Typeface.BOLD);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
textButton.setLayoutParams(params);
addView(textButton);
}
int bacgroundColor = attrs.getAttributeResourceValue(ANDROIDXML,"background",-1);
if(bacgroundColor != -1){
setBackgroundColor(getResources().getColor(bacgroundColor));
}else{
// Color by hexadecimal
// Color by hexadecimal
background = attrs.getAttributeIntValue(ANDROIDXML, "background", -1);
if (background != -1)
setBackgroundColor(background);
}
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (x != -1) {
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setColor(makePressColor());
canvas.drawCircle(x, y, radius, paint);
if(radius > getHeight()/rippleSize)
radius += rippleSpeed;
if(radius >= getWidth()){
x = -1;
y = -1;
radius = getHeight()/rippleSize;
if(onClickListener != null&& clickAfterRipple)
onClickListener.onClick(this);
}
invalidate();
}
}
/**
* Make a dark color to ripple effect
* @return
*/
@Override
protected int makePressColor(){
return Color.parseColor("#88DDDDDD");
}
public void setText(String text){
textButton.setText(text.toUpperCase());
}
// Set color of background
public void setBackgroundColor(int color){
backgroundColor = color;
if(isEnabled())
beforeBackground = backgroundColor;
textButton.setTextColor(color);
}
@Override
public TextView getTextView() {
return textButton;
}
public String getText(){
return textButton.getText().toString();
}
}
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonFloat.java
================================================
package com.gc.materialdesign.views;
import com.gc.materialdesign.R;
import com.gc.materialdesign.utils.Utils;
import com.nineoldandroids.animation.ObjectAnimator;
import com.nineoldandroids.view.ViewHelper;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff.Mode;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.Bitmap.Config;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.LayerDrawable;
import android.util.AttributeSet;
import android.view.animation.BounceInterpolator;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.RelativeLayout;
import android.widget.TextView;
public class ButtonFloat extends Button{
int sizeIcon = 24;
int sizeRadius = 28;
ImageView icon; // Icon of float button
Drawable drawableIcon;
public boolean isShow = false;
float showPosition;
float hidePosition;
public ButtonFloat(Context context, AttributeSet attrs) {
super(context, attrs);
setBackgroundResource(R.drawable.background_button_float);
setBackgroundColor(backgroundColor);
sizeRadius = 28;
setDefaultProperties();
icon = new ImageView(context);
icon.setAdjustViewBounds(true);
icon.setScaleType(ScaleType.CENTER_CROP);
if(drawableIcon != null) {
icon.setImageDrawable(drawableIcon);
}
LayoutParams params = new LayoutParams(Utils.dpToPx(sizeIcon, getResources()),Utils.dpToPx(sizeIcon, getResources()));
params.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
icon.setLayoutParams(params);
addView(icon);
}
protected void setDefaultProperties(){
rippleSpeed = Utils.dpToPx(2, getResources());
rippleSize = Utils.dpToPx(5, getResources());
setMinimumWidth(Utils.dpToPx(sizeRadius*2, getResources()));
setMinimumHeight(Utils.dpToPx(sizeRadius*2, getResources()));
super.background = R.drawable.background_button_float;
// super.setDefaultProperties();
}
// Set atributtes of XML to View
protected void setAttributes(AttributeSet attrs){
//Set background Color
// Color by resource
int bacgroundColor = attrs.getAttributeResourceValue(ANDROIDXML,"background",-1);
if(bacgroundColor != -1){
setBackgroundColor(getResources().getColor(bacgroundColor));
}else{
// Color by hexadecimal
background = attrs.getAttributeIntValue(ANDROIDXML, "background", -1);
if (background != -1)
setBackgroundColor(background);
}
// Set Ripple Color
// Color by resource
int rippleColor = attrs.getAttributeResourceValue(MATERIALDESIGNXML,
"rippleColor", -1);
if (rippleColor != -1) {
setRippleColor(getResources().getColor(rippleColor));
} else {
// Color by hexadecimal
int background = attrs.getAttributeIntValue(MATERIALDESIGNXML, "rippleColor", -1);
if (background != -1)
setRippleColor(background);
else
setRippleColor(makePressColor());
}
// Icon of button
int iconResource = attrs.getAttributeResourceValue(MATERIALDESIGNXML,"iconDrawable",-1);
if(iconResource != -1)
drawableIcon = getResources().getDrawable(iconResource);
final boolean animate = attrs.getAttributeBooleanValue(MATERIALDESIGNXML,"animate", false);
post(new Runnable() {
@Override
public void run() {
showPosition = ViewHelper.getY(ButtonFloat.this) - Utils.dpToPx(24, getResources());
hidePosition = ViewHelper.getY(ButtonFloat.this) + getHeight() * 3;
if(animate){
ViewHelper.setY(ButtonFloat.this, hidePosition);
show();
}
}
});
}
Integer height;
Integer width;
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (x != -1) {
Rect src = new Rect(0, 0, getWidth(), getHeight());
Rect dst = new Rect(Utils.dpToPx(1, getResources()), Utils.dpToPx(2, getResources()), getWidth()-Utils.dpToPx(1, getResources()), getHeight()-Utils.dpToPx(2, getResources()));
canvas.drawBitmap(cropCircle(makeCircle()), src, dst, null);
invalidate();
}
}
public ImageView getIcon() {
return icon;
}
public void setIcon(ImageView icon) {
this.icon = icon;
}
public Drawable getDrawableIcon() {
return drawableIcon;
}
public void setDrawableIcon(Drawable drawableIcon) {
this.drawableIcon = drawableIcon;
try {
icon.setBackground(drawableIcon);
} catch (NoSuchMethodError e) {
icon.setBackgroundDrawable(drawableIcon);
}
}
public Bitmap cropCircle(Bitmap bitmap) {
Bitmap output = Bitmap.createBitmap(bitmap.getWidth(),
bitmap.getHeight(), Config.ARGB_8888);
Canvas canvas = new Canvas(output);
final int color = 0xff424242;
final Paint paint = new Paint();
final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
paint.setAntiAlias(true);
canvas.drawARGB(0, 0, 0, 0);
paint.setColor(color);
canvas.drawCircle(bitmap.getWidth() / 2, bitmap.getHeight() / 2,
bitmap.getWidth()/2, paint);
paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
canvas.drawBitmap(bitmap, rect, rect, paint);
return output;
}
@Override
public TextView getTextView() {
return null;
}
public void setRippleColor(int rippleColor) {
this.rippleColor = rippleColor;
}
public void show(){
ObjectAnimator animator = ObjectAnimator.ofFloat(ButtonFloat.this, "y", showPosition);
animator.setInterpolator(new BounceInterpolator());
animator.setDuration(1500);
animator.start();
isShow = true;
}
public void hide(){
ObjectAnimator animator = ObjectAnimator.ofFloat(ButtonFloat.this, "y", hidePosition);
animator.setInterpolator(new BounceInterpolator());
animator.setDuration(1500);
animator.start();
isShow = false;
}
public boolean isShow(){
return isShow;
}
}
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonFloatSmall.java
================================================
package com.gc.materialdesign.views;
import com.gc.materialdesign.R;
import com.gc.materialdesign.utils.Utils;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.RelativeLayout;
public class ButtonFloatSmall extends ButtonFloat {
public ButtonFloatSmall(Context context, AttributeSet attrs) {
super(context, attrs);
sizeRadius = 20;
sizeIcon = 20;
setDefaultProperties();
LayoutParams params = new LayoutParams(Utils.dpToPx(sizeIcon, getResources()),Utils.dpToPx(sizeIcon, getResources()));
params.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
icon.setLayoutParams(params);
}
protected void setDefaultProperties(){
rippleSpeed = Utils.dpToPx(2, getResources());
rippleSize = 10;
// Min size
setMinimumHeight(Utils.dpToPx(sizeRadius*2, getResources()));
setMinimumWidth(Utils.dpToPx(sizeRadius*2, getResources()));
// Background shape
setBackgroundResource(R.drawable.background_button_float);
// setBackgroundColor(backgroundColor);
}
}
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonIcon.java
================================================
package com.gc.materialdesign.views;
import com.gc.materialdesign.utils.Utils;
import android.R;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.util.AttributeSet;
import android.view.MotionEvent;
public class ButtonIcon extends ButtonFloat {
public ButtonIcon(Context context, AttributeSet attrs) {
super(context, attrs);
try {
setBackground(new ColorDrawable(getResources().getColor(R.color.transparent)));
} catch (NoSuchMethodError e) {
setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.transparent)));
}
rippleSpeed = Utils.dpToPx(2, getResources());
rippleSize = Utils.dpToPx(5, getResources());
}
@Override
public boolean onTouchEvent(MotionEvent event) {
boolean returnBool = super.onTouchEvent(event);
if(x != -1){
x = getWidth() / 2;
y = getHeight() / 2;
}
return returnBool;
}
@Override
protected void onDraw(Canvas canvas) {
if (x != -1) {
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setColor(makePressColor());
canvas.drawCircle(x, y, radius, paint);
if(radius > getHeight()/rippleSize)
radius += rippleSpeed;
if(radius >= getWidth() / 2 - rippleSpeed){
x = -1;
y = -1;
radius = getHeight()/rippleSize;
if(onClickListener != null && clickAfterRipple)
onClickListener.onClick(this);
}
invalidate();
}
}
@Override
protected int makePressColor() {
return backgroundColor;
}
}
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonRectangle.java
================================================
package com.gc.materialdesign.views;
import com.gc.materialdesign.R;
import com.gc.materialdesign.utils.Utils;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.RelativeLayout;
import android.widget.TextView;
public class ButtonRectangle extends Button {
TextView textButton;
int paddingTop,paddingBottom, paddingLeft, paddingRight;
public ButtonRectangle(Context context, AttributeSet attrs) {
super(context, attrs);
setDefaultProperties();
}
@Override
protected void setDefaultProperties(){
// paddingBottom = Utils.dpToPx(16, getResources());
// paddingLeft = Utils.dpToPx(16, getResources());
// paddingRight = Utils.dpToPx(16, getResources());
// paddingTop = Utils.dpToPx(16, getResources());
super.minWidth = 80;
super.minHeight = 36;
super.background = R.drawable.background_button_rectangle;
super.setDefaultProperties();
}
// Set atributtes of XML to View
protected void setAttributes(AttributeSet attrs){
//Set background Color
// Color by resource
int bacgroundColor = attrs.getAttributeResourceValue(ANDROIDXML,"background",-1);
if(bacgroundColor != -1){
setBackgroundColor(getResources().getColor(bacgroundColor));
}else{
// Color by hexadecimal
// Color by hexadecimal
background = attrs.getAttributeIntValue(ANDROIDXML, "background", -1);
if (background != -1)
setBackgroundColor(background);
}
// Set Padding
String value = attrs.getAttributeValue(ANDROIDXML,"padding");
// if(value != null){
// float padding = Float.parseFloat(value.replace("dip", ""));
// paddingBottom = Utils.dpToPx(padding, getResources());
// paddingLeft = Utils.dpToPx(padding, getResources());
// paddingRight = Utils.dpToPx(padding, getResources());
// paddingTop = Utils.dpToPx(padding, getResources());
// }else{
// value = attrs.getAttributeValue(ANDROIDXML,"paddingLeft");
// paddingLeft = (value == null) ? paddingLeft : (int) Float.parseFloat(value.replace("dip", ""));
// value = attrs.getAttributeValue(ANDROIDXML,"paddingTop");
// paddingTop = (value == null) ? paddingTop : (int) Float.parseFloat(value.replace("dip", ""));
// value = attrs.getAttributeValue(ANDROIDXML,"paddingRight");
// paddingRight = (value == null) ? paddingRight : (int) Float.parseFloat(value.replace("dip", ""));
// value = attrs.getAttributeValue(ANDROIDXML,"paddingBottom");
// paddingBottom = (value == null) ? paddingBottom : (int) Float.parseFloat(value.replace("dip", ""));
// }
// Set text button
String text = null;
int textResource = attrs.getAttributeResourceValue(ANDROIDXML,"text",-1);
if(textResource != -1){
text = getResources().getString(textResource);
}else{
text = attrs.getAttributeValue(ANDROIDXML,"text");
}
if(text != null){
textButton = new TextView(getContext());
textButton.setText(text);
textButton.setTextColor(Color.WHITE);
textButton.setTypeface(null, Typeface.BOLD);
LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
params.setMargins(Utils.dpToPx(5, getResources()), Utils.dpToPx(5, getResources()), Utils.dpToPx(5, getResources()), Utils.dpToPx(5, getResources()));
textButton.setLayoutParams(params);
addView(textButton);
// FrameLayout.LayoutParams params = (LayoutParams) textView.getLayoutParams();
// params.width = getWidth();
// params.gravity = Gravity.CENTER_HORIZONTAL;
//// params.setMargins(paddingLeft, paddingTop, paddingRight, paddingRight);
// textView.setLayoutParams(params);textColor
int textColor = attrs.getAttributeResourceValue(ANDROIDXML,"textColor",-1);
if(textColor != -1){
textButton.setTextColor(textColor);
}else{
// Color by hexadecimal
// Color by hexadecimal
textColor = attrs.getAttributeIntValue(ANDROIDXML, "textColor", -1);
if (textColor != -1)
textButton.setTextColor(textColor);
}
int[] array = {android.R.attr.textSize};
TypedArray values = getContext().obtainStyledAttributes(attrs, array);
float textSize = values.getDimension(0, -1);
values.recycle();
if(textSize != -1)
textButton.setTextSize(textSize);
}
rippleSpeed = attrs.getAttributeFloatValue(MATERIALDESIGNXML,
"rippleSpeed", Utils.dpToPx(6, getResources()));
}
// /**
// * Center text in button
// */
// boolean txtCenter = false;
// private void centrarTexto(){
// if((textButton.getWidth()+paddingLeft+paddingRight)>Utils.dpToPx(80, getResources()))
// setMinimumWidth(textButton.getWidth()+paddingLeft+paddingRight);
// setMinimumHeight(textButton.getHeight()+paddingBottom+paddingTop);
// textButton.setX(getWidth()/2-textButton.getWidth()/2 - paddingTop + paddingBottom);
// textButton.setY(getHeight()/2-textButton.getHeight()/2 - paddingLeft + paddingRight);
// txtCenter = true;
// }
Integer height;
Integer width;
@Override
protected void onDraw(Canvas canvas) {
// if(!txtCenter)
// centrarTexto();
super.onDraw(canvas);
if (x != -1) {
Rect src = new Rect(0, 0, getWidth()-Utils.dpToPx(6, getResources()), getHeight()-Utils.dpToPx(7, getResources()));
Rect dst = new Rect(Utils.dpToPx(6, getResources()), Utils.dpToPx(6, getResources()), getWidth()-Utils.dpToPx(6, getResources()), getHeight()-Utils.dpToPx(7, getResources()));
canvas.drawBitmap(makeCircle(), src, dst, null);
invalidate();
}
}
}
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/Card.java
================================================
package com.gc.materialdesign.views;
import com.gc.materialdesign.R;
import com.gc.materialdesign.utils.Utils;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.LayerDrawable;
import android.util.AttributeSet;
import android.util.Log;
import android.view.Gravity;
import android.view.MotionEvent;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.RelativeLayout.LayoutParams;
public class Card extends CustomView {
TextView textButton;
int paddingTop,paddingBottom, paddingLeft, paddingRight;
int backgroundColor = Color.parseColor("#FFFFFF");
public Card(Context context, AttributeSet attrs) {
super(context, attrs);
setAttributes(attrs);
}
// Set atributtes of XML to View
protected void setAttributes(AttributeSet attrs){
setBackgroundResource(R.drawable.background_button_rectangle);
//Set background Color
// Color by resource
int bacgroundColor = attrs.getAttributeResourceValue(ANDROIDXML,"background",-1);
if(bacgroundColor != -1){
setBackgroundColor(getResources().getColor(bacgroundColor));
}else{
// Color by hexadecimal
String background = attrs.getAttributeValue(ANDROIDXML,"background");
if(background != null)
setBackgroundColor(Color.parseColor(background));
else
setBackgroundColor(this.backgroundColor);
}
}
// Set color of background
public void setBackgroundColor(int color){
this.backgroundColor = color;
if(isEnabled())
beforeBackground = backgroundColor;
LayerDrawable layer = (LayerDrawable) getBackground();
GradientDrawable shape = (GradientDrawable) layer.findDrawableByLayerId(R.id.shape_bacground);
shape.setColor(backgroundColor);
}
}
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/CheckBox.java
================================================
package com.gc.materialdesign.views;
import com.gc.materialdesign.R;
import com.gc.materialdesign.utils.Utils;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.LayerDrawable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;
public class CheckBox extends CustomView {
int backgroundColor = Color.parseColor("#4CAF50");
Check checkView;
boolean press = false;
boolean check = false;
OnCheckListener onCheckListener;
public CheckBox(Context context, AttributeSet attrs) {
super(context, attrs);
setAttributes(attrs);
}
// Set atributtes of XML to View
protected void setAttributes(AttributeSet attrs) {
setBackgroundResource(R.drawable.background_checkbox);
// Set size of view
setMinimumHeight(Utils.dpToPx(48, getResources()));
setMinimumWidth(Utils.dpToPx(48, getResources()));
// Set background Color
// Color by resource
int bacgroundColor = attrs.getAttributeResourceValue(ANDROIDXML,
"background", -1);
if (bacgroundColor != -1) {
setBackgroundColor(getResources().getColor(bacgroundColor));
} else {
// Color by hexadecimal
// Color by hexadecimal
int background = attrs.getAttributeIntValue(ANDROIDXML, "background", -1);
if (background != -1)
setBackgroundColor(background);
}
final boolean check = attrs.getAttributeBooleanValue(MATERIALDESIGNXML,
"check", false);
post(new Runnable() {
@Override
public void run() {
setChecked(check);
setPressed(false);
changeBackgroundColor(getResources().getColor(
android.R.color.transparent));
}
});
checkView = new Check(getContext());
checkView.setId(View.generateViewId());
RelativeLayout.LayoutParams params = new LayoutParams(Utils.dpToPx(20,
getResources()), Utils.dpToPx(20, getResources()));
params.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE);
checkView.setLayoutParams(params);
addView(checkView);
// Adding text view to checkbox
int textResource = attrs.getAttributeResourceValue(ANDROIDXML, "text", -1);
String text = null;
if(textResource != -1) {
text = getResources().getString(textResource);
} else {
text = attrs.getAttributeValue(ANDROIDXML, "text");
}
if(text != null) {
params.removeRule(RelativeLayout.CENTER_IN_PARENT);
params.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
TextView textView = new TextView(getContext());
RelativeLayout.LayoutParams textViewLayoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
textViewLayoutParams.addRule(RelativeLayout.RIGHT_OF, checkView.getId());
textViewLayoutParams.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
textViewLayoutParams.setMargins(10, 0, 0, 0);
textView.setLayoutParams(textViewLayoutParams);
textView.setText(text);
addView(textView);
}
}
@Override
public void invalidate() {
checkView.invalidate();
super.invalidate();
}
@Override
public boolean onTouchEvent(MotionEvent event) {
invalidate();
if (isEnabled()) {
isLastTouch = true;
if (event.getAction() == MotionEvent.ACTION_DOWN) {
changeBackgroundColor((check) ? makePressColor() : Color
.parseColor("#446D6D6D"));
} else if (event.getAction() == MotionEvent.ACTION_UP) {
changeBackgroundColor(getResources().getColor(
android.R.color.transparent));
press = false;
if ((event.getX() <= getWidth() && event.getX() >= 0)
&& (event.getY() <= getHeight() && event.getY() >= 0)) {
isLastTouch = false;
check = !check;
if (onCheckListener != null)
onCheckListener.onCheck(CheckBox.this, check);
if (check) {
step = 0;
}
if (check)
checkView.changeBackground();
}
}
}
return true;
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (press) {
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setColor((check) ? makePressColor() : Color
.parseColor("#446D6D6D"));
canvas.drawCircle(getWidth() / 2, getHeight() / 2, getWidth() / 2,
paint);
invalidate();
}
}
private void changeBackgroundColor(int color) {
LayerDrawable layer = (LayerDrawable) getBackground();
GradientDrawable shape = (GradientDrawable) layer
.findDrawableByLayerId(R.id.shape_bacground);
shape.setColor(color);
}
/**
* Make a dark color to press effect
*
* @return
*/
protected int makePressColor() {
int r = (this.backgroundColor >> 16) & 0xFF;
int g = (this.backgroundColor >> 8) & 0xFF;
int b = (this.backgroundColor >> 0) & 0xFF;
r = (r - 30 < 0) ? 0 : r - 30;
g = (g - 30 < 0) ? 0 : g - 30;
b = (b - 30 < 0) ? 0 : b - 30;
return Color.argb(70, r, g, b);
}
@Override
public void setBackgroundColor(int color) {
backgroundColor = color;
if (isEnabled())
beforeBackground = backgroundColor;
changeBackgroundColor(color);
}
public void setChecked(boolean check) {
invalidate();
this.check = check;
setPressed(false);
changeBackgroundColor(getResources().getColor(
android.R.color.transparent));
if (check) {
step = 0;
}
if (check)
checkView.changeBackground();
}
public boolean isCheck() {
return check;
}
// Indicate step in check animation
int step = 0;
// View that contains checkbox
class Check extends View {
Bitmap sprite;
public Check(Context context) {
super(context);
setBackgroundResource(R.drawable.background_checkbox_uncheck);
sprite = BitmapFactory.decodeResource(context.getResources(),
R.drawable.sprite_check);
}
public void changeBackground() {
if (check) {
setBackgroundResource(R.drawable.background_checkbox_check);
LayerDrawable layer = (LayerDrawable) getBackground();
GradientDrawable shape = (GradientDrawable) layer
.findDrawableByLayerId(R.id.shape_bacground);
shape.setColor(backgroundColor);
} else {
setBackgroundResource(R.drawable.background_checkbox_uncheck);
}
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (check) {
if (step < 11){
step++;
invalidate();
}
} else {
if (step >= 0){
step--;
invalidate();
}
if (step == -1){
invalidate();
changeBackground();
}
}
Rect src = new Rect(40 * step, 0, (40 * step) + 40, 40);
Rect dst = new Rect(0, 0, this.getWidth() - 2, this.getHeight());
canvas.drawBitmap(sprite, src, dst, null);
}
}
public void setOncheckListener(OnCheckListener onCheckListener) {
this.onCheckListener = onCheckListener;
}
public interface OnCheckListener {
public void onCheck(CheckBox view, boolean check);
}
}
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/CustomView.java
================================================
package com.gc.materialdesign.views;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.util.AttributeSet;
import android.widget.RelativeLayout;
public class CustomView extends RelativeLayout{
final static String MATERIALDESIGNXML = "http://schemas.android.com/apk/res-auto";
final static String ANDROIDXML = "http://schemas.android.com/apk/res/android";
final int disabledBackgroundColor = Color.parseColor("#E2E2E2");
int beforeBackground;
// Indicate if user touched this view the last time
public boolean isLastTouch = false;
public CustomView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
if(enabled)
setBackgroundColor(beforeBackground);
else
setBackgroundColor(disabledBackgroundColor);
invalidate();
}
boolean animation = false;
@Override
protected void onAnimationStart() {
super.onAnimationStart();
animation = true;
}
@Override
protected void onAnimationEnd() {
super.onAnimationEnd();
animation = false;
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if(animation)
invalidate();
}
}
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/LayoutRipple.java
================================================
package com.gc.materialdesign.views;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.MotionEvent;
public class LayoutRipple extends CustomView {
int background;
float rippleSpeed = 10f;
int rippleSize = 3;
OnClickListener onClickListener;
int backgroundColor = Color.parseColor("#FFFFFF");
Integer rippleColor;
Float xRippleOrigin;
Float yRippleOrigin;
public LayoutRipple(Context context, AttributeSet attrs) {
super(context, attrs);
setAttributes(attrs);
}
// Set atributtes of XML to View
protected void setAttributes(AttributeSet attrs) {
// Set background Color
// Color by resource
int bacgroundColor = attrs.getAttributeResourceValue(ANDROIDXML,
"background", -1);
if (bacgroundColor != -1) {
setBackgroundColor(getResources().getColor(bacgroundColor));
} else {
// Color by hexadecimal
background = attrs.getAttributeIntValue(ANDROIDXML, "background", -1);
if (background != -1)
setBackgroundColor(background);
else
setBackgroundColor(this.backgroundColor);
}
// Set Ripple Color
// Color by resource
int rippleColor = attrs.getAttributeResourceValue(MATERIALDESIGNXML,
"rippleColor", -1);
if (rippleColor != -1) {
setRippleColor(getResources().getColor(rippleColor));
} else {
// Color by hexadecimal
int background = attrs.getAttributeIntValue(MATERIALDESIGNXML, "rippleColor", -1);
if (background != -1)
setRippleColor(background);
else
setRippleColor(makePressColor());
}
rippleSpeed = attrs.getAttributeFloatValue(MATERIALDESIGNXML,
"rippleSpeed", 20f);
}
// Set color of background
public void setBackgroundColor(int color) {
this.backgroundColor = color;
if (isEnabled())
beforeBackground = backgroundColor;
super.setBackgroundColor(color);
}
public void setRippleSpeed(int rippleSpeed) {
this.rippleSpeed = rippleSpeed;
}
// ### RIPPLE EFFECT ###
float x = -1, y = -1;
float radius = -1;
@Override
public boolean onTouchEvent(MotionEvent event) {
invalidate();
if (isEnabled()) {
isLastTouch = true;
if (event.getAction() == MotionEvent.ACTION_DOWN) {
radius = getHeight() / rippleSize;
x = event.getX();
y = event.getY();
} else if (event.getAction() == MotionEvent.ACTION_MOVE) {
radius = getHeight() / rippleSize;
x = event.getX();
y = event.getY();
if (!((event.getX() <= getWidth() && event.getX() >= 0) && (event
.getY() <= getHeight() && event.getY() >= 0))) {
isLastTouch = false;
x = -1;
y = -1;
}
} else if (event.getAction() == MotionEvent.ACTION_UP) {
if ((event.getX() <= getWidth() && event.getX() >= 0)
&& (event.getY() <= getHeight() && event.getY() >= 0)) {
radius++;
} else {
isLastTouch = false;
x = -1;
y = -1;
}
}if (event.getAction() == MotionEvent.ACTION_CANCEL) {
isLastTouch = false;
x = -1;
y = -1;
}
}
return true;
}
@Override
protected void onFocusChanged(boolean gainFocus, int direction,
Rect previouslyFocusedRect) {
if (!gainFocus) {
x = -1;
y = -1;
}
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
// super.onInterceptTouchEvent(ev);
return true;
}
public Bitmap makeCircle() {
Bitmap output = Bitmap.createBitmap(getWidth(), getHeight(),
Config.ARGB_8888);
Canvas canvas = new Canvas(output);
canvas.drawARGB(0, 0, 0, 0);
Paint paint = new Paint();
paint.setAntiAlias(true);
if (rippleColor == null)
rippleColor = makePressColor();
paint.setColor(rippleColor);
x = (xRippleOrigin == null) ? x : xRippleOrigin;
y = (yRippleOrigin == null) ? y : yRippleOrigin;
canvas.drawCircle(x, y, radius, paint);
if (radius > getHeight() / rippleSize)
radius += rippleSpeed;
if (radius >= getWidth()) {
x = -1;
y = -1;
radius = getHeight() / rippleSize;
if (onClickListener != null)
onClickListener.onClick(this);
}
return output;
}
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (x != -1) {
Rect src = new Rect(0, 0, getWidth(), getHeight());
Rect dst = new Rect(0, 0, getWidth(), getHeight());
canvas.drawBitmap(makeCircle(), src, dst, null);
invalidate();
}
}
/**
* Make a dark color to ripple effect
*
* @return
*/
protected int makePressColor() {
int r = (this.backgroundColor >> 16) & 0xFF;
int g = (this.backgroundColor >> 8) & 0xFF;
int b = (this.backgroundColor >> 0) & 0xFF;
r = (r - 30 < 0) ? 0 : r - 30;
g = (g - 30 < 0) ? 0 : g - 30;
b = (b - 30 < 0) ? 0 : b - 30;
return Color.rgb(r, g, b);
}
@Override
public void setOnClickListener(OnClickListener l) {
onClickListener = l;
}
public void setRippleColor(int rippleColor) {
this.rippleColor = rippleColor;
}
public void setxRippleOrigin(Float xRippleOrigin) {
this.xRippleOrigin = xRippleOrigin;
}
public void setyRippleOrigin(Float yRippleOrigin) {
this.yRippleOrigin = yRippleOrigin;
}
}
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ProgressBarCircularIndeterminate.java
================================================
package com.gc.materialdesign.views;
import com.gc.materialdesign.utils.Utils;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.RectF;
import android.util.AttributeSet;
public class ProgressBarCircularIndeterminate extends CustomView {
final static String ANDROIDXML = "http://schemas.android.com/apk/res/android";
int backgroundColor = Color.parseColor("#1E88E5");
public ProgressBarCircularIndeterminate(Context context, AttributeSet attrs) {
super(context, attrs);
setAttributes(attrs);
}
// Set atributtes of XML to View
protected void setAttributes(AttributeSet attrs){
setMinimumHeight(Utils.dpToPx(32, getResources()));
setMinimumWidth(Utils.dpToPx(32, getResources()));
//Set background Color
// Color by resource
int bacgroundColor = attrs.getAttributeResourceValue(ANDROIDXML,"background",-1);
if(bacgroundColor != -1){
setBackgroundColor(getResources().getColor(bacgroundColor));
}else{
// Color by hexadecimal
int background = attrs.getAttributeIntValue(ANDROIDXML, "background", -1);
if (background != -1)
setBackgroundColor(background);
else
setBackgroundColor(Color.parseColor("#1E88E5"));
}
setMinimumHeight(Utils.dpToPx(3, getResources()));
}
/**
* Make a dark color to ripple effect
* @return
*/
protected int makePressColor(){
int r = (this.backgroundColor >> 16) & 0xFF;
int g = (this.backgroundColor >> 8) & 0xFF;
int b = (this.backgroundColor >> 0) & 0xFF;
// r = (r+90 > 245) ? 245 : r+90;
// g = (g+90 > 245) ? 245 : g+90;
// b = (b+90 > 245) ? 245 : b+90;
return Color.argb(128,r, g, b);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if(firstAnimationOver == false)
drawFirstAnimation(canvas);
if(cont > 0)
drawSecondAnimation(canvas);
invalidate();
}
float radius1 = 0;
float radius2 = 0;
int cont = 0;
boolean firstAnimationOver = false;
/**
* Draw first animation of view
* @param canvas
*/
private void drawFirstAnimation(Canvas canvas){
if(radius1 < getWidth()/2){
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setColor(makePressColor());
radius1 = (radius1 >= getWidth()/2)? (float)getWidth()/2 : radius1+1;
canvas.drawCircle(getWidth()/2, getHeight()/2, radius1, paint);
}else{
Bitmap bitmap = Bitmap.createBitmap(canvas.getWidth(), canvas.getHeight(), Bitmap.Config.ARGB_8888);
Canvas temp = new Canvas(bitmap);
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setColor(makePressColor());
temp.drawCircle(getWidth()/2, getHeight()/2, getHeight()/2, paint);
Paint transparentPaint = new Paint();
transparentPaint.setAntiAlias(true);
transparentPaint.setColor(getResources().getColor(android.R.color.transparent));
transparentPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
if(cont >= 50){
radius2 = (radius2 >= getWidth()/2)? (float)getWidth()/2 : radius2+1;
}else{
radius2 = (radius2 >= getWidth()/2-Utils.dpToPx(4, getResources()))? (float)getWidth()/2-Utils.dpToPx(4, getResources()) : radius2+1;
}
temp.drawCircle(getWidth()/2, getHeight()/2, radius2, transparentPaint);
canvas.drawBitmap(bitmap, 0, 0, new Paint());
if(radius2 >= getWidth()/2-Utils.dpToPx(4, getResources()))
cont++;
if(radius2 >= getWidth()/2)
firstAnimationOver = true;
}
}
int arcD = 1;
int arcO = 0;
float rotateAngle = 0;
int limite = 0;
/**
* Draw second animation of view
* @param canvas
*/
private void drawSecondAnimation(Canvas canvas){
if(arcO == limite)
arcD+=6;
if(arcD >= 290 || arcO > limite){
arcO+=6;
arcD-=6;
}
if(arcO > limite + 290){
limite = arcO;
arcO = limite;
arcD = 1;
}
rotateAngle += 4;
canvas.rotate(rotateAngle,getWidth()/2, getHeight()/2);
Bitmap bitmap = Bitmap.createBitmap(canvas.getWidth(), canvas.getHeight(), Bitmap.Config.ARGB_8888);
Canvas temp = new Canvas(bitmap);
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setColor(backgroundColor);
// temp.drawARGB(0, 0, 0, 255);
temp.drawArc(new RectF(0, 0, getWidth(), getHeight()), arcO, arcD, true, paint);
Paint transparentPaint = new Paint();
transparentPaint.setAntiAlias(true);
transparentPaint.setColor(getResources().getColor(android.R.color.transparent));
transparentPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
temp.drawCircle(getWidth()/2, getHeight()/2, (getWidth()/2)-Utils.dpToPx(4, getResources()), transparentPaint);
canvas.drawBitmap(bitmap, 0, 0, new Paint());
}
// Set color of background
public void setBackgroundColor(int color){
super.setBackgroundColor(getResources().getColor(android.R.color.transparent));
if(isEnabled())
beforeBackground = backgroundColor;
this.backgroundColor = color;
}
}
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ProgressBarDeterminate.java
================================================
package com.gc.materialdesign.views;
import com.gc.materialdesign.R;
import com.gc.materialdesign.utils.Utils;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.LayerDrawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
public class ProgressBarDeterminate extends CustomView {
int max = 100;
int min = 0;
int progress = 0;
int backgroundColor = Color.parseColor("#1E88E5");
View progressView;
public ProgressBarDeterminate(Context context, AttributeSet attrs) {
super(context, attrs);
setAttributes(attrs);
}
// Set atributtes of XML to View
protected void setAttributes(AttributeSet attrs){
progressView = new View(getContext());
LayoutParams params = new LayoutParams(1,1);
progressView.setLayoutParams(params);
progressView.setBackgroundResource(R.drawable.background_progress);
addView(progressView);
//Set background Color
// Color by resource
int bacgroundColor = attrs.getAttributeResourceValue(ANDROIDXML,"background",-1);
if(bacgroundColor != -1){
setBackgroundColor(getResources().getColor(bacgroundColor));
}else{
// Color by hexadecimal
int background = attrs.getAttributeIntValue(ANDROIDXML, "background", -1);
if (background != -1)
setBackgroundColor(background);
else
setBackgroundColor(Color.parseColor("#1E88E5"));
}
min = attrs.getAttributeIntValue(MATERIALDESIGNXML,"min", 0);
max = attrs.getAttributeIntValue(MATERIALDESIGNXML,"max", 100);
progress = attrs.getAttributeIntValue(MATERIALDESIGNXML,"progress", min);
setMinimumHeight(Utils.dpToPx(3, getResources()));
post(new Runnable() {
@Override
public void run() {
LayoutParams params = (LayoutParams) progressView.getLayoutParams();
params.height = getHeight();
progressView.setLayoutParams(params);
}
});
}
/**
* Make a dark color to ripple effect
* @return
*/
protected int makePressColor(){
int r = (this.backgroundColor >> 16) & 0xFF;
int g = (this.backgroundColor >> 8) & 0xFF;
int b = (this.backgroundColor >> 0) & 0xFF;
return Color.argb(128,r, g, b);
}
// SETTERS
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if(pendindProgress!=-1)
setProgress(pendindProgress);
}
public void setMax(int max){
this.max = max;
}
public void setMin(int min){
this.min = min;
}
int pendindProgress = -1;
public void setProgress(int progress){
if(getWidth() == 0){
pendindProgress = progress;
}else{
this.progress = progress;
if(progress > max)
progress = max;
if(progress < min)
progress = min;
int totalWidth = max-min;
double progressPercent = (double)progress/(double)totalWidth;
int progressWidth =(int) (getWidth()*progressPercent);
LayoutParams params = (LayoutParams) progressView.getLayoutParams();
params.width = progressWidth;
params.height = getHeight();
progressView.setLayoutParams(params);
pendindProgress = -1;
}
}
public int getProgress(){
return progress;
}
// Set color of background
public void setBackgroundColor(int color){
this.backgroundColor = color;
if(isEnabled())
beforeBackground = backgroundColor;
LayerDrawable layer = (LayerDrawable) progressView.getBackground();
GradientDrawable shape = (GradientDrawable) layer.findDrawableByLayerId(R.id.shape_bacground);
shape.setColor(color);
super.setBackgroundColor(makePressColor());
}
}
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ProgressBarIndeterminate.java
================================================
package com.gc.materialdesign.views;
import com.gc.materialdesign.R;
import com.nineoldandroids.animation.Animator;
import com.nineoldandroids.animation.Animator.AnimatorListener;
import com.nineoldandroids.animation.ObjectAnimator;
import com.nineoldandroids.view.ViewHelper;
import android.content.Context;
import android.util.AttributeSet;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
public class ProgressBarIndeterminate extends ProgressBarDeterminate {
public ProgressBarIndeterminate(Context context, AttributeSet attrs) {
super(context, attrs);
post(new Runnable() {
@Override
public void run() {
// Make progress animation
setProgress(60);
Animation anim = AnimationUtils.loadAnimation(getContext(), R.anim.progress_indeterminate_animation);
progressView.startAnimation(anim);
final ObjectAnimator anim2 = ObjectAnimator.ofFloat(progressView, "x", getWidth());
anim2.setDuration(1200);
anim2.addListener(new AnimatorListener() {
int cont = 1;
int suma = 1;
int duration = 1200;
public void onAnimationEnd(Animator arg0) {
// Repeat animation
ViewHelper.setX(progressView,-progressView.getWidth()/2);
cont += suma;
try {
ObjectAnimator anim2Repeat = ObjectAnimator.ofFloat(progressView, "x", getWidth());
anim2Repeat.setDuration(duration/cont);
anim2Repeat.addListener(this);
anim2Repeat.start();
} catch (ArrayIndexOutOfBoundsException e) {
// ignore this error that sometimes comes from the NineOldAndroids 2.4 library
}
if(cont == 3 || cont == 1) suma *=-1;
}
public void onAnimationStart(Animator arg0) {}
public void onAnimationRepeat(Animator arg0) {}
public void onAnimationCancel(Animator arg0) {}
});
anim2.start();
}
});
}
}
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ProgressBarIndeterminateDeterminate.java
================================================
package com.gc.materialdesign.views;
import com.nineoldandroids.animation.Animator;
import com.nineoldandroids.animation.Animator.AnimatorListener;
import com.nineoldandroids.animation.ObjectAnimator;
import com.nineoldandroids.view.ViewHelper;
import android.content.Context;
import android.util.AttributeSet;
public class ProgressBarIndeterminateDeterminate extends ProgressBarDeterminate {
boolean firstProgress = true;
boolean runAnimation = true;
ObjectAnimator animation;
public ProgressBarIndeterminateDeterminate(Context context, AttributeSet attrs) {
super(context, attrs);
post(new Runnable() {
@Override
public void run() {
// Make progress animation
setProgress(60);
ViewHelper.setX(progressView,getWidth()+progressView.getWidth()/2);
animation = ObjectAnimator.ofFloat(progressView, "x", -progressView.getWidth()/2);
animation.setDuration(1200);
animation.addListener(new AnimatorListener() {
int cont = 1;
int suma = 1;
int duration = 1200;
public void onAnimationEnd(Animator arg0) {
// Repeat animation
if(runAnimation){
ViewHelper.setX(progressView,getWidth()+progressView.getWidth()/2);
cont += suma;
animation = ObjectAnimator.ofFloat(progressView, "x", -progressView.getWidth()/2);
animation.setDuration(duration/cont);
animation.addListener(this);
animation.start();
if(cont == 3 || cont == 1) suma *=-1;
}
}
public void onAnimationStart(Animator arg0) {}
public void onAnimationRepeat(Animator arg0) {}
public void onAnimationCancel(Animator arg0) {}
});
animation.start();
}
});
}
@Override
public void setProgress(int progress) {
if(firstProgress){
firstProgress = false;
}else{
stopIndeterminate();
}
super.setProgress(progress);
}
/**
* Stop indeterminate animation to convert view in determinate progress bar
*/
private void stopIndeterminate(){
animation.cancel();
ViewHelper.setX(progressView,0);
runAnimation = false;
}
}
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ScrollView.java
================================================
package com.gc.materialdesign.views;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
public class ScrollView extends android.widget.ScrollView {
/*
* This class avoid problems in scrollviews with elements in library
* Use it if you want use a ScrollView in your App
*/
public ScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
// if(!onInterceptTouchEvent(ev)){
for(int i = 0; i < ((ViewGroup)getChildAt(0)).getChildCount(); i++){
try {
CustomView child =(CustomView) ((ViewGroup)getChildAt(0)).getChildAt(i);
if(child.isLastTouch){
child.onTouchEvent(ev);
return true;
}
} catch (ClassCastException e) {
}
}
// }
return super.onTouchEvent(ev);
}
}
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/Slider.java
================================================
package com.gc.materialdesign.views;
import android.app.Dialog;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.LayerDrawable;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.gc.materialdesign.R;
import com.gc.materialdesign.utils.Utils;
import com.nineoldandroids.view.ViewHelper;
public class Slider extends CustomView {
private int backgroundColor = Color.parseColor("#4CAF50");
private Ball ball;
private Bitmap bitmap;
private int max = 100;
private int min = 0;
private NumberIndicator numberIndicator;
private OnValueChangedListener onValueChangedListener;
private boolean placedBall = false;
private boolean press = false;
private boolean showNumberIndicator = false;
private int value = 0;
public Slider(Context context, AttributeSet attrs) {
super(context, attrs);
setAttributes(attrs);
}
public int getMax() {
return max;
}
public void setMax(int max) {
this.max = max;
}
public int getMin() {
return min;
}
public void setMin(int min) {
this.min = min;
}
public OnValueChangedListener getOnValueChangedListener() {
return onValueChangedListener;
}
public void setOnValueChangedListener(
OnValueChangedListener onValueChangedListener) {
this.onValueChangedListener = onValueChangedListener;
}
// GETERS & SETTERS
public int getValue() {
return value;
}
public void setValue(final int value) {
if (placedBall == false)
post(new Runnable() {
@Override
public void run() {
setValue(value);
}
});
else {
this.value = value;
float division = (ball.xFin - ball.xIni) / max;
ViewHelper.setX(ball,
value * division + getHeight() / 2 - ball.getWidth() / 2);
ball.changeBackground();
}
}
@Override
public void invalidate() {
ball.invalidate();
super.invalidate();
}
public boolean isShowNumberIndicator() {
return showNumberIndicator;
}
public void setShowNumberIndicator(boolean showNumberIndicator) {
this.showNumberIndicator = showNumberIndicator;
numberIndicator = (showNumberIndicator) ? new NumberIndicator(
getContext()) : null;
}
@Override
public boolean onTouchEvent(MotionEvent event) {
isLastTouch = true;
if (isEnabled()) {
if (event.getAction() == MotionEvent.ACTION_DOWN
|| event.getAction() == MotionEvent.ACTION_MOVE) {
if (numberIndicator != null
&& numberIndicator.isShowing() == false)
numberIndicator.show();
if ((event.getX() <= getWidth() && event.getX() >= 0)) {
press = true;
// calculate value
int newValue = 0;
float division = (ball.xFin - ball.xIni) / (max - min);
if (event.getX() > ball.xFin) {
newValue = max;
} else if (event.getX() < ball.xIni) {
newValue = min;
} else {
newValue = min + (int) ((event.getX() - ball.xIni) / division);
}
if (value != newValue) {
value = newValue;
if (onValueChangedListener != null)
onValueChangedListener.onValueChanged(newValue);
}
// move ball indicator
float x = event.getX();
x = (x < ball.xIni) ? ball.xIni : x;
x = (x > ball.xFin) ? ball.xFin : x;
ViewHelper.setX(ball, x);
ball.changeBackground();
// If slider has number indicator
if (numberIndicator != null) {
// move number indicator
numberIndicator.indicator.x = x;
numberIndicator.indicator.finalY = Utils
.getRelativeTop(this) - getHeight() / 2;
numberIndicator.indicator.finalSize = getHeight() / 2;
numberIndicator.numberIndicator.setText("");
}
} else {
press = false;
isLastTouch = false;
if (numberIndicator != null)
numberIndicator.dismiss();
}
} else if (event.getAction() == MotionEvent.ACTION_UP ||
event.getAction() == MotionEvent.ACTION_CANCEL) {
if (numberIndicator != null)
numberIndicator.dismiss();
isLastTouch = false;
press = false;
}
}
return true;
}
@Override
public void setBackgroundColor(int color) {
backgroundColor = color;
if (isEnabled())
beforeBackground = backgroundColor;
}
/**
* Make a dark color to press effect
*
* @return
*/
protected int makePressColor() {
int r = (this.backgroundColor >> 16) & 0xFF;
int g = (this.backgroundColor >> 8) & 0xFF;
int b = (this.backgroundColor >> 0) & 0xFF;
r = (r - 30 < 0) ? 0 : r - 30;
g = (g - 30 < 0) ? 0 : g - 30;
b = (b - 30 < 0) ? 0 : b - 30;
return Color.argb(70, r, g, b);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (!placedBall) {
placeBall();
}
Paint paint = new Paint();
if (value == min) {
// Crop line to transparent effect
if (bitmap == null) {
bitmap = Bitmap.createBitmap(canvas.getWidth(),
canvas.getHeight(), Bitmap.Config.ARGB_8888);
}
Canvas temp = new Canvas(bitmap);
paint.setColor(Color.parseColor("#B0B0B0"));
paint.setStrokeWidth(Utils.dpToPx(2, getResources()));
temp.drawLine(getHeight() / 2, getHeight() / 2, getWidth()
- getHeight() / 2, getHeight() / 2, paint);
Paint transparentPaint = new Paint();
transparentPaint.setColor(getResources().getColor(
android.R.color.transparent));
transparentPaint.setXfermode(new PorterDuffXfermode(
PorterDuff.Mode.CLEAR));
temp.drawCircle(ViewHelper.getX(ball) + ball.getWidth() / 2,
ViewHelper.getY(ball) + ball.getHeight() / 2,
ball.getWidth() / 2, transparentPaint);
canvas.drawBitmap(bitmap, 0, 0, new Paint());
} else {
paint.setColor(Color.parseColor("#B0B0B0"));
paint.setStrokeWidth(Utils.dpToPx(2, getResources()));
canvas.drawLine(getHeight() / 2, getHeight() / 2, getWidth()
- getHeight() / 2, getHeight() / 2, paint);
paint.setColor(backgroundColor);
float division = (ball.xFin - ball.xIni) / (max - min);
int value = this.value - min;
canvas.drawLine(getHeight() / 2, getHeight() / 2, value * division
+ getHeight() / 2, getHeight() / 2, paint);
}
if (press && !showNumberIndicator) {
paint.setColor(backgroundColor);
paint.setAntiAlias(true);
canvas.drawCircle(ViewHelper.getX(ball) + ball.getWidth() / 2,
getHeight() / 2, getHeight() / 3, paint);
}
invalidate();
}
// Set atributtes of XML to View
protected void setAttributes(AttributeSet attrs) {
setBackgroundResource(R.drawable.background_transparent);
// Set size of view
setMinimumHeight(Utils.dpToPx(48, getResources()));
setMinimumWidth(Utils.dpToPx(80, getResources()));
// Set background Color
// Color by resource
int bacgroundColor = attrs.getAttributeResourceValue(ANDROIDXML,
"background", -1);
if (bacgroundColor != -1) {
setBackgroundColor(getResources().getColor(bacgroundColor));
} else {
// Color by hexadecimal
int background = attrs.getAttributeIntValue(ANDROIDXML, "background", -1);
if (background != -1)
setBackgroundColor(background);
}
showNumberIndicator = attrs.getAttributeBooleanValue(MATERIALDESIGNXML,
"showNumberIndicator", false);
min = attrs.getAttributeIntValue(MATERIALDESIGNXML, "min", 0);
max = attrs.getAttributeIntValue(MATERIALDESIGNXML, "max", 0);
value = attrs.getAttributeIntValue(MATERIALDESIGNXML, "value", min);
ball = new Ball(getContext());
RelativeLayout.LayoutParams params = new LayoutParams(Utils.dpToPx(20,
getResources()), Utils.dpToPx(20, getResources()));
params.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
ball.setLayoutParams(params);
addView(ball);
// Set if slider content number indicator
// TODO
if (showNumberIndicator) {
numberIndicator = new NumberIndicator(getContext());
}
}
private void placeBall() {
ViewHelper.setX(ball, getHeight() / 2 - ball.getWidth() / 2);
ball.xIni = ViewHelper.getX(ball);
ball.xFin = getWidth() - getHeight() / 2 - ball.getWidth() / 2;
ball.xCen = getWidth() / 2 - ball.getWidth() / 2;
placedBall = true;
}
// Event when slider change value
public interface OnValueChangedListener {
public void onValueChanged(int value);
}
class Ball extends View {
float xIni, xFin, xCen;
public Ball(Context context) {
super(context);
setBackgroundResource(R.drawable.background_switch_ball_uncheck);
}
public void changeBackground() {
if (value != min) {
setBackgroundResource(R.drawable.background_checkbox);
LayerDrawable layer = (LayerDrawable) getBackground();
GradientDrawable shape = (GradientDrawable) layer
.findDrawableByLayerId(R.id.shape_bacground);
shape.setColor(backgroundColor);
} else {
setBackgroundResource(R.drawable.background_switch_ball_uncheck);
}
}
}
// Slider Number Indicator
class Indicator extends RelativeLayout {
boolean animate = true;
// Final size after animation
float finalSize = 0;
// Final y position after animation
float finalY = 0;
boolean numberIndicatorResize = false;
// Size of number indicator
float size = 0;
// Position of number indicator
float x = 0;
float y = 0;
public Indicator(Context context) {
super(context);
setBackgroundColor(getResources().getColor(
android.R.color.transparent));
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (numberIndicatorResize == false) {
LayoutParams params = (LayoutParams) numberIndicator.numberIndicator
.getLayoutParams();
params.height = (int) finalSize * 2;
params.width = (int) finalSize * 2;
numberIndicator.numberIndicator.setLayoutParams(params);
}
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setColor(backgroundColor);
if (animate) {
if (y == 0)
y = finalY + finalSize * 2;
y -= Utils.dpToPx(6, getResources());
size += Utils.dpToPx(2, getResources());
}
canvas.drawCircle(
ViewHelper.getX(ball)
+ Utils.getRelativeLeft((View) ball.getParent())
+ ball.getWidth() / 2, y, size, paint);
if (animate && size >= finalSize)
animate = false;
if (animate == false) {
ViewHelper
.setX(numberIndicator.numberIndicator,
(ViewHelper.getX(ball)
+ Utils.getRelativeLeft((View) ball
.getParent()) + ball.getWidth() / 2)
- size);
ViewHelper.setY(numberIndicator.numberIndicator, y - size);
numberIndicator.numberIndicator.setText(value + "");
}
invalidate();
}
}
class NumberIndicator extends Dialog {
Indicator indicator;
TextView numberIndicator;
public NumberIndicator(Context context) {
super(context, android.R.style.Theme_Translucent);
}
@Override
public void dismiss() {
super.dismiss();
indicator.y = 0;
indicator.size = 0;
indicator.animate = true;
}
@Override
public void onBackPressed() {
}
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.number_indicator_spinner);
setCanceledOnTouchOutside(false);
RelativeLayout content = (RelativeLayout) this
.findViewById(R.id.number_indicator_spinner_content);
indicator = new Indicator(this.getContext());
content.addView(indicator);
numberIndicator = new TextView(getContext());
numberIndicator.setTextColor(Color.WHITE);
numberIndicator.setGravity(Gravity.CENTER);
content.addView(numberIndicator);
indicator.setLayoutParams(new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.FILL_PARENT,
RelativeLayout.LayoutParams.FILL_PARENT));
}
}
}
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/Switch.java
================================================
package com.gc.materialdesign.views;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.LayerDrawable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.widget.RelativeLayout;
import com.gc.materialdesign.R;
import com.gc.materialdesign.utils.Utils;
import com.nineoldandroids.animation.ObjectAnimator;
import com.nineoldandroids.view.ViewHelper;
public class Switch extends CustomView {
private int backgroundColor = Color.parseColor("#4CAF50");
private Ball ball;
private boolean check = false;
private boolean eventCheck = false;
private boolean press = false;
private OnCheckListener onCheckListener;
private Bitmap bitmap;
public Switch(Context context, AttributeSet attrs) {
super(context, attrs);
setAttributes(attrs);
setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
if (check)
setChecked(false);
else
setChecked(true);
}
});
}
// Set atributtes of XML to View
protected void setAttributes(AttributeSet attrs) {
setBackgroundResource(R.drawable.background_transparent);
// Set size of view
setMinimumHeight(Utils.dpToPx(48, getResources()));
setMinimumWidth(Utils.dpToPx(80, getResources()));
// Set background Color
// Color by resource
int bacgroundColor = attrs.getAttributeResourceValue(ANDROIDXML,
"background", -1);
if (bacgroundColor != -1) {
setBackgroundColor(getResources().getColor(bacgroundColor));
} else {
// Color by hexadecimal
int background = attrs.getAttributeIntValue(ANDROIDXML, "background", -1);
if (background != -1)
setBackgroundColor(background);
}
check = attrs.getAttributeBooleanValue(MATERIALDESIGNXML, "check",
false);
eventCheck = check;
ball = new Ball(getContext());
RelativeLayout.LayoutParams params = new LayoutParams(Utils.dpToPx(20,
getResources()), Utils.dpToPx(20, getResources()));
params.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
ball.setLayoutParams(params);
addView(ball);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (isEnabled()) {
isLastTouch = true;
if (event.getAction() == MotionEvent.ACTION_DOWN) {
press = true;
} else if (event.getAction() == MotionEvent.ACTION_MOVE) {
float x = event.getX();
x = (x < ball.xIni) ? ball.xIni : x;
x = (x > ball.xFin) ? ball.xFin : x;
if (x > ball.xCen) {
eventCheck = true;
} else {
eventCheck = false;
}
ViewHelper.setX(ball, x);
ball.changeBackground();
if ((event.getX() <= getWidth() && event.getX() >= 0)) {
isLastTouch = false;
press = false;
}
} else if (event.getAction() == MotionEvent.ACTION_UP ||
event.getAction() == MotionEvent.ACTION_CANCEL) {
press = false;
isLastTouch = false;
if (eventCheck != check) {
check = eventCheck;
if (onCheckListener != null)
onCheckListener.onCheck(Switch.this,check);
}
if ((event.getX() <= getWidth() && event.getX() >= 0)) {
ball.animateCheck();
}
}
}
return true;
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (!placedBall) {
placeBall();
}
// Crop line to transparent effect
if(null == bitmap) {
bitmap = Bitmap.createBitmap(canvas.getWidth(),
canvas.getHeight(), Bitmap.Config.ARGB_8888);
}
Canvas temp = new Canvas(bitmap);
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setColor((eventCheck) ? backgroundColor : Color.parseColor("#B0B0B0"));
paint.setStrokeWidth(Utils.dpToPx(2, getResources()));
temp.drawLine(getHeight() / 2, getHeight() / 2, getWidth()
- getHeight() / 2, getHeight() / 2, paint);
Paint transparentPaint = new Paint();
transparentPaint.setAntiAlias(true);
transparentPaint.setColor(getResources().getColor(
android.R.color.transparent));
transparentPaint.setXfermode(new PorterDuffXfermode(
PorterDuff.Mode.CLEAR));
temp.drawCircle(ViewHelper.getX(ball) + ball.getWidth() / 2,
ViewHelper.getY(ball) + ball.getHeight() / 2,
ball.getWidth() / 2, transparentPaint);
canvas.drawBitmap(bitmap, 0, 0, new Paint());
if (press) {
paint.setColor((check) ? makePressColor() : Color
.parseColor("#446D6D6D"));
canvas.drawCircle(ViewHelper.getX(ball) + ball.getWidth() / 2,
getHeight() / 2, getHeight() / 2, paint);
}
invalidate();
}
/**
* Make a dark color to press effect
*
* @return
*/
protected int makePressColor() {
int r = (this.backgroundColor >> 16) & 0xFF;
int g = (this.backgroundColor >> 8) & 0xFF;
int b = (this.backgroundColor >> 0) & 0xFF;
r = (r - 30 < 0) ? 0 : r - 30;
g = (g - 30 < 0) ? 0 : g - 30;
b = (b - 30 < 0) ? 0 : b - 30;
return Color.argb(70, r, g, b);
}
// Move ball to first position in view
boolean placedBall = false;
private void placeBall() {
ViewHelper.setX(ball, getHeight() / 2 - ball.getWidth() / 2);
ball.xIni = ViewHelper.getX(ball);
ball.xFin = getWidth() - getHeight() / 2 - ball.getWidth() / 2;
ball.xCen = getWidth() / 2 - ball.getWidth() / 2;
placedBall = true;
ball.animateCheck();
}
// SETTERS
@Override
public void setBackgroundColor(int color) {
backgroundColor = color;
if (isEnabled())
beforeBackground = backgroundColor;
}
public void setChecked(boolean check) {
invalidate();
this.check = check;
this.eventCheck = check;
ball.animateCheck();
}
public boolean isCheck() {
return check;
}
class Ball extends View {
float xIni, xFin, xCen;
public Ball(Context context) {
super(context);
setBackgroundResource(R.drawable.background_switch_ball_uncheck);
}
public void changeBackground() {
if (eventCheck) {
setBackgroundResource(R.drawable.background_checkbox);
LayerDrawable layer = (LayerDrawable) getBackground();
GradientDrawable shape = (GradientDrawable) layer
.findDrawableByLayerId(R.id.shape_bacground);
shape.setColor(backgroundColor);
} else {
setBackgroundResource(R.drawable.background_switch_ball_uncheck);
}
}
public void animateCheck() {
changeBackground();
ObjectAnimator objectAnimator;
if (eventCheck) {
objectAnimator = ObjectAnimator.ofFloat(this, "x", ball.xFin);
} else {
objectAnimator = ObjectAnimator.ofFloat(this, "x", ball.xIni);
}
objectAnimator.setDuration(300);
objectAnimator.start();
}
}
public void setOncheckListener(OnCheckListener onCheckListener) {
this.onCheckListener = onCheckListener;
}
public interface OnCheckListener {
public void onCheck(Switch view, boolean check);
}
}
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/widgets/ColorSelector.java
================================================
package com.gc.materialdesign.widgets;
import com.gc.materialdesign.R;
import com.gc.materialdesign.views.Slider;
import com.gc.materialdesign.views.Slider.OnValueChangedListener;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Color;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.View.OnTouchListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.Animation.AnimationListener;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.RelativeLayout;
public class ColorSelector extends android.app.Dialog implements OnValueChangedListener{
int color = Color.BLACK;
Context context;
View colorView;
View view, backView;//background
OnColorSelectedListener onColorSelectedListener;
Slider red, green, blue;
public ColorSelector(Context context,Integer color, OnColorSelectedListener onColorSelectedListener) {
super(context, android.R.style.Theme_Translucent);
this.context = context;
this.onColorSelectedListener = onColorSelectedListener;
if(color != null)
this.color = color;
setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
if(ColorSelector.this.onColorSelectedListener != null)
ColorSelector.this.onColorSelectedListener.onColorSelected(ColorSelector.this.color);
}
});
}
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.color_selector);
view = (LinearLayout)findViewById(R.id.contentSelector);
backView = (RelativeLayout)findViewById(R.id.rootSelector);
backView.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getX() < view.getLeft() || event.getX() >view.getRight()
|| event.getY() > view.getBottom() || event.getY() < view.getTop()) {
dismiss();
}
return false;
}
});
colorView = findViewById(R.id.viewColor);
colorView.setBackgroundColor(color);
// Resize ColorView
colorView.post(new Runnable() {
@Override
public void run() {
LayoutParams params = (LayoutParams) colorView.getLayoutParams();
params.height = colorView.getWidth();
colorView.setLayoutParams(params);
}
});
// Configure Sliders
red = (Slider) findViewById(R.id.red);
green = (Slider) findViewById(R.id.green);
blue = (Slider) findViewById(R.id.blue);
int r = (this.color >> 16) & 0xFF;
int g = (this.color >> 8) & 0xFF;
int b = (this.color >> 0) & 0xFF;
red.setValue(r);
green.setValue(g);
blue.setValue(b);
red.setOnValueChangedListener(this);
green.setOnValueChangedListener(this);
blue.setOnValueChangedListener(this);
}
@Override
public void show() {
super.show();
view.startAnimation(AnimationUtils.loadAnimation(context, R.anim.dialog_main_show_amination));
backView.startAnimation(AnimationUtils.loadAnimation(context, R.anim.dialog_root_show_amin));
}
@Override
public void onValueChanged(int value) {
color = Color.rgb(red.getValue(), green.getValue(), blue.getValue());
colorView.setBackgroundColor(color);
}
// Event that execute when color selector is closed
public interface OnColorSelectedListener{
public void onColorSelected(int color);
}
@Override
public void dismiss() {
Animation anim = AnimationUtils.loadAnimation(context, R.anim.dialog_main_hide_amination);
anim.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
view.post(new Runnable() {
@Override
public void run() {
ColorSelector.super.dismiss();
}
});
}
});
Animation backAnim = AnimationUtils.loadAnimation(context, R.anim.dialog_root_hide_amin);
view.startAnimation(anim);
backView.startAnimation(backAnim);
}
}
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/widgets/Dialog.java
================================================
package com.gc.materialdesign.widgets;
import android.content.Context;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.Window;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.gc.materialdesign.R;
import com.gc.materialdesign.views.ButtonFlat;
public class Dialog extends android.app.Dialog{
Context context;
View view;
View backView;
String message;
TextView messageTextView;
String title;
TextView titleTextView;
ButtonFlat buttonAccept;
ButtonFlat buttonCancel;
String buttonCancelText;
View.OnClickListener onAcceptButtonClickListener;
View.OnClickListener onCancelButtonClickListener;
public Dialog(Context context,String title, String message) {
super(context, android.R.style.Theme_Translucent);
this.context = context;// init Context
this.message = message;
this.title = title;
}
public void addCancelButton(String buttonCancelText){
this.buttonCancelText = buttonCancelText;
}
public void addCancelButton(String buttonCancelText, View.OnClickListener onCancelButtonClickListener){
this.buttonCancelText = buttonCancelText;
this.onCancelButtonClickListener = onCancelButtonClickListener;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.dialog);
view = (RelativeLayout)findViewById(R.id.contentDialog);
backView = (RelativeLayout)findViewById(R.id.dialog_rootView);
backView.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getX() < view.getLeft()
|| event.getX() >view.getRight()
|| event.getY() > view.getBottom()
|| event.getY() < view.getTop()) {
dismiss();
}
return false;
}
});
this.titleTextView = (TextView) findViewById(R.id.title);
setTitle(title);
this.messageTextView = (TextView) findViewById(R.id.message);
setMessage(message);
this.buttonAccept = (ButtonFlat) findViewById(R.id.button_accept);
buttonAccept.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
if(onAcceptButtonClickListener != null)
onAcceptButtonClickListener.onClick(v);
}
});
if(buttonCancelText != null){
this.buttonCancel = (ButtonFlat) findViewById(R.id.button_cancel);
this.buttonCancel.setVisibility(View.VISIBLE);
this.buttonCancel.setText(buttonCancelText);
buttonCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
if(onCancelButtonClickListener != null)
onCancelButtonClickListener.onClick(v);
}
});
}
}
@Override
public void show() {
// TODO 自动生成的方法存根
super.show();
// set dialog enter animations
view.startAnimation(AnimationUtils.loadAnimation(context, R.anim.dialog_main_show_amination));
backView.startAnimation(AnimationUtils.loadAnimation(context, R.anim.dialog_root_show_amin));
}
// GETERS & SETTERS
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
messageTextView.setText(message);
}
public TextView getMessageTextView() {
return messageTextView;
}
public void setMessageTextView(TextView messageTextView) {
this.messageTextView = messageTextView;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
if(title == null)
titleTextView.setVisibility(View.GONE);
else{
titleTextView.setVisibility(View.VISIBLE);
titleTextView.setText(title);
}
}
public TextView getTitleTextView() {
return titleTextView;
}
public void setTitleTextView(TextView titleTextView) {
this.titleTextView = titleTextView;
}
public ButtonFlat getButtonAccept() {
return buttonAccept;
}
public void setButtonAccept(ButtonFlat buttonAccept) {
this.buttonAccept = buttonAccept;
}
public ButtonFlat getButtonCancel() {
return buttonCancel;
}
public void setButtonCancel(ButtonFlat buttonCancel) {
this.buttonCancel = buttonCancel;
}
public void setOnAcceptButtonClickListener(
View.OnClickListener onAcceptButtonClickListener) {
this.onAcceptButtonClickListener = onAcceptButtonClickListener;
if(buttonAccept != null)
buttonAccept.setOnClickListener(onAcceptButtonClickListener);
}
public void setOnCancelButtonClickListener(
View.OnClickListener onCancelButtonClickListener) {
this.onCancelButtonClickListener = onCancelButtonClickListener;
if(buttonCancel != null)
buttonCancel.setOnClickListener(onCancelButtonClickListener);
}
@Override
public void dismiss() {
Animation anim = AnimationUtils.loadAnimation(context, R.anim.dialog_main_hide_amination);
anim.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
view.post(new Runnable() {
@Override
public void run() {
Dialog.super.dismiss();
}
});
}
});
Animation backAnim = AnimationUtils.loadAnimation(context, R.anim.dialog_root_hide_amin);
view.startAnimation(anim);
backView.startAnimation(backAnim);
}
}
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/widgets/ProgressDialog.java
================================================
package com.gc.materialdesign.widgets;
import android.content.Context;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.Window;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.gc.materialdesign.R;
import com.gc.materialdesign.views.ButtonFlat;
import com.gc.materialdesign.views.ProgressBarCircularIndeterminate;
public class ProgressDialog extends android.app.Dialog{
Context context;
View view;
View backView;
String title;
TextView titleTextView;
int progressColor = -1;
public ProgressDialog(Context context,String title) {
super(context, android.R.style.Theme_Translucent);
this.title = title;
this.context = context;
}
public ProgressDialog(Context context,String title, int progressColor) {
super(context, android.R.style.Theme_Translucent);
this.title = title;
this.progressColor = progressColor;
this.context = context;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.progress_dialog);
view = (RelativeLayout)findViewById(R.id.contentDialog);
backView = (RelativeLayout)findViewById(R.id.dialog_rootView);
backView.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getX() < view.getLeft()
|| event.getX() >view.getRight()
|| event.getY() > view.getBottom()
|| event.getY() < view.getTop()) {
dismiss();
}
return false;
}
});
this.titleTextView = (TextView) findViewById(R.id.title);
setTitle(title);
if(progressColor != -1){
ProgressBarCircularIndeterminate progressBarCircularIndeterminate = (ProgressBarCircularIndeterminate) findViewById(R.id.progressBarCircularIndetermininate);
progressBarCircularIndeterminate.setBackgroundColor(progressColor);
}
}
@Override
public void show() {
// TODO 自动生成的方法存根
super.show();
// set dialog enter animations
view.startAnimation(AnimationUtils.loadAnimation(context, R.anim.dialog_main_show_amination));
backView.startAnimation(AnimationUtils.loadAnimation(context, R.anim.dialog_root_show_amin));
}
// GETERS & SETTERS
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
if(title == null)
titleTextView.setVisibility(View.GONE);
else{
titleTextView.setVisibility(View.VISIBLE);
titleTextView.setText(title);
}
}
public TextView getTitleTextView() {
return titleTextView;
}
public void setTitleTextView(TextView titleTextView) {
this.titleTextView = titleTextView;
}
@Override
public void dismiss() {
Animation anim = AnimationUtils.loadAnimation(context, R.anim.dialog_main_hide_amination);
anim.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
view.post(new Runnable() {
@Override
public void run() {
ProgressDialog.super.dismiss();
}
});
}
});
Animation backAnim = AnimationUtils.loadAnimation(context, R.anim.dialog_root_hide_amin);
view.startAnimation(anim);
backView.startAnimation(backAnim);
}
}
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/widgets/SnackBar.java
================================================
package com.gc.materialdesign.widgets;
import android.app.Activity;
import android.app.Dialog;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
import android.widget.TextView;
import com.gc.materialdesign.R;
import com.gc.materialdesign.views.ButtonFlat;
public class SnackBar extends Dialog{
String text;
float textSize = 14;//Roboto Regular 14sp
String buttonText;
View.OnClickListener onClickListener;
Activity activity;
View view;
ButtonFlat button;
int backgroundSnackBar = Color.parseColor("#333333");
int backgroundButton = Color.parseColor("#1E88E5");
OnHideListener onHideListener;
// Timer
private boolean mIndeterminate = false;
private int mTimer = 3 * 1000;
// With action button
public SnackBar(Activity activity, String text, String buttonText, View.OnClickListener onClickListener) {
super(activity, android.R.style.Theme_Translucent);
this.activity = activity;
this.text = text;
this.buttonText = buttonText;
this.onClickListener = onClickListener;
}
// Only text
public SnackBar(Activity activity, String text) {
super(activity, android.R.style.Theme_Translucent);
this.activity = activity;
this.text = text;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.snackbar);
setCanceledOnTouchOutside(false);
((TextView)findViewById(R.id.text)).setText(text);
((TextView)findViewById(R.id.text)).setTextSize(textSize); //set textSize
button = (ButtonFlat) findViewById(R.id.buttonflat);
if(text == null || onClickListener == null){
button.setVisibility(View.GONE);
}else{
button.setText(buttonText);
button.setBackgroundColor(backgroundButton);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
onClickListener.onClick(v);
}
});
}
view = findViewById(R.id.snackbar);
view.setBackgroundColor(backgroundSnackBar);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
return activity.dispatchTouchEvent(event);
}
@Override
public void onBackPressed() {
}
@Override
public void show() {
super.show();
view.setVisibility(View.VISIBLE);
view.startAnimation(AnimationUtils.loadAnimation(activity, R.anim.snackbar_show_animation));
if (!mIndeterminate) {
dismissTimer.start();
}
}
// Dismiss timer
Thread dismissTimer = new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(mTimer);
} catch (InterruptedException e) {
e.printStackTrace();
}
handler.sendMessage(new Message());
}
});
Handler handler = new Handler(new Handler.Callback() {
@Override
public boolean handleMessage(Message msg) {
if(onHideListener != null) {
onHideListener.onHide();
}
dismiss();
return false;
}
});
/**
* @author Jack Tony
*/
@Override
public void dismiss() {
Animation anim = AnimationUtils.loadAnimation(activity, R.anim.snackbar_hide_animation);
anim.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
SnackBar.super.dismiss();
}
});
view.startAnimation(anim);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
// TODO 自动生成的方法存根
if (keyCode == KeyEvent.KEYCODE_BACK ) {
dismiss();
}
return super.onKeyDown(keyCode, event);
}
public void setMessageTextSize(float size) {
textSize = size;
}
public void setIndeterminate(boolean indeterminate) {
mIndeterminate = indeterminate;
}
public boolean isIndeterminate() {
return mIndeterminate;
}
public void setDismissTimer(int time) {
mTimer = time;
}
public int getDismissTimer() {
return mTimer;
}
/**
* Change background color of SnackBar
* @param color
*/
public void setBackgroundSnackBar(int color){
backgroundSnackBar = color;
if(view != null)
view.setBackgroundColor(color);
}
/**
* Chage color of FlatButton in Snackbar
* @param color
*/
public void setColorButton(int color){
backgroundButton = color;
if(button != null)
button.setBackgroundColor(color);
}
/**
* This event start when snackbar dismish without push the button
* @author Navas
*
*/
public interface OnHideListener{
public void onHide();
}
public void setOnhideListener(OnHideListener onHideListener){
this.onHideListener = onHideListener;
}
}
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/res/anim/dialog_main_hide_amination.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator"
android:shareInterpolator="true"
android:startOffset="50">
<alpha
android:duration="200"
android:fromAlpha="1.0"
android:toAlpha="0.0" />
<scale
android:fromXScale="1.0"
android:toXScale="0.8"
android:fromYScale="1.0"
android:toYScale="0.8"
android:pivotX="50%"
android:pivotY="50%"
android:duration="200"/>
</set>
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/res/anim/dialog_main_show_amination.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:duration="200"
android:fromAlpha="0.0"
android:toAlpha="1.0" />
<scale
android:duration="200"
android:fromXScale="0.8"
android:fromYScale="0.8"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="1.0"
android:toYScale="1.0" />
</set>
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/res/anim/dialog_root_hide_amin.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator"
android:shareInterpolator="true"
android:startOffset="50">
<alpha
android:fromAlpha="1.0"
android:toAlpha="0.0"
android:duration="200" />
</set>
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/res/anim/dialog_root_show_amin.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:fromAlpha="0.0"
android:toAlpha="1.0"
android:duration="200" />
</set>
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/res/anim/progress_indeterminate_animation.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<!-- <translate -->
<!-- android:duration="1000" -->
<!-- android:fromXDelta="-100%" -->
<!-- android:toXDelta="100%" -->
<!-- android:interpolator="@android:anim/cycle_interpolator" -->
<!-- android:repeatCount="infinite"/> -->
<scale
android:duration="1000"
android:fromXScale="0.5"
android:fromYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="2"
android:toYScale="1"
android:repeatCount="infinite"
android:repeatMode="reverse"/>
</set>
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/res/anim/snackbar_hide_animation.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromYDelta="0"
android:toYDelta="100%"
android:duration="300">
</translate>
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/res/anim/snackbar_show_animation.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromYDelta="100%"
android:toYDelta="0"
android:duration="300">
</translate>
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/background_button_float.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@drawable/float_button_shadow1">
</item>
<item
android:id="@+id/shape_bacground"
android:bottom="2dp"
android:left="1dp"
android:top="1dp"
android:right="1dp">
<shape android:shape="oval" >
<solid android:color="#1E88E5" />
</shape>
</item>
</layer-list>
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/background_button_rectangle.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@drawable/background_button">
</item>
<item android:id="@+id/shape_bacground">
<shape android:shape="rectangle" >
<corners android:radius="2dp" />
<solid android:color="#FFF" />
</shape>
</item>
</layer-list>
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/background_checkbox.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/shape_bacground">
<shape android:shape="oval" >
<solid android:color="@android:color/transparent"/>
</shape>
</item>
</layer-list>
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/background_checkbox_check.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/shape_bacground">
<shape android:shape="rectangle" >
<solid android:color="#4CAF50" />
<corners android:radius="2dp"/>
</shape>
</item>
</layer-list>
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/background_checkbox_uncheck.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/shape_bacground">
<shape android:shape="rectangle" >
<stroke android:width="2dp" android:color="#6D6D6D"/>
<solid android:color="@android:color/transparent" />
<corners android:radius="2dp"/>
</shape>
</item>
</layer-list>
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/background_progress.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/shape_bacground">
<shape android:shape="rectangle" >
<corners android:topRightRadius="200dp" android:bottomRightRadius="100dp" />
<solid android:color="#1E88E5" />
</shape>
</item>
</layer-list>
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/background_switch_ball_uncheck.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/shape_bacground">
<shape android:shape="oval" >
<stroke android:width="2dp" android:color="#6D6D6D"/>
<solid android:color="@android:color/transparent"/>
</shape>
</item>
</layer-list>
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/background_transparent.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/shape_bacground">
<shape android:shape="rectangle" >
<corners android:radius="2dp" />
<solid android:color="#00000000" />
</shape>
</item>
</layer-list>
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/shadow_down.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<corners
android:bottomLeftRadius="2dp"/>
<gradient
android:angle="270"
android:centerColor="@android:color/transparent"
android:endColor="@android:color/transparent"
android:startColor="@android:color/darker_gray" />
</shape>
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/shadow_right.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<corners android:topRightRadius="2dp"
android:bottomRightRadius="2dp"/>
<gradient
android:centerColor="@android:color/transparent"
android:endColor="@android:color/transparent"
android:startColor="@android:color/darker_gray" />
</shape>
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/res/layout/color_selector.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:materialdesign="http://schemas.android.com/apk/res-auto"
android:id="@+id/rootSelector"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#55000000"
android:padding="40dp" >
<LinearLayout
android:id="@+id/contentSelector"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@drawable/dialog_background"
android:orientation="vertical" >
<View
android:id="@+id/viewColor"
android:layout_width="fill_parent"
android:layout_height="10dp" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#FFF"
android:padding="16dp" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="8dp"
android:textSize="17sp"
android:text="R"
android:textColor="#4D4D4D" />
<com.gc.materialdesign.views.Slider
android:id="@+id/red"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#4D4D4D"
materialdesign:max="255"
materialdesign:min="0"
materialdesign:showNumberIndicator="true" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center_vertical"
android:orientation="horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="8dp"
android:textSize="17sp"
android:text="G"
android:textColor="#4D4D4D" />
<com.gc.materialdesign.views.Slider
android:id="@+id/green"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#4D4D4D"
materialdesign:max="255"
materialdesign:min="0"
materialdesign:showNumberIndicator="true" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center_vertical"
android:orientation="horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="8dp"
android:textSize="17sp"
android:text="B"
android:textColor="#4D4D4D" />
<com.gc.materialdesign.views.Slider
android:id="@+id/blue"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#4D4D4D"
materialdesign:max="255"
materialdesign:min="0"
materialdesign:showNumberIndicator="true" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/res/layout/dialog.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dialog_rootView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#55000000"
android:padding="32dp" >
<RelativeLayout
android:id="@+id/contentDialog"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@drawable/dialog_background"
android:padding="24dp">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:text="Title"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000" />
<ScrollView
android:id="@+id/message_scrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/title"
android:paddingBottom="50dp"
android:scrollbarSize="2dp"
android:scrollbarThumbVertical="@color/thumbColor" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam"
android:textColor="#000"
android:textSize="18sp" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/message_scrollView"
android:layout_marginTop="24dp"
android:gravity="right"
android:orientation="horizontal" >
<com.gc.materialdesign.views.ButtonFlat
android:id="@+id/button_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel"
android:background="#000000"
android:visibility="gone" />
<com.gc.materialdesign.views.ButtonFlat
android:id="@+id/button_accept"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Accept"
android:background="#1E88E5" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/res/layout/number_indicator_spinner.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/number_indicator_spinner_content"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/res/layout/progress_dialog.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dialog_rootView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#55000000"
android:padding="32dp" >
<RelativeLayout
android:id="@+id/contentDialog"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@drawable/dialog_background"
android:padding="24dp" >
<com.gc.materialdesign.views.ProgressBarCircularIndeterminate
android:id="@+id/progressBarCircularIndetermininate"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_centerVertical="true"
android:background="#1E88E5" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/progressBarCircularIndetermininate"
android:layout_marginLeft="8dp"
android:text="Title"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000" />
</RelativeLayout>
</RelativeLayout>
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/res/layout/snackbar.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minHeight="56dp"
android:layout_alignParentBottom="true" >
<RelativeLayout
android:id="@+id/snackbar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#333333"
android:paddingBottom="18dp"
android:paddingLeft="24dp"
android:paddingRight="24dp"
android:paddingTop="18dp"
android:visibility="invisible" >
<com.gc.materialdesign.views.ButtonFlat
android:id="@+id/buttonflat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginLeft="24dp"
android:text="ACTION" />
<TextView
android:id="@+id/text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@id/buttonflat"
android:textColor="#FFF" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/res/values/attributes.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="CustomAttributes">
<!-- Color of ripple animation -->
<attr name="rippleColor" format="color|reference" />
<!-- Speed of ripple animation -->
<attr name="rippleSpeed" format="float" />
<!-- indicate if the slider must show number indicator -->
<attr name="showNumberIndicator" format="boolean" />
<!-- in progress view indicate max value of progress -->
<attr name="max" format="integer" />
<!-- in progress view indicate min value of progress -->
<attr name="min" format="integer" />
<!-- in progress view indicate value of progress -->
<attr name="value" format="integer" />
<!-- in progress view indicate value of progress -->
<attr name="progress" format="integer" />
<attr name="ringWidth" format="dimension" />
<!-- in switche's view indicate state of view -->
<attr name="check" format="boolean" />
<attr name="checkBoxSize" format="dimension" />
<attr name="thumbSize" format="dimension" />
<!-- in float button indicate icon resource -->
<attr name="iconDrawable" format="integer" />
<!-- in button whitch contains drawable indicate icon resource -->
<attr name="iconSize" format="dimension" />
<!-- in float button indicate if must start with animation -->
<attr name="animate" format="boolean" />
<!-- set the border of the ripple frame -->
<attr name="rippleBorderRadius" format="float" />
<!-- if true, delays calls to OnClickListeners until ripple effect ends -->
<attr name="clickAfterRipple" format="boolean" />
</declare-styleable>
</resources>
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/res/values/colors.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="green">#00FF00</color>
<color name="thumbColor">#66aaaaaa</color>
</resources>
================================================
FILE: MaterialDesignLibrary/MaterialDesign/src/main/res/values/strings.xml
================================================
<resources>
<string name="app_name">MaterialDesign</string>
</resources>
================================================
FILE: MaterialDesignLibrary/MaterialDesignDemo/.gitignore
================================================
/build
================================================
FILE: MaterialDesignLibrary/MaterialDesignDemo/build.gradle
================================================
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.gc.materialdesigndemo"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile project(':MaterialDesign')
}
================================================
FILE: MaterialDesignLibrary/MaterialDesignDemo/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Applications/adt-bundle-mac-x86_64-20140321/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
================================================
FILE: MaterialDesignLibrary/MaterialDesignDemo/src/androidTest/java/com/gc/materialdesigndemo/ApplicationTest.java
================================================
package com.gc.materialdesigndemo;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}
================================================
FILE: MaterialDesignLibrary/MaterialDesignDemo/src/main/AndroidManifest.xml
================================================
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gc.materialdesigndemo">
<application android:allowBackup="true" android:label="@string/app_name"
android:icon="@mipmap/ic_launcher" android:theme="@style/AppTheme">
<activity
android:name="com.gc.materialdesigndemo.ui.MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.gc.materialdesigndemo.ui.ButtonsActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="com.gc.materialdesigndemo.ui.SwitchActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="com.gc.materialdesigndemo.ui.ProgressActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="com.gc.materialdesigndemo.ui.WidgetActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" >
</activity>
</application>
</manifest>
================================================
FILE: MaterialDesignLibrary/MaterialDesignDemo/src/main/java/com/gc/materialdesigndemo/ui/ButtonsActivity.java
================================================
package com.gc.materialdesigndemo.ui;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Window;
import com.gc.materialdesigndemo.R;
public class ButtonsActivity extends Activity {
int backgroundColor = Color.parseColor("#1E88E5");
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_buttons);
int color = getIntent().getIntExtra("BACKGROUND", Color.BLACK);
findViewById(R.id.buttonflat).setBackgroundColor(color);
findViewById(R.id.button).setBackgroundColor(color);
findViewById(R.id.buttonFloatSmall).setBackgroundColor(color);
findViewById(R.id.buttonIcon).setBackgroundColor(color);
findViewById(R.id.buttonFloat).setBackgroundColor(color);
}
}
================================================
FILE: MaterialDesignLibrary/MaterialDesignDemo/src/main/java/com/gc/materialdesigndemo/ui/MainActivity.java
================================================
package com.gc.materialdesigndemo.ui;
import com.gc.materialdesign.views.ButtonFloatSmall;
import com.gc.materialdesign.views.LayoutRipple;
import com.gc.materialdesign.widgets.ColorSelector;
import com.gc.materialdesign.widgets.ColorSelector.OnColorSelectedListener;
import com.gc.materialdesigndemo.R;
import com.nineoldandroids.view.ViewHelper;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
public class MainActivity extends Activity implements OnColorSelectedListener{
int backgroundColor = Color.parseColor("#1E88E5");
ButtonFloatSmall buttonSelectColor;
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
buttonSelectColor = (ButtonFloatSmall) findViewById(R.id.buttonColorSelector);
buttonSelectColor.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
ColorSelector colorSelector = new ColorSelector(MainActivity.this, backgroundColor, MainActivity.this);
colorSelector.show();
}
});
LayoutRipple layoutRipple = (LayoutRipple) findViewById(R.id.itemButtons);
setOriginRiple(layoutRipple);
layoutRipple.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent intent = new Intent(MainActivity.this,ButtonsActivity.class);
intent.putExtra("BACKGROUND", backgroundColor);
startActivity(intent);
}
});
layoutRipple = (LayoutRipple) findViewById(R.id.itemSwitches);
setOriginRiple(layoutRipple);
layoutRipple.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent intent = new Intent(MainActivity.this,SwitchActivity.class);
intent.putExtra("BACKGROUND", backgroundColor);
startActivity(intent);
}
});
layoutRipple = (LayoutRipple) findViewById(R.id.itemProgress);
setOriginRiple(layoutRipple);
layoutRipple.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent intent = new Intent(MainActivity.this,ProgressActivity.class);
intent.putExtra("BACKGROUND", backgroundColor);
startActivity(intent);
}
});
layoutRipple = (LayoutRipple) findViewById(R.id.itemWidgets);
setOriginRiple(layoutRipple);
layoutRipple.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent intent = new Intent(MainActivity.this,WidgetActivity.class);
intent.putExtra("BACKGROUND", backgroundColor);
startActivity(intent);
}
});
}
private void setOriginRiple(final LayoutRipple layoutRipple){
layoutRipple.post(new Runnable() {
@Override
public void run() {
View v = layoutRipple.getChildAt(0);
layoutRipple.setxRippleOrigin(ViewHelper.getX(v)+v.getWidth()/2);
layoutRipple.setyRippleOrigin(ViewHelper.getY(v)+v.getHeight()/2);
layoutRipple.setRippleColor(Color.parseColor("#1E88E5"));
layoutRipple.setRippleSpeed(30);
}
});
}
@Override
public void onColorSelected(int color) {
backgroundColor = color;
buttonSelectColor.setBackgroundColor(color);
}
}
================================================
FILE: MaterialDesignLibrary/MaterialDesignDemo/src/main/java/com/gc/materialdesigndemo/ui/ProgressActivity.java
================================================
package com.gc.materialdesigndemo.ui;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.Window;
import com.gc.materialdesign.views.ProgressBarDeterminate;
import com.gc.materialdesign.views.ProgressBarIndeterminateDeterminate;
import com.gc.materialdesigndemo.R;
public class ProgressActivity extends Activity {
int backgroundColor = Color.parseColor("#1E88E5");
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_progress);
int color = getIntent().getIntExtra("BACKGROUND", Color.BLACK);
findViewById(R.id.progressBarCircularIndetermininate).setBackgroundColor(color);
findViewById(R.id.progressBarIndeterminate).setBackgroundColor(color);
findViewById(R.id.progressBarIndeterminateDeterminate).setBackgroundColor(color);
findViewById(R.id.progressDeterminate).setBackgroundColor(color);
findViewById(R.id.slider).setBackgroundColor(color);
findViewById(R.id.sliderNumber).setBackgroundColor(color);
progreesBarDeterminate = (ProgressBarDeterminate) findViewById(R.id.progressDeterminate);
progressTimer.start();
progressBarIndeterminateDeterminate = (ProgressBarIndeterminateDeterminate) findViewById(R.id.progressBarIndeterminateDeterminate);
progressTimer2.start();
}
ProgressBarDeterminate progreesBarDeterminate;
Thread progressTimer = new Thread(new Runnable() {
@Override
public void run() {
for(int i = 0; i <= 100; i++){
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
handler.sendMessage(new Message());
}
}
});
Handler handler = new Handler(new Handler.Callback() {
int progress = 0;
@Override
public boolean handleMessage(Message msg) {
progreesBarDeterminate.setProgress(progress++);
return false;
}
});
ProgressBarIndeterminateDeterminate progressBarIndeterminateDeterminate;
Thread progressTimer2 = new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(4000);
for(int i = 0; i <= 100; i++){
Thread.sleep(100);
handler2.sendMessage(new Message());
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
Handler handler2 = new Handler(new Handler.Callback() {
int progress = 0;
@Override
public boolean handleMessage(Message msg) {
progressBarIndeterminateDeterminate.setProgress(progress++);
return false;
}
});
}
================================================
FILE: MaterialDesignLibrary/MaterialDesignDemo/src/main/java/com/gc/materialdesigndemo/ui/SwitchActivity.java
================================================
package com.gc.materialdesigndemo.ui;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Window;
import com.gc.materialdesigndemo.R;
public class SwitchActivity extends Activity {
int backgroundColor = Color.parseColor("#1E88E5");
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_switchs);
int color = getIntent().getIntExtra("BACKGROUND", Color.BLACK);
findViewById(R.id.checkBox).setBackgroundColor(color);
findViewById(R.id.switchView).setBackgroundColor(color);
}
}
================================================
FILE: MaterialDesignLibrary/MaterialDesignDemo/src/main/java/com/gc/materialdesigndemo/ui/WidgetActivity.java
================================================
package com.gc.materialdesigndemo.ui;
import com.gc.materialdesign.views.ButtonFlat;
import com.gc.materialdesign.widgets.ColorSelector;
import com.gc.materialdesign.widgets.Dialog;
import com.gc.materialdesign.widgets.SnackBar;
import com.gc.materialdesigndemo.R;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.Toast;
public class WidgetActivity extends Activity {
private int backgroundColor = Color.parseColor("#1E88E5");
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_widgets);
// SHOW SNACKBAR
findViewById(R.id.buttonSnackBar).setOnClickListener(new OnClickListener() {
@Override
public void onClick(final View flatButton) {
new SnackBar(WidgetActivity.this,
"Do you want change color of this button to red?",
"yes", new OnClickListener() {
@Override
public void onClick(View v) {
ButtonFlat btn = (ButtonFlat) findViewById(R.id.buttonSnackBar);
btn.setTextColor(Color.RED);
}
}).show();
}
});
// SHOW DiALOG
findViewById(R.id.buttonDialog).setOnClickListener(new OnClickListener() {
@Override
public void onClick(final View flatButton) {
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");
dialog.setOnAcceptButtonClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(WidgetActivity.this, "Click accept button", 1).show();
}
});
dialog.setOnCancelButtonClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(WidgetActivity.this, "Click cancel button", 1).show();
}
});
dialog.show();
}
});
// SHOW COLOR SEECTOR
findViewById(R.id.buttonColorSelector).setOnClickListener(new OnClickListener() {
@Override
public void onClick(final View flatButton) {
new ColorSelector(WidgetActivity.this, Color.RED, null).show();
}
});
}
}
================================================
FILE: MaterialDesignLibrary/MaterialDesignDemo/src/main/res/drawable/blue_background.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="#b3e5fc"/>
</shape>
================================================
FILE: MaterialDesignLibrary/MaterialDesignDemo/src/main/res/drawable/selector_list.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_pressed="true" android:drawable="@drawable/blue_background"></item>
<item android:state_pressed="false" android:drawable="@drawable/transparent_backgrouns"></item>
</selector>
================================================
FILE: MaterialDesignLibrary/MaterialDesignDemo/src/main/res/drawable/transparent_backgrouns.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="#00000000"/>
</shape>
================================================
FILE: MaterialDesignLibrary/MaterialDesignDemo/src/main/res/layout/activity_buttons.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:materialdesign="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFF"
>
<com.gc.materialdesign.views.ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<!-- FLAT BUTTON -->
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="32dp"
android:layout_marginLeft="24dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="Flat Button" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:background="#1E88E5" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="72dp" >
<com.gc.materialdesign.views.ButtonFlat
android:id="@+id/buttonflat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:textColor="#ffffff"
android:text="Button" />
</RelativeLayout>
<!-- RECTANGLE BUTTON -->
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="32dp"
android:layout_marginLeft="24dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="Rectangle Button" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:background="#1E88E5" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="72dp" >
<com.gc.materialdesign.views.ButtonRectangle
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#1E88E5"
android:text="Button" />
</RelativeLayout>
<!-- SMALL FLOAT BUTTON -->
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="32dp"
android:layout_marginLeft="24dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="Small Float Button" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:background="#1E88E5" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="72dp" >
<com.gc.materialdesign.views.ButtonFloatSmall
android:id="@+id/buttonFloatSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#1E88E5"
materialdesign:iconDrawable="@drawable/ic_action_new" />
</RelativeLayout>
<!-- FLOAT BUTTON -->
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="32dp"
android:layout_marginLeft="24dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="Icon Button" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:background="#1E88E5" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="72dp" >
<com.gc.materialdesign.views.ButtonIcon
android:id="@+id/buttonIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#1E88E5"
materialdesign:iconDrawable="@drawable/ic_next" />
</RelativeLayout>
<!-- FLOAT BUTTON -->
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="32dp"
android:layout_marginLeft="24dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="Float Button" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:background="#1E88E5" />
</RelativeLayout>
</LinearLayout>
</com.gc.materialdesign.views.ScrollView>
<com.gc.materialdesign.views.ButtonFloat
android:id="@+id/buttonFloat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="24dp"
android:background="#1E88E5"
materialdesign:animate="true"
materialdesign:iconDrawable="@drawable/ic_action_new" />
</RelativeLayout>
================================================
FILE: MaterialDesignLibrary/MaterialDesignDemo/src/main/res/layout/activity_main.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:materialdesign="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFF"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="148dp" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="128dp"
android:background="#01579b"
android:paddingBottom="20dp"
android:paddingLeft="104dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="MaterialDesign"
android:textColor="#FFF"
android:textSize="25dp" />
</RelativeLayout>
<View
android:layout_width="fill_parent"
android:layout_height="2dp"
android:layout_marginTop="128dp"
android:background="#88CECECE" />
<com.gc.materialdesign.views.ButtonFloatSmall
android:id="@+id/buttonColorSelector"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="32dp"
android:layout_marginTop="108dp"
android:background="#1E88E5"
materialdesign:iconDrawable="@drawable/icn_select_color" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="48dp"
android:layout_marginLeft="104dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="Views" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:background="#1E88E5" />
</RelativeLayout>
<com.gc.materialdesign.views.LayoutRipple
android:id="@+id/itemButtons"
android:layout_width="fill_parent"
android:layout_height="64dp"
android:background="#FFF"
android:clickable="true" >
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_marginLeft="32dp"
android:src="@drawable/icn_button" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="104dp"
android:text="Buttons" />
</com.gc.materialdesign.views.LayoutRipple>
<com.gc.materialdesign.views.LayoutRipple
android:id="@+id/itemSwitches"
android:layout_width="fill_parent"
android:layout_height="64dp"
android:background="#FFF"
android:clickable="true" >
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_marginLeft="32dp"
android:src="@drawable/icn_switch" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="104dp"
android:text="Switches" />
</com.gc.materialdesign.views.LayoutRipple>
<com.gc.materialdesign.views.LayoutRipple
android:id="@+id/itemProgress"
android:layout_width="fill_parent"
android:layout_height="64dp"
android:background="#FFF"
android:clickable="true" >
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_marginLeft="32dp"
android:src="@drawable/icn_progress" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="104dp"
android:text="Progress indicators" />
</com.gc.materialdesign.views.LayoutRipple>
<com.gc.materialdesign.views.LayoutRipple
android:id="@+id/itemWidgets"
android:layout_width="fill_parent"
android:layout_height="64dp"
android:background="#FFF"
android:clickable="true" >
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_marginLeft="32dp"
android:src="@drawable/icn_widget" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="104dp"
android:text="Widgets" />
</com.gc.materialdesign.views.LayoutRipple>
</LinearLayout>
================================================
FILE: MaterialDesignLibrary/MaterialDesignDemo/src/main/res/layout/activity_progress.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:materialdesign="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<!-- PROGRESS BAR INDETERMINATE -->
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="32dp"
android:layout_marginLeft="24dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="Progress Bar Circular Indeterminate" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:background="#1E88E5" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="48dp" >
<com.gc.materialdesign.views.ProgressBarCircularIndeterminate
android:id="@+id/progressBarCircularIndetermininate"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_centerInParent="true"
android:background="#1E88E5" />
</RelativeLayout>
<!-- PROGRESS BAR INDETERMINATE -->
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="32dp"
android:layout_marginLeft="24dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="Progress Bar Indeterminate" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:background="#1E88E5" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="48dp" >
<com.gc.materialdesign.views.ProgressBarIndeterminate
android:id="@+id/progressBarIndeterminate"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#1E88E5" />
</RelativeLayout>
<!-- PROGRESS BAR INDETERMINATE DETERMINATE -->
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="32dp"
android:layout_marginLeft="24dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="Progress Bar Indeterminate Determinate" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:background="#1E88E5" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="48dp" >
<com.gc.materialdesign.views.ProgressBarIndeterminateDeterminate
android:id="@+id/progressBarIndeterminateDeterminate"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#1E88E5" />
</RelativeLayout>
<!-- PROGRESS BAR DETERMINATE -->
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="32dp"
android:layout_marginLeft="24dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="Progress Bar Determinate" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:background="#1E88E5" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="48dp" >
<com.gc.materialdesign.views.ProgressBarDeterminate
android:id="@+id/progressDeterminate"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#1E88E5" />
</RelativeLayout>
<!-- SLIDER -->
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="32dp"
android:layout_marginLeft="24dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="Slider" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:background="#1E88E5" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="48dp" >
<com.gc.materialdesign.views.Slider
android:id="@+id/slider"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#1E88E5"
materialdesign:max="50"
materialdesign:min="0"
/>
</RelativeLayout>
<!-- SLIDER WITH NUMBER INDICATOR-->
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="32dp"
android:layout_marginLeft="24dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="Slider with number indicator" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:background="#1E88E5" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="48dp" >
<com.gc.materialdesign.views.Slider
android:id="@+id/sliderNumber"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#1E88E5"
materialdesign:max="50"
materialdesign:min="0"
materialdesign:showNumberIndicator="true" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
================================================
FILE: MaterialDesignLibrary/MaterialDesignDemo/src/main/res/layout/activity_switchs.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:materialdesign="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="24dp" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<!-- CHECKBOX -->
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="32dp"
android:layout_marginLeft="24dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="Checkbox" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:background="#1E88E5" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="72dp" >
<com.gc.materialdesign.views.CheckBox
android:id="@+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#1E88E5"
materialdesign:check="true" />
</RelativeLayout>
<!-- SWITCH -->
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="32dp"
android:layout_marginLeft="24dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="Switch" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:background="#1E88E5" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="72dp" >
<com.gc.materialdesign.views.Switch
android:id="@+id/switchView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#1E88E5"
materialdesign:check="true" />
</RelativeLayout>
<!-- RADIO BUTTON -->
<!-- <RelativeLayout -->
<!-- android:layout_width="fill_parent" -->
<!-- android:layout_height="32dp" -->
<!-- android:layout_marginLeft="24dp" > -->
<!-- <TextView -->
<!-- android:layout_width="wrap_content" -->
<!-- android:layout_height="wrap_content" -->
<!-- android:layout_centerVertical="true" -->
<!-- android:text="Radio Button" /> -->
<!-- <View -->
<!-- android:layout_width="fill_parent" -->
<!-- android:layout_height="1dp" -->
<!-- android:layout_alignParentBottom="true" -->
<!-- android:background="#1E88E5" /> -->
<!-- </RelativeLayout> -->
<!-- <RelativeLayout -->
<!-- android:layout_width="fill_parent" -->
<!-- android:layout_height="72dp" > -->
<!-- COLOCAR RADIO BUTTON -->
<!-- </RelativeLayout> -->
</LinearLayout>
</RelativeLayout>
================================================
FILE: MaterialDesignLibrary/MaterialDesignDemo/src/main/res/layout/activity_widgets.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:materialdesign="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="24dp" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="32dp"
android:layout_marginLeft="24dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="SnackBar" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:background="#1E88E5" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="72dp" >
<com.gc.materialdesign.views.ButtonFlat
android:id="@+id/buttonSnackBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="Show SnackBar" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="32dp"
android:layout_marginLeft="24dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="Dialog" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:background="#1E88E5" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="72dp" >
<com.gc.materialdesign.views.ButtonFlat
android:id="@+id/buttonDialog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="Show Dialog" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="32dp"
android:layout_marginLeft="24dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="Color Selector" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:background="#1E88E5" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="72dp" >
<com.gc.materialdesign.views.ButtonFlat
android:id="@+id/buttonColorSelector"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="Show Color Selector" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
================================================
FILE: MaterialDesignLibrary/MaterialDesignDemo/src/main/res/values/strings.xml
================================================
<resources>
<string name="app_name">MaterialDesignDemo</string>
</resources>
================================================
FILE: MaterialDesignLibrary/MaterialDesignDemo/src/main/res/values/styles.xml
================================================
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
</resources>
================================================
FILE: MaterialDesignLibrary/build.gradle
================================================
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.+'
// COMMENT TO DEVELOPER MODE / UNCOMMENT TO UPLOAD TO BINTARRAY
// classpath 'org.codehaus.groovy:groovy-backports-compat23:2.3.5'
// classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
// classpath 'com.github.dcendents:android-maven-plugin:1.2'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
group = "com.github.navasmdc"
version = "1.5"
}
================================================
FILE: MaterialDesignLibrary/gradle/wrapper/gradle-wrapper.properties
================================================
#Sat Aug 22 18:02:59 CEST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
================================================
FILE: MaterialDesignLibrary/gradle.properties
================================================
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Settings specified in this file will override any Gradle settings
# configured through the IDE.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
VERSION_NAME=1.4
VERSION_CODE=6
GROUP=com.github.navasmdc
POM_DESCRIPTION=This is a library with components of Android L to you use in android 2.2
POM_URL=https://github.com/navasmdc/MaterialDesignLibrary
POM_SCM_URL=https://github.com/navasmdc/MaterialDesignLibrary
POM_SCM_CONNECTION=scm:git@github.com:navasmdc/MaterialDesignLibrary.git
POM_SCM_DEV_CONNECTION=scm:git@github.com:navasmdc/MaterialDesignLibrary.git
POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=navasmdc
POM_DEVELOPER_NAME=Ivan Navas
================================================
FILE: MaterialDesignLibrary/gradlew
================================================
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
================================================
FILE: MaterialDesignLibrary/gradlew.bat
================================================
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
================================================
FILE: MaterialDesignLibrary/settings.gradle
================================================
// DEVELOPER MODE
include ':MaterialDesignDemo', ':MaterialDesign'
// UPLOAd LIBRARY TO BINTARRAY
//include ':MaterialDesign'
================================================
FILE: README.md
================================================

# Material Design Android Library
<a href="https://play.google.com/store/apps/details?id=com.gc.demomaterialdesign">
<img alt="Android app on Google Play" src="https://developer.android.com/images/brand/en_app_rgb_wo_45.png" />
</a>
[
FILE: MaterialDesignLibrary/MaterialDesign/src/androidTest/java/com/gc/materialdesign/ApplicationTest.java
class ApplicationTest (line 9) | public class ApplicationTest extends ApplicationTestCase<Application> {
method ApplicationTest (line 10) | public ApplicationTest() {
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/utils/Utils.java
class Utils (line 7) | public class Utils {
method dpToPx (line 13) | public static int dpToPx(float dp, Resources resources){
method getRelativeTop (line 18) | public static int getRelativeTop(View myView) {
method getRelativeLeft (line 26) | public static int getRelativeLeft(View myView) {
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/AutoHideButtonFloat.java
class AutoHideButtonFloat (line 16) | public class AutoHideButtonFloat extends ButtonFloat implements AbsListV...
method AutoHideButtonFloat (line 23) | public AutoHideButtonFloat(Context context, AttributeSet attrs) {
method setOnScrollListener (line 27) | public void setOnScrollListener(AbsListView.OnScrollListener onScrollL...
method setListView (line 31) | public void setListView(ListView listView) {
method onScrollStateChanged (line 36) | @Override
method onScroll (line 49) | @Override
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/Button.java
class Button (line 19) | public abstract class Button extends CustomView {
method Button (line 35) | public Button(Context context, AttributeSet attrs) {
method setDefaultProperties (line 46) | protected void setDefaultProperties() {
method setAttributes (line 56) | abstract protected void setAttributes(AttributeSet attrs);
method onTouchEvent (line 63) | @Override
method onFocusChanged (line 103) | @Override
method onInterceptTouchEvent (line 112) | @Override
method makeCircle (line 118) | public Bitmap makeCircle() {
method makePressColor (line 145) | protected int makePressColor() {
method setOnClickListener (line 155) | @Override
method setBackgroundColor (line 161) | public void setBackgroundColor(int color) {
method setRippleSpeed (line 176) | public void setRippleSpeed(float rippleSpeed) {
method getRippleSpeed (line 180) | public float getRippleSpeed() {
method setText (line 184) | public void setText(String text) {
method setTextColor (line 188) | public void setTextColor(int color) {
method getTextView (line 192) | public TextView getTextView() {
method getText (line 196) | public String getText() {
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonFlat.java
class ButtonFlat (line 15) | public class ButtonFlat extends Button {
method ButtonFlat (line 19) | public ButtonFlat(Context context, AttributeSet attrs) {
method setDefaultProperties (line 24) | protected void setDefaultProperties(){
method setAttributes (line 34) | @Override
method onDraw (line 67) | @Override
method makePressColor (line 94) | @Override
method setText (line 99) | public void setText(String text){
method setBackgroundColor (line 104) | public void setBackgroundColor(int color){
method getTextView (line 111) | @Override
method getText (line 116) | public String getText(){
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonFloat.java
class ButtonFloat (line 29) | public class ButtonFloat extends Button{
method ButtonFloat (line 45) | public ButtonFloat(Context context, AttributeSet attrs) {
method setDefaultProperties (line 64) | protected void setDefaultProperties(){
method setAttributes (line 75) | protected void setAttributes(AttributeSet attrs){
method onDraw (line 124) | @Override
method getIcon (line 138) | public ImageView getIcon() {
method setIcon (line 142) | public void setIcon(ImageView icon) {
method getDrawableIcon (line 146) | public Drawable getDrawableIcon() {
method setDrawableIcon (line 150) | public void setDrawableIcon(Drawable drawableIcon) {
method cropCircle (line 159) | public Bitmap cropCircle(Bitmap bitmap) {
method getTextView (line 178) | @Override
method setRippleColor (line 183) | public void setRippleColor(int rippleColor) {
method show (line 187) | public void show(){
method hide (line 195) | public void hide(){
method isShow (line 205) | public boolean isShow(){
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonFloatSmall.java
class ButtonFloatSmall (line 10) | public class ButtonFloatSmall extends ButtonFloat {
method ButtonFloatSmall (line 12) | public ButtonFloatSmall(Context context, AttributeSet attrs) {
method setDefaultProperties (line 22) | protected void setDefaultProperties(){
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonIcon.java
class ButtonIcon (line 14) | public class ButtonIcon extends ButtonFloat {
method ButtonIcon (line 16) | public ButtonIcon(Context context, AttributeSet attrs) {
method onTouchEvent (line 27) | @Override
method onDraw (line 37) | @Override
method makePressColor (line 57) | @Override
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonRectangle.java
class ButtonRectangle (line 16) | public class ButtonRectangle extends Button {
method ButtonRectangle (line 23) | public ButtonRectangle(Context context, AttributeSet attrs) {
method setDefaultProperties (line 27) | @Override
method setAttributes (line 41) | protected void setAttributes(AttributeSet attrs){
method onDraw (line 137) | @Override
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/Card.java
class Card (line 27) | public class Card extends CustomView {
method Card (line 34) | public Card(Context context, AttributeSet attrs) {
method setAttributes (line 41) | protected void setAttributes(AttributeSet attrs){
method setBackgroundColor (line 60) | public void setBackgroundColor(int color){
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/CheckBox.java
class CheckBox (line 21) | public class CheckBox extends CustomView {
method CheckBox (line 32) | public CheckBox(Context context, AttributeSet attrs) {
method setAttributes (line 38) | protected void setAttributes(AttributeSet attrs) {
method invalidate (line 107) | @Override
method onTouchEvent (line 114) | @Override
method onDraw (line 143) | @Override
method changeBackgroundColor (line 157) | private void changeBackgroundColor(int color) {
method makePressColor (line 169) | protected int makePressColor() {
method setBackgroundColor (line 179) | @Override
method setChecked (line 187) | public void setChecked(boolean check) {
method isCheck (line 201) | public boolean isCheck() {
class Check (line 209) | class Check extends View {
method Check (line 213) | public Check(Context context) {
method changeBackground (line 220) | public void changeBackground() {
method onDraw (line 232) | @Override
method setOncheckListener (line 259) | public void setOncheckListener(OnCheckListener onCheckListener) {
type OnCheckListener (line 263) | public interface OnCheckListener {
method onCheck (line 264) | public void onCheck(CheckBox view, boolean check);
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/CustomView.java
class CustomView (line 9) | public class CustomView extends RelativeLayout{
method CustomView (line 21) | public CustomView(Context context, AttributeSet attrs) {
method setEnabled (line 25) | @Override
method onAnimationStart (line 37) | @Override
method onAnimationEnd (line 43) | @Override
method onDraw (line 49) | @Override
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/LayoutRipple.java
class LayoutRipple (line 13) | public class LayoutRipple extends CustomView {
method LayoutRipple (line 26) | public LayoutRipple(Context context, AttributeSet attrs) {
method setAttributes (line 32) | protected void setAttributes(AttributeSet attrs) {
method setBackgroundColor (line 68) | public void setBackgroundColor(int color) {
method setRippleSpeed (line 75) | public void setRippleSpeed(int rippleSpeed) {
method onTouchEvent (line 84) | @Override
method onFocusChanged (line 121) | @Override
method onInterceptTouchEvent (line 130) | @Override
method makeCircle (line 136) | public Bitmap makeCircle() {
method onDraw (line 161) | protected void onDraw(Canvas canvas) {
method makePressColor (line 176) | protected int makePressColor() {
method setOnClickListener (line 186) | @Override
method setRippleColor (line 191) | public void setRippleColor(int rippleColor) {
method setxRippleOrigin (line 195) | public void setxRippleOrigin(Float xRippleOrigin) {
method setyRippleOrigin (line 199) | public void setyRippleOrigin(Float yRippleOrigin) {
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ProgressBarCircularIndeterminate.java
class ProgressBarCircularIndeterminate (line 15) | public class ProgressBarCircularIndeterminate extends CustomView {
method ProgressBarCircularIndeterminate (line 23) | public ProgressBarCircularIndeterminate(Context context, AttributeSet ...
method setAttributes (line 30) | protected void setAttributes(AttributeSet attrs){
method makePressColor (line 58) | protected int makePressColor(){
method onDraw (line 69) | @Override
method drawFirstAnimation (line 88) | private void drawFirstAnimation(Canvas canvas){
method drawSecondAnimation (line 128) | private void drawSecondAnimation(Canvas canvas){
method setBackgroundColor (line 164) | public void setBackgroundColor(int color){
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ProgressBarDeterminate.java
class ProgressBarDeterminate (line 16) | public class ProgressBarDeterminate extends CustomView {
method ProgressBarDeterminate (line 27) | public ProgressBarDeterminate(Context context, AttributeSet attrs) {
method setAttributes (line 33) | protected void setAttributes(AttributeSet attrs){
method makePressColor (line 77) | protected int makePressColor(){
method onDraw (line 86) | @Override
method setMax (line 93) | public void setMax(int max){
method setMin (line 97) | public void setMin(int min){
method setProgress (line 102) | public void setProgress(int progress){
method getProgress (line 122) | public int getProgress(){
method setBackgroundColor (line 127) | public void setBackgroundColor(int color){
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ProgressBarIndeterminate.java
class ProgressBarIndeterminate (line 14) | public class ProgressBarIndeterminate extends ProgressBarDeterminate {
method ProgressBarIndeterminate (line 16) | public ProgressBarIndeterminate(Context context, AttributeSet attrs) {
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ProgressBarIndeterminateDeterminate.java
class ProgressBarIndeterminateDeterminate (line 11) | public class ProgressBarIndeterminateDeterminate extends ProgressBarDete...
method ProgressBarIndeterminateDeterminate (line 19) | public ProgressBarIndeterminateDeterminate(Context context, AttributeS...
method setProgress (line 60) | @Override
method stopIndeterminate (line 73) | private void stopIndeterminate(){
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ScrollView.java
class ScrollView (line 10) | public class ScrollView extends android.widget.ScrollView {
method ScrollView (line 17) | public ScrollView(Context context, AttributeSet attrs) {
method onTouchEvent (line 21) | @Override
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/Slider.java
class Slider (line 26) | public class Slider extends CustomView {
method Slider (line 40) | public Slider(Context context, AttributeSet attrs) {
method getMax (line 45) | public int getMax() {
method setMax (line 49) | public void setMax(int max) {
method getMin (line 53) | public int getMin() {
method setMin (line 57) | public void setMin(int min) {
method getOnValueChangedListener (line 61) | public OnValueChangedListener getOnValueChangedListener() {
method setOnValueChangedListener (line 65) | public void setOnValueChangedListener(
method getValue (line 72) | public int getValue() {
method setValue (line 76) | public void setValue(final int value) {
method invalidate (line 95) | @Override
method isShowNumberIndicator (line 101) | public boolean isShowNumberIndicator() {
method setShowNumberIndicator (line 105) | public void setShowNumberIndicator(boolean showNumberIndicator) {
method onTouchEvent (line 111) | @Override
method setBackgroundColor (line 173) | @Override
method makePressColor (line 185) | protected int makePressColor() {
method onDraw (line 195) | @Override
method setAttributes (line 252) | protected void setAttributes(AttributeSet attrs) {
method placeBall (line 294) | private void placeBall() {
type OnValueChangedListener (line 303) | public interface OnValueChangedListener {
method onValueChanged (line 304) | public void onValueChanged(int value);
class Ball (line 307) | class Ball extends View {
method Ball (line 311) | public Ball(Context context) {
method changeBackground (line 316) | public void changeBackground() {
class Indicator (line 332) | class Indicator extends RelativeLayout {
method Indicator (line 346) | public Indicator(Context context) {
method onDraw (line 352) | @Override
class NumberIndicator (line 395) | class NumberIndicator extends Dialog {
method NumberIndicator (line 400) | public NumberIndicator(Context context) {
method dismiss (line 404) | @Override
method onBackPressed (line 412) | @Override
method onCreate (line 416) | @Override
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/Switch.java
class Switch (line 22) | public class Switch extends CustomView {
method Switch (line 35) | public Switch(Context context, AttributeSet attrs) {
method setAttributes (line 51) | protected void setAttributes(AttributeSet attrs) {
method onTouchEvent (line 84) | @Override
method onDraw (line 122) | @Override
method makePressColor (line 168) | protected int makePressColor() {
method placeBall (line 181) | private void placeBall() {
method setBackgroundColor (line 192) | @Override
method setChecked (line 200) | public void setChecked(boolean check) {
method isCheck (line 207) | public boolean isCheck() {
class Ball (line 211) | class Ball extends View {
method Ball (line 215) | public Ball(Context context) {
method changeBackground (line 220) | public void changeBackground() {
method animateCheck (line 232) | public void animateCheck() {
method setOncheckListener (line 247) | public void setOncheckListener(OnCheckListener onCheckListener) {
type OnCheckListener (line 251) | public interface OnCheckListener {
method onCheck (line 252) | public void onCheck(Switch view, boolean check);
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/widgets/ColorSelector.java
class ColorSelector (line 22) | public class ColorSelector extends android.app.Dialog implements OnValue...
method ColorSelector (line 33) | public ColorSelector(Context context,Integer color, OnColorSelectedLis...
method onCreate (line 51) | @Override
method show (line 103) | @Override
method onValueChanged (line 110) | @Override
type OnColorSelectedListener (line 118) | public interface OnColorSelectedListener{
method onColorSelected (line 119) | public void onColorSelected(int color);
method dismiss (line 122) | @Override
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/widgets/Dialog.java
class Dialog (line 18) | public class Dialog extends android.app.Dialog{
method Dialog (line 37) | public Dialog(Context context,String title, String message) {
method addCancelButton (line 44) | public void addCancelButton(String buttonCancelText){
method addCancelButton (line 48) | public void addCancelButton(String buttonCancelText, View.OnClickListe...
method onCreate (line 54) | @Override
method show (line 108) | @Override
method getMessage (line 119) | public String getMessage() {
method setMessage (line 123) | public void setMessage(String message) {
method getMessageTextView (line 128) | public TextView getMessageTextView() {
method setMessageTextView (line 132) | public void setMessageTextView(TextView messageTextView) {
method getTitle (line 136) | public String getTitle() {
method setTitle (line 140) | public void setTitle(String title) {
method getTitleTextView (line 150) | public TextView getTitleTextView() {
method setTitleTextView (line 154) | public void setTitleTextView(TextView titleTextView) {
method getButtonAccept (line 158) | public ButtonFlat getButtonAccept() {
method setButtonAccept (line 162) | public void setButtonAccept(ButtonFlat buttonAccept) {
method getButtonCancel (line 166) | public ButtonFlat getButtonCancel() {
method setButtonCancel (line 170) | public void setButtonCancel(ButtonFlat buttonCancel) {
method setOnAcceptButtonClickListener (line 174) | public void setOnAcceptButtonClickListener(
method setOnCancelButtonClickListener (line 181) | public void setOnCancelButtonClickListener(
method dismiss (line 188) | @Override
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/widgets/ProgressDialog.java
class ProgressDialog (line 19) | public class ProgressDialog extends android.app.Dialog{
method ProgressDialog (line 29) | public ProgressDialog(Context context,String title) {
method ProgressDialog (line 35) | public ProgressDialog(Context context,String title, int progressColor) {
method onCreate (line 42) | @Override
method show (line 74) | @Override
method getTitle (line 85) | public String getTitle() {
method setTitle (line 89) | public void setTitle(String title) {
method getTitleTextView (line 99) | public TextView getTitleTextView() {
method setTitleTextView (line 103) | public void setTitleTextView(TextView titleTextView) {
method dismiss (line 107) | @Override
FILE: MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/widgets/SnackBar.java
class SnackBar (line 21) | public class SnackBar extends Dialog{
method SnackBar (line 39) | public SnackBar(Activity activity, String text, String buttonText, Vie...
method SnackBar (line 48) | public SnackBar(Activity activity, String text) {
method onCreate (line 54) | @Override
method onTouchEvent (line 82) | @Override
method onBackPressed (line 87) | @Override
method show (line 91) | @Override
method run (line 104) | @Override
method handleMessage (line 117) | @Override
method dismiss (line 130) | @Override
method onKeyDown (line 151) | @Override
method setMessageTextSize (line 160) | public void setMessageTextSize(float size) {
method setIndeterminate (line 164) | public void setIndeterminate(boolean indeterminate) {
method isIndeterminate (line 168) | public boolean isIndeterminate() {
method setDismissTimer (line 172) | public void setDismissTimer(int time) {
method getDismissTimer (line 176) | public int getDismissTimer() {
method setBackgroundSnackBar (line 184) | public void setBackgroundSnackBar(int color){
method setColorButton (line 194) | public void setColorButton(int color){
type OnHideListener (line 205) | public interface OnHideListener{
method onHide (line 206) | public void onHide();
method setOnhideListener (line 209) | public void setOnhideListener(OnHideListener onHideListener){
FILE: MaterialDesignLibrary/MaterialDesignDemo/src/androidTest/java/com/gc/materialdesigndemo/ApplicationTest.java
class ApplicationTest (line 9) | public class ApplicationTest extends ApplicationTestCase<Application> {
method ApplicationTest (line 10) | public ApplicationTest() {
FILE: MaterialDesignLibrary/MaterialDesignDemo/src/main/java/com/gc/materialdesigndemo/ui/ButtonsActivity.java
class ButtonsActivity (line 13) | public class ButtonsActivity extends Activity {
method onCreate (line 17) | @SuppressLint("NewApi")
FILE: MaterialDesignLibrary/MaterialDesignDemo/src/main/java/com/gc/materialdesigndemo/ui/MainActivity.java
class MainActivity (line 22) | public class MainActivity extends Activity implements OnColorSelectedLis...
method onCreate (line 27) | @SuppressLint("NewApi")
method setOriginRiple (line 102) | private void setOriginRiple(final LayoutRipple layoutRipple){
method onColorSelected (line 120) | @Override
FILE: MaterialDesignLibrary/MaterialDesignDemo/src/main/java/com/gc/materialdesigndemo/ui/ProgressActivity.java
class ProgressActivity (line 16) | public class ProgressActivity extends Activity {
method onCreate (line 20) | @SuppressLint("NewApi")
method run (line 48) | @Override
method handleMessage (line 63) | @Override
method run (line 74) | @Override
method handleMessage (line 92) | @Override
FILE: MaterialDesignLibrary/MaterialDesignDemo/src/main/java/com/gc/materialdesigndemo/ui/SwitchActivity.java
class SwitchActivity (line 14) | public class SwitchActivity extends Activity {
method onCreate (line 18) | @SuppressLint("NewApi")
FILE: MaterialDesignLibrary/MaterialDesignDemo/src/main/java/com/gc/materialdesigndemo/ui/WidgetActivity.java
class WidgetActivity (line 18) | public class WidgetActivity extends Activity {
method onCreate (line 22) | @SuppressLint("NewApi")
Condensed preview — 91 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (286K chars).
[
{
"path": ".gitignore",
"chars": 302,
"preview": "# Built application files\n*.apk\n*.ap_\n\n# Files for the Dalvik VM\n*.dex\n\n# Java class files\n*.class\n\n# Generated files\nbi"
},
{
"path": "LICENSE",
"chars": 11325,
"preview": "Apache License\n Version 2.0, January 2004\n http://www.apache.org/licens"
},
{
"path": "MaterialDesignLibrary/.gitignore",
"chars": 91,
"preview": ".gradle\n/local.properties\n/.idea/workspace.xml\n/.idea/libraries\n.DS_Store\n/build\n/captures\n"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/.gitignore",
"chars": 7,
"preview": "/build\n"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/build.gradle",
"chars": 3046,
"preview": "apply plugin: 'com.android.library'\n// COMMENT TO DEVELOPER MODE / UNCOMMENT TO UPLOAD TO BINTARRAY\n//apply plugin: 'com"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/gradle.properties",
"chars": 90,
"preview": "POM_NAME=MaterialDesignLibrary\nPOM_ARTIFACT_ID=material-design-library\nPOM_PACKAGING=aar\n\n"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/proguard-rules.pro",
"chars": 679,
"preview": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /A"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/androidTest/java/com/gc/materialdesign/ApplicationTest.java",
"chars": 352,
"preview": "package com.gc.materialdesign;\n\nimport android.app.Application;\nimport android.test.ApplicationTestCase;\n\n/**\n * <a href"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/AndroidManifest.xml",
"chars": 218,
"preview": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n package=\"com.gc.materialdesign\">\n\n <applicat"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/utils/Utils.java",
"chars": 922,
"preview": "package com.gc.materialdesign.utils;\n\nimport android.content.res.Resources;\nimport android.util.TypedValue;\nimport andro"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/AutoHideButtonFloat.java",
"chars": 2573,
"preview": "package com.gc.materialdesign.views;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\nimport android.v"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/Button.java",
"chars": 5119,
"preview": "package com.gc.materialdesign.views;\n\nimport com.gc.materialdesign.R;\nimport com.gc.materialdesign.utils.Utils;\n\nimport "
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonFlat.java",
"chars": 3095,
"preview": "package com.gc.materialdesign.views;\n\nimport com.gc.materialdesign.R;\nimport com.gc.materialdesign.utils.Utils;\n\nimport "
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonFloat.java",
"chars": 6005,
"preview": "package com.gc.materialdesign.views;\n\nimport com.gc.materialdesign.R;\nimport com.gc.materialdesign.utils.Utils;\nimport c"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonFloatSmall.java",
"chars": 1034,
"preview": "package com.gc.materialdesign.views;\n\nimport com.gc.materialdesign.R;\nimport com.gc.materialdesign.utils.Utils;\n\nimport "
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonIcon.java",
"chars": 1572,
"preview": "package com.gc.materialdesign.views;\n\nimport com.gc.materialdesign.utils.Utils;\n\nimport android.R;\nimport android.conten"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ButtonRectangle.java",
"chars": 5658,
"preview": "package com.gc.materialdesign.views;\n\nimport com.gc.materialdesign.R;\nimport com.gc.materialdesign.utils.Utils;\n\nimport "
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/Card.java",
"chars": 2088,
"preview": "package com.gc.materialdesign.views;\n\nimport com.gc.materialdesign.R;\nimport com.gc.materialdesign.utils.Utils;\n\nimport "
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/CheckBox.java",
"chars": 7208,
"preview": "package com.gc.materialdesign.views;\n\nimport com.gc.materialdesign.R;\nimport com.gc.materialdesign.utils.Utils;\n\nimport "
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/CustomView.java",
"chars": 1250,
"preview": "package com.gc.materialdesign.views;\n\nimport android.content.Context;\nimport android.graphics.Canvas;\nimport android.gra"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/LayoutRipple.java",
"chars": 5183,
"preview": "package com.gc.materialdesign.views;\n\nimport android.content.Context;\nimport android.graphics.Bitmap;\nimport android.gra"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ProgressBarCircularIndeterminate.java",
"chars": 5156,
"preview": "package com.gc.materialdesign.views;\n\nimport com.gc.materialdesign.utils.Utils;\n\nimport android.content.Context;\nimport "
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ProgressBarDeterminate.java",
"chars": 3684,
"preview": "package com.gc.materialdesign.views;\n\nimport com.gc.materialdesign.R;\nimport com.gc.materialdesign.utils.Utils;\n\nimport "
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ProgressBarIndeterminate.java",
"chars": 1901,
"preview": "package com.gc.materialdesign.views;\n\nimport com.gc.materialdesign.R;\nimport com.nineoldandroids.animation.Animator;\nimp"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ProgressBarIndeterminateDeterminate.java",
"chars": 2083,
"preview": "package com.gc.materialdesign.views;\n\nimport com.nineoldandroids.animation.Animator;\nimport com.nineoldandroids.animatio"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/ScrollView.java",
"chars": 929,
"preview": "package com.gc.materialdesign.views;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\nimport android.v"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/Slider.java",
"chars": 15145,
"preview": "package com.gc.materialdesign.views;\n\nimport android.app.Dialog;\nimport android.content.Context;\nimport android.graphics"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/views/Switch.java",
"chars": 7168,
"preview": "package com.gc.materialdesign.views;\n\nimport android.content.Context;\nimport android.graphics.Bitmap;\nimport android.gra"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/widgets/ColorSelector.java",
"chars": 4327,
"preview": "package com.gc.materialdesign.widgets;\n\nimport com.gc.materialdesign.R;\nimport com.gc.materialdesign.views.Slider;\nimpor"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/widgets/Dialog.java",
"chars": 5728,
"preview": "package com.gc.materialdesign.widgets;\n\nimport android.content.Context;\nimport android.os.Bundle;\nimport android.view.Mo"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/widgets/ProgressDialog.java",
"chars": 3683,
"preview": "package com.gc.materialdesign.widgets;\n\nimport android.content.Context;\nimport android.os.Bundle;\nimport android.view.Mo"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/java/com/gc/materialdesign/widgets/SnackBar.java",
"chars": 5002,
"preview": "package com.gc.materialdesign.widgets;\n\nimport android.app.Activity;\nimport android.app.Dialog;\nimport android.graphics."
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/res/anim/dialog_main_hide_amination.xml",
"chars": 591,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?> \n<set xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:int"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/res/anim/dialog_main_show_amination.xml",
"chars": 451,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<set xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n <alpha\n "
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/res/anim/dialog_root_hide_amin.xml",
"chars": 356,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?> \n<set xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android:int"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/res/anim/dialog_root_show_amin.xml",
"chars": 231,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?> \n<set xmlns:android=\"http://schemas.android.com/apk/res/android\"> \n <alpha "
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/res/anim/progress_indeterminate_animation.xml",
"chars": 700,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<set xmlns:android=\"http://schemas.android.com/apk/res/android\">\n<!-- <transl"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/res/anim/snackbar_hide_animation.xml",
"chars": 208,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<translate xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/res/anim/snackbar_show_animation.xml",
"chars": 208,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<translate xmlns:android=\"http://schemas.android.com/apk/res/android\"\n android"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/background_button_float.xml",
"chars": 476,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\" >\n\n <it"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/background_button_rectangle.xml",
"chars": 403,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\" >\n\n <it"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/background_checkbox.xml",
"chars": 323,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\" >\n <ite"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/background_checkbox_check.xml",
"chars": 341,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\" >\n <ite"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/background_checkbox_uncheck.xml",
"chars": 426,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\" >\n <ite"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/background_progress.xml",
"chars": 378,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\" >\n <ite"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/background_switch_ball_uncheck.xml",
"chars": 376,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\" >\n <ite"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/background_transparent.xml",
"chars": 338,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\" >\n\n <it"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/shadow_down.xml",
"chars": 375,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape xmlns:android=\"http://schemas.android.com/apk/res/android\" >\n<corners \n "
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/res/drawable/shadow_right.xml",
"chars": 390,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape xmlns:android=\"http://schemas.android.com/apk/res/android\" >\n \n <cor"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/res/layout/color_selector.xml",
"chars": 4179,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xm"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/res/layout/dialog.xml",
"chars": 2991,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n an"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/res/layout/number_indicator_spinner.xml",
"chars": 252,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n an"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/res/layout/progress_dialog.xml",
"chars": 1400,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n an"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/res/layout/snackbar.xml",
"chars": 1580,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n an"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/res/values/attributes.xml",
"chars": 1781,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n <declare-styleable name=\"CustomAttributes\">\n\n <!-- Color "
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/res/values/colors.xml",
"chars": 151,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <color name=\"green\">#00FF00</color>\n <color name=\"thumbColor\">"
},
{
"path": "MaterialDesignLibrary/MaterialDesign/src/main/res/values/strings.xml",
"chars": 77,
"preview": "<resources>\n <string name=\"app_name\">MaterialDesign</string>\n</resources>\n"
},
{
"path": "MaterialDesignLibrary/MaterialDesignDemo/.gitignore",
"chars": 7,
"preview": "/build\n"
},
{
"path": "MaterialDesignLibrary/MaterialDesignDemo/build.gradle",
"chars": 630,
"preview": "apply plugin: 'com.android.application'\n\nandroid {\n compileSdkVersion 22\n buildToolsVersion \"22.0.1\"\n\n defaultC"
},
{
"path": "MaterialDesignLibrary/MaterialDesignDemo/proguard-rules.pro",
"chars": 679,
"preview": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /A"
},
{
"path": "MaterialDesignLibrary/MaterialDesignDemo/src/androidTest/java/com/gc/materialdesigndemo/ApplicationTest.java",
"chars": 356,
"preview": "package com.gc.materialdesigndemo;\n\nimport android.app.Application;\nimport android.test.ApplicationTestCase;\n\n/**\n * <a "
},
{
"path": "MaterialDesignLibrary/MaterialDesignDemo/src/main/AndroidManifest.xml",
"chars": 1528,
"preview": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n package=\"com.gc.materialdesigndemo\">\n\n <appl"
},
{
"path": "MaterialDesignLibrary/MaterialDesignDemo/src/main/java/com/gc/materialdesigndemo/ui/ButtonsActivity.java",
"chars": 995,
"preview": "package com.gc.materialdesigndemo.ui;\n\nimport android.annotation.SuppressLint;\nimport android.app.Activity;\nimport andro"
},
{
"path": "MaterialDesignLibrary/MaterialDesignDemo/src/main/java/com/gc/materialdesigndemo/ui/MainActivity.java",
"chars": 3901,
"preview": "package com.gc.materialdesigndemo.ui;\n\nimport com.gc.materialdesign.views.ButtonFloatSmall;\nimport com.gc.materialdesign"
},
{
"path": "MaterialDesignLibrary/MaterialDesignDemo/src/main/java/com/gc/materialdesigndemo/ui/ProgressActivity.java",
"chars": 2809,
"preview": "package com.gc.materialdesigndemo.ui;\n\nimport android.annotation.SuppressLint;\nimport android.app.Activity;\nimport andro"
},
{
"path": "MaterialDesignLibrary/MaterialDesignDemo/src/main/java/com/gc/materialdesigndemo/ui/SwitchActivity.java",
"chars": 795,
"preview": "package com.gc.materialdesigndemo.ui;\n\nimport android.annotation.SuppressLint;\nimport android.app.Activity;\nimport andro"
},
{
"path": "MaterialDesignLibrary/MaterialDesignDemo/src/main/java/com/gc/materialdesigndemo/ui/WidgetActivity.java",
"chars": 2430,
"preview": "package com.gc.materialdesigndemo.ui;\n\nimport com.gc.materialdesign.views.ButtonFlat;\nimport com.gc.materialdesign.widge"
},
{
"path": "MaterialDesignLibrary/MaterialDesignDemo/src/main/res/drawable/blue_background.xml",
"chars": 178,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape xmlns:android=\"http://schemas.android.com/apk/res/android\" android:shape=\""
},
{
"path": "MaterialDesignLibrary/MaterialDesignDemo/src/main/res/drawable/selector_list.xml",
"chars": 315,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<selector xmlns:android=\"http://schemas.android.com/apk/res/android\" >\n <item "
},
{
"path": "MaterialDesignLibrary/MaterialDesignDemo/src/main/res/drawable/transparent_backgrouns.xml",
"chars": 181,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<shape xmlns:android=\"http://schemas.android.com/apk/res/android\" android:shape=\""
},
{
"path": "MaterialDesignLibrary/MaterialDesignDemo/src/main/res/layout/activity_buttons.xml",
"chars": 6539,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xm"
},
{
"path": "MaterialDesignLibrary/MaterialDesignDemo/src/main/res/layout/activity_main.xml",
"chars": 5332,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xmln"
},
{
"path": "MaterialDesignLibrary/MaterialDesignDemo/src/main/res/layout/activity_progress.xml",
"chars": 7608,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xm"
},
{
"path": "MaterialDesignLibrary/MaterialDesignDemo/src/main/res/layout/activity_switchs.xml",
"chars": 3773,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xm"
},
{
"path": "MaterialDesignLibrary/MaterialDesignDemo/src/main/res/layout/activity_widgets.xml",
"chars": 3723,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xm"
},
{
"path": "MaterialDesignLibrary/MaterialDesignDemo/src/main/res/values/strings.xml",
"chars": 83,
"preview": "<resources>\n\n <string name=\"app_name\">MaterialDesignDemo</string>\n\n</resources>\n"
},
{
"path": "MaterialDesignLibrary/MaterialDesignDemo/src/main/res/values/styles.xml",
"chars": 680,
"preview": "<resources>\n\n <!--\n Base application theme, dependent on API level. This theme is replaced\n by AppBaseT"
},
{
"path": "MaterialDesignLibrary/build.gradle",
"chars": 658,
"preview": "// Top-level build file where you can add configuration options common to all sub-projects/modules.\n\nbuildscript {\n r"
},
{
"path": "MaterialDesignLibrary/gradle/wrapper/gradle-wrapper.properties",
"chars": 231,
"preview": "#Sat Aug 22 18:02:59 CEST 2015\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER"
},
{
"path": "MaterialDesignLibrary/gradle.properties",
"chars": 1474,
"preview": "# Project-wide Gradle settings.\n\n# IDE (e.g. Android Studio) users:\n# Settings specified in this file will override any "
},
{
"path": "MaterialDesignLibrary/gradlew",
"chars": 5080,
"preview": "#!/usr/bin/env bash\n\n##############################################################################\n##\n## Gradle start "
},
{
"path": "MaterialDesignLibrary/gradlew.bat",
"chars": 2314,
"preview": "@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem "
},
{
"path": "MaterialDesignLibrary/settings.gradle",
"chars": 126,
"preview": "// DEVELOPER MODE\ninclude ':MaterialDesignDemo', ':MaterialDesign'\n// UPLOAd LIBRARY TO BINTARRAY\n//include ':MaterialDe"
},
{
"path": "README.md",
"chars": 9651,
"preview": "\n\n# Material Design Android Library\n\n<a href=\"https://play.google.com/st"
},
{
"path": "index.html",
"chars": 31021,
"preview": "<!DOCTYPE html>\n<html>\n <head>\n <meta charset='utf-8'>\n <meta http-equiv=\"X-UA-Compatible\" content=\"chrome=1\">\n "
},
{
"path": "javascripts/main.js",
"chars": 48,
"preview": "console.log('This would be the main JS file.');\n"
},
{
"path": "params.json",
"chars": 10946,
"preview": "{\n \"name\": \"Materialdesignlibrary\",\n \"tagline\": \"This is a library with components of Android L to you use in android "
},
{
"path": "stylesheets/github-light.css",
"chars": 3133,
"preview": "/*\nThe MIT License (MIT)\n\nCopyright (c) 2016 GitHub, Inc.\n\nPermission is hereby granted, free of charge, to any person o"
},
{
"path": "stylesheets/print.css",
"chars": 3277,
"preview": "html, body, div, span, applet, object, iframe,\nh1, h2, h3, h4, h5, h6, p, blockquote, pre,\na, abbr, acronym, address, bi"
},
{
"path": "stylesheets/stylesheet.css",
"chars": 15746,
"preview": "/*! normalize.css v3.0.2 | MIT License | git.io/normalize */\n\n/**\n * 1. Set default font family to sans-serif.\n * 2. Pre"
}
]
// ... and 1 more files (download for full content)
About this extraction
This page contains the full source code of the navasmdc/MaterialDesignLibrary GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 91 files (251.8 KB), approximately 66.5k tokens, and a symbol index with 264 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.