version:1.7

fix:
update:修改布局,爱心守护播放视频,
This commit is contained in:
2022-02-25 17:23:59 +08:00
parent 47b5f12c6c
commit f74e6b106c
64 changed files with 1494 additions and 422 deletions

View File

@@ -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);
}
}

View File

@@ -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() {