version:1.7
fix: update:修改布局,爱心守护播放视频,
@@ -52,7 +52,7 @@
|
||||
android:enabled="true"
|
||||
android:exported="true" />
|
||||
<service
|
||||
android:name=".service.MainService"
|
||||
android:name=".service.main.MainService"
|
||||
android:enabled="true"
|
||||
android:exported="true">
|
||||
<intent-filter android:priority="1000">
|
||||
|
||||
@@ -4,6 +4,7 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.app.StatusBarManager;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
@@ -22,6 +23,7 @@ import android.widget.TextView;
|
||||
import com.uiui.os.R;
|
||||
import com.uiui.os.bean.BaseResponse;
|
||||
import com.uiui.os.network.NetInterfaceManager;
|
||||
import com.uiui.os.receiver.BootReceiver;
|
||||
import com.uiui.os.utils.ToastUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -57,6 +59,12 @@ public class EmergencyActivity extends AppCompatActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_emergency);
|
||||
ButterKnife.bind(this);
|
||||
|
||||
//发送紧急广播
|
||||
Intent bootIntent = new Intent(BootReceiver.SOS);
|
||||
bootIntent.setComponent(new ComponentName("com.uiui.sn", "com.uiui.sn.receiver.BootReceiver"));
|
||||
sendBroadcast(bootIntent);
|
||||
|
||||
Intent intent = getIntent();
|
||||
// String setting_sos = intent.getStringExtra("setting_sos");
|
||||
// if (TextUtils.isEmpty(setting_sos)) {
|
||||
@@ -84,23 +92,23 @@ public class EmergencyActivity extends AppCompatActivity {
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("SOSRecord", "onSubscribe: ");
|
||||
Log.e("SOSRecordApi", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse baseResponse) {
|
||||
Log.e("SOSRecord", "onNext: " + baseResponse);
|
||||
Log.e("SOSRecordApi", "onNext: " + baseResponse);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("SOSRecord", "onError: " + e.getMessage());
|
||||
Log.e("SOSRecordApi", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("SOSRecord", "onComplete: ");
|
||||
Log.e("SOSRecordApi", "onComplete: ");
|
||||
}
|
||||
});
|
||||
needDial = true;
|
||||
|
||||
@@ -10,13 +10,19 @@ import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.blankj.utilcode.util.FileUtils;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.uiui.os.R;
|
||||
import com.uiui.os.bean.AlarmClockData;
|
||||
import com.uiui.os.bean.BaseResponse;
|
||||
import com.uiui.os.network.NetInterfaceManager;
|
||||
import com.uiui.os.utils.AlarmUtils;
|
||||
import com.uiui.os.utils.FileUtil;
|
||||
import com.uiui.os.utils.Utils;
|
||||
import com.uiui.os.view.JzvdStdAssert;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@@ -24,22 +30,33 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import cn.jzvd.Jzvd;
|
||||
import cn.jzvd.JzvdStd;
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
public class NoticeActivity extends AppCompatActivity {
|
||||
@BindView(R.id.tv_title)
|
||||
TextView tv_title;
|
||||
@BindView(R.id.bt_ok)
|
||||
Button bt_ok;
|
||||
@BindView(R.id.constraintLayout)
|
||||
ConstraintLayout constraintLayout;
|
||||
@BindView(R.id.cl_voice)
|
||||
ConstraintLayout cl_voice;
|
||||
@BindView(R.id.cl_vp)
|
||||
ConstraintLayout cl_vp;
|
||||
@BindView(R.id.jz_video)
|
||||
JzvdStdAssert jz_video;
|
||||
@BindView(R.id.imageView)
|
||||
ImageView imageView;
|
||||
|
||||
private AlarmClockData alarmClockData;
|
||||
int code;
|
||||
private MediaPlayer mediaPlayer;
|
||||
|
||||
private String TAG = NoticeActivity.class.getSimpleName();
|
||||
|
||||
@Override
|
||||
@@ -63,7 +80,7 @@ public class NoticeActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
private void showData(AlarmClockData alarmClockData) {
|
||||
tv_title.setText(alarmClockData.getRemarks());
|
||||
tv_title.setText(alarmClockData.getTitle());
|
||||
bt_ok.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -76,14 +93,41 @@ public class NoticeActivity extends AppCompatActivity {
|
||||
data.add(alarm);
|
||||
}
|
||||
AlarmUtils.getInstance().setAlarmString(data);
|
||||
finish();
|
||||
NetInterfaceManager.getInstance()
|
||||
.getUpdateAlarmObservable(alarmClockData.getId())
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("showData", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull BaseResponse baseResponse) {
|
||||
Log.e("showData", "onNext: " + baseResponse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("showData", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("showData", "onComplete: ");
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
String url = alarmClockData.getVoice();
|
||||
String md5 = alarmClockData.getVoice_md5();
|
||||
if (!TextUtils.isEmpty(url)) {
|
||||
constraintLayout.setVisibility(View.VISIBLE);
|
||||
String fileName = Utils.getFileNamefromURL(url);
|
||||
String voiceUrl = alarmClockData.getVoice();
|
||||
String voicemd5 = alarmClockData.getVoice_md5();
|
||||
String filePath = alarmClockData.getFile();
|
||||
|
||||
if (!TextUtils.isEmpty(voiceUrl)) {
|
||||
cl_voice.setVisibility(View.VISIBLE);
|
||||
String fileName = Utils.getFileNamefromURL(voiceUrl);
|
||||
File file = new File(Utils.getDownLoadPath(NoticeActivity.this) + fileName);
|
||||
String fileMD5 = FileUtils.getFileMD5ToString(file);
|
||||
// if (!md5.equals(fileMD5)) {
|
||||
@@ -107,8 +151,26 @@ public class NoticeActivity extends AppCompatActivity {
|
||||
}
|
||||
// }
|
||||
} else {
|
||||
constraintLayout.setVisibility(View.GONE);
|
||||
cl_voice.setVisibility(View.GONE);
|
||||
}
|
||||
if (!TextUtils.isEmpty(filePath)) {
|
||||
cl_vp.setVisibility(View.VISIBLE);
|
||||
String fileType = FileUtil.getFileType(filePath);
|
||||
Log.e(TAG, "showData: " + fileType);
|
||||
if (FileUtil.isPictureFile(fileType)) {
|
||||
jz_video.setVisibility(View.GONE);
|
||||
imageView.setVisibility(View.VISIBLE);
|
||||
Glide.with(NoticeActivity.this).load(filePath).into(imageView);
|
||||
} else if (FileUtil.isVideoFile(fileType)) {
|
||||
jz_video.setVisibility(View.VISIBLE);
|
||||
imageView.setVisibility(View.GONE);
|
||||
jz_video.setUp(filePath, "");
|
||||
jz_video.startVideo();
|
||||
}
|
||||
} else {
|
||||
cl_vp.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -122,4 +184,18 @@ public class NoticeActivity extends AppCompatActivity {
|
||||
mediaPlayer = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (Jzvd.backPress()) {
|
||||
return;
|
||||
}
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
Jzvd.releaseAllVideos();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,20 +23,17 @@ import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.alarmclock.uiui.IAlarmAidlInterface;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.uiui.os.BuildConfig;
|
||||
import com.uiui.os.R;
|
||||
import com.uiui.os.base.BaseActivity;
|
||||
import com.uiui.os.bean.AlarmItem;
|
||||
import com.uiui.os.bean.BaseResponse;
|
||||
import com.uiui.os.bean.DesktopIcon;
|
||||
import com.uiui.os.fragment.AppListFragment;
|
||||
import com.uiui.os.fragment.BaseFragmentPagerAdapter;
|
||||
import com.uiui.os.fragment.CustomFragment;
|
||||
import com.uiui.os.network.NetInterfaceManager;
|
||||
import com.uiui.os.utils.APKUtils;
|
||||
import com.uiui.os.utils.AppUsedTimeUtils;
|
||||
import com.uiui.os.utils.Utils;
|
||||
import com.uiui.os.view.ScaleCircleNavigator;
|
||||
|
||||
import net.lucode.hackware.magicindicator.MagicIndicator;
|
||||
@@ -48,22 +45,21 @@ import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
public class MainActivity extends BaseActivity {
|
||||
private String TAG = MainActivity.class.getSimpleName();
|
||||
public class MainActivity extends BaseActivity implements MainContact.MainView {
|
||||
private static String TAG = MainActivity.class.getSimpleName();
|
||||
private MainPresenter mMainPresenter;
|
||||
|
||||
@BindView(R.id.viewPager)
|
||||
ViewPager viewPager;
|
||||
ViewPager mViewPager;
|
||||
@BindView(R.id.magicIndicator)
|
||||
MagicIndicator magicIndicator;
|
||||
MagicIndicator mMagicIndicator;
|
||||
|
||||
private FragmentManager fragmentManager;
|
||||
private FragmentTransaction fragmentTransaction;
|
||||
private BaseFragmentPagerAdapter adapter;
|
||||
private List<Fragment> fragments;
|
||||
private CustomFragment customFragment;
|
||||
private FragmentManager mFragmentManager;
|
||||
private FragmentTransaction mFragmentTransaction;
|
||||
private BaseFragmentPagerAdapter mBaseFragmentPagerAdapter;
|
||||
private List<Fragment> mFragments;
|
||||
private CustomFragment mCustomFragment;
|
||||
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
@@ -73,13 +69,59 @@ public class MainActivity extends BaseActivity {
|
||||
@Override
|
||||
public void initView() {
|
||||
ButterKnife.bind(this);
|
||||
fragmentManager = getSupportFragmentManager();
|
||||
fragmentTransaction = fragmentManager.beginTransaction();
|
||||
fragments = new ArrayList<>();
|
||||
adapter = new BaseFragmentPagerAdapter(fragmentManager, fragments);
|
||||
mMainPresenter = new MainPresenter(this);
|
||||
mMainPresenter.attachView(this);
|
||||
mMainPresenter.setLifecycle(lifecycleSubject);
|
||||
|
||||
mFragmentManager = getSupportFragmentManager();
|
||||
mFragmentTransaction = mFragmentManager.beginTransaction();
|
||||
mFragments = new ArrayList<>();
|
||||
mBaseFragmentPagerAdapter = new BaseFragmentPagerAdapter(mFragmentManager, mFragments);
|
||||
// fragmentTransaction.add(R.id.viewPager, appListFragment);
|
||||
// fragmentTransaction.commit();
|
||||
customFragment = new CustomFragment();
|
||||
mCustomFragment = new CustomFragment();
|
||||
mFragments.add(mCustomFragment);
|
||||
|
||||
mMainPresenter.getDesktopLayout();
|
||||
ArrayList<DesktopIcon> desktopIcons = APKUtils.queryFilterAppInfo(this);
|
||||
|
||||
int x = 0;
|
||||
for (int i = 0; i <= desktopIcons.size(); i++) {
|
||||
if (i != 0 && i % APP_LIST_SIZE == 0) {
|
||||
AppListFragment appListFragment = new AppListFragment();
|
||||
appListFragment.setAppList(new ArrayList<>(desktopIcons.subList(x, i)));
|
||||
mFragments.add(appListFragment);
|
||||
x = i;
|
||||
} else if (i == desktopIcons.size()) {
|
||||
AppListFragment appListFragment = new AppListFragment();
|
||||
mFragments.add(appListFragment);
|
||||
appListFragment.setAppList(new ArrayList<>(desktopIcons.subList(x, i)));
|
||||
}
|
||||
}
|
||||
|
||||
ScaleCircleNavigator scaleCircleNavigator = new ScaleCircleNavigator(this);
|
||||
scaleCircleNavigator.setCircleCount(mFragments.size());
|
||||
scaleCircleNavigator.setNormalCircleColor(Color.DKGRAY);
|
||||
scaleCircleNavigator.setSelectedCircleColor(Color.LTGRAY);
|
||||
scaleCircleNavigator.setCircleClickListener(new ScaleCircleNavigator.OnCircleClickListener() {
|
||||
@Override
|
||||
public void onClick(int index) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
mViewPager.setAdapter(mBaseFragmentPagerAdapter);
|
||||
mMagicIndicator.setNavigator(scaleCircleNavigator);
|
||||
ViewPagerHelper.bind(mMagicIndicator, mViewPager);
|
||||
if (mFragments.size() > 1) {
|
||||
mViewPager.setCurrentItem(1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
registmNewAppReceiver();
|
||||
registerSOSNumberReceiver();
|
||||
mAlarmServiceConnection = new ServiceConnection() {
|
||||
@Override
|
||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
||||
@@ -97,27 +139,6 @@ public class MainActivity extends BaseActivity {
|
||||
bindAlarmService();
|
||||
}
|
||||
|
||||
private void getAlarmData() {
|
||||
if (mIAlarmAidlInterface == null) {
|
||||
bindAlarmService();
|
||||
return;
|
||||
}
|
||||
try {
|
||||
String json = mIAlarmAidlInterface.getAlarm();
|
||||
Log.e(TAG, "onServiceConnected: " + json);
|
||||
if ("暂无闹钟".equalsIgnoreCase(json) || TextUtils.isEmpty(json)) {
|
||||
customFragment.setAlarmItem(null);
|
||||
return;
|
||||
}
|
||||
Type type = new TypeToken<List<AlarmItem>>() {
|
||||
}.getType();
|
||||
List<AlarmItem> alarmItem = new Gson().fromJson(json, type);
|
||||
customFragment.setAlarmItem(alarmItem);
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private ServiceConnection mAlarmServiceConnection;
|
||||
private IAlarmAidlInterface mIAlarmAidlInterface;
|
||||
|
||||
@@ -134,48 +155,32 @@ public class MainActivity extends BaseActivity {
|
||||
}
|
||||
}
|
||||
|
||||
private final static int APP_LIST_SIZE = 12;
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
registmNewAppReceiver();
|
||||
registerSOSNumberReceiver();
|
||||
fragments.add(customFragment);
|
||||
ArrayList<ApplicationInfo> applicationInfoList = APKUtils.queryFilterAppInfo(this);
|
||||
int x = 0;
|
||||
for (int i = 0; i <= applicationInfoList.size(); i++) {
|
||||
if (i != 0 && i % APP_LIST_SIZE == 0) {
|
||||
AppListFragment appListFragment = new AppListFragment();
|
||||
appListFragment.setAppList(new ArrayList<>(applicationInfoList.subList(x, i)));
|
||||
fragments.add(appListFragment);
|
||||
x = i;
|
||||
} else if (i == applicationInfoList.size()) {
|
||||
AppListFragment appListFragment = new AppListFragment();
|
||||
fragments.add(appListFragment);
|
||||
appListFragment.setAppList(new ArrayList<>(applicationInfoList.subList(x, i)));
|
||||
}
|
||||
private void getAlarmData() {
|
||||
if (mIAlarmAidlInterface == null) {
|
||||
bindAlarmService();
|
||||
return;
|
||||
}
|
||||
viewPager.setAdapter(adapter);
|
||||
ScaleCircleNavigator scaleCircleNavigator = new ScaleCircleNavigator(this);
|
||||
scaleCircleNavigator.setCircleCount(fragments.size());
|
||||
scaleCircleNavigator.setNormalCircleColor(Color.DKGRAY);
|
||||
scaleCircleNavigator.setSelectedCircleColor(Color.LTGRAY);
|
||||
scaleCircleNavigator.setCircleClickListener(new ScaleCircleNavigator.OnCircleClickListener() {
|
||||
@Override
|
||||
public void onClick(int index) {
|
||||
|
||||
try {
|
||||
String json = mIAlarmAidlInterface.getAlarm();
|
||||
Log.e(TAG, "onServiceConnected: " + json);
|
||||
if ("暂无闹钟".equalsIgnoreCase(json) || TextUtils.isEmpty(json)) {
|
||||
mCustomFragment.setAlarmItem(null);
|
||||
return;
|
||||
}
|
||||
});
|
||||
magicIndicator.setNavigator(scaleCircleNavigator);
|
||||
ViewPagerHelper.bind(magicIndicator, viewPager);
|
||||
if (fragments.size() > 1) {
|
||||
viewPager.setCurrentItem(1);
|
||||
Type type = new TypeToken<List<AlarmItem>>() {
|
||||
}.getType();
|
||||
List<AlarmItem> alarmItem = new Gson().fromJson(json, type);
|
||||
mCustomFragment.setAlarmItem(alarmItem);
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private final static int APP_LIST_SIZE = 3 * 4;
|
||||
|
||||
private void addData() {
|
||||
List<Fragment> fragmentList = new ArrayList<>();
|
||||
ArrayList<ApplicationInfo> applicationInfoList = APKUtils.queryFilterAppInfo(this);
|
||||
ArrayList<DesktopIcon> applicationInfoList = APKUtils.queryFilterAppInfo(this);
|
||||
int x = 0;
|
||||
for (int i = 0; i <= applicationInfoList.size(); i++) {
|
||||
if (i != 0 && i % APP_LIST_SIZE == 0) {
|
||||
@@ -190,13 +195,13 @@ public class MainActivity extends BaseActivity {
|
||||
}
|
||||
}
|
||||
for (int i = 1; i <= fragmentList.size(); i++) {
|
||||
if (fragments.get(i) != null) {
|
||||
adapter.replaceFragment(i, fragmentList.get(i - 1));
|
||||
fragments.remove(i);
|
||||
fragments.add(i, fragmentList.get(i - 1));
|
||||
if (mFragments.get(i) != null) {
|
||||
mBaseFragmentPagerAdapter.replaceFragment(i, fragmentList.get(i - 1));
|
||||
mFragments.remove(i);
|
||||
mFragments.add(i, fragmentList.get(i - 1));
|
||||
} else {
|
||||
adapter.addFragment(fragmentList.get(i - 1));
|
||||
fragments.add(fragmentList.get(i - 1));
|
||||
mBaseFragmentPagerAdapter.addFragment(fragmentList.get(i - 1));
|
||||
mFragments.add(fragmentList.get(i - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -221,7 +226,7 @@ public class MainActivity extends BaseActivity {
|
||||
default:
|
||||
break;
|
||||
case Intent.ACTION_MAIN:
|
||||
viewPager.setCurrentItem(1);
|
||||
mViewPager.setCurrentItem(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -231,14 +236,6 @@ public class MainActivity extends BaseActivity {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (mNewAppReceiver != null) {
|
||||
unregisterReceiver(mNewAppReceiver);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
@@ -250,86 +247,13 @@ public class MainActivity extends BaseActivity {
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
SendRunningApp(MainActivity.this);
|
||||
mMainPresenter.sendRunningInfo();
|
||||
}
|
||||
|
||||
private void SendRunningApp(Context context) {
|
||||
AppUsedTimeUtils.getInstance().setAppPackageName(BuildConfig.APPLICATION_ID);
|
||||
AppUsedTimeUtils.getInstance().setStartTime(System.currentTimeMillis());
|
||||
long time = AppUsedTimeUtils.getInstance().getStartTime();
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("app_package", BuildConfig.APPLICATION_ID);
|
||||
jsonObject.addProperty("version_name", APKUtils.getAPPVersionName(context, BuildConfig.APPLICATION_ID));
|
||||
jsonObject.addProperty("start_time", time / 1000);
|
||||
String jsonString = jsonObject.toString();
|
||||
Log.e(TAG, "SendRunningApp: " + jsonString);
|
||||
NetInterfaceManager.getInstance()
|
||||
.getRunningAppObservable(jsonString)
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("SendRunningApp", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse baseResponse) {
|
||||
Log.e("SendRunningApp", "onSubscribe: " + baseResponse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("SendRunningApp", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("SendRunningApp", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onRestart() {
|
||||
super.onRestart();
|
||||
AppUsedTimeUtils.getInstance().setEndTime(System.currentTimeMillis());
|
||||
String packagename = AppUsedTimeUtils.getInstance().getAppPackageName();
|
||||
Log.e(TAG, "onRestart packagename == " + packagename);
|
||||
if (!TextUtils.isEmpty(packagename)) {
|
||||
Log.e(TAG, "onRestart: " + APKUtils.getAppNameByPackage(MainActivity.this, packagename));
|
||||
Log.e(TAG, "onRestart: " + packagename);
|
||||
NetInterfaceManager.getInstance().getAppUsageRecordControl()
|
||||
.sendappUsageRecord(Utils.getSerial(),
|
||||
APKUtils.getAppNameByPackage(MainActivity.this, packagename),
|
||||
packagename,
|
||||
AppUsedTimeUtils.getInstance().getStartTime() / 1000,
|
||||
AppUsedTimeUtils.getInstance().getEndTime() / 1000)
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("sendappUsageRecord", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse baseResponse) {
|
||||
Log.e("sendappUsageRecord", "onNext: " + baseResponse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("sendappUsageRecord", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("sendappUsageRecord", "onComplete: ");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Log.e("onRestart", "app = null" + packagename);
|
||||
}
|
||||
mMainPresenter.sendAPPUsage();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -343,6 +267,15 @@ public class MainActivity extends BaseActivity {
|
||||
AppUsedTimeUtils.getInstance().setEndTime(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mMainPresenter.detachView();
|
||||
if (mNewAppReceiver != null) {
|
||||
unregisterReceiver(mNewAppReceiver);
|
||||
}
|
||||
}
|
||||
|
||||
private void registmNewAppReceiver() {
|
||||
mNewAppReceiver = new NewAppReceiver();
|
||||
IntentFilter filter = new IntentFilter();
|
||||
@@ -386,7 +319,27 @@ public class MainActivity extends BaseActivity {
|
||||
Log.e(TAG, "onReceive: " + intent.getAction());
|
||||
String setting_sos = intent.getStringExtra("setting_sos");
|
||||
if (TextUtils.isEmpty(setting_sos)) return;
|
||||
customFragment.setSosNumber();
|
||||
mCustomFragment.setSosNumber();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDesktopLayoutFinish() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDesktopLayoutFinish() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendAPPUsageFinish() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendRunningInfoFinish() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,20 +2,23 @@ package com.uiui.os.activity.main;
|
||||
|
||||
import com.uiui.os.base.BasePresenter;
|
||||
import com.uiui.os.base.BaseView;
|
||||
import com.uiui.os.bean.AlarmClockData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MainContact {
|
||||
public interface Presenter extends BasePresenter<MainView> {
|
||||
//设置所有信息
|
||||
void getAlarmClock();
|
||||
|
||||
public interface Presenter extends BasePresenter<MainContact.MainView> {
|
||||
/*获取桌面布局*/
|
||||
void getDesktopLayout();
|
||||
/*更新桌面布局*/
|
||||
void updateDesktopLayout();
|
||||
/*上传正在运行的APP*/
|
||||
void sendAPPUsage();
|
||||
/*上传后台运行的APP*/
|
||||
void sendRunningInfo();
|
||||
}
|
||||
|
||||
public interface MainView extends BaseView {
|
||||
//获取所有信息
|
||||
void setAlarmClock(List<AlarmClockData> dataList);
|
||||
|
||||
void getDesktopLayoutFinish();
|
||||
void updateDesktopLayoutFinish();
|
||||
void sendAPPUsageFinish();
|
||||
void sendRunningInfoFinish();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +1,35 @@
|
||||
package com.uiui.os.activity.main;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.uiui.os.bean.AlarmClockData;
|
||||
import com.uiui.os.BuildConfig;
|
||||
import com.uiui.os.bean.BaseResponse;
|
||||
import com.uiui.os.bean.NetDesktopIcon;
|
||||
import com.uiui.os.network.NetInterfaceManager;
|
||||
import com.uiui.os.utils.AlarmUtils;
|
||||
import com.uiui.os.utils.APKUtils;
|
||||
import com.uiui.os.utils.AppUsedTimeUtils;
|
||||
import com.uiui.os.utils.Utils;
|
||||
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
* MainActivity和MainService 的 Presenter
|
||||
*
|
||||
* @author jgy02
|
||||
*/
|
||||
public class MainPresenter implements MainContact.Presenter {
|
||||
private static final String TAG = MainPresenter.class.getSimpleName();
|
||||
private static final int OK = 200;
|
||||
private MainContact.MainView mView;
|
||||
private Context mContext;
|
||||
|
||||
private BehaviorSubject<ActivityEvent> lifecycle;
|
||||
|
||||
public void setLifecycle(BehaviorSubject<ActivityEvent> lifecycle) {
|
||||
void setLifecycle(BehaviorSubject<ActivityEvent> lifecycle) {
|
||||
this.lifecycle = lifecycle;
|
||||
}
|
||||
|
||||
@@ -38,13 +37,13 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
return lifecycle;
|
||||
}
|
||||
|
||||
public MainPresenter(Context context) {
|
||||
MainPresenter(Context context) {
|
||||
this.mContext = context;
|
||||
Log.e(TAG, "MainPresenter: " + context.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attachView(@androidx.annotation.NonNull MainContact.MainView view) {
|
||||
public void attachView(MainContact.MainView view) {
|
||||
this.mView = view;
|
||||
}
|
||||
|
||||
@@ -53,37 +52,117 @@ public class MainPresenter implements MainContact.Presenter {
|
||||
this.mView = null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void getAlarmClock() {
|
||||
MMKV mmkv = MMKV.defaultMMKV();
|
||||
NetInterfaceManager.getInstance().getAlarmClockApiObservable()
|
||||
.subscribe(new Observer<BaseResponse<List<AlarmClockData>>>() {
|
||||
public void getDesktopLayout() {
|
||||
NetInterfaceManager.getInstance().getDesktopLayoutObservable()
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse<List<NetDesktopIcon>>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("getAlarmClock", "onSubscribe: ");
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.e("getDesktopLayout", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse<List<AlarmClockData>> listBaseResponse) {
|
||||
Log.e("getAlarmClock", "onNext: "+listBaseResponse);
|
||||
if (listBaseResponse.code == 200) {
|
||||
List<AlarmClockData> data = listBaseResponse.data;
|
||||
AlarmUtils.getInstance().setAlarmClockData(data);
|
||||
} else {
|
||||
|
||||
}
|
||||
public void onNext(@NonNull BaseResponse<List<NetDesktopIcon>> listBaseResponse) {
|
||||
Log.e("getDesktopLayout", "onNext: " + listBaseResponse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getAlarmClock", "onError: " + e.getMessage());
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("getDesktopLayout", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getAlarmClock", "onComplete: ");
|
||||
Log.e("getDesktopLayout", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDesktopLayout() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendAPPUsage() {
|
||||
AppUsedTimeUtils.getInstance().setEndTime(System.currentTimeMillis());
|
||||
String packagename = AppUsedTimeUtils.getInstance().getAppPackageName();
|
||||
Log.e(TAG, "onRestart packagename == " + packagename);
|
||||
if (!TextUtils.isEmpty(packagename)) {
|
||||
Log.e(TAG, "onRestart: " + APKUtils.getAppNameByPackage(mContext, packagename));
|
||||
Log.e(TAG, "onRestart: " + packagename);
|
||||
NetInterfaceManager.getInstance().getAppUsageRecordControl()
|
||||
.sendappUsageRecord(Utils.getSerial(),
|
||||
APKUtils.getAppNameByPackage(mContext, packagename),
|
||||
packagename,
|
||||
AppUsedTimeUtils.getInstance().getStartTime() / 1000,
|
||||
AppUsedTimeUtils.getInstance().getEndTime() / 1000)
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("sendAPPUsage", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse baseResponse) {
|
||||
Log.e("sendAPPUsage", "onNext: " + baseResponse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("sendAPPUsage", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("sendAPPUsage", "onComplete: ");
|
||||
mView.sendAPPUsageFinish();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Log.e("onRestart", "app = null" + packagename);
|
||||
mView.sendAPPUsageFinish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendRunningInfo() {
|
||||
AppUsedTimeUtils.getInstance().setAppPackageName(BuildConfig.APPLICATION_ID);
|
||||
AppUsedTimeUtils.getInstance().setStartTime(System.currentTimeMillis());
|
||||
long time = AppUsedTimeUtils.getInstance().getStartTime();
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
jsonObject.addProperty("app_package", BuildConfig.APPLICATION_ID);
|
||||
jsonObject.addProperty("version_name", APKUtils.getAPPVersionName(mContext, BuildConfig.APPLICATION_ID));
|
||||
jsonObject.addProperty("start_time", time / 1000);
|
||||
String jsonString = jsonObject.toString();
|
||||
Log.e(TAG, "sendRunningInfo: " + jsonString);
|
||||
NetInterfaceManager.getInstance()
|
||||
.getRunningAppObservable(jsonString)
|
||||
.compose(RxLifecycle.bindUntilEvent(lifecycle, ActivityEvent.DESTROY))
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("sendRunningInfo", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse baseResponse) {
|
||||
Log.e("sendRunningInfo", "onNext: " + baseResponse);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("sendRunningInfo", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("sendRunningInfo", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class APPListAdapter extends RecyclerView.Adapter<APPListAdapter.holder>
|
||||
holder.root.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
APKUtils.openApp(mContext, info.getPackageName());
|
||||
APKUtils.openPackage(mContext, info.getPackageName());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public class NotificationAdapter extends RecyclerView.Adapter<NotificationAdapte
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Holder holder, int position) {
|
||||
AlarmClockData alarmClockData = dataList.get(position);
|
||||
holder.tv_title.setText("提醒事件:" + alarmClockData.getRemarks());
|
||||
holder.tv_title.setText("提醒事件:" + alarmClockData.getTitle());
|
||||
holder.tv_time.setText("提醒时间:" + alarmClockData.getTime());
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.qweather.sdk.view.HeConfig;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.uiui.os.BuildConfig;
|
||||
import com.uiui.os.network.NetInterfaceManager;
|
||||
import com.uiui.os.service.MainService;
|
||||
import com.uiui.os.service.main.MainService;
|
||||
import com.uiui.os.utils.AlarmUtils;
|
||||
import com.uiui.os.utils.AmapManager;
|
||||
import com.uiui.os.utils.AppUsedTimeUtils;
|
||||
|
||||
114
app/src/main/java/com/uiui/os/base/BaseFragment.java
Normal file
@@ -0,0 +1,114 @@
|
||||
package com.uiui.os.base;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.CheckResult;
|
||||
import androidx.annotation.ContentView;
|
||||
import androidx.annotation.LayoutRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.trello.rxlifecycle4.LifecycleProvider;
|
||||
import com.trello.rxlifecycle4.LifecycleTransformer;
|
||||
import com.trello.rxlifecycle4.RxLifecycle;
|
||||
import com.trello.rxlifecycle4.android.FragmentEvent;
|
||||
import com.trello.rxlifecycle4.android.RxLifecycleAndroid;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||
|
||||
public class BaseFragment extends Fragment implements LifecycleProvider<FragmentEvent> {
|
||||
private final BehaviorSubject<FragmentEvent> lifecycleSubject = BehaviorSubject.create();
|
||||
|
||||
public BaseFragment() {
|
||||
super();
|
||||
}
|
||||
|
||||
@ContentView
|
||||
public BaseFragment(@LayoutRes int contentLayoutId) {
|
||||
super(contentLayoutId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
@CheckResult
|
||||
public final Observable<FragmentEvent> lifecycle() {
|
||||
return lifecycleSubject.hide();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
@CheckResult
|
||||
public final <T> LifecycleTransformer<T> bindUntilEvent(@NonNull FragmentEvent event) {
|
||||
return RxLifecycle.bindUntilEvent(lifecycleSubject, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNull
|
||||
@CheckResult
|
||||
public final <T> LifecycleTransformer<T> bindToLifecycle() {
|
||||
return RxLifecycleAndroid.bindFragment(lifecycleSubject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(android.app.Activity activity) {
|
||||
super.onAttach(activity);
|
||||
lifecycleSubject.onNext(FragmentEvent.ATTACH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
lifecycleSubject.onNext(FragmentEvent.CREATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
lifecycleSubject.onNext(FragmentEvent.CREATE_VIEW);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
lifecycleSubject.onNext(FragmentEvent.START);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
lifecycleSubject.onNext(FragmentEvent.RESUME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
lifecycleSubject.onNext(FragmentEvent.PAUSE);
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
lifecycleSubject.onNext(FragmentEvent.STOP);
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
lifecycleSubject.onNext(FragmentEvent.DESTROY_VIEW);
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
lifecycleSubject.onNext(FragmentEvent.DESTROY);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach() {
|
||||
lifecycleSubject.onNext(FragmentEvent.DETACH);
|
||||
super.onDetach();
|
||||
}
|
||||
}
|
||||
@@ -14,9 +14,11 @@ public class AlarmClockData implements Serializable {
|
||||
int id;
|
||||
int type;
|
||||
String time;
|
||||
String remarks;
|
||||
String title;
|
||||
String voice;
|
||||
String voice_md5;
|
||||
String file;
|
||||
|
||||
boolean finished = false;
|
||||
|
||||
public int getId() {
|
||||
@@ -43,12 +45,12 @@ public class AlarmClockData implements Serializable {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public String getRemarks() {
|
||||
return remarks;
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setRemarks(String remarks) {
|
||||
this.remarks = remarks;
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getVoice() {
|
||||
@@ -67,6 +69,14 @@ public class AlarmClockData implements Serializable {
|
||||
this.voice_md5 = voice_md5;
|
||||
}
|
||||
|
||||
public String getFile() {
|
||||
return file;
|
||||
}
|
||||
|
||||
public void setFile(String file) {
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
public boolean isFinished() {
|
||||
return finished;
|
||||
}
|
||||
@@ -81,7 +91,6 @@ public class AlarmClockData implements Serializable {
|
||||
return JsonParser.parseString(new Gson().toJson(this)).getAsJsonObject().toString();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (obj == null) return false;
|
||||
@@ -89,9 +98,10 @@ public class AlarmClockData implements Serializable {
|
||||
if (id != ((AlarmClockData) obj).id) return false;
|
||||
if (type != ((AlarmClockData) obj).type) return false;
|
||||
if (!time.equals(((AlarmClockData) obj).time)) return false;
|
||||
if (!remarks.equals(((AlarmClockData) obj).remarks)) return false;
|
||||
if (!title.equals(((AlarmClockData) obj).title)) return false;
|
||||
if (!voice.equals(((AlarmClockData) obj).voice)) return false;
|
||||
if (!voice_md5.equals(((AlarmClockData) obj).voice_md5)) return false;
|
||||
if (!file.equals(((AlarmClockData) obj).file)) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
107
app/src/main/java/com/uiui/os/bean/DesktopIcon.java
Normal file
@@ -0,0 +1,107 @@
|
||||
package com.uiui.os.bean;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class DesktopIcon implements Serializable , Parcelable {
|
||||
private static final long serialVersionUID = 3358230413497783708L;
|
||||
|
||||
String packageName;
|
||||
Drawable icon;
|
||||
String lable;
|
||||
int position;
|
||||
|
||||
private DesktopIcon() {
|
||||
|
||||
}
|
||||
|
||||
private DesktopIcon(Parcel in) {
|
||||
packageName = in.readStringNoHelper();
|
||||
lable = in.readStringNoHelper();
|
||||
position = in.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeStringNoHelper(packageName);
|
||||
dest.writeStringNoHelper(lable);
|
||||
dest.writeInt(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static final Creator<DesktopIcon> CREATOR = new Creator<DesktopIcon>() {
|
||||
@Override
|
||||
public DesktopIcon createFromParcel(Parcel in) {
|
||||
return new DesktopIcon(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DesktopIcon[] newArray(int size) {
|
||||
return new DesktopIcon[size];
|
||||
}
|
||||
};
|
||||
|
||||
public String getPackageName() {
|
||||
return packageName;
|
||||
}
|
||||
|
||||
public void setPackageName(String packageName) {
|
||||
this.packageName = packageName;
|
||||
}
|
||||
|
||||
public Drawable getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(Drawable icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public String getLable() {
|
||||
return lable;
|
||||
}
|
||||
|
||||
public void setLable(String lable) {
|
||||
this.lable = lable;
|
||||
}
|
||||
|
||||
public int getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
public void setPosition(int position) {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
public static DesktopIcon creatDesktopIcon(Context context, ApplicationInfo applicationInfo) {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
DesktopIcon desktopIcon = new DesktopIcon();
|
||||
desktopIcon.setPackageName(applicationInfo.packageName);
|
||||
desktopIcon.setIcon(applicationInfo.loadIcon(pm));
|
||||
desktopIcon.setLable(applicationInfo.loadLabel(pm).toString());
|
||||
desktopIcon.setPosition(0);
|
||||
return desktopIcon;
|
||||
}
|
||||
|
||||
public static DesktopIcon creatDesktopIcon(Context context, ApplicationInfo applicationInfo, int position) {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
DesktopIcon desktopIcon = new DesktopIcon();
|
||||
desktopIcon.setPackageName(applicationInfo.packageName);
|
||||
desktopIcon.setIcon(applicationInfo.loadIcon(pm));
|
||||
desktopIcon.setLable(applicationInfo.loadLabel(pm).toString());
|
||||
desktopIcon.setPosition(position);
|
||||
return desktopIcon;
|
||||
}
|
||||
|
||||
}
|
||||
57
app/src/main/java/com/uiui/os/bean/NetDesktopIcon.java
Normal file
@@ -0,0 +1,57 @@
|
||||
package com.uiui.os.bean;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class NetDesktopIcon implements Serializable {
|
||||
private static final long serialVersionUID = 7070889522236163187L;
|
||||
int id;
|
||||
String name;
|
||||
@SerializedName("package")
|
||||
String packages;
|
||||
Bitmap icon;
|
||||
int num;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPackages() {
|
||||
return packages;
|
||||
}
|
||||
|
||||
public void setPackages(String packages) {
|
||||
this.packages = packages;
|
||||
}
|
||||
|
||||
public Bitmap getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(Bitmap icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public int getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public void setNum(int num) {
|
||||
this.num = num;
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@ import android.widget.TextView;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.uiui.os.R;
|
||||
import com.uiui.os.bean.BaseResponse;
|
||||
import com.uiui.os.bean.DesktopIcon;
|
||||
import com.uiui.os.network.NetInterfaceManager;
|
||||
import com.uiui.os.utils.APKUtils;
|
||||
import com.uiui.os.utils.BitmapUtils;
|
||||
@@ -48,7 +49,7 @@ public class AppListFragment extends Fragment {
|
||||
private String mParam1;
|
||||
private String mParam2;
|
||||
|
||||
private ArrayList<ApplicationInfo> applicationInfos;
|
||||
private ArrayList<DesktopIcon> mDesktopIcons;
|
||||
private MyGridLayout gridLayout;
|
||||
private String TAG = AppListFragment.class.getSimpleName();
|
||||
|
||||
@@ -78,7 +79,7 @@ public class AppListFragment extends Fragment {
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (savedInstanceState != null) {
|
||||
applicationInfos = savedInstanceState.getParcelableArrayList("applicationInfos");
|
||||
mDesktopIcons = savedInstanceState.getParcelableArrayList("applicationInfos");
|
||||
}
|
||||
if (getArguments() != null) {
|
||||
mParam1 = getArguments().getString(ARG_PARAM1);
|
||||
@@ -97,8 +98,8 @@ public class AppListFragment extends Fragment {
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
if (applicationInfos.size() != 12) {
|
||||
applicationInfos.addAll(new ArrayList<>(Arrays.asList(new ApplicationInfo[12 - applicationInfos.size()])));
|
||||
if (mDesktopIcons.size() != 12) {
|
||||
mDesktopIcons.addAll(new ArrayList<>(Arrays.asList(new DesktopIcon[12 - mDesktopIcons.size()])));
|
||||
}
|
||||
gridLayout = rootView.findViewById(R.id.list);
|
||||
if (getActivity().getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
@@ -116,24 +117,24 @@ public class AppListFragment extends Fragment {
|
||||
ImageView iv = view.findViewById(R.id.iv);
|
||||
TextView tv = view.findViewById(R.id.tv);
|
||||
LinearLayout linearLayout = view.findViewById(R.id.btn_booktag);
|
||||
ApplicationInfo applicationInfo = applicationInfos.get(index);
|
||||
DesktopIcon desktopIcon = mDesktopIcons.get(index);
|
||||
|
||||
if (applicationInfo != null) {
|
||||
Log.e(TAG, "getView: " + applicationInfo.packageName);
|
||||
int i = IconUtils.appClassNameList.indexOf(applicationInfo.packageName);
|
||||
if (desktopIcon != null) {
|
||||
Log.e(TAG, "getView: " + desktopIcon.getPackageName());
|
||||
int i = IconUtils.appClassNameList.indexOf(desktopIcon.getPackageName());
|
||||
if (i != -1) {
|
||||
String val = IconUtils.appIconList.get(i);
|
||||
String val = IconUtils.appIconList2.get(i);
|
||||
int resID = getActivity().getResources().getIdentifier(val, "drawable", "com.uiui.os");
|
||||
if (resID == 0) {
|
||||
Log.e(TAG, "getView: not found src : " + applicationInfo.packageName);
|
||||
iv.setImageDrawable(applicationInfo.loadIcon(pm));
|
||||
Log.e(TAG, "getView: not found src : " + desktopIcon.getPackageName());
|
||||
iv.setImageDrawable(desktopIcon.getIcon());
|
||||
} else {
|
||||
iv.setImageDrawable(getActivity().getResources().getDrawable(resID));
|
||||
}
|
||||
} else {
|
||||
iv.setImageBitmap(BitmapUtils.getIconBitmap(rootView.getContext(), applicationInfo.loadIcon(pm)));
|
||||
iv.setImageBitmap(BitmapUtils.getIconBitmap(rootView.getContext(), desktopIcon.getIcon()));
|
||||
}
|
||||
tv.setText(applicationInfo.loadLabel(pm));
|
||||
tv.setText(desktopIcon.getLable());
|
||||
// linearLayout.setEnabled(true);
|
||||
} else {
|
||||
// linearLayout.setEnabled(false);
|
||||
@@ -145,17 +146,17 @@ public class AppListFragment extends Fragment {
|
||||
@Override
|
||||
public int getCount() {
|
||||
// return applicationInfos == null ? 0 : applicationInfos.size();
|
||||
return applicationInfos.size();
|
||||
return mDesktopIcons.size();
|
||||
}
|
||||
});
|
||||
gridLayout.setApplicationInfos(applicationInfos);
|
||||
gridLayout.setApplicationInfos(mDesktopIcons);
|
||||
gridLayout.setOnItemClickListener(new MyGridLayout.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(View v, int index) {
|
||||
ApplicationInfo applicationInfo = applicationInfos.get(index);
|
||||
if (applicationInfo != null) {
|
||||
APKUtils.openPackage(v.getContext(), applicationInfo.packageName);
|
||||
AppUsedTimeUtils.getInstance().setAppPackageName(applicationInfo.packageName);
|
||||
DesktopIcon desktopIcon = mDesktopIcons.get(index);
|
||||
if (desktopIcon != null) {
|
||||
APKUtils.openPackage(v.getContext(), desktopIcon.getPackageName());
|
||||
AppUsedTimeUtils.getInstance().setAppPackageName(desktopIcon.getPackageName());
|
||||
AppUsedTimeUtils.getInstance().setStartTime(System.currentTimeMillis());
|
||||
SendRunningApp(getActivity());
|
||||
}
|
||||
@@ -198,13 +199,13 @@ public class AppListFragment extends Fragment {
|
||||
});
|
||||
}
|
||||
|
||||
public void setAppList(ArrayList<ApplicationInfo> appList) {
|
||||
this.applicationInfos = appList;
|
||||
public void setAppList(ArrayList<DesktopIcon> appList) {
|
||||
this.mDesktopIcons = appList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
outState.putParcelableArrayList("applicationInfos", applicationInfos);
|
||||
outState.putParcelableArrayList("applicationInfos", mDesktopIcons);
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,8 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
|
||||
|
||||
private String TAG = CustomFragment.class.getSimpleName();
|
||||
private int[] mShaderColors = new int[]{0xFFfa3db5, 0xFFF8867E, 0xFFF79F6B, 0xFFF79F6B, 0xFFF79F6B, 0xFFF8867E, 0xFFfa3db5};
|
||||
// private int[] mShaderColors = new int[]{0xFFfa3db5, 0xFFF8867E, 0xFFF79F6B, 0xFFF79F6B, 0xFFF79F6B, 0xFFF8867E, 0xFFfa3db5};
|
||||
private int[] mShaderColors = new int[]{0xFF3984f6, 0xFF3984f6, 0xFF3984f6, 0xFF3984f6, 0xFF3984f6, 0xFF3984f6, 0xFF3984f6};
|
||||
private View rootView;
|
||||
private List<AlarmItem> alarmItemList;
|
||||
private NotificationAdapter notificationAdapter;
|
||||
@@ -466,9 +467,17 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
if (hourly != null && hourly.size() != 0) {
|
||||
WeatherHourlyBean.HourlyBean now = hourly.get(0);
|
||||
String imageName = "he" + now.getIcon();
|
||||
int resId = getResources().getIdentifier(imageName, "drawable", getActivity().getPackageName());
|
||||
iv_pic.setImageDrawable(getActivity().getDrawable(resId));
|
||||
tv_temp.setText(now.getTemp() + "℃");
|
||||
Log.e(TAG, "onSuccess: " + imageName);
|
||||
if (isAdded()){
|
||||
int resId = getResources().getIdentifier(imageName, "drawable", getActivity().getPackageName());
|
||||
Log.e(TAG, "onSuccess: " + resId);
|
||||
if (resId == 0) {
|
||||
iv_pic.setImageDrawable(getActivity().getDrawable(R.drawable.he100));
|
||||
} else {
|
||||
iv_pic.setImageDrawable(getActivity().getDrawable(resId));
|
||||
}
|
||||
tv_temp.setText(now.getTemp() + "℃");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//在此查看返回数据失败的原因
|
||||
@@ -486,6 +495,7 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
if (pkg.equalsIgnoreCase(BuildConfig.APPLICATION_ID)) continue;
|
||||
killBackgroundProcesses(pkg);
|
||||
}
|
||||
refreshMemory();
|
||||
}
|
||||
|
||||
private void killBackgroundProcesses(String packageName) {
|
||||
@@ -503,7 +513,6 @@ public class CustomFragment extends Fragment implements NetworkUtils.OnNetworkSt
|
||||
Log.e(TAG, "killBackgroundProcesses: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
refreshMemory();
|
||||
}
|
||||
|
||||
private void refreshMemory() {
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.uiui.os.iconpostition;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.os.Environment;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class IconPositionDBHelper extends SQLiteOpenHelper {
|
||||
public static final String DATABASE_NAME = "requestlog.db";
|
||||
private static final String DATABASE_FILE_NAME = Environment.getExternalStorageDirectory().getPath() + File.separator + DATABASE_NAME;
|
||||
private static final int DATABASE_VERSION = 1;
|
||||
|
||||
public IconPositionDBHelper(Context context) {
|
||||
// super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
||||
super(context, DATABASE_FILE_NAME, null, DATABASE_VERSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(SQLiteDatabase sqLiteDatabase) {
|
||||
sqLiteDatabase.execSQL("CREATE TABLE IF NOT EXISTS DesktopIcon (" +
|
||||
"id integer primary key autoincrement," +
|
||||
"name text," +
|
||||
"package text not null," +
|
||||
"icon blob," +
|
||||
"position integer UNIQUE" +
|
||||
")"
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.uiui.os.iconpostition;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
|
||||
import com.uiui.os.bean.NetDesktopIcon;
|
||||
import com.uiui.os.utils.APKUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class IconPositionManager {
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static IconPositionManager sInstance;
|
||||
private Context mContext;
|
||||
private IconPositionDBHelper mDBHelper;
|
||||
|
||||
private static final String TABLE_NAME = "DesktopIcon";
|
||||
private static String TAG = IconPositionManager.class.getSimpleName();
|
||||
|
||||
private IconPositionManager(Context context) {
|
||||
if (context == null) {
|
||||
throw new RuntimeException("Context is NULL");
|
||||
}
|
||||
mContext = context;
|
||||
mDBHelper = new IconPositionDBHelper(context);
|
||||
}
|
||||
|
||||
public static void init(Context context) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new IconPositionManager(context);
|
||||
}
|
||||
}
|
||||
|
||||
public static IconPositionManager getInstance() {
|
||||
if (sInstance == null) {
|
||||
throw new IllegalStateException("You must be init IconPositionManager first");
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public IconPositionDBHelper getDBHelper() {
|
||||
if (mDBHelper == null) {
|
||||
mDBHelper = new IconPositionDBHelper(mContext);
|
||||
}
|
||||
return mDBHelper;
|
||||
}
|
||||
|
||||
public void setOnlinePosition(List<NetDesktopIcon> desktopIconList) {
|
||||
HashMap hashMap = new HashMap();
|
||||
|
||||
List<NetDesktopIcon> dbList = getLogList();
|
||||
for (int i = 0; i < dbList.size(); i++) {
|
||||
NetDesktopIcon icon = dbList.get(i);
|
||||
if (!APKUtils.isAvailable(mContext, icon.getPackages())) {
|
||||
dbList.remove(i);
|
||||
deleteIcon(icon.getPackages());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<NetDesktopIcon> getLogList() {
|
||||
List<NetDesktopIcon> logBeanList = new ArrayList<>();
|
||||
SQLiteDatabase db = mDBHelper.getReadableDatabase();
|
||||
String sql = "select * from " + TABLE_NAME;
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
cursor = db.rawQuery(sql, null);
|
||||
while (cursor.moveToNext()) {
|
||||
NetDesktopIcon desktopIcon = new NetDesktopIcon();
|
||||
desktopIcon.setId(cursor.getInt(cursor.getColumnIndex("id")));
|
||||
desktopIcon.setName(cursor.getString(cursor.getColumnIndex("name")));
|
||||
desktopIcon.setPackages(cursor.getString(cursor.getColumnIndex("package")));
|
||||
desktopIcon.setNum(cursor.getInt(cursor.getColumnIndex("position")));
|
||||
desktopIcon.setIcon(IconUtils.Bytes2Bimap(cursor.getBlob(cursor.getColumnIndex("icon"))));
|
||||
logBeanList.add(desktopIcon);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (cursor != null) {
|
||||
cursor.close();
|
||||
}
|
||||
db.close();
|
||||
}
|
||||
return logBeanList;
|
||||
}
|
||||
|
||||
public void updateIcon(NetDesktopIcon netDesktopIcon) {
|
||||
SQLiteDatabase db = mDBHelper.getWritableDatabase();
|
||||
ContentValues values = new ContentValues();
|
||||
values.put("name", netDesktopIcon.getName());
|
||||
values.put("package", netDesktopIcon.getPackages());
|
||||
values.put("position", netDesktopIcon.getNum());
|
||||
values.put("icon", IconUtils.getPackageIcon(mContext, netDesktopIcon.getPackages()));
|
||||
db.update(TABLE_NAME, values, "package=?", new String[]{netDesktopIcon.getPackages()});
|
||||
}
|
||||
|
||||
public void deleteIcon(String pkg) {
|
||||
SQLiteDatabase db = mDBHelper.getWritableDatabase();
|
||||
db.delete(TABLE_NAME, "package=?", new String[]{pkg});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
42
app/src/main/java/com/uiui/os/iconpostition/IconUtils.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package com.uiui.os.iconpostition;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
public class IconUtils {
|
||||
public static byte[] getPackageIcon(Context context, String pkg) {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
ApplicationInfo applicationInfo = null;
|
||||
try {
|
||||
applicationInfo = pm.getApplicationInfo(pkg, PackageManager.GET_META_DATA);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (applicationInfo != null) {
|
||||
Drawable icon = applicationInfo.loadIcon(pm);
|
||||
Bitmap bitmap = ((BitmapDrawable) icon).getBitmap();
|
||||
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);
|
||||
byte[] bitmapdata = stream.toByteArray();
|
||||
return bitmapdata;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static Bitmap Bytes2Bimap(byte[] b) {
|
||||
if (b.length != 0) {
|
||||
return BitmapFactory.decodeByteArray(b, 0, b.length);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,11 +6,15 @@ import android.util.Log;
|
||||
|
||||
import com.uiui.os.bean.AlarmClockData;
|
||||
import com.uiui.os.bean.BaseResponse;
|
||||
import com.uiui.os.bean.NetDesktopIcon;
|
||||
import com.uiui.os.network.api.AlarmClockApi;
|
||||
import com.uiui.os.network.api.AppUsageRecordApi;
|
||||
import com.uiui.os.network.api.GetDesktopApi;
|
||||
import com.uiui.os.network.api.RunNewApp;
|
||||
import com.uiui.os.network.api.SOSRecord;
|
||||
import com.uiui.os.network.api.SOSRecordApi;
|
||||
import com.uiui.os.network.api.SendScreenshotApi;
|
||||
import com.uiui.os.network.api.UpdateAlarmClockApi;
|
||||
import com.uiui.os.network.api.UpdateDesktopApi;
|
||||
import com.uiui.os.utils.MD5Util;
|
||||
import com.uiui.os.utils.Utils;
|
||||
|
||||
@@ -170,12 +174,35 @@ public class NetInterfaceManager {
|
||||
}
|
||||
|
||||
public Observable<BaseResponse> getSOSRecordObservable() {
|
||||
return mRetrofit.create(SOSRecord.class)
|
||||
return mRetrofit.create(SOSRecordApi.class)
|
||||
.sendSOSRecord(Utils.getSerial())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse> getUpdateAlarmObservable(int id) {
|
||||
return mRetrofit.create(UpdateAlarmClockApi.class)
|
||||
.updateAlarm(Utils.getSerial(), id)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse> getUpdateDesktopObservable(String jsonArray) {
|
||||
return mRetrofit.create(UpdateDesktopApi.class)
|
||||
.updateLayout(Utils.getSerial(), jsonArray)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public Observable<BaseResponse<List<NetDesktopIcon>>> getDesktopLayoutObservable() {
|
||||
return mRetrofit.create(GetDesktopApi.class)
|
||||
.getDesktopLayout(Utils.getSerial())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public AppUsageRecordApi getAppUsageRecordControl() {
|
||||
return mRetrofit.create(AppUsageRecordApi.class);
|
||||
}
|
||||
|
||||
@@ -2,15 +2,21 @@ package com.uiui.os.network;
|
||||
|
||||
public class URLAddress {
|
||||
public static final String ROOT_URL = "https://led.aolelearn.cn/android/";
|
||||
//获取闹钟
|
||||
/*获取闹钟*/
|
||||
public static final String GET_ALARM_CLOCK = "getAlarmClock";
|
||||
//应用使用记录
|
||||
/*应用使用记录*/
|
||||
public static final String APP_USAGE_RECORD = "appUsageRecord";
|
||||
//正在运行的应用
|
||||
/*正在运行的应用*/
|
||||
public static final String RUN_NEW_APP = "app/runNewApp";
|
||||
//上传截图
|
||||
/*上传截图*/
|
||||
public static final String SEND_SCREENSHOT = "sn/uploadScreenshot";
|
||||
//sos记录
|
||||
/*sos记录*/
|
||||
public static final String SOS_RECORD = "sosRecord";
|
||||
/*爱心提醒通知成功*/
|
||||
public static final String UPDATE_ALARM_CLOCK = "updateAlarmClock";
|
||||
/*更新桌面布局*/
|
||||
public static final String UPDATE_DESKTOP_LAYOUT = "updateDesktopLayout";
|
||||
/*获取桌面布局*/
|
||||
public static final String GET_DESKTOP_LAYOUT = "getDesktopLayout";
|
||||
|
||||
}
|
||||
|
||||
21
app/src/main/java/com/uiui/os/network/api/GetDesktopApi.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package com.uiui.os.network.api;
|
||||
|
||||
import com.uiui.os.bean.BaseResponse;
|
||||
import com.uiui.os.bean.NetDesktopIcon;
|
||||
import com.uiui.os.network.URLAddress;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
public interface GetDesktopApi {
|
||||
@GET(URLAddress.GET_DESKTOP_LAYOUT)
|
||||
Observable<BaseResponse<List<NetDesktopIcon>>> getDesktopLayout(
|
||||
@Query("sn") String sn
|
||||
);
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
public interface SOSRecord {
|
||||
public interface SOSRecordApi {
|
||||
@FormUrlEncoded
|
||||
@POST(URLAddress.SOS_RECORD)
|
||||
Observable<BaseResponse> sendSOSRecord(
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.uiui.os.network.api;
|
||||
|
||||
import com.uiui.os.bean.BaseResponse;
|
||||
import com.uiui.os.network.URLAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
public interface UpdateAlarmClockApi {
|
||||
@FormUrlEncoded
|
||||
@POST(URLAddress.UPDATE_ALARM_CLOCK)
|
||||
Observable<BaseResponse> updateAlarm(
|
||||
@Field("sn") String sn,
|
||||
@Field("id") int id
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.uiui.os.network.api;
|
||||
|
||||
import com.uiui.os.bean.BaseResponse;
|
||||
import com.uiui.os.network.URLAddress;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
public interface UpdateDesktopApi {
|
||||
@FormUrlEncoded
|
||||
@POST(URLAddress.UPDATE_DESKTOP_LAYOUT)
|
||||
Observable<BaseResponse> updateLayout(
|
||||
@Field("sn") String sn,
|
||||
@Field("app") String app
|
||||
);
|
||||
}
|
||||
@@ -3,11 +3,10 @@ package com.uiui.os.receiver;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.SystemClock;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.uiui.os.service.MainService;
|
||||
import com.uiui.os.service.main.MainService;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -19,6 +18,7 @@ import io.reactivex.rxjava3.disposables.Disposable;
|
||||
public class BootReceiver extends BroadcastReceiver {
|
||||
private static String TAG = BootReceiver.class.getSimpleName();
|
||||
public static final String BOOT_COMPLETED = "zuoyeos.action.BOOT_COMPLETED";
|
||||
public static final String SOS = "zuoyeos.action.SOS";
|
||||
|
||||
static {
|
||||
getLockedState();
|
||||
|
||||
19
app/src/main/java/com/uiui/os/service/main/MainSContact.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package com.uiui.os.service.main;
|
||||
|
||||
import com.uiui.os.base.BasePresenter;
|
||||
import com.uiui.os.base.BaseView;
|
||||
import com.uiui.os.bean.AlarmClockData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MainSContact {
|
||||
public interface Presenter extends BasePresenter<MainSView> {
|
||||
//设置所有信息
|
||||
void getAlarmClock();
|
||||
}
|
||||
|
||||
public interface MainSView extends BaseView {
|
||||
//获取所有信息
|
||||
void setAlarmClock(List<AlarmClockData> dataList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.uiui.os.service.main;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.trello.rxlifecycle4.android.ActivityEvent;
|
||||
import com.uiui.os.bean.AlarmClockData;
|
||||
import com.uiui.os.bean.BaseResponse;
|
||||
import com.uiui.os.network.NetInterfaceManager;
|
||||
import com.uiui.os.utils.AlarmUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||
|
||||
|
||||
/**
|
||||
* MainActivity和MainService 的 Presenter
|
||||
*
|
||||
* @author jgy02
|
||||
*/
|
||||
public class MainSPresenter implements MainSContact.Presenter {
|
||||
private static final String TAG = MainSPresenter.class.getSimpleName();
|
||||
private static final int OK = 200;
|
||||
private MainSContact.MainSView mView;
|
||||
private Context mContext;
|
||||
|
||||
private BehaviorSubject<ActivityEvent> lifecycle;
|
||||
|
||||
public void setLifecycle(BehaviorSubject<ActivityEvent> lifecycle) {
|
||||
this.lifecycle = lifecycle;
|
||||
}
|
||||
|
||||
public BehaviorSubject<ActivityEvent> getLifecycle() {
|
||||
return lifecycle;
|
||||
}
|
||||
|
||||
public MainSPresenter(Context context) {
|
||||
this.mContext = context;
|
||||
Log.e(TAG, "MainSPresenter: " + context.getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attachView(@androidx.annotation.NonNull MainSContact.MainSView view) {
|
||||
this.mView = view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detachView() {
|
||||
this.mView = null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void getAlarmClock() {
|
||||
MMKV mmkv = MMKV.defaultMMKV();
|
||||
NetInterfaceManager.getInstance().getAlarmClockApiObservable()
|
||||
.subscribe(new Observer<BaseResponse<List<AlarmClockData>>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("getAlarmClock", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse<List<AlarmClockData>> listBaseResponse) {
|
||||
Log.e("getAlarmClock", "onNext: "+listBaseResponse);
|
||||
if (listBaseResponse.code == 200) {
|
||||
List<AlarmClockData> data = listBaseResponse.data;
|
||||
AlarmUtils.getInstance().setAlarmClockData(data);
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("getAlarmClock", "onError: " + e.getMessage());
|
||||
onComplete();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("getAlarmClock", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.uiui.os.service;
|
||||
package com.uiui.os.service.main;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.BroadcastReceiver;
|
||||
@@ -16,8 +16,6 @@ import com.arialyy.aria.core.Aria;
|
||||
import com.arialyy.aria.core.task.DownloadTask;
|
||||
import com.blankj.utilcode.util.NetworkUtils;
|
||||
import com.uiui.os.BuildConfig;
|
||||
import com.uiui.os.activity.main.MainContact;
|
||||
import com.uiui.os.activity.main.MainPresenter;
|
||||
import com.uiui.os.activity.NoticeActivity;
|
||||
import com.uiui.os.base.BaseService;
|
||||
import com.uiui.os.bean.AlarmClockData;
|
||||
@@ -48,10 +46,10 @@ import okhttp3.MultipartBody;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
|
||||
public class MainService extends BaseService implements MainContact.MainView, NetworkUtils.OnNetworkStatusChangedListener {
|
||||
public class MainService extends BaseService implements MainSContact.MainSView, NetworkUtils.OnNetworkStatusChangedListener {
|
||||
private static final String TAG = MainService.class.getSimpleName();
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
public static MainPresenter mPresenter;
|
||||
public static MainSPresenter mPresenter;
|
||||
|
||||
public MainService() {
|
||||
|
||||
@@ -80,7 +78,7 @@ public class MainService extends BaseService implements MainContact.MainView, Ne
|
||||
Log.e(TAG, "onCreate: ");
|
||||
Aria.init(this);
|
||||
Aria.download(this).register();
|
||||
mPresenter = new MainPresenter(this);
|
||||
mPresenter = new MainSPresenter(this);
|
||||
mPresenter.attachView(this);
|
||||
mPresenter.setLifecycle(lifecycleSubject);
|
||||
NetworkUtils.registerNetworkStatusChangedListener(this);
|
||||
@@ -11,7 +11,9 @@ import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.uiui.os.BuildConfig;
|
||||
import com.uiui.os.bean.DesktopIcon;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.Collator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
@@ -91,7 +93,11 @@ public class APKUtils {
|
||||
return applicationInfos;
|
||||
}
|
||||
|
||||
public static ArrayList<ApplicationInfo> queryFilterAppInfo(Context context) {
|
||||
/**
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
public static ArrayList<DesktopIcon> queryFilterAppInfo(Context context) {
|
||||
PackageManager pm = context.getPackageManager();
|
||||
// 查询所有已经安装的应用程序
|
||||
List<ApplicationInfo> appInfos = pm.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);// GET_UNINSTALLED_PACKAGES代表已删除,但还有安装目录的
|
||||
@@ -142,7 +148,11 @@ public class APKUtils {
|
||||
}
|
||||
}
|
||||
});
|
||||
return applicationInfos;
|
||||
ArrayList<DesktopIcon> desktopIcons = new ArrayList<>();
|
||||
for (int p = 0; p < applicationInfos.size(); p++) {
|
||||
desktopIcons.add(DesktopIcon.creatDesktopIcon(context, applicationInfos.get(p), p));
|
||||
}
|
||||
return desktopIcons;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -200,6 +210,32 @@ public class APKUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean openPackage(Context context, String packageName) {
|
||||
Context pkgContext = getPackageContext(context, packageName);
|
||||
Intent intent = getAppOpenIntentByPackageName(context, packageName);
|
||||
if (pkgContext != null && intent != null) {
|
||||
pkgContext.startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Context getPackageContext(Context context, String packageName) {
|
||||
Context pkgContext = null;
|
||||
if (context.getPackageName().equals(packageName)) {
|
||||
pkgContext = context;
|
||||
} else {
|
||||
// 创建第三方应用的上下文环境
|
||||
try {
|
||||
pkgContext = context.createPackageContext(packageName,
|
||||
Context.CONTEXT_IGNORE_SECURITY
|
||||
| Context.CONTEXT_INCLUDE_CODE);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return pkgContext;
|
||||
}
|
||||
|
||||
public static Intent getAppOpenIntentByPackageName(Context context, String packageName) {
|
||||
//Activity完整名
|
||||
@@ -226,33 +262,6 @@ public class APKUtils {
|
||||
return intent;
|
||||
}
|
||||
|
||||
public static Context getPackageContext(Context context, String packageName) {
|
||||
Context pkgContext = null;
|
||||
if (context.getPackageName().equals(packageName)) {
|
||||
pkgContext = context;
|
||||
} else {
|
||||
// 创建第三方应用的上下文环境
|
||||
try {
|
||||
pkgContext = context.createPackageContext(packageName,
|
||||
Context.CONTEXT_IGNORE_SECURITY
|
||||
| Context.CONTEXT_INCLUDE_CODE);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return pkgContext;
|
||||
}
|
||||
|
||||
public static boolean openPackage(Context context, String packageName) {
|
||||
Context pkgContext = getPackageContext(context, packageName);
|
||||
Intent intent = getAppOpenIntentByPackageName(context, packageName);
|
||||
if (pkgContext != null && intent != null) {
|
||||
pkgContext.startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String getAPPVersionName(Context context, String packageName) {
|
||||
String versionName = "0";
|
||||
|
||||
@@ -280,4 +289,40 @@ public class APKUtils {
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 检查手机上是否安装了指定的软件
|
||||
*/
|
||||
public static boolean isAvailable(Context context, String packageName) {
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
PackageInfo info = null;
|
||||
try {
|
||||
info = packageManager.getPackageInfo(packageName, 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return info != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查手机上是否安装了指定的软件
|
||||
*/
|
||||
public static boolean isAvailable(Context context, File file) {
|
||||
return isAvailable(context, getPackageName(context, file.getAbsolutePath()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据文件路径获取包名
|
||||
*/
|
||||
public static String getPackageName(Context context, String filePath) {
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
PackageInfo info = packageManager.getPackageArchiveInfo(filePath, PackageManager.GET_ACTIVITIES);
|
||||
if (info != null) {
|
||||
ApplicationInfo appInfo = info.applicationInfo;
|
||||
return appInfo.packageName; //得到安装包名称
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,35 +5,26 @@ import android.app.AlarmManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Environment;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.arialyy.aria.core.Aria;
|
||||
import com.blankj.utilcode.util.FileUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.uiui.os.bean.AlarmClockData;
|
||||
import com.uiui.os.service.MainService;
|
||||
import com.uiui.os.service.main.MainService;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.lang.reflect.Type;
|
||||
import java.math.BigInteger;
|
||||
import java.security.MessageDigest;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class AlarmUtils {
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
@@ -135,7 +126,7 @@ public class AlarmUtils {
|
||||
|
||||
private PendingIntent getPendingIntent(AlarmClockData alarmClock) {
|
||||
Intent intent = new Intent(MainService.ALARMWAKEUP);
|
||||
intent.putExtra("title", alarmClock.getRemarks());
|
||||
intent.putExtra("title", alarmClock.getTitle());
|
||||
intent.putExtra("id", alarmClock.getId());
|
||||
PendingIntent startPendingIntent = PendingIntent.getBroadcast(mContext, alarmClock.getId(), intent, PendingIntent.FLAG_CANCEL_CURRENT);
|
||||
return startPendingIntent;
|
||||
@@ -182,7 +173,7 @@ public class AlarmUtils {
|
||||
int type = alarm.getType();
|
||||
String timeString = alarm.getTime();
|
||||
long timestamp = getTimestamp(timeString);
|
||||
String title = alarm.getRemarks();
|
||||
String title = alarm.getTitle();
|
||||
boolean finished = alarm.isFinished();
|
||||
String url = alarm.getVoice();
|
||||
String md5 = alarm.getVoice_md5();
|
||||
|
||||
54
app/src/main/java/com/uiui/os/utils/FileUtil.java
Normal file
@@ -0,0 +1,54 @@
|
||||
package com.uiui.os.utils;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
public class FileUtil {
|
||||
public static String getFileType(String url) {
|
||||
if (url.indexOf("/") == -1) {
|
||||
return url.substring(url.indexOf("."), url.length());
|
||||
} else {
|
||||
String fileName = url.substring(url.lastIndexOf("/"));
|
||||
return fileName.substring(fileName.indexOf("."), fileName.length());
|
||||
}
|
||||
}
|
||||
|
||||
private static HashSet<String> videoFormat = new HashSet<String>() {{
|
||||
this.add(".mp4");
|
||||
this.add(".avi");
|
||||
this.add(".nkv");
|
||||
this.add(".flv");
|
||||
}};
|
||||
private static HashSet<String> pictureFormat = new HashSet<String>() {{
|
||||
this.add(".png");
|
||||
this.add(".jpg");
|
||||
this.add(".jpeg");
|
||||
this.add(".bmp");
|
||||
}};
|
||||
|
||||
public static boolean isVideoFile(String fileName) {
|
||||
if (TextUtils.isEmpty(fileName)) {
|
||||
return false;
|
||||
} else {
|
||||
if (!fileName.startsWith(".")) {
|
||||
return videoFormat.contains(getFileType(fileName));
|
||||
} else {
|
||||
return videoFormat.contains(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isPictureFile(String fileName) {
|
||||
if (TextUtils.isEmpty(fileName)) {
|
||||
return false;
|
||||
} else {
|
||||
if (!fileName.startsWith(".")) {
|
||||
return pictureFormat.contains(getFileType(fileName));
|
||||
} else {
|
||||
return pictureFormat.contains(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,43 +1,55 @@
|
||||
package com.uiui.os.utils;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class IconUtils {
|
||||
public static List<String> appClassNameList = new ArrayList<String>() {
|
||||
{
|
||||
this.add("com.android.appstore");//应用市场
|
||||
this.add("com.android.browser");//浏览器
|
||||
this.add("com.android.calculator2");//计算器
|
||||
this.add("com.android.calendar");//日历
|
||||
this.add("com.android.camera");//相机
|
||||
this.add("com.mediatek.camera");//相机
|
||||
this.add("com.android.camera2");//相机
|
||||
this.add("com.android.contacts");//通讯录
|
||||
this.add("com.android.deskclock");//时钟
|
||||
this.add("com.android.dialer");//电话
|
||||
this.add("com.android.dialer");//电话
|
||||
this.add("com.android.gallery3d");//图库
|
||||
this.add("com.android.mms");//信息
|
||||
this.add("com.android.mms.ui");//信息
|
||||
this.add("com.android.messaging");//信息
|
||||
this.add("com.android.music");//音乐
|
||||
this.add("com.android.providers.downloads.ui");//下载
|
||||
this.add("com.android.quicksearchbox");//搜索
|
||||
this.add("com.android.settings");//设置
|
||||
this.add("com.android.soundrecorder");//录音机
|
||||
this.add("com.android.stk.StkMain");//sim卡
|
||||
this.add("com.android.stk");//sim卡
|
||||
this.add("com.android.vdieo");//视频
|
||||
this.add("com.mediatek.filemanager");//文件管理
|
||||
this.add("com.android.documentsui");//下载
|
||||
this.add("com.mediatek.fmradio");//收音机
|
||||
this.add("com.android.fmradio");//收音机
|
||||
this.add("com.android.email");//电子邮件
|
||||
}
|
||||
};
|
||||
public static List<String> appClassNameList = new ArrayList<String>() {{
|
||||
this.add("com.uiui.sn");//设别信息
|
||||
this.add("com.uiui.appstore");//应用市场
|
||||
this.add("com.uiui.weather");//天气
|
||||
this.add("com.android.browser");//浏览器
|
||||
this.add("com.uiui.browser");//浏览器
|
||||
this.add("com.aoleyun.browser");//浏览器
|
||||
this.add("com.android.calculator2");//计算器
|
||||
this.add("com.android.calendar");//日历
|
||||
this.add("com.android.camera");//相机
|
||||
this.add("com.mediatek.camera");//相机
|
||||
this.add("com.android.camera2");//相机
|
||||
this.add("com.android.contacts");//通讯录
|
||||
this.add("com.android.deskclock");//时钟
|
||||
this.add("com.android.dialer");//电话
|
||||
this.add("com.android.dialer");//电话
|
||||
this.add("com.android.gallery3d");//图库
|
||||
this.add("com.android.mms");//信息
|
||||
this.add("com.android.mms.ui");//信息
|
||||
this.add("com.android.messaging");//信息
|
||||
this.add("com.android.music");//音乐
|
||||
this.add("com.android.providers.downloads.ui");//下载
|
||||
this.add("com.android.quicksearchbox");//搜索
|
||||
this.add("com.android.settings");//设置
|
||||
this.add("com.android.soundrecorder");//录音机
|
||||
this.add("com.android.stk.StkMain");//sim卡
|
||||
this.add("com.android.stk");//sim卡
|
||||
this.add("com.android.vdieo");//视频
|
||||
this.add("com.mediatek.filemanager");//文件管理
|
||||
this.add("com.android.documentsui");//下载
|
||||
this.add("com.mediatek.fmradio");//收音机
|
||||
this.add("com.android.fmradio");//收音机
|
||||
this.add("com.android.email");//电子邮件
|
||||
this.add("com.ss.android.ugc.aweme");//抖音
|
||||
this.add("com.ss.android.article.news");//头条
|
||||
this.add("com.tencent.mm");//微信
|
||||
}};
|
||||
|
||||
public static List<String> appIconList = new ArrayList<String>() {{
|
||||
this.add("com_uiui_sn");
|
||||
this.add("com_android_appstore");
|
||||
this.add("com_uiui_weather");
|
||||
this.add("com_android_browser");
|
||||
this.add("com_android_browser");
|
||||
this.add("com_android_browser");
|
||||
this.add("com_android_calculator2");
|
||||
this.add("com_android_calendar");
|
||||
@@ -65,5 +77,52 @@ public class IconUtils {
|
||||
this.add("com_mediatek_fmradio");
|
||||
this.add("com_mediatek_fmradio");//收音机
|
||||
this.add("com_android_email");
|
||||
this.add("com_android_aweme2");
|
||||
this.add("com_android_news2");
|
||||
this.add("com_tencent_mm2");
|
||||
}};
|
||||
|
||||
public static List<String> appIconList2 = new ArrayList<String>() {{
|
||||
this.add("com_uiui_sn2");
|
||||
this.add("com_android_appstore2");
|
||||
this.add("com_uiui_weather2");
|
||||
this.add("com_android_browser2");
|
||||
this.add("com_android_browser2");
|
||||
this.add("com_android_browser2");
|
||||
this.add("com_android_calculator2");
|
||||
this.add("com_android_calendar");
|
||||
this.add("com_android_camera2");
|
||||
this.add("com_android_camera2");
|
||||
this.add("com_android_camera2");
|
||||
this.add("com_android_contacts");
|
||||
this.add("com_android_deskclock");
|
||||
this.add("com_android_dialer2");
|
||||
this.add("com_android_dialer2");
|
||||
this.add("com_android_gallery3d_app2");
|
||||
this.add("com_android_mms_ui2");
|
||||
this.add("com_android_mms_ui2");
|
||||
this.add("com_android_mms_ui2");
|
||||
this.add("com_android_music");
|
||||
this.add("com_android_providers_downloads_ui");
|
||||
this.add("com_android_quicksearchbox");
|
||||
this.add("com_android_settings2");
|
||||
this.add("com_android_soundrecorder");
|
||||
this.add("com_android_stk_stkmain");
|
||||
this.add("com_android_stk_stkmain");
|
||||
this.add("com_android_vdieo");
|
||||
this.add("com_mediatek_filemanager");
|
||||
this.add("com_mediatek_filemanager");
|
||||
this.add("com_mediatek_fmradio");
|
||||
this.add("com_mediatek_fmradio");//收音机
|
||||
this.add("com_android_email");
|
||||
this.add("com_android_aweme2");
|
||||
this.add("com_android_news2");
|
||||
this.add("com_tencent_mm2");
|
||||
}};
|
||||
|
||||
static {
|
||||
Log.e("IconUtils", "appClassNameList size: " + appClassNameList.size());
|
||||
Log.e("IconUtils", "appIconList size: " + appIconList.size());
|
||||
Log.e("IconUtils", "appIconList2 size: " + appIconList2.size());
|
||||
}
|
||||
}
|
||||
|
||||
82
app/src/main/java/com/uiui/os/view/JzvdStdAssert.java
Normal file
@@ -0,0 +1,82 @@
|
||||
package com.uiui.os.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
|
||||
import cn.jzvd.JzvdStd;
|
||||
|
||||
|
||||
public class JzvdStdAssert extends JzvdStd {
|
||||
private onVideoCompletionListener onVideoCompletionListener;
|
||||
private ScreenOrientationChangeListener changeListener;
|
||||
private GotoFullScreenListener gotoFullScreenListener;
|
||||
|
||||
public JzvdStdAssert(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public JzvdStdAssert(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onPrepared() {
|
||||
Log.e("onStateChanged", "onPrepared");
|
||||
state = STATE_PREPARED;
|
||||
if (!preloading) {
|
||||
mediaInterface.start();
|
||||
preloading = false;
|
||||
}
|
||||
onStatePlaying();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onCompletion() {
|
||||
super.onCompletion();
|
||||
onVideoCompletionListener.onVideoComplet();
|
||||
Log.e("onStateChanged", "onCompletion");
|
||||
}
|
||||
|
||||
public void setOnCompletionListener(onVideoCompletionListener listener) {
|
||||
this.onVideoCompletionListener = listener;
|
||||
}
|
||||
|
||||
public void setScreenOrientationChangeListener(ScreenOrientationChangeListener listener) {
|
||||
this.changeListener = listener;
|
||||
}
|
||||
|
||||
public void setGotoFullScreenListener(GotoFullScreenListener listener) {
|
||||
this.gotoFullScreenListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void gotoNormalScreen() {
|
||||
super.gotoNormalScreen();
|
||||
changeListener.onOrientationChange();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void gotoFullscreen() {
|
||||
super.gotoFullscreen();
|
||||
gotoFullScreenListener.onGotoFullScreen();
|
||||
}
|
||||
|
||||
//视频播放完成回调
|
||||
public interface onVideoCompletionListener {
|
||||
void onVideoComplet();
|
||||
}
|
||||
|
||||
//退出全屏回调
|
||||
public interface ScreenOrientationChangeListener {
|
||||
void onOrientationChange();
|
||||
}
|
||||
|
||||
//进入全屏回调
|
||||
public interface GotoFullScreenListener {
|
||||
void onGotoFullScreen();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import android.view.ViewGroup;
|
||||
|
||||
|
||||
import com.uiui.os.R;
|
||||
import com.uiui.os.bean.DesktopIcon;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -88,8 +89,9 @@ public class MyGridLayout extends ViewGroup {
|
||||
int height = b - t;// 布局区域高度
|
||||
int width = r - l;// 布局区域宽度
|
||||
// int rows = count % colums == 0 ? count / colums : count / colums + 1;// 行数
|
||||
if (count == 0)
|
||||
if (count == 0) {
|
||||
return;
|
||||
}
|
||||
int gridW = (width - margin * (colums + 1)) / colums;// 格子宽度
|
||||
int gridH = (height - margin * (rows + 1)) / rows;// 格子高度
|
||||
|
||||
@@ -99,8 +101,9 @@ public class MyGridLayout extends ViewGroup {
|
||||
for (int i = 0; i < rows; i++) {// 遍历行
|
||||
for (int j = 0; j < colums; j++) {// 遍历每一行的元素
|
||||
View child = this.getChildAt(i * colums + j);
|
||||
if (child == null)
|
||||
if (child == null) {
|
||||
return;
|
||||
}
|
||||
// if (j == 0) {
|
||||
left = j * gridW + (j + 1) * margin + margin / 2;
|
||||
// } else {
|
||||
@@ -144,9 +147,9 @@ public class MyGridLayout extends ViewGroup {
|
||||
void onItemClick(View v, int index);
|
||||
}
|
||||
|
||||
private ArrayList<ApplicationInfo> applicationInfos;
|
||||
private ArrayList<DesktopIcon> applicationInfos;
|
||||
|
||||
public void setApplicationInfos(ArrayList<ApplicationInfo> infoArrayList) {
|
||||
public void setApplicationInfos(ArrayList<DesktopIcon> infoArrayList) {
|
||||
this.applicationInfos = infoArrayList;
|
||||
}
|
||||
|
||||
@@ -156,8 +159,9 @@ public class MyGridLayout extends ViewGroup {
|
||||
* @param click
|
||||
*/
|
||||
public void setOnItemClickListener(final OnItemClickListener click) {
|
||||
if (this.adapter == null)
|
||||
if (this.adapter == null) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < adapter.getCount(); i++) {
|
||||
final int index = i;
|
||||
View view = getChildAt(i);
|
||||
@@ -170,7 +174,9 @@ public class MyGridLayout extends ViewGroup {
|
||||
});
|
||||
if (applicationInfos.get(index) == null) {
|
||||
view.setClickable(false);
|
||||
} else view.setClickable(true);
|
||||
} else {
|
||||
view.setClickable(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 1.7 KiB |
BIN
app/src/main/res/drawable-hdpi/charging_icon.png
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 13 KiB |
BIN
app/src/main/res/drawable-hdpi/wallpaper.png
Normal file
|
After Width: | Height: | Size: 2.4 MiB |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 7.7 KiB |
BIN
app/src/main/res/drawable-xhdpi/com_android_appstore2.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
app/src/main/res/drawable-xhdpi/com_android_aweme2.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
app/src/main/res/drawable-xhdpi/com_android_browser2.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
app/src/main/res/drawable-xhdpi/com_android_camera2.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
app/src/main/res/drawable-xhdpi/com_android_dialer2.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
app/src/main/res/drawable-xhdpi/com_android_gallery3d_app2.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
app/src/main/res/drawable-xhdpi/com_android_mms_ui2.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
app/src/main/res/drawable-xhdpi/com_android_news2.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
app/src/main/res/drawable-xhdpi/com_android_settings2.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
app/src/main/res/drawable-xhdpi/com_tencent_mm2.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
app/src/main/res/drawable-xhdpi/com_uiui_sn2.png
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
BIN
app/src/main/res/drawable-xhdpi/com_uiui_weather2.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
app/src/main/res/drawable-xhdpi/weather2.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
@@ -2,7 +2,7 @@
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:drawable="@drawable/actions_item_bg_s" android:state_focused="true" />
|
||||
<item android:drawable="@drawable/actions_item_bg_s" android:state_pressed="true" />
|
||||
<item android:drawable="@color/actions_item_pressed" android:state_pressed="true" />
|
||||
<item>
|
||||
<shape>
|
||||
<solid android:color="@color/colorPrimary" />
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="天气预报"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -93,7 +93,7 @@
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="爱心守护"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -136,15 +136,15 @@
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="紧急呼叫"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_sos"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/sos_icon"
|
||||
@@ -188,7 +188,7 @@
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="我的闹钟"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -233,7 +233,7 @@
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="设备状态"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -253,12 +253,12 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_charging"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="22dp"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="23dp"
|
||||
android:layout_marginStart="32dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/charging"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/charging_icon"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -287,9 +287,11 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_wifi"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginStart="32dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/wifi_icon"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@@ -329,7 +331,6 @@
|
||||
app:cpvStrokeWidth="20dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.481"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
@@ -341,7 +342,7 @@
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="一键加速"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -362,15 +363,15 @@
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="系统应用"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_allapp"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/systemapp_icon"
|
||||
|
||||
@@ -8,9 +8,11 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_icon"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter"
|
||||
app:srcCompat="@mipmap/ic_launcher" />
|
||||
|
||||
<TextView
|
||||
@@ -20,7 +22,7 @@
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:gravity="center_horizontal"
|
||||
android:singleLine="true"
|
||||
android:textSize="15sp"
|
||||
android:textColor="@color/white" />
|
||||
android:textColor="@color/white"
|
||||
android:textSize="17sp" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -47,7 +47,7 @@
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="天气预报"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -92,7 +92,7 @@
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="爱心守护"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -142,15 +142,15 @@
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="紧急呼叫"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_sos"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/sos_icon"
|
||||
@@ -186,7 +186,7 @@
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="我的闹钟"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -237,7 +237,7 @@
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="设备状态"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -257,12 +257,12 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_charging"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="22dp"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="23dp"
|
||||
android:layout_marginStart="32dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/charging"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/charging_icon"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -291,10 +291,12 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_wifi"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginStart="32dp"
|
||||
android:src="@drawable/wifi_icon"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerInside"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -344,7 +346,7 @@
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="一键加速"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -372,15 +374,15 @@
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="系统应用"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="15sp"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_allapp"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/systemapp_icon"
|
||||
|
||||
@@ -8,9 +8,11 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_icon"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_width="128dp"
|
||||
android:layout_height="128dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="fitCenter"
|
||||
app:srcCompat="@mipmap/ic_launcher" />
|
||||
|
||||
<TextView
|
||||
@@ -20,7 +22,7 @@
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:gravity="center_horizontal"
|
||||
android:singleLine="true"
|
||||
android:textSize="15sp"
|
||||
android:textColor="@color/white" />
|
||||
android:textColor="@color/white"
|
||||
android:textSize="17sp" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -6,28 +6,26 @@
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".activity.NoticeActivity">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="72dp"
|
||||
android:text="测试标题"
|
||||
android:layout_marginTop="32dp"
|
||||
android:text="爱心提醒"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="50sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraintLayout"
|
||||
android:id="@+id/cl_voice"
|
||||
android:layout_width="240dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="108dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:background="@drawable/notice_voice_background"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.497"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_title">
|
||||
|
||||
@@ -36,8 +34,8 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:text="30秒"
|
||||
android:textSize="30sp"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
@@ -51,18 +49,38 @@
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_vp"
|
||||
android:layout_width="360dp"
|
||||
android:layout_height="360dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/bt_ok"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/cl_voice">
|
||||
|
||||
<com.uiui.os.view.JzvdStdAssert
|
||||
android:id="@+id/jz_video"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_ok"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:text="OK"
|
||||
android:textSize="30sp"
|
||||
android:textColor="@color/white"
|
||||
android:layout_marginBottom="148dp"
|
||||
android:layout_marginBottom="32dp"
|
||||
android:background="@drawable/ok_background"
|
||||
android:text="OK"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -4,7 +4,6 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/white"
|
||||
tools:context=".fragment.AppListFragment">
|
||||
|
||||
<com.uiui.os.view.MyGridLayout
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop" />
|
||||
android:scaleType="fitCenter" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv"
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#37353a</color>
|
||||
<color name="colorPrimary">#343336</color>
|
||||
<color name="colorPrimaryDark">#272727</color>
|
||||
<color name="colorAccent">#454347</color>
|
||||
<color name="white">#ffffff</color>
|
||||
|
||||
<color name="transparent_white">#FFFFFF</color>
|
||||
<color name="transparent">#00FFFFFF</color>
|
||||
<color name="black">#000000</color>
|
||||
|
||||
<color name="tv_add_color">#4880ff</color>
|
||||
@@ -13,5 +14,6 @@
|
||||
<color name="notice_blue">#0480FF</color>
|
||||
<color name="ok_button">#4D4B50</color>
|
||||
<color name="red">#FF0000</color>
|
||||
<color name="actions_item_pressed">#424144</color>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
<dimen name="actions_item_font">14sp</dimen>
|
||||
<dimen name="actions_item_font">18sp</dimen>
|
||||
<dimen name="actions_item_drawablePaddding">10dip</dimen>
|
||||
|
||||
</resources>
|
||||