version:6.1
fix: update:增加主页没有激活不显示天气
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
|
||||
|
||||
<!-- 允许访问网络,必选权限 -->
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<!-- 允许获取精确位置,精准定位必选 -->
|
||||
|
||||
@@ -31,13 +31,13 @@ import com.google.gson.reflect.TypeToken;
|
||||
import com.uiui.aios.BuildConfig;
|
||||
import com.uiui.aios.R;
|
||||
import com.uiui.aios.base.BaseActivity;
|
||||
import com.uiui.aios.base.BaseFragmentPagerAdapter;
|
||||
import com.uiui.aios.bean.AlarmItem;
|
||||
import com.uiui.aios.bean.DesktopIcon;
|
||||
import com.uiui.aios.dialog.PasswordDialog;
|
||||
import com.uiui.aios.fragment.AppListFragment;
|
||||
import com.uiui.aios.fragment.BaseFragmentPagerAdapter;
|
||||
import com.uiui.aios.fragment.CustomFragment;
|
||||
import com.uiui.aios.fragment.SecondFragment;
|
||||
import com.uiui.aios.fragment.custom.CustomFragment;
|
||||
import com.uiui.aios.service.NotificationService;
|
||||
import com.uiui.aios.utils.ApkUtils;
|
||||
import com.uiui.aios.utils.AppUsedTimeUtils;
|
||||
@@ -150,31 +150,6 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
|
||||
if (mFragments.size() > 1) {
|
||||
mViewPager.setCurrentItem(defaultCurrent);
|
||||
}
|
||||
|
||||
mHomeWatcher = new HomeWatcher(this);
|
||||
mHomeWatcher.setOnHomePressedListener(new HomeWatcher.OnHomePressedListener() {
|
||||
@Override
|
||||
public void onHomePressed() {
|
||||
//按了HOME键
|
||||
Log.e(TAG, "onHomePressed: ");
|
||||
int is_activation = Settings.Global.getInt(getContentResolver(), "uiui_activation", 0);
|
||||
Log.e(TAG, "onHomePressed: is_activation = " + is_activation);
|
||||
if (is_activation == 0) {
|
||||
LauncherUtils.openLauncher3(MainActivity.this);
|
||||
} else {
|
||||
if (!LauncherUtils.isDefaultHome(MainActivity.this)) {
|
||||
LauncherUtils.setDefaultDesktop(MainActivity.this, BuildConfig.APPLICATION_ID, this.getClass().getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHomeLongPressed() {
|
||||
Log.e(TAG, "onHomeLongPressed: ");
|
||||
//长按HOME键
|
||||
}
|
||||
});
|
||||
mHomeWatcher.startWatch();
|
||||
}
|
||||
|
||||
private void showPassword() {
|
||||
@@ -314,6 +289,10 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
return false;
|
||||
} else if (KeyEvent.KEYCODE_HOME == keyCode) {
|
||||
Log.e(TAG, "onKeyDown: keyCode = " + keyCode);
|
||||
//写要执行的动作或者任务
|
||||
android.os.Process.killProcess(android.os.Process.myPid());
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
@@ -357,7 +336,7 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
|
||||
gotoNotificationAccessSetting(this);
|
||||
}
|
||||
int is_activation = Settings.Global.getInt(getContentResolver(), "uiui_activation", 0);
|
||||
Log.e(TAG, "onHomePressed: is_activation = " + is_activation);
|
||||
Log.e(TAG, "onResume: is_activation = " + is_activation);
|
||||
if (is_activation == 1) {
|
||||
LauncherUtils.setDefaultDesktop(MainActivity.this, BuildConfig.APPLICATION_ID, this.getClass().getName());
|
||||
} else {
|
||||
@@ -366,6 +345,36 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
|
||||
addData();
|
||||
mMainPresenter.sendRunningInfo();
|
||||
mMainPresenter.getAdminSnSetting();
|
||||
addHomeWatcher();
|
||||
}
|
||||
|
||||
private void addHomeWatcher() {
|
||||
if (mHomeWatcher == null) {
|
||||
mHomeWatcher = new HomeWatcher(this);
|
||||
}
|
||||
mHomeWatcher.setOnHomePressedListener(new HomeWatcher.OnHomePressedListener() {
|
||||
@Override
|
||||
public void onHomePressed() {
|
||||
//按了HOME键
|
||||
Log.e(TAG, "onHomePressed: ");
|
||||
int is_activation = Settings.Global.getInt(getContentResolver(), "uiui_activation", 0);
|
||||
Log.e(TAG, "onHomePressed: is_activation = " + is_activation);
|
||||
if (is_activation == 0) {
|
||||
LauncherUtils.openLauncher3(MainActivity.this);
|
||||
} else {
|
||||
if (!LauncherUtils.isDefaultHome(MainActivity.this)) {
|
||||
LauncherUtils.setDefaultDesktop(MainActivity.this, BuildConfig.APPLICATION_ID, this.getClass().getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHomeLongPressed() {
|
||||
Log.e(TAG, "onHomeLongPressed: ");
|
||||
//长按HOME键
|
||||
}
|
||||
});
|
||||
mHomeWatcher.startWatch();
|
||||
}
|
||||
|
||||
private static final String ENABLED_NOTIFICATION_LISTENERS = "enabled_notification_listeners";
|
||||
@@ -421,6 +430,9 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
if (mHomeWatcher != null) {
|
||||
mHomeWatcher.stopWatch();// 在销毁时停止监听,不然会报错的。
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -436,9 +448,6 @@ public class MainActivity extends BaseActivity implements MainContact.MainView {
|
||||
if (mNewAppReceiver != null) {
|
||||
unregisterReceiver(mNewAppReceiver);
|
||||
}
|
||||
if (mHomeWatcher != null) {
|
||||
mHomeWatcher.stopWatch();// 在销毁时停止监听,不然会报错的。
|
||||
}
|
||||
}
|
||||
|
||||
private void registmNewAppReceiver() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.uiui.aios.fragment;
|
||||
package com.uiui.aios.base;
|
||||
|
||||
import android.util.SparseArray;
|
||||
|
||||
251
app/src/main/java/com/uiui/aios/dialog/CustomDialog.java
Normal file
251
app/src/main/java/com/uiui/aios/dialog/CustomDialog.java
Normal file
@@ -0,0 +1,251 @@
|
||||
package com.uiui.aios.dialog;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import com.uiui.aios.R;
|
||||
|
||||
|
||||
/**
|
||||
* description:自定义dialog
|
||||
*/
|
||||
|
||||
public class CustomDialog extends AlertDialog {
|
||||
/**
|
||||
* 显示的图片
|
||||
*/
|
||||
private ImageView imageIv;
|
||||
|
||||
/**
|
||||
* 显示的标题
|
||||
*/
|
||||
private TextView titleTv;
|
||||
|
||||
/**
|
||||
* 显示的消息
|
||||
*/
|
||||
private TextView messageTv;
|
||||
|
||||
/**
|
||||
* 确认和取消按钮
|
||||
*/
|
||||
private TextView positiveBn;
|
||||
private TextView negtiveBn;
|
||||
|
||||
/**
|
||||
* 按钮之间的分割线
|
||||
*/
|
||||
// private View columnLineView;
|
||||
|
||||
private Context mContext;
|
||||
|
||||
public CustomDialog(Context context) {
|
||||
super(context, R.style.CustomDialog);
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
/**
|
||||
* 都是内容数据
|
||||
*/
|
||||
private String message;
|
||||
private String title;
|
||||
private String positive, negtive;
|
||||
private int imageResId = -1;
|
||||
|
||||
/**
|
||||
* 底部是否只有一个按钮
|
||||
*/
|
||||
private boolean isSingle = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.custom_dialog);
|
||||
//按空白处不能取消动画
|
||||
setCanceledOnTouchOutside(false);
|
||||
//初始化界面控件
|
||||
initView();
|
||||
//初始化界面数据
|
||||
refreshView();
|
||||
//初始化界面控件的事件
|
||||
initEvent();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化界面的确定和取消监听器
|
||||
*/
|
||||
private void initEvent() {
|
||||
//设置确定按钮被点击后,向外界提供监听
|
||||
positiveBn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (onClickBottomListener != null) {
|
||||
onClickBottomListener.onPositiveClick();
|
||||
}
|
||||
}
|
||||
});
|
||||
//设置取消按钮被点击后,向外界提供监听
|
||||
negtiveBn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (onClickBottomListener != null) {
|
||||
onClickBottomListener.onNegtiveClick();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化界面控件的显示数据
|
||||
*/
|
||||
private void refreshView() {
|
||||
//如果用户自定了title和message
|
||||
if (!TextUtils.isEmpty(title)) {
|
||||
titleTv.setText(title);
|
||||
titleTv.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
titleTv.setVisibility(View.GONE);
|
||||
}
|
||||
if (!TextUtils.isEmpty(message)) {
|
||||
messageTv.setText(message);
|
||||
}
|
||||
//如果设置按钮的文字
|
||||
if (!TextUtils.isEmpty(positive)) {
|
||||
positiveBn.setText(positive);
|
||||
} else {
|
||||
positiveBn.setText("确定");
|
||||
}
|
||||
if (!TextUtils.isEmpty(negtive)) {
|
||||
negtiveBn.setText(negtive);
|
||||
} else {
|
||||
negtiveBn.setText("取消");
|
||||
}
|
||||
|
||||
if (imageResId != -1) {
|
||||
imageIv.setImageResource(imageResId);
|
||||
imageIv.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
imageIv.setVisibility(View.GONE);
|
||||
}
|
||||
/**
|
||||
* 只显示一个按钮的时候隐藏取消按钮,回掉只执行确定的事件
|
||||
*/
|
||||
// if (isSingle) {
|
||||
//// columnLineView.setVisibility(View.GONE);
|
||||
// negtiveBn.setVisibility(View.GONE);
|
||||
// } else {
|
||||
// negtiveBn.setVisibility(View.VISIBLE);
|
||||
//// columnLineView.setVisibility(View.VISIBLE);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
super.show();
|
||||
refreshView();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化界面控件
|
||||
*/
|
||||
private void initView() {
|
||||
negtiveBn = findViewById(R.id.negtive);
|
||||
positiveBn = findViewById(R.id.positive);
|
||||
titleTv = findViewById(R.id.title);
|
||||
messageTv = findViewById(R.id.message);
|
||||
imageIv = findViewById(R.id.image);
|
||||
// columnLineView = findViewById(R.id.column_line);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置确定取消按钮的回调
|
||||
*/
|
||||
private OnClickBottomListener onClickBottomListener;
|
||||
|
||||
public void setOnClickBottomListener(OnClickBottomListener onClickBottomListener) {
|
||||
this.onClickBottomListener = onClickBottomListener;
|
||||
}
|
||||
|
||||
public interface OnClickBottomListener {
|
||||
/**
|
||||
* 点击确定按钮事件
|
||||
*/
|
||||
void onPositiveClick();
|
||||
|
||||
/**
|
||||
* 点击取消按钮事件
|
||||
*/
|
||||
void onNegtiveClick();
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public CustomDialog setMessage(String message) {
|
||||
this.message = message;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public CustomDialog setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getPositive() {
|
||||
return positive;
|
||||
}
|
||||
|
||||
public CustomDialog setPositive(String positive) {
|
||||
this.positive = positive;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNegtive() {
|
||||
return negtive;
|
||||
}
|
||||
|
||||
public CustomDialog setNegtive(String negtive) {
|
||||
this.negtive = negtive;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CustomDialog setNegtiveText(String negtive) {
|
||||
negtiveBn.setText(negtive);
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getImageResId() {
|
||||
return imageResId;
|
||||
}
|
||||
|
||||
public boolean isSingle() {
|
||||
return isSingle;
|
||||
}
|
||||
|
||||
public CustomDialog setSingle(boolean single) {
|
||||
isSingle = single;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CustomDialog setImageResId(int imageResId) {
|
||||
this.imageResId = imageResId;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
super.dismiss();
|
||||
}
|
||||
}
|
||||
@@ -14,14 +14,17 @@ import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.FragmentEvent;
|
||||
import com.uiui.aios.R;
|
||||
import com.uiui.aios.base.BaseFragment;
|
||||
import com.uiui.aios.bean.BaseResponse;
|
||||
import com.uiui.aios.bean.DesktopIcon;
|
||||
import com.uiui.aios.dialog.CustomDialog;
|
||||
import com.uiui.aios.dialog.PasswordDialog;
|
||||
import com.uiui.aios.network.NetInterfaceManager;
|
||||
import com.uiui.aios.service.NotificationService;
|
||||
@@ -36,6 +39,7 @@ import com.uiui.aios.view.MyGridLayout;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
@@ -44,7 +48,7 @@ import io.reactivex.rxjava3.disposables.Disposable;
|
||||
* Use the {@link AppListFragment#newInstance} factory method to
|
||||
* create an instance of this fragment.
|
||||
*/
|
||||
public class AppListFragment extends Fragment {
|
||||
public class AppListFragment extends BaseFragment {
|
||||
// TODO: Rename parameter arguments, choose names that match
|
||||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||
private static final String ARG_PARAM1 = "param1";
|
||||
@@ -178,7 +182,7 @@ public class AppListFragment extends Fragment {
|
||||
int is_activation = Settings.Global.getInt(mContext.getContentResolver(), "uiui_activation", 0);
|
||||
if (is_activation == 0) {
|
||||
LauncherUtils.openLauncher3(mContext);
|
||||
}else {
|
||||
} else {
|
||||
showPassword();
|
||||
}
|
||||
break;
|
||||
@@ -190,9 +194,74 @@ public class AppListFragment extends Fragment {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLongClick(View v, int index) {
|
||||
DesktopIcon desktopIcon = mDesktopIcons.get(index);
|
||||
String pkg = desktopIcon.getPackageName();
|
||||
Log.e(TAG, "onLongClick: " + pkg);
|
||||
switch (pkg) {
|
||||
case "aios.exit":
|
||||
case "com.uiui.sn":
|
||||
break;
|
||||
default:
|
||||
showHinDialog(pkg, desktopIcon.getLable());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateAppDisableStatus(String pkg, String label) {
|
||||
NetInterfaceManager.getInstance().getUpdateAppIconObservable(pkg, label, 0)
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycleSubject, FragmentEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("updateAppDisableStatus", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse baseResponse) {
|
||||
Log.e("updateAppDisableStatus", "onNext: " + baseResponse);
|
||||
if (baseResponse.code == 200) {
|
||||
ApkUtils.disableApp(mContext, pkg);
|
||||
} else {
|
||||
ToastUtil.show("隐藏失败,检查网络连接");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("updateAppDisableStatus", "onError: ");
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("updateAppDisableStatus", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showHinDialog(String pkg, String label) {
|
||||
CustomDialog customDialog = new CustomDialog(mContext);
|
||||
customDialog.setTitle("隐藏应用");
|
||||
customDialog.setMessage("是否要隐藏:" + label);
|
||||
customDialog.setOnClickBottomListener(new CustomDialog.OnClickBottomListener() {
|
||||
@Override
|
||||
public void onPositiveClick() {
|
||||
updateAppDisableStatus(pkg, label);
|
||||
customDialog.dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNegtiveClick() {
|
||||
customDialog.dismiss();
|
||||
}
|
||||
});
|
||||
customDialog.show();
|
||||
}
|
||||
|
||||
private void showPassword() {
|
||||
PasswordDialog passwordDialog = new PasswordDialog(mContext);
|
||||
passwordDialog.setTitle("退出关怀系统");
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.uiui.aios.fragment.custom;
|
||||
|
||||
|
||||
import com.uiui.aios.base.BasePresenter;
|
||||
import com.uiui.aios.base.BaseView;
|
||||
import com.uiui.aios.bean.AlarmClockData;
|
||||
import com.uiui.aios.bean.SnInfo;
|
||||
import com.uiui.aios.bean.UserAvatarInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CustomContact {
|
||||
public interface Presenter extends BasePresenter<CustomView> {
|
||||
void getSnIsActivation();
|
||||
void getSnInfo();
|
||||
void getUserAvatarInfo();
|
||||
void getAlarmClock();
|
||||
}
|
||||
|
||||
public interface CustomView extends BaseView {
|
||||
void setSnIsActivation(boolean activation);
|
||||
void setSnInfo(SnInfo snInfo);
|
||||
void setUserAvatarInfo(UserAvatarInfo userAvatarInfo);
|
||||
void setAlarmClock(List<AlarmClockData> clockDataList);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.uiui.aios.fragment;
|
||||
package com.uiui.aios.fragment.custom;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
@@ -50,10 +50,9 @@ import com.uiui.aios.activity.contact.ContactActivity;
|
||||
import com.uiui.aios.activity.weather.WeatherActivity;
|
||||
import com.uiui.aios.adapter.NotificationAdapter;
|
||||
import com.uiui.aios.adapter.SOSNnmberAdapter;
|
||||
import com.uiui.aios.alarm.AlarmUtils;
|
||||
import com.uiui.aios.base.BaseFragment;
|
||||
import com.uiui.aios.bean.AlarmClockData;
|
||||
import com.uiui.aios.bean.AlarmItem;
|
||||
import com.uiui.aios.bean.BaseResponse;
|
||||
import com.uiui.aios.bean.Contact;
|
||||
import com.uiui.aios.bean.HealthCode;
|
||||
import com.uiui.aios.bean.SnInfo;
|
||||
@@ -73,14 +72,10 @@ import com.uiui.aios.utils.Utils;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
|
||||
/**
|
||||
@@ -88,12 +83,14 @@ import io.reactivex.rxjava3.disposables.Disposable;
|
||||
* Use the {@link CustomFragment#newInstance} factory method to
|
||||
* create an instance of this fragment.
|
||||
*/
|
||||
public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkStatusChangedListener {
|
||||
public class CustomFragment extends BaseFragment implements CustomContact.CustomView, NetworkUtils.OnNetworkStatusChangedListener {
|
||||
// @BindView(R.id.cl_alarm)
|
||||
// ConstraintLayout cl_alarm;
|
||||
|
||||
@BindView(R.id.cl_weather)
|
||||
ConstraintLayout cl_weather;
|
||||
@BindView(R.id.cl_activation)
|
||||
ConstraintLayout cl_activation;
|
||||
@BindView(R.id.cl_clean)
|
||||
ConstraintLayout cl_shared_space;
|
||||
@BindView(R.id.cl_sos)
|
||||
@@ -157,6 +154,7 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
private Activity mContext;
|
||||
private ContentResolver mCRv;
|
||||
private CacheHelper mCacheHelper;
|
||||
private CustomPresenter mCustomPresenter;
|
||||
|
||||
// TODO: Rename parameter arguments, choose names that match
|
||||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||
@@ -332,6 +330,9 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
// Inflate the layout for this fragment
|
||||
rootView = inflater.inflate(R.layout.fragment_custom, container, false);
|
||||
mContext = (Activity) rootView.getContext();
|
||||
mCustomPresenter = new CustomPresenter(mContext);
|
||||
mCustomPresenter.attachView(this);
|
||||
mCustomPresenter.setLifecycle(lifecycleSubject);
|
||||
mCacheHelper = new CacheHelper(mContext);
|
||||
mCRv = mContext.getContentResolver();
|
||||
ButterKnife.bind(this, rootView);
|
||||
@@ -406,6 +407,12 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
startActivity(new Intent(mContext, WeatherActivity.class));
|
||||
}
|
||||
});
|
||||
cl_activation.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
ApkUtils.openApp(mContext, "com.uiui.sn");
|
||||
}
|
||||
});
|
||||
cl_shared_space.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -513,51 +520,60 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
NetInterfaceManager.getInstance().getSnInfo(new NetInterfaceManager.SnInfoCallback() {
|
||||
@Override
|
||||
public void setSnInfo(SnInfo snInfo) {
|
||||
if (snInfo != null) {
|
||||
if (TextUtils.isEmpty(snInfo.getSn_name())) {
|
||||
// tv_name.setText("未设置");
|
||||
} else {
|
||||
// tv_name.setText(snInfo.getSn_name());
|
||||
}
|
||||
} else {
|
||||
// tv_name.setText("未设置");
|
||||
}
|
||||
}
|
||||
});
|
||||
NetInterfaceManager.getInstance().getUserAvatarInfoControl()
|
||||
.subscribe(new Observer<BaseResponse<UserAvatarInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getUserAvatarInfoControl", "onSubscribe: ");
|
||||
}
|
||||
mCustomPresenter.getSnIsActivation();
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<UserAvatarInfo> userAvatarInfoBaseResponse) {
|
||||
Log.e("getUserAvatarInfoControl", "onNext: " + userAvatarInfoBaseResponse);
|
||||
if (userAvatarInfoBaseResponse.code == 200) {
|
||||
if (!mContext.isDestroyed()) {
|
||||
// Glide.with(iv_head).load(userAvatarInfoBaseResponse.data.getAvatar()).into(iv_head);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getUserAvatarInfoControl", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getUserAvatarInfoControl", "onComplete: ");
|
||||
}
|
||||
});
|
||||
initAmap();
|
||||
// getAlarmClock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSnIsActivation(boolean activation) {
|
||||
if (activation) {
|
||||
cl_weather.setVisibility(View.VISIBLE);
|
||||
cl_activation.setVisibility(View.GONE);
|
||||
} else {
|
||||
cl_weather.setVisibility(View.GONE);
|
||||
cl_activation.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mCustomPresenter.getSnInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSnInfo(SnInfo snInfo) {
|
||||
if (snInfo != null) {
|
||||
if (TextUtils.isEmpty(snInfo.getSn_name())) {
|
||||
// tv_name.setText("未设置");
|
||||
} else {
|
||||
// tv_name.setText(snInfo.getSn_name());
|
||||
}
|
||||
} else {
|
||||
// tv_name.setText("未设置");
|
||||
}
|
||||
mCustomPresenter.getUserAvatarInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUserAvatarInfo(UserAvatarInfo userAvatarInfo) {
|
||||
if (userAvatarInfo != null && userAvatarInfo.getAvatar() != null) {
|
||||
if (!mContext.isDestroyed()) {
|
||||
// Glide.with(iv_head).load(userAvatarInfo.getAvatar()).into(iv_head);
|
||||
}
|
||||
}
|
||||
mCustomPresenter.getAlarmClock();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlarmClock(List<AlarmClockData> clockDataList) {
|
||||
if (clockDataList != null && clockDataList.size() != 0) {
|
||||
notificationAdapter.setDataList(clockDataList);
|
||||
rv_noti.setVisibility(View.VISIBLE);
|
||||
iv_note_nodata.setVisibility(View.GONE);
|
||||
} else {
|
||||
rv_noti.setVisibility(View.GONE);
|
||||
iv_note_nodata.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
@@ -574,6 +590,7 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
// setAlarm();
|
||||
getAlarmClock();
|
||||
setSosNumber();
|
||||
mCustomPresenter.getSnIsActivation();
|
||||
}
|
||||
|
||||
private void openScheme(String uri) {
|
||||
@@ -601,7 +618,7 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
return;
|
||||
}
|
||||
|
||||
NetInterfaceManager.getInstance().getSnInfo(new NetInterfaceManager.SnInfoCallback() {
|
||||
NetInterfaceManager.getInstance().getSnInfo(lifecycleSubject, new NetInterfaceManager.SnInfoCallback() {
|
||||
@Override
|
||||
public void setSnInfo(SnInfo snInfo) {
|
||||
if (snInfo == null || TextUtils.isEmpty(snInfo.getMobile())) {
|
||||
@@ -686,33 +703,7 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
}
|
||||
|
||||
private void getAlarmClock() {
|
||||
NetInterfaceManager.getInstance().getAlarmClock(new NetInterfaceManager.AlarmClockCallback() {
|
||||
@Override
|
||||
public void setAlarmClock(List<AlarmClockData> alarmClockList) {
|
||||
AlarmClockData alarmClockData = AlarmUtils.getInstance().getRecentAlarmClock();
|
||||
List<AlarmClockData> data = new ArrayList<>();
|
||||
if (alarmClockData != null) {
|
||||
data.add(alarmClockData);
|
||||
notificationAdapter.setDataList(data);
|
||||
rv_noti.setVisibility(View.VISIBLE);
|
||||
iv_note_nodata.setVisibility(View.GONE);
|
||||
} else {
|
||||
rv_noti.setVisibility(View.GONE);
|
||||
iv_note_nodata.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlarmClockEmpty() {
|
||||
rv_noti.setVisibility(View.GONE);
|
||||
iv_note_nodata.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showNoData(String title, String msg) {
|
||||
@@ -825,7 +816,10 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
private void killBackgroundApp() {
|
||||
List<String> pkgList = ApkUtils.queryFilterAppList(mContext);
|
||||
for (String pkg : pkgList) {
|
||||
if (pkg.equalsIgnoreCase(BuildConfig.APPLICATION_ID)) continue;
|
||||
if (pkg.equalsIgnoreCase(BuildConfig.APPLICATION_ID)
|
||||
|| "com.tencent.mm".equals(pkg)) {
|
||||
continue;
|
||||
}
|
||||
killBackgroundProcesses(pkg);
|
||||
}
|
||||
refreshMemory();
|
||||
@@ -865,6 +859,7 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
mCustomPresenter.detachView();
|
||||
NetworkUtils.unregisterNetworkStatusChangedListener(this);
|
||||
if (batteryReceiver != null) {
|
||||
mContext.unregisterReceiver(batteryReceiver);
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.uiui.aios.fragment;
|
||||
package com.uiui.aios.fragment.custom;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
@@ -0,0 +1,162 @@
|
||||
package com.uiui.aios.fragment.custom;
|
||||
|
||||
import android.content.Context;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.FragmentEvent;
|
||||
import com.uiui.aios.alarm.AlarmUtils;
|
||||
import com.uiui.aios.bean.AlarmClockData;
|
||||
import com.uiui.aios.bean.BaseResponse;
|
||||
import com.uiui.aios.bean.SnInfo;
|
||||
import com.uiui.aios.bean.UserAvatarInfo;
|
||||
import com.uiui.aios.network.NetInterfaceManager;
|
||||
import com.uiui.aios.utils.GsonUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||
|
||||
public class CustomPresenter implements CustomContact.Presenter {
|
||||
private static final String TAG = CustomPresenter.class.getSimpleName();
|
||||
private Context mContext;
|
||||
private CustomContact.CustomView mView;
|
||||
|
||||
public CustomPresenter(Context context) {
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
private BehaviorSubject<FragmentEvent> lifecycle;
|
||||
|
||||
void setLifecycle(BehaviorSubject<FragmentEvent> lifecycle) {
|
||||
this.lifecycle = lifecycle;
|
||||
}
|
||||
|
||||
public BehaviorSubject<FragmentEvent> getLifecycle() {
|
||||
return lifecycle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attachView(@NonNull CustomContact.CustomView view) {
|
||||
this.mView = view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detachView() {
|
||||
this.mView = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSnIsActivation() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getSnIsActivationObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, FragmentEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getSnIsActivation", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse baseResponse) {
|
||||
Log.e("getSnIsActivation", "onNext: " + baseResponse);
|
||||
if (baseResponse.code == 200) {
|
||||
JsonObject jsonObject = GsonUtils.getJsonObject(baseResponse.data.toString());
|
||||
int is_activation = jsonObject.get("is_activation").getAsInt();
|
||||
Settings.Global.putInt(mContext.getContentResolver(), "uiui_activation", is_activation);
|
||||
mView.setSnIsActivation(is_activation == 1);
|
||||
// mView.setSnIsActivation(false);
|
||||
} else {
|
||||
mView.setSnIsActivation(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getSnIsActivation", "onError: " + e.getMessage());
|
||||
int is_activation = Settings.Global.getInt(mContext.getContentResolver(), "uiui_activation", 0);
|
||||
mView.setSnIsActivation(is_activation == 1);
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getSnIsActivation", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSnInfo() {
|
||||
NetInterfaceManager.getInstance().getSnInfo(getLifecycle(), new NetInterfaceManager.SnInfoCallback() {
|
||||
@Override
|
||||
public void setSnInfo(SnInfo snInfo) {
|
||||
mView.setSnInfo(snInfo);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getUserAvatarInfo() {
|
||||
NetInterfaceManager.getInstance()
|
||||
.getUserAvatarInfoControl()
|
||||
.compose(RxLifecycle.bindUntilEvent(getLifecycle(), FragmentEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<UserAvatarInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getUserAvatarInfoControl", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse<UserAvatarInfo> userAvatarInfoBaseResponse) {
|
||||
Log.e("getUserAvatarInfoControl", "onNext: " + userAvatarInfoBaseResponse);
|
||||
mView.setUserAvatarInfo(userAvatarInfoBaseResponse.data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getUserAvatarInfoControl", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getUserAvatarInfoControl", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAlarmClock() {
|
||||
NetInterfaceManager.getInstance().getAlarmClock(new NetInterfaceManager.AlarmClockCallback() {
|
||||
@Override
|
||||
public void setAlarmClock(List<AlarmClockData> alarmClockList) {
|
||||
AlarmClockData alarmClockData = AlarmUtils.getInstance().getRecentAlarmClock();
|
||||
if (alarmClockData != null) {
|
||||
List<AlarmClockData> data = new ArrayList<>();
|
||||
data.add(alarmClockData);
|
||||
mView.setAlarmClock(data);
|
||||
} else {
|
||||
mView.setAlarmClock(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlarmClockEmpty() {
|
||||
mView.setAlarmClock(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -43,7 +43,9 @@ import com.uiui.aios.network.api.SNInfoApi;
|
||||
import com.uiui.aios.network.api.SOSRecordApi;
|
||||
import com.uiui.aios.network.api.SendScreenshotApi;
|
||||
import com.uiui.aios.network.api.Setting;
|
||||
import com.uiui.aios.network.api.SnIsActivationApi;
|
||||
import com.uiui.aios.network.api.UpdateAlarmClockApi;
|
||||
import com.uiui.aios.network.api.UpdateAppIconApi;
|
||||
import com.uiui.aios.network.api.UpdateDesktopApi;
|
||||
import com.uiui.aios.network.api.UserInfoControl;
|
||||
import com.uiui.aios.network.interceptor.RepeatRequestInterceptor;
|
||||
@@ -255,6 +257,20 @@ public class NetInterfaceManager {
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse> getSnIsActivationObservable() {
|
||||
return mRetrofit.create(SnIsActivationApi.class)
|
||||
.getSnIsActivation(Utils.getSerial())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse> getUpdateAppIconObservable(String pkg, String label, int type) {
|
||||
return mRetrofit.create(UpdateAppIconApi.class)
|
||||
.appIconUpdate(Utils.getSerial(), pkg, type, label)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
|
||||
public interface onCompleteCallback {
|
||||
void onComplete();
|
||||
@@ -776,8 +792,9 @@ public class NetInterfaceManager {
|
||||
void setSnInfo(SnInfo snInfo);
|
||||
}
|
||||
|
||||
public void getSnInfo(SnInfoCallback callback) {
|
||||
public void getSnInfo(BehaviorSubject<FragmentEvent> lifecycle, SnInfoCallback callback) {
|
||||
getsnInfoControl()
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, FragmentEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<SnInfo>>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
|
||||
@@ -2,6 +2,9 @@ package com.uiui.aios.network;
|
||||
|
||||
public class URLAddress {
|
||||
public static final String ROOT_URL = "https://led.zuoyepad.com/android/";
|
||||
|
||||
/*获取设备是否激活*/
|
||||
public static final String GET_SN_IS_ACTIVATION = "sn/getSnIsActivation";
|
||||
/*设备信息接口*/
|
||||
public static final String SNINFO = "sn/getSnInfo";
|
||||
/*获取用户头像和信息*/
|
||||
@@ -42,6 +45,8 @@ public class URLAddress {
|
||||
public static final String GET_MAIL_LIST = "Control/getMailList";
|
||||
/*获取负二屏开关*/
|
||||
public static final String GET_ADMIN_SN_SETTING = "getAdminSnSetting";
|
||||
/*更新app隐藏或者显示状态*/
|
||||
public static final String APP_ICON_UPDATE = "Control/appIconUpdate";
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.uiui.aios.network.api;
|
||||
|
||||
import com.uiui.aios.bean.BaseResponse;
|
||||
import com.uiui.aios.network.URLAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface SnIsActivationApi {
|
||||
@GET(URLAddress.GET_SN_IS_ACTIVATION)
|
||||
Observable<BaseResponse> getSnIsActivation(
|
||||
@Query("sn") String sn
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.uiui.aios.network.api;
|
||||
|
||||
import com.uiui.aios.bean.BaseResponse;
|
||||
import com.uiui.aios.network.URLAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
public interface UpdateAppIconApi {
|
||||
@FormUrlEncoded
|
||||
@POST(URLAddress.APP_ICON_UPDATE)
|
||||
Observable<BaseResponse> appIconUpdate(
|
||||
@Field("sn") String sn,
|
||||
@Field("app_package") String app_package,
|
||||
@Field("type") int type,//类型 1显示 0隐藏
|
||||
@Field("app_name") String app_name
|
||||
);
|
||||
}
|
||||
@@ -48,16 +48,17 @@ public class ApkUtils {
|
||||
this.add("org.chromium.browser");
|
||||
this.add("com.sprd.sprdnote");
|
||||
this.add("com.android.deskclock");
|
||||
this.add("com.alldocube.store");
|
||||
this.add("com.android.email");
|
||||
this.add("com.android.calendar");
|
||||
this.add("com.android.uiuios");
|
||||
this.add("com.uiui.os");
|
||||
this.add("com.uiui.health");
|
||||
this.add("com.tencent.android.qqdownloader");
|
||||
this.add("com.uiui.appstore");
|
||||
// this.add("com.tencent.android.qqdownloader");
|
||||
// this.add("com.alldocube.store");
|
||||
}};
|
||||
private static HashSet<String> showPackageName = new HashSet<String>() {{
|
||||
this.add("com.uiui.sn");
|
||||
this.add("com.android.dialer");
|
||||
this.add("com.android.gallery3d");
|
||||
this.add("com.android.settings");
|
||||
@@ -66,10 +67,18 @@ public class ApkUtils {
|
||||
this.add("com.mediatek.camera");
|
||||
this.add("com.android.mms");
|
||||
this.add("com.uiui.city");
|
||||
this.add("com.alldocube.store");
|
||||
this.add("com.android.fmradio");
|
||||
this.add("com.android.documentsui");
|
||||
this.add("com.android.calculator2");
|
||||
this.add("cn.wps.moffice_eng");
|
||||
this.add("com.baidu.searchbox.lite");
|
||||
this.add("com.ss.android.article.video");
|
||||
this.add("com.ss.android.ugc.aweme");
|
||||
this.add("com.smile.gifmaker");
|
||||
this.add("com.kuaikan.comic");
|
||||
this.add("com.jxw.launcher");
|
||||
this.add("com.tencent.android.qqdownloader");
|
||||
this.add("com.alldocube.store");
|
||||
}};
|
||||
private static HashSet<String> allHintPackage = new HashSet<String>() {{
|
||||
this.add("com.android.uiuios");
|
||||
@@ -177,6 +186,7 @@ public class ApkUtils {
|
||||
}
|
||||
if (Settings.Global.getInt(context.getContentResolver(), "is_activity", 0) == 0) {
|
||||
applicationInfos.removeIf(applicationInfo -> "com.uiui.city".equals(applicationInfo.packageName));
|
||||
// applicationInfos.removeIf(applicationInfo -> "com.uiui.sn".equals(applicationInfo.packageName));
|
||||
}
|
||||
|
||||
applicationInfos.sort(new Comparator<ApplicationInfo>() {
|
||||
@@ -220,11 +230,20 @@ public class ApkUtils {
|
||||
return desktopIcons;
|
||||
}
|
||||
|
||||
private static boolean appIsDisable(Context context, String pkg) {
|
||||
public static boolean appIsDisable(Context context, String pkg) {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
return pm.getApplicationEnabledSetting(pkg) == PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
|
||||
}
|
||||
|
||||
public static boolean disableApp(Context context, String pkg) {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
try {
|
||||
pm.setApplicationEnabledSetting(pkg, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, 0);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取第三方应用
|
||||
|
||||
@@ -7,7 +7,6 @@ import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
|
||||
import com.uiui.aios.R;
|
||||
import com.uiui.aios.bean.DesktopIcon;
|
||||
|
||||
@@ -143,6 +142,8 @@ public class MyGridLayout extends ViewGroup {
|
||||
|
||||
public interface OnItemClickListener {
|
||||
void onItemClick(View v, int index);
|
||||
|
||||
void onLongClick(View v, int index);
|
||||
}
|
||||
|
||||
private ArrayList<DesktopIcon> applicationInfos;
|
||||
@@ -164,12 +165,18 @@ public class MyGridLayout extends ViewGroup {
|
||||
final int index = i;
|
||||
View view = getChildAt(i);
|
||||
view.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
click.onItemClick(v, index);
|
||||
}
|
||||
});
|
||||
view.setOnLongClickListener(new OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View view) {
|
||||
click.onLongClick(view, index);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (applicationInfos.get(index) == null) {
|
||||
view.setClickable(false);
|
||||
} else {
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 5.0 KiB |
BIN
app/src/main/res/drawable-hdpi/home_activation_icon.png
Normal file
BIN
app/src/main/res/drawable-hdpi/home_activation_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
@@ -25,7 +25,8 @@
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:layout_weight="3"
|
||||
android:background="@drawable/custom_bg_weather">
|
||||
android:background="@drawable/custom_bg_weather"
|
||||
android:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_pic"
|
||||
@@ -72,8 +73,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:text="位置"
|
||||
android:textSize="@dimen/sp_16"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_16"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_temp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_temp" />
|
||||
@@ -92,6 +93,56 @@
|
||||
app:layout_constraintTop_toTopOf="@+id/tv_location" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_activation"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
android:layout_marginTop="@dimen/dp_4"
|
||||
android:layout_marginEnd="@dimen/dp_4"
|
||||
android:layout_marginBottom="@dimen/dp_2"
|
||||
android:layout_weight="3"
|
||||
android:visibility="gone"
|
||||
android:background="@drawable/custom_bg_weather">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_activation"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
android:text="激活关怀系统"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_17"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView8"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:text="当前系统未激活,立即激活系统"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_36"
|
||||
android:layout_height="@dimen/dp_36"
|
||||
android:layout_marginEnd="@dimen/dp_32"
|
||||
android:src="@drawable/home_activation_icon"
|
||||
app:layout_constraintEnd_toEndOf="@+id/textView8"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView8" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_clean"
|
||||
android:layout_width="0dp"
|
||||
@@ -117,27 +168,27 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!-- <ImageView-->
|
||||
<!-- android:id="@+id/iv_head"-->
|
||||
<!-- android:layout_width="@dimen/dp_68"-->
|
||||
<!-- android:layout_height="@dimen/dp_68"-->
|
||||
<!-- android:adjustViewBounds="true"-->
|
||||
<!-- android:scaleType="fitCenter"-->
|
||||
<!-- android:src="@drawable/home_clean_icon"-->
|
||||
<!-- 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_head"-->
|
||||
<!-- android:layout_width="@dimen/dp_68"-->
|
||||
<!-- android:layout_height="@dimen/dp_68"-->
|
||||
<!-- android:adjustViewBounds="true"-->
|
||||
<!-- android:scaleType="fitCenter"-->
|
||||
<!-- android:src="@drawable/home_clean_icon"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent" />-->
|
||||
|
||||
<com.king.view.circleprogressview.CircleProgressView
|
||||
android:id="@+id/cpv"
|
||||
android:layout_width="144dp"
|
||||
android:layout_height="144dp"
|
||||
app:cpvDuration="1000"
|
||||
app:cpvLabelTextSize="26sp"
|
||||
app:cpvProgressColor="#27602f"
|
||||
app:cpvLabelTextColor="@color/white"
|
||||
app:cpvLabelTextSize="26sp"
|
||||
app:cpvNormalColor="#c1d4c4"
|
||||
app:cpvProgressColor="#27602f"
|
||||
app:cpvShowTick="false"
|
||||
app:cpvStrokeWidth="@dimen/dp_8"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
||||
@@ -25,14 +25,15 @@
|
||||
android:layout_marginEnd="@dimen/dp_4"
|
||||
android:layout_marginBottom="@dimen/dp_2"
|
||||
android:layout_weight="3"
|
||||
android:background="@drawable/custom_bg_weather">
|
||||
android:background="@drawable/custom_bg_weather"
|
||||
android:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_pic"
|
||||
android:layout_width="@dimen/dp_100"
|
||||
android:layout_height="@dimen/dp_100"
|
||||
android:adjustViewBounds="true"
|
||||
android:layout_marginEnd="@dimen/dp_16"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/he100"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -72,8 +73,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_4"
|
||||
android:text="位置"
|
||||
android:textSize="@dimen/sp_18"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_18"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="@+id/tv_temp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_temp" />
|
||||
@@ -93,6 +94,56 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_temp" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_activation"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="@dimen/dp_4"
|
||||
android:layout_marginTop="@dimen/dp_4"
|
||||
android:layout_marginEnd="@dimen/dp_4"
|
||||
android:layout_marginBottom="@dimen/dp_2"
|
||||
android:layout_weight="3"
|
||||
android:background="@drawable/custom_bg_weather"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_activation"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_16"
|
||||
android:layout_marginTop="@dimen/dp_16"
|
||||
android:text="激活关怀系统"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_17"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView8"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="2"
|
||||
android:singleLine="true"
|
||||
android:text="当前系统未激活,立即激活系统"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_16"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_36"
|
||||
android:layout_height="@dimen/dp_36"
|
||||
android:layout_marginEnd="@dimen/dp_32"
|
||||
android:src="@drawable/home_activation_icon"
|
||||
app:layout_constraintEnd_toEndOf="@+id/textView8"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView8" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
@@ -128,8 +179,8 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="绿码同行更畅快"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:text="绿码同行更畅快"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintStart_toStartOf="@+id/textView"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView" />
|
||||
@@ -149,15 +200,15 @@
|
||||
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/tv_name"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginTop="@dimen/dp_2"-->
|
||||
<!-- android:textColor="@color/black"-->
|
||||
<!-- android:textStyle="bold"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="@+id/iv_health"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="@+id/iv_health"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/iv_health" />-->
|
||||
<!-- android:id="@+id/tv_name"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginTop="@dimen/dp_2"-->
|
||||
<!-- android:textColor="@color/black"-->
|
||||
<!-- android:textStyle="bold"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="@+id/iv_health"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="@+id/iv_health"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/iv_health" />-->
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -195,10 +246,10 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="危险请按我"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintStart_toStartOf="@+id/textView7"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView7" />
|
||||
@@ -255,25 +306,25 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:maxLines="1"
|
||||
android:singleLine="true"
|
||||
android:text="卡顿就按我"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintStart_toStartOf="@+id/textView5"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView5" />
|
||||
|
||||
<!-- <ImageView-->
|
||||
<!-- android:id="@+id/iv_head"-->
|
||||
<!-- android:layout_width="@dimen/dp_52"-->
|
||||
<!-- android:layout_height="@dimen/dp_52"-->
|
||||
<!-- android:layout_marginEnd="24dp"-->
|
||||
<!-- android:adjustViewBounds="true"-->
|
||||
<!-- android:scaleType="fitCenter"-->
|
||||
<!-- android:src="@drawable/home_clean_icon"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent" />-->
|
||||
<!-- <ImageView-->
|
||||
<!-- android:id="@+id/iv_head"-->
|
||||
<!-- android:layout_width="@dimen/dp_52"-->
|
||||
<!-- android:layout_height="@dimen/dp_52"-->
|
||||
<!-- android:layout_marginEnd="24dp"-->
|
||||
<!-- android:adjustViewBounds="true"-->
|
||||
<!-- android:scaleType="fitCenter"-->
|
||||
<!-- android:src="@drawable/home_clean_icon"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent" />-->
|
||||
|
||||
<com.king.view.circleprogressview.CircleProgressView
|
||||
android:id="@+id/cpv"
|
||||
@@ -281,10 +332,10 @@
|
||||
android:layout_height="@dimen/dp_64"
|
||||
android:layout_marginEnd="@dimen/dp_8"
|
||||
app:cpvDuration="1000"
|
||||
app:cpvLabelTextSize="26sp"
|
||||
app:cpvLabelTextColor="@color/white"
|
||||
app:cpvProgressColor="#27602f"
|
||||
app:cpvLabelTextSize="26sp"
|
||||
app:cpvNormalColor="#c1d4c4"
|
||||
app:cpvProgressColor="#27602f"
|
||||
app:cpvShowTick="false"
|
||||
app:cpvStrokeWidth="@dimen/dp_4"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
||||
122
app/src/main/res/layout/custom_dialog.xml
Normal file
122
app/src/main/res/layout/custom_dialog.xml
Normal file
@@ -0,0 +1,122 @@
|
||||
<?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"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="@dimen/dp_300"
|
||||
android:layout_height="@dimen/dp_200"
|
||||
android:layout_centerInParent="true"
|
||||
android:background="@drawable/bg_dialog"
|
||||
android:minWidth="@dimen/dp_240"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="@dimen/dp_8"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="@dimen/dp_30"
|
||||
android:layout_height="@dimen/dp_30"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:maxWidth="@dimen/dp_80"
|
||||
android:maxHeight="@dimen/dp_80"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/sp_18"
|
||||
android:textStyle="bold"
|
||||
android:visibility="visible"
|
||||
tools:text="消息提示" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_20"
|
||||
android:layout_marginEnd="@dimen/dp_20"
|
||||
android:gravity="center"
|
||||
android:lineSpacingExtra="@dimen/dp_3"
|
||||
android:lineSpacingMultiplier="1.2"
|
||||
android:minHeight="@dimen/dp_50"
|
||||
android:textColor="#999999"
|
||||
android:textSize="@dimen/sp_14"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="提示消息提示消息提示消息提示消息提示消息" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/linearLayout3"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dp_20"
|
||||
android:layout_marginStart="@dimen/dp_56"
|
||||
android:layout_marginEnd="@dimen/dp_56"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/positive"
|
||||
android:layout_width="@dimen/dp_64"
|
||||
android:layout_height="@dimen/dp_28"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/join_background"
|
||||
android:gravity="center"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_14"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="确定" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/negtive"
|
||||
android:layout_width="@dimen/dp_64"
|
||||
android:layout_height="@dimen/dp_28"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/joined_background"
|
||||
android:gravity="center"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_14"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="取消" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in New Issue
Block a user