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