private void initCardAdapter() {
    List<Card> lc = new ArrayList<>();
    this.mCardArrayAdapter = new CardArrayAdapter(this, lc);
    this.mCardArrayAdapter.setEnableUndo(true);

    CardListView listView = (CardListView) this.findViewById(R.id.cardList);
    if (listView != null) {
      listView.setAdapter(this.mCardArrayAdapter);
    }
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, final ViewGroup container, Bundle savedInstance) {

    View v = inflater.inflate(R.layout.fragment_movement, container, false);
    croutonParent = container;

    fabButton = (FloatingActionButton) getActivity().findViewById(R.id.fabButton);
    fabButton.hide();
    /*if(Utils.getDefaultWalletIdPref(getActivity())==-1)
        fabButton.hide(true);
    else
        fabButton.show(true);*/

    cursorCardAdapter =
        new MovementCursorCardAdapter(
            getActivity(),
            dbHelper.getMovementsOfWallet(
                Utils.getDefaultWalletIdPref(getActivity()), Const.KEY_MOVEMENT_DATE, true),
            false); // dbHelper.getMovementsOfWallet(Utils.getDefaultWalletIdPref(getActivity()),
    // Const.KEY_MOVEMENT_NAME),false, true);

    listViewMovement = (CardListView) v.findViewById(R.id.listViewMovement);
    if (listViewMovement != null) {
      listViewMovement.setAdapter(cursorCardAdapter);
    }
    LayoutAnimationController lac =
        new LayoutAnimationController(
            AnimationUtils.loadAnimation(getActivity(), R.anim.table_row_appear),
            0.5f); // 0.5f == time between appearance of listview items.
    listViewMovement.setLayoutAnimation(lac);
    listViewMovement.setFastScrollEnabled(true);
    listViewMovement.setEmptyView(v.findViewById(R.id.emtyView));

    /*fabButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dialogAddMovement();
        }
    });
    fabButton.attachToListView(listViewMovement);*/

    multiple_actions = (FloatingActionsMenu) v.findViewById(R.id.multiple_actions);
    fbNewExit =
        (com.getbase.floatingactionbutton.FloatingActionButton) v.findViewById(R.id.fbNewExit);
    fbNewEntry =
        (com.getbase.floatingactionbutton.FloatingActionButton) v.findViewById(R.id.fbNewEntry);
    fbNewEntry.setOnClickListener(this);
    fbNewExit.setOnClickListener(this);
    if (Utils.getDefaultWalletIdPref(getActivity()) == -1)
      multiple_actions.setVisibility(View.GONE);
    else fabButton.setVisibility(View.VISIBLE);

    return v;
  }
  private void initCards() {

    // Init an array of Cards
    ArrayList<Card> cards = new ArrayList<Card>();

    for (int i = 0; i < 100; i++) {
      GooglePlaySmallCard card = new GooglePlaySmallCard(this.getActivity());
      card.setTitle("Application example " + i);
      card.setSecondaryTitle("A company inc..." + i);
      card.setRating((float) (Math.random() * (5.0)));
      card.setId("" + i);

      // Only for test, change some icons
      if ((i > 10 && i < 15) || (i > 35 && i < 45)) {
        card.setResourceIdThumbnail(R.drawable.ic_launcher);
      }

      card.init();
      cards.add(card);
    }

    mCardArrayAdapter = new CardArrayAdapter(getActivity(), cards);

    // Enable undo controller!
    mCardArrayAdapter.setEnableUndo(true);

    // CardListView listView = (CardListView)
    // getActivity().findViewById(R.id.carddemo_list_gplaycard);
    if (mListView != null) {
      mListView.setAdapter(mCardArrayAdapter);
    }
  }
  private void initCards() {

    // Init an array of Cards
    ArrayList<Card> cards = new ArrayList<Card>();
    for (int i = 0; i < 200; i++) {
      Card card = init_standard_header_with_expandcollapse_button_custom_area("Header " + i);
      cards.add(card);
    }

    CardArrayAdapter mCardArrayAdapter = new CardArrayAdapter(getActivity(), cards);

    CardListView listView = (CardListView) getActivity().findViewById(R.id.carddemo_list_expand);
    if (listView != null) {
      listView.setAdapter(mCardArrayAdapter);
    }
  }
示例#5
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_list);

    int listImages[] =
        new int[] {
          R.drawable.ic_launcher,
          R.drawable.ic_launcher,
          R.drawable.ic_launcher,
          R.drawable.ic_launcher,
          R.drawable.ic_launcher
        };

    ArrayList<Card> cards = new ArrayList<Card>();

    for (int i = 0; i < 5; i++) {
      // Create a Card
      Card card = new Card(this);
      // Create a CardHeader
      CardHeader header = new CardHeader(this);
      // Add Header to card
      header.setTitle("Angry bird: " + i);
      card.setTitle("sample title");
      card.addCardHeader(header);

      CardThumbnail thumb = new CardThumbnail(this);
      thumb.setDrawableResource(listImages[i]);
      card.addCardThumbnail(thumb);

      cards.add(card);
    }

    CardArrayAdapter mCardArrayAdapter = new CardArrayAdapter(this, cards);

    CardListView listView = (CardListView) this.findViewById(R.id.myList);
    if (listView != null) {
      listView.setAdapter(mCardArrayAdapter);
    }
  }
