version:2.2
fix:修复应用从第一屏开始排列 add:
This commit is contained in:
@@ -47,20 +47,20 @@ import com.aoleyun.os.ItemInfo;
|
||||
import com.aoleyun.os.Launcher;
|
||||
import com.aoleyun.os.LauncherAppWidgetInfo;
|
||||
import com.aoleyun.os.LauncherAppWidgetProviderInfo;
|
||||
import com.aoleyun.os.TTUtils.CustomDialog;
|
||||
import com.aoleyun.os.TTUtils.ToastUtil;
|
||||
import com.aoleyun.os.base.MyApplication;
|
||||
import com.aoleyun.os.uiuiutils.CustomDialog;
|
||||
import com.aoleyun.os.uiuiutils.ToastUtil;
|
||||
import com.aoleyun.os.base.BaseApplication;
|
||||
import com.aoleyun.os.PromiseAppInfo;
|
||||
import com.aoleyun.os.R;
|
||||
import com.aoleyun.os.Statistics.AppInformation;
|
||||
import com.aoleyun.os.Statistics.StatisticsInfo;
|
||||
import com.aoleyun.os.TTUtils.Utils;
|
||||
import com.aoleyun.os.statistics.AppInformation;
|
||||
import com.aoleyun.os.statistics.StatisticsInfo;
|
||||
import com.aoleyun.os.uiuiutils.Utils;
|
||||
import com.aoleyun.os.WorkspaceItemInfo;
|
||||
import com.aoleyun.os.compat.AppWidgetManagerCompat;
|
||||
import com.aoleyun.os.folder.Folder;
|
||||
import com.aoleyun.os.folder.FolderIcon;
|
||||
import com.aoleyun.os.network.AppPasswdBean;
|
||||
import com.aoleyun.os.network.BaseResponse;
|
||||
import com.aoleyun.os.network.bean.AppPasswdBean;
|
||||
import com.aoleyun.os.network.bean.BaseResponse;
|
||||
import com.aoleyun.os.network.HTTPInterface;
|
||||
import com.aoleyun.os.network.NetworkManager;
|
||||
import com.aoleyun.os.network.api.AddAppLog;
|
||||
@@ -128,8 +128,7 @@ public class ItemClickHandler {
|
||||
Log.e("onClick", "onClick: " + ApplicationLock);
|
||||
Type type = new TypeToken<List<AppPasswdBean>>() {
|
||||
}.getType();
|
||||
Gson gson = new Gson();
|
||||
List<AppPasswdBean> appPasswdBeans = gson.fromJson(ApplicationLock, type);
|
||||
List<AppPasswdBean> appPasswdBeans = new Gson().fromJson(ApplicationLock, type);
|
||||
String packageName = ((WorkspaceItemInfo) tag).getTargetComponent().getPackageName();
|
||||
Log.e("ItemClickHandler", "onClick: " + packageName);
|
||||
if (appPasswdBeans == null) {
|
||||
@@ -139,7 +138,6 @@ public class ItemClickHandler {
|
||||
for (AppPasswdBean bean : appPasswdBeans) {
|
||||
hashMap.put(bean.getApp_package(), bean.getPassword());
|
||||
}
|
||||
|
||||
if (hashMap.get(packageName) != null) {
|
||||
CustomDialog dialog = new CustomDialog(v.getContext());
|
||||
dialog.setTitle("请输入密码");
|
||||
@@ -168,35 +166,12 @@ public class ItemClickHandler {
|
||||
onClickAppShortcut(v, (WorkspaceItemInfo) tag, launcher, sourceContainer);
|
||||
}
|
||||
}
|
||||
|
||||
// Log.e("ItemClickHandler", "onClick: " + packageName);
|
||||
// if (cameraClosed(v.getContext(), packageName)) {
|
||||
// return;
|
||||
// }
|
||||
// onClickAppShortcut(v, (WorkspaceItemInfo) tag, launcher, sourceContainer);
|
||||
AppInformation app = null;
|
||||
try {
|
||||
app = getInfoFromPackageName(packageName);
|
||||
} catch (Exception e) {
|
||||
Log.e("onClick", e.getMessage());
|
||||
}
|
||||
// if (app != null) {
|
||||
// Log.e("fht", "运行时间: " + DateUtils.formatElapsedTime(app.getUsedTimebyDay() / 1000));
|
||||
// Log.e("fht", "运行时间: " + app.getUsedTimebyDay() / 1000);
|
||||
// TimeUtils.getInstance().setTime(app.getUsedTimebyDay() / 1000);
|
||||
//
|
||||
// } else {
|
||||
// Log.e("fht", "首次运行:" + "包名:" + packageName);
|
||||
// TimeUtils.getInstance().setTime(0);
|
||||
// }
|
||||
// if (!APKUtils.isSystemApp(v.getContext(), packageName) && !Arrays.asList(packages).contains(packageName)) {
|
||||
// HTTPInterface.sendTimeLog(handler, userInfo, ((ShortcutInfo) tag).title.toString(), 1, 0);
|
||||
// SendOpenApp(packageName);
|
||||
// }
|
||||
|
||||
//写入正在运行的app的包名和时间
|
||||
TimeUtils.getInstance().setAppPackageName(packageName);
|
||||
TimeUtils.getInstance().setStartTime(System.currentTimeMillis());
|
||||
HTTPInterface.SendRunningApp(MyApplication.getInstance().getApplicationContext());
|
||||
HTTPInterface.sendRunningApp(BaseApplication.getContext());
|
||||
} else if (tag instanceof FolderInfo) {
|
||||
if (v instanceof FolderIcon) {
|
||||
onClickFolderIcon(v);
|
||||
@@ -235,13 +210,12 @@ public class ItemClickHandler {
|
||||
"com.android.uiuios",
|
||||
"com.easyold.uiuios",
|
||||
"com.jiaoguanyi.store"
|
||||
|
||||
};
|
||||
|
||||
public static AppInformation getInfoFromPackageName(String packageName) {
|
||||
List<AppInformation> list;
|
||||
AppInformation app = null;
|
||||
StatisticsInfo statisticsInfo = new StatisticsInfo(MyApplication.getInstance().getApplicationContext());
|
||||
StatisticsInfo statisticsInfo = new StatisticsInfo(BaseApplication.getInstance().getApplicationContext());
|
||||
list = statisticsInfo.getShowList();
|
||||
for (AppInformation appInformation : list) {
|
||||
String name = appInformation.getPackageName();
|
||||
@@ -252,57 +226,6 @@ public class ItemClickHandler {
|
||||
return app;
|
||||
}
|
||||
|
||||
private static void SendOpenApp(String packageName) {
|
||||
PackageManager pm = MyApplication.getInstance().getPackageManager();
|
||||
PackageInfo appInfo = null;
|
||||
try {
|
||||
appInfo = pm.getPackageInfo(packageName, 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (null != appInfo) {
|
||||
long appVersionCode;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
appVersionCode = appInfo.getLongVersionCode();
|
||||
} else {
|
||||
appVersionCode = appInfo.versionCode;
|
||||
}
|
||||
AddAppLog appLog = NetworkManager.getInstance().getapplogControl();
|
||||
String sn = Utils.getSerial();
|
||||
appLog.addLog(sn, packageName, appVersionCode, System.currentTimeMillis() / 1000, 1)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<BaseResponse>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
Log.e("SendOpenApp", "onSubscribe: ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(BaseResponse baseResponse) {
|
||||
int code = baseResponse.code;
|
||||
if (code == 200) {
|
||||
Log.e("SendOpenApp", "onNext: " + code + baseResponse.data);
|
||||
} else {
|
||||
Log.e("SendOpenApp", "onNext: " + code + baseResponse.msg);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
Log.e("SendOpenApp", "onError: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
Log.e("SendOpenApp", "onComplete: ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Event handler for a folder icon click.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user