mirror of
https://github.com/Nezumi-2711/PRM392.git
synced 2026-09-22 13:48:29 +00:00
Fix Crash App and add add log out function Server App
This commit is contained in:
@@ -304,6 +304,12 @@ public class Home extends AppCompatActivity implements NavigationView.OnNavigati
|
|||||||
} else if(id == R.id.nav_message) {
|
} else if(id == R.id.nav_message) {
|
||||||
Intent banner = new Intent(Home.this, SendMessage.class);
|
Intent banner = new Intent(Home.this, SendMessage.class);
|
||||||
startActivity(banner);
|
startActivity(banner);
|
||||||
|
} else if (id == R.id.nav_log_out) {
|
||||||
|
//Logout
|
||||||
|
Intent signIn = new Intent(Home.this, SignIn.class);
|
||||||
|
signIn.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
|
startActivity(signIn);
|
||||||
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||||
|
|||||||
+1
-13
@@ -11,12 +11,10 @@ import com.waterbase.foodifyServer.Common.Common;
|
|||||||
import com.waterbase.foodifyServer.Interface.ItemClickListener;
|
import com.waterbase.foodifyServer.Interface.ItemClickListener;
|
||||||
import com.waterbase.foodifyServer.R;
|
import com.waterbase.foodifyServer.R;
|
||||||
|
|
||||||
public class FoodViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnCreateContextMenuListener{
|
public class FoodViewHolder extends RecyclerView.ViewHolder implements View.OnCreateContextMenuListener{
|
||||||
public TextView txtFoodName;
|
public TextView txtFoodName;
|
||||||
public ImageView imageView;
|
public ImageView imageView;
|
||||||
|
|
||||||
private ItemClickListener itemClickListener;
|
|
||||||
|
|
||||||
public FoodViewHolder(View itemView) {
|
public FoodViewHolder(View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
|
|
||||||
@@ -24,16 +22,6 @@ public class FoodViewHolder extends RecyclerView.ViewHolder implements View.OnCl
|
|||||||
imageView = (ImageView) itemView.findViewById(R.id.food_image);
|
imageView = (ImageView) itemView.findViewById(R.id.food_image);
|
||||||
|
|
||||||
itemView.setOnCreateContextMenuListener(this);
|
itemView.setOnCreateContextMenuListener(this);
|
||||||
itemView.setOnClickListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setItemClickListener(ItemClickListener itemClickListener) {
|
|
||||||
this.itemClickListener = itemClickListener;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
itemClickListener.onClick(v, getAdapterPosition(), false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="200dp"
|
android:layout_height="200dp"
|
||||||
|
android:layout_margin="5dp"
|
||||||
app:cardElevation="4dp"
|
app:cardElevation="4dp"
|
||||||
android:layout_marginBottom="8dp"
|
android:layout_marginBottom="8dp"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="200dp"
|
android:layout_height="200dp"
|
||||||
|
android:layout_margin="5dp"
|
||||||
app:cardElevation="4dp"
|
app:cardElevation="4dp"
|
||||||
>
|
>
|
||||||
|
|
||||||
|
|||||||
@@ -12,16 +12,12 @@
|
|||||||
android:id="@+id/nav_message"
|
android:id="@+id/nav_message"
|
||||||
android:icon="@drawable/ic_baseline_message_24"
|
android:icon="@drawable/ic_baseline_message_24"
|
||||||
android:title="Thông báo" />
|
android:title="Thông báo" />
|
||||||
<item
|
|
||||||
android:id="@+id/nav_cart"
|
|
||||||
android:icon="@drawable/ic_baseline_shopping_cart_24"
|
|
||||||
android:title="Giỏ hàng" />
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/nav_orders"
|
android:id="@+id/nav_orders"
|
||||||
android:icon="@drawable/ic_baseline_access_time_24"
|
android:icon="@drawable/ic_baseline_access_time_24"
|
||||||
android:title="Tình trạng đơn hàng" />
|
android:title="Tình trạng đơn hàng" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/nav_sign_out"
|
android:id="@+id/nav_log_out"
|
||||||
android:icon="@drawable/ic_baseline_exit_to_app_24"
|
android:icon="@drawable/ic_baseline_exit_to_app_24"
|
||||||
android:title="Đăng xuất" />
|
android:title="Đăng xuất" />
|
||||||
</group>
|
</group>
|
||||||
|
|||||||
Reference in New Issue
Block a user