mirror of
https://github.com/Nezumi-2711/Foodify.git
synced 2026-09-22 13:38:41 +00:00
Add, change avatar image for user
This commit is contained in:
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
||||
@@ -47,6 +47,7 @@ dependencies {
|
||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'com.google.firebase:firebase-auth:21.1.0'
|
||||
implementation 'com.google.firebase:firebase-storage:20.1.0'
|
||||
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
package com.capstone.foodify.Activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.DatePickerDialog;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.webkit.MimeTypeMap;
|
||||
import android.widget.Button;
|
||||
import android.widget.DatePicker;
|
||||
import android.widget.EditText;
|
||||
@@ -11,14 +15,29 @@ import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.activity.result.ActivityResult;
|
||||
import androidx.activity.result.ActivityResultCallback;
|
||||
import androidx.activity.result.ActivityResultLauncher;
|
||||
import androidx.activity.result.contract.ActivityResultContracts;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.capstone.foodify.API.FoodApiToken;
|
||||
import com.capstone.foodify.Common;
|
||||
import com.capstone.foodify.Model.User;
|
||||
import com.capstone.foodify.R;
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
import com.google.android.gms.tasks.OnCompleteListener;
|
||||
import com.google.android.gms.tasks.OnFailureListener;
|
||||
import com.google.android.gms.tasks.OnSuccessListener;
|
||||
import com.google.android.gms.tasks.Task;
|
||||
import com.google.android.material.textfield.TextInputLayout;
|
||||
import com.google.firebase.storage.FirebaseStorage;
|
||||
import com.google.firebase.storage.OnProgressListener;
|
||||
import com.google.firebase.storage.StorageReference;
|
||||
import com.google.firebase.storage.UploadTask;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
@@ -30,13 +49,17 @@ import retrofit2.Response;
|
||||
|
||||
public class AccountAndProfileActivity extends AppCompatActivity {
|
||||
|
||||
private static final String FOLDER_DIRECTORY = "UserImages/";
|
||||
TextInputLayout textInput_email, textInput_phone, textInput_fullName, textInput_birthDay;
|
||||
|
||||
EditText edt_birthday, edt_email, edt_phone, edt_fullName;
|
||||
final Calendar myCalendar= Calendar.getInstance();
|
||||
LinearLayout change_password;
|
||||
Button update_button;
|
||||
Button update_button, update_image_button;
|
||||
ImageView back_image;
|
||||
RoundedImageView profile_avatar;
|
||||
private Uri imageUri;
|
||||
final private StorageReference storageReference = FirebaseStorage.getInstance().getReference();
|
||||
ConstraintLayout progressLayout;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -68,10 +91,100 @@ public class AccountAndProfileActivity extends AppCompatActivity {
|
||||
update_button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
updateUser();
|
||||
progressLayout.setVisibility(View.VISIBLE);
|
||||
if(imageUri != null)
|
||||
uploadToFirebase(imageUri);
|
||||
else
|
||||
updateUser(null);
|
||||
}
|
||||
});
|
||||
|
||||
//Activity choose image
|
||||
ActivityResultLauncher<Intent> activityResultLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(),
|
||||
new ActivityResultCallback<ActivityResult>() {
|
||||
@Override
|
||||
public void onActivityResult(ActivityResult result) {
|
||||
if(result.getResultCode() == Activity.RESULT_OK){
|
||||
Intent data = result.getData();
|
||||
imageUri = data.getData();
|
||||
profile_avatar.setImageURI(imageUri);
|
||||
|
||||
Toast.makeText(AccountAndProfileActivity.this, "Hãy bấm nút cập nhật phía dưới để thay đổi có hiệu lực!", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Toast.makeText(AccountAndProfileActivity.this, "Không ảnh nào được chọn!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//Set event on button upload image avatar
|
||||
update_image_button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent photoPicker = new Intent();
|
||||
photoPicker.setAction(Intent.ACTION_GET_CONTENT);
|
||||
photoPicker.setType("image/*");
|
||||
activityResultLauncher.launch(photoPicker);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void uploadToFirebase(Uri uri){
|
||||
|
||||
//Name of image user
|
||||
String imageName = Common.CURRENT_USER.getFullName().replace(" " , "_") + "_" + Common.CURRENT_USER.getDateOfBirth().replace("-", "_")
|
||||
+ "_" + System.currentTimeMillis();
|
||||
|
||||
final StorageReference imageReference = storageReference.child(FOLDER_DIRECTORY + imageName + "." + getFileExtension(uri));
|
||||
imageReference.putFile(uri).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
|
||||
@Override
|
||||
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
|
||||
imageReference.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
|
||||
@Override
|
||||
public void onSuccess(Uri uri) {
|
||||
if(!Common.CURRENT_USER.getImageUrl().isEmpty())
|
||||
deleteOldImage();
|
||||
|
||||
updateUser(uri.toString());
|
||||
|
||||
Toast.makeText(AccountAndProfileActivity.this, "Upload ảnh thành công!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}).addOnProgressListener(new OnProgressListener<UploadTask.TaskSnapshot>() {
|
||||
@Override
|
||||
public void onProgress(@NonNull UploadTask.TaskSnapshot snapshot) {
|
||||
|
||||
}
|
||||
}).addOnFailureListener(new OnFailureListener() {
|
||||
@Override
|
||||
public void onFailure(@NonNull Exception e) {
|
||||
|
||||
Toast.makeText(AccountAndProfileActivity.this, "Failed", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void deleteOldImage() {
|
||||
StorageReference storageReference = FirebaseStorage.getInstance().getReferenceFromUrl(Common.CURRENT_USER.getImageUrl());
|
||||
|
||||
storageReference.delete().addOnCompleteListener(new OnCompleteListener<Void>() {
|
||||
@Override
|
||||
public void onComplete(@NonNull Task<Void> task) {
|
||||
Toast.makeText(AccountAndProfileActivity.this, "Delete old image successfully!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}).addOnFailureListener(new OnFailureListener() {
|
||||
@Override
|
||||
public void onFailure(@NonNull Exception e) {
|
||||
Toast.makeText(AccountAndProfileActivity.this, "Can't delete old image!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private String getFileExtension(Uri fileUri){
|
||||
ContentResolver contentResolver = getContentResolver();
|
||||
MimeTypeMap mime = MimeTypeMap.getSingleton();
|
||||
return mime.getExtensionFromMimeType(contentResolver.getType(fileUri));
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
@@ -79,11 +192,17 @@ public class AccountAndProfileActivity extends AppCompatActivity {
|
||||
edt_phone.setText(Common.CURRENT_USER.getPhoneNumber());
|
||||
edt_fullName.setText(Common.CURRENT_USER.getFullName());
|
||||
edt_birthday.setText(Common.CURRENT_USER.getDateOfBirth());
|
||||
|
||||
//Set image for user
|
||||
if(Common.CURRENT_USER.getImageUrl().isEmpty()){
|
||||
profile_avatar.setImageResource(R.drawable.profile_avatar);
|
||||
} else {
|
||||
Picasso.get().load(Common.CURRENT_USER.getImageUrl()).into(profile_avatar);
|
||||
}
|
||||
}
|
||||
|
||||
private void initComponent() {
|
||||
//Init Component
|
||||
|
||||
textInput_email= findViewById(R.id.textInput_email);
|
||||
textInput_phone = findViewById(R.id.textInput_phone);
|
||||
textInput_fullName = findViewById(R.id.textInput_fullName);
|
||||
@@ -91,6 +210,7 @@ public class AccountAndProfileActivity extends AppCompatActivity {
|
||||
change_password = findViewById(R.id.change_password);
|
||||
|
||||
update_button = findViewById(R.id.updated_button);
|
||||
update_image_button = findViewById(R.id.change_image_button);
|
||||
|
||||
back_image = findViewById(R.id.back_image);
|
||||
|
||||
@@ -98,6 +218,10 @@ public class AccountAndProfileActivity extends AppCompatActivity {
|
||||
edt_email = findViewById(R.id.edt_email);
|
||||
edt_phone = findViewById(R.id.edt_phone);
|
||||
edt_fullName = findViewById(R.id.edt_fullName);
|
||||
|
||||
profile_avatar = findViewById(R.id.profile_avatar);
|
||||
|
||||
progressLayout = findViewById(R.id.progress_layout);
|
||||
}
|
||||
|
||||
private void setFontUI() {
|
||||
@@ -139,7 +263,7 @@ public class AccountAndProfileActivity extends AppCompatActivity {
|
||||
edt_birthday.setText(dateFormat.format(myCalendar.getTime()));
|
||||
}
|
||||
|
||||
private void updateUser() {
|
||||
private void updateUser(String imageUrl) {
|
||||
//Get data from form
|
||||
String fullName = edt_fullName.getText().toString();
|
||||
String dateOfBirth = edt_birthday.getText().toString();
|
||||
@@ -147,16 +271,20 @@ public class AccountAndProfileActivity extends AppCompatActivity {
|
||||
//Create object User
|
||||
Common.CURRENT_USER.setFullName(fullName);
|
||||
Common.CURRENT_USER.setDateOfBirth(dateOfBirth);
|
||||
if(imageUrl != null)
|
||||
Common.CURRENT_USER.setImageUrl(imageUrl);
|
||||
|
||||
FoodApiToken.apiService.updateUser(Common.CURRENT_USER.getId(), Common.CURRENT_USER).enqueue(new Callback<User>() {
|
||||
@Override
|
||||
public void onResponse(Call<User> call, Response<User> response) {
|
||||
Toast.makeText(AccountAndProfileActivity.this, "Cập nhật thành công!", Toast.LENGTH_SHORT).show();
|
||||
progressLayout.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<User> call, Throwable t) {
|
||||
Common.showErrorServerNotification(AccountAndProfileActivity.this);
|
||||
progressLayout.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.capstone.foodify.Fragment;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -23,9 +24,11 @@ import com.capstone.foodify.Activity.SignUpActivity;
|
||||
import com.capstone.foodify.Common;
|
||||
import com.capstone.foodify.R;
|
||||
import com.google.firebase.auth.FirebaseAuth;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.saadahmedsoft.popupdialog.PopupDialog;
|
||||
import com.saadahmedsoft.popupdialog.Styles;
|
||||
import com.saadahmedsoft.popupdialog.listener.OnDialogButtonClickListener;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
||||
import io.paperdb.Paper;
|
||||
|
||||
@@ -33,6 +36,7 @@ public class ProfileFragment extends Fragment {
|
||||
LinearLayout account_and_profile, manage_address, favorite_food, order_history, log_out;
|
||||
PopupDialog popupDialog;
|
||||
TextView user_name;
|
||||
RoundedImageView profile_avatar;
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
@@ -46,12 +50,20 @@ public class ProfileFragment extends Fragment {
|
||||
order_history = rootView.findViewById(R.id.order_history);
|
||||
log_out = rootView.findViewById(R.id.log_out);
|
||||
user_name = rootView.findViewById(R.id.user_name);
|
||||
profile_avatar = rootView.findViewById(R.id.profile_avatar);
|
||||
|
||||
popupDialog = PopupDialog.getInstance(getContext());
|
||||
|
||||
//Set user name on textview
|
||||
user_name.setText(Common.CURRENT_USER.getFullName());
|
||||
|
||||
//Set image for user
|
||||
if(Common.CURRENT_USER.getImageUrl().isEmpty()){
|
||||
profile_avatar.setImageResource(R.drawable.profile_avatar);
|
||||
} else {
|
||||
Picasso.get().load(Common.CURRENT_USER.getImageUrl()).into(profile_avatar);
|
||||
}
|
||||
|
||||
account_and_profile.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
||||
@@ -6,185 +6,241 @@
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".Activity.AccountAndProfileActivity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back_image"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:src="@drawable/back_button"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="25dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:fontFamily="@font/bebas"
|
||||
android:text="@string/account_and_profile"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="40sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/back_image" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/textInput_email"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:hint="@string/email_text"
|
||||
app:boxBackgroundColor="@color/white"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/textInput_phone"
|
||||
app:startIconDrawable="@drawable/baseline_email_24"
|
||||
app:startIconTint="@color/primaryColor">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edt_email"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:inputType="textEmailAddress"
|
||||
android:enabled="false"
|
||||
/>
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/textInput_phone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:hint="@string/phone_text"
|
||||
app:boxBackgroundColor="@color/white"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/textInput_fullName"
|
||||
app:startIconDrawable="@drawable/baseline_phone_24"
|
||||
app:startIconTint="@color/primaryColor">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edt_phone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:inputType="phone"
|
||||
android:enabled="false"
|
||||
/>
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/textInput_fullName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:hint="@string/full_name"
|
||||
app:boxBackgroundColor="@color/white"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/textInput_birthDay"
|
||||
app:startIconDrawable="@drawable/baseline_abc_24"
|
||||
app:startIconTint="@color/primaryColor">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edt_fullName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:inputType="text"
|
||||
/>
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/textInput_birthDay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginBottom="40dp"
|
||||
android:hint="@string/birthday_text"
|
||||
app:boxBackgroundColor="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/change_password"
|
||||
app:startIconDrawable="@drawable/baseline_calendar_month_24"
|
||||
app:startIconTint="@color/primaryColor">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edt_birthDay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="false"
|
||||
android:cursorVisible="false"
|
||||
android:focusable="false"
|
||||
android:focusableInTouchMode="false"
|
||||
/>
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/change_password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="80dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/updated_button"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:orientation="horizontal"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="false"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ic_pencil"
|
||||
android:src="@drawable/baseline_vpn_key_24"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:ignore="ContentDescription"
|
||||
app:tint="@color/primaryColor"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:text="@string/change_password"
|
||||
android:textSize="18sp"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textColor="@color/black"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_weight="1"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back_image"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:rotation="180"
|
||||
android:src="@drawable/back_button"
|
||||
tools:ignore="ContentDescription" />
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="25dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:fontFamily="@font/bebas"
|
||||
android:text="@string/account_and_profile"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="40sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/back_image" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/updated_button"
|
||||
style="@style/DefaultSolid"
|
||||
android:fontFamily="@font/bebas"
|
||||
android:text="@string/updated"
|
||||
android:textSize="20sp"
|
||||
android:padding="10dp"
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_marginEnd="40dp"
|
||||
android:layout_marginBottom="17dp"
|
||||
<com.makeramen.roundedimageview.RoundedImageView
|
||||
android:id="@+id/profile_avatar"
|
||||
android:src="@drawable/profile_avatar"
|
||||
android:layout_marginTop="15dp"
|
||||
app:riv_corner_radius="180dp"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:scaleType="centerCrop"
|
||||
app:layout_constraintTop_toBottomOf="@id/textView"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/change_image_button"
|
||||
android:text="Đổi ảnh"
|
||||
android:textColor="@color/white"
|
||||
android:fontFamily="@font/bebas"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/profile_avatar"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
/>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/textInput_email"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:hint="@string/email_text"
|
||||
app:boxBackgroundColor="@color/white"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/textInput_phone"
|
||||
app:startIconDrawable="@drawable/baseline_email_24"
|
||||
app:startIconTint="@color/primaryColor">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edt_email"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:inputType="textEmailAddress"
|
||||
android:enabled="false"
|
||||
/>
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/textInput_phone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:hint="@string/phone_text"
|
||||
app:boxBackgroundColor="@color/white"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/textInput_fullName"
|
||||
app:startIconDrawable="@drawable/baseline_phone_24"
|
||||
app:startIconTint="@color/primaryColor">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edt_phone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:inputType="phone"
|
||||
android:enabled="false"
|
||||
/>
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/textInput_fullName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:hint="@string/full_name"
|
||||
app:boxBackgroundColor="@color/white"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/textInput_birthDay"
|
||||
app:startIconDrawable="@drawable/baseline_abc_24"
|
||||
app:startIconTint="@color/primaryColor">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edt_fullName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:inputType="text"
|
||||
/>
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/textInput_birthDay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
android:layout_marginBottom="40dp"
|
||||
android:hint="@string/birthday_text"
|
||||
app:boxBackgroundColor="@color/white"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/change_password"
|
||||
app:startIconDrawable="@drawable/baseline_calendar_month_24"
|
||||
app:startIconTint="@color/primaryColor">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edt_birthDay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="false"
|
||||
android:cursorVisible="false"
|
||||
android:focusable="false"
|
||||
android:focusableInTouchMode="false"
|
||||
/>
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/change_password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="30dp"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginEnd="20dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/updated_button"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ic_pencil"
|
||||
android:src="@drawable/baseline_vpn_key_24"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:ignore="ContentDescription"
|
||||
app:tint="@color/primaryColor"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:text="@string/change_password"
|
||||
android:textSize="18sp"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:textColor="@color/black"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_weight="1"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:rotation="180"
|
||||
android:src="@drawable/back_button"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/updated_button"
|
||||
style="@style/DefaultSolid"
|
||||
android:fontFamily="@font/bebas"
|
||||
android:text="@string/updated"
|
||||
android:textSize="20sp"
|
||||
android:padding="10dp"
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_marginEnd="40dp"
|
||||
android:layout_marginBottom="17dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
android:layout_height="match_parent"
|
||||
android:background="#80000000"
|
||||
android:id="@+id/progress_layout"
|
||||
android:clickable="true"
|
||||
android:visibility="gone"
|
||||
>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressBarLoadData"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminateTint="@color/primaryColor"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in New Issue
Block a user