|
@@ -1,5 +1,7 @@
|
|
|
package com.usai.commoneditorlib;
|
|
package com.usai.commoneditorlib;
|
|
|
|
|
|
|
|
|
|
+import android.app.AlertDialog;
|
|
|
|
|
+//import android.app.ProgressDialog;/**/
|
|
|
import android.app.ProgressDialog;
|
|
import android.app.ProgressDialog;
|
|
|
import android.content.Context;
|
|
import android.content.Context;
|
|
|
import android.content.Intent;
|
|
import android.content.Intent;
|
|
@@ -104,19 +106,19 @@ public class CommonEditorActivity extends AppCompatActivity implements View.OnLa
|
|
|
public JSONArray missingfields;
|
|
public JSONArray missingfields;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public ProgressDialog showProgressAlert(String title,String msg) {
|
|
|
|
|
- ProgressDialog pd = new ProgressDialog(this);
|
|
|
|
|
- pd.setTitle(title);
|
|
|
|
|
- pd.setMessage(msg);
|
|
|
|
|
- /**
|
|
|
|
|
- * false,表示 ProgressDialog 是不能通过 Back 键取消
|
|
|
|
|
- * 数据加载完成后必须要调用 ProgressDialog 的 dismiss() 方法来关闭对话框
|
|
|
|
|
- * */
|
|
|
|
|
- pd.setCancelable(false);
|
|
|
|
|
- pd.show();
|
|
|
|
|
-
|
|
|
|
|
- return pd;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// public ProgressDialog showProgressAlert(String title,String msg) {
|
|
|
|
|
+// ProgressDialog pd = new ProgressDialog(this);
|
|
|
|
|
+// pd.setTitle(title);
|
|
|
|
|
+// pd.setMessage(msg);
|
|
|
|
|
+// /**
|
|
|
|
|
+// * false,表示 ProgressDialog 是不能通过 Back 键取消
|
|
|
|
|
+// * 数据加载完成后必须要调用 ProgressDialog 的 dismiss() 方法来关闭对话框
|
|
|
|
|
+// * */
|
|
|
|
|
+// pd.setCancelable(false);
|
|
|
|
|
+// pd.show();
|
|
|
|
|
+//
|
|
|
|
|
+// return pd;
|
|
|
|
|
+// }
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public boolean onCreateOptionsMenu(Menu menu) {
|
|
public boolean onCreateOptionsMenu(Menu menu) {
|
|
@@ -262,7 +264,7 @@ public class CommonEditorActivity extends AppCompatActivity implements View.OnLa
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- final ProgressDialog pd = showProgressAlert("Loading","Please wait");
|
|
|
|
|
|
|
+ final ProgressDialog pd = RAUtil.waiting_alert(this,"Loading","Please wait");
|
|
|
new Thread(new Runnable() {
|
|
new Thread(new Runnable() {
|
|
|
@Override
|
|
@Override
|
|
|
public void run() {
|
|
public void run() {
|
|
@@ -291,11 +293,12 @@ public class CommonEditorActivity extends AppCompatActivity implements View.OnLa
|
|
|
adapter.notifyDataSetChanged();
|
|
adapter.notifyDataSetChanged();
|
|
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
- Utils.alertMessage(mCtx,"Warning","Error");
|
|
|
|
|
|
|
+
|
|
|
|
|
+ RAUtil.alertMessage(mCtx,"Warning","Error");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
- Utils.message_alert(mCtx,"Warning","Error");
|
|
|
|
|
|
|
+ RAUtil.alertMessage(mCtx,"Warning","Error");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -398,7 +401,7 @@ public class CommonEditorActivity extends AppCompatActivity implements View.OnLa
|
|
|
String url_down = data.getStringExtra("url_down");
|
|
String url_down = data.getStringExtra("url_down");
|
|
|
String url_up = data.getStringExtra("url_up");
|
|
String url_up = data.getStringExtra("url_up");
|
|
|
String path = data.getStringExtra("path");
|
|
String path = data.getStringExtra("path");
|
|
|
- Utils.cacheLocalImageToURL(path,url_up); // 将图片移动到缓存目录
|
|
|
|
|
|
|
+ RAUtil.cacheLocalImageToURL(this,path,url_up); // 将图片移动到缓存目录
|
|
|
// 对应更新数据,然刷新该行
|
|
// 对应更新数据,然刷新该行
|
|
|
imgIsChanged(url_down,url_up,group,child,btn,url_up);
|
|
imgIsChanged(url_down,url_up,group,child,btn,url_up);
|
|
|
}
|
|
}
|
|
@@ -498,7 +501,7 @@ public class CommonEditorActivity extends AppCompatActivity implements View.OnLa
|
|
|
String url_up = data.getStringExtra("url_up"); // value
|
|
String url_up = data.getStringExtra("url_up"); // value
|
|
|
String path = data.getStringExtra("path");
|
|
String path = data.getStringExtra("path");
|
|
|
|
|
|
|
|
- Utils.cacheLocalImageToURL(path,url_down);
|
|
|
|
|
|
|
+ RAUtil.cacheLocalImageToURL(CommonEditorActivity.this,path,url_down);
|
|
|
|
|
|
|
|
signatureIsChanged(url_down,url_up,group,child);
|
|
signatureIsChanged(url_down,url_up,group,child);
|
|
|
}
|
|
}
|
|
@@ -1117,7 +1120,7 @@ public class CommonEditorActivity extends AppCompatActivity implements View.OnLa
|
|
|
endEditting();
|
|
endEditting();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- final ProgressDialog pd = showProgressAlert("Loading","Please wait");
|
|
|
|
|
|
|
+ final ProgressDialog pd = RAUtil.waiting_alert(CommonEditorActivity.this,"Loading","Please wait");
|
|
|
|
|
|
|
|
if (url_type == URL_REMOTE) {
|
|
if (url_type == URL_REMOTE) {
|
|
|
|
|
|
|
@@ -1150,7 +1153,7 @@ public class CommonEditorActivity extends AppCompatActivity implements View.OnLa
|
|
|
public void run() {
|
|
public void run() {
|
|
|
pd.dismiss();
|
|
pd.dismiss();
|
|
|
if (editor_json == null) {
|
|
if (editor_json == null) {
|
|
|
- Utils.message_alert(mCtx,"Warning","net error");
|
|
|
|
|
|
|
+ RAUtil.alertMessage(mCtx,"Warning","net error");
|
|
|
adapter.notifyDataSetChanged();
|
|
adapter.notifyDataSetChanged();
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -1162,7 +1165,7 @@ public class CommonEditorActivity extends AppCompatActivity implements View.OnLa
|
|
|
adapter.notifyDataSetChanged();
|
|
adapter.notifyDataSetChanged();
|
|
|
|
|
|
|
|
} else {
|
|
} else {
|
|
|
- Utils.message_alert(mCtx,"Warning",editor_json.optString("err_msg"));
|
|
|
|
|
|
|
+ RAUtil.alertMessage(mCtx,"Warning",editor_json.optString("err_msg"));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
@@ -1318,7 +1321,7 @@ public class CommonEditorActivity extends AppCompatActivity implements View.OnLa
|
|
|
JSONObject itemjson_j = sectionjson.optJSONObject("item_" + j);
|
|
JSONObject itemjson_j = sectionjson.optJSONObject("item_" + j);
|
|
|
String key_j = itemjson_j.optString("name");
|
|
String key_j = itemjson_j.optString("name");
|
|
|
|
|
|
|
|
- if (key_j == null || key_j.isEmpty()) {
|
|
|
|
|
|
|
+ if ( key_j.isEmpty()) {
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -2458,7 +2461,7 @@ public class CommonEditorActivity extends AppCompatActivity implements View.OnLa
|
|
|
|
|
|
|
|
Bitmap placeHolder = BitmapFactory.decodeResource(getResources(),R.drawable.not_found);
|
|
Bitmap placeHolder = BitmapFactory.decodeResource(getResources(),R.drawable.not_found);
|
|
|
if (img_url_0 != null && !img_url_0.isEmpty()) {
|
|
if (img_url_0 != null && !img_url_0.isEmpty()) {
|
|
|
- Bitmap bmp0 = Utils.loadCacheImage(img_url_up_0,placeHolder);
|
|
|
|
|
|
|
+ Bitmap bmp0 = RAUtil.loadCacheImage(this,img_url_up_0,placeHolder);
|
|
|
if (bmp0 != null) {
|
|
if (bmp0 != null) {
|
|
|
holder.setImage0(img_url_up_0,bmp0);
|
|
holder.setImage0(img_url_up_0,bmp0);
|
|
|
} else {
|
|
} else {
|
|
@@ -2468,7 +2471,7 @@ public class CommonEditorActivity extends AppCompatActivity implements View.OnLa
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (img_url_1 != null && !img_url_1.isEmpty()) {
|
|
if (img_url_1 != null && !img_url_1.isEmpty()) {
|
|
|
- Bitmap bmp1 = Utils.loadCacheImage(img_url_up_1,placeHolder);
|
|
|
|
|
|
|
+ Bitmap bmp1 = RAUtil.loadCacheImage(this,img_url_up_1,placeHolder);
|
|
|
if (bmp1 != null) {
|
|
if (bmp1 != null) {
|
|
|
holder.setImage1(img_url_up_1,bmp1);
|
|
holder.setImage1(img_url_up_1,bmp1);
|
|
|
} else {
|
|
} else {
|
|
@@ -2478,7 +2481,7 @@ public class CommonEditorActivity extends AppCompatActivity implements View.OnLa
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (img_url_2 != null && !img_url_2.isEmpty()) {
|
|
if (img_url_2 != null && !img_url_2.isEmpty()) {
|
|
|
- Bitmap bmp2 = Utils.loadCacheImage(img_url_up_2,placeHolder);
|
|
|
|
|
|
|
+ Bitmap bmp2 = RAUtil.loadCacheImage(this,img_url_up_2,placeHolder);
|
|
|
if (bmp2 != null) {
|
|
if (bmp2 != null) {
|
|
|
holder.setImage2(img_url_up_2,bmp2);
|
|
holder.setImage2(img_url_up_2,bmp2);
|
|
|
} else {
|
|
} else {
|
|
@@ -2505,7 +2508,7 @@ public class CommonEditorActivity extends AppCompatActivity implements View.OnLa
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
|
|
|
|
|
- bitmap = Utils.loadCacheImage(path,null);
|
|
|
|
|
|
|
+ bitmap = RAUtil.loadCacheImage(CommonEditorActivity.this,path,null);
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bitmap == null) {
|
|
if (bitmap == null) {
|
|
@@ -2535,7 +2538,7 @@ public class CommonEditorActivity extends AppCompatActivity implements View.OnLa
|
|
|
if (bitmap == null) {
|
|
if (bitmap == null) {
|
|
|
bitmap = BitmapFactory.decodeResource(getResources(),R.drawable.not_found);
|
|
bitmap = BitmapFactory.decodeResource(getResources(),R.drawable.not_found);
|
|
|
}
|
|
}
|
|
|
- Utils.cacheImage(path,bitmap);
|
|
|
|
|
|
|
+ RAUtil.cacheImage(CommonEditorActivity.this,path,bitmap);
|
|
|
// 更新数据,刷新行
|
|
// 更新数据,刷新行
|
|
|
runOnUiThread(new Runnable() {
|
|
runOnUiThread(new Runnable() {
|
|
|
@Override
|
|
@Override
|
|
@@ -3066,7 +3069,7 @@ public class CommonEditorActivity extends AppCompatActivity implements View.OnLa
|
|
|
|
|
|
|
|
img_url = "http://img.gank.io/6ade6383-bc8e-40e4-9919-605901ad0ca5?imageView2/0/w/100";
|
|
img_url = "http://img.gank.io/6ade6383-bc8e-40e4-9919-605901ad0ca5?imageView2/0/w/100";
|
|
|
Bitmap placeHolder = BitmapFactory.decodeResource(getResources(),R.drawable.not_found);
|
|
Bitmap placeHolder = BitmapFactory.decodeResource(getResources(),R.drawable.not_found);
|
|
|
- Bitmap bmp = Utils.loadCacheImage(img_url,placeHolder);
|
|
|
|
|
|
|
+ Bitmap bmp = RAUtil.loadCacheImage(CommonEditorActivity.this,img_url,placeHolder);
|
|
|
if (bmp != null) {
|
|
if (bmp != null) {
|
|
|
holder.model_img_btn.setImageBitmap(bmp);
|
|
holder.model_img_btn.setImageBitmap(bmp);
|
|
|
} else {
|
|
} else {
|
|
@@ -3194,7 +3197,7 @@ public class CommonEditorActivity extends AppCompatActivity implements View.OnLa
|
|
|
}
|
|
}
|
|
|
Bitmap placeHolder = BitmapFactory.decodeResource(getResources(),R.drawable.not_found);
|
|
Bitmap placeHolder = BitmapFactory.decodeResource(getResources(),R.drawable.not_found);
|
|
|
if (img_url != null && !img_url.isEmpty()) {
|
|
if (img_url != null && !img_url.isEmpty()) {
|
|
|
- Bitmap bmp = Utils.loadCacheImage(img_url,placeHolder);
|
|
|
|
|
|
|
+ Bitmap bmp = RAUtil.loadCacheImage(CommonEditorActivity.this,img_url,placeHolder);
|
|
|
if (bmp != null) {
|
|
if (bmp != null) {
|
|
|
holder.signature_iv.setImageBitmap(bmp);
|
|
holder.signature_iv.setImageBitmap(bmp);
|
|
|
} else {
|
|
} else {
|
|
@@ -4034,7 +4037,7 @@ public class CommonEditorActivity extends AppCompatActivity implements View.OnLa
|
|
|
JSONObject params = new JSONObject();
|
|
JSONObject params = new JSONObject();
|
|
|
params.put(name,val);
|
|
params.put(name,val);
|
|
|
|
|
|
|
|
- final ProgressDialog pd = Utils.waiting_alert(mCtx,"loading","please wait");
|
|
|
|
|
|
|
+ final ProgressDialog pd = RAUtil.waiting_alert(mCtx,"loading","please wait");
|
|
|
final JSONObject final_params = params;
|
|
final JSONObject final_params = params;
|
|
|
new Thread(new Runnable() {
|
|
new Thread(new Runnable() {
|
|
|
@Override
|
|
@Override
|
|
@@ -4056,7 +4059,7 @@ public class CommonEditorActivity extends AppCompatActivity implements View.OnLa
|
|
|
setValue(name,value);
|
|
setValue(name,value);
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- Utils.alertMessage(mCtx,"",editor_json.optString("err_msg"));
|
|
|
|
|
|
|
+ RAUtil.alertMessage(mCtx,"",editor_json.optString("err_msg"));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -4130,7 +4133,7 @@ public class CommonEditorActivity extends AppCompatActivity implements View.OnLa
|
|
|
|
|
|
|
|
JSONObject params = new JSONObject();
|
|
JSONObject params = new JSONObject();
|
|
|
params.put(name,val);
|
|
params.put(name,val);
|
|
|
- final ProgressDialog pd = Utils.waiting_alert(mCtx,"loading","please wait");
|
|
|
|
|
|
|
+ final ProgressDialog pd = RAUtil.waiting_alert(mCtx,"loading","please wait");
|
|
|
final JSONObject final_params = params;
|
|
final JSONObject final_params = params;
|
|
|
new Thread(new Runnable() {
|
|
new Thread(new Runnable() {
|
|
|
@Override
|
|
@Override
|
|
@@ -4153,7 +4156,7 @@ public class CommonEditorActivity extends AppCompatActivity implements View.OnLa
|
|
|
setValue(name,value);
|
|
setValue(name,value);
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- Utils.message_alert(mCtx,"",editor_json.optString("err_msg"));
|
|
|
|
|
|
|
+ RAUtil.alertMessage(mCtx,"",editor_json.optString("err_msg"));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|