Commit d40389f8d60faa6ee69f88487bd77b85ddbc5a06
1 parent
5750ce3862
Exists in
master
优化和注册信息检查接口调试
Showing
30 changed files
with
688 additions
and
685 deletions
 
Show diff stats
PersonalCenter/app/build.gradle
| ... | ... | @@ -46,5 +46,5 @@ dependencies { | 
| 46 | 46 | releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3' | 
| 47 | 47 | compile 'com.google.zxing:core:3.3.0' | 
| 48 | 48 | compile 'com.google.zxing:android-core:3.3.0' | 
| 49 | - compile project(':mypresonallibrary') | |
| 49 | + compile project(path: ':mypresonallibrary') | |
| 50 | 50 | } | ... | ... | 
PersonalCenter/app/src/main/java/com/hjx/personalcenter/activity/LoginAndRegisterActivity.java
| ... | ... | @@ -2,17 +2,24 @@ package com.hjx.personalcenter.activity; | 
| 2 | 2 | |
| 3 | 3 | import android.content.Intent; | 
| 4 | 4 | import android.os.Bundle; | 
| 5 | +import android.provider.Settings; | |
| 5 | 6 | import android.support.annotation.Nullable; | 
| 6 | 7 | import android.support.v4.app.Fragment; | 
| 7 | 8 | import android.support.v4.view.ViewPager; | 
| 8 | 9 | import android.support.v7.app.AppCompatActivity; | 
| 10 | +import android.view.Gravity; | |
| 11 | +import android.view.View; | |
| 9 | 12 | |
| 10 | 13 | import com.hjx.personalcenter.R; | 
| 11 | 14 | import com.hjx.personalcenter.adapter.LoginAndRegisterAdapter; | 
| 12 | 15 | import com.hjx.personalcenter.db.SaveParam; | 
| 13 | -import com.hjx.personalcenter.fragment.RegisterFragment; | |
| 14 | 16 | import com.hjx.personalcenter.fragment.LoginFragment; | 
| 17 | +import com.hjx.personalcenter.fragment.RegisterFragment; | |
| 15 | 18 | import com.hjx.personalcenter.thirdparty.SlidingTabLayout; | 
| 19 | +import com.hjx.personalcenter.util.NetUtils; | |
| 20 | +import com.mylhyl.circledialog.CircleDialog; | |
| 21 | +import com.mylhyl.circledialog.callback.ConfigText; | |
| 22 | +import com.mylhyl.circledialog.params.TextParams; | |
| 16 | 23 | |
| 17 | 24 | import java.util.ArrayList; | 
| 18 | 25 | import java.util.Arrays; | 
| ... | ... | @@ -33,6 +40,31 @@ public class LoginAndRegisterActivity extends AppCompatActivity { | 
| 33 | 40 | @Override | 
| 34 | 41 | protected void onCreate(@Nullable Bundle savedInstanceState) { | 
| 35 | 42 | super.onCreate(savedInstanceState); | 
| 43 | + //检查网络 | |
| 44 | + boolean isconnect = NetUtils.isNetworkConnected(this); | |
| 45 | + if (!isconnect){ | |
| 46 | + new CircleDialog.Builder(this) | |
| 47 | + .setCanceledOnTouchOutside(false) | |
| 48 | + .setCancelable(false) | |
| 49 | + .setWidth(0.5f) | |
| 50 | + .configText(new ConfigText() { | |
| 51 | + @Override | |
| 52 | + public void onConfig(TextParams params) { | |
| 53 | + params.gravity = Gravity.CENTER; | |
| 54 | + params.padding = new int[]{50, 50, 50, 50}; | |
| 55 | + } | |
| 56 | + }) | |
| 57 | + .setText("当前无网络,请检查网络设置") | |
| 58 | + .setNegative("继续使用", null) | |
| 59 | + .setPositive("设置网络", new View.OnClickListener() { | |
| 60 | + @Override | |
| 61 | + public void onClick(View v) { | |
| 62 | + Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 63 | + startActivity(intent); | |
| 64 | + } | |
| 65 | + }) | |
| 66 | + .show(); | |
| 67 | + } | |
| 36 | 68 | String islogin =SaveParam.getInstance().getLoginParam(this,"login"); | 
| 37 | 69 | String type =SaveParam.getInstance().getCustomizeParam(LoginAndRegisterActivity.this,SaveParam.ACCOUNT); | 
| 38 | 70 | if (type==null){ | ... | ... | 
PersonalCenter/app/src/main/java/com/hjx/personalcenter/adapter/GridAdapter.java
| ... | ... | @@ -0,0 +1,66 @@ | 
| 1 | +package com.hjx.personalcenter.adapter; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | +import android.view.View; | |
| 5 | +import android.view.ViewGroup; | |
| 6 | +import android.widget.BaseAdapter; | |
| 7 | +import android.widget.TextView; | |
| 8 | + | |
| 9 | +import com.facebook.drawee.view.SimpleDraweeView; | |
| 10 | +import com.hjx.personalcenter.R; | |
| 11 | +import com.hjx.personalcenter.model.DefautPublishInfo; | |
| 12 | + | |
| 13 | +import java.util.ArrayList; | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * Created by h on 2017/9/12. | |
| 17 | + */ | |
| 18 | + | |
| 19 | +public class GridAdapter extends BaseAdapter { | |
| 20 | + private ArrayList<DefautPublishInfo> defautPublishInfo; | |
| 21 | + private Context context; | |
| 22 | + | |
| 23 | + public GridAdapter(ArrayList<DefautPublishInfo> defautPublishInfo, Context context) { | |
| 24 | + this.defautPublishInfo = defautPublishInfo; | |
| 25 | + this.context = context; | |
| 26 | + } | |
| 27 | + | |
| 28 | + @Override | |
| 29 | + public int getCount() { | |
| 30 | + return defautPublishInfo.size(); | |
| 31 | + } | |
| 32 | + | |
| 33 | + @Override | |
| 34 | + public Object getItem(int position) { | |
| 35 | + return position; | |
| 36 | + } | |
| 37 | + | |
| 38 | + @Override | |
| 39 | + public long getItemId(int position) { | |
| 40 | + return position; | |
| 41 | + } | |
| 42 | + | |
| 43 | + @Override | |
| 44 | + public View getView(int position, View convertView, ViewGroup parent) { | |
| 45 | + ViewHolder viewHolder = new ViewHolder(); | |
| 46 | + if (convertView == null) { | |
| 47 | + convertView = View.inflate(context, R.layout.fragment_changge_version_info_itmes, null); | |
| 48 | + viewHolder.simpleDraweeView = (SimpleDraweeView) convertView.findViewById(R.id.image_publish); | |
| 49 | + viewHolder.subject = (TextView) convertView.findViewById(R.id.subject); | |
| 50 | + viewHolder.publish = (TextView) convertView.findViewById(R.id.tv_publish); | |
| 51 | + convertView.setTag(viewHolder); | |
| 52 | + } else { | |
| 53 | + viewHolder = (ViewHolder) convertView.getTag(); | |
| 54 | + } | |
| 55 | + viewHolder.simpleDraweeView.setImageURI(defautPublishInfo.get(position).getImagurl()); | |
| 56 | + viewHolder.subject.setText(defautPublishInfo.get(position).getSubjuct()); | |
| 57 | + viewHolder.publish.setText(defautPublishInfo.get(position).getPublish()); | |
| 58 | + return convertView; | |
| 59 | + } | |
| 60 | + | |
| 61 | + static class ViewHolder { | |
| 62 | + SimpleDraweeView simpleDraweeView; | |
| 63 | + TextView subject; | |
| 64 | + TextView publish; | |
| 65 | + } | |
| 66 | +} | ... | ... | 
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/CitysListDialog.java
| 1 | 1 | package com.hjx.personalcenter.customdialog; | 
| 2 | 2 | |
| 3 | +import android.annotation.SuppressLint; | |
| 3 | 4 | import android.content.Context; | 
| 4 | 5 | import android.graphics.Color; | 
| 5 | 6 | import android.os.Bundle; | 
| ... | ... | @@ -30,16 +31,22 @@ import java.util.List; | 
| 30 | 31 | * 自定义市级列表对话框 | 
| 31 | 32 | * Created by h on 2017/8/10. | 
| 32 | 33 | */ | 
| 33 | - | |
| 34 | +@SuppressLint("ValidFragment") | |
| 34 | 35 | public class CitysListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { | 
| 35 | 36 | private CitysAdapter listadapter; | 
| 36 | 37 | private ListView listView; | 
| 37 | 38 | private ImageView cance; | 
| 39 | + private Context context; | |
| 38 | 40 | private DialogCallBack.CitysCallBack mCallBack; | 
| 39 | 41 | private ArrayList<CityInfo.CitiesBean> data = new ArrayList<>(); | 
| 42 | + public CitysListDialog() { | |
| 43 | + context= getActivity(); | |
| 44 | + } | |
| 40 | 45 | public CitysListDialog(DialogCallBack.CitysCallBack callBack) { | 
| 41 | 46 | this.mCallBack = callBack; | 
| 42 | 47 | } | 
| 48 | + | |
| 49 | + | |
| 43 | 50 | public static CitysListDialog getInstance(DialogCallBack.CitysCallBack callBack) { | 
| 44 | 51 | CitysListDialog dialogFragment = new CitysListDialog(callBack); | 
| 45 | 52 | dialogFragment.setCanceledBack(true); | ... | ... | 
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/CountryDialog.java
| 1 | 1 | package com.hjx.personalcenter.customdialog; | 
| 2 | 2 | |
| 3 | +import android.annotation.SuppressLint; | |
| 3 | 4 | import android.content.Context; | 
| 4 | 5 | import android.graphics.Color; | 
| 5 | 6 | import android.os.Bundle; | 
| ... | ... | @@ -29,7 +30,7 @@ import java.util.List; | 
| 29 | 30 | /** | 
| 30 | 31 | * Created by wei on 2017/8/21. | 
| 31 | 32 | */ | 
| 32 | - | |
| 33 | +@SuppressLint("ValidFragment") | |
| 33 | 34 | public class CountryDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { | 
| 34 | 35 | private CountryAdapter listadapter; | 
| 35 | 36 | private ListView listView; | ... | ... | 
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/ElectronicCardDialog.java
| 1 | 1 | package com.hjx.personalcenter.customdialog; | 
| 2 | 2 | |
| 3 | +import android.annotation.SuppressLint; | |
| 3 | 4 | import android.content.Context; | 
| 4 | 5 | import android.content.Intent; | 
| 5 | 6 | import android.graphics.Color; | 
| ... | ... | @@ -18,7 +19,7 @@ import com.mylhyl.circledialog.res.values.CircleDimen; | 
| 18 | 19 | /** | 
| 19 | 20 | * Created by h on 2017/8/10. | 
| 20 | 21 | */ | 
| 21 | - | |
| 22 | +@SuppressLint("ValidFragment") | |
| 22 | 23 | public class ElectronicCardDialog extends BaseCircleDialog { | 
| 23 | 24 | private ImageView cancel; | 
| 24 | 25 | public static ElectronicCardDialog getInstance() { | ... | ... | 
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/GradeListDialog.java
| 1 | 1 | package com.hjx.personalcenter.customdialog; | 
| 2 | 2 | |
| 3 | +import android.annotation.SuppressLint; | |
| 3 | 4 | import android.content.Context; | 
| 4 | 5 | import android.graphics.Color; | 
| 5 | 6 | import android.os.Bundle; | 
| ... | ... | @@ -29,7 +30,7 @@ import java.util.List; | 
| 29 | 30 | /**自定义年级列表对话框 | 
| 30 | 31 | * Created by h on 2017/8/10. | 
| 31 | 32 | */ | 
| 32 | - | |
| 33 | +@SuppressLint("ValidFragment") | |
| 33 | 34 | public class GradeListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { | 
| 34 | 35 | private GrandeAdapter listadapter; | 
| 35 | 36 | private ListView listView; | ... | ... | 
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/HeadDialog.java
| 1 | 1 | package com.hjx.personalcenter.customdialog; | 
| 2 | 2 | |
| 3 | +import android.annotation.SuppressLint; | |
| 3 | 4 | import android.content.Context; | 
| 4 | 5 | import android.graphics.Color; | 
| 5 | 6 | import android.os.Bundle; | 
| ... | ... | @@ -19,7 +20,7 @@ import com.mylhyl.circledialog.res.values.CircleDimen; | 
| 19 | 20 | /** | 
| 20 | 21 | * Created by h on 2017/8/20. | 
| 21 | 22 | */ | 
| 22 | - | |
| 23 | +@SuppressLint("ValidFragment") | |
| 23 | 24 | public class HeadDialog extends BaseCircleDialog implements View.OnClickListener { | 
| 24 | 25 | private View mView; | 
| 25 | 26 | private TextView oktakephone, cancetakephone; | ... | ... | 
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/ProvinceListDialog.java
| 1 | 1 | package com.hjx.personalcenter.customdialog; | 
| 2 | 2 | |
| 3 | +import android.annotation.SuppressLint; | |
| 3 | 4 | import android.content.Context; | 
| 4 | 5 | import android.graphics.Color; | 
| 5 | 6 | import android.os.Bundle; | 
| ... | ... | @@ -30,7 +31,7 @@ import java.util.List; | 
| 30 | 31 | * 自定义年级列表对话框 | 
| 31 | 32 | * Created by h on 2017/8/10. | 
| 32 | 33 | */ | 
| 33 | - | |
| 34 | +@SuppressLint("ValidFragment") | |
| 34 | 35 | public class ProvinceListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { | 
| 35 | 36 | private ProvincesAdapter listadapter; | 
| 36 | 37 | private ImageView cance; | ... | ... | 
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/SchoolListDialog.java
| 1 | 1 | package com.hjx.personalcenter.customdialog; | 
| 2 | 2 | |
| 3 | +import android.annotation.SuppressLint; | |
| 3 | 4 | import android.content.Context; | 
| 4 | 5 | import android.graphics.Color; | 
| 5 | 6 | import android.os.Bundle; | 
| ... | ... | @@ -32,7 +33,7 @@ import java.util.List; | 
| 32 | 33 | /** | 
| 33 | 34 | * Created by h on 2017/8/21. | 
| 34 | 35 | */ | 
| 35 | - | |
| 36 | +@SuppressLint("ValidFragment") | |
| 36 | 37 | public class SchoolListDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { | 
| 37 | 38 | private ListView school_list; | 
| 38 | 39 | private EditText school_sech; | ... | ... | 
PersonalCenter/app/src/main/java/com/hjx/personalcenter/customdialog/VerSionDialog.java
| 1 | 1 | package com.hjx.personalcenter.customdialog; | 
| 2 | 2 | |
| 3 | +import android.annotation.SuppressLint; | |
| 3 | 4 | import android.content.Context; | 
| 4 | 5 | import android.graphics.Color; | 
| 5 | 6 | import android.os.Bundle; | 
| ... | ... | @@ -31,7 +32,7 @@ import java.util.List; | 
| 31 | 32 | * 自定义版本信息列表对话框 | 
| 32 | 33 | * Created by h on 2017/8/10. | 
| 33 | 34 | */ | 
| 34 | - | |
| 35 | +@SuppressLint("ValidFragment") | |
| 35 | 36 | public class VerSionDialog extends BaseCircleDialog implements AdapterView.OnItemClickListener { | 
| 36 | 37 | private VersionAdapter listadapter; | 
| 37 | 38 | private ImageView cance; | ... | ... | 
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/LoginFragment.java
| ... | ... | @@ -18,7 +18,9 @@ import android.widget.Toast; | 
| 18 | 18 | import com.hjx.personalcenter.R; | 
| 19 | 19 | import com.hjx.personalcenter.activity.ForgotPasswordActivity; | 
| 20 | 20 | import com.hjx.personalcenter.activity.MainActivity; | 
| 21 | +import com.hjx.personalcenter.activity.RegisterInfoActivity; | |
| 21 | 22 | import com.hjx.personalcenter.customdialog.ElectronicCardDialog; | 
| 23 | +import com.hjx.personalcenter.db.SaveParam; | |
| 22 | 24 | import com.hjx.personalcenter.http.HttpCode; | 
| 23 | 25 | import com.hjx.personalcenter.http.HttpManager; | 
| 24 | 26 | import com.hjx.personalcenter.util.AlertUtils; | 
| ... | ... | @@ -68,10 +70,13 @@ public class LoginFragment extends Fragment implements View.OnClickListener { | 
| 68 | 70 | // | 
| 69 | 71 | try { | 
| 70 | 72 | long auserID = Long.parseLong(userId); | 
| 71 | - //是否填写保卡 | |
| 72 | - HttpManager.getInstance().cardinfocheck(getActivity(),auserID,handler); | |
| 73 | 73 | //登录成功,保存登录数据并且获取个人信息 | 
| 74 | 74 | HttpManager.getInstance().saveLoginInfo(getActivity(), name, pwd, access_token, "true", userId); | 
| 75 | + //检测注册信息是否完整 | |
| 76 | + HttpManager.getInstance().registerinfocheck(getActivity(),auserID,handler); | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 75 | 80 | } catch (NumberFormatException e) { | 
| 76 | 81 | e.printStackTrace(); | 
| 77 | 82 | } | 
| ... | ... | @@ -91,6 +96,40 @@ public class LoginFragment extends Fragment implements View.OnClickListener { | 
| 91 | 96 | e.printStackTrace(); | 
| 92 | 97 | } | 
| 93 | 98 | break; | 
| 99 | + case HttpCode.REGISTER_SUCESS: | |
| 100 | + try { | |
| 101 | + jsonObject = new JSONObject( (String) msg.obj); | |
| 102 | + status = jsonObject.optString("status"); | |
| 103 | + JSONObject isregisterinfo = (JSONObject) jsonObject.opt("data"); | |
| 104 | + boolean isRegisterInfoComplete =isregisterinfo.optBoolean("isRegisterInfoComplete"); | |
| 105 | + if (status.equals("1")){ | |
| 106 | + if (!isRegisterInfoComplete){ | |
| 107 | + Intent intent = new Intent(); | |
| 108 | + intent.setClass(getActivity(), RegisterInfoActivity.class); | |
| 109 | + getActivity().startActivity(intent); | |
| 110 | + getActivity().overridePendingTransition(R.anim.rightin, R.anim.rightout); | |
| 111 | + }else { | |
| 112 | + String userID = SaveParam.getInstance().getLoginParam(getActivity(),"userId"); | |
| 113 | + try { | |
| 114 | + long auserID = Long.parseLong(userID); | |
| 115 | + //是否填写保卡 | |
| 116 | + HttpManager.getInstance().cardinfocheck(getActivity(),auserID,handler); | |
| 117 | + } catch (NumberFormatException e) { | |
| 118 | + e.printStackTrace(); | |
| 119 | + } | |
| 120 | + | |
| 121 | + | |
| 122 | + } | |
| 123 | + | |
| 124 | + }else{ | |
| 125 | + Toast.makeText(getActivity(), "请检查网络", Toast.LENGTH_LONG).show(); | |
| 126 | + } | |
| 127 | + | |
| 128 | + } catch (JSONException e) { | |
| 129 | + e.printStackTrace(); | |
| 130 | + } | |
| 131 | + | |
| 132 | + break; | |
| 94 | 133 | case HttpCode.CHECKCARD: | 
| 95 | 134 | try { | 
| 96 | 135 | jsonObject = new JSONObject( (String) msg.obj); | ... | ... | 
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/RegisterFragment.java
| ... | ... | @@ -77,7 +77,6 @@ public class RegisterFragment extends Fragment implements View.OnClickListener { | 
| 77 | 77 | HttpManager.getInstance().saveLoginInfo(getActivity(),usernameStr,passwordStr,access_token,"true",userId); | 
| 78 | 78 | AlertUtils.showToast(getActivity(), "注册成功!"); | 
| 79 | 79 | Content.accountflag =1; | 
| 80 | - //检查信息是否填写完整 | |
| 81 | 80 | Intent intent = new Intent(); | 
| 82 | 81 | intent.setClass(getActivity(),RegisterInfoActivity.class); | 
| 83 | 82 | startActivity(intent); | ... | ... | 
PersonalCenter/app/src/main/java/com/hjx/personalcenter/fragment/VersionsInfoFragment.java
| ... | ... | @@ -8,28 +8,24 @@ import android.view.View; | 
| 8 | 8 | import android.view.ViewGroup; | 
| 9 | 9 | import android.widget.AdapterView; | 
| 10 | 10 | import android.widget.GridView; | 
| 11 | -import android.widget.SimpleAdapter; | |
| 12 | 11 | |
| 13 | 12 | import com.hjx.personalcenter.R; | 
| 13 | +import com.hjx.personalcenter.adapter.GridAdapter; | |
| 14 | 14 | import com.hjx.personalcenter.customdialog.VerSionDialog; | 
| 15 | 15 | import com.hjx.personalcenter.db.SaveParam; | 
| 16 | 16 | import com.hjx.personalcenter.interfaces.DialogCallBack; | 
| 17 | -import com.hjx.personalcenter.model.VersionInfo; | |
| 18 | -import com.hjx.personalcenter.util.AlertUtils; | |
| 17 | +import com.hjx.personalcenter.model.DefautPublishInfo; | |
| 19 | 18 | |
| 20 | 19 | import java.util.ArrayList; | 
| 21 | -import java.util.HashMap; | |
| 22 | -import java.util.List; | |
| 23 | -import java.util.Map; | |
| 24 | 20 | |
| 25 | 21 | /** | 
| 26 | 22 | * Created by h on 2017/8/12. | 
| 27 | 23 | */ | 
| 28 | 24 | |
| 29 | -public class VersionsInfoFragment extends Fragment implements AdapterView.OnItemClickListener,DialogCallBack.VersionCallBack { | |
| 25 | +public class VersionsInfoFragment extends Fragment implements AdapterView.OnItemClickListener{ | |
| 30 | 26 | private GridView gridView; | 
| 31 | - private List<Map<String, Object>> data_list; | |
| 32 | - private SimpleAdapter sim_adapter; | |
| 27 | + private ArrayList<DefautPublishInfo> defautPublishInfos = new ArrayList<>(); | |
| 28 | + private GridAdapter sim_adapter; | |
| 33 | 29 | private View mView; | 
| 34 | 30 | private int type; | 
| 35 | 31 | public static String TABLAYOUT_FRAGMENT = "tab_fragment"; | 
| ... | ... | @@ -42,16 +38,6 @@ public class VersionsInfoFragment extends Fragment implements AdapterView.OnItem | 
| 42 | 38 | return fragment; | 
| 43 | 39 | |
| 44 | 40 | } | 
| 45 | - // 图片封装为一个数组 | |
| 46 | - private int[] icon = { R.mipmap.ic_launcher, R.mipmap.ic_launcher, | |
| 47 | - R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher, | |
| 48 | - R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher, | |
| 49 | - R.mipmap.ic_launcher}; | |
| 50 | - private String[] subject = { "语文", "数学", "英语", "物理", "化学", "生物", "政治", | |
| 51 | - "历史", "地理" }; | |
| 52 | - private String[] publish = { "人民教育出版社", "人民教育出版社", "人民教育出版社", | |
| 53 | - "人民教育出版社", "人民教育出版社", "人民教育出版社", "人民教育出版社", | |
| 54 | - "人民教育出版社", "人民教育出版社" }; | |
| 55 | 41 | @Override | 
| 56 | 42 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 
| 57 | 43 | if (mView == null) { | 
| ... | ... | @@ -70,26 +56,26 @@ public class VersionsInfoFragment extends Fragment implements AdapterView.OnItem | 
| 70 | 56 | |
| 71 | 57 | } | 
| 72 | 58 | private void initData() { | 
| 73 | - data_list = new ArrayList<Map<String, Object>>(); | |
| 74 | - getData(); | |
| 75 | - String [] from ={"image","text","text1"}; | |
| 76 | - int [] to = {R.id.image,R.id.text}; | |
| 77 | - sim_adapter = new SimpleAdapter(getActivity(), data_list, R.layout.fragment_changge_version_info_itmes, from, to); | |
| 59 | + DefautPublishInfo defautPublishInfo = new DefautPublishInfo(); | |
| 60 | + defautPublishInfo.setImagurl("http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/8480ff7b-42f1-4d64-b848-c8f4f3afd385.png"); | |
| 61 | + defautPublishInfo.setSubjuct("语文"); | |
| 62 | + defautPublishInfo.setPublish("人民教育出版社"); | |
| 63 | + DefautPublishInfo defautPublishInfo1 = new DefautPublishInfo(); | |
| 64 | + defautPublishInfo1.setImagurl("http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/8480ff7b-42f1-4d64-b848-c8f4f3afd385.png"); | |
| 65 | + defautPublishInfo1.setSubjuct("数学"); | |
| 66 | + defautPublishInfo1.setPublish("人民教育出版社"); | |
| 67 | + DefautPublishInfo defautPublishInfo2 = new DefautPublishInfo(); | |
| 68 | + defautPublishInfo2.setImagurl("http://hjxprodbucket.oss.aliyuncs.com/static/upload/boss_api/announcement/2017-08-29/8480ff7b-42f1-4d64-b848-c8f4f3afd385.png"); | |
| 69 | + defautPublishInfo2.setSubjuct("英语"); | |
| 70 | + defautPublishInfo2.setPublish("人民教育出版社"); | |
| 71 | + defautPublishInfos.add(defautPublishInfo); | |
| 72 | + defautPublishInfos.add(defautPublishInfo1); | |
| 73 | + defautPublishInfos.add(defautPublishInfo2); | |
| 74 | + sim_adapter = new GridAdapter(defautPublishInfos,getActivity()); | |
| 78 | 75 | //配置适配器 | 
| 79 | 76 | gridView.setAdapter(sim_adapter); | 
| 80 | 77 | } | 
| 81 | - public List<Map<String, Object>> getData(){ | |
| 82 | - //cion和iconName的长度是相同的,这里任选其一都可以 | |
| 83 | - for(int i=0;i<icon.length;i++){ | |
| 84 | - Map<String, Object> map = new HashMap<String, Object>(); | |
| 85 | - map.put("image", icon[i]); | |
| 86 | - map.put("text", subject[i]); | |
| 87 | - map.put("text1", publish[i]); | |
| 88 | - data_list.add(map); | |
| 89 | - } | |
| 90 | 78 | |
| 91 | - return data_list; | |
| 92 | - } | |
| 93 | 79 | private void setLister() { | 
| 94 | 80 | gridView.setOnItemClickListener(this); | 
| 95 | 81 | } | 
| ... | ... | @@ -131,12 +117,11 @@ public class VersionsInfoFragment extends Fragment implements AdapterView.OnItem | 
| 131 | 117 | |
| 132 | 118 | } | 
| 133 | 119 | |
| 134 | - @Override | |
| 135 | - public void versionOnItemClick(ArrayList<VersionInfo.DataBean> data, int position, int type) { | |
| 136 | - String regionName = data.get(position).getPressName(); | |
| 137 | - //SaveParam.getInstance().saveLoginParam(this, "sheng", regionName); | |
| 138 | - AlertUtils.showToast(getActivity(),regionName); | |
| 139 | 120 | |
| 140 | 121 | |
| 122 | + @Override | |
| 123 | + public void onResume() { | |
| 124 | + super.onResume(); | |
| 125 | + | |
| 141 | 126 | } | 
| 142 | 127 | } | ... | ... | 
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpCode.java
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpManager.java
| ... | ... | @@ -6,11 +6,7 @@ import android.content.Context; | 
| 6 | 6 | import android.content.Intent; | 
| 7 | 7 | import android.os.Handler; | 
| 8 | 8 | import android.os.Message; | 
| 9 | -import android.provider.Settings; | |
| 10 | -import android.support.v4.app.FragmentActivity; | |
| 11 | 9 | import android.util.Log; | 
| 12 | -import android.view.Gravity; | |
| 13 | -import android.view.View; | |
| 14 | 10 | import android.widget.Toast; | 
| 15 | 11 | |
| 16 | 12 | import com.google.gson.Gson; | 
| ... | ... | @@ -36,9 +32,6 @@ import com.hjx.personalcenter.util.DialogPermission; | 
| 36 | 32 | import com.loopj.android.http.AsyncHttpResponseHandler; | 
| 37 | 33 | import com.loopj.android.http.JsonHttpResponseHandler; | 
| 38 | 34 | import com.loopj.android.http.RequestParams; | 
| 39 | -import com.mylhyl.circledialog.CircleDialog; | |
| 40 | -import com.mylhyl.circledialog.callback.ConfigText; | |
| 41 | -import com.mylhyl.circledialog.params.TextParams; | |
| 42 | 35 | |
| 43 | 36 | import org.apache.http.Header; | 
| 44 | 37 | import org.apache.http.entity.ByteArrayEntity; | 
| ... | ... | @@ -86,27 +79,7 @@ public class HttpManager { | 
| 86 | 79 | @Override | 
| 87 | 80 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 
| 88 | 81 | closeProgress(); | 
| 89 | - new CircleDialog.Builder((FragmentActivity) mContext) | |
| 90 | - .setCanceledOnTouchOutside(false) | |
| 91 | - .setCancelable(false) | |
| 92 | - .setWidth(0.5f) | |
| 93 | - .configText(new ConfigText() { | |
| 94 | - @Override | |
| 95 | - public void onConfig(TextParams params) { | |
| 96 | - params.gravity = Gravity.CENTER; | |
| 97 | - params.padding = new int[]{50, 50, 50, 50}; | |
| 98 | - } | |
| 99 | - }) | |
| 100 | - .setText("当前无网络,请检查网络设置") | |
| 101 | - .setNegative("继续使用", null) | |
| 102 | - .setPositive("设置网络", new View.OnClickListener() { | |
| 103 | - @Override | |
| 104 | - public void onClick(View v) { | |
| 105 | - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 106 | - mContext.startActivity(intent); | |
| 107 | - } | |
| 108 | - }) | |
| 109 | - .show(); | |
| 82 | + AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 110 | 83 | } | 
| 111 | 84 | }); | 
| 112 | 85 | } | 
| ... | ... | @@ -149,27 +122,7 @@ public class HttpManager { | 
| 149 | 122 | super.onFailure(statusCode, headers, throwable, errorResponse); | 
| 150 | 123 | closeProgress(); | 
| 151 | 124 | Log.e("test", "onFailure" + errorResponse); | 
| 152 | - new CircleDialog.Builder((FragmentActivity) context) | |
| 153 | - .setCanceledOnTouchOutside(false) | |
| 154 | - .setCancelable(false) | |
| 155 | - .setWidth(0.5f) | |
| 156 | - .configText(new ConfigText() { | |
| 157 | - @Override | |
| 158 | - public void onConfig(TextParams params) { | |
| 159 | - params.gravity = Gravity.CENTER; | |
| 160 | - params.padding = new int[]{50, 50, 50, 50}; | |
| 161 | - } | |
| 162 | - }) | |
| 163 | - .setText("当前无网络,请检查网络设置") | |
| 164 | - .setNegative("继续使用", null) | |
| 165 | - .setPositive("设置网络", new View.OnClickListener() { | |
| 166 | - @Override | |
| 167 | - public void onClick(View v) { | |
| 168 | - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 169 | - context.startActivity(intent); | |
| 170 | - } | |
| 171 | - }) | |
| 172 | - .show(); | |
| 125 | + AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 173 | 126 | } | 
| 174 | 127 | |
| 175 | 128 | }); | 
| ... | ... | @@ -194,27 +147,7 @@ public class HttpManager { | 
| 194 | 147 | |
| 195 | 148 | @Override | 
| 196 | 149 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 
| 197 | - new CircleDialog.Builder((FragmentActivity) mContext) | |
| 198 | - .setCanceledOnTouchOutside(false) | |
| 199 | - .setCancelable(false) | |
| 200 | - .setWidth(0.5f) | |
| 201 | - .configText(new ConfigText() { | |
| 202 | - @Override | |
| 203 | - public void onConfig(TextParams params) { | |
| 204 | - params.gravity = Gravity.CENTER; | |
| 205 | - params.padding = new int[]{50, 50, 50, 50}; | |
| 206 | - } | |
| 207 | - }) | |
| 208 | - .setText("当前无网络,请检查网络设置") | |
| 209 | - .setNegative("继续使用", null) | |
| 210 | - .setPositive("设置网络", new View.OnClickListener() { | |
| 211 | - @Override | |
| 212 | - public void onClick(View v) { | |
| 213 | - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 214 | - mContext.startActivity(intent); | |
| 215 | - } | |
| 216 | - }) | |
| 217 | - .show(); | |
| 150 | + AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 218 | 151 | } | 
| 219 | 152 | }); | 
| 220 | 153 | } | 
| ... | ... | @@ -237,27 +170,7 @@ public class HttpManager { | 
| 237 | 170 | |
| 238 | 171 | @Override | 
| 239 | 172 | public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) { | 
| 240 | - new CircleDialog.Builder((FragmentActivity) mContext) | |
| 241 | - .setCanceledOnTouchOutside(false) | |
| 242 | - .setCancelable(false) | |
| 243 | - .setWidth(0.5f) | |
| 244 | - .configText(new ConfigText() { | |
| 245 | - @Override | |
| 246 | - public void onConfig(TextParams params) { | |
| 247 | - params.gravity = Gravity.CENTER; | |
| 248 | - params.padding = new int[]{50, 50, 50, 50}; | |
| 249 | - } | |
| 250 | - }) | |
| 251 | - .setText("当前无网络,请检查网络设置") | |
| 252 | - .setNegative("继续使用", null) | |
| 253 | - .setPositive("设置网络", new View.OnClickListener() { | |
| 254 | - @Override | |
| 255 | - public void onClick(View v) { | |
| 256 | - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 257 | - mContext.startActivity(intent); | |
| 258 | - } | |
| 259 | - }) | |
| 260 | - .show(); | |
| 173 | + AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 261 | 174 | |
| 262 | 175 | } | 
| 263 | 176 | }); | 
| ... | ... | @@ -296,27 +209,7 @@ public class HttpManager { | 
| 296 | 209 | @Override | 
| 297 | 210 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 
| 298 | 211 | Log.e("test", "onFailure" + new String(bytes)); | 
| 299 | - new CircleDialog.Builder((FragmentActivity) context) | |
| 300 | - .setCanceledOnTouchOutside(false) | |
| 301 | - .setCancelable(false) | |
| 302 | - .setWidth(0.5f) | |
| 303 | - .configText(new ConfigText() { | |
| 304 | - @Override | |
| 305 | - public void onConfig(TextParams params) { | |
| 306 | - params.gravity = Gravity.CENTER; | |
| 307 | - params.padding = new int[]{50, 50, 50, 50}; | |
| 308 | - } | |
| 309 | - }) | |
| 310 | - .setText("当前无网络,请检查网络设置") | |
| 311 | - .setNegative("继续使用", null) | |
| 312 | - .setPositive("设置网络", new View.OnClickListener() { | |
| 313 | - @Override | |
| 314 | - public void onClick(View v) { | |
| 315 | - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 316 | - context.startActivity(intent); | |
| 317 | - } | |
| 318 | - }) | |
| 319 | - .show(); | |
| 212 | + AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 320 | 213 | } | 
| 321 | 214 | }); | 
| 322 | 215 | |
| ... | ... | @@ -350,27 +243,7 @@ public class HttpManager { | 
| 350 | 243 | @Override | 
| 351 | 244 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 
| 352 | 245 | Log.e("test", "onFailure" + new String(bytes)); | 
| 353 | - new CircleDialog.Builder((FragmentActivity) context) | |
| 354 | - .setCanceledOnTouchOutside(false) | |
| 355 | - .setCancelable(false) | |
| 356 | - .setWidth(0.5f) | |
| 357 | - .configText(new ConfigText() { | |
| 358 | - @Override | |
| 359 | - public void onConfig(TextParams params) { | |
| 360 | - params.gravity = Gravity.CENTER; | |
| 361 | - params.padding = new int[]{50, 50, 50, 50}; | |
| 362 | - } | |
| 363 | - }) | |
| 364 | - .setText("当前无网络,请检查网络设置") | |
| 365 | - .setNegative("继续使用", null) | |
| 366 | - .setPositive("设置网络", new View.OnClickListener() { | |
| 367 | - @Override | |
| 368 | - public void onClick(View v) { | |
| 369 | - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 370 | - context.startActivity(intent); | |
| 371 | - } | |
| 372 | - }) | |
| 373 | - .show(); | |
| 246 | + AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 374 | 247 | } | 
| 375 | 248 | }); | 
| 376 | 249 | |
| ... | ... | @@ -441,27 +314,7 @@ public class HttpManager { | 
| 441 | 314 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 
| 442 | 315 | Log.e("test", "onFailure" + (throwable)); | 
| 443 | 316 | closeProgress(); | 
| 444 | - new CircleDialog.Builder((FragmentActivity) context) | |
| 445 | - .setCanceledOnTouchOutside(false) | |
| 446 | - .setCancelable(false) | |
| 447 | - .setWidth(0.5f) | |
| 448 | - .configText(new ConfigText() { | |
| 449 | - @Override | |
| 450 | - public void onConfig(TextParams params) { | |
| 451 | - params.gravity = Gravity.CENTER; | |
| 452 | - params.padding = new int[]{50, 50, 50, 50}; | |
| 453 | - } | |
| 454 | - }) | |
| 455 | - .setText("当前无网络,请检查网络设置") | |
| 456 | - .setNegative("继续使用", null) | |
| 457 | - .setPositive("设置网络", new View.OnClickListener() { | |
| 458 | - @Override | |
| 459 | - public void onClick(View v) { | |
| 460 | - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 461 | - context.startActivity(intent); | |
| 462 | - } | |
| 463 | - }) | |
| 464 | - .show(); | |
| 317 | + AlertUtils.showToast(context, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 465 | 318 | |
| 466 | 319 | } | 
| 467 | 320 | }); | 
| ... | ... | @@ -504,27 +357,7 @@ public class HttpManager { | 
| 504 | 357 | @Override | 
| 505 | 358 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 
| 506 | 359 | closeProgress(); | 
| 507 | - new CircleDialog.Builder((FragmentActivity) mContext) | |
| 508 | - .setCanceledOnTouchOutside(false) | |
| 509 | - .setCancelable(false) | |
| 510 | - .setWidth(0.5f) | |
| 511 | - .configText(new ConfigText() { | |
| 512 | - @Override | |
| 513 | - public void onConfig(TextParams params) { | |
| 514 | - params.gravity = Gravity.CENTER; | |
| 515 | - params.padding = new int[]{50, 50, 50, 50}; | |
| 516 | - } | |
| 517 | - }) | |
| 518 | - .setText("当前无网络,请检查网络设置") | |
| 519 | - .setNegative("继续使用", null) | |
| 520 | - .setPositive("设置网络", new View.OnClickListener() { | |
| 521 | - @Override | |
| 522 | - public void onClick(View v) { | |
| 523 | - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 524 | - mContext.startActivity(intent); | |
| 525 | - } | |
| 526 | - }) | |
| 527 | - .show(); | |
| 360 | + AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 528 | 361 | } | 
| 529 | 362 | }); | 
| 530 | 363 | } | 
| ... | ... | @@ -565,27 +398,7 @@ public class HttpManager { | 
| 565 | 398 | @Override | 
| 566 | 399 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 
| 567 | 400 | Log.e("test", "onFailure" + new String(bytes)); | 
| 568 | - new CircleDialog.Builder((FragmentActivity) mContext) | |
| 569 | - .setCanceledOnTouchOutside(false) | |
| 570 | - .setCancelable(false) | |
| 571 | - .setWidth(0.5f) | |
| 572 | - .configText(new ConfigText() { | |
| 573 | - @Override | |
| 574 | - public void onConfig(TextParams params) { | |
| 575 | - params.gravity = Gravity.CENTER; | |
| 576 | - params.padding = new int[]{50, 50, 50, 50}; | |
| 577 | - } | |
| 578 | - }) | |
| 579 | - .setText("当前无网络,请检查网络设置") | |
| 580 | - .setNegative("继续使用", null) | |
| 581 | - .setPositive("设置网络", new View.OnClickListener() { | |
| 582 | - @Override | |
| 583 | - public void onClick(View v) { | |
| 584 | - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 585 | - mContext.startActivity(intent); | |
| 586 | - } | |
| 587 | - }) | |
| 588 | - .show(); | |
| 401 | + AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 589 | 402 | } | 
| 590 | 403 | }); | 
| 591 | 404 | } | 
| ... | ... | @@ -605,7 +418,7 @@ public class HttpManager { | 
| 605 | 418 | JSONObject jsonObject = new JSONObject(new String(bytes)); | 
| 606 | 419 | String status = jsonObject.optString("status"); | 
| 607 | 420 | if (status.equals("1")) { | 
| 608 | - Toast.makeText(mContext, "手机号修改成功", Toast.LENGTH_LONG).show(); | |
| 421 | + Toast.makeText(mContext, "修改成功", Toast.LENGTH_LONG).show(); | |
| 609 | 422 | SaveParam.getInstance().saveCustomizeParam(mContext, SaveParam.ADRESSCUNSTEM, customerAddress); | 
| 610 | 423 | ((Activity) mContext).finish(); | 
| 611 | 424 | } else { | 
| ... | ... | @@ -619,27 +432,7 @@ public class HttpManager { | 
| 619 | 432 | @Override | 
| 620 | 433 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 
| 621 | 434 | Log.e("test", "onFailure" + new String(bytes)); | 
| 622 | - new CircleDialog.Builder((FragmentActivity) mContext) | |
| 623 | - .setCanceledOnTouchOutside(false) | |
| 624 | - .setCancelable(false) | |
| 625 | - .setWidth(0.5f) | |
| 626 | - .configText(new ConfigText() { | |
| 627 | - @Override | |
| 628 | - public void onConfig(TextParams params) { | |
| 629 | - params.gravity = Gravity.CENTER; | |
| 630 | - params.padding = new int[]{50, 50, 50, 50}; | |
| 631 | - } | |
| 632 | - }) | |
| 633 | - .setText("当前无网络,请检查网络设置") | |
| 634 | - .setNegative("继续使用", null) | |
| 635 | - .setPositive("设置网络", new View.OnClickListener() { | |
| 636 | - @Override | |
| 637 | - public void onClick(View v) { | |
| 638 | - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 639 | - mContext.startActivity(intent); | |
| 640 | - } | |
| 641 | - }) | |
| 642 | - .show(); | |
| 435 | + AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 643 | 436 | } | 
| 644 | 437 | }); | 
| 645 | 438 | } | 
| ... | ... | @@ -665,27 +458,7 @@ public class HttpManager { | 
| 665 | 458 | @Override | 
| 666 | 459 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 
| 667 | 460 | closeProgress(); | 
| 668 | - new CircleDialog.Builder((FragmentActivity) mContext) | |
| 669 | - .setCanceledOnTouchOutside(false) | |
| 670 | - .setCancelable(false) | |
| 671 | - .setWidth(0.5f) | |
| 672 | - .configText(new ConfigText() { | |
| 673 | - @Override | |
| 674 | - public void onConfig(TextParams params) { | |
| 675 | - params.gravity = Gravity.CENTER; | |
| 676 | - params.padding = new int[]{50, 50, 50, 50}; | |
| 677 | - } | |
| 678 | - }) | |
| 679 | - .setText("当前无网络,请检查网络设置") | |
| 680 | - .setNegative("继续使用", null) | |
| 681 | - .setPositive("设置网络", new View.OnClickListener() { | |
| 682 | - @Override | |
| 683 | - public void onClick(View v) { | |
| 684 | - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 685 | - mContext.startActivity(intent); | |
| 686 | - } | |
| 687 | - }) | |
| 688 | - .show(); | |
| 461 | + AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 689 | 462 | //Toast.makeText(mContext, "请检查网络。。" + arg3, Toast.LENGTH_LONG).show(); | 
| 690 | 463 | } | 
| 691 | 464 | }); | 
| ... | ... | @@ -725,27 +498,7 @@ public class HttpManager { | 
| 725 | 498 | |
| 726 | 499 | @Override | 
| 727 | 500 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 
| 728 | - new CircleDialog.Builder((FragmentActivity) mContext) | |
| 729 | - .setCanceledOnTouchOutside(false) | |
| 730 | - .setCancelable(false) | |
| 731 | - .setWidth(0.5f) | |
| 732 | - .configText(new ConfigText() { | |
| 733 | - @Override | |
| 734 | - public void onConfig(TextParams params) { | |
| 735 | - params.gravity = Gravity.CENTER; | |
| 736 | - params.padding = new int[]{50, 50, 50, 50}; | |
| 737 | - } | |
| 738 | - }) | |
| 739 | - .setText("当前无网络,请检查网络设置") | |
| 740 | - .setNegative("继续使用", null) | |
| 741 | - .setPositive("设置网络", new View.OnClickListener() { | |
| 742 | - @Override | |
| 743 | - public void onClick(View v) { | |
| 744 | - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 745 | - mContext.startActivity(intent); | |
| 746 | - } | |
| 747 | - }) | |
| 748 | - .show(); | |
| 501 | + AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 749 | 502 | } | 
| 750 | 503 | }); | 
| 751 | 504 | } | 
| ... | ... | @@ -788,27 +541,7 @@ public class HttpManager { | 
| 788 | 541 | |
| 789 | 542 | @Override | 
| 790 | 543 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 
| 791 | - new CircleDialog.Builder((FragmentActivity) mContext) | |
| 792 | - .setCanceledOnTouchOutside(false) | |
| 793 | - .setCancelable(false) | |
| 794 | - .setWidth(0.5f) | |
| 795 | - .configText(new ConfigText() { | |
| 796 | - @Override | |
| 797 | - public void onConfig(TextParams params) { | |
| 798 | - params.gravity = Gravity.CENTER; | |
| 799 | - params.padding = new int[]{50, 50, 50, 50}; | |
| 800 | - } | |
| 801 | - }) | |
| 802 | - .setText("当前无网络,请检查网络设置") | |
| 803 | - .setNegative("继续使用", null) | |
| 804 | - .setPositive("设置网络", new View.OnClickListener() { | |
| 805 | - @Override | |
| 806 | - public void onClick(View v) { | |
| 807 | - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 808 | - mContext.startActivity(intent); | |
| 809 | - } | |
| 810 | - }) | |
| 811 | - .show(); | |
| 544 | + AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 812 | 545 | } | 
| 813 | 546 | }); | 
| 814 | 547 | } | 
| ... | ... | @@ -857,27 +590,7 @@ public class HttpManager { | 
| 857 | 590 | @Override | 
| 858 | 591 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 
| 859 | 592 | closeProgress(); | 
| 860 | - new CircleDialog.Builder((FragmentActivity) mContext) | |
| 861 | - .setCanceledOnTouchOutside(false) | |
| 862 | - .setCancelable(false) | |
| 863 | - .setWidth(0.5f) | |
| 864 | - .configText(new ConfigText() { | |
| 865 | - @Override | |
| 866 | - public void onConfig(TextParams params) { | |
| 867 | - params.gravity = Gravity.CENTER; | |
| 868 | - params.padding = new int[]{50, 50, 50, 50}; | |
| 869 | - } | |
| 870 | - }) | |
| 871 | - .setText("当前无网络,请检查网络设置") | |
| 872 | - .setNegative("继续使用", null) | |
| 873 | - .setPositive("设置网络", new View.OnClickListener() { | |
| 874 | - @Override | |
| 875 | - public void onClick(View v) { | |
| 876 | - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 877 | - mContext.startActivity(intent); | |
| 878 | - } | |
| 879 | - }) | |
| 880 | - .show(); | |
| 593 | + AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 881 | 594 | } | 
| 882 | 595 | }); | 
| 883 | 596 | } | 
| ... | ... | @@ -924,27 +637,7 @@ public class HttpManager { | 
| 924 | 637 | super.onFailure(statusCode, headers, throwable, errorResponse); | 
| 925 | 638 | closeProgress(); | 
| 926 | 639 | Log.e("test", "onFailure" + errorResponse); | 
| 927 | - new CircleDialog.Builder((FragmentActivity) mContext) | |
| 928 | - .setCanceledOnTouchOutside(false) | |
| 929 | - .setCancelable(false) | |
| 930 | - .setWidth(0.5f) | |
| 931 | - .configText(new ConfigText() { | |
| 932 | - @Override | |
| 933 | - public void onConfig(TextParams params) { | |
| 934 | - params.gravity = Gravity.CENTER; | |
| 935 | - params.padding = new int[]{50, 50, 50, 50}; | |
| 936 | - } | |
| 937 | - }) | |
| 938 | - .setText("当前无网络,请检查网络设置") | |
| 939 | - .setNegative("继续使用", null) | |
| 940 | - .setPositive("设置网络", new View.OnClickListener() { | |
| 941 | - @Override | |
| 942 | - public void onClick(View v) { | |
| 943 | - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 944 | - mContext.startActivity(intent); | |
| 945 | - } | |
| 946 | - }) | |
| 947 | - .show(); | |
| 640 | + AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 948 | 641 | } | 
| 949 | 642 | |
| 950 | 643 | }); | 
| ... | ... | @@ -976,27 +669,7 @@ public class HttpManager { | 
| 976 | 669 | @Override | 
| 977 | 670 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 
| 978 | 671 | Log.e("test", "onFailure" + new String(bytes)); | 
| 979 | - new CircleDialog.Builder((FragmentActivity) mContext) | |
| 980 | - .setCanceledOnTouchOutside(false) | |
| 981 | - .setCancelable(false) | |
| 982 | - .setWidth(0.5f) | |
| 983 | - .configText(new ConfigText() { | |
| 984 | - @Override | |
| 985 | - public void onConfig(TextParams params) { | |
| 986 | - params.gravity = Gravity.CENTER; | |
| 987 | - params.padding = new int[]{50, 50, 50, 50}; | |
| 988 | - } | |
| 989 | - }) | |
| 990 | - .setText("当前无网络,请检查网络设置") | |
| 991 | - .setNegative("继续使用", null) | |
| 992 | - .setPositive("设置网络", new View.OnClickListener() { | |
| 993 | - @Override | |
| 994 | - public void onClick(View v) { | |
| 995 | - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 996 | - mContext.startActivity(intent); | |
| 997 | - } | |
| 998 | - }) | |
| 999 | - .show(); | |
| 672 | + AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 1000 | 673 | } | 
| 1001 | 674 | }); | 
| 1002 | 675 | } | 
| ... | ... | @@ -1042,7 +715,7 @@ public class HttpManager { | 
| 1042 | 715 | @Override | 
| 1043 | 716 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 
| 1044 | 717 | Log.e("test", "失败原因" + arg3); | 
| 1045 | - AlertUtils.showToast(mContext, "你好,服务器异常,请稍后重试!"); | |
| 718 | + AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 1046 | 719 | } | 
| 1047 | 720 | }); | 
| 1048 | 721 | } | 
| ... | ... | @@ -1098,27 +771,7 @@ public class HttpManager { | 
| 1098 | 771 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 
| 1099 | 772 | closeProgress(); | 
| 1100 | 773 | Log.e("test", "错误信息" + new String(bytes)); | 
| 1101 | - new CircleDialog.Builder((FragmentActivity) mContext) | |
| 1102 | - .setCanceledOnTouchOutside(false) | |
| 1103 | - .setCancelable(false) | |
| 1104 | - .setWidth(0.5f) | |
| 1105 | - .configText(new ConfigText() { | |
| 1106 | - @Override | |
| 1107 | - public void onConfig(TextParams params) { | |
| 1108 | - params.gravity = Gravity.CENTER; | |
| 1109 | - params.padding = new int[]{50, 50, 50, 50}; | |
| 1110 | - } | |
| 1111 | - }) | |
| 1112 | - .setText("当前无网络,请检查网络设置") | |
| 1113 | - .setNegative("继续使用", null) | |
| 1114 | - .setPositive("设置网络", new View.OnClickListener() { | |
| 1115 | - @Override | |
| 1116 | - public void onClick(View v) { | |
| 1117 | - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 1118 | - mContext.startActivity(intent); | |
| 1119 | - } | |
| 1120 | - }) | |
| 1121 | - .show(); | |
| 774 | + AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 1122 | 775 | |
| 1123 | 776 | } | 
| 1124 | 777 | }); | 
| ... | ... | @@ -1174,27 +827,7 @@ public class HttpManager { | 
| 1174 | 827 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 
| 1175 | 828 | closeProgress(); | 
| 1176 | 829 | // Log.e("test", "错误信息" + new String(arg2)); | 
| 1177 | - new CircleDialog.Builder((FragmentActivity) mContext) | |
| 1178 | - .setCanceledOnTouchOutside(false) | |
| 1179 | - .setCancelable(false) | |
| 1180 | - .setWidth(0.5f) | |
| 1181 | - .configText(new ConfigText() { | |
| 1182 | - @Override | |
| 1183 | - public void onConfig(TextParams params) { | |
| 1184 | - params.gravity = Gravity.CENTER; | |
| 1185 | - params.padding = new int[]{50, 50, 50, 50}; | |
| 1186 | - } | |
| 1187 | - }) | |
| 1188 | - .setText("当前无网络,请检查网络设置") | |
| 1189 | - .setNegative("继续使用", null) | |
| 1190 | - .setPositive("设置网络", new View.OnClickListener() { | |
| 1191 | - @Override | |
| 1192 | - public void onClick(View v) { | |
| 1193 | - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 1194 | - mContext.startActivity(intent); | |
| 1195 | - } | |
| 1196 | - }) | |
| 1197 | - .show(); | |
| 830 | + AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 1198 | 831 | } | 
| 1199 | 832 | }); | 
| 1200 | 833 | |
| ... | ... | @@ -1236,27 +869,7 @@ public class HttpManager { | 
| 1236 | 869 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 
| 1237 | 870 | closeProgress(); | 
| 1238 | 871 | Log.e("test", "错误信息" + new String(arg2)); | 
| 1239 | - new CircleDialog.Builder((FragmentActivity) mContext) | |
| 1240 | - .setCanceledOnTouchOutside(false) | |
| 1241 | - .setCancelable(false) | |
| 1242 | - .setWidth(0.5f) | |
| 1243 | - .configText(new ConfigText() { | |
| 1244 | - @Override | |
| 1245 | - public void onConfig(TextParams params) { | |
| 1246 | - params.gravity = Gravity.CENTER; | |
| 1247 | - params.padding = new int[]{50, 50, 50, 50}; | |
| 1248 | - } | |
| 1249 | - }) | |
| 1250 | - .setText("当前无网络,请检查网络设置") | |
| 1251 | - .setNegative("继续使用", null) | |
| 1252 | - .setPositive("设置网络", new View.OnClickListener() { | |
| 1253 | - @Override | |
| 1254 | - public void onClick(View v) { | |
| 1255 | - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 1256 | - mContext.startActivity(intent); | |
| 1257 | - } | |
| 1258 | - }) | |
| 1259 | - .show(); | |
| 872 | + AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 1260 | 873 | } | 
| 1261 | 874 | }); | 
| 1262 | 875 | |
| ... | ... | @@ -1311,27 +924,7 @@ public class HttpManager { | 
| 1311 | 924 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 
| 1312 | 925 | closeProgress(); | 
| 1313 | 926 | Log.e("test", "错误信息" + new String(arg2)); | 
| 1314 | - new CircleDialog.Builder((FragmentActivity) mContext) | |
| 1315 | - .setCanceledOnTouchOutside(false) | |
| 1316 | - .setCancelable(false) | |
| 1317 | - .setWidth(0.5f) | |
| 1318 | - .configText(new ConfigText() { | |
| 1319 | - @Override | |
| 1320 | - public void onConfig(TextParams params) { | |
| 1321 | - params.gravity = Gravity.CENTER; | |
| 1322 | - params.padding = new int[]{50, 50, 50, 50}; | |
| 1323 | - } | |
| 1324 | - }) | |
| 1325 | - .setText("当前无网络,请检查网络设置") | |
| 1326 | - .setNegative("继续使用", null) | |
| 1327 | - .setPositive("设置网络", new View.OnClickListener() { | |
| 1328 | - @Override | |
| 1329 | - public void onClick(View v) { | |
| 1330 | - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 1331 | - mContext.startActivity(intent); | |
| 1332 | - } | |
| 1333 | - }) | |
| 1334 | - .show(); | |
| 927 | + AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 1335 | 928 | } | 
| 1336 | 929 | }); | 
| 1337 | 930 | |
| ... | ... | @@ -1376,27 +969,7 @@ public class HttpManager { | 
| 1376 | 969 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 
| 1377 | 970 | closeProgress(); | 
| 1378 | 971 | Log.e("test", "错误信息" + new String(arg2)); | 
| 1379 | - new CircleDialog.Builder((FragmentActivity) mContext) | |
| 1380 | - .setCanceledOnTouchOutside(false) | |
| 1381 | - .setCancelable(false) | |
| 1382 | - .setWidth(0.5f) | |
| 1383 | - .configText(new ConfigText() { | |
| 1384 | - @Override | |
| 1385 | - public void onConfig(TextParams params) { | |
| 1386 | - params.gravity = Gravity.CENTER; | |
| 1387 | - params.padding = new int[]{50, 50, 50, 50}; | |
| 1388 | - } | |
| 1389 | - }) | |
| 1390 | - .setText("当前无网络,请检查网络设置") | |
| 1391 | - .setNegative("继续使用", null) | |
| 1392 | - .setPositive("设置网络", new View.OnClickListener() { | |
| 1393 | - @Override | |
| 1394 | - public void onClick(View v) { | |
| 1395 | - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 1396 | - mContext.startActivity(intent); | |
| 1397 | - } | |
| 1398 | - }) | |
| 1399 | - .show(); | |
| 972 | + AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 1400 | 973 | } | 
| 1401 | 974 | }); | 
| 1402 | 975 | |
| ... | ... | @@ -1441,27 +1014,7 @@ public class HttpManager { | 
| 1441 | 1014 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 
| 1442 | 1015 | closeProgress(); | 
| 1443 | 1016 | Log.e("test", "错误信息" + new String(arg2)); | 
| 1444 | - new CircleDialog.Builder((FragmentActivity) mContext) | |
| 1445 | - .setCanceledOnTouchOutside(false) | |
| 1446 | - .setCancelable(false) | |
| 1447 | - .setWidth(0.5f) | |
| 1448 | - .configText(new ConfigText() { | |
| 1449 | - @Override | |
| 1450 | - public void onConfig(TextParams params) { | |
| 1451 | - params.gravity = Gravity.CENTER; | |
| 1452 | - params.padding = new int[]{50, 50, 50, 50}; | |
| 1453 | - } | |
| 1454 | - }) | |
| 1455 | - .setText("当前无网络,请检查网络设置") | |
| 1456 | - .setNegative("继续使用", null) | |
| 1457 | - .setPositive("设置网络", new View.OnClickListener() { | |
| 1458 | - @Override | |
| 1459 | - public void onClick(View v) { | |
| 1460 | - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 1461 | - mContext.startActivity(intent); | |
| 1462 | - } | |
| 1463 | - }) | |
| 1464 | - .show(); | |
| 1017 | + AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 1465 | 1018 | } | 
| 1466 | 1019 | }); | 
| 1467 | 1020 | |
| ... | ... | @@ -1512,27 +1065,7 @@ public class HttpManager { | 
| 1512 | 1065 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 
| 1513 | 1066 | closeProgress(); | 
| 1514 | 1067 | Log.e("test", "错误信息" + new String(bytes)); | 
| 1515 | - new CircleDialog.Builder((FragmentActivity) mContext) | |
| 1516 | - .setCanceledOnTouchOutside(false) | |
| 1517 | - .setCancelable(false) | |
| 1518 | - .setWidth(0.5f) | |
| 1519 | - .configText(new ConfigText() { | |
| 1520 | - @Override | |
| 1521 | - public void onConfig(TextParams params) { | |
| 1522 | - params.gravity = Gravity.CENTER; | |
| 1523 | - params.padding = new int[]{50, 50, 50, 50}; | |
| 1524 | - } | |
| 1525 | - }) | |
| 1526 | - .setText("当前无网络,请检查网络设置") | |
| 1527 | - .setNegative("继续使用", null) | |
| 1528 | - .setPositive("设置网络", new View.OnClickListener() { | |
| 1529 | - @Override | |
| 1530 | - public void onClick(View v) { | |
| 1531 | - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 1532 | - mContext.startActivity(intent); | |
| 1533 | - } | |
| 1534 | - }) | |
| 1535 | - .show(); | |
| 1068 | + AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 1536 | 1069 | |
| 1537 | 1070 | } | 
| 1538 | 1071 | }); | 
| ... | ... | @@ -1579,32 +1112,44 @@ public class HttpManager { | 
| 1579 | 1112 | public void onFailure(int i, Header[] headers, byte[] bytes, Throwable throwable) { | 
| 1580 | 1113 | closeProgress(); | 
| 1581 | 1114 | Log.e("test", "错误信息" + new String(bytes)); | 
| 1582 | - new CircleDialog.Builder((FragmentActivity) mContext) | |
| 1583 | - .setCanceledOnTouchOutside(false) | |
| 1584 | - .setCancelable(false) | |
| 1585 | - .setWidth(0.5f) | |
| 1586 | - .configText(new ConfigText() { | |
| 1587 | - @Override | |
| 1588 | - public void onConfig(TextParams params) { | |
| 1589 | - params.gravity = Gravity.CENTER; | |
| 1590 | - params.padding = new int[]{50, 50, 50, 50}; | |
| 1591 | - } | |
| 1592 | - }) | |
| 1593 | - .setText("当前无网络,请检查网络设置") | |
| 1594 | - .setNegative("继续使用", null) | |
| 1595 | - .setPositive("设置网络", new View.OnClickListener() { | |
| 1596 | - @Override | |
| 1597 | - public void onClick(View v) { | |
| 1598 | - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 1599 | - mContext.startActivity(intent); | |
| 1600 | - } | |
| 1601 | - }) | |
| 1602 | - .show(); | |
| 1115 | + AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 1603 | 1116 | |
| 1604 | 1117 | } | 
| 1605 | 1118 | }); | 
| 1606 | 1119 | } | 
| 1607 | 1120 | |
| 1121 | + /** | |
| 1122 | + * 检查注册信息是否完整 | |
| 1123 | + * @param mContext | |
| 1124 | + * @param userId | |
| 1125 | + */ | |
| 1126 | + public void registerinfocheck(final Context mContext, long userId, final Handler handler) { | |
| 1127 | + mProgress = DialogPermission.showProgress(mContext, null, "正在检查注册信息是否完整...", | |
| 1128 | + false, true, null); | |
| 1129 | + HttpClient.getInstance().setTimeout(5 * 1000); | |
| 1130 | + HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | |
| 1131 | + HttpClient.getInstance().get(HttpUrl.isRegisterInfoCompleteURL + "?userId=" + userId , new AsyncHttpResponseHandler() { | |
| 1132 | + @Override | |
| 1133 | + public void onSuccess(int arg0, Header[] arg1, byte[] arg2) { | |
| 1134 | + closeProgress(); | |
| 1135 | + Log.e("test", "注册信息" + new String(arg2)); | |
| 1136 | + Message msg = Message.obtain(); | |
| 1137 | + msg.what = HttpCode.REGISTER_SUCESS; | |
| 1138 | + msg.obj = new String(arg2); | |
| 1139 | + handler.sendMessage(msg); | |
| 1140 | + | |
| 1141 | + } | |
| 1142 | + | |
| 1143 | + @Override | |
| 1144 | + public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | |
| 1145 | + closeProgress(); | |
| 1146 | + Log.e("test", "错误信息" + new String(arg2)); | |
| 1147 | + AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 1148 | + | |
| 1149 | + } | |
| 1150 | + }); | |
| 1151 | + | |
| 1152 | + } | |
| 1608 | 1153 | |
| 1609 | 1154 | /** | 
| 1610 | 1155 | * 系统升级 | 
| ... | ... | @@ -1613,7 +1158,7 @@ public class HttpManager { | 
| 1613 | 1158 | * @param pid appName | 
| 1614 | 1159 | */ | 
| 1615 | 1160 | public void updateAPP(final Context mContext, String pid, String appName, final Handler handler) { | 
| 1616 | - mProgress = DialogPermission.showProgress(mContext, null, "正在切换子账户...", | |
| 1161 | + mProgress = DialogPermission.showProgress(mContext, null, "正在检测是否版本信息...", | |
| 1617 | 1162 | false, true, null); | 
| 1618 | 1163 | HttpClient.getInstance().setTimeout(5 * 1000); | 
| 1619 | 1164 | HttpClient.getInstance().addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); | 
| ... | ... | @@ -1635,27 +1180,6 @@ public class HttpManager { | 
| 1635 | 1180 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 
| 1636 | 1181 | closeProgress(); | 
| 1637 | 1182 | Log.e("test", "错误信息" + new String(arg2)); | 
| 1638 | - new CircleDialog.Builder((FragmentActivity) mContext) | |
| 1639 | - .setCanceledOnTouchOutside(false) | |
| 1640 | - .setCancelable(false) | |
| 1641 | - .setWidth(0.5f) | |
| 1642 | - .configText(new ConfigText() { | |
| 1643 | - @Override | |
| 1644 | - public void onConfig(TextParams params) { | |
| 1645 | - params.gravity = Gravity.CENTER; | |
| 1646 | - params.padding = new int[]{50, 50, 50, 50}; | |
| 1647 | - } | |
| 1648 | - }) | |
| 1649 | - .setText("当前无网络,请检查网络设置") | |
| 1650 | - .setNegative("继续使用", null) | |
| 1651 | - .setPositive("设置网络", new View.OnClickListener() { | |
| 1652 | - @Override | |
| 1653 | - public void onClick(View v) { | |
| 1654 | - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 1655 | - mContext.startActivity(intent); | |
| 1656 | - } | |
| 1657 | - }) | |
| 1658 | - .show(); | |
| 1659 | 1183 | } | 
| 1660 | 1184 | }); | 
| 1661 | 1185 | |
| ... | ... | @@ -1693,27 +1217,7 @@ public class HttpManager { | 
| 1693 | 1217 | |
| 1694 | 1218 | @Override | 
| 1695 | 1219 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 
| 1696 | - new CircleDialog.Builder((FragmentActivity) mContext) | |
| 1697 | - .setCanceledOnTouchOutside(false) | |
| 1698 | - .setCancelable(false) | |
| 1699 | - .setWidth(0.5f) | |
| 1700 | - .configText(new ConfigText() { | |
| 1701 | - @Override | |
| 1702 | - public void onConfig(TextParams params) { | |
| 1703 | - params.gravity = Gravity.CENTER; | |
| 1704 | - params.padding = new int[]{50, 50, 50, 50}; | |
| 1705 | - } | |
| 1706 | - }) | |
| 1707 | - .setText("当前无网络,请检查网络设置") | |
| 1708 | - .setNegative("继续使用", null) | |
| 1709 | - .setPositive("设置网络", new View.OnClickListener() { | |
| 1710 | - @Override | |
| 1711 | - public void onClick(View v) { | |
| 1712 | - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 1713 | - mContext.startActivity(intent); | |
| 1714 | - } | |
| 1715 | - }) | |
| 1716 | - .show(); | |
| 1220 | + AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 1717 | 1221 | } | 
| 1718 | 1222 | }); | 
| 1719 | 1223 | } | 
| ... | ... | @@ -1752,27 +1256,7 @@ public class HttpManager { | 
| 1752 | 1256 | |
| 1753 | 1257 | @Override | 
| 1754 | 1258 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 
| 1755 | - new CircleDialog.Builder((FragmentActivity) mContext) | |
| 1756 | - .setCanceledOnTouchOutside(false) | |
| 1757 | - .setCancelable(false) | |
| 1758 | - .setWidth(0.5f) | |
| 1759 | - .configText(new ConfigText() { | |
| 1760 | - @Override | |
| 1761 | - public void onConfig(TextParams params) { | |
| 1762 | - params.gravity = Gravity.CENTER; | |
| 1763 | - params.padding = new int[]{50, 50, 50, 50}; | |
| 1764 | - } | |
| 1765 | - }) | |
| 1766 | - .setText("当前无网络,请检查网络设置") | |
| 1767 | - .setNegative("继续使用", null) | |
| 1768 | - .setPositive("设置网络", new View.OnClickListener() { | |
| 1769 | - @Override | |
| 1770 | - public void onClick(View v) { | |
| 1771 | - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 1772 | - mContext.startActivity(intent); | |
| 1773 | - } | |
| 1774 | - }) | |
| 1775 | - .show(); | |
| 1259 | + AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 1776 | 1260 | } | 
| 1777 | 1261 | }); | 
| 1778 | 1262 | } | 
| ... | ... | @@ -1809,27 +1293,7 @@ public class HttpManager { | 
| 1809 | 1293 | |
| 1810 | 1294 | @Override | 
| 1811 | 1295 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 
| 1812 | - new CircleDialog.Builder((FragmentActivity) mContext) | |
| 1813 | - .setCanceledOnTouchOutside(false) | |
| 1814 | - .setCancelable(false) | |
| 1815 | - .setWidth(0.5f) | |
| 1816 | - .configText(new ConfigText() { | |
| 1817 | - @Override | |
| 1818 | - public void onConfig(TextParams params) { | |
| 1819 | - params.gravity = Gravity.CENTER; | |
| 1820 | - params.padding = new int[]{50, 50, 50, 50}; | |
| 1821 | - } | |
| 1822 | - }) | |
| 1823 | - .setText("当前无网络,请检查网络设置") | |
| 1824 | - .setNegative("继续使用", null) | |
| 1825 | - .setPositive("设置网络", new View.OnClickListener() { | |
| 1826 | - @Override | |
| 1827 | - public void onClick(View v) { | |
| 1828 | - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 1829 | - mContext.startActivity(intent); | |
| 1830 | - } | |
| 1831 | - }) | |
| 1832 | - .show(); | |
| 1296 | + AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 1833 | 1297 | } | 
| 1834 | 1298 | }); | 
| 1835 | 1299 | } | 
| ... | ... | @@ -1865,27 +1329,7 @@ public class HttpManager { | 
| 1865 | 1329 | |
| 1866 | 1330 | @Override | 
| 1867 | 1331 | public void onFailure(int arg0, Header[] arg1, byte[] arg2, Throwable arg3) { | 
| 1868 | - new CircleDialog.Builder((FragmentActivity) mContext) | |
| 1869 | - .setCanceledOnTouchOutside(false) | |
| 1870 | - .setCancelable(false) | |
| 1871 | - .setWidth(0.5f) | |
| 1872 | - .configText(new ConfigText() { | |
| 1873 | - @Override | |
| 1874 | - public void onConfig(TextParams params) { | |
| 1875 | - params.gravity = Gravity.CENTER; | |
| 1876 | - params.padding = new int[]{50, 50, 50, 50}; | |
| 1877 | - } | |
| 1878 | - }) | |
| 1879 | - .setText("当前无网络,请检查网络设置") | |
| 1880 | - .setNegative("继续使用", null) | |
| 1881 | - .setPositive("设置网络", new View.OnClickListener() { | |
| 1882 | - @Override | |
| 1883 | - public void onClick(View v) { | |
| 1884 | - Intent intent = new Intent(Settings.ACTION_SETTINGS);//系统设置界面 | |
| 1885 | - mContext.startActivity(intent); | |
| 1886 | - } | |
| 1887 | - }) | |
| 1888 | - .show(); | |
| 1332 | + AlertUtils.showToast(mContext, "无法链接到服务器,请检查您的网络或稍后重试!"); | |
| 1889 | 1333 | } | 
| 1890 | 1334 | }); | 
| 1891 | 1335 | } | ... | ... | 
PersonalCenter/app/src/main/java/com/hjx/personalcenter/http/HttpUrl.java
| ... | ... | @@ -39,6 +39,7 @@ public class HttpUrl { | 
| 39 | 39 | public static String headerURL=GetDomain()+"/profile/picture/update";//头像上传 | 
| 40 | 40 | public static String headerdefaultURL=GetDomain()+"/profile/picture/default";//默认头像上传 | 
| 41 | 41 | public static String getversionURL=GetDomain()+"/press/list";//获取版本信息 | 
| 42 | + public static String isRegisterInfoCompleteURL=GetDomain()+"/register/extrainfo/check";//注册信息是否完整 | |
| 42 | 43 | |
| 43 | 44 | |
| 44 | 45 | ... | ... | 
PersonalCenter/app/src/main/java/com/hjx/personalcenter/model/DefautPublishInfo.java
| ... | ... | @@ -0,0 +1,38 @@ | 
| 1 | +package com.hjx.personalcenter.model; | |
| 2 | + | |
| 3 | +import java.io.Serializable; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * Created by h on 2017/9/12. | |
| 7 | + */ | |
| 8 | + | |
| 9 | +public class DefautPublishInfo implements Serializable{ | |
| 10 | + private String imagurl; | |
| 11 | + | |
| 12 | + public String getImagurl() { | |
| 13 | + return imagurl; | |
| 14 | + } | |
| 15 | + | |
| 16 | + public void setImagurl(String imagurl) { | |
| 17 | + this.imagurl = imagurl; | |
| 18 | + } | |
| 19 | + | |
| 20 | + public String getSubjuct() { | |
| 21 | + return subjuct; | |
| 22 | + } | |
| 23 | + | |
| 24 | + public void setSubjuct(String subjuct) { | |
| 25 | + this.subjuct = subjuct; | |
| 26 | + } | |
| 27 | + | |
| 28 | + public String getPublish() { | |
| 29 | + return publish; | |
| 30 | + } | |
| 31 | + | |
| 32 | + public void setPublish(String publish) { | |
| 33 | + this.publish = publish; | |
| 34 | + } | |
| 35 | + | |
| 36 | + private String subjuct; | |
| 37 | + private String publish; | |
| 38 | +} | ... | ... | 
PersonalCenter/app/src/main/java/com/hjx/personalcenter/model/LoginInfo.java
| ... | ... | @@ -0,0 +1,56 @@ | 
| 1 | +package com.hjx.personalcenter.model; | |
| 2 | + | |
| 3 | +import java.io.Serializable; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * Created by h on 2017/9/12. | |
| 7 | + */ | |
| 8 | + | |
| 9 | +public class LoginInfo implements Serializable { | |
| 10 | + private String username; | |
| 11 | + private String password; | |
| 12 | + | |
| 13 | + public String getUsername() { | |
| 14 | + return username; | |
| 15 | + } | |
| 16 | + | |
| 17 | + public void setUsername(String username) { | |
| 18 | + this.username = username; | |
| 19 | + } | |
| 20 | + | |
| 21 | + public String getPassword() { | |
| 22 | + return password; | |
| 23 | + } | |
| 24 | + | |
| 25 | + public void setPassword(String password) { | |
| 26 | + this.password = password; | |
| 27 | + } | |
| 28 | + | |
| 29 | + public String getAccess_token() { | |
| 30 | + return access_token; | |
| 31 | + } | |
| 32 | + | |
| 33 | + public void setAccess_token(String access_token) { | |
| 34 | + this.access_token = access_token; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public String getLoginStatus() { | |
| 38 | + return loginStatus; | |
| 39 | + } | |
| 40 | + | |
| 41 | + public void setLoginStatus(String loginStatus) { | |
| 42 | + this.loginStatus = loginStatus; | |
| 43 | + } | |
| 44 | + | |
| 45 | + public String getUserId() { | |
| 46 | + return userId; | |
| 47 | + } | |
| 48 | + | |
| 49 | + public void setUserId(String userId) { | |
| 50 | + this.userId = userId; | |
| 51 | + } | |
| 52 | + | |
| 53 | + private String access_token; | |
| 54 | + private String loginStatus; | |
| 55 | + private String userId; | |
| 56 | +} | ... | ... | 
PersonalCenter/app/src/main/java/com/hjx/personalcenter/service/CenterService.java
| ... | ... | @@ -3,12 +3,23 @@ package com.hjx.personalcenter.service; | 
| 3 | 3 | import android.content.Intent; | 
| 4 | 4 | import android.os.IBinder; | 
| 5 | 5 | import android.os.RemoteException; | 
| 6 | +import android.util.Log; | |
| 7 | + | |
| 8 | +import com.google.gson.Gson; | |
| 9 | +import com.hjx.personalcenter.activity.LoginAndRegisterActivity; | |
| 10 | +import com.hjx.personalcenter.db.SaveParam; | |
| 11 | +import com.hjx.personalcenter.model.CardInfo; | |
| 12 | +import com.hjx.personalcenter.model.LoginInfo; | |
| 13 | +import com.hjx.personalcenter.util.GetDevicesUtil; | |
| 6 | 14 | |
| 7 | 15 | /** | 
| 8 | 16 | * Created by h on 2017/9/1. | 
| 9 | 17 | */ | 
| 10 | 18 | |
| 11 | 19 | public class CenterService extends BaseService { | 
| 20 | + enum ACTIVITY_ACTION{ | |
| 21 | + userinfo_activity | |
| 22 | + } | |
| 12 | 23 | public CenterService(){ | 
| 13 | 24 | |
| 14 | 25 | } | 
| ... | ... | @@ -20,16 +31,87 @@ public class CenterService extends BaseService { | 
| 20 | 31 | |
| 21 | 32 | @Override | 
| 22 | 33 | public String viewPage(String action) throws RemoteException { | 
| 23 | - return null; | |
| 34 | + String result = null; | |
| 35 | + if(action.equals(ACTIVITY_ACTION.userinfo_activity.toString())){ | |
| 36 | + //登录界面 | |
| 37 | + Intent intent = new Intent(); | |
| 38 | + intent.setClass(CenterService.this, LoginAndRegisterActivity.class); | |
| 39 | + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |
| 40 | + startActivity(intent); | |
| 41 | + result= "跳转成功"; | |
| 42 | + } | |
| 43 | + | |
| 44 | + return result; | |
| 24 | 45 | } | 
| 25 | 46 | |
| 26 | 47 | @Override | 
| 27 | 48 | public String getSimpleUser() throws RemoteException { | 
| 49 | + String logininfo = null; | |
| 50 | + Gson gson = new Gson(); | |
| 51 | + LoginInfo loginInfo = new LoginInfo(); | |
| 52 | + String islogin = SaveParam.getInstance().getLoginParam(getApplication(),"login"); | |
| 53 | + if ("true".equals(islogin)){ | |
| 54 | + loginInfo.setUsername(SaveParam.getInstance().getLoginParam(getApplication(), "username")); | |
| 55 | + loginInfo.setPassword(SaveParam.getInstance().getLoginParam(getApplication(), "password")); | |
| 56 | + loginInfo.setAccess_token(SaveParam.getInstance().getLoginParam(getApplication(), "access_token")); | |
| 57 | + loginInfo.setLoginStatus(SaveParam.getInstance().getLoginParam(getApplication(), "login")); | |
| 58 | + loginInfo.setUserId(SaveParam.getInstance().getLoginParam(getApplication(), "userId")); | |
| 59 | + | |
| 60 | + logininfo =gson.toJson(loginInfo); | |
| 61 | + | |
| 62 | + Log.e("test","登录信息"+logininfo); | |
| 63 | + | |
| 64 | + } | |
| 65 | + | |
| 66 | + return logininfo; | |
| 67 | + } | |
| 68 | + //保卡信息 | |
| 69 | + @Override | |
| 70 | + public String getcardUser() throws RemoteException { | |
| 71 | + String results = null; | |
| 72 | + CardInfo cardInfo = new CardInfo(); | |
| 73 | + CardInfo.DataBean dataBean = new CardInfo.DataBean(); | |
| 74 | + Gson gson = new Gson(); | |
| 75 | + | |
| 76 | + //获取设备信息 | |
| 77 | + dataBean.setProductModel(GetDevicesUtil.getDevicesInfo(getApplication()).getDeviceModel()); | |
| 78 | + dataBean.setDeviceNumber(GetDevicesUtil.getDevicesInfo(getApplication()).getDeviceNumber()); | |
| 79 | + dataBean.setMacAddress(GetDevicesUtil.getDevicesInfo(getApplication()).getMac()); | |
| 80 | + //获取保卡信息 | |
| 81 | + dataBean.setCustomerName(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.CUNSTEMNAME)); | |
| 82 | + dataBean.setCustomerAddress(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.ADRESSCUNSTEM)); | |
| 83 | + dataBean.setBuyTime(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.SHOPTIME)); | |
| 84 | + dataBean.setBuyAddress(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.SHOPADRESS)); | |
| 85 | + dataBean.setAlterSaleCall(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.SHOPTLEPHONE)); | |
| 86 | + dataBean.setMobilePhone(SaveParam.getInstance().getCustomizeParam(getApplication(),SaveParam.CARDPHONE)); | |
| 87 | + cardInfo.setData(dataBean); | |
| 88 | + results =gson.toJson(cardInfo); | |
| 89 | + | |
| 90 | + return results; | |
| 91 | + } | |
| 92 | + | |
| 93 | + @Override | |
| 94 | + public String getUserInfo() throws RemoteException { | |
| 28 | 95 | return null; | 
| 29 | 96 | } | 
| 30 | 97 | |
| 31 | 98 | @Override | 
| 32 | - public String getcardUser() throws RemoteException { | |
| 99 | + public String logout() throws RemoteException { | |
| 100 | + return null; | |
| 101 | + } | |
| 102 | + | |
| 103 | + @Override | |
| 104 | + public String validateToken() throws RemoteException { | |
| 105 | + return null; | |
| 106 | + } | |
| 107 | + | |
| 108 | + @Override | |
| 109 | + public String getDeviceID() throws RemoteException { | |
| 110 | + return null; | |
| 111 | + } | |
| 112 | + | |
| 113 | + @Override | |
| 114 | + public String getChildsInfo() throws RemoteException { | |
| 33 | 115 | return null; | 
| 34 | 116 | } | 
| 35 | 117 | }; | ... | ... | 
PersonalCenter/app/src/main/java/com/hjx/personalcenter/util/NetUtils.java
| ... | ... | @@ -0,0 +1,68 @@ | 
| 1 | +package com.hjx.personalcenter.util; | |
| 2 | + | |
| 3 | +import android.content.Context; | |
| 4 | +import android.net.ConnectivityManager; | |
| 5 | +import android.net.NetworkInfo; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * Created by h on 2017/9/13. | |
| 9 | + */ | |
| 10 | + | |
| 11 | +public class NetUtils { | |
| 12 | + // 判断网络连接状态 | |
| 13 | + public static boolean isNetworkConnected(Context context) { | |
| 14 | + if (context != null) { | |
| 15 | + ConnectivityManager mConnectivityManager = (ConnectivityManager) context | |
| 16 | + .getSystemService(Context.CONNECTIVITY_SERVICE); | |
| 17 | + NetworkInfo mNetworkInfo = mConnectivityManager | |
| 18 | + .getActiveNetworkInfo(); | |
| 19 | + if (mNetworkInfo != null) { | |
| 20 | + return mNetworkInfo.isAvailable(); | |
| 21 | + } | |
| 22 | + } | |
| 23 | + return false; | |
| 24 | + } | |
| 25 | + | |
| 26 | + // 判断wifi状态 | |
| 27 | + public static boolean isWifiConnected(Context context) { | |
| 28 | + if (context != null) { | |
| 29 | + ConnectivityManager mConnectivityManager = (ConnectivityManager) context | |
| 30 | + .getSystemService(Context.CONNECTIVITY_SERVICE); | |
| 31 | + NetworkInfo mWiFiNetworkInfo = mConnectivityManager | |
| 32 | + .getNetworkInfo(ConnectivityManager.TYPE_WIFI); | |
| 33 | + if (mWiFiNetworkInfo != null) { | |
| 34 | + return mWiFiNetworkInfo.isAvailable(); | |
| 35 | + } | |
| 36 | + } | |
| 37 | + return false; | |
| 38 | + } | |
| 39 | + | |
| 40 | + // 判断移动网络 | |
| 41 | + public static boolean isMobileConnected(Context context) { | |
| 42 | + if (context != null) { | |
| 43 | + ConnectivityManager mConnectivityManager = (ConnectivityManager) context | |
| 44 | + .getSystemService(Context.CONNECTIVITY_SERVICE); | |
| 45 | + NetworkInfo mMobileNetworkInfo = mConnectivityManager | |
| 46 | + .getNetworkInfo(ConnectivityManager.TYPE_MOBILE); | |
| 47 | + if (mMobileNetworkInfo != null) { | |
| 48 | + return mMobileNetworkInfo.isAvailable(); | |
| 49 | + } | |
| 50 | + } | |
| 51 | + return false; | |
| 52 | + } | |
| 53 | + | |
| 54 | + // 获取连接类型 | |
| 55 | + public static int getConnectedType(Context context) { | |
| 56 | + if (context != null) { | |
| 57 | + ConnectivityManager mConnectivityManager = (ConnectivityManager) context | |
| 58 | + .getSystemService(Context.CONNECTIVITY_SERVICE); | |
| 59 | + NetworkInfo mNetworkInfo = mConnectivityManager | |
| 60 | + .getActiveNetworkInfo(); | |
| 61 | + if (mNetworkInfo != null && mNetworkInfo.isAvailable()) { | |
| 62 | + return mNetworkInfo.getType(); | |
| 63 | + } | |
| 64 | + } | |
| 65 | + return -1; | |
| 66 | + } | |
| 67 | + | |
| 68 | +} | ... | ... | 
PersonalCenter/app/src/main/res/layout/activity_main.xml
| ... | ... | @@ -134,6 +134,7 @@ | 
| 134 | 134 | android:id="@+id/iv_sex" | 
| 135 | 135 | android:layout_width="wrap_content" | 
| 136 | 136 | android:layout_height="wrap_content" | 
| 137 | + android:layout_gravity="center_vertical" | |
| 137 | 138 | android:layout_marginLeft="50dp" | 
| 138 | 139 | android:src="@mipmap/men" /> | 
| 139 | 140 | |
| ... | ... | @@ -383,7 +384,7 @@ | 
| 383 | 384 | android:layout_width="0dp" | 
| 384 | 385 | android:layout_height="wrap_content" | 
| 385 | 386 | android:layout_marginLeft="5dp" | 
| 386 | - android:layout_weight="2" | |
| 387 | + android:layout_weight="5" | |
| 387 | 388 | android:text="个人信息" | 
| 388 | 389 | android:textSize="22sp" /> | 
| 389 | 390 | |
| ... | ... | @@ -393,7 +394,7 @@ | 
| 393 | 394 | android:layout_width="0dp" | 
| 394 | 395 | android:layout_height="wrap_content" | 
| 395 | 396 | android:layout_marginLeft="10dp" | 
| 396 | - android:layout_weight="0.2" | |
| 397 | + android:layout_weight="0.4" | |
| 397 | 398 | android:text="编辑" | 
| 398 | 399 | android:textSize="18sp" /> | 
| 399 | 400 | |
| ... | ... | @@ -538,7 +539,7 @@ | 
| 538 | 539 | android:layout_width="0dp" | 
| 539 | 540 | android:layout_height="wrap_content" | 
| 540 | 541 | android:layout_weight="1" | 
| 541 | - android:text="Q Q" | |
| 542 | + android:text=" Q Q" | |
| 542 | 543 | android:textSize="20sp" /> | 
| 543 | 544 | |
| 544 | 545 | <TextView | ... | ... | 
PersonalCenter/app/src/main/res/layout/fragment_changge_version_info_itmes.xml
| 1 | 1 | <?xml version="1.0" encoding="utf-8"?> | 
| 2 | 2 | <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | 
| 3 | + xmlns:fresco="http://schemas.android.com/apk/res-auto" | |
| 3 | 4 | android:orientation="vertical" | 
| 4 | 5 | android:layout_width="match_parent" | 
| 5 | 6 | android:layout_height="match_parent" | 
| 6 | 7 | android:gravity="center"> | 
| 7 | 8 | |
| 8 | 9 | |
| 9 | - <ImageView | |
| 10 | - android:src="@mipmap/ic_launcher" | |
| 11 | - android:id="@+id/image" | |
| 10 | + <com.facebook.drawee.view.SimpleDraweeView | |
| 11 | + android:id="@+id/image_publish" | |
| 12 | 12 | android:layout_width="100dp" | 
| 13 | - android:background="@drawable/corcle_black_bg" | |
| 14 | 13 | android:layout_height="150dp" | 
| 14 | + android:layout_gravity="center" | |
| 15 | + android:background="@drawable/corcle_black_bg" | |
| 16 | + fresco:placeholderImage="@mipmap/header_default" | |
| 17 | + fresco:roundAsCircle="true" | |
| 18 | + fresco:placeholderImageScaleType="fitCenter" /> | |
| 15 | 19 | |
| 16 | - /> | |
| 17 | 20 | <TextView | 
| 18 | - android:id="@+id/text" | |
| 21 | + android:id="@+id/subject" | |
| 19 | 22 | android:layout_marginTop="5dp" | 
| 20 | 23 | android:textSize="22sp" | 
| 21 | 24 | android:layout_width="wrap_content" | 
| ... | ... | @@ -30,7 +33,7 @@ | 
| 30 | 33 | android:layout_width="wrap_content" | 
| 31 | 34 | android:layout_height="wrap_content" | 
| 32 | 35 | android:textColor="@color/login_text_black" | 
| 33 | - android:text="人民教育出版社" | |
| 36 | + android:text="" | |
| 34 | 37 | /> | 
| 35 | 38 | |
| 36 | 39 | </LinearLayout> | 
| 37 | 40 | \ No newline at end of file | ... | ... | 
PersonalCenter/app/src/main/res/values/styles.xml
| ... | ... | @@ -49,6 +49,7 @@ | 
| 49 | 49 | <item name="android:layout_height">wrap_content</item> | 
| 50 | 50 | <item name="android:background">@drawable/selector_blue_btn_bg</item> | 
| 51 | 51 | <item name="android:textSize">23sp</item> | 
| 52 | + | |
| 52 | 53 | <item name="android:gravity">center</item> | 
| 53 | 54 | <item name="android:padding">10dp</item> | 
| 54 | 55 | <item name="android:textColor">@android:color/white</item> | ... | ... | 
PersonalCenter/circledialog/src/main/java/com/mylhyl/circledialog/CircleDialog.java
PersonalCenter/mypresonallibrary/build.gradle
| ... | ... | @@ -22,7 +22,7 @@ android { | 
| 22 | 22 | } | 
| 23 | 23 | |
| 24 | 24 | dependencies { | 
| 25 | - compile fileTree(dir: 'libs', include: ['*.jar']) | |
| 25 | + compile fileTree(include: ['*.jar'], dir: 'libs') | |
| 26 | 26 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { | 
| 27 | 27 | exclude group: 'com.android.support', module: 'support-annotations' | 
| 28 | 28 | }) | ... | ... | 
PersonalCenter/mypresonallibrary/src/main/aidl/com/hjx/personalcenter/service/IPresonalInterface.aidl
| ... | ... | @@ -12,4 +12,11 @@ interface IPresonalInterface { | 
| 12 | 12 | String getSimpleUser(); | 
| 13 | 13 | //得到用户保卡信息 | 
| 14 | 14 | String getcardUser(); | 
| 15 | + //得到用户个人信息 | |
| 16 | + String getUserInfo(); | |
| 17 | + String logout();//注销 | |
| 18 | + String validateToken();//验证Token | |
| 19 | + String getDeviceID(); | |
| 20 | + //子账户信息 | |
| 21 | + String getChildsInfo(); | |
| 15 | 22 | } | ... | ... | 
PersonalCenter/mypresonallibrary/src/main/java/com/hjx/mypresonallibrary/ActionConfig.java
| ... | ... | @@ -0,0 +1,17 @@ | 
| 1 | +/** | |
| 2 | + * HaoJiXing Teacher Q&A | |
| 3 | + * copyright(C)2013- Acorn International | |
| 4 | + * | |
| 5 | + * packeage:com.ozing.center.util.ActionConfig.java | |
| 6 | + * create:2013年10月29日下午3:32:01 | |
| 7 | + */ | |
| 8 | +package com.hjx.mypresonallibrary; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * @author jixiaolong<jixiaolong@chinadrtv.com> | |
| 12 | + * @code: 015261 | |
| 13 | + */ | |
| 14 | +public class ActionConfig { | |
| 15 | + public static final String SERVICE_ACTION = "com.hjx.mypresonallibrary.ICenterService"; | |
| 16 | + public static final String PACKAGENAEM = "com.hjx.personalcenter"; | |
| 17 | +} | ... | ... | 
PersonalCenter/mypresonallibrary/src/main/java/com/hjx/mypresonallibrary/PresonalCallBack.java
PersonalCenter/mypresonallibrary/src/main/java/com/hjx/mypresonallibrary/PresonalHelper.java
| ... | ... | @@ -0,0 +1,137 @@ | 
| 1 | +package com.hjx.mypresonallibrary; | |
| 2 | + | |
| 3 | +import android.app.Service; | |
| 4 | +import android.content.ComponentName; | |
| 5 | +import android.content.Context; | |
| 6 | +import android.content.DialogInterface; | |
| 7 | +import android.content.Intent; | |
| 8 | +import android.content.ServiceConnection; | |
| 9 | +import android.os.IBinder; | |
| 10 | +import android.os.RemoteException; | |
| 11 | + | |
| 12 | +import com.hjx.personalcenter.service.IPresonalInterface; | |
| 13 | + | |
| 14 | +import java.util.concurrent.locks.ReentrantLock; | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * Created by h on 2017/9/13. | |
| 18 | + */ | |
| 19 | + | |
| 20 | +public class PresonalHelper implements DialogInterface.OnDismissListener{ | |
| 21 | + private IPresonalInterface center; | |
| 22 | + private int STATUS_IDLE = 0; | |
| 23 | + private int STATUS_PENDDING = 1; | |
| 24 | + private int STATUS_FINISH = 2; | |
| 25 | + private int status = STATUS_IDLE; | |
| 26 | + private byte[] mx = new byte[0]; | |
| 27 | + private ReentrantLock lock = new ReentrantLock(); | |
| 28 | + private boolean isRun = false; | |
| 29 | + private boolean isShow = false; | |
| 30 | + | |
| 31 | + public PresonalHelper() { | |
| 32 | + isRun = true; | |
| 33 | + } | |
| 34 | + private ServiceConnection serviceConnection = new ServiceConnection() { | |
| 35 | + | |
| 36 | + @Override | |
| 37 | + public void onServiceDisconnected(ComponentName name) { | |
| 38 | + center = null; | |
| 39 | + } | |
| 40 | + | |
| 41 | + @Override | |
| 42 | + public void onServiceConnected(ComponentName name, IBinder service) { | |
| 43 | + center = IPresonalInterface.Stub.asInterface(service); | |
| 44 | + synchronized (mx) { | |
| 45 | + status = STATUS_FINISH; | |
| 46 | + mx.notifyAll(); | |
| 47 | + } | |
| 48 | + } | |
| 49 | + }; | |
| 50 | + private void bind(Context context){ | |
| 51 | + status = STATUS_PENDDING; | |
| 52 | + Intent intent = new Intent(ActionConfig.SERVICE_ACTION); | |
| 53 | + intent.setPackage(ActionConfig.PACKAGENAEM); | |
| 54 | + context.getApplicationContext().bindService(intent, serviceConnection, Service.BIND_AUTO_CREATE); | |
| 55 | + } | |
| 56 | + | |
| 57 | + | |
| 58 | + @Override | |
| 59 | + public void onDismiss(DialogInterface dialog) { | |
| 60 | + isShow = false; | |
| 61 | + | |
| 62 | + } | |
| 63 | + private void checkBind(Context context){ | |
| 64 | + if(!isRun)return; | |
| 65 | + if(status == STATUS_IDLE || (center == null && status!= STATUS_PENDDING)){ | |
| 66 | + bind(context); | |
| 67 | + } | |
| 68 | + | |
| 69 | + if(status == STATUS_PENDDING || status == STATUS_IDLE){ | |
| 70 | + try { | |
| 71 | + synchronized (mx) { | |
| 72 | + if (center == null) | |
| 73 | + mx.wait(); | |
| 74 | + } | |
| 75 | + } catch (InterruptedException e) { | |
| 76 | + e.printStackTrace(); | |
| 77 | + } | |
| 78 | + } | |
| 79 | + } | |
| 80 | + private String buildNotInstallResult(){ | |
| 81 | + return "{\"resultCode\":301,\"message\":\"center not install.\"}"; | |
| 82 | + } | |
| 83 | + private String buildNotRun(){ | |
| 84 | + return "{\"resultCode\":302,\"message\":\"center is destoryed\"}"; | |
| 85 | + } | |
| 86 | + private String buildRemoteError(){ | |
| 87 | + return "{\"resultCode\":303,\"message\":\"remote service call failed\"}"; | |
| 88 | + } | |
| 89 | + public void getSimpleUser(final Context context, final PresonalCallBack callBack){ | |
| 90 | + if(callBack == null){ | |
| 91 | + throw new IllegalArgumentException("call back can not null"); | |
| 92 | + } | |
| 93 | + new Thread(new Runnable() { | |
| 94 | + | |
| 95 | + @Override | |
| 96 | + public void run() { | |
| 97 | + String result = null; | |
| 98 | + try { | |
| 99 | + checkBind(context); | |
| 100 | + if(!isRun){ | |
| 101 | + result = buildNotRun(); | |
| 102 | + }else{ | |
| 103 | + result = center.getSimpleUser(); | |
| 104 | + } | |
| 105 | + } catch (RemoteException e) { | |
| 106 | + e.printStackTrace(); | |
| 107 | + result = buildRemoteError(); | |
| 108 | + } | |
| 109 | + callBack.result(result); | |
| 110 | + } | |
| 111 | + }).start(); | |
| 112 | + } | |
| 113 | + public void getcardUser(final Context context, final PresonalCallBack callBack){ | |
| 114 | + if(callBack == null){ | |
| 115 | + throw new IllegalArgumentException("call back can not null"); | |
| 116 | + } | |
| 117 | + new Thread(new Runnable() { | |
| 118 | + | |
| 119 | + @Override | |
| 120 | + public void run() { | |
| 121 | + String result = null; | |
| 122 | + try { | |
| 123 | + checkBind(context); | |
| 124 | + if(!isRun){ | |
| 125 | + result = buildNotRun(); | |
| 126 | + }else{ | |
| 127 | + result = center.getcardUser(); | |
| 128 | + } | |
| 129 | + } catch (RemoteException e) { | |
| 130 | + e.printStackTrace(); | |
| 131 | + result = buildRemoteError(); | |
| 132 | + } | |
| 133 | + callBack.result(result); | |
| 134 | + } | |
| 135 | + }).start(); | |
| 136 | + } | |
| 137 | +} | ... | ... |