光环助手V2.4优化汇总(20170302)
This commit is contained in:
@ -7,6 +7,7 @@ import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.provider.MediaStore;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
@ -19,8 +20,11 @@ import com.gh.common.util.Utils;
|
||||
import com.gh.gamecenter.retrofit.JSONObjectResponse;
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ -118,6 +122,25 @@ public class SelectUserIconActivity extends BaseActivity {
|
||||
postUserIocn(8);
|
||||
break;
|
||||
case R.id.skip_media_store:
|
||||
|
||||
String iconCount = sp.getString("updateIconCount", null);
|
||||
if (!TextUtils.isEmpty(iconCount)) {
|
||||
long l = System.currentTimeMillis();
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
|
||||
String time = format.format(new Date(l));
|
||||
|
||||
JSONObject json = null;
|
||||
try {
|
||||
json = new JSONObject(iconCount);
|
||||
String lastTime = json.getString("time");
|
||||
if (lastTime.equals(time) && json.getInt("count") == 2) {
|
||||
Utils.toast(SelectUserIconActivity.this, "每天最多只能上传2次头像");
|
||||
return;
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
||||
startActivityForResult(intent, 0x123);
|
||||
break;
|
||||
@ -191,6 +214,8 @@ public class SelectUserIconActivity extends BaseActivity {
|
||||
ex.printStackTrace();
|
||||
Toast.makeText(SelectUserIconActivity.this, "修改失败", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(SelectUserIconActivity.this, "网络异常,修改头像失败", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user