|
|
@@ -110,8 +110,11 @@ public class CommonUtil {
|
|
|
* @author:Administrator on 2016/2/18 15:12
|
|
|
*/
|
|
|
public static String getAppBaseUrl(Context ct) {
|
|
|
- if (ct==null)return "";
|
|
|
- String baseUrl =getSharedPreferences(ct, "erp_baseurl");
|
|
|
+ if (ct == null) return "";
|
|
|
+ String baseUrl = getSharedPreferences(ct, "erp_baseurl");
|
|
|
+// if (BaseConfig.isDebug()) {
|
|
|
+//// baseUrl = "http://192.168.253.243:8080/ERP/";
|
|
|
+//// }
|
|
|
return baseUrl;
|
|
|
}
|
|
|
|
|
|
@@ -646,7 +649,7 @@ public class CommonUtil {
|
|
|
return dateString;
|
|
|
}
|
|
|
|
|
|
- public static String getStringDate(Long date,String dateFormat) {
|
|
|
+ public static String getStringDate(Long date, String dateFormat) {
|
|
|
SimpleDateFormat formatter = new SimpleDateFormat(dateFormat);
|
|
|
String dateString = formatter.format(date);
|
|
|
return dateString;
|
|
|
@@ -1065,10 +1068,10 @@ public class CommonUtil {
|
|
|
public static String getMIMEType(File f) {
|
|
|
String type = "";
|
|
|
String fName = f.getName();
|
|
|
- /* 取得扩展名 */
|
|
|
+ /* 取得扩展名 */
|
|
|
String end = fName.substring(fName.lastIndexOf(".") + 1, fName.length()).toLowerCase();
|
|
|
|
|
|
- /* 依扩展名的类型决定MimeType */
|
|
|
+ /* 依扩展名的类型决定MimeType */
|
|
|
if (end.equals("pdf")) {
|
|
|
type = "application/pdf";//
|
|
|
} else if (end.equals("m4a") || end.equals("mp3") || end.equals("mid") ||
|
|
|
@@ -1250,7 +1253,7 @@ public class CommonUtil {
|
|
|
|
|
|
datePickDialog.setOnDateTimeSetListener(new DateTimePickerDialog.OnDateTimeSetListener() {
|
|
|
public void OnDateTimeSet(AlertDialog dia, long date) {
|
|
|
- textView.setText(CommonUtil.getStringDate(date,dateFormat));
|
|
|
+ textView.setText(CommonUtil.getStringDate(date, dateFormat));
|
|
|
/** @注释:保证 初始化当前时间 */
|
|
|
datePickDialog = null;
|
|
|
}
|
|
|
@@ -1284,8 +1287,8 @@ public class CommonUtil {
|
|
|
* @desc:打电话确认框
|
|
|
* @author:Arison on 2016/11/3
|
|
|
*/
|
|
|
- public static void phoneAction( Context mContext, String phone) {
|
|
|
- SystemUtil.phoneAction(mContext,phone);
|
|
|
+ public static void phoneAction(Context mContext, String phone) {
|
|
|
+ SystemUtil.phoneAction(mContext, phone);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1418,16 +1421,18 @@ public class CommonUtil {
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
|
- public static String getTwoPointStr(double m){
|
|
|
- String strValue = "";
|
|
|
+
|
|
|
+ public static String getTwoPointStr(double m) {
|
|
|
+ String strValue = "";
|
|
|
try {
|
|
|
DecimalFormat df = new DecimalFormat("#,###.##");
|
|
|
- strValue = df.format(m);
|
|
|
+ strValue = df.format(m);
|
|
|
return strValue;
|
|
|
} catch (Exception e) {
|
|
|
return strValue;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
/*获取账套,erp的账套 b2b的公司uu号*/
|
|
|
public static String getMaster() {
|
|
|
boolean isB2b = ApiUtils.getApiModel() instanceof ApiPlatform;
|
|
|
@@ -1440,7 +1445,7 @@ public class CommonUtil {
|
|
|
public static String getEmcode() {
|
|
|
boolean isB2b = ApiUtils.getApiModel() instanceof ApiPlatform;
|
|
|
String emcode = isB2b ? CommonUtil.getSharedPreferences(MyApplication.getInstance().getApplicationContext(), "b2b_uu") : CommonUtil.getSharedPreferences(MyApplication.getInstance(), "erp_username");
|
|
|
- if (emcode==null)emcode="";
|
|
|
+ if (emcode == null) emcode = "";
|
|
|
return emcode;
|
|
|
}
|
|
|
|
|
|
@@ -1507,8 +1512,9 @@ public class CommonUtil {
|
|
|
|
|
|
/**
|
|
|
* 将double格式化为指定小数位的String,不足小数位用0补全
|
|
|
- * @param v 需要格式化的数字
|
|
|
- * @param scale 小数点后保留几位
|
|
|
+ *
|
|
|
+ * @param v 需要格式化的数字
|
|
|
+ * @param scale 小数点后保留几位
|
|
|
* @return
|
|
|
*/
|
|
|
public static String roundByScale(double v, int scale) {
|
|
|
@@ -1516,11 +1522,11 @@ public class CommonUtil {
|
|
|
throw new IllegalArgumentException(
|
|
|
"The scale must be a positive integer or zero");
|
|
|
}
|
|
|
- if(scale == 0){
|
|
|
+ if (scale == 0) {
|
|
|
return new DecimalFormat("0").format(v);
|
|
|
}
|
|
|
String formatStr = "0.";
|
|
|
- for(int i=0;i<scale;i++){
|
|
|
+ for (int i = 0; i < scale; i++) {
|
|
|
formatStr = formatStr + "0";
|
|
|
}
|
|
|
return new DecimalFormat(formatStr).format(v);
|