Skip to content

Commit c897b36

Browse files
committed
easyTextView
1 parent e8caa24 commit c897b36

18 files changed

Lines changed: 378 additions & 4 deletions

File tree

.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.

.idea/modules.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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
apply plugin: 'com.android.application'
2+
apply plugin: 'com.github.dcendents.android-maven'
23

4+
group='com.github.sdfdzx'
35
android {
46
compileSdkVersion 26
57
buildToolsVersion "26.0.1"
@@ -28,4 +30,5 @@ dependencies {
2830
compile 'com.android.support.constraint:constraint-layout:1.0.2'
2931
testCompile 'junit:junit:4.12'
3032
compile project(':shapebuilder')
33+
compile project(':easywidget')
3134
}

app/src/main/java/com/study/xuan/suppershape/MainActivity.java

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,23 @@
33
import android.graphics.Color;
44
import android.os.Bundle;
55
import android.support.v7.app.AppCompatActivity;
6+
import android.text.SpannableString;
7+
import android.text.style.ForegroundColorSpan;
8+
import android.util.Log;
69
import android.view.View;
10+
import android.widget.TextView;
711

12+
import com.study.xuan.easywidget.EasyTextView;
13+
import com.study.xuan.shapebuilder.annotation.Shape;
814
import com.study.xuan.shapebuilder.shape.LayerBuilder;
915
import com.study.xuan.shapebuilder.shape.ShapeBuilder;
1016
import com.study.xuan.shapebuilder.shape.ShapeListBuilder;
1117

1218
import static android.graphics.drawable.GradientDrawable.RECTANGLE;
1319

1420
public class MainActivity extends AppCompatActivity{
15-
21+
@Shape(RECTANGLE)
22+
private TextView mTv;
1623
@Override
1724
protected void onCreate(Bundle savedInstanceState) {
1825
super.onCreate(savedInstanceState);
@@ -35,6 +42,22 @@ public void onClick(View view) {
3542

3643
LayerBuilder.create(builder1.build(), builder2.build()).Bottom(1, 15).build(findViewById(R
3744
.id.tv3));
45+
/*TextView ic = (TextView) findViewById(R.id.easyText);
46+
Log.i("TAG", "---" + ic.getText().toString() + "----");
47+
ic.append("300");
48+
49+
ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(Color.parseColor
50+
("#11FFFC"));
51+
SpannableString spannableString = new SpannableString("+++"+ic.getText());
52+
spannableString.setSpan(foregroundColorSpan, 0, 1, 1);
53+
ic.setText(spannableString);*/
54+
final EasyTextView ic = (EasyTextView) findViewById(R.id.easyText);
55+
ic.setOnClickListener(new View.OnClickListener() {
56+
@Override
57+
public void onClick(View v) {
58+
ic.setIconColor(Color.parseColor("#2E7D19"));
59+
}
60+
});
3861

3962
}
4063
}

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<LinearLayout
33
xmlns:android="http://schemas.android.com/apk/res/android"
4+
xmlns:app="http://schemas.android.com/apk/res-auto"
45
android:layout_width="match_parent"
56
android:layout_height="match_parent"
67
android:gravity="center"
@@ -33,4 +34,20 @@
3334
android:text="TEXT2"
3435
android:textColor="#000000"
3536
/>
37+
<com.study.xuan.easywidget.EasyTextView
38+
android:id="@+id/easyText"
39+
android:layout_marginTop="30dp"
40+
android:layout_width="wrap_content"
41+
android:layout_height="wrap_content"
42+
android:text="@string/icon_font_home"
43+
android:textSize="38dp"
44+
android:textColor="#000000"
45+
app:totalRadius="5dp"
46+
app:textRight="300"
47+
app:textPadding="30dp"
48+
android:padding="10dp"
49+
app:strokeColor="@color/colorAccent"
50+
app:strokeWidth="2dp"
51+
app:iconColor="@color/colorPrimary"
52+
/>
3653
</LinearLayout>

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
}
77
dependencies {
88
classpath 'com.android.tools.build:gradle:2.3.2'
9-
9+
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
1010
// NOTE: Do not place your application dependencies here; they belong
1111
// in the individual module build.gradle files
1212
}

easywidget/.gitignore

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

easywidget/build.gradle

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
apply plugin: 'com.android.library'
2+
3+
android {
4+
compileSdkVersion 26
5+
buildToolsVersion "27.0.0"
6+
7+
defaultConfig {
8+
minSdkVersion 15
9+
targetSdkVersion 26
10+
versionCode 1
11+
versionName "1.0"
12+
13+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
14+
15+
}
16+
buildTypes {
17+
release {
18+
minifyEnabled false
19+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
20+
}
21+
}
22+
}
23+
24+
dependencies {
25+
compile fileTree(dir: 'libs', include: ['*.jar'])
26+
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
27+
exclude group: 'com.android.support', module: 'support-annotations'
28+
})
29+
compile 'com.android.support:appcompat-v7:26.+'
30+
testCompile 'junit:junit:4.12'
31+
compile project(':shapebuilder')
32+
}

easywidget/proguard-rules.pro

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in E:\Program\sdk/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the proguardFiles
5+
# directive in build.gradle.
6+
#
7+
# For more details, see
8+
# http://developer.android.com/guide/developing/tools/proguard.html
9+
10+
# Add any project specific keep options here:
11+
12+
# If your project uses WebView with JS, uncomment the following
13+
# and specify the fully qualified class name to the JavaScript interface
14+
# class:
15+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16+
# public *;
17+
#}
18+
19+
# Uncomment this to preserve the line number information for
20+
# debugging stack traces.
21+
#-keepattributes SourceFile,LineNumberTable
22+
23+
# If you keep the line number information, uncomment this to
24+
# hide the original source file name.
25+
#-renamesourcefileattribute SourceFile
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.study.xuan.easywidget;
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+
* Instrumentation 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() throws Exception {
21+
// Context of the app under test.
22+
Context appContext = InstrumentationRegistry.getTargetContext();
23+
24+
assertEquals("com.study.xuan.easywidget.test", appContext.getPackageName());
25+
}
26+
}

0 commit comments

Comments
 (0)