Ejemplo n.º 1
0
 public void addtoWish(View view) {
   View inWish = findViewById(R.id.buttonAddWish);
   View notinWish = findViewById(R.id.ButtonRemoveWish);
   inWish.setVisibility(View.GONE);
   notinWish.setVisibility(View.VISIBLE);
   WineDAO db;
   db = new WineDAO(this);
   db.open();
   Cursor c = db.getWine(rowId);
   db.updateWine(
       rowId, c.getString(1), c.getString(2), c.getString(3), c.getString(4), c.getInt(5), 1);
   Toast.makeText(this, "Added to Wishlist!", Toast.LENGTH_LONG).show();
   db.close();
 }
Ejemplo n.º 2
0
 public void removeFav(View view) {
   View inFav = findViewById(R.id.buttonAddFav);
   View notinFav = findViewById(R.id.ButtonRemoveFav);
   inFav.setVisibility(View.VISIBLE);
   notinFav.setVisibility(View.GONE);
   WineDAO db;
   db = new WineDAO(this);
   db.open();
   Cursor c = db.getWine(rowId);
   db.updateWine(
       rowId, c.getString(1), c.getString(2), c.getString(3), c.getString(4), 0, c.getInt(6));
   Toast.makeText(this, "Removed from Favorites!", Toast.LENGTH_LONG).show();
   db.close();
 }
Ejemplo n.º 3
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_wine);
    View inWish = findViewById(R.id.buttonAddWish);
    View inFav = findViewById(R.id.buttonAddFav);
    View notinWish = findViewById(R.id.ButtonRemoveWish);
    View notinFav = findViewById(R.id.ButtonRemoveFav);
    WineDAO db;
    db = new WineDAO(this);
    Intent intent = getIntent();
    db.open();
    String id = intent.getStringExtra("rowId");
    rowId = Integer.parseInt(id);
    Cursor c = db.getWine(rowId);

    EditText name = (EditText) findViewById(R.id.winename);
    EditText description = (EditText) findViewById(R.id.winedsc);
    Typeface font = Typeface.createFromAsset(getAssets(), "bless.otf");
    name.setTypeface(font);

    name.setText(c.getString(1));
    description.setText(c.getString(4));

    if ((c.getInt(6) == 1)) {
      inWish.setVisibility(View.GONE);
      notinWish.setVisibility(View.VISIBLE);
    } else {
      inWish.setVisibility(View.VISIBLE);
      notinWish.setVisibility(View.GONE);
    }
    if (!(c.getInt(5) == 1)) {
      inFav.setVisibility(View.VISIBLE);
      notinFav.setVisibility(View.GONE);
    } else {
      inFav.setVisibility(View.GONE);
      notinFav.setVisibility(View.VISIBLE);
    }
    db.close();
  }