version:1.4.3
fix: update:增加添加应用,实时更新信息
This commit is contained in:
@@ -17,8 +17,8 @@ android {
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 29
|
||||
|
||||
versionCode 31
|
||||
versionName "1.3.9"
|
||||
versionCode 35
|
||||
versionName "1.4.3"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
|
||||
@@ -90,12 +90,23 @@
|
||||
android:excludeFromRecents="true"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/activity_styles" />
|
||||
<activity
|
||||
android:name=".activity.PasswordActivity"
|
||||
android:excludeFromRecents="true"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="userLandscape"
|
||||
android:theme="@style/activity_styles" />
|
||||
<activity
|
||||
android:name=".activity.AddIconActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="userLandscape" />
|
||||
<activity
|
||||
android:name=".activity.PolicyActivity"
|
||||
android:launchMode="singleTask" />
|
||||
<activity
|
||||
android:name=".activity.more.MoreAppActivity"
|
||||
android:launchMode="singleTask" />
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="userLandscape" />
|
||||
<activity
|
||||
android:name=".activity.ExitActivity"
|
||||
android:configChanges="keyboardHidden"
|
||||
@@ -222,8 +233,7 @@
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<!-- 【必须】 信鸽receiver广播接收 -->
|
||||
</activity> <!-- 【必须】 信鸽receiver广播接收 -->
|
||||
<receiver
|
||||
android:name="com.tencent.android.tpush.XGPushReceiver"
|
||||
android:exported="false"
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.uiui.zyos.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.uiui.zyos.R;
|
||||
import com.uiui.zyos.adapter.AddAppAdapter;
|
||||
import com.uiui.zyos.adapter.AppAdapter;
|
||||
import com.uiui.zyos.base.BaseActivity;
|
||||
import com.uiui.zyos.bean.DesktopIcon;
|
||||
import com.uiui.zyos.manager.AppManager;
|
||||
import com.uiui.zyos.view.RecyclerViewSpacesItemDecoration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
public class AddIconActivity extends BaseActivity {
|
||||
|
||||
@BindView(R.id.iv_back)
|
||||
ImageView iv_back;
|
||||
@BindView(R.id.recyclerView)
|
||||
RecyclerView recyclerView;
|
||||
@BindView(R.id.tv_appsize)
|
||||
TextView tv_appsize;
|
||||
|
||||
private AddAppAdapter mAddAppAdapter;
|
||||
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
return R.layout.activity_add_icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView() {
|
||||
ButterKnife.bind(this);
|
||||
iv_back.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
recyclerView.setLayoutManager(new GridLayoutManager(this, 6));
|
||||
HashMap<String, Integer> stringIntegerHashMap = new HashMap<>();
|
||||
WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
wm.getDefaultDisplay().getRealMetrics(dm);
|
||||
float density = dm.density; // 屏幕密度(0.75 / 1.0 / 1.5)
|
||||
stringIntegerHashMap.put(RecyclerViewSpacesItemDecoration.TOP_DECORATION, (int) (density * 1));//top间距
|
||||
stringIntegerHashMap.put(RecyclerViewSpacesItemDecoration.BOTTOM_DECORATION, (int) (density * 1));//底部间距
|
||||
stringIntegerHashMap.put(RecyclerViewSpacesItemDecoration.LEFT_DECORATION, (int) (density * 20));//左间距
|
||||
stringIntegerHashMap.put(RecyclerViewSpacesItemDecoration.RIGHT_DECORATION, (int) (density * 20));//右间距
|
||||
recyclerView.addItemDecoration(new RecyclerViewSpacesItemDecoration(stringIntegerHashMap));
|
||||
mAddAppAdapter = new AddAppAdapter();
|
||||
recyclerView.setAdapter(mAddAppAdapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
ArrayList<DesktopIcon> desktopIcons = AppManager.getInstance().getAllAppList();
|
||||
mAddAppAdapter.setDesktopIcons(desktopIcons);
|
||||
Set<String> appList = AppManager.getInstance().getFilterAppset();
|
||||
mAddAppAdapter.setPackageSet(appList);
|
||||
|
||||
tv_appsize.setText(String.format(getString(R.string.app_size), desktopIcons.size()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -142,7 +142,7 @@ public class ExitActivity extends BaseActivity {
|
||||
return;
|
||||
}
|
||||
Log.e(TAG, "inputComplete: " + content);
|
||||
String password = Settings.Global.getString(getContentResolver(), CommonConfig.DEFAULT_PASSWORD);
|
||||
String password = Settings.Global.getString(getContentResolver(), CommonConfig.LOCK_SCREEN_PASSWORD);
|
||||
if ((!TextUtils.isEmpty(content) && !TextUtils.isEmpty(password))) {
|
||||
if (password.equals(content)) {
|
||||
exitDesktop();
|
||||
@@ -187,7 +187,7 @@ public class ExitActivity extends BaseActivity {
|
||||
String oldText = codeView.getEditText().getText().toString();
|
||||
Log.e(TAG, "add: " + oldText);
|
||||
codeView.getEditText().setText(text);
|
||||
soundPool.play(soundId, 1, 1, 0, 0, 1);
|
||||
// soundPool.play(soundId, 1, 1, 0, 0, 1);
|
||||
}
|
||||
|
||||
private void exitDesktop() {
|
||||
|
||||
181
app/src/main/java/com/uiui/zyos/activity/PasswordActivity.java
Normal file
181
app/src/main/java/com/uiui/zyos/activity/PasswordActivity.java
Normal file
@@ -0,0 +1,181 @@
|
||||
package com.uiui.zyos.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.media.AudioAttributes;
|
||||
import android.media.SoundPool;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.tuo.customview.VerificationCodeView;
|
||||
import com.uiui.zyos.R;
|
||||
import com.uiui.zyos.base.BaseActivity;
|
||||
import com.uiui.zyos.config.CommonConfig;
|
||||
import com.uiui.zyos.manager.RemoteManager;
|
||||
import com.uiui.zyos.utils.ApkUtils;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
public class PasswordActivity extends BaseActivity {
|
||||
|
||||
private static final String TAG = PasswordActivity.class.getSimpleName();
|
||||
|
||||
@BindView(R.id.bt_0)
|
||||
TextView bt0;
|
||||
@BindView(R.id.bt_1)
|
||||
TextView bt1;
|
||||
@BindView(R.id.bt_2)
|
||||
TextView bt2;
|
||||
@BindView(R.id.bt_3)
|
||||
TextView bt3;
|
||||
@BindView(R.id.bt_4)
|
||||
TextView bt4;
|
||||
@BindView(R.id.bt_5)
|
||||
TextView bt5;
|
||||
@BindView(R.id.bt_6)
|
||||
TextView bt6;
|
||||
@BindView(R.id.bt_7)
|
||||
TextView bt7;
|
||||
@BindView(R.id.bt_8)
|
||||
TextView bt8;
|
||||
@BindView(R.id.bt_9)
|
||||
TextView bt9;
|
||||
@BindView(R.id.bt_del)
|
||||
TextView bt_del;
|
||||
@BindView(R.id.bt_confirm)
|
||||
TextView bt_confirm;
|
||||
|
||||
@BindView(R.id.textView)
|
||||
TextView textView;
|
||||
@BindView(R.id.tv_hint)
|
||||
TextView tv_hint;
|
||||
@BindView(R.id.ll_keyboard)
|
||||
LinearLayout ll_keyboard;
|
||||
@BindView(R.id.icv)
|
||||
VerificationCodeView codeView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
return R.layout.activity_passwd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView() {
|
||||
ButterKnife.bind(this);
|
||||
InputMethodManager imm = (InputMethodManager) PasswordActivity.this.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(codeView.getWindowToken(), 0);
|
||||
codeView.getEditText().setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
ll_keyboard.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
codeView.setInputCompleteListener(new VerificationCodeView.InputCompleteListener() {
|
||||
@Override
|
||||
public void inputComplete() {
|
||||
checkPasswd();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteContent() {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
bt_del.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
tv_hint.setText("");
|
||||
codeView.clearInputContent();
|
||||
}
|
||||
});
|
||||
bt_confirm.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
checkPasswd();
|
||||
}
|
||||
});
|
||||
|
||||
bt0.setOnClickListener(view1 -> add(codeView, "0"));
|
||||
bt1.setOnClickListener(view1 -> add(codeView, "1"));
|
||||
bt2.setOnClickListener(view1 -> add(codeView, "2"));
|
||||
bt3.setOnClickListener(view1 -> add(codeView, "3"));
|
||||
bt4.setOnClickListener(view1 -> add(codeView, "4"));
|
||||
bt5.setOnClickListener(view1 -> add(codeView, "5"));
|
||||
bt6.setOnClickListener(view1 -> add(codeView, "6"));
|
||||
bt7.setOnClickListener(view1 -> add(codeView, "7"));
|
||||
bt8.setOnClickListener(view1 -> add(codeView, "8"));
|
||||
bt9.setOnClickListener(view1 -> add(codeView, "9"));
|
||||
}
|
||||
|
||||
private void checkPasswd() {
|
||||
String content = codeView.getInputContent();
|
||||
if (TextUtils.isEmpty(content) || content.length() != 6) {
|
||||
return;
|
||||
}
|
||||
Log.e(TAG, "inputComplete: " + content);
|
||||
String password = Settings.Global.getString(getContentResolver(), CommonConfig.LOCK_SCREEN_PASSWORD);
|
||||
if ((!TextUtils.isEmpty(content) && !TextUtils.isEmpty(password))) {
|
||||
if (password.equals(content)) {
|
||||
startActivity(new Intent(PasswordActivity.this, AddIconActivity.class));
|
||||
finish();
|
||||
} else {
|
||||
setEmpty();
|
||||
tv_hint.setText("密码错误");
|
||||
}
|
||||
} else if (CommonConfig.DEFAULT_PASSWORD.equals(content)) {
|
||||
startActivity(new Intent(PasswordActivity.this, AddIconActivity.class));
|
||||
finish();
|
||||
} else {
|
||||
setEmpty();
|
||||
tv_hint.setText("密码错误");
|
||||
}
|
||||
}
|
||||
|
||||
private void setEmpty() {
|
||||
Handler.getMain().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
codeView.clearInputContent();
|
||||
tv_hint.setText("");
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
private void add(VerificationCodeView codeView, String text) {
|
||||
Log.e(TAG, "add: text = " + text);
|
||||
String oldText = codeView.getEditText().getText().toString();
|
||||
Log.e(TAG, "add: " + oldText);
|
||||
codeView.getEditText().setText(text);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -72,7 +72,6 @@ public class MoreAppActivity extends BaseActivity implements MoreContact.MoreVie
|
||||
recyclerView.addItemDecoration(new RecyclerViewSpacesItemDecoration(stringIntegerHashMap));
|
||||
mAppAdapter = new AppAdapter();
|
||||
recyclerView.setAdapter(mAppAdapter);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -81,6 +80,12 @@ public class MoreAppActivity extends BaseActivity implements MoreContact.MoreVie
|
||||
mPresenter.getInstalledApp();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
mPresenter.getInstalledApp();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
@@ -92,7 +97,7 @@ public class MoreAppActivity extends BaseActivity implements MoreContact.MoreVie
|
||||
@Override
|
||||
public void setDesktopIcons(List<DesktopIcon> desktopIcons) {
|
||||
mAppAdapter.setDesktopIcons(desktopIcons);
|
||||
tv_appsize.setText(String.format(getString(R.string.app_size), desktopIcons.size()));
|
||||
tv_appsize.setText(String.format(getString(R.string.app_size), desktopIcons.size() - 1));
|
||||
}
|
||||
|
||||
private AppChangedReceiver mAppChangedReceiver;
|
||||
|
||||
@@ -6,8 +6,9 @@ import android.util.Log;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.uiui.zyos.R;
|
||||
import com.uiui.zyos.bean.DesktopIcon;
|
||||
import com.uiui.zyos.utils.ApkUtils;
|
||||
import com.uiui.zyos.manager.AppManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -16,6 +17,7 @@ import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||
public class MorePresenter implements MoreContact.Presenter {
|
||||
private static final String TAG = MorePresenter.class.getSimpleName();
|
||||
|
||||
|
||||
private Context mContext;
|
||||
private MoreContact.MoreView mView;
|
||||
|
||||
@@ -46,7 +48,12 @@ public class MorePresenter implements MoreContact.Presenter {
|
||||
|
||||
@Override
|
||||
public void getInstalledApp() {
|
||||
ArrayList<DesktopIcon> desktopIcons = ApkUtils.queryFilterAppInfo(mContext);
|
||||
ArrayList<DesktopIcon> desktopIcons = AppManager.getInstance().getFilterAppList();
|
||||
DesktopIcon desktopIcon = new DesktopIcon();
|
||||
desktopIcon.setLable("添加应用");
|
||||
desktopIcon.setPackageName("com.zyos.add");
|
||||
desktopIcon.setIcon(mContext.getDrawable(R.drawable.icon_add));
|
||||
desktopIcons.add(desktopIcons.size(), desktopIcon);
|
||||
mView.setDesktopIcons(desktopIcons);
|
||||
}
|
||||
}
|
||||
|
||||
123
app/src/main/java/com/uiui/zyos/adapter/AddAppAdapter.java
Normal file
123
app/src/main/java/com/uiui/zyos/adapter/AddAppAdapter.java
Normal file
@@ -0,0 +1,123 @@
|
||||
package com.uiui.zyos.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.uiui.zyos.R;
|
||||
import com.uiui.zyos.activity.PasswordActivity;
|
||||
import com.uiui.zyos.bean.DesktopIcon;
|
||||
import com.uiui.zyos.config.CommonConfig;
|
||||
import com.uiui.zyos.manager.AppManager;
|
||||
import com.uiui.zyos.utils.ApkUtils;
|
||||
import com.uiui.zyos.utils.BitmapUtils;
|
||||
import com.uiui.zyos.utils.IconUtils;
|
||||
import com.uiui.zyos.utils.OpenApkUtils;
|
||||
import com.uiui.zyos.utils.ToastUtil;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class AddAppAdapter extends RecyclerView.Adapter<AddAppAdapter.AppHolder> {
|
||||
private static final String TAG = AddAppAdapter.class.getSimpleName();
|
||||
|
||||
private Context mContext;
|
||||
|
||||
private List<DesktopIcon> desktopIcons;
|
||||
|
||||
private Set<String> packageSet;
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public AppHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
mContext = parent.getContext();
|
||||
return new AppHolder(LayoutInflater.from(mContext).inflate(R.layout.item_add_app, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull AppHolder holder, int position) {
|
||||
DesktopIcon desktopIcon = desktopIcons.get(position);
|
||||
String lable = desktopIcon.getLable();
|
||||
holder.tv_appname.setText(lable);
|
||||
holder.iv_icon.setImageDrawable(desktopIcon.getIcon());
|
||||
String pkg = desktopIcon.getPackageName();
|
||||
|
||||
if (packageSet != null) {
|
||||
if (packageSet.contains(pkg)) {
|
||||
holder.iv_select.setImageDrawable(mContext.getDrawable(R.drawable.icon_selected));
|
||||
} else {
|
||||
holder.iv_select.setImageDrawable(mContext.getDrawable(R.drawable.icon_unselect));
|
||||
}
|
||||
}
|
||||
|
||||
Log.e(TAG, "getView: " + pkg);
|
||||
int i = IconUtils.appClassNameList.indexOf(pkg);
|
||||
if (i != -1) {
|
||||
String val = IconUtils.appIconList.get(i);
|
||||
int resID = mContext.getResources().getIdentifier(val, "drawable", "com.uiui.zyos");
|
||||
if (resID == 0) {
|
||||
Log.e(TAG, "getView: not found src : " + pkg);
|
||||
holder.iv_icon.setImageBitmap(BitmapUtils.getIconBitmap(mContext, desktopIcon.getIcon()));
|
||||
} else {
|
||||
holder.iv_icon.setImageDrawable(mContext.getResources().getDrawable(resID));
|
||||
}
|
||||
} else {
|
||||
if (AppManager.ADD_NAME.equals(pkg)) {
|
||||
holder.iv_icon.setImageDrawable(desktopIcon.getIcon());
|
||||
} else {
|
||||
holder.iv_icon.setImageBitmap(BitmapUtils.getIconBitmap(mContext, desktopIcon.getIcon()));
|
||||
}
|
||||
}
|
||||
holder.root.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (packageSet.contains(pkg)) {
|
||||
packageSet.remove(pkg);
|
||||
AppManager.getInstance().removePakcage(pkg);
|
||||
} else {
|
||||
packageSet.add(pkg);
|
||||
AppManager.getInstance().addPakcage(pkg);
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return desktopIcons == null ? 0 : desktopIcons.size();
|
||||
}
|
||||
|
||||
public void setDesktopIcons(List<DesktopIcon> desktopIcons) {
|
||||
this.desktopIcons = desktopIcons;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void setPackageSet(Set<String> packageSet) {
|
||||
this.packageSet = packageSet;
|
||||
}
|
||||
|
||||
class AppHolder extends RecyclerView.ViewHolder {
|
||||
ConstraintLayout root;
|
||||
TextView tv_appname;
|
||||
ImageView iv_icon, iv_select;
|
||||
|
||||
public AppHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
root = itemView.findViewById(R.id.root);
|
||||
tv_appname = itemView.findViewById(R.id.tv_appname);
|
||||
iv_icon = itemView.findViewById(R.id.iv_icon);
|
||||
iv_select = itemView.findViewById(R.id.iv_select);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.uiui.zyos.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
@@ -15,8 +16,10 @@ import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.uiui.zyos.R;
|
||||
import com.uiui.zyos.activity.PasswordActivity;
|
||||
import com.uiui.zyos.bean.DesktopIcon;
|
||||
import com.uiui.zyos.config.CommonConfig;
|
||||
import com.uiui.zyos.manager.AppManager;
|
||||
import com.uiui.zyos.utils.ApkUtils;
|
||||
import com.uiui.zyos.utils.AppUsedTimeUtils;
|
||||
import com.uiui.zyos.utils.BitmapUtils;
|
||||
@@ -60,19 +63,28 @@ public class AppAdapter extends RecyclerView.Adapter<AppAdapter.AppHolder> {
|
||||
holder.iv_icon.setImageDrawable(mContext.getResources().getDrawable(resID));
|
||||
}
|
||||
} else {
|
||||
holder.iv_icon.setImageBitmap(BitmapUtils.getIconBitmap(mContext, desktopIcon.getIcon()));
|
||||
if (AppManager.ADD_NAME.equals(pkg)) {
|
||||
holder.iv_icon.setImageDrawable(desktopIcon.getIcon());
|
||||
} else {
|
||||
holder.iv_icon.setImageBitmap(BitmapUtils.getIconBitmap(mContext, desktopIcon.getIcon()));
|
||||
}
|
||||
}
|
||||
holder.root.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
int setting_other_appInstaller = Settings.Global.getInt(mContext.getContentResolver(), CommonConfig.SETTING_OTHER_APPINSTALLER_KEY, 1);
|
||||
if (setting_other_appInstaller == 0
|
||||
&& !ApkUtils.isSystemApp(mContext, desktopIcon.getPackageName()
|
||||
)) {
|
||||
ToastUtil.show("已禁止应用打开");
|
||||
if (AppManager.ADD_NAME.equals(pkg)) {
|
||||
mContext.startActivity(new Intent(mContext, PasswordActivity.class));
|
||||
} else {
|
||||
OpenApkUtils.getInstance().openApp(desktopIcon.getPackageName(), desktopIcon.getClassName());
|
||||
int setting_other_appInstaller = Settings.Global.getInt(mContext.getContentResolver(), CommonConfig.SETTING_OTHER_APPINSTALLER_KEY, 1);
|
||||
if (setting_other_appInstaller == 0
|
||||
&& !ApkUtils.isSystemApp(mContext, desktopIcon.getPackageName()
|
||||
)) {
|
||||
ToastUtil.show("已禁止应用打开");
|
||||
} else {
|
||||
OpenApkUtils.getInstance().openApp(desktopIcon.getPackageName(), desktopIcon.getClassName());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.tencent.android.tpush.XGPushManager;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.uiui.zyos.BuildConfig;
|
||||
import com.uiui.zyos.alarm.AlarmUtils;
|
||||
import com.uiui.zyos.manager.AppManager;
|
||||
import com.uiui.zyos.manager.ConnectManager;
|
||||
import com.uiui.zyos.manager.RemoteManager;
|
||||
import com.uiui.zyos.network.NetInterfaceManager;
|
||||
@@ -49,6 +50,7 @@ public class BaseApplication extends Application {
|
||||
if (SystemUtils.isMainProcessName(this, android.os.Process.myPid())) {
|
||||
String rootDir = MMKV.initialize(this);
|
||||
Log.e(TAG, "mmkv root: " + rootDir);
|
||||
AppManager.init(this);
|
||||
Aria.init(this);
|
||||
Aria.get(this).getDownloadConfig().setMaxTaskNum(1);
|
||||
Aria.get(this).getDownloadConfig().setConvertSpeed(true);
|
||||
|
||||
@@ -357,6 +357,7 @@ public class UserFragment extends BaseFragment implements UserContact.UserView {
|
||||
super.onResume();
|
||||
Log.e(TAG, "onResume: ");
|
||||
setButtonVisibility();
|
||||
mPresenter.getInstalledApp();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,25 +9,24 @@ import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.trello.rxlifecycle4.android.FragmentEvent;
|
||||
import com.uiui.zyos.BuildConfig;
|
||||
import com.uiui.zyos.R;
|
||||
import com.uiui.zyos.bean.AppUsed;
|
||||
import com.uiui.zyos.bean.BaseResponse;
|
||||
import com.uiui.zyos.bean.DesktopIcon;
|
||||
import com.uiui.zyos.bean.SnInfo;
|
||||
import com.uiui.zyos.config.CommonConfig;
|
||||
import com.uiui.zyos.disklrucache.CacheHelper;
|
||||
import com.uiui.zyos.manager.AppManager;
|
||||
import com.uiui.zyos.manager.RemoteManager;
|
||||
import com.uiui.zyos.network.NetInterfaceManager;
|
||||
import com.uiui.zyos.network.UrlAddress;
|
||||
import com.uiui.zyos.utils.ApkUtils;
|
||||
import com.uiui.zyos.utils.CXAESUtil;
|
||||
import com.uiui.zyos.utils.Utils;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.function.ToLongFunction;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
@@ -107,7 +106,12 @@ public class UserPresenter implements UserContact.Presenter {
|
||||
|
||||
@Override
|
||||
public void getInstalledApp() {
|
||||
ArrayList<DesktopIcon> desktopIcons = ApkUtils.queryFilterAppInfo(mContext);
|
||||
ArrayList<DesktopIcon> desktopIcons = AppManager.getInstance().getFilterAppList();
|
||||
DesktopIcon desktopIcon = new DesktopIcon();
|
||||
desktopIcon.setLable("添加应用");
|
||||
desktopIcon.setPackageName("com.zyos.add");
|
||||
desktopIcon.setIcon(mContext.getDrawable(R.drawable.icon_add));
|
||||
desktopIcons.add(desktopIcons.size(), desktopIcon);
|
||||
mView.setInstalledApp(desktopIcons);
|
||||
}
|
||||
|
||||
|
||||
255
app/src/main/java/com/uiui/zyos/manager/AppManager.java
Normal file
255
app/src/main/java/com/uiui/zyos/manager/AppManager.java
Normal file
@@ -0,0 +1,255 @@
|
||||
package com.uiui.zyos.manager;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.uiui.zyos.bean.DesktopIcon;
|
||||
import com.uiui.zyos.config.CommonConfig;
|
||||
import com.uiui.zyos.utils.ApkUtils;
|
||||
|
||||
import java.text.Collator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class AppManager {
|
||||
private static final String TAG = AppManager.class.getSimpleName();
|
||||
|
||||
public static final String ADD_NAME = "com.zyos.add";
|
||||
private static final String SHOW_PACKAGE_KEY = "SHOW_PACKAGE_KEY";
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static AppManager sInstance;
|
||||
private Context mContext;
|
||||
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
private Set<String> showPackages;
|
||||
|
||||
public static void init(Context context) {
|
||||
if (context == null) {
|
||||
throw new RuntimeException("context is NULL");
|
||||
}
|
||||
if (sInstance == null) {
|
||||
Log.e(TAG, "init: ");
|
||||
sInstance = new AppManager(context);
|
||||
}
|
||||
}
|
||||
|
||||
public AppManager(Context context) {
|
||||
if (context == null) {
|
||||
throw new RuntimeException("Context is NULL");
|
||||
}
|
||||
this.mContext = context;
|
||||
this.showPackages = mMMKV.decodeStringSet(SHOW_PACKAGE_KEY, new HashSet<>());
|
||||
this.showPackages.removeIf(TextUtils::isEmpty);
|
||||
}
|
||||
|
||||
public static AppManager getInstance() {
|
||||
if (sInstance == null) {
|
||||
throw new IllegalStateException("You must be init AppManager first");
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public void addPakcage(String packageName) {
|
||||
this.showPackages.add(packageName);
|
||||
mMMKV.encode(SHOW_PACKAGE_KEY, showPackages);
|
||||
}
|
||||
|
||||
public void removePakcage(String packageName) {
|
||||
this.showPackages.remove(packageName);
|
||||
mMMKV.encode(SHOW_PACKAGE_KEY, showPackages);
|
||||
}
|
||||
|
||||
public Set<String> getFilterAppset() {
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
// 查询所有已经安装的应用程序
|
||||
List<ResolveInfo> resolveInfos = new ArrayList<>();
|
||||
// 创建一个类别为CATEGORY_LAUNCHER的该包名的Intent
|
||||
Intent resolveIntent = new Intent(Intent.ACTION_MAIN, null);
|
||||
resolveIntent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||
|
||||
// 通过getPackageManager()的queryIntentActivities方法遍历,得到所有能打开的app的packageName
|
||||
List<ResolveInfo> resolveinfoList = pm.queryIntentActivities(resolveIntent, 0);
|
||||
Set<String> allowPackages = resolveinfoList.stream().map(resolveInfo -> resolveInfo.activityInfo.packageName).collect(Collectors.toSet());
|
||||
|
||||
List<String> adminApp = RemoteManager.getInstance().getAdminApp();
|
||||
Log.i(TAG, "queryFilterAppInfo: adminapp = " + adminApp);
|
||||
for (ResolveInfo resolveInfo : resolveinfoList) {
|
||||
String pkg = resolveInfo.activityInfo.packageName;
|
||||
if (ApkUtils.appIsDisable(mContext, pkg)) {
|
||||
Log.e(TAG, "queryFilterAppInfo: disable = " + pkg);
|
||||
continue;
|
||||
}
|
||||
if (showPackages.contains(pkg)) {
|
||||
resolveInfos.add(resolveInfo);
|
||||
} else {
|
||||
//通过flag排除系统应用,会将电话、短信也排除掉
|
||||
if (ApkUtils.isSystemApp(mContext, pkg)) {
|
||||
if (ApkUtils.showPackageName.contains(pkg)) {
|
||||
resolveInfos.add(resolveInfo);
|
||||
}
|
||||
} else {
|
||||
if (allowPackages.contains(pkg) && !ApkUtils.excludePackageName.contains(pkg)) {
|
||||
if (adminApp.contains(pkg)) {
|
||||
resolveInfos.add(resolveInfo);
|
||||
} else if (ApkUtils.showPackageName.contains(pkg)) {
|
||||
resolveInfos.add(resolveInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Settings.Global.getInt(mContext.getContentResolver(), "is_activity", 0) == 0) {
|
||||
resolveInfos.removeIf(resolveInfo -> "com.uiui.city".equals(resolveInfo.activityInfo.packageName));
|
||||
}
|
||||
Set<String> desktopIcons = resolveInfos.stream().map(resolveInfo -> resolveInfo.activityInfo.packageName).collect(Collectors.toSet());
|
||||
return desktopIcons;
|
||||
}
|
||||
|
||||
|
||||
public ArrayList<DesktopIcon> getFilterAppList() {
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
// 查询所有已经安装的应用程序
|
||||
List<ResolveInfo> resolveInfos = new ArrayList<>();
|
||||
// 创建一个类别为CATEGORY_LAUNCHER的该包名的Intent
|
||||
Intent resolveIntent = new Intent(Intent.ACTION_MAIN, null);
|
||||
resolveIntent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||
|
||||
// 通过getPackageManager()的queryIntentActivities方法遍历,得到所有能打开的app的packageName
|
||||
List<ResolveInfo> resolveinfoList = pm.queryIntentActivities(resolveIntent, 0);
|
||||
Set<String> allowPackages = resolveinfoList.stream().map(resolveInfo -> resolveInfo.activityInfo.packageName).collect(Collectors.toSet());
|
||||
|
||||
|
||||
List<String> adminApp = RemoteManager.getInstance().getAdminApp();
|
||||
Log.i(TAG, "queryFilterAppInfo: adminapp = " + adminApp);
|
||||
for (ResolveInfo resolveInfo : resolveinfoList) {
|
||||
String pkg = resolveInfo.activityInfo.packageName;
|
||||
if (ApkUtils.appIsDisable(mContext, pkg)) {
|
||||
Log.e(TAG, "queryFilterAppInfo: disable = " + pkg);
|
||||
continue;
|
||||
}
|
||||
if (showPackages.contains(pkg)) {
|
||||
resolveInfos.add(resolveInfo);
|
||||
} else {
|
||||
//通过flag排除系统应用,会将电话、短信也排除掉
|
||||
if (ApkUtils.isSystemApp(mContext, pkg)) {
|
||||
if (ApkUtils.showPackageName.contains(pkg)) {
|
||||
resolveInfos.add(resolveInfo);
|
||||
}
|
||||
} else {
|
||||
if (allowPackages.contains(pkg) && !ApkUtils.excludePackageName.contains(pkg)) {
|
||||
if (adminApp.contains(pkg)) {
|
||||
resolveInfos.add(resolveInfo);
|
||||
} else if (ApkUtils.showPackageName.contains(pkg)) {
|
||||
resolveInfos.add(resolveInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Settings.Global.getInt(mContext.getContentResolver(), "is_activity", 0) == 0) {
|
||||
resolveInfos.removeIf(resolveInfo -> "com.uiui.city".equals(resolveInfo.activityInfo.packageName));
|
||||
}
|
||||
resolveInfos.sort(new Comparator<ResolveInfo>() {
|
||||
@Override
|
||||
public int compare(ResolveInfo o1, ResolveInfo o2) {
|
||||
return Collator.getInstance(Locale.CHINESE).compare(o1.loadLabel(pm).toString(), o2.loadLabel(pm).toString());
|
||||
}
|
||||
});
|
||||
resolveInfos.sort(new Comparator<ResolveInfo>() {
|
||||
@Override
|
||||
public int compare(ResolveInfo o1, ResolveInfo o2) {
|
||||
try {
|
||||
if ((pm.getApplicationInfo(o1.activityInfo.packageName, 0).flags & ApplicationInfo.FLAG_SYSTEM) <= (pm.getApplicationInfo(o2.activityInfo.packageName, 0).flags & ApplicationInfo.FLAG_SYSTEM)) {
|
||||
return 1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
ArrayList<DesktopIcon> desktopIcons = new ArrayList<>();
|
||||
for (ResolveInfo applicationInfo : resolveInfos) {
|
||||
if (!ApkUtils.excludeClassName.contains(applicationInfo.activityInfo.name)) {
|
||||
desktopIcons.add(DesktopIcon.creatDesktopIcon(mContext, applicationInfo));
|
||||
}
|
||||
}
|
||||
return desktopIcons;
|
||||
}
|
||||
|
||||
public ArrayList<DesktopIcon> getAllAppList() {
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
// 查询所有已经安装的应用程序
|
||||
List<ResolveInfo> resolveInfos = new ArrayList<>();
|
||||
// 创建一个类别为CATEGORY_LAUNCHER的该包名的Intent
|
||||
Intent resolveIntent = new Intent(Intent.ACTION_MAIN, null);
|
||||
resolveIntent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||
|
||||
// 通过getPackageManager()的queryIntentActivities方法遍历,得到所有能打开的app的packageName
|
||||
List<ResolveInfo> resolveinfoList = pm.queryIntentActivities(resolveIntent, 0);
|
||||
Set<String> allowPackages = resolveinfoList.stream().map(resolveInfo -> resolveInfo.activityInfo.packageName).collect(Collectors.toSet());
|
||||
|
||||
|
||||
List<String> adminApp = RemoteManager.getInstance().getAdminApp();
|
||||
Log.i(TAG, "queryFilterAppInfo: adminapp = " + adminApp);
|
||||
for (ResolveInfo resolveInfo : resolveinfoList) {
|
||||
String pkg = resolveInfo.activityInfo.packageName;
|
||||
if (ApkUtils.appIsDisable(mContext, pkg)) {
|
||||
Log.e(TAG, "queryFilterAppInfo: disable = " + pkg);
|
||||
continue;
|
||||
}
|
||||
if (ApkUtils.excludePackageName.contains(pkg)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
resolveInfos.add(resolveInfo);
|
||||
}
|
||||
if (Settings.Global.getInt(mContext.getContentResolver(), "is_activity", 0) == 0) {
|
||||
resolveInfos.removeIf(resolveInfo -> "com.uiui.city".equals(resolveInfo.activityInfo.packageName));
|
||||
}
|
||||
resolveInfos.sort(new Comparator<ResolveInfo>() {
|
||||
@Override
|
||||
public int compare(ResolveInfo o1, ResolveInfo o2) {
|
||||
return Collator.getInstance(Locale.CHINESE).compare(o1.loadLabel(pm).toString(), o2.loadLabel(pm).toString());
|
||||
}
|
||||
});
|
||||
resolveInfos.sort(new Comparator<ResolveInfo>() {
|
||||
@Override
|
||||
public int compare(ResolveInfo o1, ResolveInfo o2) {
|
||||
try {
|
||||
if ((pm.getApplicationInfo(o1.activityInfo.packageName, 0).flags & ApplicationInfo.FLAG_SYSTEM) <= (pm.getApplicationInfo(o2.activityInfo.packageName, 0).flags & ApplicationInfo.FLAG_SYSTEM)) {
|
||||
return 1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
ArrayList<DesktopIcon> desktopIcons = new ArrayList<>();
|
||||
for (ResolveInfo applicationInfo : resolveInfos) {
|
||||
desktopIcons.add(DesktopIcon.creatDesktopIcon(mContext, applicationInfo));
|
||||
}
|
||||
return desktopIcons;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -45,7 +45,7 @@ import io.reactivex.rxjava3.disposables.Disposable;
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
|
||||
public class ApkUtils {
|
||||
private static HashSet<String> excludePackageName = new HashSet<String>() {{
|
||||
public static final HashSet<String> excludePackageName = new HashSet<String>() {{
|
||||
this.add(BuildConfig.APPLICATION_ID);
|
||||
this.add("com.uiui.zy");
|
||||
this.add("com.uiui.zyos");
|
||||
@@ -88,11 +88,11 @@ public class ApkUtils {
|
||||
this.add("com.huawei.gamebox");
|
||||
}};
|
||||
|
||||
private static HashSet<String> excludeClassName = new HashSet<String>() {{
|
||||
public static final HashSet<String> excludeClassName = new HashSet<String>() {{
|
||||
this.add("com.android.dialer.app.calllog.CallLogActivity");
|
||||
}};
|
||||
|
||||
private static HashSet<String> showPackageName = new HashSet<String>() {{
|
||||
public static final HashSet<String> showPackageName = new HashSet<String>() {{
|
||||
this.add("com.android.dialer");
|
||||
// this.add("com.android.gallery3d");
|
||||
// this.add("com.android.settings");
|
||||
|
||||
BIN
app/src/main/res/drawable-hdpi/icon_add.png
Normal file
BIN
app/src/main/res/drawable-hdpi/icon_add.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_selected.png
Normal file
BIN
app/src/main/res/drawable-hdpi/icon_selected.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
BIN
app/src/main/res/drawable-hdpi/icon_unselect.png
Normal file
BIN
app/src/main/res/drawable-hdpi/icon_unselect.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
66
app/src/main/res/layout/activity_add_icon.xml
Normal file
66
app/src/main/res/layout/activity_add_icon.xml
Normal file
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".activity.AddIconActivity">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraintLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_32"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_back"
|
||||
android:layout_width="@dimen/dp_48"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/exit"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="添加应用"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_15"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_appsize"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_size"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_11"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="@dimen/dp_8"
|
||||
android:layout_marginTop="@dimen/dp_4"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
android:layout_marginBottom="@dimen/dp_4"
|
||||
android:fadeScrollbars="false"
|
||||
android:scrollbars="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/constraintLayout" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -67,7 +67,7 @@
|
||||
android:gravity="center"
|
||||
android:maxLines="2"
|
||||
android:minLines="2"
|
||||
android:text="退出系统"
|
||||
android:text="输入密码后添加应用到桌面"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_14"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
56
app/src/main/res/layout/item_add_app.xml
Normal file
56
app/src/main/res/layout/item_add_app.xml
Normal file
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/root"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_icon"
|
||||
android:layout_width="@dimen/dp_36"
|
||||
android:layout_height="@dimen/dp_36"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
android:layout_marginEnd="@dimen/dp_4"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@mipmap/ic_launcher" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_select"
|
||||
android:layout_width="@dimen/dp_12"
|
||||
android:layout_height="@dimen/dp_12"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/icon_unselect"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_icon"
|
||||
app:layout_constraintEnd_toEndOf="@+id/iv_icon" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_appname"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="@dimen/dp_4"
|
||||
android:gravity="center_horizontal"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_8"
|
||||
app:layout_constraintEnd_toEndOf="@+id/iv_icon"
|
||||
app:layout_constraintStart_toStartOf="@+id/iv_icon"
|
||||
app:layout_constraintTop_toBottomOf="@+id/iv_icon" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in New Issue
Block a user