Skip to content

Commit 06479b1

Browse files
committed
see 10/16 log
1 parent 6da8f6e commit 06479b1

File tree

15 files changed

+137
-120
lines changed

15 files changed

+137
-120
lines changed

app/build.gradle

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ plugins {
22
id "com.android.application"
33
// id "com.blankj.bus"
44
}
5-
65
// in config.gradle
76
configAndroidDomain project
8-
configAppDependencies project
7+
configAppDependencies project

app/src/main/java/com/blankj/androidutilcode/Config.java

+1-13
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
import android.os.Environment;
44

5-
import com.blankj.utilcode.util.BusUtils;
6-
import com.blankj.utilcode.util.ToastUtils;
75
import com.blankj.utilcode.util.Utils;
86

97
import java.io.File;
@@ -16,7 +14,7 @@
1614
* desc : config about constants
1715
* </pre>
1816
*/
19-
public class Config implements BusUtils.IBus {
17+
public class Config {
2018

2119
public static final String FILE_SEP = System.getProperty("file.separator");
2220
public static final String LINE_SEP = System.getProperty("line.separator");
@@ -37,14 +35,4 @@ public class Config implements BusUtils.IBus {
3735
TEST_APK_PATH = CACHE_PATH + FILE_SEP + "test_install.apk";
3836

3937
}
40-
41-
@Override
42-
public String getName() {
43-
return "Config";
44-
}
45-
46-
@Override
47-
public void onEvent() {
48-
ToastUtils.showShort("config");
49-
}
5038
}

app/src/main/java/com/blankj/androidutilcode/feature/core/image/ImageActivity.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import com.blankj.androidutilcode.Config;
1515
import com.blankj.androidutilcode.R;
16-
import com.blankj.androidutilcode.base.BaseBackActivity;
16+
import com.blankj.androidutilcode.base.BaseActivity;
1717
import com.blankj.utilcode.util.ImageUtils;
1818
import com.blankj.utilcode.util.ToastUtils;
1919

@@ -28,9 +28,9 @@
2828
* desc : demo about ImageUtils
2929
* </pre>
3030
*/
31-
public class ImageActivity extends BaseBackActivity {
31+
public class ImageActivity extends BaseActivity {
3232

33-
Bitmap src;
33+
Bitmap src;
3434
List<ImageBean> mList = new ArrayList<>();
3535

3636
public static void start(Context context) {
@@ -50,7 +50,7 @@ public int bindLayout() {
5050

5151
@Override
5252
public void initView(Bundle savedInstanceState, View contentView) {
53-
getToolBar().setTitle(getString(R.string.demo_image));
53+
// getToolBar().setTitle(getString(R.string.demo_image));
5454

5555
RecyclerView rvImages = findViewById(R.id.rv_images);
5656
findViewById(R.id.btn_save).setOnClickListener(this);
@@ -88,7 +88,7 @@ public void initView(Bundle savedInstanceState, View contentView) {
8888
mList.add(new ImageBean(R.string.image_compress_by_quality_max_size, ImageUtils.compressByQuality(src, 10L * 1024)));// 10Kb
8989
mList.add(new ImageBean(R.string.image_compress_by_sample_size, ImageUtils.compressBySampleSize(src, 2)));
9090

91-
rvImages.setAdapter(new ImageAdapter(mList, R.layout.item_image));
91+
rvImages.setAdapter(new ImageAdapter(mList, R.layout.item_image1));
9292
rvImages.setLayoutManager(new LinearLayoutManager(this));
9393
}
9494

@@ -106,4 +106,4 @@ public void onWidgetClick(View view) {
106106
break;
107107
}
108108
}
109-
}
109+
}

app/src/main/res_core/layout/activity_image.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<LinearLayout
3-
xmlns:android="http://schemas.android.com/apk/res/android"
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
43
android:layout_width="match_parent"
54
android:layout_height="wrap_content"
5+
android:background="@color/white"
66
android:descendantFocusability="blocksDescendants"
77
android:orientation="vertical"
88
android:padding="@dimen/spacing_16">
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
android:layout_width="match_parent"
5+
android:layout_height="wrap_content">
6+
7+
<TextView
8+
android:id="@+id/tv_image_name"
9+
style="@style/TextStyle"
10+
android:layout_width="wrap_content"
11+
android:layout_height="wrap_content" />
12+
13+
<ImageView
14+
android:id="@+id/iv_image"
15+
android:layout_width="wrap_content"
16+
android:layout_height="wrap_content"
17+
app:layout_constraintTop_toBottomOf="@id/tv_image_name" />
18+
19+
</android.support.constraint.ConstraintLayout>

config.gradle

+9-2
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@ ext {
77
minSdkVersion : 14,
88
targetSdkVersion : 27,
99
versionCode : 1_020_004,
10-
versionName : '1.20.4'// E.g. 1.9.72 => 1,009,072
10+
versionName : '1.20.4.10'// E.g. 1.9.72 => 1,009,072
1111
]
1212

1313
versionConfig = [
1414
// plugin
15-
gradle : '3.2.0',
15+
gradle : '3.2.1',
1616
kotlin : '1.2.30',
1717
// lib
1818
support : '27.1.1',
19+
constraint : '1.0.2',
20+
bus : '1.0',
1921
gson : '2.8.2',
2022
glide : '4.7.1',
2123
leakcanary : '1.5.4',
@@ -34,11 +36,13 @@ ext {
3436
appcompat_v7: "com.android.support:appcompat-v7:$versionConfig.support",
3537
design : "com.android.support:design:$versionConfig.support",
3638
],
39+
constraint : "com.android.support.constraint:constraint-layout:$versionConfig.constraint",
3740
kotlin_stdlib_jdk7 : "org.jetbrains.kotlin:kotlin-stdlib-jdk7",
3841
leakcanary : [
3942
android : "com.squareup.leakcanary:leakcanary-android:$versionConfig.leakcanary",
4043
android_no_op: "com.squareup.leakcanary:leakcanary-android-no-op:$versionConfig.leakcanary",
4144
],
45+
bus : "com.blankj:bus:$versionConfig.bus",
4246
gson : "com.google.code.gson:gson:$versionConfig.gson",
4347
glide : "com.github.bumptech.glide:glide:$versionConfig.glide",
4448
retrofit : "com.squareup.retrofit2:retrofit:$versionConfig.retrofit",
@@ -167,6 +171,7 @@ def configAppDependencies(Project pro) {
167171

168172
implementation depConfig.support.appcompat_v7
169173
implementation depConfig.support.design
174+
implementation depConfig.constraint
170175
implementation depConfig.free_proguard
171176
implementation 'com.r0adkll:slidableactivity:2.0.5'
172177
// LeakCanary
@@ -178,6 +183,8 @@ def configAppDependencies(Project pro) {
178183

179184
def configUtilCodeDependencies(Project pro) {
180185
pro.dependencies {
186+
api depConfig.bus
187+
181188
compileOnly depConfig.support.appcompat_v7
182189
compileOnly depConfig.support.design
183190

gradle/bintrayUpload.gradle

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
2-
apply plugin: 'com.github.dcendents.android-maven'
3-
apply plugin: 'com.jfrog.bintray'
4-
51
// load properties
62
Properties properties = new Properties()
73
File localPropertiesFile = project.file("local.properties");
8-
if(localPropertiesFile.exists()){
4+
if (localPropertiesFile.exists()) {
95
properties.load(localPropertiesFile.newDataInputStream())
106
}
117
File projectPropertiesFile = project.file("project.properties");
12-
if(projectPropertiesFile.exists()){
8+
if (projectPropertiesFile.exists()) {
139
properties.load(projectPropertiesFile.newDataInputStream())
1410
}
1511

@@ -91,7 +87,7 @@ artifacts {
9187

9288
// javadoc configuration
9389
javadoc {
94-
options{
90+
options {
9591
encoding "UTF-8"
9692
charSet 'UTF-8'
9793
author true

utilcode/README-CN.md

+1
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ copyDir : 复制目录
252252
copyFile : 复制文件
253253
moveDir : 移动目录
254254
moveFile : 移动文件
255+
delete : 删除文件或目录
255256
deleteDir : 删除目录
256257
deleteFile : 删除文件
257258
deleteAllInDir : 删除目录下所有东西
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.blankj.utilcode;
2+
3+
import com.blankj.utilcode.util.BusUtils;
4+
import com.blankj.utilcode.util.LogUtils;
5+
6+
/**
7+
* <pre>
8+
* author: Blankj
9+
* blog : http://blankj.com
10+
* time : 2018/10/08
11+
* desc :
12+
* </pre>
13+
*/
14+
public class BusTest {
15+
16+
@BusUtils.Subscribe(name = "lib")
17+
public static String libBus(String name) {
18+
LogUtils.e(name);
19+
return "libBus";
20+
}
21+
}

utilcode/src/main/java/com/blankj/utilcode/util/BusUtils.java

-45
This file was deleted.

utilcode/src/main/java/com/blankj/utilcode/util/FileUtils.java

+24
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,30 @@ private static boolean copyOrMoveFile(final File srcFile,
505505
}
506506
}
507507

508+
/**
509+
* Delete the directory.
510+
*
511+
* @param filePath The path of file.
512+
* @return {@code true}: success<br>{@code false}: fail
513+
*/
514+
public static boolean delete(final String filePath) {
515+
return delete(getFileByPath(filePath));
516+
}
517+
518+
/**
519+
* Delete the directory.
520+
*
521+
* @param file The file.
522+
* @return {@code true}: success<br>{@code false}: fail
523+
*/
524+
public static boolean delete(final File file) {
525+
if (file == null) return false;
526+
if (file.isDirectory()) {
527+
return deleteDir(file);
528+
}
529+
return deleteFile(file);
530+
}
531+
508532
/**
509533
* Delete the directory.
510534
*

utilcode/src/main/java/com/blankj/utilcode/util/IntentUtils.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import android.content.ComponentName;
44
import android.content.Intent;
5+
import android.content.pm.PackageManager;
56
import android.net.Uri;
67
import android.os.Build;
78
import android.os.Bundle;
@@ -37,7 +38,10 @@ private IntentUtils() {
3738
* @return {@code true}: yes<br>{@code false}: no
3839
*/
3940
public static boolean isIntentAvailable(final Intent intent) {
40-
return Utils.getApp().getPackageManager().queryIntentActivities(intent, 0).size() > 0;
41+
return Utils.getApp()
42+
.getPackageManager()
43+
.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY)
44+
.size() > 0;
4145
}
4246

4347
/**

0 commit comments

Comments
 (0)