Commit 977a57c2 by tangguangrui

修改闪退bug

parent c8d4fa58
......@@ -115,4 +115,36 @@ public class FileUtils {
return size;
}
/**
* 获取目录长度
*
* @param dir 目录
* @return 目录长度
*/
public static long getDirLength(final File dir) {
if (!isDir(dir)) return -1;
long len = 0;
File[] files = dir.listFiles();
if (files != null && files.length != 0) {
for (File file : files) {
if (file.isDirectory()) {
len += getDirLength(file);
} else {
len += file.length();
}
}
}
return len;
}
/**
* 判断是否是目录
*
* @param file 文件
* @return {@code true}: 是<br>{@code false}: 否
*/
public static boolean isDir(final File file) {
return file != null && file.exists() && file.isDirectory();
}
}
......@@ -14,8 +14,8 @@ public class Constant {
public static String BaseImagesDir = Utils.getRootFilePath() + "/image/";
public static String Host = "https://api-mircrosoft-building.dankal.cn/v1/"; //测试
// public static String Host = "https://api.mctower.dankal.cn/v1/"; //正式
// public static String Host = "https://api-mircrosoft-building.dankal.cn/v1/"; //测试
public static String Host = "https://api.mctower.dankal.cn/v1/"; //正式
public static final String API_VISIT_RECORD_LIST = Host + "mini/visit/users";
public static final String API_VISIT_DETAIL = Host + "mini/visit/user/detail/";
public static final String API_GET_QINIU_TOKEN = Host + "cms/property/common/ignore/qiniu";
......
......@@ -18,7 +18,9 @@ import cn.dankal.base.http.HttpPostHelper;
import cn.dankal.base.http.NOToastHttpCallBack;
import cn.dankal.base.utils.LogUtils;
import cn.dankal.base.utils.NetPicUtil;
import cn.dankal.base.utils.ScreenUtil;
import cn.dankal.base.utils.ToastUtils;
import cn.dankal.base.utils.UIUtil;
import cn.mctower.visitor.model.MonthCardDetailBean;
import cn.mctower.visitor.model.MonthCardRqCodeBean;
import cn.mctower.visitor.model.QiNiuTokenBean;
......@@ -164,13 +166,31 @@ public class MonthCardDetailActivity extends NetBaseAppCompatActivity {
for(String url : bean.vehicleImgArray){
if(i == 0) {
pic1.setVisibility(View.VISIBLE);
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) pic1.getLayoutParams();
lp.width = ScreenUtil.getScreenWidth(MonthCardDetailActivity.this) - UIUtil.Dp2Px(MonthCardDetailActivity.this,84);
pic1.setLayoutParams(lp);
netPicUtil.display(pic1,qiNiuTokenBean.url + url);
}
else if(i == 1) {
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) pic1.getLayoutParams();
lp.width = (ScreenUtil.getScreenWidth(MonthCardDetailActivity.this) - UIUtil.Dp2Px(MonthCardDetailActivity.this,84)) / 2;
pic1.setLayoutParams(lp);
pic2.setVisibility(View.VISIBLE);
LinearLayout.LayoutParams lp2 = (LinearLayout.LayoutParams) pic2.getLayoutParams();
lp2.width = (ScreenUtil.getScreenWidth(MonthCardDetailActivity.this) - UIUtil.Dp2Px(MonthCardDetailActivity.this,84)) / 2;
pic2.setLayoutParams(lp2);
netPicUtil.display(pic2,qiNiuTokenBean.url + url);
}
else if(i == 2) {
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) pic1.getLayoutParams();
lp.width = (ScreenUtil.getScreenWidth(MonthCardDetailActivity.this) - UIUtil.Dp2Px(MonthCardDetailActivity.this,84)) / 3;
pic1.setLayoutParams(lp);
LinearLayout.LayoutParams lp2 = (LinearLayout.LayoutParams) pic2.getLayoutParams();
lp2.width = (ScreenUtil.getScreenWidth(MonthCardDetailActivity.this) - UIUtil.Dp2Px(MonthCardDetailActivity.this,84)) / 3;
pic2.setLayoutParams(lp2);
LinearLayout.LayoutParams lp3 = (LinearLayout.LayoutParams) pic3.getLayoutParams();
lp3.width = (ScreenUtil.getScreenWidth(MonthCardDetailActivity.this) - UIUtil.Dp2Px(MonthCardDetailActivity.this,84)) / 3;
pic2.setLayoutParams(lp3);
pic3.setVisibility(View.VISIBLE);
netPicUtil.display(pic3,qiNiuTokenBean.url + url);
}
......
......@@ -210,62 +210,59 @@
android:id="@+id/picsFrame"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:layout_below="@id/frame2"
android:translationZ="10dp"
android:layout_marginTop="12dp"
android:layout_marginLeft="22dp"
android:layout_marginRight="22dp">
<TextView
android:id="@+id/picTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:textSize="14sp"
android:textColor="#2D506B"
android:layout_marginTop="19dp"
android:layout_marginBottom="9dp"
android:background="@color/white"
android:text="相关证件"/>
android:layout_marginRight="22dp"
android:layout_marginTop="12dp"
android:background="@android:color/white"
android:translationZ="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_below="@id/picTitle"
android:layout_marginBottom="22dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="22dp"
android:orientation="horizontal"
android:weightSum="3">
<ImageView
android:id="@+id/pic1"
android:layout_width="wrap_content"
android:layout_width="100dp"
android:layout_height="90dp"
android:layout_weight="1"
android:background="#eeeeee"/>
android:background="#eeeeee" />
<ImageView
android:id="@+id/pic2"
android:layout_width="wrap_content"
android:layout_width="100dp"
android:layout_height="90dp"
android:layout_weight="1"
android:background="#eeeeee"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:visibility="gone"/>
android:background="#eeeeee"
android:visibility="gone" />
<ImageView
android:id="@+id/pic3"
android:layout_width="wrap_content"
android:layout_width="100dp"
android:layout_height="90dp"
android:layout_weight="1"
android:background="#eeeeee"
android:visibility="gone"/>
android:visibility="gone" />
</LinearLayout>
<TextView
android:id="@+id/picTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginBottom="9dp"
android:layout_marginTop="19dp"
android:background="@color/white"
android:text="相关证件"
android:textColor="#2D506B"
android:textSize="14sp" />
</cn.mctower.visitor.RoundLayout>
<TextView
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment