<repo_name>NikemoXss/AsScg<file_sep>/app/build.gradle
apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "com.ys.www.asscg"
        minSdkVersion 16
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets {
        main {
            jniLibs.srcDir 'src/main/jniLibs'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.squareup.okhttp3:okhttp:3.8.1'
    compile 'com.android.support:design:26.+'
    testCompile 'junit:junit:4.12'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
    compile 'com.google.code.gson:gson:2.8.1'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'
    compile files('libs/baidumapapi_base_v4_3_1.jar')
    compile files('libs/baidumapapi_cloud_v4_3_1.jar')
    compile files('libs/baidumapapi_map_v4_3_1.jar')
    compile files('libs/baidumapapi_radar_v4_3_1.jar')
    compile files('libs/baidumapapi_search_v4_3_1.jar')
    compile files('libs/baidumapapi_util_v4_3_1.jar')
    compile files('libs/locSDK_6.13.jar')
    compile files('libs/MobCommons-2017.0608.1618.jar')
    compile files('libs/MobTools-2017.0608.1618.jar')
    compile files('libs/ShareSDK-Core-3.0.0.jar')
    compile files('libs/ShareSDK-QQ-3.0.0.jar')
    compile files('libs/ShareSDK-QZone-3.0.0.jar')
    compile files('libs/ShareSDK-Wechat-3.0.0.jar')
    compile files('libs/ShareSDK-Wechat-Core-3.0.0.jar')
    compile files('libs/ShareSDK-Wechat-Favorite-3.0.0.jar')
    compile files('libs/ShareSDK-Wechat-Moments-3.0.0.jar')
}
<file_sep>/app/src/main/java/com/ys/www/asscg/fragment/SetFragment_Scg.java
package com.ys.www.asscg.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;

import com.ys.www.asscg.R;
import com.ys.www.asscg.activity.AboutUsActivity;
import com.ys.www.asscg.activity.ContactUsActivity;
import com.ys.www.asscg.activity.FeedbackActivity;
import com.ys.www.asscg.activity.LoginActivity;
import com.ys.www.asscg.api.SystenmApi;
import com.ys.www.asscg.base.BaseFragment;
import com.ys.www.asscg.http.HttpClient;
import com.ys.www.asscg.util.Default;

import org.json.JSONException;
import org.json.JSONObject;

//苏常设置
public class SetFragment_Scg extends BaseFragment implements OnClickListener {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View mainView = inflater.inflate(R.layout.layout_set, null);
        mainView.findViewById(R.id.item_feedback).setOnClickListener(this);
        mainView.findViewById(R.id.item_check_update).setOnClickListener(this);
        mainView.findViewById(R.id.item_shareapp).setOnClickListener(this);
        mainView.findViewById(R.id.item_contactus).setOnClickListener(this);
        mainView.findViewById(R.id.item_aboutus).setOnClickListener(this);
        return mainView;
    }

    @Override
    public void onResume() {
        // TODO Auto-generated method stub
        super.onResume();

    }

    public void stop() {
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.item_feedback:
                // 检测用户是否登录
                if (Default.userId != 0) {
                    getActivity().startActivity(new Intent(getActivity(), FeedbackActivity.class));
                } else {
                    getActivity().startActivity(new Intent(getActivity(), LoginActivity.class));
                }
                break;
            case R.id.item_check_update:
                new Thread() {
                    @Override
                    public void run() {
                        super.run();
                        checkNewVersion();
                    }
                }.start();
                break;
            case R.id.item_shareapp:
                SystenmApi.showShareView(getActivity(), "苏常网APP，随时随地掌握你的财富", "手机移动理财的指尖神器，帮您在“拇指时代”指点钱途，“掌握财富”。",
                "http://www.czsuchang.com/Member/Common/AppRegister?invite=" + Default.userId);//http://www.czsuchang.com/Member/Common/AppRegister?invite=881
                break;
            case R.id.item_contactus:
                Intent intent = new Intent(getActivity(), ContactUsActivity.class);
                startActivity(intent);
                break;
            case R.id.item_aboutus:
                Intent intent1 = new Intent(getActivity(), AboutUsActivity.class);
                startActivity(intent1);
                break;

            default:
                break;
        }
    }

    // 提交用户反馈到服务器
    public void checkNewVersion() {
        String url = Default.ip + Default.version;
        JSONObject jsonObject = new JSONObject();
        try {
            jsonObject.put("uid", 0);
            jsonObject.put("version", Default.version);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        try {
            String s = HttpClient.post(url, jsonObject.toString());
            if (!"".equals(s)) {
                JSONObject response = str2json(s);
                Message msg = new Message();
                msg.what = 1;
                msg.obj = response;
                handler.sendMessage(msg);
            } else {
                showCustomToast("获取失败");
            }
            Log.e("HttpClient", s);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public JSONObject str2json(String s) {
        JSONObject json = null;
        try {
            json = new JSONObject(s);

        } catch (JSONException e) {
            e.printStackTrace();
        }
        return json;
    }

    Handler handler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            switch (msg.what) {
                case 1:
                    JSONObject response = (JSONObject) msg.obj;
                    try {
                        // 没有新版本
                        if (response.getInt("status") == 1) {
                            showCustomToast(response.getString("message"));
                            // 获取新版本
                        } else if (response.getInt("status") == 0) {
                            // 另起后台线程 下载新版APP
                        } else {
                            showCustomToast(response.getString("message"));
                        }
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                    break;
                default:
                    break;
            }
        }
    };
}
<file_sep>/app/src/main/java/com/ys/www/asscg/activity/itemNewsActivity.java
package com.ys.www.asscg.activity;

import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.Html;
import android.text.Html.ImageGetter;
import android.text.Spanned;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebSettings.LayoutAlgorithm;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.TextView;

import com.ys.www.asscg.R;
import com.ys.www.asscg.base.BaseActivity;
import com.ys.www.asscg.http.HttpClient;
import com.ys.www.asscg.item.newsItem;
import com.ys.www.asscg.util.Default;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;


public class itemNewsActivity extends BaseActivity implements OnClickListener {
    public static String source; // =
    private TextView name;
    private TextView time;
    private newsItem mItem;
    private WebView webview;
    public static JSONObject noticeListItemJson;
    ImageView title_right;

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.news);

        name = (TextView) findViewById(R.id.newsName);
        time = (TextView) findViewById(R.id.newsTime);

        title_right= findViewById(R.id.title_right);
        title_right.setVisibility(View.VISIBLE);
        title_right.setOnClickListener(this);

        TextView text = (TextView) findViewById(R.id.title);
        text.setText(R.string.newsTitle);

        webview = (WebView) findViewById(R.id.web);
        webview.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);

        new Thread() {
            @Override
            public void run() {
                super.run();
                if (Default.IS_SHOW_NESW_OR_NOTICE) {
                    doShowItemhttp(Default.showNoticeId);
                } else {
                    doShowItemhttp(Default.showNewsId);
                }
            }
        }.start();
    }

    private String getFormateHtml(String html) {

        String retStr = "<html><head><style type='text/css'>p{text-align:justify;border-style:" + " none;border-top-width: 2px;border-right-width: 2px;border-bottom-width: 2px;border-left-width: 2px;}" + "img{height:auto;width: auto;width:100%;}</style></head><body>" + html + "</body></html>";

        return retStr;

    }

    private void updateData(JSONObject json) {
        try {

            name.setText(json.getString("title"));
            time.setText(json.getString("art_time"));
            source = json.getString("art_content");

            // doText();

            webview.loadDataWithBaseURL(Default.ip, getFormateHtml(source), "text/html", "utf-8", null);
        } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.title_right:
                finish(0);
                break;
        }
    }

    public void doText() {

        new Thread(new Runnable() {
            @Override
            public void run() {
                ImageGetter getter = new ImageGetter() {

                    @Override
                    public Drawable getDrawable(String source) {
                        Drawable drawable = null;
                        try {
                            URL url = new URL(Default.ip + source);
                            String srcName = source.substring(source.lastIndexOf("/") + 1, source.length());
                            InputStream is = null;
                            try {
                                is = url.openStream();
                            } catch (IOException e) {
                                e.printStackTrace();
                            }
                            drawable = Drawable.createFromStream(is, srcName);
                            drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
                        } catch (MalformedURLException e) {
                            e.printStackTrace();
                        }

                        return drawable;
                    }
                };
                Spanned spanned = Html.fromHtml(source, getter, null);
                Map map = new HashMap<String, Object>();
                map.put("spanned", spanned);
                map.put("info", source);

                Message msg = new Message();
                msg.what = 1;
                msg.obj = map;
                handler.sendMessage(msg);

            }
        }).start();
    }

    @Override
    public void finish() {
        Default.IS_SHOW_NESW_OR_NOTICE = false;
        super.finish();
    }

    Handler handler = new Handler() {

        @Override
        public void handleMessage(Message msg) {
            switch (msg.what) {
                case 1:
                    HashMap map = (HashMap) msg.obj;

                    Spanned getter = (Spanned) map.get("spanned");
                    // info.setText(getter);
                    break;
                case 3:
                    updateData(noticeListItemJson);
                    break;
            }
        }

    };

    // private void doShowItemhttp(long id)
    // {
    // showLoadingDialogNoCancle(getResources().getString(R.string.toast2));
    //
    // JsonBuilder builder = new JsonBuilder();
    // builder.put("id", id);
    // new BaseModel(null, Default.newsListItem, builder)
    // .setConnectionResponseLinstener(new ConnectResponseListener()
    // {
    // public void onConnectResponseCallback(JSONObject json)
    // {
    // dismissLoadingDialog();
    // Data.noticeListItemJson = json;
    // handler.sendEmptyMessage(3);
    // }
    //
    // @Override
    // public void onFail(JSONObject json)
    // {
    // dismissLoadingDialog();
    // try
    // {
    // Message msg = new Message();
    // msg.arg1 = 2;
    // Bundle bundel = new Bundle();
    // bundel.putString("info", json.getString("message"));
    // msg.setData(bundel);
    // handler.sendMessage(msg);
    // }
    // catch (JSONException e)
    // {
    // e.printStackTrace();
    // }
    // }
    // });
    //
    // }
    private void doShowItemhttp(long id) {
        String url = Default.ip + (Default.IS_SHOW_NESW_OR_NOTICE ? Default.noticeListItem : Default.newsListItem);
        JSONObject jsonObject = new JSONObject();
        try {
            jsonObject.put("uid", 0);
            jsonObject.put("id", id);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        try {
            String s = HttpClient.post(url, jsonObject.toString());
            if (!"".equals(s)) {
                JSONObject json = str2json(s);
                noticeListItemJson = json;
                handler.sendEmptyMessage(3);
            } else {
                showCustomToast("获取失败");
            }
            Log.e("HttpClient", s);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public JSONObject str2json(String s) {
        JSONObject json = null;
        try {
            json = new JSONObject(s);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return json;
    }
}
<file_sep>/app/src/main/java/com/ys/www/asscg/activity/ForgotPwdActivity.java
package com.ys.www.asscg.activity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.ys.www.asscg.R;
import com.ys.www.asscg.base.BaseActivity;
import com.ys.www.asscg.http.HttpClient;
import com.ys.www.asscg.util.Default;

import org.json.JSONException;
import org.json.JSONObject;


public class ForgotPwdActivity extends BaseActivity implements OnClickListener {

	/**
	 * 用户手机号码
	 */
	private EditText phoneEditor;
	private EditText usernameEditor, user_phone_sx, ver_pwd_sx;

	/**
	 * 用户手机号码
	 */
	private String phoneNum;
	private String username;
	TextView title;
	ImageView iv;
	String uid;
	String iszfpwd;
	public static ForgotPwdActivity instance = null;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.forgot_pwd);
		instance = this;
		title = (TextView) findViewById(R.id.title);
		Intent intent = getIntent();
		iszfpwd = intent.getStringExtra("iszfpwd");
//		showCustomToast(iszfpwd);
		title.setText("忘记登录密码");
		if(iszfpwd.equals("0")){
			title.setText("忘记支付密码");
		}
		// findViewById(R.id.forget_pwd).setOnClickListener(this);
		iv = (ImageView) findViewById(R.id.title_right);
		iv.setVisibility(View.VISIBLE);
		iv.setOnClickListener(this);
		// phoneEditor = (EditText) findViewById(R.id.user_phone);
		// usernameEditor = (EditText) findViewById(R.id.user_name);
		findViewById(R.id.edittext_sx).setOnClickListener(this);
		user_phone_sx = (EditText) findViewById(R.id.user_phone_sx);
		findViewById(R.id.forget_pwd_sx).setOnClickListener(this);
		ver_pwd_sx = (EditText) findViewById(R.id.ver_pwd_sx);
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub

		switch (v.getId()) {
		case R.id.title_right:
			finish();
			break;
		case R.id.forget_pwd_sx:// 校验验证码
			if (user_phone_sx.equals("")) {
				showCustomToast("请输入您的手机号！");
				return;
			}
			if (ver_pwd_sx.equals("")) {
				showCustomToast("请输入验证码！");
				return;
			}
			doHttpyzmyz();
//			Intent intent = new Intent(ForgotPwdActivity.this, AddNewPwd.class);
//			intent.putExtra("uid", 349);
//			startActivity(intent);
			break;
		case R.id.edittext_sx:// 获取验证码
			doHttpyzm();
			break;
		default:
			break;
		}

	}

	private void doHttpyzm() {
		{
			String url = Default.ip + Default.getyzm;
			try {
				JSONObject jsonObject=new JSONObject();
				jsonObject.put("uid", 0);
				jsonObject.put("phone", user_phone_sx.getText().toString());
				String s = HttpClient.post(url, jsonObject.toString());
				if (!"".equals(s)) {
					JSONObject response = str2json(s);
					if (response.getInt("status") == 1) {
						uid = response.getString("uid");
						showCustomToast("验证码发送成功");
					} else {
						showCustomToast("验证码发送失败");
					}
				} else {
					showCustomToast("获取失败");
				}
				Log.e("HttpClient", s);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}

	public JSONObject str2json(String s) {
		JSONObject json = null;
		try {
			json = new JSONObject(s);

		} catch (JSONException e) {
			e.printStackTrace();
		}
		return json;
	}

	private void doHttpyzmyz() {
			String url = Default.ip + Default.yzmyzsx;
			try {
				JSONObject jsonObject=new JSONObject();
				jsonObject.put("uid", 0);
				jsonObject.put("code", ver_pwd_sx.getText().toString());
				String s = HttpClient.post(url, jsonObject.toString());
				if (!"".equals(s)) {
					JSONObject response = str2json(s);
					if (response.getInt("status") == 1) {
						Intent intent = new Intent(ForgotPwdActivity.this, AddNewPwd.class);
						intent.putExtra("uid", uid);
						intent.putExtra("iszf", iszfpwd);
						startActivity(intent);
					} else {
						showCustomToast("验证码发送失败");
					}
				} else {
					showCustomToast("验证码验证错误");
				}
				Log.e("HttpClient", s);
			} catch (Exception e) {
				e.printStackTrace();
			}
	}

	@Override
	public void finish() {
		// TODO Auto-generated method stub
		super.finish();
	}

	@Override
	protected void onDestroy() {
		// TODO Auto-generated method stub
		super.onDestroy();
	}

}
<file_sep>/app/src/main/java/com/ys/www/asscg/activity/VIPActivity.java
package com.ys.www.asscg.activity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.ys.www.asscg.R;
import com.ys.www.asscg.api.SystenmApi;
import com.ys.www.asscg.base.BaseActivity;
import com.ys.www.asscg.dialog.PopDialog;
import com.ys.www.asscg.http.HttpClient;
import com.ys.www.asscg.util.Default;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;


public class VIPActivity extends BaseActivity implements OnClickListener {

    private TextView vip_free_textView;
    private EditText vip_info_editText;
    private JSONArray kf_list;
    private String kf_id;
    private PopDialog kf_popDialog;
    private TextView user_select_kfName, title;
    ImageView imageView;
    private boolean isClickItem = false;

    private int index = 0;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.vip);

        initView();

    }

    public void initView() {
        imageView = (ImageView) findViewById(R.id.title_right);
        imageView.setVisibility(View.VISIBLE);
        imageView.setOnClickListener(this);
        title = (TextView) findViewById(R.id.title);
        title.setText("VIP申请");
        findViewById(R.id.vip_button).setOnClickListener(this);
        vip_free_textView = (TextView) findViewById(R.id.vip_fee);

        kf_popDialog = new PopDialog(VIPActivity.this);
        kf_popDialog.setDialogTitle("选择客服");
        user_select_kfName = (TextView) findViewById(R.id.show_selecet_name);

        findViewById(R.id.vip_kf).setOnClickListener(this);
        kf_popDialog.setonClickListener(this);
        kf_popDialog.setOnItemClickListener(new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

                isClickItem = true;

                kf_popDialog.setDefaultSelect(position);

                index = position;

            }
        });

        vip_info_editText = (EditText) findViewById(R.id.vip_info);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.title_right:
                finish(0);
                break;
            case R.id.vip_kf:

                if (kf_list != null) {

                    SystenmApi.hiddenKeyBoard(VIPActivity.this);

                    kf_popDialog.setDefaultSelect(0);
                    try {
                        kf_id = kf_list.getJSONObject(0).getString("id");
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }

                    kf_popDialog.showAsDropDown(v);

                }
                break;
            case R.id.cButton:
                kf_popDialog.dismiss();
                break;
            case R.id.sButton:

                if (isClickItem) {
                    try {
                        kf_id = kf_list.getJSONObject(index).getString("id");

                        user_select_kfName
                                .setText(kf_list.getJSONObject(kf_popDialog.getDefaultSelect()).getString("user_name"));
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                } else {
                    kf_popDialog.setDefaultSelect(0);
                    try {
                        user_select_kfName.setText(kf_list.getJSONObject(0).getString("user_name"));

                        kf_id = kf_list.getJSONObject(0).getString("id");
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                }

                kf_popDialog.dismiss();
                break;
            case R.id.vip_button:

                if (kf_id == null) {
                    showCustomToast("请选择客服");

                    return;
                } else if (vip_info_editText.getText().toString().equals("")) {
                    showCustomToast("请输入申请说明");
                    return;
                } else {
                    new Thread() {
                        @Override
                        public void run() {
                            super.run();
                            vipActiondohttp();
                        }
                    }.start();
                }
                break;
        }
    }

    private void initInfo(JSONObject json) {
        try {
            vip_free_textView.setText(json.getString("fee_vip") + "元/年");
            kf_list = json.getJSONArray("list");
            for (int i = 0; i < kf_list.length(); i++) {
                JSONObject obj = kf_list.getJSONObject(i);
                kf_popDialog.addItem(obj.getString("user_name"));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @Override
    protected void onResume() {
        // TODO Auto-generated method stub
        super.onResume();
        new Thread() {
            @Override
            public void run() {
                super.run();
                doHttp();
            }
        }.start();
    }

    private void doHttp() {
        String url = Default.ip + Default.vip_kf_inf;
        try {
            String s = HttpClient.post(url, null);
            if (!"".equals(s)) {
                JSONObject response = str2json(s);
                if (response.has("status")) {
                    try {
                        if (response.getInt("status") == 1) {
                            initInfo(response);
                        }
                    } catch (JSONException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                }
            } else {
                showCustomToast("获取失败");
            }
            Log.e("HttpClient", s);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void vipActiondohttp() {
        String url = Default.ip + Default.hf_vip;
        try {
            String s = HttpClient.post(url, null);
            if (!"".equals(s)) {
                JSONObject response = str2json(s);
                if (response.has("status")) {
                    try {
                        if (response.getInt("status") == 1) {
                            showCustomToast("提交申请成功，请等待管理员审核");
                        } else {
                            showCustomToast(response.getString("message"));
                        }
                    } catch (JSONException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                }
            } else {
                showCustomToast("获取失败");
            }
            Log.e("HttpClient", s);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public JSONObject str2json(String s) {
        JSONObject json = null;
        try {
            json = new JSONObject(s);

        } catch (JSONException e) {
            e.printStackTrace();
        }
        return json;
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        int code = data.getIntExtra("code", -1);
        String message = data.getStringExtra("message");
        int code1 = data.getIntExtra("code1", -1);
        String message1 = data.getStringExtra("message1");
        int code2 = data.getIntExtra("code2", -1);
        String message2 = data.getStringExtra("message2");
        if (code == 88) {
            Toast.makeText(this, "恭喜您，支付成功！", Toast.LENGTH_SHORT).show();
            finish();
        } else {
            Toast.makeText(this, code + ":" + message, Toast.LENGTH_SHORT).show();
        }
    }

    @Override
    public void finish() {
        super.finish();
    }

}
<file_sep>/app/src/main/java/com/ys/www/asscg/adapter/MyReViewAdapter.java
package com.ys.www.asscg.adapter;

import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.ys.www.asscg.R;
import com.ys.www.asscg.activity.BidItem;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2017/6/23.
 */

public class MyReViewAdapter extends RecyclerView.Adapter<MyReViewAdapter.ViewHolder> {

    List<Map<String, Object>> list;
    Context context;
    private LayoutInflater mInflater;

    public MyReViewAdapter(List<Map<String, Object>> list, Context context) {
        this.list = list;
        this.context = context;
        mInflater = LayoutInflater.from(context);
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = mInflater.inflate(R.layout.item_list_indexfragment, parent, false);
        ViewHolder myViewHolder = new ViewHolder(view);
        return myViewHolder;
    }

    @Override
    public void onBindViewHolder(ViewHolder holder,final int position) {
        if (!"1".equals(list.get(position).get("repayment_type").toString())) {// 1表示天标
            // 其余数值表示月标
            holder.title_icon_r.setBackgroundResource(R.drawable.image_r2);
            holder.title_icon_l.setBackgroundResource(R.drawable.title_i2);
            holder.item_bg.setBackgroundResource(R.drawable.item_bg_2);
        } else {
            holder.title_icon_r.setBackgroundResource(R.drawable.image_r1);
            holder.title_icon_l.setBackgroundResource(R.drawable.title_i1);
            holder.item_bg.setBackgroundResource(R.drawable.item_bg_1);
        }
        holder.list_progress.setProgress((int) Double.parseDouble(list.get(position).get("progress_tz_sx").toString()));
        holder.list_borrow_name.setText(list.get(position).get("item_tzbt_sx").toString());
        holder.list_borrow_money.setText(list.get(position).get("item_jkje_sx").toString());
        holder.list_has_borrow.setText(list.get(position).get("has_borrow_sx").toString());
        holder.list_borrow_duration.setText(list.get(position).get("item_tzqx_sx").toString());
        holder.list_borrow_interest_rate.setText(list.get(position).get("item_nhl_sx").toString());
        holder.list_jindu.setText("进度:" + list.get(position).get("progress_tz_sx").toString() + "%");

        holder.item_bg.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                Long id = (Long) list.get(position).get("id");
                int type = (Integer) list.get(position).get("type");
                String string = (String) list.get(position).get("repayment_type");
//                Toast.makeText(context, "hahaha"+id, Toast.LENGTH_SHORT).show();
				Intent intent = new Intent(context, BidItem.class);
				intent.putExtra("id", id);
				intent.putExtra("type", type);
                context.startActivity(intent);
            }
        });
    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    public static class ViewHolder extends RecyclerView.ViewHolder {
        TextView list_borrow_name, list_borrow_money, list_has_borrow, list_borrow_duration, list_borrow_interest_rate,
                list_jindu;
        ProgressBar list_progress;
        ImageView title_icon_r, title_icon_l;
        FrameLayout item_bg;

        public ViewHolder(View itemView) {
            super(itemView);
            list_borrow_name = (TextView) itemView.findViewById(R.id.list_borrow_name);
            list_borrow_money = (TextView) itemView.findViewById(R.id.list_borrow_money);
            list_has_borrow = (TextView) itemView.findViewById(R.id.list_has_borrow);
            list_borrow_duration = (TextView) itemView.findViewById(R.id.list_borrow_duration);
            list_borrow_interest_rate = (TextView) itemView.findViewById(R.id.list_borrow_interest_rate);
            list_jindu = (TextView) itemView.findViewById(R.id.list_jindu);
            list_progress = (ProgressBar) itemView.findViewById(R.id.list_progress);
            title_icon_r = (ImageView) itemView.findViewById(R.id.title_icon_r);
            title_icon_l = (ImageView) itemView.findViewById(R.id.title_icon_l);
            item_bg = (FrameLayout) itemView.findViewById(R.id.item_bg);
        }
    }
}
<file_sep>/app/src/main/java/com/ys/www/asscg/activity/PasswordJaoYiActivity.java
package com.ys.www.asscg.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.ys.www.asscg.R;
import com.ys.www.asscg.base.BaseActivity;
import com.ys.www.asscg.http.HttpClient;
import com.ys.www.asscg.util.Default;

import org.json.JSONException;
import org.json.JSONObject;


/**
 * 修改交易密码
 */
public class PasswordJaoYiActivity extends BaseActivity implements OnClickListener {
	private EditText mOldd, mPassww, mPassww2;
	private String info[];
	ImageView iv_back;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.people_info_update_jiaoyipsw);
		initView();
	}

	public void initView() {
		iv_back = (ImageView) findViewById(R.id.title_right);
		iv_back.setVisibility(View.VISIBLE);
		iv_back.setOnClickListener(this);
		// findViewById(R.id.back).setOnClickListener(this);
		findViewById(R.id.btn_jiayoyi).setOnClickListener(this);
		findViewById(R.id.getPw).setOnClickListener(this);
		TextView text = (TextView) findViewById(R.id.title);
		text.setText(R.string.updatezfpsd_title);

		mOldd = (EditText) findViewById(R.id.ed_itold);
		mPassww = (EditText) findViewById(R.id.ed_itpassw);
		mPassww2 = (EditText) findViewById(R.id.ed_itpassw2);

	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.btn_jiayoyi:
			info = getInfo();
			if (info == null) {
				return;
			}
			doHttp();
			break;
		case R.id.title_right:
			finish();
			break;
		case R.id.getPw:
			Intent intent = new Intent(PasswordJaoYiActivity.this, ForgotPwdActivity.class);
			intent.putExtra("iszfpwd", "0");
			startActivity(intent);
			break;
		default:
			break;
		}

	}

	public String[] getInfo() {
		String old = mOldd.getText().toString();
		String passw = mPassww.getText().toString();
		String passw2 = mPassww2.getText().toString();

		if (old.equals("")) {
			showCustomToast(R.string.toast7);
			return null;
		}
		if (passw.equals("")) {
			showCustomToast(R.string.toast8);
			return null;
		}
		if (passw.length() < 6) {
			showCustomToast(R.string.toast8_2);
			return null;
		}

		if (passw.length() > 16) {
			showCustomToast(R.string.toast8_3);
			return null;
		}
		if (passw2.equals("")) {
			showCustomToast(R.string.toast8_1);
			return null;
		}
		if (passw2.equals(passw) == false) {
			showCustomToast(R.string.toast9);
			return null;
		}

		return new String[] { old, passw, passw2 };
	}

	public void doHttp() {
		String url = Default.ip + Default.peoInfoxsjiaoyipsw;
		try {
			JSONObject jsonObject=new JSONObject();
			jsonObject.put("uid", 0);
			jsonObject.put("oldpwd", info[0]);
			jsonObject.put("newpwd", info[1]);
			String s = HttpClient.post(url, jsonObject.toString());
			if (!"".equals(s)) {
				JSONObject response = str2json(s);
				if (response.getInt("status") == 1) {
					finish();
					showCustomToast("修改支付密码成功！");
				} else {
					showCustomToast(response.getString("message"));
				}
			} else {
				showCustomToast("获取失败");
			}
			Log.e("HttpClient", s);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}


	public JSONObject str2json(String s) {
		JSONObject json = null;
		try {
			json = new JSONObject(s);

		} catch (JSONException e) {
			e.printStackTrace();
		}
		return json;
	}

	private Handler handler = new Handler() {
		@Override
		public void handleMessage(Message msg) {
			super.handleMessage(msg);
			showCustomToast(msg.getData().getString("info"));
		}

	};

}
<file_sep>/app/src/main/java/com/ys/www/asscg/fragment/IndexFragment_Scg.java
package com.ys.www.asscg.fragment;

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.assist.FailReason;
import com.nostra13.universalimageloader.core.assist.ImageScaleType;
import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer;
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener;
import com.ys.www.asscg.R;
import com.ys.www.asscg.activity.BidItem;
import com.ys.www.asscg.activity.LoginActivity;
import com.ys.www.asscg.activity.NewsListActivity;
import com.ys.www.asscg.activity.TouziActivity;
import com.ys.www.asscg.base.BaseFragment;
import com.ys.www.asscg.http.HttpClient;
import com.ys.www.asscg.util.Default;
import com.ys.www.asscg.view.AutoVerticalScrollTextView;
import com.ys.www.asscg.view.ViewPagerAdapter;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

import static com.ys.www.asscg.activity.MainTabActivity.mainTabActivity;

//苏常主页
public class IndexFragment_Scg extends BaseFragment implements OnClickListener, OnPageChangeListener {

    private int curPage = 1, pageCount = 1;
    private JSONArray list = null;
    private long id_tt, id_yy;
    private int type_tt, type_yy;

    private ViewPagerAdapter vpAdapter;
    private List<View> views;
    private ArrayList<View> footPointViews;
    private List<String> bannerItemspic;
    private LinearLayout footpointview;
    private static final int[] pics = {R.drawable.slide};
    private ViewPager flipper;
    private int index;
    private boolean change;
    private int number = 0;
    private boolean isRunning = true;

    LinearLayout item_tt, item_yy;

    private AutoVerticalScrollTextView autoVerticalScrollTextView;

    TextView tt_borrow_name, tt_borrow_money, tt_has_borrow, tt_borrow_duration, tt_borrow_interest_rate, tt_jindu;
    ProgressBar tt_progress;
    TextView yy_borrow_name, yy_borrow_money, yy_has_borrow, yy_borrow_duration, yy_borrow_interest_rate, yy_jindu;
    ProgressBar yy_progress;

    List<String> list_str;
    List<String> mStr;


    private String[] strings1 = {"我的剑，就是你的剑!", "俺也是从石头里蹦出来得!", "我用双手成就你的梦想!", "人在塔在!", "犯我德邦者，虽远必诛!", "我会让你看看什么叫残忍!",
            "我的大刀早已饥渴难耐了!"};
    private Handler mHandler = new Handler();
    private Runnable runable = new Runnable() {

        @Override
        public void run() {
            changePic();
        }
    };

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View mainView = inflater.inflate(R.layout.layout_index, null);
        mainView.findViewById(R.id.gg_loadmore).setOnClickListener(this);
        footpointview = (LinearLayout) mainView.findViewById(R.id.footer_point);
        autoVerticalScrollTextView = (AutoVerticalScrollTextView) mainView
                .findViewById(R.id.autoVerticalScrollTextView);
        // autoVerticalScrollTextView.setText(strings[0]);

        autoVerticalScrollTextView.setOnClickListener(this);

        mainView.findViewById(R.id.item_yy).setOnClickListener(this);
        mainView.findViewById(R.id.item_tt).setOnClickListener(this);

        initView(mainView);
        initTtview(mainView);
        initYyview(mainView);
        mHandler.postDelayed(runable, 5000);
        return mainView;
    }

    public void initBannerData(JSONObject json) {

        if (json != null) {
            views.clear();
            // flipper.removeAllViews();
            flipper.setBackgroundDrawable(null);
            footPointViews.clear();
            footpointview.removeAllViews();
            bannerItemspic = new ArrayList<String>();
            try {
                JSONArray array = json.getJSONArray("list");
                for (int i = 0; i < array.length(); i++) {
                    JSONObject jsonObject = array.getJSONObject(i);

                    bannerItemspic.add(jsonObject.get("pic").toString());
                    // bannerItemspic.add(array.getString(i));

                }

            } catch (JSONException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            for (int i = 0; i < bannerItemspic.size(); i++) {
                ImageView footView = new ImageView(mainTabActivity);
                LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
                        ViewGroup.LayoutParams.WRAP_CONTENT,
                        ViewGroup.LayoutParams.WRAP_CONTENT);
                params.leftMargin = 10;
                footView.setLayoutParams(params);

                if (i == 0) {
                    footView.setImageResource(R.drawable.b_dx1);
                } else {
                    footView.setImageResource(R.drawable.b_dx2);
                }
                footpointview.addView(footView);
                footPointViews.add(footView);

                final ImageView iv = new ImageView(mainTabActivity);
                iv.setScaleType(ScaleType.FIT_XY);
                iv.setTag(i);

                DisplayImageOptions options = new DisplayImageOptions.Builder().showImageForEmptyUri(pics[0])
                        .showImageOnFail(pics[0]).resetViewBeforeLoading(true).cacheOnDisk(true)
                        .imageScaleType(ImageScaleType.EXACTLY).bitmapConfig(Bitmap.Config.RGB_565)
                        .considerExifParams(true).displayer(new FadeInBitmapDisplayer(300)).build();
                Log.e("url", bannerItemspic.get(i));
                ImageLoader.getInstance().displayImage(Default.ip + bannerItemspic.get(i), iv, options,
                        new SimpleImageLoadingListener() {
                            @Override
                            public void onLoadingStarted(String imageUri, View view) {
                            }

                            @Override
                            public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
                                String message = null;
                                switch (failReason.getType()) {
                                    case IO_ERROR:
                                        message = "Input/Output error";
                                        break;
                                    case DECODING_ERROR:
                                        message = "解析错误";
                                        break;
                                    case NETWORK_DENIED:
                                        message = "网络错误";
                                        break;
                                    case OUT_OF_MEMORY:
                                        message = "内存错误";
                                        break;
                                    case UNKNOWN:
                                        message = "位置错误";
                                        break;
                                }
                            }

                            @Override
                            public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
                                if (loadedImage != null) {
                                    iv.setImageBitmap(loadedImage);
                                }

                            }
                        });
                views.add(iv);
            }

        }
    }

    @Override
    public void onResume() {
        // TODO Auto-generated method stub
        super.onResume();
        new Thread() {
            @Override
            public void run() {
                super.run();
                doHttp();
            }
        }.start();
        new Thread() {
            @Override
            public void run() {
                super.run();
                indexdoHttp();
            }
        }.start();
        new Thread() {
            @Override
            public void run() {
                super.run();
                ggdoHttp();
            }
        }.start();

    }

    /**
     * 首页推荐标
     */
    public void indexdoHttp() {
        String url = Default.ip + Default.tzList;
        JSONObject jsonObject = new JSONObject();
        try {
            jsonObject.put("uid", 0);
            jsonObject.put("is_tuijian", 1);
            jsonObject.put("type", 11);
            jsonObject.put("page", curPage);
            jsonObject.put("limit", pageCount);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        try {
            String s = HttpClient.post(url, jsonObject.toString());
            if (!"".equals(s)) {
                updateAddInfo(str2json(s));
            } else {
                showCustomToast("获取失败");
            }
            Log.e("HttpClient", s);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public JSONObject str2json(String s) {
        JSONObject json = null;
        try {
            json = new JSONObject(s);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return json;
    }

    public void ggdoHttp() {
        String url = Default.ip + Default.sygg;
        try {
            String s = HttpClient.get(url);
            if (!"".equals(s)) {
                JSONObject json = str2json(s);
                if (json.getInt("status") == 1) {
                    String string = json.getString("msg");
                    // int count = string.length();
                    JSONArray jsonArray = json.getJSONArray("msg");
                    list_str = new ArrayList<String>();
                    for (int i = 0; i < jsonArray.length(); i++) {
                        JSONObject jsonObject = jsonArray.getJSONObject(i);
                        list_str.add(jsonObject.optString("title"));
                    }
                    Message message = new Message();
                    message.obj = list_str;
                    message.what = 111;
                    handler.sendMessage(message);
                } else {
                    showCustomToast(json.getString("message"));
                }
            } else {
                showCustomToast("获取失败");
            }
            Log.e("HttpClient", s);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    public void updateAddInfo(JSONObject json) {
        try {

            if (!json.isNull("list")) {
                list = json.getJSONArray("list");
                Message message = new Message();
                message.what = 100;
                message.obj = list;
                handler.sendMessage(message);
            }

        } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    /**
     * 获取幻灯片
     */
    public void doHttp() {
        String url = Default.ip + Default.bannerPic;
        JSONObject jsonObject = new JSONObject();
        try {
            jsonObject.put("uid", 0);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        try {
            String s = HttpClient.post(url, jsonObject.toString());
            if (!"".equals(s)) {
                Message message = new Message();
                message.what = 666;
                message.obj = str2json(s);
                handler.sendMessage(message);

            } else {
                showCustomToast("获取失败");
            }
            Log.e("HttpClient", s);
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

    public void stop() {
        try {
            mHandler.wait();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public void changePic() {
        if (getActivity() == null) {
            return;
        }
        if (!change) {

            if (index < views.size() - 1) {
                index++;
                setImage(index);
                flipper.setCurrentItem(index);
                if (index == views.size() - 1) {
                    change = true;
                }
            }

        } else {
            if (index > 0) {
                index--;
                setImage(index);
                flipper.setCurrentItem(index);
                if (index == 0) {
                    change = false;
                }
            }
        }
        mHandler.postDelayed(runable, 5000);
    }

    void setImage(int i) {
        for (int j = 0; j < footPointViews.size(); j++) {
            ImageView iv = (ImageView) footPointViews.get(j);
            if (j != i) {
                iv.setImageResource(R.drawable.b_dx2);
            } else {
                iv.setImageResource(R.drawable.b_dx1);
            }
        }
    }

    public int px2dip(Context context, float pxValue) {
        final float scale = context.getResources().getDisplayMetrics().density;
        return (int) (pxValue / scale + 0.5f);
    }

    public void initView(View view) {

        views = new ArrayList<View>();
        footPointViews = new ArrayList<View>();
        flipper = (ViewPager) view.findViewById(R.id.flipper);
        ImageView footView = new ImageView(getActivity());

        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        params.leftMargin = 10;
        footView.setLayoutParams(params);

        footView.setImageResource(R.drawable.b_dx1);

        footPointViews.add(footView);
        footpointview.addView(footView);

        flipper = (ViewPager) view.findViewById(R.id.flipper);

        vpAdapter = new ViewPagerAdapter(views);

        flipper.setAdapter(vpAdapter);
        // 绑定回调
        flipper.setOnPageChangeListener(this);

        // new Thread() {
        // @Override
        // public void run() {
        // while (isRunning) {
        // SystemClock.sleep(3000);
        // handler.sendEmptyMessage(199);
        // }
        // }
        // }.start();

    }

    private void initTtview(View mainView) {
        // TODO Auto-generated method stub
        tt_borrow_name = (TextView) mainView.findViewById(R.id.tt_borrow_name);
        tt_borrow_money = (TextView) mainView.findViewById(R.id.tt_borrow_money);
        tt_has_borrow = (TextView) mainView.findViewById(R.id.tt_has_borrow);
        tt_borrow_duration = (TextView) mainView.findViewById(R.id.tt_borrow_duration);
        tt_borrow_interest_rate = (TextView) mainView.findViewById(R.id.tt_borrow_interest_rate);
        tt_jindu = (TextView) mainView.findViewById(R.id.tt_jindu);
        tt_progress = (ProgressBar) mainView.findViewById(R.id.tt_progress);
    }

    private void initYyview(View mainView) {
        // TODO Auto-generated method stub
        yy_borrow_name = (TextView) mainView.findViewById(R.id.yy_borrow_name);
        yy_borrow_money = (TextView) mainView.findViewById(R.id.yy_borrow_money);
        yy_has_borrow = (TextView) mainView.findViewById(R.id.yy_has_borrow);
        yy_borrow_duration = (TextView) mainView.findViewById(R.id.yy_borrow_duration);
        yy_borrow_interest_rate = (TextView) mainView.findViewById(R.id.yy_borrow_interest_rate);
        yy_jindu = (TextView) mainView.findViewById(R.id.yy_jindu);
        yy_progress = (ProgressBar) mainView.findViewById(R.id.yy_progress);
    }

    private Handler handler = new Handler() {
        @SuppressWarnings("unchecked")
        @Override
        public void handleMessage(Message msg) {

            if (msg.what == 199) {
                autoVerticalScrollTextView.next();
                number++;
                // autoVerticalScrollTextView.setText(strings[number %
                // strings.length]);
                autoVerticalScrollTextView.setText(mStr.get(number % mStr.size()));
            } else if (msg.what == 100) {
                try {
                    JSONArray ja = (JSONArray) msg.obj;
                    JSONObject jo = null;
                    for (int i = 0; i < ja.length(); i++) {
                        jo = ja.getJSONObject(i);
                        if (i == 0) {
                            id_tt = jo.getLong("id");
                            type_tt = jo.getInt("borrow_type");
                            tt_borrow_name.setText(jo.getString("borrow_name"));
                            tt_borrow_money.setText(jo.getString("borrow_money"));

                            if ("1".equals(jo.getString("repayment_type"))) {
                                tt_borrow_duration.setText(jo.getString("borrow_duration") + "天");
                            } else {
                                tt_borrow_duration.setText(jo.getString("borrow_duration") + "月");
                            }
                            tt_borrow_interest_rate.setText(jo.getString("borrow_interest_rate") + "%");
                            Double all = jo.getDouble("borrow_money");// getSubtract
                            Double has = jo.getDouble("has_borrow");
                            tt_has_borrow.setText(getSubtract(all, has));
                            int progress = getProgress(all, has);
                            tt_progress.setProgress(progress);
                            tt_jindu.setText("进度:" + progress + "%");
                        } else if (i == 1) {
                            id_yy = jo.getLong("id");
                            type_yy = jo.getInt("borrow_type");
                            yy_borrow_name.setText(jo.getString("borrow_name"));
                            yy_borrow_money.setText(jo.getString("borrow_money"));
                            yy_has_borrow.setText(jo.getString("has_borrow"));
                            if ("1".equals(jo.getString("repayment_type"))) {
                                yy_borrow_duration.setText(jo.getString("borrow_duration") + "天");
                            } else {
                                yy_borrow_duration.setText(jo.getString("borrow_duration") + "月");
                            }
                            yy_borrow_interest_rate.setText(jo.getString("borrow_interest_rate") + "%");
                            Double all = jo.getDouble("borrow_money");
                            Double has = jo.getDouble("has_borrow");
                            yy_has_borrow.setText(getSubtract(all, has));
                            int progress = getProgress(all, has);
                            yy_progress.setProgress(progress);
                            yy_jindu.setText("进度:" + progress + "%");

                        }
                    }
                } catch (Exception e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            } else if (msg.what == 111) {
                mStr = (List<String>) msg.obj;
                if (mStr.size() > 0) {
                    autoVerticalScrollTextView.setText(mStr.get(0));
                    new Thread() {
                        @Override
                        public void run() {
                            while (isRunning) {
                                SystemClock.sleep(3000);
                                handler.sendEmptyMessage(199);
                            }
                        }
                    }.start();
                }

            } else if (msg.what == 666) {
                JSONObject json = (JSONObject) msg.obj;
                initBannerData(json);
                vpAdapter.notifyDataSetChanged();
            }
        }
    };

    private int getProgress(Double all, Double has) {
        BigDecimal b1 = new BigDecimal(all.toString());
        BigDecimal b2 = new BigDecimal(has.toString());
        Double isuse = b1.subtract(b2).doubleValue();
        // BigDecimal isuse1 = new BigDecimal(isuse.toString());
        Double res = b2.divide(b1, 3, BigDecimal.ROUND_HALF_UP).doubleValue();
        int i = (int) (Double.parseDouble(res + "") * 100);
        return i;
    }

    private String getSubtract(Double all, Double has) {
        BigDecimal b1 = new BigDecimal(all.toString());
        BigDecimal b2 = new BigDecimal(has.toString());
        Double isuse = b1.subtract(b2).doubleValue();
        return isuse + "";
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub
        switch (v.getId()) {
            case R.id.gg_loadmore:
                Intent intent = new Intent(getActivity(), TouziActivity.class);
                startActivity(intent);
                break;
            case R.id.item_tt:
                if (Default.userId == 0) {
                    Intent intent1 = new Intent(getActivity(), LoginActivity.class);
                    startActivity(intent1);
                } else {
                    Intent intent1 = new Intent(getActivity(), BidItem.class);
                    intent1.putExtra("id", id_tt);
                    intent1.putExtra("type", shabiphp(type_tt));
                    startActivity(intent1);
                }

                break;
            case R.id.item_yy:
                if (Default.userId == 0) {
                    Intent intent1 = new Intent(getActivity(), LoginActivity.class);
                    startActivity(intent1);
                } else {
                    Intent intent2 = new Intent(getActivity(), BidItem.class);
                    intent2.putExtra("id", id_yy);
                    intent2.putExtra("type", shabiphp(type_yy));
                    startActivity(intent2);
                }
                break;
            case R.id.autoVerticalScrollTextView:
                getActivity().startActivity(new Intent(getActivity(), NewsListActivity.class));
                break;
            default:

                break;

        }

    }

    public int shabiphp(int i) {
        int j = 0;
        switch (i) {
            case 1:
                j = 3;
                break;
            case 2:
                j = 4;
                break;
            case 3:
                j = 5;
                break;
            case 4:
                j = 6;
                break;
            case 5:
                j = 7;
                break;

            default:
                break;
        }

        return j;
    }

    @Override
    public void onPageScrollStateChanged(int arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onPageScrolled(int arg0, float arg1, int arg2) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onPageSelected(int arg0) {
        index = arg0;
        setImage(arg0);

    }

    @Override
    public void onDestroy() {
        // TODO Auto-generated method stub
        super.onDestroy();
        isRunning = false;
    }

}
<file_sep>/app/src/main/java/com/ys/www/asscg/activity/MainTabActivity.java
package com.ys.www.asscg.activity;

import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;

import com.ys.www.asscg.R;
import com.ys.www.asscg.fragment.FragmentFactory;
import com.ys.www.asscg.receiver.NetWorkStatusBroadcastReceiver;
import com.ys.www.asscg.util.Default;

/**
 * Created by Administrator on 2017/6/22.
 */

public class MainTabActivity extends FragmentActivity {
    TextView title_view;
    RadioGroup rg_tab;
    RadioButton tab_one, tab_two, tab_three;
    FrameLayout content_frame;
    NetWorkStatusBroadcastReceiver netWorkStatusBroadcastReceiver;
    /**
     * 当前TabBar 选择项
     */
    private int currentIndex = 1;
    /***
     * 当前TabBar 选择项 之前的选择项
     */
    private int lastIndex = 1;

    private boolean changeToHomeFlag = false;

    public static MainTabActivity mainTabActivity;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.layout_main);
        mainTabActivity = this;
        init();
    }

    public void init() {
        title_view = findViewById(R.id.title_view);
        rg_tab = findViewById(R.id.rg_tab);
        tab_one = findViewById(R.id.tab_one);
        tab_two = findViewById(R.id.tab_two);
        tab_three = findViewById(R.id.tab_three);
        content_frame = findViewById(R.id.content_frame);
        netWorkStatusBroadcastReceiver = new NetWorkStatusBroadcastReceiver();
        IntentFilter filter = new IntentFilter();
        filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
        registerReceiver(netWorkStatusBroadcastReceiver, filter);

        Fragment fragment = FragmentFactory.getInstanceByIndex(1);
        getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, fragment).commit();
        title_view.setText("理财");
        tab_one.setChecked(true);

        rg_tab.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                /**
                 * 判断用户是否登陆 ， 借款和个人账户的跳转选择
                 */

                int selectedId = 0;
                switch (checkedId) {
                    case R.id.tab_one:
                        selectedId = 1;
                        break;
                    case R.id.tab_two:
                        selectedId = 2;
                        break;
                    case R.id.tab_three:
                        selectedId = 3;
                        break;

                    default:
                        break;
                }
                lastIndex = currentIndex;
                currentIndex = selectedId;
                changeTitle(selectedId);

                Fragment fragment = FragmentFactory.getInstanceByIndex(selectedId);
//                if (changeToHomeFlag) {
//                    HomeFragment homeFragment = (HomeFragment) fragment;
//                    changeToHomeFlag = false;
//                }

                getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, fragment)
                        .commitAllowingStateLoss();

            }
        });
    }

    /**
     * 更改标题
     *
     * @param index Tab 选项
     */
    private void changeTitle(int index) {

        switch (index) {
            case 1:
                title_view.setText("理财");
                break;
            case 2:
                if (Default.userId == 0) {
                    Intent userInfoLoginIntent = new Intent();
                    userInfoLoginIntent.setClass(this, LoginActivity.class);
                    startActivity(userInfoLoginIntent);
                } else {
                    title_view.setText("个人账户");
                }
                break;
            case 3:
                title_view.setText("设置");
                break;

            default:
                break;
        }
    }

    /***
     * 跳转到首页
     *
     * @return
     */

    public void IndexView() {

        tab_one.setChecked(true);

    }

    private long lastTime;
    private int closeNum;

    @Override
    protected void onDestroy() {
        super.onDestroy();
        unregisterReceiver(netWorkStatusBroadcastReceiver);
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        // TODO Auto-generated method stub
        if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
            if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
                closeNum++;
                if (System.currentTimeMillis() - lastTime > 5000) {
                    closeNum = 0;
                }
                lastTime = System.currentTimeMillis();
                if (closeNum == 1) {
                    finish();
                } else {
                    showCustomToast(R.string.exit);
                }
            }
            return false;
        }

        return super.onKeyDown(keyCode, event);

    }

    public void showCustomToast(String text) {
        View toastRoot = LayoutInflater.from(MainTabActivity.this).inflate(R.layout.common_toast, null);
        ((TextView) toastRoot.findViewById(R.id.toast_text)).setText(text);
        Toast toast = new Toast(MainTabActivity.this);
        toast.setGravity(Gravity.CENTER, 0, 0);
        toast.setDuration(Toast.LENGTH_SHORT);
        toast.setView(toastRoot);
        toast.show();
    }

    public void showCustomToast(int id) {
        showCustomToast(getResources().getString(id).toString());
    }
}
<file_sep>/app/src/main/java/com/ys/www/asscg/fragment/AccountFragment_Scg.java
package com.ys.www.asscg.fragment;

import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.LinearInterpolator;
import android.widget.ImageView;
import android.widget.TextView;

import com.squareup.picasso.Picasso;
import com.ys.www.asscg.R;
import com.ys.www.asscg.activity.PeopleInfoDataActivity;
import com.ys.www.asscg.base.BaseFragment;
import com.ys.www.asscg.http.HttpClient;
import com.ys.www.asscg.util.Default;
import com.ys.www.asscg.view.ChuckWaveView;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

//苏常账户
@SuppressLint("NewApi")
public class AccountFragment_Scg extends BaseFragment implements OnClickListener {

    private ChuckWaveView mWaveView = null;

    private float mCurrentHeight = 0;

    TextView total_rs, freeze_rs, user_name_rs;
    ImageView user_pic;
    int jxj_num = 0;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View mainView = inflater.inflate(R.layout.layout_account, null);
        mainView.findViewById(R.id.item_personalset).setOnClickListener(this);
        mainView.findViewById(R.id.item_tzrecord).setOnClickListener(this);
        mainView.findViewById(R.id.item_jyjl).setOnClickListener(this);
        mainView.findViewById(R.id.cz_rs).setOnClickListener(this);
        mainView.findViewById(R.id.tx_rs).setOnClickListener(this);
        mainView.findViewById(R.id.item_jxj).setOnClickListener(this);
        mainView.findViewById(R.id.item_redpkg).setOnClickListener(this);
        total_rs = (TextView) mainView.findViewById(R.id.total_rs);
        freeze_rs = (TextView) mainView.findViewById(R.id.freeze_rs);
        user_pic = (ImageView) mainView.findViewById(R.id.user_pic);
        user_name_rs = (TextView) mainView.findViewById(R.id.user_name_rs);
        mWaveView = (ChuckWaveView) mainView.findViewById(R.id.main_wave_v1);
        initview();
        return mainView;
    }

    private void initview() {
        // TODO Auto-generated method stub

        loadWaveData(0.30f);
    }

    private void loadWaveData(float height) {
        float a = 0.33f;
        height = a;
        // Toast.makeText(MainActivity.this, height + "", 1000).show();
        final List<Animator> mAnimators = new ArrayList<Animator>();
        ObjectAnimator waveShiftAnim = ObjectAnimator.ofFloat(mWaveView, "waveShiftRatio", 0f, 1f); // 水平方向循环
        waveShiftAnim.setRepeatCount(ValueAnimator.INFINITE);
        waveShiftAnim.setDuration(2000);
        waveShiftAnim.setInterpolator(new LinearInterpolator());
        mAnimators.add(waveShiftAnim);

        ObjectAnimator waterLevelAnim = ObjectAnimator.ofFloat(mWaveView, "waterLevelRatio", mCurrentHeight, height); // 竖直方向从0%到x%
        waterLevelAnim.setDuration(6000);
        waterLevelAnim.setInterpolator(new DecelerateInterpolator());
        mAnimators.add(waterLevelAnim);

        mWaveView.invalidate();
        AnimatorSet mAnimatorSet = new AnimatorSet();
        mAnimatorSet.playTogether(mAnimators);
        mAnimatorSet.start();

        mCurrentHeight = height;
    }

    @Override
    public void onResume() {
        // TODO Auto-generated method stub
        super.onResume();
        new Thread() {
            @Override
            public void run() {
                super.run();
                doHttpUpdatePeopleInfo();
            }
        }.start();


    }

    public void doHttpUpdatePeopleInfo() {
        String url = Default.ip + Default.peoInfoUpdate;

        try {
            String s = HttpClient.post(url, null);
            if (!"".equals(s)) {
                JSONObject response = str2json(s);

                if (response.getInt("status") == 1) {
                    // updateUserInfo(response);
                    total_rs.setText(response.getString("total") + "元");
                    // 冻结
                    freeze_rs.setText(response.getString("freeze") + "元");
                    Picasso.with(getActivity()).load(Default.ip + response.getString("head")).into(user_pic);
                    user_name_rs.setText(response.getString("username"));
                } else {
                    showCustomToast(response.getString("message"));
                }

            } else {
                showCustomToast("获取失败");
            }
            Log.e("HttpClient", s);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public JSONObject str2json(String s) {
        JSONObject json = null;
        try {
            json = new JSONObject(s);

        } catch (JSONException e) {
            e.printStackTrace();
        }
        return json;
    }


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.item_personalset:// 用户设置
                Intent intent = new Intent(getActivity(), PeopleInfoDataActivity.class);
                startActivity(intent);
                break;
            case R.id.item_tzrecord:// 投资记录
//                Intent intent1 = new Intent(getActivity(), InvestManagerStandardActivity.class);
//                startActivity(intent1);
                break;
            case R.id.item_jyjl:// 交易记录
//			startActivity(new Intent(getActivity(), PeopleInfoJiaoYi_New.class));
                break;
            case R.id.cz_rs:// 充值
//			Intent i = new Intent(getActivity(), ChoosePayType.class);
//			startActivity(i);
                break;
            case R.id.tx_rs:// 提现
                getUserBankCard();
                break;
            case R.id.item_jxj:// 加息劵
//			Intent i1 = new Intent(getActivity(), InterestratesecuritiesActivity.class);
//			startActivity(i1);
                break;
            case R.id.item_redpkg://红包
//			Intent i2 = new Intent(getActivity(), MyBriberyMoney.class);
//			startActivity(i2);
                break;
            default:
                break;

        }
    }

    public void getUserBankCard() {
    }

    ;

    // 解析获取到银行卡信息
//	public void decoidTheUesrCardInfo(JSONObject json) {
//		try {
//			if (json.getString("bank_num") != null && !json.getString("bank_num").equals("")) {
//
//				Intent intent = new Intent(getActivity(), peopleInfoWithdrawalActivity.class);
//
//				intent.putExtra("bank_num", json.getString("bank_num"));
//
//				if (json.getString("bank_name") != null && !json.getString("bank_name").equals("")) {
//
//					intent.putExtra("bank_name", json.getString("bank_name"));
//
//				}
//				if (json.getString("real_name") != null && !json.getString("real_name").equals("")) {
//
//					intent.putExtra("real_name", json.getString("real_name"));
//				}
//				// if (json.getString("all_money") != null
//				// && !json.getString("all_money").equals("")) {
//				intent.putExtra("all_money", json.getString("all_money"));
//				MyLog.e("提现准备传的钱数", json.getString("all_money"));
//				// }
//				if (json.getString("qixian") != null && !json.getString("qixian").equals("")) {
//
//					intent.putExtra("qixian", json.getString("qixian"));
//				}
//
//				startActivity(intent);
//
//			}
//		} catch (JSONException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		}
//
//	}
}
