version:4.4
fix: update:增加手机页面
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
package="com.uiuios.aios">
|
package="com.uiuios.aios">
|
||||||
|
|
||||||
<!-- 清单文件中, 申明监听通话精确状态权限,该权限需要android:sharedUserId="android.uid.system" -->
|
<!-- 清单文件中, 申明监听通话精确状态权限,该权限需要android:sharedUserId="android.uid.system" -->
|
||||||
@@ -67,16 +66,14 @@
|
|||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.main.MainActivity"
|
android:name=".activity.SplashActivity"
|
||||||
android:clearTaskOnLaunch="true"
|
android:clearTaskOnLaunch="true"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:excludeFromRecents="true"
|
android:excludeFromRecents="true"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:resizeableActivity="true"
|
android:resizeableActivity="true"
|
||||||
android:resumeWhilePausing="true"
|
android:resumeWhilePausing="true"
|
||||||
android:screenOrientation="userLandscape"
|
|
||||||
android:stateNotNeeded="true"
|
android:stateNotNeeded="true"
|
||||||
android:taskAffinity="com.example.taskaffinity.newtask"
|
|
||||||
android:windowSoftInputMode="adjustPan">
|
android:windowSoftInputMode="adjustPan">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
@@ -88,6 +85,17 @@
|
|||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name=".activity.main.MainActivity"
|
||||||
|
android:exported="true"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:screenOrientation="userLandscape" />
|
||||||
|
<activity
|
||||||
|
android:name=".activity.main.PhoneMainActivity"
|
||||||
|
android:exported="true"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:screenOrientation="userPortrait" />
|
||||||
|
|
||||||
<activity android:name=".activity.ControlActivity" />
|
<activity android:name=".activity.ControlActivity" />
|
||||||
<activity android:name=".activity.QuickAppActivity" />
|
<activity android:name=".activity.QuickAppActivity" />
|
||||||
<activity android:name=".activity.SpikeListActivity" />
|
<activity android:name=".activity.SpikeListActivity" />
|
||||||
@@ -119,7 +127,7 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".activity.code.FamilySpaceActivity"
|
android:name=".activity.code.FamilySpaceActivity"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:screenOrientation="sensorPortrait" />
|
android:screenOrientation="userPortrait" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.weather.WeatherActivity"
|
android:name=".activity.weather.WeatherActivity"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
@@ -127,8 +135,8 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".activity.location.LocationAcivity"
|
android:name=".activity.location.LocationAcivity"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:theme="@style/activity_styles"
|
android:screenOrientation="userLandscape"
|
||||||
android:screenOrientation="sensorLandscape" />
|
android:theme="@style/activity_styles" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.EmergencyActivity"
|
android:name=".activity.EmergencyActivity"
|
||||||
android:launchMode="singleTask" />
|
android:launchMode="singleTask" />
|
||||||
@@ -171,11 +179,12 @@
|
|||||||
android:screenOrientation="userLandscape" />
|
android:screenOrientation="userLandscape" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.InformationActivity"
|
android:name=".activity.InformationActivity"
|
||||||
android:screenOrientation="sensorPortrait"
|
android:launchMode="singleTask"
|
||||||
android:launchMode="singleTask" />
|
android:screenOrientation="userPortrait" />
|
||||||
<activity android:name=".activity.InformationDetailsActivity"
|
<activity
|
||||||
android:screenOrientation="sensorPortrait"
|
android:name=".activity.InformationDetailsActivity"
|
||||||
android:launchMode="singleTask"/>
|
android:launchMode="singleTask"
|
||||||
|
android:screenOrientation="userPortrait" />
|
||||||
|
|
||||||
<receiver
|
<receiver
|
||||||
android:name=".receiver.BootReceiver"
|
android:name=".receiver.BootReceiver"
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.uiuios.aios.activity;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Handler;
|
||||||
|
|
||||||
|
import com.uiuios.aios.R;
|
||||||
|
import com.uiuios.aios.activity.main.MainActivity;
|
||||||
|
import com.uiuios.aios.activity.main.PhoneMainActivity;
|
||||||
|
import com.uiuios.aios.base.BaseActivity;
|
||||||
|
import com.uiuios.aios.utils.Utils;
|
||||||
|
|
||||||
|
|
||||||
|
public class SplashActivity extends BaseActivity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置布局
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int getLayoutId() {
|
||||||
|
return R.layout.activity_splash;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化视图
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void initView() {
|
||||||
|
new Handler().postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (Utils.isTablet(SplashActivity.this)) {
|
||||||
|
startActivity(new Intent(SplashActivity.this, MainActivity.class));
|
||||||
|
} else {
|
||||||
|
startActivity(new Intent(SplashActivity.this, PhoneMainActivity.class));
|
||||||
|
}
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化数据
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void initData() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,607 @@
|
|||||||
|
package com.uiuios.aios.activity.main;
|
||||||
|
|
||||||
|
import android.content.ActivityNotFoundException;
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.ComponentName;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.IntentFilter;
|
||||||
|
import android.content.ServiceConnection;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.os.IBinder;
|
||||||
|
import android.os.RemoteException;
|
||||||
|
import android.provider.Settings;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.KeyEvent;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
|
import androidx.viewpager.widget.ViewPager;
|
||||||
|
|
||||||
|
import com.alarmclock.uiui.IAlarmAidlInterface;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
import com.hjq.permissions.OnPermissionCallback;
|
||||||
|
import com.hjq.permissions.Permission;
|
||||||
|
import com.hjq.permissions.XXPermissions;
|
||||||
|
import com.uiuios.aios.BuildConfig;
|
||||||
|
import com.uiuios.aios.R;
|
||||||
|
import com.uiuios.aios.base.BaseActivity;
|
||||||
|
import com.uiuios.aios.base.BaseFragmentPagerAdapter;
|
||||||
|
import com.uiuios.aios.bean.AlarmItem;
|
||||||
|
import com.uiuios.aios.bean.DesktopIcon;
|
||||||
|
import com.uiuios.aios.config.CommonConfig;
|
||||||
|
import com.uiuios.aios.fragment.AppListFragment;
|
||||||
|
import com.uiuios.aios.fragment.ControlFragment;
|
||||||
|
import com.uiuios.aios.fragment.home.HomeFragment;
|
||||||
|
import com.uiuios.aios.fragment.second.SecondFragment;
|
||||||
|
import com.uiuios.aios.manager.RemoteManager;
|
||||||
|
import com.uiuios.aios.service.NotificationService;
|
||||||
|
import com.uiuios.aios.utils.ApkUtils;
|
||||||
|
import com.uiuios.aios.utils.AppUsedTimeUtils;
|
||||||
|
import com.uiuios.aios.utils.ToastUtil;
|
||||||
|
import com.uiuios.aios.view.ScaleCircleNavigator;
|
||||||
|
|
||||||
|
import net.lucode.hackware.magicindicator.MagicIndicator;
|
||||||
|
import net.lucode.hackware.magicindicator.ViewPagerHelper;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import butterknife.BindView;
|
||||||
|
import butterknife.ButterKnife;
|
||||||
|
|
||||||
|
public abstract class BaseMainActivity extends BaseActivity implements MainContact.MainView {
|
||||||
|
private static final String TAG = BaseMainActivity.class.getSimpleName();
|
||||||
|
|
||||||
|
private MainPresenter mMainPresenter;
|
||||||
|
|
||||||
|
@BindView(R.id.viewPager)
|
||||||
|
ViewPager mViewPager;
|
||||||
|
@BindView(R.id.magicIndicator)
|
||||||
|
MagicIndicator mMagicIndicator;
|
||||||
|
|
||||||
|
private FragmentManager mFragmentManager;
|
||||||
|
private FragmentTransaction mFragmentTransaction;
|
||||||
|
|
||||||
|
private ScaleCircleNavigator scaleCircleNavigator;
|
||||||
|
private BaseFragmentPagerAdapter mBaseFragmentPagerAdapter;
|
||||||
|
|
||||||
|
private List<Fragment> mFragments;
|
||||||
|
private ControlFragment mControlFragment;
|
||||||
|
private HomeFragment mHomeFragment;
|
||||||
|
// private CustomFragment mCustomFragment;
|
||||||
|
private SecondFragment mSecondFragment;
|
||||||
|
|
||||||
|
private boolean is_twoscreen = false;
|
||||||
|
private int appListIndex = 3;
|
||||||
|
private int defaultCurrent = 2;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initView() {
|
||||||
|
ButterKnife.bind(this);
|
||||||
|
toggleNotificationListenerService(this);
|
||||||
|
mMainPresenter = new MainPresenter(this);
|
||||||
|
mMainPresenter.attachView(this);
|
||||||
|
mMainPresenter.setLifecycle(lifecycleSubject);
|
||||||
|
|
||||||
|
if (BuildConfig.DEBUG) {
|
||||||
|
// SystemClock.setCurrentTimeMillis(1662123600000L);//09-02
|
||||||
|
// SystemClock.setCurrentTimeMillis(1662210000000L);//09-03
|
||||||
|
}
|
||||||
|
|
||||||
|
mFragmentManager = getSupportFragmentManager();
|
||||||
|
mFragmentTransaction = mFragmentManager.beginTransaction();
|
||||||
|
mFragments = new ArrayList<>();
|
||||||
|
mBaseFragmentPagerAdapter = new BaseFragmentPagerAdapter(mFragmentManager, mFragments);
|
||||||
|
// fragmentTransaction.add(R.id.viewPager, appListFragment);
|
||||||
|
// fragmentTransaction.commit();
|
||||||
|
mControlFragment = new ControlFragment();
|
||||||
|
mFragments.add(mControlFragment);
|
||||||
|
// is_twoscreen = Settings.Global.getInt(getContentResolver(), "is_twoscreen", 1) == 1;
|
||||||
|
// if (is_twoscreen) {
|
||||||
|
// appListIndex = 2;
|
||||||
|
// defaultCurrent = 1;
|
||||||
|
mSecondFragment = new SecondFragment();
|
||||||
|
mFragments.add(mSecondFragment);
|
||||||
|
// }
|
||||||
|
// mCustomFragment = new CustomFragment();
|
||||||
|
// mFragments.add(mCustomFragment);
|
||||||
|
|
||||||
|
mHomeFragment = new HomeFragment();
|
||||||
|
mFragments.add(mHomeFragment);
|
||||||
|
|
||||||
|
mMainPresenter.getSystemSettings();
|
||||||
|
// mMainPresenter.getAdminSnSetting();
|
||||||
|
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 = 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);
|
||||||
|
mViewPager.setOffscreenPageLimit(3);
|
||||||
|
mMagicIndicator.setNavigator(scaleCircleNavigator);
|
||||||
|
ViewPagerHelper.bind(mMagicIndicator, mViewPager);
|
||||||
|
if (mFragments.size() > 1) {
|
||||||
|
mViewPager.setCurrentItem(defaultCurrent);
|
||||||
|
}
|
||||||
|
|
||||||
|
View decorView = getWindow().getDecorView();
|
||||||
|
decorView.setOnSystemUiVisibilityChangeListener(mOnSystemUiVisibilityChangeListener);
|
||||||
|
|
||||||
|
// 隐藏导航栏
|
||||||
|
hideNavigationBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
private View.OnSystemUiVisibilityChangeListener mOnSystemUiVisibilityChangeListener =
|
||||||
|
new View.OnSystemUiVisibilityChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onSystemUiVisibilityChange(int visibility) {
|
||||||
|
if ((visibility & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0) {
|
||||||
|
// 导航栏显示中,重新隐藏导航栏
|
||||||
|
hideNavigationBar();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 隐藏导航栏
|
||||||
|
private void hideNavigationBar() {
|
||||||
|
View decorView = getWindow().getDecorView();
|
||||||
|
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||||
|
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||||
|
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
||||||
|
decorView.setSystemUiVisibility(uiOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initData() {
|
||||||
|
registmNewAppReceiver();
|
||||||
|
registerSOSNumberReceiver();
|
||||||
|
registerUpdateDesktopReceiver();
|
||||||
|
mAlarmServiceConnection = new ServiceConnection() {
|
||||||
|
@Override
|
||||||
|
public void onServiceConnected(ComponentName name, IBinder service) {
|
||||||
|
Log.e(TAG, "onServiceConnected: ");
|
||||||
|
mIAlarmAidlInterface = IAlarmAidlInterface.Stub.asInterface(service);
|
||||||
|
getAlarmData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onServiceDisconnected(ComponentName name) {
|
||||||
|
Log.e(TAG, "onServiceDisconnected: ");
|
||||||
|
mIAlarmAidlInterface = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
bindAlarmService();
|
||||||
|
RemoteManager.getInstance().setListener(new RemoteManager.ConnectedListener() {
|
||||||
|
@Override
|
||||||
|
public void onConnected() {
|
||||||
|
setDefaultDesktop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private ServiceConnection mAlarmServiceConnection;
|
||||||
|
private IAlarmAidlInterface mIAlarmAidlInterface;
|
||||||
|
|
||||||
|
private void bindAlarmService() {
|
||||||
|
if (mIAlarmAidlInterface == null) {
|
||||||
|
//这是连接aidl服务的代码
|
||||||
|
Intent intent = new Intent();
|
||||||
|
intent.setAction("com.alarmclock.uiui.IAlarmAidlInterface");
|
||||||
|
intent.setPackage("com.alarmclock.uiui");
|
||||||
|
intent.setComponent(new ComponentName("com.alarmclock.uiui", "com.alarmclock.uiui.AIDLAlarmService"));
|
||||||
|
bindService(intent, mAlarmServiceConnection, Context.BIND_AUTO_CREATE);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void toggleNotificationListenerService(Context context) {
|
||||||
|
Log.e(TAG, "toggleNotificationListenerService");
|
||||||
|
PackageManager pm = context.getPackageManager();
|
||||||
|
pm.setComponentEnabledSetting(new ComponentName(context, NotificationService.class),
|
||||||
|
PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
|
||||||
|
|
||||||
|
pm.setComponentEnabledSetting(new ComponentName(context, NotificationService.class),
|
||||||
|
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getAlarmData() {
|
||||||
|
if (mIAlarmAidlInterface == null) {
|
||||||
|
bindAlarmService();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
String json = mIAlarmAidlInterface.getAlarm();
|
||||||
|
Log.e(TAG, "onServiceConnected: " + json);
|
||||||
|
if ("暂无闹钟".equalsIgnoreCase(json) || TextUtils.isEmpty(json)) {
|
||||||
|
// mCustomFragment.setAlarmItem(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
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() {
|
||||||
|
Log.e(TAG, "addData: ");
|
||||||
|
List<Fragment> fragmentList = new ArrayList<>();
|
||||||
|
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) {
|
||||||
|
AppListFragment appListFragment = new AppListFragment();
|
||||||
|
appListFragment.setAppList(new ArrayList<>(applicationInfoList.subList(x, i)));
|
||||||
|
fragmentList.add(appListFragment);
|
||||||
|
x = i;
|
||||||
|
} else if (i == applicationInfoList.size()) {
|
||||||
|
AppListFragment appListFragment = new AppListFragment();
|
||||||
|
fragmentList.add(appListFragment);
|
||||||
|
appListFragment.setAppList(new ArrayList<>(applicationInfoList.subList(x, i)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//从第三个开始改
|
||||||
|
for (int i = 0; i < fragmentList.size(); i++) {
|
||||||
|
if (i + appListIndex < mFragments.size()) {
|
||||||
|
mBaseFragmentPagerAdapter.replaceFragment(i + appListIndex, fragmentList.get(i));
|
||||||
|
// mFragments.remove(i + 2);
|
||||||
|
// mFragments.add(i + 2, fragmentList.get(i));
|
||||||
|
} else {
|
||||||
|
// mFragments.add(fragmentList.get(i));
|
||||||
|
// mBaseFragmentPagerAdapter.getFragments();
|
||||||
|
mBaseFragmentPagerAdapter.addFragment(fragmentList.get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = mFragments.size(); i > fragmentList.size() + appListIndex; i--) {
|
||||||
|
mFragments.remove(i - 1);
|
||||||
|
}
|
||||||
|
scaleCircleNavigator.setCircleCount(mFragments.size());
|
||||||
|
scaleCircleNavigator.notifyDataSetChanged();
|
||||||
|
mBaseFragmentPagerAdapter.notifyItemChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
|
if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return super.onKeyDown(keyCode, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onNewIntent(Intent intent) {
|
||||||
|
super.onNewIntent(intent);
|
||||||
|
Log.e(TAG, "onNewIntent: " + intent.getAction());
|
||||||
|
String action = intent.getAction();
|
||||||
|
if (TextUtils.isEmpty(action)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
switch (action) {
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
case Intent.ACTION_MAIN:
|
||||||
|
mViewPager.setCurrentItem(defaultCurrent);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfigurationChanged(@NonNull Configuration newConfig) {
|
||||||
|
super.onConfigurationChanged(newConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
AppUsedTimeUtils.getInstance().setAppPackageName(BuildConfig.APPLICATION_ID);
|
||||||
|
AppUsedTimeUtils.getInstance().setStartTime(System.currentTimeMillis());
|
||||||
|
getAlarmData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
Log.e(TAG, "onResume: ");
|
||||||
|
if (!isNotificationListenersEnabled()) {
|
||||||
|
ToastUtil.show("请授予\"" + getString(R.string.app_name) + "\"使用通知权");
|
||||||
|
gotoNotificationAccessSetting(this);
|
||||||
|
} else {
|
||||||
|
getPermission();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String Launcher3 = "com.android.launcher3";
|
||||||
|
public static final String Launcher3Class = "com.android.launcher3.Launcher";
|
||||||
|
public static final String Launcher3QuickstepClass = "com.android.launcher3.uioverrides.QuickstepLauncher";
|
||||||
|
|
||||||
|
private void setDefaultDesktop() {
|
||||||
|
int is_activation = Settings.Global.getInt(getContentResolver(), CommonConfig.UIUI_ACTIVATION_KEY, 0);
|
||||||
|
Log.e(TAG, "onResume: is_activation = " + is_activation);
|
||||||
|
if (is_activation == 1) {
|
||||||
|
RemoteManager.getInstance().setDefaultDesktop(BuildConfig.APPLICATION_ID, this.getClass().getName());
|
||||||
|
} else {
|
||||||
|
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) {
|
||||||
|
RemoteManager.getInstance().setDefaultDesktop(Launcher3, Launcher3QuickstepClass);
|
||||||
|
} else {
|
||||||
|
RemoteManager.getInstance().setDefaultDesktop(Launcher3, Launcher3Class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String[] permission = new String[]{
|
||||||
|
Permission.CALL_PHONE,
|
||||||
|
// Permission.REQUEST_INSTALL_PACKAGES,
|
||||||
|
Permission.WRITE_EXTERNAL_STORAGE,
|
||||||
|
Permission.READ_PHONE_STATE,
|
||||||
|
Permission.WRITE_SETTINGS,
|
||||||
|
Permission.READ_CALL_LOG,
|
||||||
|
Permission.WRITE_CALL_LOG,
|
||||||
|
};
|
||||||
|
|
||||||
|
private void getPermission() {
|
||||||
|
XXPermissions.with(this)
|
||||||
|
// 申请单个权限
|
||||||
|
// .permission(Permission.RECORD_AUDIO)
|
||||||
|
// 申请多个权限
|
||||||
|
.permission(permission)
|
||||||
|
// 设置权限请求拦截器(局部设置)
|
||||||
|
//.interceptor(new PermissionInterceptor())
|
||||||
|
// 设置不触发错误检测机制(局部设置)
|
||||||
|
//.unchecked()
|
||||||
|
.request(new OnPermissionCallback() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGranted(@NonNull List<String> permissions, boolean allGranted) {
|
||||||
|
if (!allGranted) {
|
||||||
|
ToastUtil.show("获取部分权限成功,但部分权限未正常授予");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// ToastUtil.show("获取录音和日历权限成功");
|
||||||
|
Log.e(TAG, "onGranted: 获取存储权限成功");
|
||||||
|
addData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDenied(@NonNull List<String> permissions, boolean doNotAskAgain) {
|
||||||
|
if (doNotAskAgain) {
|
||||||
|
ToastUtil.show("被永久拒绝授权,请手动授予存储权限");
|
||||||
|
// 如果是被永久拒绝就跳转到应用权限系统设置页面
|
||||||
|
XXPermissions.startPermissionActivity(BaseMainActivity.this, permissions);
|
||||||
|
} else {
|
||||||
|
// ToastUtil.show("获取录音和日历权限失败");
|
||||||
|
Log.e(TAG, "onGranted: 获取存储权限权限失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static final String ENABLED_NOTIFICATION_LISTENERS = "enabled_notification_listeners";
|
||||||
|
|
||||||
|
private boolean isNotificationListenersEnabled() {
|
||||||
|
String pkgName = getPackageName();
|
||||||
|
final String flat = Settings.Secure.getString(getContentResolver(), ENABLED_NOTIFICATION_LISTENERS);
|
||||||
|
if (!TextUtils.isEmpty(flat)) {
|
||||||
|
final String[] names = flat.split(":");
|
||||||
|
for (int i = 0; i < names.length; i++) {
|
||||||
|
final ComponentName cn = ComponentName.unflattenFromString(names[i]);
|
||||||
|
if (cn != null) {
|
||||||
|
if (TextUtils.equals(pkgName, cn.getPackageName())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean gotoNotificationAccessSetting(Context context) {
|
||||||
|
try {
|
||||||
|
Intent intent = new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS");
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
context.startActivity(intent);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
} catch (ActivityNotFoundException e) {//普通情况下找不到的时候需要再特殊处理找一次
|
||||||
|
try {
|
||||||
|
Intent intent = new Intent();
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
ComponentName cn = new ComponentName("com.android.settings", "com.android.settings.Settings$NotificationAccessSettingsActivity");
|
||||||
|
intent.setComponent(cn);
|
||||||
|
intent.putExtra(":settings:show_fragment", "NotificationAccessSettings");
|
||||||
|
context.startActivity(intent);
|
||||||
|
return true;
|
||||||
|
} catch (Exception e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
ToastUtil.show("对不起,您的手机暂不支持");
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onRestart() {
|
||||||
|
super.onRestart();
|
||||||
|
mMainPresenter.sendAPPUsage();
|
||||||
|
mMainPresenter.sendRunningInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStop() {
|
||||||
|
super.onStop();
|
||||||
|
AppUsedTimeUtils.getInstance().setEndTime(System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
mMainPresenter.detachView();
|
||||||
|
if (mNewAppReceiver != null) {
|
||||||
|
unregisterReceiver(mNewAppReceiver);
|
||||||
|
}
|
||||||
|
if (updateDesktopReceiver != null) {
|
||||||
|
unregisterReceiver(updateDesktopReceiver);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||||
|
// super.onSaveInstanceState(outState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onRestoreInstanceState(Bundle savedInstanceState) {
|
||||||
|
// super.onRestoreInstanceState(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void registmNewAppReceiver() {
|
||||||
|
mNewAppReceiver = new NewAppReceiver();
|
||||||
|
IntentFilter filter = new IntentFilter();
|
||||||
|
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
|
||||||
|
filter.addAction(Intent.ACTION_PACKAGE_ADDED);
|
||||||
|
filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
|
||||||
|
filter.addAction(Intent.ACTION_PACKAGE_REPLACED);
|
||||||
|
filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
|
||||||
|
filter.addDataScheme("package");
|
||||||
|
registerReceiver(mNewAppReceiver, filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
private NewAppReceiver mNewAppReceiver;
|
||||||
|
|
||||||
|
class NewAppReceiver extends BroadcastReceiver {
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
String action = intent.getAction();
|
||||||
|
Log.e(TAG, "onReceive: " + action);
|
||||||
|
if (Intent.ACTION_PACKAGE_ADDED.equals(action)
|
||||||
|
|| Intent.ACTION_PACKAGE_REMOVED.equals(action)
|
||||||
|
|| Intent.ACTION_PACKAGE_CHANGED.equals(action)) {
|
||||||
|
addData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private SOSNumberReceiver sosNumberReceiver;
|
||||||
|
|
||||||
|
private void registerSOSNumberReceiver() {
|
||||||
|
if (sosNumberReceiver == null) {
|
||||||
|
sosNumberReceiver = new SOSNumberReceiver();
|
||||||
|
}
|
||||||
|
IntentFilter filter = new IntentFilter();
|
||||||
|
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
|
||||||
|
filter.addAction("setting_sos");
|
||||||
|
registerReceiver(sosNumberReceiver, filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
class SOSNumberReceiver extends BroadcastReceiver {
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
Log.e(TAG, "onReceive: " + intent.getAction());
|
||||||
|
String setting_sos = intent.getStringExtra("setting_sos");
|
||||||
|
if (TextUtils.isEmpty(setting_sos)) return;
|
||||||
|
// mCustomFragment.setSosNumber();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String ACTION_PACKAGE_HIDE = "com.uiui.aios.ACTION_PACKAGE_HIDE";
|
||||||
|
|
||||||
|
private UpdateDesktopReceiver updateDesktopReceiver;
|
||||||
|
|
||||||
|
private void registerUpdateDesktopReceiver() {
|
||||||
|
if (updateDesktopReceiver == null) {
|
||||||
|
updateDesktopReceiver = new UpdateDesktopReceiver();
|
||||||
|
}
|
||||||
|
IntentFilter filter = new IntentFilter();
|
||||||
|
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
|
||||||
|
filter.addAction("UPDATE_DESKTOP_ICON");
|
||||||
|
filter.addAction(ACTION_PACKAGE_HIDE);
|
||||||
|
registerReceiver(updateDesktopReceiver, filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
class UpdateDesktopReceiver extends BroadcastReceiver {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
Log.e(TAG, "onReceive: " + intent.getAction());
|
||||||
|
addData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSystemSettings() {
|
||||||
|
// mMainPresenter.getDesktopLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getDesktopLayoutFinish() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateDesktopLayoutFinish() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendAPPUsageFinish() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendRunningInfoFinish() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAdminSnSetting() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,612 +1,12 @@
|
|||||||
package com.uiuios.aios.activity.main;
|
package com.uiuios.aios.activity.main;
|
||||||
|
|
||||||
import android.content.ActivityNotFoundException;
|
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.ComponentName;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.IntentFilter;
|
|
||||||
import android.content.ServiceConnection;
|
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.content.res.Configuration;
|
|
||||||
import android.graphics.Color;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.IBinder;
|
|
||||||
import android.os.RemoteException;
|
|
||||||
import android.provider.Settings;
|
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.KeyEvent;
|
|
||||||
import android.view.View;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
import androidx.fragment.app.FragmentManager;
|
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
|
||||||
import androidx.viewpager.widget.ViewPager;
|
|
||||||
|
|
||||||
import com.alarmclock.uiui.IAlarmAidlInterface;
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
|
||||||
import com.hjq.permissions.OnPermissionCallback;
|
|
||||||
import com.hjq.permissions.Permission;
|
|
||||||
import com.hjq.permissions.XXPermissions;
|
|
||||||
import com.uiuios.aios.BuildConfig;
|
|
||||||
import com.uiuios.aios.R;
|
import com.uiuios.aios.R;
|
||||||
import com.uiuios.aios.base.BaseActivity;
|
|
||||||
import com.uiuios.aios.bean.AlarmItem;
|
|
||||||
import com.uiuios.aios.bean.DesktopIcon;
|
|
||||||
import com.uiuios.aios.config.CommonConfig;
|
|
||||||
import com.uiuios.aios.fragment.AppListFragment;
|
|
||||||
import com.uiuios.aios.base.BaseFragmentPagerAdapter;
|
|
||||||
import com.uiuios.aios.fragment.ControlFragment;
|
|
||||||
import com.uiuios.aios.fragment.custom.CustomFragment;
|
|
||||||
import com.uiuios.aios.fragment.home.HomeFragment;
|
|
||||||
import com.uiuios.aios.fragment.second.SecondFragment;
|
|
||||||
import com.uiuios.aios.manager.RemoteManager;
|
|
||||||
import com.uiuios.aios.service.NotificationService;
|
|
||||||
import com.uiuios.aios.utils.ApkUtils;
|
|
||||||
import com.uiuios.aios.utils.AppUsedTimeUtils;
|
|
||||||
import com.uiuios.aios.utils.HomeWatcher;
|
|
||||||
import com.uiuios.aios.utils.ToastUtil;
|
|
||||||
import com.uiuios.aios.view.ScaleCircleNavigator;
|
|
||||||
|
|
||||||
import net.lucode.hackware.magicindicator.MagicIndicator;
|
public class MainActivity extends BaseMainActivity {
|
||||||
import net.lucode.hackware.magicindicator.ViewPagerHelper;
|
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import butterknife.BindView;
|
|
||||||
import butterknife.ButterKnife;
|
|
||||||
|
|
||||||
public class MainActivity extends BaseActivity implements MainContact.MainView {
|
|
||||||
private static final String TAG = MainActivity.class.getSimpleName();
|
private static final String TAG = MainActivity.class.getSimpleName();
|
||||||
private MainPresenter mMainPresenter;
|
|
||||||
|
|
||||||
@BindView(R.id.viewPager)
|
|
||||||
ViewPager mViewPager;
|
|
||||||
@BindView(R.id.magicIndicator)
|
|
||||||
MagicIndicator mMagicIndicator;
|
|
||||||
|
|
||||||
private FragmentManager mFragmentManager;
|
|
||||||
private FragmentTransaction mFragmentTransaction;
|
|
||||||
|
|
||||||
private ScaleCircleNavigator scaleCircleNavigator;
|
|
||||||
private BaseFragmentPagerAdapter mBaseFragmentPagerAdapter;
|
|
||||||
|
|
||||||
private List<Fragment> mFragments;
|
|
||||||
private ControlFragment mControlFragment;
|
|
||||||
private HomeFragment mHomeFragment;
|
|
||||||
// private CustomFragment mCustomFragment;
|
|
||||||
private SecondFragment mSecondFragment;
|
|
||||||
|
|
||||||
private boolean is_twoscreen = false;
|
|
||||||
private int appListIndex = 3;
|
|
||||||
private int defaultCurrent = 2;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLayoutId() {
|
public int getLayoutId() {
|
||||||
return R.layout.activity_main;
|
return R.layout.activity_main;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initView() {
|
|
||||||
ButterKnife.bind(this);
|
|
||||||
toggleNotificationListenerService(this);
|
|
||||||
mMainPresenter = new MainPresenter(this);
|
|
||||||
mMainPresenter.attachView(this);
|
|
||||||
mMainPresenter.setLifecycle(lifecycleSubject);
|
|
||||||
|
|
||||||
if (BuildConfig.DEBUG) {
|
|
||||||
// SystemClock.setCurrentTimeMillis(1662123600000L);//09-02
|
|
||||||
// SystemClock.setCurrentTimeMillis(1662210000000L);//09-03
|
|
||||||
}
|
|
||||||
|
|
||||||
mFragmentManager = getSupportFragmentManager();
|
|
||||||
mFragmentTransaction = mFragmentManager.beginTransaction();
|
|
||||||
mFragments = new ArrayList<>();
|
|
||||||
mBaseFragmentPagerAdapter = new BaseFragmentPagerAdapter(mFragmentManager, mFragments);
|
|
||||||
// fragmentTransaction.add(R.id.viewPager, appListFragment);
|
|
||||||
// fragmentTransaction.commit();
|
|
||||||
mControlFragment =new ControlFragment();
|
|
||||||
mFragments.add(mControlFragment);
|
|
||||||
// is_twoscreen = Settings.Global.getInt(getContentResolver(), "is_twoscreen", 1) == 1;
|
|
||||||
// if (is_twoscreen) {
|
|
||||||
// appListIndex = 2;
|
|
||||||
// defaultCurrent = 1;
|
|
||||||
mSecondFragment = new SecondFragment();
|
|
||||||
mFragments.add(mSecondFragment);
|
|
||||||
// }
|
|
||||||
// mCustomFragment = new CustomFragment();
|
|
||||||
// mFragments.add(mCustomFragment);
|
|
||||||
|
|
||||||
mHomeFragment =new HomeFragment();
|
|
||||||
mFragments.add(mHomeFragment);
|
|
||||||
|
|
||||||
mMainPresenter.getSystemSettings();
|
|
||||||
// mMainPresenter.getAdminSnSetting();
|
|
||||||
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 = 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);
|
|
||||||
mViewPager.setOffscreenPageLimit(3);
|
|
||||||
mMagicIndicator.setNavigator(scaleCircleNavigator);
|
|
||||||
ViewPagerHelper.bind(mMagicIndicator, mViewPager);
|
|
||||||
if (mFragments.size() > 1) {
|
|
||||||
mViewPager.setCurrentItem(defaultCurrent);
|
|
||||||
}
|
|
||||||
|
|
||||||
View decorView = getWindow().getDecorView();
|
|
||||||
decorView.setOnSystemUiVisibilityChangeListener(mOnSystemUiVisibilityChangeListener);
|
|
||||||
|
|
||||||
// 隐藏导航栏
|
|
||||||
hideNavigationBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
private View.OnSystemUiVisibilityChangeListener mOnSystemUiVisibilityChangeListener =
|
|
||||||
new View.OnSystemUiVisibilityChangeListener() {
|
|
||||||
@Override
|
|
||||||
public void onSystemUiVisibilityChange(int visibility) {
|
|
||||||
if ((visibility & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0) {
|
|
||||||
// 导航栏显示中,重新隐藏导航栏
|
|
||||||
hideNavigationBar();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 隐藏导航栏
|
|
||||||
private void hideNavigationBar() {
|
|
||||||
View decorView = getWindow().getDecorView();
|
|
||||||
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
|
||||||
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
|
||||||
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
|
||||||
decorView.setSystemUiVisibility(uiOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initData() {
|
|
||||||
registmNewAppReceiver();
|
|
||||||
registerSOSNumberReceiver();
|
|
||||||
registerUpdateDesktopReceiver();
|
|
||||||
mAlarmServiceConnection = new ServiceConnection() {
|
|
||||||
@Override
|
|
||||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
|
||||||
Log.e(TAG, "onServiceConnected: ");
|
|
||||||
mIAlarmAidlInterface = IAlarmAidlInterface.Stub.asInterface(service);
|
|
||||||
getAlarmData();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onServiceDisconnected(ComponentName name) {
|
|
||||||
Log.e(TAG, "onServiceDisconnected: ");
|
|
||||||
mIAlarmAidlInterface = null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
bindAlarmService();
|
|
||||||
RemoteManager.getInstance().setListener(new RemoteManager.ConnectedListener() {
|
|
||||||
@Override
|
|
||||||
public void onConnected() {
|
|
||||||
setDefaultDesktop();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private ServiceConnection mAlarmServiceConnection;
|
|
||||||
private IAlarmAidlInterface mIAlarmAidlInterface;
|
|
||||||
|
|
||||||
private void bindAlarmService() {
|
|
||||||
if (mIAlarmAidlInterface == null) {
|
|
||||||
//这是连接aidl服务的代码
|
|
||||||
Intent intent = new Intent();
|
|
||||||
intent.setAction("com.alarmclock.uiui.IAlarmAidlInterface");
|
|
||||||
intent.setPackage("com.alarmclock.uiui");
|
|
||||||
intent.setComponent(new ComponentName("com.alarmclock.uiui", "com.alarmclock.uiui.AIDLAlarmService"));
|
|
||||||
bindService(intent, mAlarmServiceConnection, Context.BIND_AUTO_CREATE);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void toggleNotificationListenerService(Context context) {
|
|
||||||
Log.e(TAG, "toggleNotificationListenerService");
|
|
||||||
PackageManager pm = context.getPackageManager();
|
|
||||||
pm.setComponentEnabledSetting(new ComponentName(context, NotificationService.class),
|
|
||||||
PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
|
|
||||||
|
|
||||||
pm.setComponentEnabledSetting(new ComponentName(context, NotificationService.class),
|
|
||||||
PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void getAlarmData() {
|
|
||||||
if (mIAlarmAidlInterface == null) {
|
|
||||||
bindAlarmService();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
String json = mIAlarmAidlInterface.getAlarm();
|
|
||||||
Log.e(TAG, "onServiceConnected: " + json);
|
|
||||||
if ("暂无闹钟".equalsIgnoreCase(json) || TextUtils.isEmpty(json)) {
|
|
||||||
// mCustomFragment.setAlarmItem(null);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
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() {
|
|
||||||
Log.e(TAG, "addData: ");
|
|
||||||
List<Fragment> fragmentList = new ArrayList<>();
|
|
||||||
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) {
|
|
||||||
AppListFragment appListFragment = new AppListFragment();
|
|
||||||
appListFragment.setAppList(new ArrayList<>(applicationInfoList.subList(x, i)));
|
|
||||||
fragmentList.add(appListFragment);
|
|
||||||
x = i;
|
|
||||||
} else if (i == applicationInfoList.size()) {
|
|
||||||
AppListFragment appListFragment = new AppListFragment();
|
|
||||||
fragmentList.add(appListFragment);
|
|
||||||
appListFragment.setAppList(new ArrayList<>(applicationInfoList.subList(x, i)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//从第三个开始改
|
|
||||||
for (int i = 0; i < fragmentList.size(); i++) {
|
|
||||||
if (i + appListIndex < mFragments.size()) {
|
|
||||||
mBaseFragmentPagerAdapter.replaceFragment(i + appListIndex, fragmentList.get(i));
|
|
||||||
// mFragments.remove(i + 2);
|
|
||||||
// mFragments.add(i + 2, fragmentList.get(i));
|
|
||||||
} else {
|
|
||||||
// mFragments.add(fragmentList.get(i));
|
|
||||||
// mBaseFragmentPagerAdapter.getFragments();
|
|
||||||
mBaseFragmentPagerAdapter.addFragment(fragmentList.get(i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int i = mFragments.size(); i > fragmentList.size() + appListIndex; i--) {
|
|
||||||
mFragments.remove(i - 1);
|
|
||||||
}
|
|
||||||
scaleCircleNavigator.setCircleCount(mFragments.size());
|
|
||||||
scaleCircleNavigator.notifyDataSetChanged();
|
|
||||||
mBaseFragmentPagerAdapter.notifyItemChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
|
||||||
if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return super.onKeyDown(keyCode, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onNewIntent(Intent intent) {
|
|
||||||
super.onNewIntent(intent);
|
|
||||||
Log.e(TAG, "onNewIntent: " + intent.getAction());
|
|
||||||
String action = intent.getAction();
|
|
||||||
if (TextUtils.isEmpty(action)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
switch (action) {
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
case Intent.ACTION_MAIN:
|
|
||||||
mViewPager.setCurrentItem(defaultCurrent);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onConfigurationChanged(@NonNull Configuration newConfig) {
|
|
||||||
super.onConfigurationChanged(newConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onStart() {
|
|
||||||
super.onStart();
|
|
||||||
AppUsedTimeUtils.getInstance().setAppPackageName(BuildConfig.APPLICATION_ID);
|
|
||||||
AppUsedTimeUtils.getInstance().setStartTime(System.currentTimeMillis());
|
|
||||||
getAlarmData();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
Log.e(TAG, "onResume: ");
|
|
||||||
if (!isNotificationListenersEnabled()) {
|
|
||||||
ToastUtil.show("请授予\"" + getString(R.string.app_name) + "\"使用通知权");
|
|
||||||
gotoNotificationAccessSetting(this);
|
|
||||||
} else {
|
|
||||||
getPermission();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final String Launcher3 = "com.android.launcher3";
|
|
||||||
public static final String Launcher3Class = "com.android.launcher3.Launcher";
|
|
||||||
public static final String Launcher3QuickstepClass = "com.android.launcher3.uioverrides.QuickstepLauncher";
|
|
||||||
|
|
||||||
private void setDefaultDesktop() {
|
|
||||||
int is_activation = Settings.Global.getInt(getContentResolver(), CommonConfig.UIUI_ACTIVATION_KEY, 0);
|
|
||||||
Log.e(TAG, "onResume: is_activation = " + is_activation);
|
|
||||||
if (is_activation == 1) {
|
|
||||||
RemoteManager.getInstance().setDefaultDesktop(BuildConfig.APPLICATION_ID, this.getClass().getName());
|
|
||||||
} else {
|
|
||||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) {
|
|
||||||
RemoteManager.getInstance().setDefaultDesktop(Launcher3, Launcher3QuickstepClass);
|
|
||||||
} else {
|
|
||||||
RemoteManager.getInstance().setDefaultDesktop(Launcher3, Launcher3Class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private String[] permission = new String[]{
|
|
||||||
Permission.CALL_PHONE,
|
|
||||||
// Permission.REQUEST_INSTALL_PACKAGES,
|
|
||||||
Permission.WRITE_EXTERNAL_STORAGE,
|
|
||||||
Permission.READ_PHONE_STATE,
|
|
||||||
Permission.WRITE_SETTINGS,
|
|
||||||
Permission.READ_CALL_LOG,
|
|
||||||
Permission.WRITE_CALL_LOG,
|
|
||||||
};
|
|
||||||
|
|
||||||
private void getPermission() {
|
|
||||||
XXPermissions.with(this)
|
|
||||||
// 申请单个权限
|
|
||||||
// .permission(Permission.RECORD_AUDIO)
|
|
||||||
// 申请多个权限
|
|
||||||
.permission(permission)
|
|
||||||
// 设置权限请求拦截器(局部设置)
|
|
||||||
//.interceptor(new PermissionInterceptor())
|
|
||||||
// 设置不触发错误检测机制(局部设置)
|
|
||||||
//.unchecked()
|
|
||||||
.request(new OnPermissionCallback() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onGranted(@NonNull List<String> permissions, boolean allGranted) {
|
|
||||||
if (!allGranted) {
|
|
||||||
ToastUtil.show("获取部分权限成功,但部分权限未正常授予");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// ToastUtil.show("获取录音和日历权限成功");
|
|
||||||
Log.e(TAG, "onGranted: 获取存储权限成功");
|
|
||||||
addData();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDenied(@NonNull List<String> permissions, boolean doNotAskAgain) {
|
|
||||||
if (doNotAskAgain) {
|
|
||||||
ToastUtil.show("被永久拒绝授权,请手动授予存储权限");
|
|
||||||
// 如果是被永久拒绝就跳转到应用权限系统设置页面
|
|
||||||
XXPermissions.startPermissionActivity(MainActivity.this, permissions);
|
|
||||||
} else {
|
|
||||||
// ToastUtil.show("获取录音和日历权限失败");
|
|
||||||
Log.e(TAG, "onGranted: 获取存储权限权限失败");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private static final String ENABLED_NOTIFICATION_LISTENERS = "enabled_notification_listeners";
|
|
||||||
|
|
||||||
private boolean isNotificationListenersEnabled() {
|
|
||||||
String pkgName = getPackageName();
|
|
||||||
final String flat = Settings.Secure.getString(getContentResolver(), ENABLED_NOTIFICATION_LISTENERS);
|
|
||||||
if (!TextUtils.isEmpty(flat)) {
|
|
||||||
final String[] names = flat.split(":");
|
|
||||||
for (int i = 0; i < names.length; i++) {
|
|
||||||
final ComponentName cn = ComponentName.unflattenFromString(names[i]);
|
|
||||||
if (cn != null) {
|
|
||||||
if (TextUtils.equals(pkgName, cn.getPackageName())) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean gotoNotificationAccessSetting(Context context) {
|
|
||||||
try {
|
|
||||||
Intent intent = new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS");
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
context.startActivity(intent);
|
|
||||||
return true;
|
|
||||||
|
|
||||||
} catch (ActivityNotFoundException e) {//普通情况下找不到的时候需要再特殊处理找一次
|
|
||||||
try {
|
|
||||||
Intent intent = new Intent();
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
ComponentName cn = new ComponentName("com.android.settings", "com.android.settings.Settings$NotificationAccessSettingsActivity");
|
|
||||||
intent.setComponent(cn);
|
|
||||||
intent.putExtra(":settings:show_fragment", "NotificationAccessSettings");
|
|
||||||
context.startActivity(intent);
|
|
||||||
return true;
|
|
||||||
} catch (Exception e1) {
|
|
||||||
e1.printStackTrace();
|
|
||||||
}
|
|
||||||
ToastUtil.show("对不起,您的手机暂不支持");
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onRestart() {
|
|
||||||
super.onRestart();
|
|
||||||
mMainPresenter.sendAPPUsage();
|
|
||||||
mMainPresenter.sendRunningInfo();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPause() {
|
|
||||||
super.onPause();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onStop() {
|
|
||||||
super.onStop();
|
|
||||||
AppUsedTimeUtils.getInstance().setEndTime(System.currentTimeMillis());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
mMainPresenter.detachView();
|
|
||||||
if (mNewAppReceiver != null) {
|
|
||||||
unregisterReceiver(mNewAppReceiver);
|
|
||||||
}
|
|
||||||
if (updateDesktopReceiver != null) {
|
|
||||||
unregisterReceiver(updateDesktopReceiver);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
|
||||||
// super.onSaveInstanceState(outState);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onRestoreInstanceState(Bundle savedInstanceState) {
|
|
||||||
// super.onRestoreInstanceState(savedInstanceState);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void registmNewAppReceiver() {
|
|
||||||
mNewAppReceiver = new NewAppReceiver();
|
|
||||||
IntentFilter filter = new IntentFilter();
|
|
||||||
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
|
|
||||||
filter.addAction(Intent.ACTION_PACKAGE_ADDED);
|
|
||||||
filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
|
|
||||||
filter.addAction(Intent.ACTION_PACKAGE_REPLACED);
|
|
||||||
filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
|
|
||||||
filter.addDataScheme("package");
|
|
||||||
registerReceiver(mNewAppReceiver, filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
private NewAppReceiver mNewAppReceiver;
|
|
||||||
|
|
||||||
class NewAppReceiver extends BroadcastReceiver {
|
|
||||||
@Override
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
String action = intent.getAction();
|
|
||||||
Log.e(TAG, "onReceive: " + action);
|
|
||||||
if (Intent.ACTION_PACKAGE_ADDED.equals(action)
|
|
||||||
|| Intent.ACTION_PACKAGE_REMOVED.equals(action)
|
|
||||||
|| Intent.ACTION_PACKAGE_CHANGED.equals(action)) {
|
|
||||||
addData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private SOSNumberReceiver sosNumberReceiver;
|
|
||||||
|
|
||||||
private void registerSOSNumberReceiver() {
|
|
||||||
if (sosNumberReceiver == null) {
|
|
||||||
sosNumberReceiver = new SOSNumberReceiver();
|
|
||||||
}
|
|
||||||
IntentFilter filter = new IntentFilter();
|
|
||||||
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
|
|
||||||
filter.addAction("setting_sos");
|
|
||||||
registerReceiver(sosNumberReceiver, filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
class SOSNumberReceiver extends BroadcastReceiver {
|
|
||||||
@Override
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
Log.e(TAG, "onReceive: " + intent.getAction());
|
|
||||||
String setting_sos = intent.getStringExtra("setting_sos");
|
|
||||||
if (TextUtils.isEmpty(setting_sos)) return;
|
|
||||||
// mCustomFragment.setSosNumber();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final String ACTION_PACKAGE_HIDE = "com.uiui.aios.ACTION_PACKAGE_HIDE";
|
|
||||||
|
|
||||||
private UpdateDesktopReceiver updateDesktopReceiver;
|
|
||||||
|
|
||||||
private void registerUpdateDesktopReceiver() {
|
|
||||||
if (updateDesktopReceiver == null) {
|
|
||||||
updateDesktopReceiver = new UpdateDesktopReceiver();
|
|
||||||
}
|
|
||||||
IntentFilter filter = new IntentFilter();
|
|
||||||
filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
|
|
||||||
filter.addAction("UPDATE_DESKTOP_ICON");
|
|
||||||
filter.addAction(ACTION_PACKAGE_HIDE);
|
|
||||||
registerReceiver(updateDesktopReceiver, filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
class UpdateDesktopReceiver extends BroadcastReceiver {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
Log.e(TAG, "onReceive: " + intent.getAction());
|
|
||||||
addData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setSystemSettings() {
|
|
||||||
// mMainPresenter.getDesktopLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void getDesktopLayoutFinish() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateDesktopLayoutFinish() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendAPPUsageFinish() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendRunningInfoFinish() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAdminSnSetting() {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.uiuios.aios.activity.main;
|
||||||
|
|
||||||
|
import com.uiuios.aios.R;
|
||||||
|
|
||||||
|
public class PhoneMainActivity extends BaseMainActivity {
|
||||||
|
private static final String TAG = PhoneMainActivity.class.getSimpleName();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getLayoutId() {
|
||||||
|
return R.layout.phone_activity_main;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -37,12 +37,16 @@ import androidx.fragment.app.Fragment;
|
|||||||
import com.tencent.mmkv.MMKV;
|
import com.tencent.mmkv.MMKV;
|
||||||
import com.uiuios.aios.R;
|
import com.uiuios.aios.R;
|
||||||
import com.uiuios.aios.activity.ControlActivity;
|
import com.uiuios.aios.activity.ControlActivity;
|
||||||
|
import com.uiuios.aios.activity.SplashActivity;
|
||||||
|
import com.uiuios.aios.activity.main.MainActivity;
|
||||||
|
import com.uiuios.aios.activity.main.PhoneMainActivity;
|
||||||
import com.uiuios.aios.base.BaseFragment;
|
import com.uiuios.aios.base.BaseFragment;
|
||||||
import com.uiuios.aios.config.CommonConfig;
|
import com.uiuios.aios.config.CommonConfig;
|
||||||
import com.uiuios.aios.disklrucache.CacheHelper;
|
import com.uiuios.aios.disklrucache.CacheHelper;
|
||||||
import com.uiuios.aios.manager.RemoteManager;
|
import com.uiuios.aios.manager.RemoteManager;
|
||||||
import com.uiuios.aios.utils.BrightnessUtils;
|
import com.uiuios.aios.utils.BrightnessUtils;
|
||||||
import com.uiuios.aios.utils.ToastUtil;
|
import com.uiuios.aios.utils.ToastUtil;
|
||||||
|
import com.uiuios.aios.utils.Utils;
|
||||||
import com.uiuios.aios.view.RulerSeekBar;
|
import com.uiuios.aios.view.RulerSeekBar;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
@@ -163,7 +167,11 @@ public class ControlFragment extends BaseFragment {
|
|||||||
parent.removeView(rootView);
|
parent.removeView(rootView);
|
||||||
}
|
}
|
||||||
} else { // 如ongoing果rootView为空 ,就实例化该视图
|
} else { // 如ongoing果rootView为空 ,就实例化该视图
|
||||||
|
if (Utils.isTablet(container.getContext())) {
|
||||||
rootView = inflater.inflate(R.layout.fragment_control, container, false);
|
rootView = inflater.inflate(R.layout.fragment_control, container, false);
|
||||||
|
} else {
|
||||||
|
rootView = inflater.inflate(R.layout.phone_fragment_control, container, false);
|
||||||
|
}
|
||||||
mContext = rootView.getContext();
|
mContext = rootView.getContext();
|
||||||
mCRv = mContext.getContentResolver();
|
mCRv = mContext.getContentResolver();
|
||||||
mCacheHelper = new CacheHelper(mContext);
|
mCacheHelper = new CacheHelper(mContext);
|
||||||
|
|||||||
@@ -224,21 +224,21 @@ public class ApkUtils {
|
|||||||
// return o1.loadLabel(pm).toString().compareTo(o2.loadLabel(pm).toString());
|
// return o1.loadLabel(pm).toString().compareTo(o2.loadLabel(pm).toString());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
resolveInfos.sort(new Comparator<ResolveInfo>() {
|
// resolveInfos.sort(new Comparator<ResolveInfo>() {
|
||||||
@Override
|
// @Override
|
||||||
public int compare(ResolveInfo o1, ResolveInfo o2) {
|
// public int compare(ResolveInfo o1, ResolveInfo o2) {
|
||||||
try {
|
// try {
|
||||||
if ((pm.getApplicationInfo(o1.activityInfo.packageName, 0).flags & ApplicationInfo.FLAG_SYSTEM) <= (pm.getApplicationInfo(o2.activityInfo.packageName, 0).flags & ApplicationInfo.FLAG_SYSTEM)) {
|
// if ((pm.getApplicationInfo(o1.activityInfo.packageName, 0).flags & ApplicationInfo.FLAG_SYSTEM) <= (pm.getApplicationInfo(o2.activityInfo.packageName, 0).flags & ApplicationInfo.FLAG_SYSTEM)) {
|
||||||
return 1;
|
// return 1;
|
||||||
} else {
|
// } else {
|
||||||
return -1;
|
// return -1;
|
||||||
}
|
// }
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
// } catch (PackageManager.NameNotFoundException e) {
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
}
|
// }
|
||||||
return -1;
|
// return 0;
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
ArrayList<DesktopIcon> desktopIcons = new ArrayList<>();
|
ArrayList<DesktopIcon> desktopIcons = new ArrayList<>();
|
||||||
for (ResolveInfo applicationInfo : resolveInfos) {
|
for (ResolveInfo applicationInfo : resolveInfos) {
|
||||||
if (!excludeClassName.contains(applicationInfo.activityInfo.name)) {
|
if (!excludeClassName.contains(applicationInfo.activityInfo.name)) {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import android.content.Intent;
|
|||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
|
import android.content.res.Configuration;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
@@ -258,4 +259,43 @@ public class Utils {
|
|||||||
// return bgBitmap;
|
// return bgBitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取系统配置信息
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* @param defaultValue
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getProperty(String key, String defaultValue) {
|
||||||
|
String value = defaultValue;
|
||||||
|
try {
|
||||||
|
Class<?> c = Class.forName("android.os.SystemProperties");
|
||||||
|
Method get = c.getMethod("get", String.class, String.class);
|
||||||
|
value = (String) (get.invoke(c, key, "unknown"));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isTablet(Context context) {
|
||||||
|
// return isPad();
|
||||||
|
boolean isTablet = (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
|
||||||
|
Log.e(TAG, "isTablet: " + isTablet);
|
||||||
|
return isTablet;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static boolean isPad() {
|
||||||
|
boolean result = false;
|
||||||
|
String mDeviceType = getProperty("ro.build.characteristics", "default");
|
||||||
|
Log.e(TAG, "isPad: " + mDeviceType);
|
||||||
|
if (mDeviceType != null && mDeviceType.equalsIgnoreCase("tablet")) {
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
Log.d(TAG, "isPad:" + result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,8 @@
|
|||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
tools:context=".activity.ArticleActivity"
|
||||||
android:background="@color/white">
|
android:background="@color/white">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
tools:context=".activity.InfoListActivity"
|
||||||
android:background="@color/gray">
|
android:background="@color/gray">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
|||||||
21
app/src/main/res/layout/activity_splash.xml
Normal file
21
app/src/main/res/layout/activity_splash.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".activity.SplashActivity">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="@dimen/dp_64"
|
||||||
|
android:layout_height="@dimen/dp_64"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@mipmap/ic_launcher"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.382" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
28
app/src/main/res/layout/phone_activity_main.xml
Normal file
28
app/src/main/res/layout/phone_activity_main.xml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@drawable/control_background"
|
||||||
|
tools:context=".activity.main.PhoneMainActivity">
|
||||||
|
|
||||||
|
<androidx.viewpager.widget.ViewPager
|
||||||
|
android:id="@+id/viewPager"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/magicIndicator"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<net.lucode.hackware.magicindicator.MagicIndicator
|
||||||
|
android:id="@+id/magicIndicator"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="16dp"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:visibility="visible"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
401
app/src/main/res/layout/phone_fragment_control.xml
Normal file
401
app/src/main/res/layout/phone_fragment_control.xml
Normal file
@@ -0,0 +1,401 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".fragment.ControlFragment">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_margin="@dimen/dp_12"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="4"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/cl_wifi"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_margin="@dimen/dp_4"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/control_background_item_dis">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_wifi"
|
||||||
|
android:layout_width="@dimen/dp_48"
|
||||||
|
android:layout_height="@dimen/dp_48"
|
||||||
|
android:layout_marginStart="@dimen/dp_16"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/settings_network"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_wifi"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="网络"
|
||||||
|
android:textColor="@color/control_text_color"
|
||||||
|
android:textSize="@dimen/sp_17"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.2"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/iv_wifi"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.5" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/cl_bt"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_margin="@dimen/dp_4"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/control_background_item_dis">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_bt"
|
||||||
|
android:layout_width="@dimen/dp_48"
|
||||||
|
android:layout_height="@dimen/dp_48"
|
||||||
|
android:layout_marginStart="@dimen/dp_16"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/settings_bluetooth"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_bt"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="蓝牙"
|
||||||
|
android:textColor="@color/control_text_color"
|
||||||
|
android:textSize="@dimen/sp_17"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.2"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/iv_bt"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.5" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="4"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/cl_battery"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_margin="@dimen/dp_4"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/control_background_item_dis">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_battery"
|
||||||
|
android:layout_width="@dimen/dp_48"
|
||||||
|
android:layout_height="@dimen/dp_48"
|
||||||
|
android:layout_marginStart="@dimen/dp_16"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/settings_battery"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_battery"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="电量"
|
||||||
|
android:textColor="@color/control_text_color"
|
||||||
|
android:textSize="@dimen/sp_17"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.2"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/iv_battery"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.5" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/cl_flashlight"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_margin="@dimen/dp_4"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:background="@drawable/control_background_item_dis">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_flashlight"
|
||||||
|
android:layout_width="@dimen/dp_48"
|
||||||
|
android:layout_height="@dimen/dp_48"
|
||||||
|
android:layout_marginStart="@dimen/dp_16"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/settings_system"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_flashlight"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="系统"
|
||||||
|
android:textColor="@color/control_text_color"
|
||||||
|
android:textSize="@dimen/sp_17"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.2"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/iv_flashlight"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.5" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_margin="@dimen/dp_4"
|
||||||
|
android:layout_weight="2">
|
||||||
|
|
||||||
|
<SeekBar
|
||||||
|
android:id="@+id/seekbar_sound"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@null"
|
||||||
|
android:paddingStart="0dp"
|
||||||
|
android:paddingEnd="0dp"
|
||||||
|
android:progressDrawable="@drawable/seekbar_progress_default"
|
||||||
|
android:thumb="@null"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_sound"
|
||||||
|
android:layout_width="@dimen/dp_36"
|
||||||
|
android:layout_height="@dimen/dp_36"
|
||||||
|
android:layout_marginStart="@dimen/dp_8"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/sound2"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_sound"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/dp_16"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="100%"
|
||||||
|
android:textColor="@color/control_text_color"
|
||||||
|
android:textSize="@dimen/sp_24"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/iv_sound"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/iv_sound"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/iv_sound" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_margin="@dimen/dp_4"
|
||||||
|
android:layout_weight="2">
|
||||||
|
|
||||||
|
<SeekBar
|
||||||
|
android:id="@+id/seekbar_brightness"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@null"
|
||||||
|
android:paddingStart="0dp"
|
||||||
|
android:paddingEnd="0dp"
|
||||||
|
android:progressDrawable="@drawable/seekbar_progress_default"
|
||||||
|
android:thumb="@null"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_brightness"
|
||||||
|
android:layout_width="@dimen/dp_36"
|
||||||
|
android:layout_height="@dimen/dp_36"
|
||||||
|
android:layout_marginStart="@dimen/dp_8"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/brightness2"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_brightness"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/dp_16"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="亮度"
|
||||||
|
android:textColor="@color/control_text_color"
|
||||||
|
android:textSize="@dimen/sp_20"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@+id/iv_brightness"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/iv_brightness"
|
||||||
|
app:layout_constraintTop_toTopOf="@+id/iv_brightness" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_margin="@dimen/dp_4"
|
||||||
|
android:layout_weight="2"
|
||||||
|
android:background="@drawable/control_background_item_dis">
|
||||||
|
|
||||||
|
<com.uiuios.aios.view.RulerSeekBar
|
||||||
|
android:id="@+id/seekBar"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:max="3"
|
||||||
|
android:maxHeight="@dimen/dp_14"
|
||||||
|
android:minHeight="@dimen/dp_14"
|
||||||
|
android:progress="0"
|
||||||
|
android:progressDrawable="@drawable/shape_progress_drawable"
|
||||||
|
android:thumb="@drawable/shape_thumb_icon"
|
||||||
|
android:thumbOffset="0dp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="@+id/linearLayout4"
|
||||||
|
app:layout_constraintStart_toStartOf="@+id/linearLayout4"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imageView4"
|
||||||
|
android:layout_width="@dimen/dp_36"
|
||||||
|
android:layout_height="@dimen/dp_36"
|
||||||
|
android:layout_marginStart="@dimen/dp_8"
|
||||||
|
android:src="@drawable/font_size"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/linearLayout4"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/imageView4"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/seekBar">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="start"
|
||||||
|
android:paddingStart="@dimen/dp_8"
|
||||||
|
android:text="标准"
|
||||||
|
android:textColor="@color/control_text_color"
|
||||||
|
android:textSize="@dimen/sp_12"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="大"
|
||||||
|
android:textColor="@color/control_text_color"
|
||||||
|
android:textSize="@dimen/sp_12"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="end"
|
||||||
|
android:paddingEnd="@dimen/dp_8"
|
||||||
|
android:text="最大"
|
||||||
|
android:textColor="@color/control_text_color"
|
||||||
|
android:textSize="@dimen/sp_12"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.5"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/cl_location"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_margin="@dimen/dp_4"
|
||||||
|
android:layout_weight="2"
|
||||||
|
android:background="@drawable/control_background_item_dis">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/iv_location"
|
||||||
|
android:layout_width="@dimen/dp_36"
|
||||||
|
android:layout_height="@dimen/dp_36"
|
||||||
|
android:layout_marginStart="@dimen/dp_8"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:scaleType="centerCrop"
|
||||||
|
android:src="@drawable/position"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_location"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/dp_16"
|
||||||
|
android:layout_marginEnd="@dimen/dp_16"
|
||||||
|
android:text="未知"
|
||||||
|
android:textColor="@color/control_text_color"
|
||||||
|
android:textSize="@dimen/sp_12"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@+id/iv_location"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
Reference in New Issue
Block a user