Пример #1
0
        @Override
        public void run() {

          Message message = mHandler.obtainMessage(0);

          SQLiteManager sqLiteManager = new SQLiteManager(getActivity());
          sqLiteManager.onOpen(sqLiteManager.getWritableDatabase());

          Iterator<MoneyItem> iterator = moneyAdapter.getMoneyItems().iterator();

          while (iterator.hasNext()) {
            MoneyItem moneyItem = iterator.next();
            if (moneyItem.getCheck()) {
              sqLiteManager.deleteMoneyData(
                  CurrentAccountData.getMoneyTableName(), moneyItem.getRowId());
              iterator.remove();
            }
          }
          sqLiteManager.close();
          mHandler.sendMessage(message);
        }
Пример #2
0
  @Override
  public void onFoundMoneyItems(ArrayList<MoneyItem> moneyItems, int totalMoney) {

    moneyAdapter = new MoneyAdapter(moneyItems);
    moneyAdapter.setOnClickListener(
        new MoneyAdapter.OnClickListener() {
          @Override
          public void onClick(View view, MoneyItem moneyItem) {

            Intent intent = new Intent();
            intent.putExtra("mMoneyItem", moneyItem);
            intent.setClass(getActivity(), MoneyDetailActivity.class);
            getActivity().startActivity(intent);
          }

          @Override
          public void onLongClick(MoneyItem moneyItem) {}

          @Override
          public void onDeleteMode(boolean deleteSwitch) {

            MainActivity mainActivity = (MainActivity) getActivity();

            if (deleteSwitch) {
              mainActivity.onOpenDeleteActionMode();
            } else {
              mainActivity.onCloseDeleteActionMode();
            }
          }
        });
    RecyclerView recyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerView);
    recyclerView.setVisibility(View.VISIBLE);
    recyclerView.setHasFixedSize(true);
    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    recyclerView.setAdapter(moneyAdapter);
  }
Пример #3
0
 public void closeDeleteMode() {
   moneyAdapter.setDeleteMode(false);
   moneyAdapter.notifyDataSetChanged();
 }