Skip to content

Commit e409b90

Browse files
committed
update to add the version of androidx
1 parent 471ef5f commit e409b90

File tree

65 files changed

+3951
-12
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+3951
-12
lines changed

.idea/gradle.xml

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

androidx/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

androidx/build.gradle

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 28
5+
6+
7+
defaultConfig {
8+
minSdkVersion 16
9+
targetSdkVersion 28
10+
versionCode 1
11+
versionName "1.0"
12+
13+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
14+
15+
}
16+
17+
buildTypes {
18+
release {
19+
minifyEnabled false
20+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
21+
}
22+
}
23+
24+
}
25+
26+
dependencies {
27+
implementation fileTree(dir: 'libs', include: ['*.jar'])
28+
29+
implementation 'androidx.appcompat:appcompat:1.0.0'
30+
// implementation 'com.android.support:support-v4:28.0.0-rc02'
31+
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
32+
testImplementation 'junit:junit:4.12'
33+
androidTestImplementation 'com.android.support.test:runner:1.0.2'
34+
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
35+
36+
implementation 'com.trello.rxlifecycle3:rxlifecycle:3.0.0'
37+
38+
// If you want to bind to Android-specific lifecycles
39+
implementation 'com.trello.rxlifecycle3:rxlifecycle-android:3.0.0'
40+
41+
// If you want pre-written Activities and Fragments you can subclass as providers
42+
implementation 'com.trello.rxlifecycle3:rxlifecycle-components:3.0.0'
43+
// implementation project(':libraryx')
44+
implementation 'com.noober.background:corex:1.5.4-ALPHA'
45+
}
46+
47+
repositories{
48+
maven { url 'https://dl.bintray.com/noober/maven' }
49+
}
50+
51+

androidx/proguard-rules.pro

+21
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.noober.androidx;
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.noober.androidx.test", appContext.getPackageName());
25+
}
26+
}

androidx/src/main/AndroidManifest.xml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.noober.androidx" >
3+
<application
4+
android:allowBackup="true"
5+
android:icon="@mipmap/ic_launcher"
6+
android:label="@string/app_name"
7+
android:roundIcon="@mipmap/ic_launcher_round"
8+
android:supportsRtl="true"
9+
android:theme="@style/AppTheme">
10+
<activity android:name=".MainActivity">
11+
<intent-filter>
12+
<action android:name="android.intent.action.MAIN" />
13+
14+
<category android:name="android.intent.category.LAUNCHER" />
15+
</intent-filter>
16+
</activity>
17+
</application>
18+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
package com.noober.androidx;
2+
3+
import android.app.ListActivity;
4+
import android.content.Intent;
5+
import android.content.res.ColorStateList;
6+
import android.graphics.Color;
7+
import android.graphics.drawable.Drawable;
8+
import android.os.Build;
9+
import android.os.Bundle;
10+
import android.view.View;
11+
import android.widget.Button;
12+
import android.widget.TextView;
13+
14+
import androidx.annotation.Nullable;
15+
16+
import com.noober.background.drawable.DrawableCreator;
17+
import com.trello.rxlifecycle3.components.support.RxAppCompatActivity;
18+
19+
public class MainActivity extends RxAppCompatActivity {
20+
21+
@Override
22+
protected void onCreate(@Nullable Bundle savedInstanceState) {
23+
super.onCreate(savedInstanceState);
24+
setContentView( R.layout.activity_main);
25+
Button button = findViewById(R.id.btn);
26+
27+
button.setOnClickListener(new View.OnClickListener() {
28+
@Override
29+
public void onClick(View v) {
30+
startActivity(new Intent(MainActivity.this, ListActivity.class));
31+
}
32+
});
33+
34+
// AnimationDrawable animationDrawable = (AnimationDrawable) vAnim.getBackground();
35+
// animationDrawable.start();
36+
37+
Drawable drawable = new DrawableCreator.Builder().setCornersRadius(30)
38+
.setSolidColor(Color.parseColor("#FFFFFF"))
39+
.setStrokeColor(Color.parseColor("#FFFFFF"))
40+
.setStrokeWidth(10)
41+
.build();
42+
TextView tvTest1 = findViewById(R.id.tvTest1);
43+
tvTest1.setClickable(true);
44+
ColorStateList colors = new DrawableCreator.Builder().setPressedTextColor(Color.RED).setUnPressedTextColor(Color.BLUE).buildTextColor();
45+
tvTest1.setTextColor(colors);
46+
47+
Button btnTest2 = findViewById(R.id.btnTest2);
48+
Drawable drawable2 = new DrawableCreator.Builder().setCornersRadius(dip2px(20))
49+
.setGradientAngle(0).setGradientColor(Color.parseColor("#63B8FF"), Color.parseColor("#4F94CD")).build();
50+
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN){
51+
btnTest2.setBackground(drawable2);
52+
}else {
53+
btnTest2.setBackgroundDrawable(drawable2);
54+
}
55+
56+
57+
Button btnTest3 = findViewById(R.id.btnTest3);
58+
Drawable drawable3 = new DrawableCreator.Builder().setCornersRadius(dip2px(20))
59+
.setRipple(true, Color.parseColor("#71C671"))
60+
.setSolidColor(Color.parseColor("#7CFC00"))
61+
.setStrokeColor(Color.parseColor("#8c6822"))
62+
.setStrokeWidth(dip2px(2))
63+
.build();
64+
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN){
65+
btnTest3.setBackground(drawable3);
66+
}else {
67+
btnTest3.setBackgroundDrawable(drawable3);
68+
}
69+
70+
71+
// TextView tvTest4 = findViewById(R.id.tvTest4);
72+
// Drawable drawable4 = new DrawableCreator.Builder().setCornersRadius(dip2px(20))
73+
// .setPressedDrawable(ContextCompat.getDrawable(this, R.drawable.circle_like_pressed))
74+
// .setUnPressedDrawable(ContextCompat.getDrawable(this, R.drawable.circle_like_normal))
75+
// .build();
76+
// tvTest4.setClickable(true);
77+
// if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN){
78+
// tvTest4.setBackground(drawable4);
79+
// }else {
80+
// tvTest4.setBackgroundDrawable(drawable4);
81+
// }
82+
83+
84+
final Button btnEnable = findViewById(R.id.btn_setEnable);
85+
final TextView tvMulti = findViewById(R.id.tv_multi);
86+
btnEnable.setOnClickListener(new View.OnClickListener() {
87+
@Override
88+
public void onClick(View v) {
89+
if(tvMulti.isEnabled()){
90+
tvMulti.setEnabled(false);
91+
tvMulti.setText("textView一条属性多个状态:enable=false");
92+
}else {
93+
tvMulti.setEnabled(true);
94+
tvMulti.setText("textView一条属性多个状态:enable=true");
95+
}
96+
}
97+
});
98+
99+
}
100+
101+
102+
public int dip2px(float dipValue) {
103+
float scale = getResources().getDisplayMetrics().density;
104+
return (int)(dipValue * scale + 0.5F);
105+
}
106+
107+
}

0 commit comments

Comments
 (0)