146 lines
4.6 KiB
Java
146 lines
4.6 KiB
Java
package com.sl.house_property;
|
|
|
|
import android.os.Bundle;
|
|
import android.text.Editable;
|
|
import android.text.TextWatcher;
|
|
import android.view.Gravity;
|
|
import android.view.View;
|
|
import android.widget.Toast;
|
|
|
|
import com.sl.house_property.databinding.ActivityAdeviseBinding;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
import my_loader.Loader;
|
|
import my_loader.Resultcode;
|
|
import tools.Config;
|
|
import http.ApiConfig;
|
|
import rx.Subscription;
|
|
import rx.functions.Action1;
|
|
import utils.Md5;
|
|
|
|
public class AdeviseActivity extends BaseActivity<ActivityAdeviseBinding> {
|
|
|
|
private Loader mGankLoader;
|
|
|
|
@Override
|
|
protected int getLayoutResId() {
|
|
return R.layout.activity_adevise;
|
|
}
|
|
|
|
@Override
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
super.onCreate(savedInstanceState);
|
|
setAbr("意见反馈", new View.OnClickListener() {
|
|
@Override
|
|
public void onClick(View view) {
|
|
finish();
|
|
}
|
|
},0,null,0,null,0,null,"");
|
|
mDataBinding.comimit.setOnClickListener(new View.OnClickListener(){
|
|
@Override
|
|
public void onClick(View view) {
|
|
if(mDataBinding.connent.getText().toString().trim().length()<3){
|
|
setToast(2,getString(R.string.pleaseeditcontent));
|
|
return;}
|
|
Map<String,String> map=new HashMap<>();
|
|
map.put("content",mDataBinding.connent.getText().toString().trim());
|
|
|
|
map.put("userid",Config.getInstance(AdeviseActivity.this).getUser().getUserid());
|
|
map.put("sign", Md5.md5("System"+"System_an_Feedback"+Md5.secret));
|
|
map.put("app", "System");
|
|
map.put("class", "System_an_Feedback");
|
|
getGankList(ApiConfig.BASE_URL,map, "正在反馈...",view.getId());
|
|
|
|
}
|
|
});
|
|
|
|
mDataBinding.connent.addTextChangedListener(new TextWatcher() {
|
|
@Override
|
|
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
|
|
|
}
|
|
|
|
@Override
|
|
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
|
|
|
}
|
|
|
|
@Override
|
|
public void afterTextChanged(Editable editable) {
|
|
if( mDataBinding.connent.getText().toString().length()>3){
|
|
mDataBinding.comimit.setEnabled(true);
|
|
}else {
|
|
mDataBinding.comimit.setEnabled(false);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
private void getGankList(final String myurl, Map<String, String> map, String string, final int getcode1) {
|
|
progressDialog.setMessage(string);
|
|
|
|
//map.put("")
|
|
progressDialog.setCancelable(false);
|
|
progressDialog.show();
|
|
mDataBinding.getRoot().postDelayed(new Runnable() {
|
|
@Override
|
|
public void run() {
|
|
progressDialog.dismiss();
|
|
//setToast(1, getString(R.string.timeout));
|
|
}
|
|
},13000);
|
|
mGankLoader = new Loader();
|
|
/* Map<String,String> map=new HashMap<String,String>();
|
|
map.put("phone");*/
|
|
Subscription subscription = mGankLoader.getMovie(myurl,map).subscribe(new Action1<Resultcode>() {
|
|
@Override
|
|
public void call(Resultcode resultcode) {
|
|
progressDialog.dismiss();
|
|
//setToast(0,resultcode.status);
|
|
if((!(resultcode.status==0))){
|
|
// setToast(1, resultcode.msg);
|
|
return;
|
|
}
|
|
switch (getcode1) {
|
|
|
|
case R.id.comimit:
|
|
// setToast(0, getString(R.string.loginsucess));
|
|
showToast("提交成功");
|
|
mDataBinding.getRoot().postDelayed(new Runnable() {
|
|
@Override
|
|
public void run() {
|
|
finish();
|
|
}
|
|
},1000);
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}, new Action1<Throwable>() {
|
|
@Override
|
|
public void call(Throwable throwable) {
|
|
progressDialog.dismiss();
|
|
showToast(getString(R.string.getdatafailure));
|
|
throwable.printStackTrace();
|
|
}
|
|
});
|
|
|
|
addSubscription(subscription);
|
|
}
|
|
|
|
private void showToast(String s) {
|
|
Toast toast = Toast.makeText(getApplicationContext(), s, Toast.LENGTH_SHORT);
|
|
toast.setGravity(Gravity.CENTER, 0, 0);
|
|
toast.show();
|
|
|
|
|
|
}
|
|
}
|