示例#6
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    self = inflater.inflate(R.layout.fragment_news, container, false);

    ArrayList<Card> cards = new ArrayList<Card>();

    cards.add(newsTextCard.getCard(getActivity(), "颢神", "我在药科大"));
    cards.add(newsTextCard.getCard(getActivity(), "颢神", "我在北大"));
    cards.add(newsTextCard.getCard(getActivity(), "颢神", "我在清华"));

    CardArrayAdapter mCardArrayAdapter = new CardArrayAdapter(getActivity(), cards);
    mCardArrayAdapter.setEnableUndo(true);

    listView = (CardListView) self.findViewById(R.id.newsList);
    if (listView != null) {
      listView.setAdapter(mCardArrayAdapter);
    }

    return self;
  }
示例#7
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Start service to listen for shaking
    startService(new Intent(MainActivity.this, Background_service.class));

    int cnt = getNumDots();
    // cnt = 0;
    if (cnt == 0) {
      try {
        FileOutputStream fos = openFileOutput("Dots.txt", Context.MODE_PRIVATE);
        fos.write((".").getBytes());
        fos.close();
      } catch (Exception e) {
      }
      this.setContentView(R.layout.login);
    } else if (cnt == 1) {
      try {
        FileOutputStream fos = openFileOutput("Dots.txt", Context.MODE_PRIVATE);
        fos.write(("..").getBytes());
        fos.close();
      } catch (Exception e) {
      }

      this.setContentView(R.layout.instructions);
    } else if (cnt == 2) {
      try {
        FileOutputStream fos = openFileOutput("Dots.txt", Context.MODE_PRIVATE);
        fos.write(("...").getBytes());
        fos.close();
      } catch (Exception e) {
      }

      this.setContentView(R.layout.s1);
    } else if (cnt == 3) {
      try {
        FileOutputStream fos = openFileOutput("Dots.txt", Context.MODE_PRIVATE);
        fos.write(("....").getBytes());
        fos.close();
      } catch (Exception e) {
      }
      this.setContentView(R.layout.s2);

    } else if (cnt == 4) {
      try {
        FileOutputStream fos = openFileOutput("Dots.txt", Context.MODE_PRIVATE);
        fos.write((".....").getBytes());
        fos.close();
      } catch (Exception e) {
      }
      this.setContentView(R.layout.s3);
    } else if (cnt == 5) {
      try {
        FileOutputStream fos = openFileOutput("Dots.txt", Context.MODE_PRIVATE);
        fos.write(("......").getBytes());
        fos.close();
      } catch (Exception e) {
      }
      this.setContentView(R.layout.s4);
    } else {
      setContentView(R.layout.activity_main);
      showBalance = (TextView) findViewById(R.id.textView);
      showBalance.setText(dollar("$" + String.valueOf(getTotalTimes() * getAps())));
      startNotification();

      int listImages[] =
          new int[] {
            R.drawable.two, R.drawable.one, R.drawable.three, R.drawable.four, R.drawable.five
          };

      ArrayList<Card> cards = new ArrayList<Card>();

      /* for (int i = 0; i<5; i++) {
          Card card = new Card(this);
          CardHeader header = new CardHeader(this);
          header.setTitle("Angry bird: " + i);
          card.setTitle("sample title");
          card.addCardHeader(header);
          CardThumbnail thumb = new CardThumbnail(this);
          thumb.setDrawableResource(listImages[i]);
          card.addCardThumbnail(thumb);
          cards.add(card);
      }*/

      Card card = new Card(this);
      CardHeader header = new CardHeader(this);
      header.setTitle("Shannon Baker: $15");
      card.setTitle("Perfect Attendance for a week!");
      card.addCardHeader(header);
      CardThumbnail thumb = new CardThumbnail(this);
      thumb.setDrawableResource(listImages[1]);
      card.addCardThumbnail(thumb);
      cards.add(card);

      card = new Card(this);
      header = new CardHeader(this);
      header.setTitle("Russel Heritage: $20");
      card.setTitle("10 Selfies in ten days!");
      card.addCardHeader(header);
      thumb = new CardThumbnail(this);
      thumb.setDrawableResource(listImages[0]);
      card.addCardThumbnail(thumb);
      cards.add(card);

      card = new Card(this);
      header = new CardHeader(this);
      header.setTitle("Melody Li: $5");
      card.setTitle("Discovered every place in her house!");
      card.addCardHeader(header);
      thumb = new CardThumbnail(this);
      thumb.setDrawableResource(listImages[2]);
      card.addCardThumbnail(thumb);
      cards.add(card);

      card = new Card(this);
      header = new CardHeader(this);
      header.setTitle("Bisma Imran: $10");
      card.setTitle("Brought lunch from home all week!");
      card.addCardHeader(header);
      thumb = new CardThumbnail(this);
      thumb.setDrawableResource(listImages[3]);
      card.addCardThumbnail(thumb);
      cards.add(card);

      card = new Card(this);
      header = new CardHeader(this);
      header.setTitle("Adit Patel: $7");
      card.setTitle("Went to practice every day this month!");
      card.addCardHeader(header);
      thumb = new CardThumbnail(this);
      thumb.setDrawableResource(listImages[4]);
      card.addCardThumbnail(thumb);
      cards.add(card);

      CardArrayAdapter mCardArrayAdapter = new CardArrayAdapter(this, cards);

      CardListView listView = (CardListView) this.findViewById(R.id.myList);
      if (listView != null) {
        listView.setAdapter(mCardArrayAdapter);
      }
      // showBalance.setText("$124.00");
    }
  }