This commit is contained in:
Nezumi2711
2022-06-11 11:34:40 +07:00
parent 89e46b6bd3
commit 45bba79f4d
5 changed files with 20 additions and 19 deletions
+9 -3
View File
@@ -51,13 +51,19 @@
android:theme="@style/Theme.Foodify.NoActionBar" />
<activity
android:name=".SignUp"
android:exported="false" />
android:exported="false"
android:theme="@style/Theme.Foodify.NoActionBar" />
/>
<activity
android:name=".SignIn"
android:exported="false" />
android:exported="false"
android:theme="@style/Theme.Foodify.NoActionBar" />
/>
<activity
android:name=".Welcome"
android:exported="true">
android:exported="true"
android:theme="@style/Theme.Foodify.NoActionBar"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -34,7 +34,7 @@ import com.waterbase.foodify.ViewHolder.MenuViewHolder;
import io.paperdb.Paper;
public class Home extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener{
public class Home extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
FirebaseDatabase database;
DatabaseReference category;
@@ -76,7 +76,7 @@ public class Home extends AppCompatActivity implements NavigationView.OnNavigati
layoutManager = new LinearLayoutManager(this);
recyler_menu.setLayoutManager(layoutManager);
if(Common.isConnectedToInternet(getBaseContext()))
if (Common.isConnectedToInternet(getBaseContext()))
loadMenu();
else {
Toast.makeText(this, "Vui lòng kiểm tra kết nối mạng!", Toast.LENGTH_SHORT).show();
@@ -105,16 +105,11 @@ public class Home extends AppCompatActivity implements NavigationView.OnNavigati
@Override
public void onClick(View view, int position, boolean isLongClick) {
try {
//Get Category Id and send to new Activity
Intent foodList = new Intent(getBaseContext(), FoodList.class);
foodList.putExtra("CategoryId", adapter.getRef(position).getKey());
foodList.putExtra("CategoryName", model.getName());
startActivity(foodList);
}catch (Exception e){
Log.d("ERROR", e.getStackTrace().toString());
}
//Get Category Id and send to new Activity
Intent foodList = new Intent(getBaseContext(), FoodList.class);
foodList.putExtra("CategoryId", adapter.getRef(position).getKey());
foodList.putExtra("CategoryName", model.getName());
startActivity(foodList);
}
});
}
@@ -132,7 +127,7 @@ public class Home extends AppCompatActivity implements NavigationView.OnNavigati
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if(item.getItemId() == R.id.refresh)
if (item.getItemId() == R.id.refresh)
loadMenu();
return super.onOptionsItemSelected(item);
@@ -142,7 +137,7 @@ public class Home extends AppCompatActivity implements NavigationView.OnNavigati
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
int id = item.getItemId();
if(id == R.id.nav_cart) {
if (id == R.id.nav_cart) {
Intent cartIntent = new Intent(Home.this, Cart.class);
startActivity(cartIntent);
} else if (id == R.id.nav_order) {
@@ -32,6 +32,6 @@ public class OrderViewHolder extends RecyclerView.ViewHolder implements View.OnC
@Override
public void onClick(View v) {
itemClickListener.onClick(v, getAdapterPosition(), false);
// itemClickListener.onClick(v, getAdapterPosition(), false);
}
}
@@ -5,7 +5,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.waterbase.foodify.SignIn"
style="@style/Theme.MaterialComponents.DayNight.NoActionBar"
>
<ImageView
@@ -5,6 +5,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:clickable="true"
app:cardElevation="4dp"
>