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.replace(R.id.fragment_container, gmapFragment);
ft.commit(); ft.commit();
} else if (id == R.id.nav_personal) { } else if (id == R.id.nav_personal) {
toolbar.setTitle("Personal Notes");
setSupportActionBar(toolbar);
Log.d(TAG, "Before going to personal"); Log.d(TAG, "Before going to personal");
ft.replace(R.id.fragment_container, personalFragment); ft.replace(R.id.fragment_container, personalFragment);
ft.commit(); ft.commit();

View file

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

View file

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

View file

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