mirror of
https://github.com/Nezumi-2711/Foodify.git
synced 2026-09-22 13:38:41 +00:00
Refactor Code
This commit is contained in:
@@ -13,6 +13,7 @@ import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.capstone.foodify.Common;
|
||||
import com.capstone.foodify.R;
|
||||
import com.google.android.material.textfield.TextInputLayout;
|
||||
|
||||
@@ -71,15 +72,12 @@ public class AccountAndProfileActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
private void setFontUI() {
|
||||
Typeface bebas= Typeface.createFromAsset(getAssets(), "font/bebas.ttf");
|
||||
textInput_email.setTypeface(Common.setFontBebas(getAssets()));
|
||||
textInput_phone.setTypeface(Common.setFontBebas(getAssets()));
|
||||
textInput_fullName.setTypeface(Common.setFontBebas(getAssets()));
|
||||
textInput_birthDay.setTypeface(Common.setFontBebas(getAssets()));
|
||||
|
||||
//Set Type face
|
||||
textInput_email.setTypeface(bebas);
|
||||
textInput_phone.setTypeface(bebas);
|
||||
textInput_fullName.setTypeface(bebas);
|
||||
textInput_birthDay.setTypeface(bebas);
|
||||
|
||||
edt_birthday.setTypeface(bebas);
|
||||
edt_birthday.setTypeface(Common.setFontBebas(getAssets()));
|
||||
}
|
||||
|
||||
private void chooseDateOfBirth() {
|
||||
|
||||
@@ -19,6 +19,7 @@ import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.capstone.foodify.API.FoodApi;
|
||||
import com.capstone.foodify.Common;
|
||||
import com.capstone.foodify.Model.Address.Address;
|
||||
import com.capstone.foodify.Model.Address.AddressAdapter;
|
||||
import com.capstone.foodify.Model.DistrictWard.DistrictWardResponse;
|
||||
@@ -93,7 +94,6 @@ public class AddressManagerActivity extends AppCompatActivity {
|
||||
|
||||
private void showAddAddressDialog(){
|
||||
View view = LayoutInflater.from(this).inflate(R.layout.add_address_dialog,null);
|
||||
Typeface bebas= Typeface.createFromAsset(getAssets(), "font/opensans.ttf");
|
||||
|
||||
//Init component
|
||||
TextInputLayout textInputLayout = view.findViewById(R.id.textInput_address);
|
||||
@@ -101,7 +101,7 @@ public class AddressManagerActivity extends AppCompatActivity {
|
||||
districtSpinner = view.findViewById(R.id.district);
|
||||
|
||||
//Set font
|
||||
textInputLayout.setTypeface(bebas);
|
||||
textInputLayout.setTypeface(Common.setFontOpenSans(getAssets()));
|
||||
|
||||
//Load district and ward
|
||||
if(districtList.size() == 0){
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.capstone.foodify.Common;
|
||||
import com.capstone.foodify.R;
|
||||
import com.google.android.material.textfield.TextInputLayout;
|
||||
|
||||
@@ -42,10 +43,8 @@ public class ChangePasswordActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
private void setFontUI() {
|
||||
Typeface bebas= Typeface.createFromAsset(getAssets(), "font/bebas.ttf");
|
||||
|
||||
textInput_password.setTypeface(bebas);
|
||||
textInput_old_password.setTypeface(bebas);
|
||||
textInput_password_confirm.setTypeface(bebas);
|
||||
textInput_password.setTypeface(Common.setFontBebas(getAssets()));
|
||||
textInput_old_password.setTypeface(Common.setFontBebas(getAssets()));
|
||||
textInput_password_confirm.setTypeface(Common.setFontBebas(getAssets()));
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.capstone.foodify.Common;
|
||||
import com.capstone.foodify.R;
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
import com.google.android.material.textfield.TextInputLayout;
|
||||
@@ -44,11 +45,8 @@ public class ForgotPasswordActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
private void setFontUI() {
|
||||
Typeface bebas= Typeface.createFromAsset(getAssets(), "font/bebas.ttf");
|
||||
|
||||
textInput_account = (TextInputLayout) findViewById(R.id.textInput_account);
|
||||
|
||||
textInput_account.setTypeface(bebas);
|
||||
textInput_account.setTypeface(Common.setFontBebas(getAssets()));
|
||||
}
|
||||
|
||||
private void initComponent() {
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.capstone.foodify.Common;
|
||||
import com.capstone.foodify.R;
|
||||
import com.google.android.material.textfield.TextInputLayout;
|
||||
|
||||
@@ -33,11 +34,8 @@ public class ResetPasswordActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
private void setFontUI() {
|
||||
Typeface bebas= Typeface.createFromAsset(getAssets(), "font/bebas.ttf");
|
||||
|
||||
textInput_password.setTypeface(bebas);
|
||||
textInput_confirmPassword.setTypeface(bebas);
|
||||
//1587.57
|
||||
textInput_password.setTypeface(Common.setFontBebas(getAssets()));
|
||||
textInput_confirmPassword.setTypeface(Common.setFontBebas(getAssets()));
|
||||
}
|
||||
|
||||
private void initComponent() {
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.capstone.foodify.Common;
|
||||
import com.capstone.foodify.R;
|
||||
import com.google.android.material.textfield.TextInputLayout;
|
||||
|
||||
@@ -56,10 +57,8 @@ public class SignInActivity extends AppCompatActivity {
|
||||
back_image = (ImageView) findViewById(R.id.back_image);
|
||||
}
|
||||
private void setFontUI() {
|
||||
Typeface bebas= Typeface.createFromAsset(getAssets(), "font/bebas.ttf");
|
||||
|
||||
textInput_account.setTypeface(bebas);
|
||||
textInput_password.setTypeface(bebas);
|
||||
textInput_account.setTypeface(Common.setFontBebas(getAssets()));
|
||||
textInput_password.setTypeface(Common.setFontBebas(getAssets()));
|
||||
}
|
||||
|
||||
// this event will enable the back
|
||||
|
||||
@@ -19,6 +19,7 @@ import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.capstone.foodify.API.FoodApi;
|
||||
import com.capstone.foodify.Common;
|
||||
import com.capstone.foodify.Model.DistrictWard.DistrictWardResponse;
|
||||
import com.capstone.foodify.R;
|
||||
import com.google.android.material.textfield.TextInputLayout;
|
||||
@@ -238,17 +239,14 @@ public class SignUpActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
private void setFontUI() {
|
||||
Typeface bebas= Typeface.createFromAsset(getAssets(), "font/bebas.ttf");
|
||||
textInput_email.setTypeface(Common.setFontBebas(getAssets()));
|
||||
textInput_password.setTypeface(Common.setFontBebas(getAssets()));
|
||||
textInput_phone.setTypeface(Common.setFontBebas(getAssets()));
|
||||
textInput_address.setTypeface(Common.setFontBebas(getAssets()));
|
||||
textInput_repeatPassword.setTypeface(Common.setFontBebas(getAssets()));
|
||||
textInput_fullName.setTypeface(Common.setFontBebas(getAssets()));
|
||||
textInput_birthDay.setTypeface(Common.setFontBebas(getAssets()));
|
||||
|
||||
//Set Type face
|
||||
textInput_email.setTypeface(bebas);
|
||||
textInput_password.setTypeface(bebas);
|
||||
textInput_phone.setTypeface(bebas);
|
||||
textInput_address.setTypeface(bebas);
|
||||
textInput_repeatPassword.setTypeface(bebas);
|
||||
textInput_fullName.setTypeface(bebas);
|
||||
textInput_birthDay.setTypeface(bebas);
|
||||
|
||||
edt_birthday.setTypeface(bebas);
|
||||
edt_birthday.setTypeface(Common.setFontBebas(getAssets()));
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
package com.capstone.foodify;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.AssetManager;
|
||||
import android.graphics.Typeface;
|
||||
|
||||
import com.capstone.foodify.Model.Basket.Basket;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
@@ -15,4 +19,12 @@ public class Common {
|
||||
NumberFormat fmt = NumberFormat.getCurrencyInstance(locale);
|
||||
return fmt.format(price);
|
||||
}
|
||||
|
||||
public static Typeface setFontBebas(AssetManager assetManager){
|
||||
return Typeface.createFromAsset(assetManager, "font/bebas.ttf");
|
||||
}
|
||||
|
||||
public static Typeface setFontOpenSans(AssetManager assetManager){
|
||||
return Typeface.createFromAsset(assetManager, "font/opensans.ttf");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user