Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package codelabs.ambarrukmo.activity;
- import android.content.Intent;
- import android.os.AsyncTask;
- import android.support.v7.app.AppCompatActivity;
- import android.os.Bundle;
- import android.support.v7.widget.RecyclerView;
- import android.text.TextUtils;
- import android.view.View;
- import android.widget.Button;
- import android.widget.EditText;
- import android.widget.ImageView;
- import android.widget.TextView;
- import com.google.gson.JsonSyntaxException;
- import org.json.JSONException;
- import java.io.IOException;
- import java.util.HashMap;
- import java.util.Map;
- import butterknife.BindInt;
- import butterknife.BindView;
- import butterknife.ButterKnife;
- import butterknife.OnClick;
- import codelabs.ambarrukmo.R;
- import codelabs.ambarrukmo.connection.ApiUtils;
- import codelabs.ambarrukmo.connection.AppConstant;
- import codelabs.ambarrukmo.connection.DataManager;
- import codelabs.ambarrukmo.connection.RetrofitInterface;
- import codelabs.ambarrukmo.model.GetUpdateProfil;
- import codelabs.ambarrukmo.utils.RecentUtils;
- import retrofit2.Call;
- import retrofit2.Response;
- public class ProfileActivity extends BaseActivity implements View.OnClickListener {
- @BindView(R.id.iv_back)
- ImageView ivBack;
- // @BindView(R.id.ed_firstname)
- // EditText edFirstName;
- // @BindView(R.id.ed_lastname)
- // EditText edLastName;
- // @BindView(R.id.ed_email)
- // EditText edEmail;
- // @BindView(R.id.ed_password)
- // EditText edPassword;
- // @BindView(R.id.ed_conf_password)
- // EditText edConfPassword;
- // @BindView(R.id.btn_save)
- // Button btnSave;
- @BindView(R.id.tv_change_fullname)
- TextView btnChangeFullname;
- @BindView(R.id.tv_nama_lengkap)
- TextView tvNamaLengkap;
- @BindView(R.id.tv_field_email)
- TextView tvFieldEmail;
- @BindView(R.id.btn_change_email)
- ImageView btnChangeEmail;
- @BindView(R.id.rv_item_mobile)
- RecyclerView rvItemMobile;
- @BindView(R.id.btn_add_mobile)
- TextView btnAddMobile;
- @BindView(R.id.tv_field_password)
- TextView tvFieldPassword;
- @BindView(R.id.btn_change_password)
- ImageView btnChangePwd;
- @BindView(R.id.btn_connect_fb)
- Button btnConnectFb;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_profile);
- ButterKnife.bind(this);
- // btnSave.setOnClickListener(this);
- btnChangeFullname.setOnClickListener(this);
- edFirstName.setText(DataManager.getInstance().getProfile().getFirstname());
- edLastName.setText(DataManager.getInstance().getProfile().getLastname());
- edEmail.setText(DataManager.getInstance().getEmail());
- }
- @Override
- public void onClick(View view) {
- // if (view == btnSave) {
- // doSave();
- // }
- if (view == btnChangeFullname) {
- Intent intent = new Intent(ProfileActivity.this, FullnameProfilActivity.class);
- startActivity(intent);
- }
- }
- private void doSave() {
- // String firstname = edFirstName.getText().toString();
- // String lastname = edLastName.getText().toString();
- // String email = edEmail.getText().toString();
- // if (TextUtils.isEmpty(firstname)) {
- // showToast("Please enter first name");
- // return;
- // }
- // if (TextUtils.isEmpty(lastname)) {
- // showToast("Please enter last name");
- // return;
- // }
- // if (!RecentUtils.isEmailValid(email)){
- // showToast("Please enter valid email address");
- // return;
- // }
- // Map<String, String> params = new HashMap<>();
- // String[] names = name.split("");
- //
- // params.put("firstname", names[0]);
- // if (names.length > 1) {
- // params.put("lastname", names[1]);
- // } else {
- // params.put("lastname", "");
- // }
- // params.put("firstname", firstname);
- // params.put("lastname", lastname);
- // params.put("email", email);
- // showDialogProgress("Updating Profile Data");
- // new NetworkCall().execute(params);
- }
- // private class NetworkCall extends AsyncTask<Map<String, String>, Void, Response<GetUpdateProfil>> {
- //
- // @Override
- // protected Response<GetUpdateProfil> doInBackground(Map<String, String>... params) {
- // try {
- //
- // RetrofitInterface apiService = ApiUtils.getAPIService();
- // String auth = AppConstant.AuthValue + DataManager.getInstance().getToken();
- // Call<GetUpdateProfil> call = apiService.doUpdateProfile(auth, params[0]);
- // Response<GetUpdateProfil> response = call.execute();
- // return response;
- // } catch (IOException | JsonSyntaxException e) {
- // e.printStackTrace();
- // }
- // return null;
- // }
- // @Override
- // protected void onPostExecute(Response<GetUpdateProfil> data) {
- // hideDialogProgress();
- // if (data!=null) {
- // if (data.isSuccessful()) {
- // GetUpdateProfil response = data.body();
- // if (response != null) {
- // if (response.getSTATUS() == 200) {
- // showToast(response.getMESSAGE());
- // DataManager.getInstance().setLoginData(response.getDATA());
- // } else {
- // showToast(response.getMESSAGE());
- // }
- // } else {
- // showToast(getString(R.string.no_response));
- // }
- // } else {
- // RecentUtils.handleRetrofitError(data.code());
- // }
- // }else {
- //
- // if (RecentUtils.checkInternet()) {
- // showToast("Please check internet connection!");
- // }
- // }
- // }
- // }
- @OnClick (R.id.iv_back)
- void closeactivity(){
- finish();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement