RecyclerView滑动以删除片段

时间:2019-12-05 21:28:45

标签: android android-recyclerview

我滑动了一下,以删除recycleView中的功能,并且想在屏幕上滑动项目时添加另一个背景。

我正在为此使用教程:https://medium.com/@zackcosborn/step-by-step-recyclerview-swipe-to-delete-and-undo-7bbae1fce27e

我写了一些代码,但是我有一个 java.lang.IllegalStateException:片段PatientFragment {dcddb65}未附加到上下文。

--
-- Triggers `label_requests`
--
  DELIMITER $$
  CREATE TRIGGER `insert_final_label_requests` AFTER INSERT ON `label_requests` 
  FOR EACH ROW BEGIN

   DECLARE i VARCHAR(50);
   DECLARE prmy VARCHAR(50);
   DECLARE LblrID VARCHAR(50);
   DECLARE unit VARCHAR(50);
   DECLARE part VARCHAR(50);
   DECLARE ipt INT DEFAULT 0;
   DECLARE s INT DEFAULT 0;
   DECLARE label_format VARCHAR(50);
   DECLARE lot VARCHAR(25);
   DECLARE exp_date VARCHAR(25);
   DECLARE exp_date_cat VARCHAR(30);
   DECLARE v_counter INT DEFAULT 0;
   DECLARE CD CHAR(1);
   DECLARE v_bc_value VARCHAR(50);

   SET label_format = CONCAT(NEW.item,'-BT.btw');

   SELECT labeler_id_code, product_code, uom, NEW.lot, IFNULL(DATE_FORMAT(NEW.expire,'%Y%m%d'),'')
     INTO LblrID, part, unit, lot, exp_date
     FROM item_list il
    WHERE il.product_code = NEW.item;

   IF exp_date <> '' THEN
     SET exp_date_cat = CONCAT('/14D',exp_date);
   END IF;

   SET prmy = CONCAT(LblrID, part, unit);
   SET i = CONCAT('+', prmy, '/$$7', `lot`, exp_date_cat);

      SET v_counter = 1;
      WHILE v_counter <= LENGTH(i) DO
         SET ipt = ASCII(MID(i, v_counter, 1));
         IF ipt = 32 THEN
            SET ipt = 38;
         ELSEIF ipt = 36 THEN
            SET ipt = 39;
         ELSEIF ipt = 47 THEN
            SET ipt = 40;
         ELSEIF ipt = 43 THEN
            SET ipt = 41;
         ELSEIF ipt = 37 THEN
            SET ipt = 42;
         ELSEIF ipt >= 48 AND ipt <= 57 THEN
            SET ipt = ipt - 48;
         ELSEIF ipt >= 65 AND ipt <= 90 THEN
            SET ipt = ipt - 55;
         ELSEIF ipt = 45 THEN
            SET ipt = 36;
         ELSEIF ipt = 46 THEN
            SET ipt = 37;
         END IF;
         SET s = (s + ipt) MOD 43;
         SET v_counter = v_counter + 1;
      END WHILE;

      IF s < 10 THEN
         SET cd = CHAR(s + 48);
      ELSEIF s >= 10 AND s < 36 THEN
         SET cd = CHAR(s + 55);
      ELSEIF s = 36 THEN
         SET cd = "-";
      ELSEIF s = 37 THEN
         SET cd = ".";
      ELSEIF s = 38 THEN
         SET cd = " ";
      ELSEIF s = 39 THEN
         SET cd = "$";
      ELSEIF s = 40 THEN
         SET cd = "/";
      ELSEIF s = 41 THEN
         SET cd = "+";
      ELSEIF s = 42 THEN
         SET cd = "%";
      END IF;

      SET v_bc_value =  CONCAT(i, cd);

      INSERT INTO label_requests_final (item, labeler_id, lot, uom, expire, exp_barcode, bc_value, label_format, label_quantity, printer, format_loc)
        SELECT product_code,
               labeler_id_code, 
               NEW.lot,
               uom,
               DATE_FORMAT(NEW.expire,'%Y%m%d'),
               DATE_FORMAT(NEW.expire,'%Y%m%d'),
               v_bc_value,
               label_format,
               NEW.label_quantity,
               NEW.printer,
               format_loc
          FROM item_list il
         WHERE il.product_code = NEW.item;

   END

有什么想法吗?

谢谢!

0 个答案:

没有答案