version:2.3
fix: add:本地应用显示优化
This commit is contained in:
@@ -39,8 +39,8 @@ android {
|
||||
productFlavors {
|
||||
beta {
|
||||
flavorDimensions "default"
|
||||
versionCode 13
|
||||
versionName "2.2"
|
||||
versionCode 14
|
||||
versionName "2.3"
|
||||
manifestPlaceholders = [
|
||||
JPUSH_PKGNAME: "com.uiui.appstore",
|
||||
JPUSH_APPKEY : "c93d01f43046fa500d162817", //JPush 上注册的包名对应的 Appkey.
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":24,"versionName":"1.2.4","enabled":true,"outputFile":"\\UIUIAPPStore-24-V1.2.4-20201021185409.apk","fullName":"release","baseName":"release"},"path":"UIUIAPPStore-24-V1.2.4-20201021185409.apk","properties":{}}]
|
||||
@@ -17,6 +17,7 @@ import com.uiui.appstore.R;
|
||||
import com.uiui.appstore.bean.GlideCircleWithBorder;
|
||||
import com.uiui.appstore.bean.LocalApp;
|
||||
import com.uiui.appstore.utils.ApkUtils;
|
||||
import com.uiui.appstore.utils.TimeUtils;
|
||||
import com.uiui.appstore.utils.Utils;
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
@@ -54,9 +55,9 @@ public class LocalAppAdapter extends RecyclerView.Adapter<LocalAppAdapter.LocalA
|
||||
.transform(new GlideCircleWithBorder(context))
|
||||
.into(holder.ivIcon);
|
||||
holder.ivIcon.setImageDrawable(new BitmapDrawable(context.getResources(), bitmap));
|
||||
holder.tvCompany.setText(localApp.getCompany());
|
||||
holder.tvName.setText(localApp.getAppName());
|
||||
holder.tvVersion.setText(localApp.getVersion());
|
||||
holder.tvVersion.setText("版本:"+localApp.getVersion());
|
||||
holder.tvInstallTime.setText("安装时间:"+TimeUtils.transferLongToDate(localApp.getFirstInstallTime()));
|
||||
if (localApp.isCanUnintall()) {
|
||||
holder.btnDownLoad.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
@@ -75,7 +76,7 @@ public class LocalAppAdapter extends RecyclerView.Adapter<LocalAppAdapter.LocalA
|
||||
}
|
||||
});
|
||||
String totalLength = Formatter.formatFileSize(context, localApp.getSize());
|
||||
holder.tvCompany.setText(totalLength);
|
||||
holder.tvCompany.setText("大小:"+totalLength);
|
||||
|
||||
}
|
||||
|
||||
@@ -91,7 +92,7 @@ public class LocalAppAdapter extends RecyclerView.Adapter<LocalAppAdapter.LocalA
|
||||
|
||||
public static class LocalAppViewHolder extends RecyclerView.ViewHolder {
|
||||
ImageView ivIcon;
|
||||
TextView tvCompany, tvName, tvVersion;
|
||||
TextView tvCompany, tvName, tvVersion, tvInstallTime;
|
||||
TextView tvUpdate;
|
||||
Button btnDownLoad, btnOpen;
|
||||
|
||||
@@ -101,6 +102,7 @@ public class LocalAppAdapter extends RecyclerView.Adapter<LocalAppAdapter.LocalA
|
||||
tvCompany = itemView.findViewById(R.id.local_app_tv_company);
|
||||
tvName = itemView.findViewById(R.id.local_app_tv_name);
|
||||
tvVersion = itemView.findViewById(R.id.local_app_version);
|
||||
tvInstallTime = itemView.findViewById(R.id.local_app_install_time);
|
||||
tvUpdate = itemView.findViewById(R.id.local_app_update);
|
||||
btnDownLoad = itemView.findViewById(R.id.local_app_btn_delete);
|
||||
btnOpen = itemView.findViewById(R.id.local_app_btn_open);
|
||||
|
||||
@@ -20,6 +20,7 @@ public class LocalApp implements Serializable {
|
||||
private int versionCode;
|
||||
private boolean isNeedUpdate = false;
|
||||
private boolean canUnintall = true;
|
||||
private long firstInstallTime;
|
||||
|
||||
public LocalApp() {
|
||||
}
|
||||
@@ -96,4 +97,12 @@ public class LocalApp implements Serializable {
|
||||
public void setCanUnintall(boolean canUnintall) {
|
||||
this.canUnintall = canUnintall;
|
||||
}
|
||||
|
||||
public long getFirstInstallTime() {
|
||||
return firstInstallTime;
|
||||
}
|
||||
|
||||
public void setFirstInstallTime(long firstInstallTime) {
|
||||
this.firstInstallTime = firstInstallTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -678,7 +678,7 @@ public class ApkUtils {
|
||||
} else {
|
||||
//系统应用
|
||||
}
|
||||
|
||||
bean.setFirstInstallTime(packageInfo.firstInstallTime);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
12
app/src/main/java/com/uiui/appstore/utils/TimeUtils.java
Normal file
12
app/src/main/java/com/uiui/appstore/utils/TimeUtils.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.uiui.appstore.utils;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class TimeUtils {
|
||||
public static String transferLongToDate(Long millSec) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Date date = new Date(millSec);
|
||||
return sdf.format(date);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="70dp"
|
||||
android:layout_height="90dp"
|
||||
android:background="@drawable/ll_selector"
|
||||
android:orientation="vertical">
|
||||
|
||||
@@ -14,27 +14,25 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/local_app_iv_icon"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/local_app_tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/black"
|
||||
@@ -45,7 +43,6 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text=""
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
@@ -53,22 +50,28 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="1.0"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/local_app_install_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textSize="12sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="@dimen/dp_64"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/local_app_btn_open"
|
||||
android:layout_width="@dimen/dp_64"
|
||||
android:layout_height="@dimen/dp_32"
|
||||
android:layout_width="@dimen/dp_90"
|
||||
android:layout_height="@dimen/dp_40"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="@drawable/btn_shap_open"
|
||||
@@ -79,9 +82,8 @@
|
||||
|
||||
<Button
|
||||
android:id="@+id/local_app_btn_delete"
|
||||
android:layout_width="@dimen/dp_64"
|
||||
android:layout_height="@dimen/dp_32"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_width="@dimen/dp_90"
|
||||
android:layout_height="@dimen/dp_40"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="8dp"
|
||||
android:background="@drawable/btn_shap_delete"
|
||||
|
||||
@@ -31,9 +31,8 @@
|
||||
<TextView
|
||||
android:id="@+id/local_app_tv_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/black"
|
||||
@@ -52,17 +51,22 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:text="1.0"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/local_app_install_time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="@dimen/dp_64"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/local_app_btn_open"
|
||||
@@ -80,7 +84,6 @@
|
||||
android:id="@+id/local_app_btn_delete"
|
||||
android:layout_width="@dimen/dp_64"
|
||||
android:layout_height="@dimen/dp_32"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="8dp"
|
||||
android:background="@drawable/btn_shap_delete"
|
||||
|
||||
Reference in New Issue
Block a user