Skip to content

Commit b990747

Browse files
Merge pull request #1 from Omega-R/feature/jitpack_support
Feature/jitpack support
2 parents 45276cc + a3debe7 commit b990747

File tree

7 files changed

+82
-15
lines changed

7 files changed

+82
-15
lines changed

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
[![](https://jitpack.io/v/Omega-R/OmegaCenterIconButton.svg)](https://jitpack.io/#Omega-R/OmegaCenterIconButton)
2+
[![GitHub license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://opensource.org/licenses/MIT)
3+
4+
# OmegaCenterIconButton
5+
It's AppCompatButton with centered text and icon. Allow you add icons to left, right and both side.
6+
7+
<p align="center">
8+
<img src="/images/example.png?raw=true" width="300" height="533" />
9+
</p>
10+
11+
# Installation
12+
To get a Git project into your build:
13+
14+
**Step 1.** Add the JitPack repository to your build file
15+
```
16+
allprojects {
17+
repositories {
18+
...
19+
maven { url 'https://jitpack.io' }
20+
}
21+
}
22+
```
23+
**Step 2.** Add the dependency
24+
```
25+
dependencies {
26+
compile 'com.github.Omega-R:OmegaCenterIconButton:0.0.1@aar'
27+
}
28+
```
29+
30+
# Usage
31+
Example of usage in xml layout
32+
```
33+
<com.omega_r.libs.OmegaCenterIconButton
34+
android:layout_width="match_parent"
35+
android:layout_height="wrap_content"
36+
android:drawableLeft="@drawable/ic_android_black_24dp"
37+
android:text="Great"
38+
android:textSize="14sp"
39+
android:theme="@style/BlueButtonStyle"/>
40+
```
41+
42+
# License
43+
```
44+
The MIT License
45+
46+
Copyright 2017 Omega-R
47+
48+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
49+
associated documentation files (the "Software"), to deal in the Software without restriction,
50+
including without limitation the rights to use, copy, modify, merge, publish, distribute,
51+
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
52+
furnished to do so, subject to the following conditions:
53+
54+
The above copyright notice and this permission notice shall be included in all copies or substantial
55+
portions of the Software.
56+
57+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
58+
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
59+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
60+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
61+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
62+
```

app/src/main/res/layout/activity_main.xml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,31 @@
66
android:orientation="vertical"
77
tools:context="com.omega.MainActivity">
88

9-
<com.omega_r.libs.centericonbutton.OmegaCenterIconButton
9+
<com.omega_r.libs.OmegaCenterIconButton
1010
android:layout_width="match_parent"
1111
android:layout_height="wrap_content"
1212
android:layout_marginTop="20dp"
1313
android:drawableLeft="@drawable/ic_android_black_24dp"
14-
android:gravity="center"
15-
android:includeFontPadding="false"
1614
android:text="It's really!"
1715
android:textSize="14sp"
1816
android:theme="@style/BlueButtonStyle" />
1917

20-
<com.omega_r.libs.centericonbutton.OmegaCenterIconButton
18+
<com.omega_r.libs.OmegaCenterIconButton
2119
android:layout_width="match_parent"
2220
android:layout_height="wrap_content"
2321
android:layout_marginTop="20dp"
2422
android:drawableRight="@drawable/ic_android_black_24dp"
25-
android:gravity="center"
26-
android:includeFontPadding="false"
2723
android:text="Great"
2824
android:textSize="14sp"
2925
android:theme="@style/AccentButtonStyle" />
3026

3127

32-
<com.omega_r.libs.centericonbutton.OmegaCenterIconButton
28+
<com.omega_r.libs.OmegaCenterIconButton
3329
android:layout_width="match_parent"
3430
android:layout_height="wrap_content"
3531
android:layout_marginTop="20dp"
3632
android:drawableLeft="@drawable/ic_android_black_24dp"
3733
android:drawableRight="@drawable/ic_android_black_24dp"
38-
android:gravity="center"
39-
android:includeFontPadding="false"
4034
android:text="library"
4135
android:textSize="14sp" />
4236

@@ -46,15 +40,15 @@
4640
android:layout_marginTop="20dp"
4741
android:orientation="horizontal">
4842

49-
<com.omega_r.libs.centericonbutton.OmegaCenterIconButton
43+
<com.omega_r.libs.OmegaCenterIconButton
5044
android:layout_width="0dp"
5145
android:layout_height="wrap_content"
5246
android:layout_weight="1"
5347
android:drawableLeft="@drawable/ic_beach_access_black_24dp"
5448
android:text="left"
5549
android:textSize="14sp" />
5650

57-
<com.omega_r.libs.centericonbutton.OmegaCenterIconButton
51+
<com.omega_r.libs.OmegaCenterIconButton
5852
android:layout_width="0dp"
5953
android:layout_height="wrap_content"
6054
android:layout_weight="1"
@@ -64,14 +58,12 @@
6458

6559
</LinearLayout>
6660

67-
<com.omega_r.libs.centericonbutton.OmegaCenterIconButton
61+
<com.omega_r.libs.OmegaCenterIconButton
6862
android:layout_width="match_parent"
6963
android:layout_height="wrap_content"
7064
android:layout_marginTop="20dp"
7165
android:drawableLeft="@drawable/ic_beach_access_black_24dp"
7266
android:drawableRight="@drawable/ic_bug_report_black_24dp"
73-
android:gravity="center"
74-
android:includeFontPadding="false"
7567
android:text="both"
7668
android:textSize="14sp" />
7769

build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ buildscript {
1111
repositories {
1212
google()
1313
jcenter()
14+
maven { url 'https://jitpack.io' }
1415
}
1516
dependencies {
1617
classpath 'com.android.tools.build:gradle:3.0.1'
1718
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
19+
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
1820

1921
// NOTE: Do not place your application dependencies here; they belong
2022
// in the individual module build.gradle files
@@ -25,6 +27,7 @@ allprojects {
2527
repositories {
2628
google()
2729
jcenter()
30+
maven { url 'https://jitpack.io' }
2831
}
2932
}
3033

center_icon_button/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
apply plugin: 'com.android.library'
2+
apply plugin: 'com.github.dcendents.android-maven'
3+
group = 'com.github.Omega-R'
24

35
android {
46
compileSdkVersion rootProject.compileSdkVersion

center_icon_button/src/main/java/com/omega_r/libs/centericonbutton/OmegaCenterIconButton.java renamed to center_icon_button/src/main/java/com/omega_r/libs/OmegaCenterIconButton.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.omega_r.libs.centericonbutton;
1+
package com.omega_r.libs;
22

33
import android.content.Context;
44
import android.content.res.TypedArray;
@@ -14,6 +14,8 @@
1414
import android.text.method.TransformationMethod;
1515
import android.util.AttributeSet;
1616

17+
import com.omega_r.libs.centericonbutton.R;
18+
1719
import java.util.ArrayList;
1820
import java.util.List;
1921
import java.util.StringTokenizer;

images/example.png

28.7 KB
Loading

0 commit comments

Comments
 (0)