Skip to content

Commit 5cfda50

Browse files
author
Ozan.Turcan
committed
Component moved to Android Library
1 parent b531af8 commit 5cfda50

File tree

15 files changed

+145
-37
lines changed

15 files changed

+145
-37
lines changed

.idea/gradle.xml

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

app/build.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
apply plugin: 'com.android.application'
2-
32
apply plugin: 'kotlin-android'
4-
53
apply plugin: 'kotlin-android-extensions'
64

75
android {
@@ -30,4 +28,5 @@ dependencies {
3028
testImplementation 'junit:junit:4.12'
3129
androidTestImplementation 'com.android.support.test:runner:1.0.2'
3230
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
31+
implementation project(path: ':smartnumerictextview')
3332
}

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

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,46 @@
22
<LinearLayout
33
xmlns:android="http://schemas.android.com/apk/res/android"
44
xmlns:tools="http://schemas.android.com/tools"
5-
xmlns:app="http://schemas.android.com/apk/res-auto"
65
android:layout_width="match_parent"
7-
android:layout_height="match_parent"
6+
android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto"
87
android:gravity="center_horizontal"
98
tools:context=".MainActivity" android:orientation="vertical">
109

1110

1211
<com.ozanturcan.smartnumerictextview.SmartNumericTextView
13-
android:layout_width="wrap_content"
14-
android:layout_height="wrap_content"
15-
app:textSize="30sp"
16-
app:textPercentage="70"
17-
app:suffixSymbol=""
18-
app:text="1198.99"/>
12+
android:layout_width="wrap_content"
13+
android:layout_height="wrap_content"
14+
app:textSize="30sp"
15+
app:textPercentage="70"
16+
app:suffixSymbol=""
17+
app:text="1198.99"/>
1918

2019
<com.ozanturcan.smartnumerictextview.SmartNumericTextView
21-
android:layout_width="wrap_content"
22-
android:layout_height="wrap_content"
23-
app:textSize="30sp"
24-
app:textPercentage="70"
25-
app:textStyle="bold"
26-
app:textColor="@color/colorPrimary"
27-
app:text="4.99"
28-
app:suffixSymbol="kg"/>
20+
android:layout_width="wrap_content"
21+
android:layout_height="wrap_content"
22+
app:textSize="30sp"
23+
app:textPercentage="70"
24+
app:textStyle="bold"
25+
app:textColor="@color/colorPrimary"
26+
app:text="4.99"
27+
app:suffixSymbol="kg"/>
2928

3029
<com.ozanturcan.smartnumerictextview.SmartNumericTextView
31-
android:layout_width="wrap_content"
32-
android:layout_height="wrap_content"
33-
app:textSize="30sp"
34-
app:textPercentage="50"
35-
app:textStyle="italic"
36-
app:textColor="@color/colorAccent"
37-
app:text="750.00"/>
30+
android:layout_width="wrap_content"
31+
android:layout_height="wrap_content"
32+
app:textSize="30sp"
33+
app:textPercentage="50"
34+
app:textStyle="italic"
35+
app:textColor="@color/colorAccent"
36+
app:text="750.00"/>
3837

3938
<com.ozanturcan.smartnumerictextview.SmartNumericTextView
40-
android:layout_width="wrap_content"
41-
android:layout_height="wrap_content"
42-
app:textSize="30sp"
43-
app:textStyle="bold"
44-
app:textColor="@color/colorPrimary"
45-
app:secondaryTextColor="@color/colorPrimaryDark"
46-
app:suffixSymbol=""
47-
app:text="750.00"/>
39+
android:layout_width="wrap_content"
40+
android:layout_height="wrap_content"
41+
app:textSize="30sp"
42+
app:textStyle="bold"
43+
app:textColor="@color/colorPrimary"
44+
app:secondaryTextColor="@color/colorPrimaryDark"
45+
app:suffixSymbol=""
46+
app:text="750.00"/>
4847
</LinearLayout>

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4-
ext.kotlin_version = '1.3.20'
4+
ext.kotlin_version = '1.3.21'
55
repositories {
66
google()
77
jcenter()

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include ':app'
1+
include ':app', ':smartnumerictextview'

smartnumerictextview/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

smartnumerictextview/build.gradle

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
apply plugin: 'com.android.library'
2+
apply plugin: 'kotlin-android'
3+
apply plugin: 'kotlin-android-extensions'
4+
5+
android {
6+
compileSdkVersion 28
7+
8+
9+
10+
defaultConfig {
11+
minSdkVersion 18
12+
targetSdkVersion 28
13+
versionCode 1
14+
versionName "1.0"
15+
16+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
17+
18+
}
19+
20+
buildTypes {
21+
release {
22+
minifyEnabled false
23+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
24+
}
25+
}
26+
27+
}
28+
29+
dependencies {
30+
implementation fileTree(dir: 'libs', include: ['*.jar'])
31+
32+
implementation 'com.android.support:appcompat-v7:28.0.0'
33+
testImplementation 'junit:junit:4.12'
34+
androidTestImplementation 'com.android.support.test:runner:1.0.2'
35+
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
36+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
37+
}
38+
repositories {
39+
mavenCentral()
40+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.ozanturcan.smartnumerictextview;
2+
3+
import android.content.Context;
4+
import android.support.test.InstrumentationRegistry;
5+
import android.support.test.runner.AndroidJUnit4;
6+
7+
import org.junit.Test;
8+
import org.junit.runner.RunWith;
9+
10+
import static org.junit.Assert.*;
11+
12+
/**
13+
* Instrumented test, which will execute on an Android device.
14+
*
15+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
16+
*/
17+
@RunWith(AndroidJUnit4.class)
18+
public class ExampleInstrumentedTest {
19+
@Test
20+
public void useAppContext() {
21+
// Context of the app under test.
22+
Context appContext = InstrumentationRegistry.getTargetContext();
23+
24+
assertEquals("com.ozanturcan.smartnumerictextview.test", appContext.getPackageName());
25+
}
26+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<manifest package="com.ozanturcan.smartnumerictextview"/>

app/src/main/res/layout/smart_numeric_text_view.xml renamed to smartnumerictextview/src/main/res/layout/smart_numeric_text_view.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
android:layout_width="wrap_content">
55
<TextView
66
android:id="@+id/text_integer"
7-
android:textColor="@color/colorPrimary"
7+
android:textColor="@android:color/primary_text_dark"
88
android:layout_width="wrap_content"
99
android:layout_height="wrap_content"
1010
android:gravity="center_horizontal"
@@ -13,7 +13,7 @@
1313

1414
<TextView
1515
android:id="@+id/text_decimal"
16-
android:textColor="@color/colorPrimaryDark"
16+
android:textColor="@android:color/primary_text_light"
1717
android:layout_width="wrap_content"
1818
android:layout_height="wrap_content"
1919
android:gravity="center_horizontal"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<resources>
2+
<string name="app_name">smartnumerictextview</string>
3+
</resources>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.ozanturcan.smartnumerictextview;
2+
3+
import org.junit.Test;
4+
5+
import static org.junit.Assert.*;
6+
7+
/**
8+
* Example local unit test, which will execute on the development machine (host).
9+
*
10+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
11+
*/
12+
public class ExampleUnitTest {
13+
@Test
14+
public void addition_isCorrect() {
15+
assertEquals(4, 2 + 2);
16+
}
17+
}

0 commit comments

Comments
 (0)