Skip to content

Commit

Permalink
see 11/28 log
Browse files Browse the repository at this point in the history
  • Loading branch information
Blankj committed Nov 27, 2019
1 parent 272a8fb commit 93c0a76
Show file tree
Hide file tree
Showing 36 changed files with 589 additions and 197 deletions.
2 changes: 1 addition & 1 deletion README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

[frame]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/auc_frame_cn.png

[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.25.9-brightgreen.svg
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.26.0-brightgreen.svg
[auc]: https://github.com/Blankj/AndroidUtilCode

[apiSvg]: https://img.shields.io/badge/API-14+-brightgreen.svg
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ If this project helps you a lot and you want to support the project's developmen

[frame]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/auc_frame.png

[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.25.9-brightgreen.svg
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.26.0-brightgreen.svg
[auc]: https://github.com/Blankj/AndroidUtilCode

[apiSvg]: https://img.shields.io/badge/API-14+-brightgreen.svg
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/groovy/Config.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Config {
static minSdkVersion = 14
static targetSdkVersion = 28
static versionCode = 1_026_000
static versionName = '1.26.0'// E.g. 1.9.72 => 1,009,072
static versionName = '1.26.0-alpha1'// E.g. 1.9.72 => 1,009,072

// lib version
static kotlin_version = '1.3.50'
Expand Down Expand Up @@ -44,7 +44,7 @@ class Config {
lib_utildebug : new DepConfig(true, true, ":lib:utildebug", "com.blankj:utildebug:1.25.10-alpha5"),
lib_utildebug_no_op : new DepConfig(true, true, ":lib:utildebug-no-op", "com.blankj:utildebug-no-op:1.25.10-alpha5"),
/*Never delete this line*/
plugin_gradle : new DepConfig(pluginPath: "com.android.tools.build:gradle:3.5.2"),
plugin_gradle : new DepConfig(pluginPath: "com.android.tools.build:gradle:3.4.2"),
plugin_kotlin : new DepConfig(pluginPath: "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"),
plugin_maven : new DepConfig(pluginPath: "com.github.dcendents:android-maven-gradle-plugin:2.1", pluginId: "com.github.dcendents.android-maven"),// 上传到 maven
plugin_bintray : new DepConfig(pluginPath: "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4", pluginId: "com.jfrog.bintray"),// 上传到 bintray
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/groovy/TaskDurationUtils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class TaskDurationUtils {
sb.append(String.format("%7sms %s\n", it.exeDuration, it.task.path))
}
def content = sb.toString()
GLog.d(content)
// GLog.d(content)
File file = new File(grd.rootProject.buildDir.getAbsolutePath(),
"build_time_records_" + new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss").format(new Date()) + ".txt")
file.getParentFile().mkdirs()
Expand Down
4 changes: 4 additions & 0 deletions feature/utilcode/pkg/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@
android:name="activity_meta_data"
android:value="ActivityMetaData" />
</activity>
<activity
android:name=".feature.mvp.MvpActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:launchMode="singleTop" />
<activity
android:name=".feature.network.NetworkActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@ public void testCallback(Callback callback) {
callback.call();
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import com.blankj.utilcode.pkg.feature.language.LanguageActivity
import com.blankj.utilcode.pkg.feature.log.LogActivity
import com.blankj.utilcode.pkg.feature.messenger.MessengerActivity
import com.blankj.utilcode.pkg.feature.metaData.MetaDataActivity
import com.blankj.utilcode.pkg.feature.mvp.MvpActivity
import com.blankj.utilcode.pkg.feature.network.NetworkActivity
import com.blankj.utilcode.pkg.feature.notification.NotificationActivity
import com.blankj.utilcode.pkg.feature.path.PathActivity
Expand Down Expand Up @@ -123,6 +124,9 @@ class CoreUtilActivity : CommonActivity() {
CommonItemClick(R.string.demo_meta_data, true) {
MetaDataActivity.start(this)
},
CommonItemClick(R.string.demo_mvp, true) {
MvpActivity.start(this)
},
CommonItemClick(R.string.demo_network, true) {
NetworkActivity.start(this)
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.blankj.utilcode.pkg.feature.mvp;

import com.blankj.utilcode.util.Utils;

/**
* <pre>
* author: blankj
* blog : http://blankj.com
* time : 2019/11/26
* desc :
* </pre>
*/
public interface IMvp {

interface View {
void setLoadingVisible(boolean visible);

void showMsg(CharSequence msg);
}

interface Presenter {
void updateMsg();
}

interface Model {
void requestUpdateMsg(final Utils.Func1<Void, String> func1);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package com.blankj.utilcode.pkg.feature.mvp;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;

import com.blankj.common.activity.CommonActivity;
import com.blankj.utilcode.pkg.R;

Expand All @@ -13,8 +19,24 @@
*/
public class MvpActivity extends CommonActivity {

public static void start(Context context) {
Intent starter = new Intent(context, MvpActivity.class);
context.startActivity(starter);
}

@Override
public int bindTitleRes() {
return R.string.demo_mvp;
}

@Override
public int bindLayout() {
return R.layout.mvp_activity;
}

@Override
public void initView(@Nullable Bundle savedInstanceState, @Nullable View contentView) {
super.initView(savedInstanceState, contentView);
new MvpView(this).addPresenter(new MvpPresenter());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.blankj.utilcode.pkg.feature.mvp;

import com.blankj.base.mvp.BaseModel;
import com.blankj.utilcode.util.ThreadUtils;
import com.blankj.utilcode.util.Utils;

/**
* <pre>
* author: blankj
* blog : http://blankj.com
* time : 2019/11/26
* desc :
* </pre>
*/
public class MvpModel extends BaseModel implements IMvp.Model {

private int index;

@Override
public void onCreateModel() {
index = 0;
}

@Override
public void onDestroyModel() {

}

@Override
public void requestUpdateMsg(final Utils.Func1<Void, String> func1) {
ThreadUtils.executeByCached(addAutoDestroyTask(new ThreadUtils.SimpleTask<String>() {
@Override
public String doInBackground() throws Throwable {
Thread.sleep(1000);
return "msg: " + index++;
}

@Override
public void onSuccess(String result) {
func1.call(result);
}
}));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.blankj.utilcode.pkg.feature.mvp;

import com.blankj.base.mvp.BasePresenter;
import com.blankj.utilcode.util.Utils;

/**
* <pre>
* author: blankj
* blog : http://blankj.com
* time : 2019/11/26
* desc :
* </pre>
*/
public class MvpPresenter extends BasePresenter<MvpView>
implements IMvp.Presenter {

@Override
public void onAttachView() {
}

@Override
public void updateMsg() {
getView().setLoadingVisible(true);
getModel(MvpModel.class).requestUpdateMsg(new Utils.Func1<Void, String>() {
@Override
public Void call(String param) {
getView().showMsg(param);
getView().setLoadingVisible(false);
return null;
}
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package com.blankj.utilcode.pkg.feature.mvp;

import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.widget.TextView;

import com.blankj.base.mvp.BaseView;
import com.blankj.utilcode.pkg.R;
import com.blankj.utilcode.util.ClickUtils;
import com.blankj.utilcode.util.ToastUtils;

/**
* <pre>
* author: blankj
* blog : http://blankj.com
* time : 2019/11/26
* desc :
* </pre>
*/
public class MvpView extends BaseView<MvpView>
implements IMvp.View {

private TextView mvpTv;

public MvpView(FragmentActivity activity) {
super(activity);
mvpTv = activity.findViewById(R.id.mvpUpdateTv);
ClickUtils.applyPressedBgDark(mvpTv);
mvpTv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getPresenter(MvpPresenter.class).updateMsg();
}
});
}

@Override
public void setLoadingVisible(boolean visible) {
final MvpActivity activity = getActivity();
if (visible) {
activity.showLoading(new Runnable() {
@Override
public void run() {
activity.finish();
}
});
} else {
activity.dismissLoading();
}
}

@Override
public void showMsg(CharSequence msg) {
ToastUtils.showLong(msg);
}

@Override
public void onDestroyView() {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@ package com.blankj.utilcode.pkg.feature.shadow

import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.os.Bundle
import android.view.View
import com.blankj.common.activity.CommonActivity
import com.blankj.utilcode.pkg.R
import com.blankj.utilcode.util.ShadowUtils
import com.blankj.utilcode.util.ShadowUtils.Config
import com.blankj.utilcode.util.SizeUtils
import kotlinx.android.synthetic.main.shadow_activity.*

/**
* ```
Expand All @@ -25,4 +32,16 @@ class ShadowActivity : CommonActivity() {
override fun bindTitleRes(): Int {
return R.string.demo_shadow
}

override fun bindLayout(): Int {
return R.layout.shadow_activity
}

override fun initView(savedInstanceState: Bundle?, contentView: View?) {
super.initView(savedInstanceState, contentView)
ShadowUtils.apply(shadowRectView, Config().setShadowRadius(0.01f).setShadowColor(Color.BLUE, Color.GREEN))
ShadowUtils.apply(shadowRoundRectView, Config().setShadowRadius(
SizeUtils.dp2px(16f).toFloat()).setShadowColor(Color.RED, Color.BLUE))
ShadowUtils.apply(shadowCircleView, Config().setCircle().setShadowColor(Color.GREEN, Color.BLUE))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,33 +110,33 @@ class SpanActivity : CommonActivity() {
.appendLine("阴影效果").setFontSize(64, true).setBackgroundColor(Color.BLACK).setShadow(24f, 8f, 8f, Color.WHITE)

.append("小图").setBackgroundColor(Color.GREEN)
.appendImage(R.drawable.span_shape_block_low, SpanUtils.ALIGN_TOP)
.appendImage(R.drawable.span_block_low, SpanUtils.ALIGN_TOP)
.append("顶部").setBackgroundColor(Color.GREEN)
.appendImage(R.drawable.span_shape_block_low, SpanUtils.ALIGN_CENTER)
.appendImage(R.drawable.span_block_low, SpanUtils.ALIGN_CENTER)
.append("居中").setBackgroundColor(Color.GREEN)
.appendImage(R.drawable.span_shape_block_low, SpanUtils.ALIGN_BASELINE)
.appendImage(R.drawable.span_block_low, SpanUtils.ALIGN_BASELINE)
.append("底部").setBackgroundColor(Color.GREEN)
.appendImage(R.drawable.span_shape_block_low, SpanUtils.ALIGN_BOTTOM)
.appendImage(R.drawable.span_block_low, SpanUtils.ALIGN_BOTTOM)
.appendLine("对齐").setBackgroundColor(Color.GREEN)
.appendImage(R.drawable.span_shape_block_high, SpanUtils.ALIGN_TOP)
.appendImage(R.drawable.span_block_high, SpanUtils.ALIGN_TOP)
.append("大图").setBackgroundColor(Color.LTGRAY)
.appendImage(R.drawable.span_shape_block_high, SpanUtils.ALIGN_TOP)
.appendImage(R.drawable.span_block_high, SpanUtils.ALIGN_TOP)
.append("顶部").setBackgroundColor(Color.LTGRAY)
.appendImage(R.drawable.span_shape_block_high, SpanUtils.ALIGN_TOP)
.appendImage(R.drawable.span_block_high, SpanUtils.ALIGN_TOP)
.appendLine("对齐").setBackgroundColor(Color.LTGRAY)

.appendImage(R.drawable.span_shape_block_high, SpanUtils.ALIGN_CENTER)
.appendImage(R.drawable.span_block_high, SpanUtils.ALIGN_CENTER)
.append("大图").setBackgroundColor(Color.GREEN)
.appendImage(R.drawable.span_shape_block_high, SpanUtils.ALIGN_CENTER)
.appendImage(R.drawable.span_block_high, SpanUtils.ALIGN_CENTER)
.append("居中").setBackgroundColor(Color.GREEN)
.appendImage(R.drawable.span_shape_block_high, SpanUtils.ALIGN_CENTER)
.appendImage(R.drawable.span_block_high, SpanUtils.ALIGN_CENTER)
.appendLine("对齐").setBackgroundColor(Color.GREEN)

.appendImage(R.drawable.span_shape_block_high, SpanUtils.ALIGN_BOTTOM)
.appendImage(R.drawable.span_block_high, SpanUtils.ALIGN_BOTTOM)
.append("大图").setBackgroundColor(Color.LTGRAY)
.appendImage(R.drawable.span_shape_block_high, SpanUtils.ALIGN_BOTTOM)
.appendImage(R.drawable.span_block_high, SpanUtils.ALIGN_BOTTOM)
.append("底部").setBackgroundColor(Color.LTGRAY)
.appendImage(R.drawable.span_shape_block_high, SpanUtils.ALIGN_BOTTOM)
.appendImage(R.drawable.span_block_high, SpanUtils.ALIGN_BOTTOM)
.appendLine("对齐").setBackgroundColor(Color.LTGRAY)

.append("测试空格").appendSpace(30, Color.LTGRAY).appendSpace(50, Color.GREEN).appendSpace(100).appendSpace(30, Color.LTGRAY).appendSpace(50, Color.GREEN)
Expand Down Expand Up @@ -201,7 +201,7 @@ class SpanActivity : CommonActivity() {
// printer
mForegroundAlphaColorSpanGroup.alpha = animation.animatedValue as Float

// update
// showMsg
spanAboutAnimTv.text = animSsb
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class ToastActivity : CommonActivity() {
},
CommonItemClick(R.string.toast_show_bg_resource) {
resetToast()
ToastUtils.setBgResource(R.drawable.toast_shape_round_rect)
ToastUtils.setBgResource(R.drawable.toast_round_rect)
ToastUtils.showLong(R.string.toast_custom_bg)
},
CommonItemClick(R.string.toast_show_span) {
Expand Down
7 changes: 7 additions & 0 deletions feature/utilcode/pkg/src/main/res/drawable/shadow_circle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">

<solid android:color="@color/colorAccent" />

</shape>
Loading

0 comments on commit 93c0a76

Please sign in to comment.