mirror of
https://github.com/Nezumi-2711/Foodify.git
synced 2026-09-22 13:38:41 +00:00
Fix some bug and layout
This commit is contained in:
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="17" />
|
||||
<bytecodeTargetLevel target="11" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+1
-1
@@ -7,7 +7,7 @@
|
||||
<option name="testRunner" value="GRADLE" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="jbr-17" />
|
||||
<option name="gradleJvm" value="Embedded JDK" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
|
||||
Generated
+2
-1
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="jbr-11" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
||||
@@ -63,7 +63,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
User userData = response.body();
|
||||
if(userData != null){
|
||||
Common.CURRENT_USER = userData;
|
||||
HomeFragment.setNameUser(Common.CURRENT_USER.getFullName());
|
||||
HomeFragment.setNameUser();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,6 @@ public class MainActivity extends AppCompatActivity {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -127,6 +126,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
viewPager2.setCurrentItem(3);
|
||||
} else {
|
||||
startActivity(new Intent(MainActivity.this, SignInActivity.class));
|
||||
finish();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.capstone.foodify.API.FoodApiToken;
|
||||
import com.capstone.foodify.Common;
|
||||
import com.capstone.foodify.Fragment.HomeFragment;
|
||||
import com.capstone.foodify.Model.User;
|
||||
import com.capstone.foodify.R;
|
||||
import com.google.android.gms.tasks.OnCompleteListener;
|
||||
@@ -163,6 +164,8 @@ public class SignInActivity extends AppCompatActivity {
|
||||
if(task.isSuccessful()){
|
||||
Common.TOKEN = task.getResult().getToken();
|
||||
|
||||
|
||||
|
||||
//Get user from database
|
||||
FoodApiToken.apiService.getUserFromEmail(user.getEmail()).enqueue(new Callback<User>() {
|
||||
@Override
|
||||
@@ -171,6 +174,11 @@ public class SignInActivity extends AppCompatActivity {
|
||||
if(userData != null){
|
||||
Common.CURRENT_USER = userData;
|
||||
}
|
||||
|
||||
//Dismiss progress bar
|
||||
progressLayout.setVisibility(View.GONE);
|
||||
|
||||
startActivity(new Intent(SignInActivity.this, MainActivity.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -179,11 +187,6 @@ public class SignInActivity extends AppCompatActivity {
|
||||
Common.showErrorServerNotification(SignInActivity.this);
|
||||
}
|
||||
});
|
||||
|
||||
//Dismiss progress bar
|
||||
progressLayout.setVisibility(View.GONE);
|
||||
|
||||
startActivity(new Intent(SignInActivity.this, MainActivity.class));
|
||||
} else {
|
||||
Toast.makeText(SignInActivity.this, "Error when taking token!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@@ -244,6 +244,8 @@ public class VerifyAccountActivity extends AppCompatActivity {
|
||||
@Override
|
||||
public void onResponse(Call<User> call, Response<User> response) {
|
||||
|
||||
|
||||
|
||||
progressLayout.setVisibility(View.GONE);
|
||||
//Create user success;
|
||||
Toast.makeText(VerifyAccountActivity.this, "Tạo tài khoản thành công!", Toast.LENGTH_SHORT).show();
|
||||
|
||||
@@ -90,7 +90,13 @@ public class HomeFragment extends Fragment {
|
||||
System.out.println("Main activity destroy!");
|
||||
}
|
||||
|
||||
public static void setNameUser(String name){
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
setNameUser();
|
||||
}
|
||||
|
||||
public static void setNameUser(){
|
||||
//Set name user while user already login
|
||||
if(Common.CURRENT_USER != null)
|
||||
welcomeText.setText("Xin chào, " + Common.CURRENT_USER.getFullName() + "!");
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
<TextView
|
||||
android:id="@+id/food_name_text_view"
|
||||
android:text="@string/food_name"
|
||||
android:textSize="18sp"
|
||||
android:textSize="15sp"
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:layout_width="match_parent"
|
||||
@@ -88,14 +88,14 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="0.6"
|
||||
android:layout_weight="0.49"
|
||||
android:layout_marginStart="5dp"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/shop_name_text_view"
|
||||
android:text="Shop Name"
|
||||
android:textSize="16sp"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/secondary"
|
||||
android:fontFamily="@font/opensans"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -107,14 +107,13 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/price_text_view"
|
||||
android:text="$5.00"
|
||||
android:textSize="25sp"
|
||||
android:textColor="@color/primaryColor"
|
||||
android:fontFamily="@font/bebas"
|
||||
android:layout_width="220dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp"
|
||||
/>
|
||||
android:fontFamily="@font/bebas"
|
||||
android:text="$5.00"
|
||||
android:textColor="@color/primaryColor"
|
||||
android:textSize="20sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<com.cepheuen.elegantnumberbutton.view.ElegantNumberButton
|
||||
@@ -124,7 +123,7 @@
|
||||
app:backGroundColor="@color/white"
|
||||
app:textColor="@color/primaryColor"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="0.43"
|
||||
android:layout_weight="0.5"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
Reference in New Issue
Block a user