Change von Pos zu sl_id
This commit is contained in:
parent
b55bee5fba
commit
0d341638ef
app/src/main
java/at/smartshopper/smartshopper
res/menu
@ -52,29 +52,25 @@ public class ShoppinglistDetails extends Activity implements DetailsAdapter.OnGr
|
||||
|
||||
colorBtn = (Button) findViewById(R.id.groupColor);
|
||||
Bundle bundle = getIntent().getExtras();
|
||||
int position = -1; // or other values
|
||||
String sl_id = null; // or other values
|
||||
if (bundle != null)
|
||||
position = bundle.getInt("pos");
|
||||
sl_id = bundle.getString("sl_id");
|
||||
|
||||
Toast.makeText(this, "Click detected on item " + position, Toast.LENGTH_LONG).show();
|
||||
//Toast.makeText(this, "Click detected on item " + position, Toast.LENGTH_LONG).show();
|
||||
|
||||
List<Shoppinglist> shoppinglists = null;
|
||||
try {
|
||||
shoppinglists = db.getMyShoppinglists(FirebaseAuth.getInstance().getCurrentUser().getUid());
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
Shoppinglist shoppinglist = db.getShoppinglist(sl_id);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Shoppinglist aktuelleShopinglist = shoppinglists.get(position);
|
||||
|
||||
final String sl_id = aktuelleShopinglist.getSlId();
|
||||
final String finalSl_id = sl_id;
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
try {
|
||||
showPupupGroupEdit(false, null, sl_id, v);
|
||||
showPupupGroupEdit(false, null, finalSl_id, v);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
} catch (JSONException e) {
|
||||
|
@ -77,7 +77,21 @@ public class ShoppinglistAdapter extends RecyclerView.Adapter<ShoppinglistAdapte
|
||||
//binding the data with the viewholder views
|
||||
holder.textViewTitle.setText(shoppinglist.getname());
|
||||
System.out.println(shoppinglist.getname());
|
||||
holder.textViewBeschreibung.setText(shoppinglist.getdescription());
|
||||
|
||||
|
||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
Intent intent = new Intent(v.getContext(), ShoppinglistDetails.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("sl_id", shoppinglist.getSlId());
|
||||
intent.putExtras(bundle);
|
||||
v.getContext().startActivity(intent);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
holder.bearbeiten.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@ -186,20 +200,7 @@ public class ShoppinglistAdapter extends RecyclerView.Adapter<ShoppinglistAdapte
|
||||
del = itemView.findViewById(R.id.deleteShoppinglist);
|
||||
shoppinglistColor = itemView.findViewById(R.id.shoppinglistColor);
|
||||
|
||||
itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int position = getAdapterPosition();
|
||||
|
||||
Intent intent = new Intent(v.getContext(), ShoppinglistDetails.class);
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt("pos", position);
|
||||
intent.putExtras(bundle);
|
||||
v.getContext().startActivity(intent);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:id="@+id/ocrBtn"
|
||||
android:title="Rechnung Scanen" />
|
||||
<item
|
||||
android:id="@+id/logoutBtn"
|
||||
android:title="Logout"
|
||||
|
Loading…
x
Reference in New Issue
Block a user