Skip to content

Commit 3bee275

Browse files
committed
update to 1.6.2
1 parent 4d00d73 commit 3bee275

9 files changed

Lines changed: 64 additions & 12 deletions

File tree

README-EN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ A framework for directly generating shape through Tags, no need to write shape.x
77
Add this to your app's build.gradle:
88

99
implementation "com.android.support:appcompat-v7:$supportVersion"
10-
implementation 'com.noober.background:core:1.6.1'
10+
implementation 'com.noober.background:core:1.6.2'
1111

1212
if use androidx:
1313

1414
implementation "androidx.appcompat:appcompat:$supportVersion"
15-
implementation 'com.noober.background:core:1.6.1'
15+
implementation 'com.noober.background:core:1.6.2'
1616

1717

1818
## Example effect

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ A framework for directly generating shape through Tags, no need to write shape.x
1010
依赖方式:
1111

1212
implementation "com.android.support:appcompat-v7:$supportVersion"
13-
implementation 'com.noober.background:core:1.6.1'
13+
implementation 'com.noober.background:core:1.6.2'
1414

1515
如果项目使用了androidx:
1616

1717
implementation "androidx.appcompat:appcompat:$supportVersion"
18-
implementation 'com.noober.background:core:1.6.1'
18+
implementation 'com.noober.background:core:1.6.2'
1919

2020

2121
## 使用文档

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ dependencies {
3737
testImplementation 'junit:junit:4.12'
3838
androidTestImplementation 'com.android.support.test:runner:1.0.2'
3939
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
40-
// implementation 'com.noober.background:core:1.6.0'
41-
implementation project(':library')
40+
implementation 'com.noober.background:core:1.6.2'
41+
// implementation project(':library')
4242
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
4343
}

app/src/main/java/com/noober/backgroudlibrary/MyApplication.java

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,37 @@
11
package com.noober.backgroudlibrary;
22

3-
import android.app.Activity;
43
import android.app.Application;
5-
import android.os.Bundle;
4+
import android.content.Context;
5+
import android.util.Log;
66

7-
import com.noober.background.BackgroundLibrary;
7+
import com.noober.background.BLAutoInjectController;
88

99
/**
1010
* Created by xiaoqi on 2018/9/13
1111
*/
1212
public class MyApplication extends Application {
1313

14+
15+
16+
{
17+
BLAutoInjectController.setEnableAutoInject(false);
18+
}
19+
//或者
20+
static {
21+
BLAutoInjectController.setEnableAutoInject(false);
22+
}
23+
//或者
24+
@Override
25+
protected void attachBaseContext(Context base) {
26+
super.attachBaseContext(base);
27+
BLAutoInjectController.setEnableAutoInject(false);
28+
}
29+
1430
@Override
1531
public void onCreate() {
1632
super.onCreate();
33+
Log.e("BL", "onCreate");
34+
1735
// registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {
1836
// @Override
1937
// public void onActivityCreated(Activity activity, Bundle savedInstanceState) {

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ ext {
3636
userOrg = 'noober'
3737
groupId = 'com.noober.background'
3838
uploadName = 'LibraryForBackground'
39-
publishVersion = '1.6.1'
39+
publishVersion = '1.6.2'
4040
desc = "A framework for directly generating shape through Tags, no need to write shape.xml again(通过标签直接生成shape,无需再写shape.xml)"
4141
website = 'https://github.com/JavaNoober/BackgroundLibrary'
4242
// gradlew clean build bintrayUpload -PbintrayUser=xiaoqiandroid -PbintrayKey=xxxxxxxxxxxxxxxx -PdryRun=false
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.noober.background;
2+
3+
/**
4+
* 控制是否自动进行inject
5+
*/
6+
public class BLAutoInjectController {
7+
8+
private static boolean enableAutoInject = true;
9+
10+
public static boolean isEnableAutoInject() {
11+
return enableAutoInject;
12+
}
13+
14+
public static void setEnableAutoInject(boolean enableAutoInject) {
15+
BLAutoInjectController.enableAutoInject = enableAutoInject;
16+
}
17+
}

library/src/main/java/com/noober/background/BackgroundContentProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
public class BackgroundContentProvider extends ContentProvider {
1212
@Override
1313
public boolean onCreate() {
14-
if(getContext() != null && getContext() instanceof Application){
14+
if(getContext() != null && getContext() instanceof Application && BLAutoInjectController.isEnableAutoInject()){
1515
BackgroundLibrary.inject(getContext());
1616
((Application) getContext()).registerActivityLifecycleCallbacks(new BLActivityLifecycleRegister());
1717
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.noober.background;
2+
3+
/**
4+
* 控制是否自动进行inject
5+
*/
6+
public class BLAutoInjectController {
7+
8+
private static boolean enableAutoInject = true;
9+
10+
public static boolean isEnableAutoInject() {
11+
return enableAutoInject;
12+
}
13+
14+
public static void setEnableAutoInject(boolean enableAutoInject) {
15+
BLAutoInjectController.enableAutoInject = enableAutoInject;
16+
}
17+
}

libraryx/src/main/java/com/noober/background/BackgroundContentProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
public class BackgroundContentProvider extends ContentProvider {
1313
@Override
1414
public boolean onCreate() {
15-
if(getContext() != null && getContext() instanceof Application){
15+
if(getContext() != null && getContext() instanceof Application && BLAutoInjectController.isEnableAutoInject()){
1616
BackgroundLibrary.inject(getContext());
1717
((Application) getContext()).registerActivityLifecycleCallbacks(new BLActivityLifecycleRegister());
1818
}

0 commit comments

Comments
 (0)