Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add photo edit icon to self profile. #238

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

Expand All @@ -42,8 +43,8 @@
import me.grishka.houseclub.api.methods.Me;
import me.grishka.houseclub.api.methods.Unfollow;
import me.grishka.houseclub.api.methods.UpdateBio;
import me.grishka.houseclub.api.methods.UpdatePhoto;
import me.grishka.houseclub.api.methods.UpdateName;
import me.grishka.houseclub.api.methods.UpdatePhoto;
import me.grishka.houseclub.api.model.FullUser;

public class ProfileFragment extends LoaderFragment{
Expand All @@ -54,17 +55,19 @@ public class ProfileFragment extends LoaderFragment{

private TextView name, username, followers, following, followsYou, bio, inviteInfo, twitter, instagram,
invites;
private ImageView photo, inviterPhoto;
private ImageView photo, photo_edit_icon,inviterPhoto;
private Button followBtn, inviteButton;
private EditText invitePhoneNum;
private View socialButtons, inviteLayout;
private boolean self;


@Override
public void onAttach(Activity activity){
super.onAttach(activity);
loadData();
self=getArguments().getInt("id")==Integer.parseInt(ClubhouseSession.userID);
isImageFitToScreen=true;
if(self)
setHasOptionsMenu(true);
}
Expand Down Expand Up @@ -98,11 +101,16 @@ public View onCreateContentView(LayoutInflater inflater, ViewGroup container, Bu
following.setOnClickListener(this::onFollowingClick);
v.findViewById(R.id.inviter_btn).setOnClickListener(this::onInviterClick);
if(self){
photo_edit_icon=v.findViewById(R.id.photo_edit_icon);
photo_edit_icon.setVisibility(View.VISIBLE);
bio.setOnClickListener(this::onBioClick);
photo.setOnClickListener(this::onPhotoClick);
name.setOnClickListener(this::onNameClick);
inviteButton.setOnClickListener(this::onInviteClick);
}
else {
photo.setOnClickListener(this::onForeignPhotoClick);
}

return v;
}
Expand Down Expand Up @@ -415,4 +423,15 @@ private void onPhotoClick(View v){
intent.setType("image/*");
startActivityForResult(intent, PICK_PHOTO_RESULT);
}
private void onForeignPhotoClick(View view) {
if(isImageFitToScreen) {
isImageFitToScreen=false;
photo.setLayoutParams(new LinearLayout.LayoutParams((int) (272 * (getResources().getDisplayMetrics().density)), (int) (272 * (getResources().getDisplayMetrics().density))));
photo.setAdjustViewBounds(true);
}else{
isImageFitToScreen=true;
photo.setLayoutParams(new LinearLayout.LayoutParams((int) (72 * (getResources().getDisplayMetrics().density)), (int) (72 * (getResources().getDisplayMetrics().density))));
photo.setScaleType(ImageView.ScaleType.FIT_XY);
}
}
}
13 changes: 13 additions & 0 deletions Houseclub/src/main/res/drawable/ic_photo_camera.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#000"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0" />
<path
android:fillColor="@android:color/white"
android:pathData="M9,2L7.17,4L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2L9,2zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z" />
</vector>
Loading