Advertisement
ricky_yulianto

Untitled

Apr 10th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.06 KB | None | 0 0
  1. package codelabs.ambarrukmo.activity;
  2.  
  3. import android.content.Intent;
  4. import android.os.AsyncTask;
  5. import android.support.v7.app.AppCompatActivity;
  6. import android.os.Bundle;
  7. import android.support.v7.widget.RecyclerView;
  8. import android.text.TextUtils;
  9. import android.view.View;
  10. import android.widget.Button;
  11. import android.widget.EditText;
  12. import android.widget.ImageView;
  13. import android.widget.TextView;
  14.  
  15. import com.google.gson.JsonSyntaxException;
  16.  
  17. import org.json.JSONException;
  18.  
  19. import java.io.IOException;
  20. import java.util.HashMap;
  21. import java.util.Map;
  22.  
  23. import butterknife.BindInt;
  24. import butterknife.BindView;
  25. import butterknife.ButterKnife;
  26. import butterknife.OnClick;
  27. import codelabs.ambarrukmo.R;
  28. import codelabs.ambarrukmo.connection.ApiUtils;
  29. import codelabs.ambarrukmo.connection.AppConstant;
  30. import codelabs.ambarrukmo.connection.DataManager;
  31. import codelabs.ambarrukmo.connection.RetrofitInterface;
  32. import codelabs.ambarrukmo.model.GetUpdateProfil;
  33. import codelabs.ambarrukmo.utils.RecentUtils;
  34. import retrofit2.Call;
  35. import retrofit2.Response;
  36.  
  37. public class ProfileActivity extends BaseActivity implements View.OnClickListener {
  38.  
  39.  
  40. @BindView(R.id.iv_back)
  41. ImageView ivBack;
  42. // @BindView(R.id.ed_firstname)
  43. // EditText edFirstName;
  44. // @BindView(R.id.ed_lastname)
  45. // EditText edLastName;
  46. // @BindView(R.id.ed_email)
  47. // EditText edEmail;
  48. // @BindView(R.id.ed_password)
  49. // EditText edPassword;
  50. // @BindView(R.id.ed_conf_password)
  51. // EditText edConfPassword;
  52. // @BindView(R.id.btn_save)
  53. // Button btnSave;
  54.  
  55.  
  56.  
  57. @BindView(R.id.tv_change_fullname)
  58. TextView btnChangeFullname;
  59. @BindView(R.id.tv_nama_lengkap)
  60. TextView tvNamaLengkap;
  61. @BindView(R.id.tv_field_email)
  62. TextView tvFieldEmail;
  63. @BindView(R.id.btn_change_email)
  64. ImageView btnChangeEmail;
  65. @BindView(R.id.rv_item_mobile)
  66. RecyclerView rvItemMobile;
  67. @BindView(R.id.btn_add_mobile)
  68. TextView btnAddMobile;
  69. @BindView(R.id.tv_field_password)
  70. TextView tvFieldPassword;
  71. @BindView(R.id.btn_change_password)
  72. ImageView btnChangePwd;
  73. @BindView(R.id.btn_connect_fb)
  74. Button btnConnectFb;
  75.  
  76.  
  77.  
  78.  
  79.  
  80. @Override
  81. protected void onCreate(Bundle savedInstanceState) {
  82. super.onCreate(savedInstanceState);
  83. setContentView(R.layout.activity_profile);
  84. ButterKnife.bind(this);
  85.  
  86. // btnSave.setOnClickListener(this);
  87.  
  88. btnChangeFullname.setOnClickListener(this);
  89.  
  90.  
  91. edFirstName.setText(DataManager.getInstance().getProfile().getFirstname());
  92. edLastName.setText(DataManager.getInstance().getProfile().getLastname());
  93. edEmail.setText(DataManager.getInstance().getEmail());
  94.  
  95. }
  96.  
  97. @Override
  98. public void onClick(View view) {
  99. // if (view == btnSave) {
  100. // doSave();
  101. // }
  102.  
  103. if (view == btnChangeFullname) {
  104. Intent intent = new Intent(ProfileActivity.this, FullnameProfilActivity.class);
  105. startActivity(intent);
  106. }
  107.  
  108. }
  109.  
  110. private void doSave() {
  111. // String firstname = edFirstName.getText().toString();
  112. // String lastname = edLastName.getText().toString();
  113. // String email = edEmail.getText().toString();
  114.  
  115. // if (TextUtils.isEmpty(firstname)) {
  116. // showToast("Please enter first name");
  117. // return;
  118. // }
  119. // if (TextUtils.isEmpty(lastname)) {
  120. // showToast("Please enter last name");
  121. // return;
  122. // }
  123. // if (!RecentUtils.isEmailValid(email)){
  124. // showToast("Please enter valid email address");
  125. // return;
  126. // }
  127.  
  128.  
  129. // Map<String, String> params = new HashMap<>();
  130. // String[] names = name.split("");
  131. //
  132. // params.put("firstname", names[0]);
  133. // if (names.length > 1) {
  134. // params.put("lastname", names[1]);
  135. // } else {
  136. // params.put("lastname", "");
  137. // }
  138.  
  139. // params.put("firstname", firstname);
  140. // params.put("lastname", lastname);
  141. // params.put("email", email);
  142.  
  143. // showDialogProgress("Updating Profile Data");
  144.  
  145. // new NetworkCall().execute(params);
  146. }
  147.  
  148. // private class NetworkCall extends AsyncTask<Map<String, String>, Void, Response<GetUpdateProfil>> {
  149. //
  150. // @Override
  151. // protected Response<GetUpdateProfil> doInBackground(Map<String, String>... params) {
  152. // try {
  153. //
  154. // RetrofitInterface apiService = ApiUtils.getAPIService();
  155. // String auth = AppConstant.AuthValue + DataManager.getInstance().getToken();
  156. // Call<GetUpdateProfil> call = apiService.doUpdateProfile(auth, params[0]);
  157. // Response<GetUpdateProfil> response = call.execute();
  158. // return response;
  159. // } catch (IOException | JsonSyntaxException e) {
  160. // e.printStackTrace();
  161. // }
  162. // return null;
  163. // }
  164.  
  165. // @Override
  166. // protected void onPostExecute(Response<GetUpdateProfil> data) {
  167. // hideDialogProgress();
  168. // if (data!=null) {
  169. // if (data.isSuccessful()) {
  170. // GetUpdateProfil response = data.body();
  171. // if (response != null) {
  172. // if (response.getSTATUS() == 200) {
  173. // showToast(response.getMESSAGE());
  174. // DataManager.getInstance().setLoginData(response.getDATA());
  175. // } else {
  176. // showToast(response.getMESSAGE());
  177. // }
  178. // } else {
  179. // showToast(getString(R.string.no_response));
  180. // }
  181. // } else {
  182. // RecentUtils.handleRetrofitError(data.code());
  183. // }
  184. // }else {
  185. //
  186. // if (RecentUtils.checkInternet()) {
  187. // showToast("Please check internet connection!");
  188. // }
  189. // }
  190. // }
  191. // }
  192.  
  193. @OnClick (R.id.iv_back)
  194. void closeactivity(){
  195. finish();
  196. }
  197. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement