Repository: rafakob/DrawMe
Branch: master
Commit: 77b4ef95d0a9
Files: 37
Total size: 83.9 KB
Directory structure:
gitextract_d4pkzbxf/
├── .gitignore
├── LICENSE
├── README.md
├── app/
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── rafakob/
│ │ └── example/
│ │ └── drawme/
│ │ └── MainActivity.java
│ └── res/
│ ├── drawable/
│ │ └── ic_vector_cloud.xml
│ ├── layout/
│ │ └── activity_main.xml
│ └── values/
│ ├── colors.xml
│ ├── strings.xml
│ └── styles.xml
├── build.gradle
├── gradle/
│ └── wrapper/
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── library/
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src/
│ └── main/
│ ├── AndroidManifest.xml
│ ├── java/
│ │ └── com/
│ │ └── rafakob/
│ │ └── drawme/
│ │ ├── DrawMeButton.java
│ │ ├── DrawMeEditText.java
│ │ ├── DrawMeFrameLayout.java
│ │ ├── DrawMeImageButton.java
│ │ ├── DrawMeLinearLayout.java
│ │ ├── DrawMeRelativeLayout.java
│ │ ├── DrawMeTextView.java
│ │ ├── delegate/
│ │ │ ├── DrawMe.java
│ │ │ ├── DrawMeShape.java
│ │ │ └── DrawMeShapeText.java
│ │ └── util/
│ │ ├── Coloring.java
│ │ └── FontCache.java
│ └── res/
│ └── values/
│ └── attrs.xml
└── settings.gradle
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
# Built application files
/*/build/
# Crashlytics configuations
com_crashlytics_export_strings.xml
# Local configuration file (sdk path, etc)
local.properties
# Gradle generated files
.gradle/
# Signing files
.signing/
# User-specific configurations
.idea/libraries/
.idea/workspace.xml
.idea/tasks.xml
.idea/.name
.idea/compiler.xml
.idea/copyright/profiles_settings.xml
.idea/encodings.xml
.idea/misc.xml
.idea/modules.xml
.idea/scopes/scope_settings.xml
.idea/vcs.xml
.idea/*
*.iml
# OS-specific files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
================================================
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: README.md
================================================
[](https://android-arsenal.com/details/1/3355)
[](https://jitpack.io/#rafakob/DrawMe)
# DrawMe #
With **DrawMe** you can easily create views with custom background shapes using only XML layout files. Quick example:
_Standard way:_
```xml
<!--drawable/back.xml-->
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="5dp" />
<solid android:color="@android:color/white" />
<stroke
android:width="3dp"
android:color="@android:color/black" />
</shape>
<!--layout/activity_main.xml-->
<FrameLayout
android:layout_width="100dp"
android:layout_height="100dp"
android:background="@drawable/back.xml"/>
```
**_With DrawMe:_**
```xml
<com.rafakob.drawme.DrawMeFrameLayout
android:layout_width="100dp"
android:layout_height="100dp"
drawme:dm_backColor="@android:color/white"
drawme:dm_strokeColor="@android:color/black"
drawme:dm_radius="5dp"
drawme:dm_stroke="3dp"/>
```
Library also supports different states: **normal**, **pressed**, **disabled**.
It means that you can define different background and stroke colors for each state. The best thing about it is that **DrawMe** is "compatible" with pre and post Lollipop. On API +21 it uses **native** ripple press effect, and below it uses standard StateListDrawable. Here's example:
_Standard way:_
```xml
<!--drawable/custom_button.xml-->
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false">
<shape android:shape="rectangle">
<solid android:color="@color/colorDarkGray"/>
</shape>
</item>
<item android:state_pressed="false">
<shape android:shape="rectangle">
<solid android:color="@color/colorButtonGreen"/>
</shape>
</item>
<item android:state_pressed="true">
<shape android:shape="rectangle">
<solid android:color="@color/colorButtonGreenFocused"/>
</shape>
</item>
</selector>
<!--drawable-v21/custom_button.xml-->
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false">
<shape android:shape="rectangle">
<solid android:color="@color/colorDarkGray"/>
</shape>
</item>
<item android:state_enabled="true">
<ripple
xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/colorButtonGreenFocused">
<item>
<color android:color="@color/colorButtonGreen"/>
</item>
</ripple>
</item>
</selector>
<!--layout/activity_main.xml-->
<Button
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@drawable/custom_button.xml"/>
```
**_With DrawMe:_**
```xml
<com.rafakob.drawme.DrawMeButton
android:layout_width="match_parent"
android:layout_height="50dp"
drawme:dm_backColor="@color/colorButtonGreen"
drawme:dm_backColorPressed="@color/colorButtonGreenFocused"
drawme:dm_backColorDisabled="@color/colorDarkGray"
drawme:dm_shapeRadiusHalfHeight="true"/>
```
**_Result_**
_Pre Lollipop_

_API +21_

## Install ##
Add it in your root build.gradle at the end of repositories:
```java
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
```
Add the dependency:
[](https://jitpack.io/#rafakob/DrawMe)
```java
dependencies {
compile 'com.github.rafakob:DrawMe:VERSION'
}
```
## Features ##
Provided attributes are only accessiable from XML, you can't modify them from JAVA code (at least for now).
I tried to use as many default values as possible, so that user wouldn't have to specify too many attributes and colors. For instance you can define background color only for a normal state - pressed and disabled will be generated.
To fully understand everything just play around with it for a while. No rocket science here :)
[**EXAMPLES**](https://github.com/rafakob/DrawMe/blob/master/app/src/main/res/layout/activity_main.xml)
### Background shape ###
| Attribute | Format | Default | Description |
| :--- | :---: | :---: | :--- |
| `dm_stroke` | dimension | 0 | Stroke width. |
| `dm_radius` | dimension | 0 | Corner radius. |
| `dm_radiusBottomLeft` | dimension | -1 | "-1" means that attribute will be ignored. |
| `dm_radiusBottomRight` | dimension | -1 | as above |
| `dm_radiusTopLeft` | dimension | -1 | as above |
| `dm_radiusTopRight` | dimension | -1 | as above |
| `dm_shapeRadiusHalfHeight` | boolean | false | True - use "full radius", other radius dimensions will be ignored. |
| `dm_shapeEqualWidthHeight` | boolean | false | True - shape will have equal height and width. |
- Set `dm_shapeRadiusHalfHeight` and `dm_shapeEqualWidthHeight` in order to create a circle.
- You can combine `dm_radius` with other radius dimensions, it works just like padding.


### States and ripple ###
| Attribute | Format | Default | Description |
| :--- | :---: | :---: | :--- |
| `dm_rippleEffect` | boolean | true | True - use ripple effect on API +21. False - use standard StateListDrawable on all devices. |
| `dm_rippleUseControlHighlight` | boolean | true | Use theme attribute `R.attr.colorControlHighlight` as a ripple color. It's avaiable only on +21, and it's basically a `1F000000` color. On lower API "mimic" this highlight by mixing background color with a black mask (it should look almost the same as on +21). Matters only when pressed background color hasn't been specified. |
| `dm_statePressed` | boolean | true | True - create pressed state. False - ignore it. |
| `dm_stateDisabled` | boolean | true | True - create disabled state. False - ignore it. |
First button is in normal state. Second is pressed with default ripple highlight. Third one uses custom color as pressed ripple effect:

### Colors ###
| Attribute | Format | Default | Description |
| :--- | :---: | :---: | :--- |
| `dm_backColor` | color | `Color.TRANSPARENT` | Background color - default state. |
| `dm_backColorPressed` | color | Dark highlight (like ripple) | Background color - pressed state. |
| `dm_backColorDisabled` | color | Grayed out `backColor` | Background color - disabled state. |
| `dm_strokeColor` | color | `Color.GRAY` | Stroke color - default state. |
| `dm_strokeColorPressed` | color | Dark highlight (like ripple) | Stroke color - pressed state. |
| `dm_strokeColorDisabled` | color | Grayed out `strokeColor` | Stroke color - disabled state. |
- If you're not gonna define any attribute, view will have transaprent borderless background with pressed state like ripple effect.
- Use `android:stateListAnimator="@null"` to disable default press shadow/elevation on +21.


### Layouts ###
Avaiable layouts:
- `DrawMeFrameLayout`
- `DrawMeLinearLayout`
- `DrawMeRelativeLayout`
- `DrawMeImageButton`
All above attributes can be applied to them.

### TextViews ###
Avaiable views:
- `DrawMeButton`
- `DrawMeTextView`
- `DrawMeEditText`
| Attribute | Format | Default | Description |
| :--- | :---: | :---: | :--- |
| `dm_font` | string | null | Name of a custom font, eg. `Lato-Regular.ttf`.|
| `dm_textColor` | color | System default | Text color - default state. Same as `android:textColor`. |
| `dm_textColorPressed` | color | `textColor` | Text color - pressed state. |
| `dm_textColorDisabled` | color | `textColor` | Text color - disabled state. |
| `dm_drawableTint` | color | none | Equivalent to `android:drawableTint` but it's compatible with preLollipop devices. |
| `dm_drawableTintMode` | enum | none | Equivalent to `android:drawableTintMode` but it's compatible with preLollipop devices. |
- Custom fonts has to be put in `assets/fonts`. Library uses font caching.
- Tintintg is performed using `DrawableCompat.wrap()` method.

### Advanced - mask, adaptive highlight ###
| Attribute | Format | Default |
| :--- | :---: | :---: |
| `dm_maskColorPressed` | color | `#1F00000` |
| `dm_maskColorPressedInverse` | color | `#1DFFFFFF` |
| `dm_maskColorDisabled` | color | `#6DFFFFFF` |
| `dm_maskBrightnessThreshold` | float [0 - 1] | 0 |
By default ripple color is just a blackish shadow over normal state color. I've added an option to adjust that shadow mask. Same applies to disabled color. Just modify `dm_maskColorPressed` and `dm_maskColorDisabled`:

But what when I have a black or very dark buttons? Ripple effect won't be visiable. In that case you have three options:
- leave it as is
- change `dm_maskColorPressed` to a lighter color
- use an adaptive method by modifing `dm_maskBrightnessThreshold`
So how the adaption works?
- Library calculates background color brightness: 0.0 means that background is black, 1.0 means it's white.
- Compare background brightness with `dm_maskBrightnessThreshold`. If it's lower than use `dm_maskColorPressedInverse` instead of `dm_maskColorPressed`.
Example:
- `maskBrightnessThreshold = 0.2`
- Button X has background brightness `0.8` -> use `dm_maskColorPressed` -> ripple will be darker than background color
- Button Y has background brightness `0.1` -> use `dm_maskColorPressedInverse` -> ripple will be lighter than background color

## About ##
> If you find any bugs feel free to report an issue or create a pull request. Suggestions and feature requestes are very welcome.
> Use it wherever and however you want.
## Changelog ##
##### `0.1.6` (2016-04-04):#####
- Support for theme `buttonStyle`.
#####`0.1.5` (2016-04-01):#####
- Added `dm_` prefix for all attributes.
## License ##
```
Copyright 2016 Rafał Kobyłko
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: app/.gitignore
================================================
/build
================================================
FILE: app/build.gradle
================================================
apply plugin: 'com.android.application'
group = 'com.github.rafakob'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.rafakob.example.drawme"
minSdkVersion 10
targetSdkVersion 23
versionCode 1
versionName "1.0.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile project(':library')
}
================================================
FILE: app/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/rafakob/Library/Android/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: app/src/main/AndroidManifest.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.rafakob.example.drawme"
xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="DrawMe"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name="com.rafakob.example.drawme.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
================================================
FILE: app/src/main/java/com/rafakob/example/drawme/MainActivity.java
================================================
package com.rafakob.example.drawme;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById(R.id.transparent_pressed).setPressed(true);
findViewById(R.id.transparent_disabled).setEnabled(false);
findViewById(R.id.colored_pressed1).setPressed(true);
findViewById(R.id.colored_pressed2).setPressed(true);
findViewById(R.id.colored_disabled).setEnabled(false);
findViewById(R.id.rounded_pressed).setPressed(true);
findViewById(R.id.rounded_disabled).setEnabled(false);
findViewById(R.id.ctrl_pressed1).setPressed(true);
findViewById(R.id.ctrl_pressed2).setPressed(true);
findViewById(R.id.mask_def).setPressed(true);
findViewById(R.id.mask_dark).setPressed(true);
findViewById(R.id.mask_light).setPressed(true);
findViewById(R.id.ada1).setPressed(true);
findViewById(R.id.ada2).setPressed(true);
findViewById(R.id.ada3).setPressed(true);
findViewById(R.id.ada4).setPressed(true);
}
}
================================================
FILE: app/src/main/res/drawable/ic_vector_cloud.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24"
android:viewportWidth="24">
<path
android:fillColor="#000"
android:pathData="M19,18H6A4,4 0 0,1 2,14A4,4 0 0,1 6,10H6.71C7.37,7.69 9.5,6 12,6A5.5,5.5 0 0,1 17.5,11.5V12H19A3,3 0 0,1 22,15A3,3 0 0,1 19,18M19.35,10.03C18.67,6.59 15.64,4 12,4C9.11,4 6.6,5.64 5.35,8.03C2.34,8.36 0,10.9 0,14A6,6 0 0,0 6,20H19A5,5 0 0,0 24,15C24,12.36 21.95,10.22 19.35,10.03Z"/>
</vector>
================================================
FILE: app/src/main/res/layout/activity_main.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:drawme="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:orientation="vertical"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp">
<TextView
style="@style/TextDivider"
android:text="#01: Transparent borderless button"/>
<com.rafakob.drawme.DrawMeButton
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="Normal"/>
<com.rafakob.drawme.DrawMeButton
android:id="@+id/transparent_pressed"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="Pressed"/>
<com.rafakob.drawme.DrawMeButton
android:id="@+id/transparent_disabled"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="Disabled"/>
<TextView
style="@style/TextDivider"
android:text="#02: Colored button"/>
<com.rafakob.drawme.DrawMeButton
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="Normal"
drawme:dm_backColor="@color/colorAccent"/>
<com.rafakob.drawme.DrawMeButton
android:id="@+id/colored_pressed1"
android:layout_width="match_parent"
android:layout_height="50dp"
android:stateListAnimator="@null"
android:text="Pressed without animator"
drawme:dm_backColor="@color/colorAccent"/>
<com.rafakob.drawme.DrawMeButton
android:id="@+id/colored_pressed2"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="Pressed"
drawme:dm_backColor="@color/colorAccent"/>
<com.rafakob.drawme.DrawMeButton
android:id="@+id/colored_disabled"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="Disabled"
drawme:dm_backColor="@color/colorAccent"/>
<TextView
style="@style/TextDivider"
android:text="#03: Rounded button with style"/>
<com.rafakob.drawme.DrawMeButton
style="@style/RoundedButton"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="Normal"/>
<com.rafakob.drawme.DrawMeButton
android:id="@+id/rounded_pressed"
style="@style/RoundedButton"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:text="Pressed"/>
<com.rafakob.drawme.DrawMeButton
android:id="@+id/rounded_disabled"
style="@style/RoundedButton"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="Disabled"/>
<TextView
style="@style/TextDivider"
android:text="#04: Shape and font"/>
<com.rafakob.drawme.DrawMeButton
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginBottom="8dp"
android:text="Rounded"
drawme:dm_backColor="@color/colorGreen"
drawme:dm_font="Lato-Bold.ttf"
drawme:dm_shapeRadiusHalfHeight="true"
drawme:dm_textColor="@android:color/white"/>
<com.rafakob.drawme.DrawMeButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Circle"
drawme:dm_backColor="@color/colorGreen"
drawme:dm_font="Lato-Bold.ttf"
drawme:dm_shapeEqualWidthHeight="true"
drawme:dm_shapeRadiusHalfHeight="true"
drawme:dm_textColor="@android:color/white"/>
<TextView
style="@style/TextDivider"
android:text="#05: Ripple - control highlight vs generated dim color"/>
<com.rafakob.drawme.DrawMeButton
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginBottom="8dp"
android:text="Control highlight"
drawme:dm_backColor="@color/colorBlue"
drawme:dm_shapeRadiusHalfHeight="true"
drawme:dm_stroke="12dp"
drawme:dm_strokeColor="@color/colorYellow"
drawme:dm_textColor="@android:color/white"/>
<com.rafakob.drawme.DrawMeButton
android:id="@+id/ctrl_pressed1"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginBottom="8dp"
android:text="Control highlight"
drawme:dm_backColor="@color/colorBlue"
drawme:dm_shapeRadiusHalfHeight="true"
drawme:dm_stroke="12dp"
drawme:dm_strokeColor="@color/colorYellow"
drawme:dm_textColor="@android:color/white"/>
<com.rafakob.drawme.DrawMeButton
android:id="@+id/ctrl_pressed2"
android:layout_width="match_parent"
android:layout_height="60dp"
android:text="Dim background color"
drawme:dm_backColor="@color/colorBlue"
drawme:dm_rippleUseControlHighlight="false"
drawme:dm_shapeRadiusHalfHeight="true"
drawme:dm_stroke="12dp"
drawme:dm_strokeColor="@color/colorYellow"
drawme:dm_textColor="@android:color/white"/>
<TextView
style="@style/TextDivider"
android:text="#06: Textviews"/>
<com.rafakob.drawme.DrawMeTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:clickable="true"
android:gravity="center_horizontal"
android:padding="12dp"
android:text="My text"
drawme:dm_stroke="2dp"/>
<com.rafakob.drawme.DrawMeTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="8dp"
android:clickable="true"
android:gravity="center_horizontal"
android:padding="12dp"
android:text="My text"
android:textAllCaps="true"
android:textSize="18sp"
drawme:dm_font="Lato-Bold.ttf"
drawme:dm_radius="16dp"
drawme:dm_stateDisabled="false"
drawme:dm_statePressed="false"
drawme:dm_stroke="4dp"
drawme:dm_strokeColor="@color/colorAccent"/>
<com.rafakob.drawme.DrawMeEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:drawableLeft="@drawable/ic_vector_cloud"
android:drawablePadding="16dp"
android:hint="EditText with tinted icon"
android:padding="8dp"
drawme:dm_drawableTint="@color/colorAccent"/>
<TextView
style="@style/TextDivider"
android:text="#07: Layouts"/>
<com.rafakob.drawme.DrawMeRelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:padding="16dp"
drawme:dm_radius="16dp"
drawme:dm_stroke="4dp"
drawme:dm_strokeColor="@color/colorGreen">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@mipmap/ic_launcher"/>
<com.rafakob.drawme.DrawMeFrameLayout
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerInParent="true"
android:clickable="true"
drawme:dm_backColor="@color/colorAccent"
drawme:dm_shapeRadiusHalfHeight="true"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:src="@mipmap/ic_launcher"/>
</com.rafakob.drawme.DrawMeRelativeLayout>
<TextView
style="@style/TextDivider"
android:text="#08: Highlight and disabled mask"/>
<com.rafakob.drawme.DrawMeButton
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginBottom="8dp"
android:text="Normal"
drawme:dm_backColor="@color/colorAccent"
drawme:dm_rippleUseControlHighlight="false"
drawme:dm_textColor="@android:color/white"/>
<com.rafakob.drawme.DrawMeButton
android:id="@+id/mask_def"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginBottom="8dp"
android:text="Pressed - Default mask"
drawme:dm_backColor="@color/colorAccent"
drawme:dm_rippleUseControlHighlight="false"
drawme:dm_textColor="@android:color/white"/>
<com.rafakob.drawme.DrawMeButton
android:id="@+id/mask_dark"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginBottom="8dp"
android:text="Pressed - Darker"
drawme:dm_backColor="@color/colorAccent"
drawme:dm_maskColorPressed="#8D000000"
drawme:dm_rippleUseControlHighlight="false"
drawme:dm_textColor="@android:color/white"/>
<com.rafakob.drawme.DrawMeButton
android:id="@+id/mask_light"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginBottom="8dp"
android:text="Pressed - Lighter"
drawme:dm_backColor="@color/colorAccent"
drawme:dm_maskColorPressed="#8DFFFFFF"
drawme:dm_rippleUseControlHighlight="false"
drawme:dm_textColor="@android:color/white"/>
<com.rafakob.drawme.DrawMeButton
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginBottom="8dp"
android:enabled="false"
android:text="Disabled - Default"
drawme:dm_backColor="@color/colorAccent"
drawme:dm_rippleUseControlHighlight="false"
drawme:dm_textColor="@android:color/white"/>
<com.rafakob.drawme.DrawMeButton
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginBottom="8dp"
android:enabled="false"
android:text="Disabled - Custom"
drawme:dm_backColor="@color/colorAccent"
drawme:dm_maskColorDisabled="#CCFFFFFF"
drawme:dm_rippleUseControlHighlight="false"
drawme:dm_textColor="@android:color/white"/>
<TextView
style="@style/TextDivider"
android:text="#09: Adaptive mask"/>
<com.rafakob.drawme.DrawMeButton
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginBottom="8dp"
android:text="Normal"
drawme:dm_backColor="@color/colorGreen"
drawme:dm_rippleUseControlHighlight="false"
drawme:dm_textColor="@android:color/white"/>
<com.rafakob.drawme.DrawMeButton
android:id="@+id/ada1"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginBottom="8dp"
android:text="Normal pressed - default"
drawme:dm_backColor="@color/colorGreen"
drawme:dm_rippleUseControlHighlight="false"
drawme:dm_textColor="@android:color/white"/>
<com.rafakob.drawme.DrawMeButton
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginBottom="8dp"
android:text="Dark normal"
drawme:dm_backColor="@color/colorGreenDark"
drawme:dm_rippleUseControlHighlight="false"
drawme:dm_textColor="@android:color/white"/>
<com.rafakob.drawme.DrawMeButton
android:id="@+id/ada2"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginBottom="8dp"
android:text="Dark normal pressed - Default"
drawme:dm_backColor="@color/colorGreenDark"
drawme:dm_rippleUseControlHighlight="false"
drawme:dm_textColor="@android:color/white"/>
<com.rafakob.drawme.DrawMeButton
android:id="@+id/ada3"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginBottom="8dp"
android:text="Dark normal pressed - Adaptive"
drawme:dm_backColor="@color/colorGreenDark"
drawme:dm_maskBrightnessThreshold="0.2"
drawme:dm_rippleUseControlHighlight="false"
drawme:dm_textColor="@android:color/white"/>
<com.rafakob.drawme.DrawMeButton
android:id="@+id/ada4"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginBottom="8dp"
android:text="Dark pressed dark - Lighter"
drawme:dm_backColor="@color/colorGreenDark"
drawme:dm_maskBrightnessThreshold="0.2"
drawme:dm_maskColorPressedInverse="#9DFFFFFF"
drawme:dm_rippleUseControlHighlight="false"
drawme:dm_textColor="@android:color/white"/>
<TextView
style="@style/TextDivider"
android:text="#09: Other"/>
<FrameLayout
android:theme="@style/AppTheme.ThemeButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp">
<com.rafakob.drawme.DrawMeButton
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="Style from theme"/>
</FrameLayout>
</LinearLayout>
</ScrollView>
================================================
FILE: app/src/main/res/values/colors.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
<color name="colorGreen">#80B52B</color>
<color name="colorGreenDark">#162303</color>
<color name="colorBlue">#1089ec</color>
<color name="colorYellow">#f5e100</color>
</resources>
================================================
FILE: app/src/main/res/values/strings.xml
================================================
<resources>
<string name="app_name">DrawMe</string>
</resources>
================================================
FILE: app/src/main/res/values/styles.xml
================================================
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="TextDivider">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:paddingTop">24dp</item>
<item name="android:paddingBottom">8dp</item>
<item name="android:textColor">#DD000000</item>
<item name="android:textSize">16sp</item>
</style>
<style name="RoundedButton">
<item name="android:textAllCaps">true</item>
<item name="dm_backColor">@color/colorAccent</item>
<item name="dm_backColorDisabled">@android:color/darker_gray</item>
<item name="dm_backColorPressed">@color/colorPrimary</item>
<item name="dm_radius">24dp</item>
<item name="dm_radiusTopRight">48dp</item>
<item name="dm_stroke">4dp</item>
<item name="dm_strokeColor">@color/colorPrimary</item>
<item name="dm_strokeColorDisabled">@android:color/darker_gray</item>
<item name="dm_strokeColorPressed">@color/colorPrimaryDark</item>
</style>
<style name="AppTheme.ThemeButton">
<item name="buttonStyle">@style/ThemeButton</item>
</style>
<style name="ThemeButton" parent="@style/Widget.AppCompat.Button">
<item name="dm_backColor">@color/colorPrimary</item>
<item name="dm_backColorPressed">@color/colorPrimaryDark</item>
</style>
</resources>
================================================
FILE: build.gradle
================================================
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-rc1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
================================================
FILE: gradle/wrapper/gradle-wrapper.properties
================================================
#Mon Dec 28 10:00:20 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
================================================
FILE: gradle.properties
================================================
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# 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
================================================
FILE: 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
# 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\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
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"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# 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: 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: library/.gitignore
================================================
/build
================================================
FILE: library/build.gradle
================================================
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
def versionMajor = 0
def versionMinor = 1
def versionPatch = 6
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 10
targetSdkVersion 23
versionCode versionMajor * 1000000 + versionMinor * 1000 + versionPatch
versionName "${versionMajor}.${versionMinor}.${versionPatch}"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
}
// build a jar with source files
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
task javadoc(type: Javadoc) {
failOnError false
source = android.sourceSets.main.java.sourceFiles
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}
// build a jar with javadoc
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
================================================
FILE: library/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/rafakob/Library/Android/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: library/src/main/AndroidManifest.xml
================================================
<manifest package="com.rafakob.drawme">
<application/>
</manifest>
================================================
FILE: library/src/main/java/com/rafakob/drawme/DrawMeButton.java
================================================
package com.rafakob.drawme;
import android.content.Context;
import android.support.v7.widget.AppCompatButton;
import android.util.AttributeSet;
import com.rafakob.drawme.delegate.DrawMe;
import com.rafakob.drawme.delegate.DrawMeShapeText;
public class DrawMeButton extends AppCompatButton {
private final DrawMe drawMe;
public DrawMeButton(Context context) {
this(context, null);
}
public DrawMeButton(Context context, AttributeSet attrs) {
this(context, attrs, R.attr.buttonStyle);
}
public DrawMeButton(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
drawMe = new DrawMeShapeText(context, this, attrs, defStyleAttr);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int[] size = drawMe.onMeasure(widthMeasureSpec, heightMeasureSpec);
super.onMeasure(size[0], size[1]);
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
drawMe.onLayout(changed, left, top, right, bottom);
}
}
================================================
FILE: library/src/main/java/com/rafakob/drawme/DrawMeEditText.java
================================================
package com.rafakob.drawme;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.EditText;
import com.rafakob.drawme.delegate.DrawMe;
import com.rafakob.drawme.delegate.DrawMeShapeText;
public class DrawMeEditText extends EditText {
private final DrawMe drawMe;
public DrawMeEditText(Context context) {
super(context);
drawMe = new DrawMeShapeText(context, this, null);
}
public DrawMeEditText(Context context, AttributeSet attrs) {
super(context, attrs);
drawMe = new DrawMeShapeText(context, this, attrs);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int[] size = drawMe.onMeasure(widthMeasureSpec, heightMeasureSpec);
super.onMeasure(size[0], size[1]);
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
drawMe.onLayout(changed, left, top, right, bottom);
}
}
================================================
FILE: library/src/main/java/com/rafakob/drawme/DrawMeFrameLayout.java
================================================
package com.rafakob.drawme;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.FrameLayout;
import com.rafakob.drawme.delegate.DrawMe;
import com.rafakob.drawme.delegate.DrawMeShape;
public class DrawMeFrameLayout extends FrameLayout {
private final DrawMe drawMe;
public DrawMeFrameLayout(Context context) {
super(context);
drawMe = new DrawMeShape(context, this, null);
}
public DrawMeFrameLayout(Context context, AttributeSet attrs) {
super(context, attrs);
drawMe = new DrawMeShape(context, this, attrs);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int[] size = drawMe.onMeasure(widthMeasureSpec, heightMeasureSpec);
super.onMeasure(size[0], size[1]);
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
drawMe.onLayout(changed, left, top, right, bottom);
}
}
================================================
FILE: library/src/main/java/com/rafakob/drawme/DrawMeImageButton.java
================================================
package com.rafakob.drawme;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageButton;
import com.rafakob.drawme.delegate.DrawMe;
import com.rafakob.drawme.delegate.DrawMeShape;
public class DrawMeImageButton extends ImageButton {
private final DrawMe drawMe;
public DrawMeImageButton(Context context) {
super(context);
drawMe = new DrawMeShape(context, this, null);
}
public DrawMeImageButton(Context context, AttributeSet attrs) {
super(context, attrs);
drawMe = new DrawMeShape(context, this, attrs);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int[] size = drawMe.onMeasure(widthMeasureSpec, heightMeasureSpec);
super.onMeasure(size[0], size[1]);
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
drawMe.onLayout(changed, left, top, right, bottom);
}
}
================================================
FILE: library/src/main/java/com/rafakob/drawme/DrawMeLinearLayout.java
================================================
package com.rafakob.drawme;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.LinearLayout;
import com.rafakob.drawme.delegate.DrawMe;
import com.rafakob.drawme.delegate.DrawMeShape;
public class DrawMeLinearLayout extends LinearLayout {
private final DrawMe drawMe;
public DrawMeLinearLayout(Context context) {
super(context);
drawMe = new DrawMeShape(context, this, null);
}
public DrawMeLinearLayout(Context context, AttributeSet attrs) {
super(context, attrs);
drawMe = new DrawMeShape(context, this, attrs);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int[] size = drawMe.onMeasure(widthMeasureSpec, heightMeasureSpec);
super.onMeasure(size[0], size[1]);
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
drawMe.onLayout(changed, left, top, right, bottom);
}
}
================================================
FILE: library/src/main/java/com/rafakob/drawme/DrawMeRelativeLayout.java
================================================
package com.rafakob.drawme;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.RelativeLayout;
import com.rafakob.drawme.delegate.DrawMe;
import com.rafakob.drawme.delegate.DrawMeShape;
public class DrawMeRelativeLayout extends RelativeLayout {
private final DrawMe drawMe;
public DrawMeRelativeLayout(Context context) {
super(context);
drawMe = new DrawMeShape(context, this, null);
}
public DrawMeRelativeLayout(Context context, AttributeSet attrs) {
super(context, attrs);
drawMe = new DrawMeShape(context, this, attrs);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int[] size = drawMe.onMeasure(widthMeasureSpec, heightMeasureSpec);
super.onMeasure(size[0], size[1]);
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
drawMe.onLayout(changed, left, top, right, bottom);
}
}
================================================
FILE: library/src/main/java/com/rafakob/drawme/DrawMeTextView.java
================================================
package com.rafakob.drawme;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;
import com.rafakob.drawme.delegate.DrawMe;
import com.rafakob.drawme.delegate.DrawMeShapeText;
public class DrawMeTextView extends TextView {
private final DrawMe drawMe;
public DrawMeTextView(Context context) {
super(context);
drawMe = new DrawMeShapeText(context, this, null);
}
public DrawMeTextView(Context context, AttributeSet attrs) {
super(context, attrs);
drawMe = new DrawMeShapeText(context, this, attrs);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int[] size = drawMe.onMeasure(widthMeasureSpec, heightMeasureSpec);
super.onMeasure(size[0], size[1]);
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
drawMe.onLayout(changed, left, top, right, bottom);
}
}
================================================
FILE: library/src/main/java/com/rafakob/drawme/delegate/DrawMe.java
================================================
package com.rafakob.drawme.delegate;
public interface DrawMe {
void updateLayout();
void onLayout(boolean changed, int left, int top, int right, int bottom);
int[] onMeasure(int widthMeasureSpec, int heightMeasureSpec);
}
================================================
FILE: library/src/main/java/com/rafakob/drawme/delegate/DrawMeShape.java
================================================
package com.rafakob.drawme.delegate;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.RippleDrawable;
import android.graphics.drawable.StateListDrawable;
import android.os.Build;
import android.support.annotation.AttrRes;
import android.support.annotation.ColorInt;
import android.util.AttributeSet;
import android.view.View;
import com.rafakob.drawme.R;
import com.rafakob.drawme.util.Coloring;
import java.util.Arrays;
/**
* Base delegate that holds all shape attributes and accessors.
*/
public class DrawMeShape implements DrawMe {
/* Widget */
protected final View mView;
/* Background color */
protected int backColor;
protected int backColorPressed;
protected int backColorDisabled;
/* Stroke */
protected int stroke;
protected int strokeColor;
protected int strokeColorPressed;
protected int strokeColorDisabled;
/* Corner radius */
protected int radius;
protected int radiusBottomLeft;
protected int radiusBottomRight;
protected int radiusTopLeft;
protected int radiusTopRight;
/* Mask */
protected float maskBrightnessThreshold;
protected int maskColorPressed;
protected int maskColorPressedInverse;
protected int maskColorDisabled;
/* Params */
protected boolean rippleEffect;
protected boolean rippleUseControlHighlight;
protected boolean statePressed;
protected boolean stateDisabled;
protected boolean shapeEqualWidthHeight;
protected boolean shapeRadiusHalfHeight;
public DrawMeShape(Context context, View view) {
this(context, view, null);
}
public DrawMeShape(Context context, View view, AttributeSet attrs) {
this(context, view, attrs, 0);
}
public DrawMeShape(Context context, View view, AttributeSet attrs, @AttrRes int defStyleAttr) {
this.mView = view;
obtainAttributes(context, attrs, defStyleAttr);
}
public void obtainAttributes(Context context, AttributeSet attrs, @AttrRes int defStyleAttr) {
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.DrawMe, defStyleAttr, 0);
obtainShapeAttributes(typedArray);
typedArray.recycle();
}
protected void obtainShapeAttributes(TypedArray a) {
rippleEffect = a.getBoolean(R.styleable.DrawMe_dm_rippleEffect, true);
rippleUseControlHighlight = a.getBoolean(R.styleable.DrawMe_dm_rippleUseControlHighlight, true);
statePressed = a.getBoolean(R.styleable.DrawMe_dm_statePressed, true);
stateDisabled = a.getBoolean(R.styleable.DrawMe_dm_stateDisabled, true);
shapeEqualWidthHeight = a.getBoolean(R.styleable.DrawMe_dm_shapeEqualWidthHeight, false);
shapeRadiusHalfHeight = a.getBoolean(R.styleable.DrawMe_dm_shapeRadiusHalfHeight, false);
maskBrightnessThreshold = a.getFloat(R.styleable.DrawMe_dm_maskBrightnessThreshold, 0);
maskColorPressed = a.getColor(R.styleable.DrawMe_dm_maskColorPressed, Color.parseColor("#1F000000"));
maskColorPressedInverse = a.getColor(R.styleable.DrawMe_dm_maskColorPressedInverse, Color.parseColor("#1DFFFFFF"));
maskColorDisabled = a.getColor(R.styleable.DrawMe_dm_maskColorDisabled, Color.parseColor("#6DFFFFFF"));
stroke = a.getDimensionPixelSize(R.styleable.DrawMe_dm_stroke, 0);
radius = a.getDimensionPixelSize(R.styleable.DrawMe_dm_radius, 0);
radiusBottomLeft = a.getDimensionPixelSize(R.styleable.DrawMe_dm_radiusBottomLeft, -1);
radiusBottomRight = a.getDimensionPixelSize(R.styleable.DrawMe_dm_radiusBottomRight, -1);
radiusTopLeft = a.getDimensionPixelSize(R.styleable.DrawMe_dm_radiusTopLeft, -1);
radiusTopRight = a.getDimensionPixelSize(R.styleable.DrawMe_dm_radiusTopRight, -1);
backColor = a.getColor(R.styleable.DrawMe_dm_backColor, Color.TRANSPARENT);
backColorPressed = a.getColor(R.styleable.DrawMe_dm_backColorPressed, defaultPressedColor(backColor));
backColorDisabled = a.getColor(R.styleable.DrawMe_dm_backColorDisabled, defaultDisabledColor(backColor));
strokeColor = a.getColor(R.styleable.DrawMe_dm_strokeColor, Color.GRAY);
strokeColorPressed = a.getColor(R.styleable.DrawMe_dm_strokeColorPressed, defaultPressedColor(strokeColor));
strokeColorDisabled = a.getColor(R.styleable.DrawMe_dm_strokeColorDisabled, defaultDisabledColor(strokeColor));
}
@Override
public void onLayout(boolean changed, int left, int top, int right, int bottom) {
if (shapeRadiusHalfHeight) {
radius = mView.getHeight() / 2;
}
updateLayout();
}
@Override
public int[] onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int[] size = new int[2];
if (shapeEqualWidthHeight && mView.getWidth() > 0 && mView.getHeight() > 0) {
int max = Math.max(mView.getWidth(), mView.getHeight());
int measureSpec = View.MeasureSpec.makeMeasureSpec(max, View.MeasureSpec.EXACTLY);
size[0] = measureSpec;
size[1] = measureSpec;
return size;
}
size[0] = widthMeasureSpec;
size[1] = heightMeasureSpec;
return size;
}
@Override
public void updateLayout() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
mView.setBackground(createBackground());
} else {
mView.setBackgroundDrawable(createBackground());
}
}
private Drawable createBackground() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && rippleEffect) {
return createRippleDrawable();
} else {
return createStateListDrawable();
}
}
/**
* Creates background shape - setups background, stroke and radius.
*
* @param backgroundColor Background color.
* @param strokeColor Stroke color.
* @return Shape drawable.
*/
private Drawable createShape(int backgroundColor, int strokeColor) {
GradientDrawable shape = new GradientDrawable();
shape.setColor(backgroundColor);
final float[] radiusArray = new float[8];
Arrays.fill(radiusArray, radius);
if (radiusTopLeft >= 0) {
radiusArray[0] = radiusTopLeft;
radiusArray[1] = radiusTopLeft;
}
if (radiusTopRight >= 0) {
radiusArray[2] = radiusTopRight;
radiusArray[3] = radiusTopRight;
}
if (radiusBottomRight >= 0) {
radiusArray[4] = radiusBottomRight;
radiusArray[5] = radiusBottomRight;
}
if (radiusBottomLeft >= 0) {
radiusArray[6] = radiusBottomLeft;
radiusArray[7] = radiusBottomLeft;
}
shape.setCornerRadii(radiusArray);
shape.setStroke(stroke, strokeColor);
return shape;
}
private StateListDrawable createStateListDrawable() {
StateListDrawable states = new StateListDrawable();
if (stateDisabled) {
states.addState(new int[]{-android.R.attr.state_enabled}, createShape(backColorDisabled, strokeColorDisabled));
}
if (statePressed) {
states.addState(new int[]{android.R.attr.state_pressed}, createShape(backColorPressed, strokeColorPressed));
}
states.addState(new int[]{}, createShape(backColor, strokeColor));
return states;
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private Drawable createRippleDrawable() {
if (!statePressed) {
return getRippleContentDrawable();
} else if (backColorPressed == Color.TRANSPARENT && strokeColorPressed != Color.TRANSPARENT) {
// highlight only stroke
return new RippleDrawable(ColorStateList.valueOf(strokeColorPressed), getRippleContentDrawable(), createShape(Color.TRANSPARENT, Color.WHITE));
} else {
return new RippleDrawable(ColorStateList.valueOf(backColorPressed), getRippleContentDrawable(), createShape(Color.WHITE, Color.WHITE));
}
}
/**
* Creates content drawable for a RippleDrawable.
*
* @return
*/
private Drawable getRippleContentDrawable() {
if (!stateDisabled) {
return createShape(backColor, strokeColor);
} else {
StateListDrawable states = new StateListDrawable();
states.addState(new int[]{-android.R.attr.state_enabled}, createShape(backColorDisabled, strokeColorDisabled));
states.addState(new int[]{}, createShape(backColor, strokeColor));
return states;
}
}
/**
* Calculates default color value for pressed color.
* On PreL mixes normal state color with a "shadow mask", on L uses theme attribute colorControlHighlight.
*
* @param normalColor
* @return
*/
@ColorInt
private int defaultPressedColor(int normalColor) {
if (maskBrightnessThreshold > 0 && Coloring.getColorBrightness(normalColor) < maskBrightnessThreshold) {
return Coloring.mix(maskColorPressedInverse, normalColor);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && rippleUseControlHighlight) {
return Coloring.getThemeColor(mView.getContext(), R.attr.colorControlHighlight);
} else {
return Coloring.mix(maskColorPressed, normalColor);
}
}
/**
* Calculates default color value for disabled color.
* Mixes state color with a "lighter mask".
*
* @param normalColor
* @return
*/
@ColorInt
private int defaultDisabledColor(int normalColor) {
return Coloring.mix(maskColorDisabled, normalColor);
}
}
================================================
FILE: library/src/main/java/com/rafakob/drawme/delegate/DrawMeShapeText.java
================================================
package com.rafakob.drawme.delegate;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.AttrRes;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;
import com.rafakob.drawme.R;
import com.rafakob.drawme.util.FontCache;
public class DrawMeShapeText extends DrawMeShape {
protected String font;
protected int textColor;
protected int textColorPressed;
protected int textColorDisabled;
protected int tintColor;
protected int tintMode;
public DrawMeShapeText(Context context, View view) {
super(context, view);
}
public DrawMeShapeText(Context context, View view, AttributeSet attrs) {
super(context, view, attrs);
}
public DrawMeShapeText(Context context, View view, AttributeSet attrs, @AttrRes int defStyleAttr) {
super(context, view, attrs, defStyleAttr);
}
protected void obtainTextAttributes(TypedArray a) {
font = a.getString(R.styleable.DrawMeText_dm_font);
textColor = a.getColor(R.styleable.DrawMeText_dm_textColor, ((TextView) mView).getTextColors().getDefaultColor());
textColorPressed = a.getColor(R.styleable.DrawMeText_dm_textColorPressed, textColor);
textColorDisabled = a.getColor(R.styleable.DrawMeText_dm_textColorDisabled, textColor);
tintColor = a.getColor(R.styleable.DrawMeText_dm_drawableTint, 0);
tintMode = a.getInt(R.styleable.DrawMeText_dm_drawableTintMode, 0);
Drawable left = tintDrawable(a.getDrawable(R.styleable.DrawMeText_android_drawableLeft));
Drawable start = tintDrawable(a.getDrawable(R.styleable.DrawMeText_android_drawableStart));
Drawable top = tintDrawable(a.getDrawable(R.styleable.DrawMeText_android_drawableTop));
Drawable right = tintDrawable(a.getDrawable(R.styleable.DrawMeText_android_drawableRight));
Drawable end = tintDrawable(a.getDrawable(R.styleable.DrawMeText_android_drawableEnd));
Drawable bottom = tintDrawable(a.getDrawable(R.styleable.DrawMeText_android_drawableBottom));
((TextView) mView).setCompoundDrawablesWithIntrinsicBounds(left == null ? start : left, top, right == null ? end : right, bottom);
}
@Override
public void obtainAttributes(Context context, AttributeSet attrs, @AttrRes int defStyleAttr) {
super.obtainAttributes(context, attrs, defStyleAttr);
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.DrawMeText, defStyleAttr, 0);
obtainTextAttributes(typedArray);
typedArray.recycle();
if (!TextUtils.isEmpty(font))
applyFont();
}
private void applyFont() {
((TextView) mView).setTypeface(FontCache.get(mView.getContext(), font));
}
private Drawable tintDrawable(Drawable drawable) {
return tintDrawable(drawable, tintColor, tintMode);
}
private Drawable tintDrawable(Drawable drawable, int tintColor, int tintMode) {
if (drawable == null || tintColor == 0) return drawable;
Drawable wrapDrawable = DrawableCompat.wrap(drawable).mutate();
DrawableCompat.setTint(wrapDrawable, tintColor);
PorterDuff.Mode mode = intToMode(tintMode);
if (mode != null && mode != PorterDuff.Mode.CLEAR)
DrawableCompat.setTintMode(wrapDrawable, mode);
return wrapDrawable;
}
private PorterDuff.Mode intToMode(int val) {
switch (val) {
default:
case 0:
return PorterDuff.Mode.CLEAR;
case 1:
return PorterDuff.Mode.SRC;
case 2:
return PorterDuff.Mode.DST;
case 3:
return PorterDuff.Mode.SRC_OVER;
case 4:
return PorterDuff.Mode.DST_OVER;
case 5:
return PorterDuff.Mode.SRC_IN;
case 6:
return PorterDuff.Mode.DST_IN;
case 7:
return PorterDuff.Mode.SRC_OUT;
case 8:
return PorterDuff.Mode.DST_OUT;
case 9:
return PorterDuff.Mode.SRC_ATOP;
case 10:
return PorterDuff.Mode.DST_ATOP;
case 11:
return PorterDuff.Mode.XOR;
case 16:
return PorterDuff.Mode.DARKEN;
case 17:
return PorterDuff.Mode.LIGHTEN;
case 13:
return PorterDuff.Mode.MULTIPLY;
case 14:
return PorterDuff.Mode.SCREEN;
case 12:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
return PorterDuff.Mode.ADD;
}
break;
case 15:
return PorterDuff.Mode.OVERLAY;
}
return PorterDuff.Mode.CLEAR;
}
@Override
public void updateLayout() {
super.updateLayout();
if (textColorPressed != Integer.MAX_VALUE) {
ColorStateList textColors = ((TextView) mView).getTextColors();
ColorStateList colorStateList = new ColorStateList(
new int[][]{
new int[]{-android.R.attr.state_enabled},
new int[]{android.R.attr.state_pressed},
new int[]{},
},
new int[]{
textColorDisabled,
textColorPressed,
textColor});
((TextView) mView).setTextColor(colorStateList);
}
}
}
================================================
FILE: library/src/main/java/com/rafakob/drawme/util/Coloring.java
================================================
package com.rafakob.drawme.util;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.support.annotation.AttrRes;
import android.support.annotation.ColorInt;
import android.support.annotation.NonNull;
import android.util.TypedValue;
public class Coloring {
public static String intToHex(@ColorInt int color) {
return String.format("#%06X", color);
}
@ColorInt
public static int mix(int A, int B) {
int rA = Color.red(A);
int gA = Color.green(A);
int bA = Color.blue(A);
int aA = Color.alpha(A);
int rB = Color.red(B);
int gB = Color.green(B);
int bB = Color.blue(B);
int aB = Color.alpha(B);
int rOut = (rA * aA / 255) + (rB * aB * (255 - aA) / (255 * 255));
int gOut = (gA * aA / 255) + (gB * aB * (255 - aA) / (255 * 255));
int bOut = (bA * aA / 255) + (bB * aB * (255 - aA) / (255 * 255));
int aOut = aA + (aB * (255 - aA) / 255);
return Color.argb(aOut, rOut, gOut, bOut);
}
@ColorInt
public static int getThemeColor(@NonNull Context context, @AttrRes int attributeColor) {
TypedValue typedValue = new TypedValue();
if (context.getTheme().resolveAttribute(attributeColor, typedValue, true)) {
return typedValue.data;
}
return 0;
}
public static float getColorBrightness(int normalColor) {
int r = Color.red(normalColor);
int g = Color.green(normalColor);
int b = Color.blue(normalColor);
return ((b + r + r + g + g + g) / 6 / 255f);
}
@ColorInt
public static int getDrawableColor(ColorDrawable colorDrawable) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
return colorDrawable.getColor();
} else {
// http://stackoverflow.com/questions/15982044/get-activity-background-color-in-android-api-level-8
Bitmap bitmap = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_4444);
Canvas canvas = new Canvas(bitmap);
colorDrawable.draw(canvas);
final int color = bitmap.getPixel(0, 0);
bitmap.recycle();
return color;
}
}
public static ColorStateList getColorStateList(int normalColor, int pressedColor, int disabledColor) {
return new ColorStateList(
new int[][]{
new int[]{-android.R.attr.state_enabled,
-android.R.attr.state_pressed,
-android.R.attr.state_selected,
-android.R.attr.state_focused},
new int[]{android.R.attr.state_pressed},
new int[]{}
},
new int[]{
disabledColor,
pressedColor,
normalColor}
);
}
}
================================================
FILE: library/src/main/java/com/rafakob/drawme/util/FontCache.java
================================================
package com.rafakob.drawme.util;
import android.content.Context;
import android.graphics.Typeface;
import android.support.v4.util.SimpleArrayMap;
public class FontCache {
private static final SimpleArrayMap<String, Typeface> cache = new SimpleArrayMap<>();
public static Typeface get(Context c, String name) {
synchronized (cache) {
if (!cache.containsKey(name)) {
try {
Typeface t = Typeface.createFromAsset(c.getAssets(), String.format("fonts/%s", name));
cache.put(name, t);
return t;
} catch (RuntimeException e) {
return null;
}
}
return cache.get(name);
}
}
}
================================================
FILE: library/src/main/res/values/attrs.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="DrawMe">
<attr name="dm_backColor" format="color"/>
<attr name="dm_backColorDisabled" format="color"/>
<attr name="dm_backColorPressed" format="color"/>
<attr name="dm_maskBrightnessThreshold" format="float"/>
<attr name="dm_maskColorPressed" format="color"/>
<attr name="dm_maskColorPressedInverse" format="color"/>
<attr name="dm_maskColorDisabled" format="color"/>
<attr name="dm_radius" format="dimension"/>
<attr name="dm_radiusBottomLeft" format="dimension"/>
<attr name="dm_radiusBottomRight" format="dimension"/>
<attr name="dm_radiusTopLeft" format="dimension"/>
<attr name="dm_radiusTopRight" format="dimension"/>
<attr name="dm_rippleEffect" format="boolean"/>
<attr name="dm_rippleUseControlHighlight" format="boolean"/>
<attr name="dm_shapeEqualWidthHeight" format="boolean"/>
<attr name="dm_shapeRadiusHalfHeight" format="boolean"/>
<attr name="dm_stateDisabled" format="boolean"/>
<attr name="dm_statePressed" format="boolean"/>
<attr name="dm_stroke" format="dimension"/>
<attr name="dm_strokeColor" format="color"/>
<attr name="dm_strokeColorDisabled" format="color"/>
<attr name="dm_strokeColorPressed" format="color"/>
</declare-styleable>
<declare-styleable name="DrawMeText">
<attr name="android:drawableLeft"/>
<attr name="android:drawableStart"/>
<attr name="android:drawableEnd"/>
<attr name="android:drawableRight"/>
<attr name="android:drawableTop"/>
<attr name="android:drawableBottom"/>
<attr name="dm_drawableTint" format="color"/>
<attr name="dm_drawableTintMode" format="integer">
<enum name="clear" value="0"/>
<enum name="src" value="1"/>
<enum name="dst" value="2"/>
<enum name="src_over" value="3"/>
<enum name="dst_over" value="4"/>
<enum name="src_in" value="5"/>
<enum name="dst_in" value="6"/>
<enum name="src_out" value="7"/>
<enum name="dst_out" value="8"/>
<enum name="src_atop" value="9"/>
<enum name="dst_atop" value="10"/>
<enum name="xor" value="11"/>
<enum name="darken" value="16"/>
<enum name="lighten" value="17"/>
<enum name="multiply" value="13"/>
<enum name="screen" value="14"/>
<enum name="add" value="12"/>
<enum name="overlay" value="15"/>
</attr>
<attr name="dm_font" format="string"/>
<attr name="dm_textColor" format="color"/>
<attr name="dm_textColorDisabled" format="color"/>
<attr name="dm_textColorPressed" format="color"/>
</declare-styleable>
</resources>
================================================
FILE: settings.gradle
================================================
include ':app', ':library'
gitextract_d4pkzbxf/ ├── .gitignore ├── LICENSE ├── README.md ├── app/ │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src/ │ └── main/ │ ├── AndroidManifest.xml │ ├── java/ │ │ └── com/ │ │ └── rafakob/ │ │ └── example/ │ │ └── drawme/ │ │ └── MainActivity.java │ └── res/ │ ├── drawable/ │ │ └── ic_vector_cloud.xml │ ├── layout/ │ │ └── activity_main.xml │ └── values/ │ ├── colors.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── gradle/ │ └── wrapper/ │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle.properties ├── gradlew ├── gradlew.bat ├── library/ │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src/ │ └── main/ │ ├── AndroidManifest.xml │ ├── java/ │ │ └── com/ │ │ └── rafakob/ │ │ └── drawme/ │ │ ├── DrawMeButton.java │ │ ├── DrawMeEditText.java │ │ ├── DrawMeFrameLayout.java │ │ ├── DrawMeImageButton.java │ │ ├── DrawMeLinearLayout.java │ │ ├── DrawMeRelativeLayout.java │ │ ├── DrawMeTextView.java │ │ ├── delegate/ │ │ │ ├── DrawMe.java │ │ │ ├── DrawMeShape.java │ │ │ └── DrawMeShapeText.java │ │ └── util/ │ │ ├── Coloring.java │ │ └── FontCache.java │ └── res/ │ └── values/ │ └── attrs.xml └── settings.gradle
SYMBOL INDEX (78 symbols across 13 files)
FILE: app/src/main/java/com/rafakob/example/drawme/MainActivity.java
class MainActivity (line 6) | public class MainActivity extends AppCompatActivity {
method onCreate (line 8) | @Override
FILE: library/src/main/java/com/rafakob/drawme/DrawMeButton.java
class DrawMeButton (line 10) | public class DrawMeButton extends AppCompatButton {
method DrawMeButton (line 14) | public DrawMeButton(Context context) {
method DrawMeButton (line 18) | public DrawMeButton(Context context, AttributeSet attrs) {
method DrawMeButton (line 22) | public DrawMeButton(Context context, AttributeSet attrs, int defStyleA...
method onMeasure (line 27) | @Override
method onLayout (line 33) | @Override
FILE: library/src/main/java/com/rafakob/drawme/DrawMeEditText.java
class DrawMeEditText (line 9) | public class DrawMeEditText extends EditText {
method DrawMeEditText (line 12) | public DrawMeEditText(Context context) {
method DrawMeEditText (line 17) | public DrawMeEditText(Context context, AttributeSet attrs) {
method onMeasure (line 22) | @Override
method onLayout (line 28) | @Override
FILE: library/src/main/java/com/rafakob/drawme/DrawMeFrameLayout.java
class DrawMeFrameLayout (line 10) | public class DrawMeFrameLayout extends FrameLayout {
method DrawMeFrameLayout (line 13) | public DrawMeFrameLayout(Context context) {
method DrawMeFrameLayout (line 18) | public DrawMeFrameLayout(Context context, AttributeSet attrs) {
method onMeasure (line 23) | @Override
method onLayout (line 29) | @Override
FILE: library/src/main/java/com/rafakob/drawme/DrawMeImageButton.java
class DrawMeImageButton (line 10) | public class DrawMeImageButton extends ImageButton {
method DrawMeImageButton (line 13) | public DrawMeImageButton(Context context) {
method DrawMeImageButton (line 18) | public DrawMeImageButton(Context context, AttributeSet attrs) {
method onMeasure (line 23) | @Override
method onLayout (line 29) | @Override
FILE: library/src/main/java/com/rafakob/drawme/DrawMeLinearLayout.java
class DrawMeLinearLayout (line 10) | public class DrawMeLinearLayout extends LinearLayout {
method DrawMeLinearLayout (line 13) | public DrawMeLinearLayout(Context context) {
method DrawMeLinearLayout (line 18) | public DrawMeLinearLayout(Context context, AttributeSet attrs) {
method onMeasure (line 23) | @Override
method onLayout (line 29) | @Override
FILE: library/src/main/java/com/rafakob/drawme/DrawMeRelativeLayout.java
class DrawMeRelativeLayout (line 10) | public class DrawMeRelativeLayout extends RelativeLayout {
method DrawMeRelativeLayout (line 13) | public DrawMeRelativeLayout(Context context) {
method DrawMeRelativeLayout (line 18) | public DrawMeRelativeLayout(Context context, AttributeSet attrs) {
method onMeasure (line 23) | @Override
method onLayout (line 29) | @Override
FILE: library/src/main/java/com/rafakob/drawme/DrawMeTextView.java
class DrawMeTextView (line 10) | public class DrawMeTextView extends TextView {
method DrawMeTextView (line 13) | public DrawMeTextView(Context context) {
method DrawMeTextView (line 18) | public DrawMeTextView(Context context, AttributeSet attrs) {
method onMeasure (line 23) | @Override
method onLayout (line 29) | @Override
FILE: library/src/main/java/com/rafakob/drawme/delegate/DrawMe.java
type DrawMe (line 3) | public interface DrawMe {
method updateLayout (line 4) | void updateLayout();
method onLayout (line 6) | void onLayout(boolean changed, int left, int top, int right, int bottom);
method onMeasure (line 8) | int[] onMeasure(int widthMeasureSpec, int heightMeasureSpec);
FILE: library/src/main/java/com/rafakob/drawme/delegate/DrawMeShape.java
class DrawMeShape (line 27) | public class DrawMeShape implements DrawMe {
method DrawMeShape (line 58) | public DrawMeShape(Context context, View view) {
method DrawMeShape (line 62) | public DrawMeShape(Context context, View view, AttributeSet attrs) {
method DrawMeShape (line 66) | public DrawMeShape(Context context, View view, AttributeSet attrs, @At...
method obtainAttributes (line 71) | public void obtainAttributes(Context context, AttributeSet attrs, @Att...
method obtainShapeAttributes (line 77) | protected void obtainShapeAttributes(TypedArray a) {
method onLayout (line 106) | @Override
method onMeasure (line 114) | @Override
method updateLayout (line 129) | @Override
method createBackground (line 138) | private Drawable createBackground() {
method createShape (line 153) | private Drawable createShape(int backgroundColor, int strokeColor) {
method createStateListDrawable (line 185) | private StateListDrawable createStateListDrawable() {
method createRippleDrawable (line 197) | @TargetApi(Build.VERSION_CODES.LOLLIPOP)
method getRippleContentDrawable (line 215) | private Drawable getRippleContentDrawable() {
method defaultPressedColor (line 233) | @ColorInt
method defaultDisabledColor (line 253) | @ColorInt
FILE: library/src/main/java/com/rafakob/drawme/delegate/DrawMeShapeText.java
class DrawMeShapeText (line 19) | public class DrawMeShapeText extends DrawMeShape {
method DrawMeShapeText (line 27) | public DrawMeShapeText(Context context, View view) {
method DrawMeShapeText (line 31) | public DrawMeShapeText(Context context, View view, AttributeSet attrs) {
method DrawMeShapeText (line 35) | public DrawMeShapeText(Context context, View view, AttributeSet attrs,...
method obtainTextAttributes (line 39) | protected void obtainTextAttributes(TypedArray a) {
method obtainAttributes (line 58) | @Override
method applyFont (line 69) | private void applyFont() {
method tintDrawable (line 73) | private Drawable tintDrawable(Drawable drawable) {
method tintDrawable (line 77) | private Drawable tintDrawable(Drawable drawable, int tintColor, int ti...
method intToMode (line 89) | private PorterDuff.Mode intToMode(int val) {
method updateLayout (line 135) | @Override
FILE: library/src/main/java/com/rafakob/drawme/util/Coloring.java
class Coloring (line 15) | public class Coloring {
method intToHex (line 16) | public static String intToHex(@ColorInt int color) {
method mix (line 20) | @ColorInt
method getThemeColor (line 41) | @ColorInt
method getColorBrightness (line 50) | public static float getColorBrightness(int normalColor) {
method getDrawableColor (line 57) | @ColorInt
method getColorStateList (line 72) | public static ColorStateList getColorStateList(int normalColor, int pr...
FILE: library/src/main/java/com/rafakob/drawme/util/FontCache.java
class FontCache (line 7) | public class FontCache {
method get (line 10) | public static Typeface get(Context c, String name) {
Condensed preview — 37 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (92K chars).
[
{
"path": ".gitignore",
"chars": 674,
"preview": ".gradle\n/local.properties\n/.idea/workspace.xml\n/.idea/libraries\n.DS_Store\n/build\n/captures\n\n# Built application files\n/*"
},
{
"path": "LICENSE",
"chars": 11357,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "README.md",
"chars": 11413,
"preview": "[](https://android-arsenal"
},
{
"path": "app/.gitignore",
"chars": 7,
"preview": "/build\n"
},
{
"path": "app/build.gradle",
"chars": 692,
"preview": "apply plugin: 'com.android.application'\n\ngroup = 'com.github.rafakob'\n\nandroid {\n compileSdkVersion 23\n buildTools"
},
{
"path": "app/proguard-rules.pro",
"chars": 665,
"preview": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /U"
},
{
"path": "app/src/main/AndroidManifest.xml",
"chars": 686,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest package=\"com.rafakob.example.drawme\"\n xmlns:android=\"http://sc"
},
{
"path": "app/src/main/java/com/rafakob/example/drawme/MainActivity.java",
"chars": 1271,
"preview": "package com.rafakob.example.drawme;\n\nimport android.os.Bundle;\nimport android.support.v7.app.AppCompatActivity;\n\npublic "
},
{
"path": "app/src/main/res/drawable/ic_vector_cloud.xml",
"chars": 597,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<vector xmlns:android=\"http://schemas.android.com/apk/res/android\"\n androi"
},
{
"path": "app/src/main/res/layout/activity_main.xml",
"chars": 15280,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ScrollView\n xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xm"
},
{
"path": "app/src/main/res/values/colors.xml",
"chars": 393,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <color name=\"colorPrimary\">#3F51B5</color>\n <color name=\"color"
},
{
"path": "app/src/main/res/values/strings.xml",
"chars": 69,
"preview": "<resources>\n <string name=\"app_name\">DrawMe</string>\n</resources>\n"
},
{
"path": "app/src/main/res/values/styles.xml",
"chars": 1671,
"preview": "<resources>\n\n <style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.DarkActionBar\">\n <item name=\"colorPrimary\">"
},
{
"path": "build.gradle",
"chars": 340,
"preview": "buildscript {\n repositories {\n jcenter()\n }\n dependencies {\n classpath 'com.android.tools.build:g"
},
{
"path": "gradle/wrapper/gradle-wrapper.properties",
"chars": 231,
"preview": "#Mon Dec 28 10:00:20 PST 2015\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_"
},
{
"path": "gradle.properties",
"chars": 855,
"preview": "# Project-wide Gradle settings.\n\n# IDE (e.g. Android Studio) users:\n# Gradle settings configured through the IDE *will o"
},
{
"path": "gradlew",
"chars": 4971,
"preview": "#!/usr/bin/env bash\n\n##############################################################################\n##\n## Gradle start "
},
{
"path": "gradlew.bat",
"chars": 2404,
"preview": "@if \"%DEBUG%\" == \"\" @echo off\r\n@rem ##########################################################################\r\n@rem\r\n@r"
},
{
"path": "library/.gitignore",
"chars": 7,
"preview": "/build\n"
},
{
"path": "library/build.gradle",
"chars": 1258,
"preview": "apply plugin: 'com.android.library'\napply plugin: 'com.github.dcendents.android-maven'\n\ndef versionMajor = 0\ndef version"
},
{
"path": "library/proguard-rules.pro",
"chars": 665,
"preview": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /U"
},
{
"path": "library/src/main/AndroidManifest.xml",
"chars": 73,
"preview": "<manifest package=\"com.rafakob.drawme\">\n\n <application/>\n\n</manifest>\n"
},
{
"path": "library/src/main/java/com/rafakob/drawme/DrawMeButton.java",
"chars": 1180,
"preview": "package com.rafakob.drawme;\n\nimport android.content.Context;\nimport android.support.v7.widget.AppCompatButton;\nimport an"
},
{
"path": "library/src/main/java/com/rafakob/drawme/DrawMeEditText.java",
"chars": 994,
"preview": "package com.rafakob.drawme;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\nimport android.widget.Edi"
},
{
"path": "library/src/main/java/com/rafakob/drawme/DrawMeFrameLayout.java",
"chars": 1051,
"preview": "package com.rafakob.drawme;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\nimport android.widget.Fra"
},
{
"path": "library/src/main/java/com/rafakob/drawme/DrawMeImageButton.java",
"chars": 1051,
"preview": "package com.rafakob.drawme;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\nimport android.widget.Ima"
},
{
"path": "library/src/main/java/com/rafakob/drawme/DrawMeLinearLayout.java",
"chars": 1057,
"preview": "package com.rafakob.drawme;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\nimport android.widget.Lin"
},
{
"path": "library/src/main/java/com/rafakob/drawme/DrawMeRelativeLayout.java",
"chars": 1067,
"preview": "package com.rafakob.drawme;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\nimport android.widget.Rel"
},
{
"path": "library/src/main/java/com/rafakob/drawme/DrawMeTextView.java",
"chars": 1049,
"preview": "package com.rafakob.drawme;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\nimport android.widget.Tex"
},
{
"path": "library/src/main/java/com/rafakob/drawme/delegate/DrawMe.java",
"chars": 237,
"preview": "package com.rafakob.drawme.delegate;\n\npublic interface DrawMe {\n void updateLayout();\n\n void onLayout(boolean chan"
},
{
"path": "library/src/main/java/com/rafakob/drawme/delegate/DrawMeShape.java",
"chars": 9970,
"preview": "package com.rafakob.drawme.delegate;\n\nimport android.annotation.TargetApi;\nimport android.content.Context;\nimport androi"
},
{
"path": "library/src/main/java/com/rafakob/drawme/delegate/DrawMeShapeText.java",
"chars": 5887,
"preview": "package com.rafakob.drawme.delegate;\n\nimport android.content.Context;\nimport android.content.res.ColorStateList;\nimport "
},
{
"path": "library/src/main/java/com/rafakob/drawme/util/Coloring.java",
"chars": 3111,
"preview": "package com.rafakob.drawme.util;\n\nimport android.content.Context;\nimport android.content.res.ColorStateList;\nimport andr"
},
{
"path": "library/src/main/java/com/rafakob/drawme/util/FontCache.java",
"chars": 761,
"preview": "package com.rafakob.drawme.util;\n\nimport android.content.Context;\nimport android.graphics.Typeface;\nimport android.suppo"
},
{
"path": "library/src/main/res/values/attrs.xml",
"chars": 2912,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <declare-styleable name=\"DrawMe\">\n <attr name=\"dm_backColo"
},
{
"path": "settings.gradle",
"chars": 27,
"preview": "include ':app', ':library'\n"
}
]
// ... and 1 more files (download for full content)
About this extraction
This page contains the full source code of the rafakob/DrawMe GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 37 files (83.9 KB), approximately 21.5k tokens, and a symbol index with 78 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.