Add floating console support

This commit is contained in:
hyb1996
2017-05-03 01:20:29 +08:00
parent 68706fbd98
commit 7473d7c6a5
60 changed files with 1072 additions and 561 deletions

View File

@@ -0,0 +1,43 @@
package com.stardust.util;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.widget.Toast;
/**
* Created by Stardust on 2017/5/2.
*/
public class UiHandler extends Handler {
private Context mContext;
public UiHandler(Context context) {
super(Looper.getMainLooper());
mContext = context;
}
public Context getContext() {
return mContext;
}
public void toast(final String message) {
post(new Runnable() {
@Override
public void run() {
Toast.makeText(mContext, message, Toast.LENGTH_SHORT).show();
}
});
}
public void toast(final int resId) {
post(new Runnable() {
@Override
public void run() {
Toast.makeText(mContext, resId, Toast.LENGTH_SHORT).show();
}
});
}
}

View File

@@ -0,0 +1,21 @@
package com.stardust.util;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
/**
* Created by Stardust on 2017/5/2.
*/
public class UnderuseExecutors {
private static Executor mExecutor = Executors.newSingleThreadExecutor();
public static void execute(Runnable runnable) {
mExecutor.execute(runnable);
}
public static Executor getExecutor() {
return mExecutor;
}
}

View File

@@ -41,4 +41,10 @@ public class ViewUtil {
}
public static void setViewMeasure(View view, int width, int height) {
ViewGroup.LayoutParams params = view.getLayoutParams();
params.width = width;
params.height = height;
view.setLayoutParams(params);
}
}