This commit is contained in:
Matan Bar Yosef 2016-07-09 19:04:27 +03:00
commit 86352c8669
4 changed files with 12 additions and 19 deletions

View file

@ -161,7 +161,8 @@ public class MainActivity extends AppCompatActivity
ft.replace(R.id.fragment_container, gmapFragment);
ft.commit();
} else if (id == R.id.nav_personal) {
toolbar.setTitle("Personal Notes");
setSupportActionBar(toolbar);
Log.d(TAG, "Before going to personal");
ft.replace(R.id.fragment_container, personalFragment);
ft.commit();

View file

@ -65,14 +65,11 @@ public class SettingsFragment extends Fragment implements View.OnClickListener,
this.parent = (MainActivity)getActivity();
Utils.showLoadingDialog(parent, "Just a sec...", "");
this.user = parent.getUser();
Log.d(TAG, "onCreateView: "+user.toString());
this.cameraBtn = (ImageButton) view.findViewById(R.id.btn_camera);
this.cameraBtn.setOnClickListener(this);
this.avatarImage = (ImageView) view.findViewById(R.id.settings_userAvater_iamgeView);
this.txt_email = (EditText)view.findViewById(R.id.txt_email);
this.txt_email.addTextChangedListener(this);
this.txt_password = (EditText)view.findViewById(R.id.txt_password);
this.txt_password.addTextChangedListener(this);
this.txt_username = (EditText)view.findViewById(R.id.txt_username);
this.lbl_num_of_notes = (TextView)view.findViewById(R.id.lbl_num_of_notes);
this.lbl_num_of_liked = (TextView)view.findViewById(R.id.lbl_num_of_liked);
@ -85,12 +82,13 @@ public class SettingsFragment extends Fragment implements View.OnClickListener,
Utils.URLtoImageView(avatarImage, user.getAvatar());
this.txt_username.setText(""+user.getUsername());
this.txt_password.setText(""+user.getPassword());
Log.d(TAG, "onCreateView: The FUCKING EMAIL IS --------------->>>" + user.getEmail());
this.txt_email.setText(""+user.getEmail());
this.txt_email.setText(""+parent.getUser().getEmail());
this.lbl_num_of_notes.setText(""+user.getNumber_of_notes()); //TODO
this.lbl_num_of_liked.setText(""+user.getLiked_notes().size());
this.txt_password.addTextChangedListener(this);
this.txt_email.addTextChangedListener(this);
Utils.dismissLoadingDialog();
return view;

View file

@ -63,6 +63,7 @@ public class User {
break;
}
}
Log.d(TAG, "User: Constructor Created:\n"+this.toString());
}
public int getNumber_of_notes() {
@ -90,7 +91,7 @@ public class User {
}
public String getEmail() {
return email;
return this.email;
}
public void setEmail(String email) {
@ -109,18 +110,11 @@ public class User {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public Vector<String> getLiked_notes() {
return liked_notes;
}
public void setLiked_notes(Vector<String> liked_notes) {
this.liked_notes = liked_notes;
}
private void createArrayNotes(String s) {
Log.d(TAG, "createArrayNotes:" + s);
String[] noteIds = s.split("\\|");
@ -128,7 +122,6 @@ public class User {
Log.d(TAG, "createArrayNotes: Note ID " + i + ": " + noteIds[i]);
liked_notes.add(noteIds[i]);
}
Log.d(TAG, "createArrayNotes: =================: == Done With Note IDS");
}
public String Serialise(){
@ -151,13 +144,11 @@ public class User {
}
public void updateUser(final MainActivity activity){
Log.d(TAG, "updateUser: ================================");
VolleyUtilSingleton.getInstance(activity).post(Utils.BASE_URL + "/user/upsert", this.toJSON(), new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
try {
if(response.get("status").equals("OK")){
Log.d(TAG, "onResponse: In OKOKOKOK");
activity.updateNavAvatar();
Utils.updateUserSharedPref(self.Serialise());
activity.updateNavAvatar();

View file

@ -47,7 +47,7 @@
android:ems="10"
android:id="@+id/txt_email"
android:hint="Email"
android:inputType="none|text" />
android:inputType="textEmailAddress" />
</LinearLayout>
<RelativeLayout
@ -130,7 +130,10 @@
android:id="@+id/btn_save"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_marginEnd="29dp" />
android:layout_marginEnd="29dp"
android:background="@color/colorPrimary"
android:textColor="#ffffff"
android:padding="10dp" />
</RelativeLayout>
</LinearLayout>