Beispiel #1
0
 @Override
 public void onViewCreated(View view, Bundle savedInstanceState) {
   super.onViewCreated(view, savedInstanceState);
   SwipeDismissList swipeDismissList =
       new SwipeDismissList(
           getListView(), getLLQueue().mSwipeCallback, SwipeDismissList.UndoMode.SINGLE_UNDO);
 }
 @Override
 public void onViewCreated(View view, Bundle savedInstanceState) {
   super.onViewCreated(view, savedInstanceState);
   getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
   // 开启工作线程加载列表
   new WorkerThread().start();
 }
 @Override
 public void onViewCreated(View view, Bundle savedInstanceState) {
   super.onViewCreated(view, savedInstanceState);
   if (savedInstanceState != null && savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) {
     setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
   }
 }
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    if (savedInstanceState != null) {
      actTag = savedInstanceState.getString("TAG");
      player1 = savedInstanceState.getParcelable("playerOne");
      player2 = savedInstanceState.getParcelable("playerTwo");
      countOk = savedInstanceState.getInt("countOk");
    }

    mItems = new ArrayList<ListViewItem>();

    Resources resources = getResources();

    mItems.add(new ListViewItem("", player1.getName(), player2.getName()));
    mItems.add(
        new ListViewItem(
            "Score", String.valueOf(player1.getScore()), String.valueOf(player2.getScore())));
    mItems.add(
        new ListViewItem(
            "Sets", String.valueOf(player1.getSets()), String.valueOf(player2.getSets())));
    mItems.add(
        new ListViewItem(
            "Legs", String.valueOf(player1.getLegs()), String.valueOf(player2.getLegs())));
    mItems.add(
        new ListViewItem(
            "Darts", String.valueOf(player1.getDarts()), String.valueOf(player2.getDarts())));
    mItems.add(
        new ListViewItem(
            "Best leg",
            String.valueOf(String.format("%.2f", player1.getBestleg())),
            String.valueOf(String.format("%.2f", player2.getBestleg()))));
    mItems.add(
        new ListViewItem(
            "Previous leg",
            String.valueOf(String.format("%.2f", player1.getPreviousLeg())),
            String.valueOf(String.format("%.2f", player2.getPreviousLeg()))));
    mItems.add(
        new ListViewItem(
            "Current leg",
            String.valueOf(String.format("%.2f", player1.getCurrentLeg())),
            String.valueOf(String.format("%.2f", player2.getCurrentLeg()))));
    mItems.add(
        new ListViewItem(
            "Current set",
            String.valueOf(String.format("%.2f", player1.getCurrentSet())),
            String.valueOf(String.format("%.2f", player2.getCurrentSet()))));
    mItems.add(
        new ListViewItem(
            "Match",
            String.valueOf(String.format("%.2f", player1.getMatch())),
            String.valueOf(String.format("%.2f", player2.getMatch()))));

    setListAdapter(new ListViewAdapter(getActivity(), mItems));

    // remove the dividers from the ListView of the ListFragment
    getListView().setDivider(null);
  }
 @Override
 public void onViewCreated(View view, Bundle savedInstanceState) {
   super.onViewCreated(view, savedInstanceState);
   adapter =
       new ArrayAdapter<String>(
           getActivity(), android.R.layout.simple_list_item_1, locationEvents);
   setListAdapter(adapter);
 }
  /** {@inheritDoc} */
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    mAdapter = new CosplayerAdapter(getActivity());
    setListAdapter(mAdapter);
    setListShown(true);
  }
 @Override
 public void onViewCreated(View view, Bundle savedInstanceState) {
   super.onViewCreated(view, savedInstanceState);
   // Restore the previously serialized activated item position.
   if (savedInstanceState != null && savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) {
     setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
   }
 }
Beispiel #8
0
 @Override
 public void onViewCreated(View view, Bundle savedInstanceState) {
   super.onViewCreated(view, savedInstanceState);
   ArrayAdapter adapter =
       ArrayAdapter.createFromResource(
           getActivity(), R.array.values, android.R.layout.simple_list_item_1);
   setListAdapter(adapter);
   getListView().setOnItemClickListener(this);
 }
  /**
   * Attach to list view once the view hierarchy has been created.
   *
   * @param view
   * @param savedInstanceState
   */
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mStops = new ArrayList<>();
    mStopAdapter = new StopAdapter(getContext(), mStops);

    setListAdapter(mStopAdapter);
    setEmptyText("No Route Found");
    getListView().setDividerHeight(0);
  }
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    ViewGroup viewGroup = (ViewGroup) view;
    mPullToRefreshLayout = new PullToRefreshLayout(viewGroup.getContext());
    ActionBarPullToRefresh.from(getActivity())
        .insertLayoutInto(viewGroup)
        .theseChildrenArePullable(getListView(), getListView().getEmptyView())
        .listener(this)
        .setup(mPullToRefreshLayout);
  }
Beispiel #11
0
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    ListView lv = getListView();
    lv.setFastScrollEnabled(true);
    lv.setOnItemClickListener(mItemClickListener);
    lv.setOnItemLongClickListener(mItemLongClickListener);
    lv.setOnScrollListener(this);
    lv.setFocusable(true);

    MusubiBaseActivity.getInstance().setOnKeyListener(this);
    // int color = Feed.colorFor(feedName, Feed.BACKGROUND_ALPHA);
    // getListView().setCacheColorHint(color);
  }
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    // As this is a native ListFragment I don't have defined a layout for my listView
    // so I need to customize it by code
    ListView listView = getListView();
    listView.setBackgroundColor(getResources().getColor(R.color.Gray));
    //        listView.setSelector(R.drawable.apptheme_list_selector_holo_light);
    //        listView.setDivider(new ColorDrawable(Color.WHITE));
    //        listView.setDividerHeight(3); // 3 pixels height

    // Restore the previously serialized activated item position.
    if (savedInstanceState != null && savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) {
      setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
    }
  }
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    setHeader(view);
    getListView().setOnItemClickListener(this);

    mHeader.post(
        new Runnable() {
          @Override
          public void run() {
            screenWidth = getResources().getDisplayMetrics().widthPixels;
            screenHeight = getListView().getMeasuredHeight();
            setListAdapter(new PickActivityAdapter());
          }
        });
  }
Beispiel #14
0
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    list = getListView();
    videoListAdapter = new VideoListAdapter(getActivity(), this);
    footer =
        ((LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE))
            .inflate(R.layout.paginate_footer, null, false);

    setListAdapter(videoListAdapter);

    // Restore the previously serialized activated item position.
    if (savedInstanceState != null && savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) {

      setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
    }

    getListView()
        .setOnScrollListener(
            new AbsListView.OnScrollListener() {
              long lastScrollDate = 0;

              @Override
              public void onScrollStateChanged(AbsListView view, int scrollState) {}

              @Override
              public void onScroll(
                  AbsListView view,
                  int firstVisibleItem,
                  int visibleItemCount,
                  int totalItemCount) {
                if (mode != PRESENT_VIDEOS_MODE
                    && list.getChildAt(0) != null
                    && list.getLastVisiblePosition() == list.getAdapter().getCount() - 1
                    && list.getChildAt(list.getChildCount() - 1).getBottom() <= list.getHeight()) {
                  long time = System.currentTimeMillis();
                  if ((time - lastScrollDate) > 200 && !loadingNextPage) {
                    lastScrollDate = time;
                    getListView().addFooterView(footer);
                    nextPage();
                  }
                }
              }
            });
  }
Beispiel #15
0
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    setListAdapter(new HeaderViewListAdapter(null, null, null));
    viewLoading =
        ((LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE))
            .inflate(R.layout.listitem_loading, null);
    if (getListView().getCount() != 1) {
      getListView().addFooterView(viewLoading, null, false);
    }
    listAdapter = new JuickMessagesAdapter(getActivity(), 0);
    setListAdapter(listAdapter);

    getListView().setOnScrollListener(this);
    getListView().setOnItemLongClickListener(new JuickMessageMenu(getActivity()));

    Thread thr =
        new Thread(
            new Runnable() {

              public void run() {
                final String jsonStr = Utils.getJSON(getActivity(), apiurl);
                if (isAdded()) {
                  getActivity()
                      .runOnUiThread(
                          new Runnable() {

                            public void run() {
                              if (jsonStr == null || listAdapter.parseJSON(jsonStr) != 20) {
                                MessagesFragment.this.getListView().removeFooterView(viewLoading);
                              }
                              loading = false;
                            }
                          });
                }
              }
            });
    thr.start();
  }
 @Override
 public void onViewCreated(View view, Bundle savedInstanceState) {
   super.onViewCreated(view, savedInstanceState);
 }
  /** When view is created. */
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    // Enabling batch contextual actions in the ListView.
    final ListView listView = getListView();
    listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);

    // AbsListView.MultiChoiceModeListener interface.
    listView.setMultiChoiceModeListener(
        new MultiChoiceModeListener() {

          @Override
          public void onItemCheckedStateChanged(
              ActionMode mode, int position, long id, boolean checked) {
            // Here you can do something when items are selected/de-selected,
            // such as update the title in the CAB.
            if (mAdapter.getItem(position) instanceof Segment) {
              mAdapter.toggleSelection(position);
              mode.setTitle(mAdapter.getSelectedIds().size() + " Selected");
            } else if (mAdapter.getSelectedIds().size() == 0) {
              mode.finish();
            }
          }

          @Override
          public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
            // Respond to clicks on the actions in the CAB
            switch (item.getItemId()) {
              case R.id.tracklist_delete:
                new AlertDialog.Builder(getActivity())
                    .setTitle(R.string.delete_segment)
                    .setIcon(android.R.drawable.ic_dialog_alert)
                    .setMessage(getResources().getString(R.string.delete_segment_selected_hint))
                    .setCancelable(true)
                    .setPositiveButton(
                        android.R.string.yes,
                        new DialogInterface.OnClickListener() {
                          @Override
                          public void onClick(DialogInterface dialog, int which) {
                            // Calls getSelectedIds method from ListViewAdapter Class
                            SparseBooleanArray selected = mAdapter.getSelectedIds();
                            // Captures all selected ids with a loop
                            for (int i = (selected.size() - 1); i >= 0; i--) {
                              if (selected.valueAt(i)) {
                                Segment selectedItem = mAdapter.getItem(selected.keyAt(i));
                                if (!DBModel.deleteSegment(
                                    getActivity(), ((Segment) selectedItem).getId())) {
                                  Toast.makeText(
                                          getActivity(),
                                          getString(R.string.segment_was_not_deleted)
                                              + " ("
                                              + ((Segment) selectedItem).getName()
                                              + ")",
                                          Toast.LENGTH_LONG)
                                      .show();
                                } else {
                                  mAdapter.remove(selectedItem);
                                }
                              }
                            }
                            mAdapter.removeSelection();
                          }
                        })
                    .setNegativeButton(
                        android.R.string.no,
                        new DialogInterface.OnClickListener() {
                          @Override
                          public void onClick(DialogInterface dialog, int which) {
                            mAdapter.removeSelection();
                            dialog.cancel();
                          }
                        })
                    .create()
                    .show();

                mode.finish(); // Action picked, so close the CAB
                return true;
              default:
                return false;
            }
          }

          @Override
          public boolean onCreateActionMode(ActionMode mode, Menu menu) {
            // Inflate the menu for the CAB
            MenuInflater inflater = mode.getMenuInflater();
            inflater.inflate(R.menu.segment_list_context_menu, menu);
            return true;
          }

          @Override
          public void onDestroyActionMode(ActionMode mode) {
            // Here you can make any necessary updates to the activity when
            // the CAB is removed. By default, selected items are deselected/unchecked.
            // mAdapter.removeSelection();
          }

          @Override
          public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
            // Here you can perform updates to the CAB due to
            // an invalidate() request
            return false;
          }
        });
  }
 @Override
 public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
   super.onViewCreated(view, savedInstanceState);
   ButterKnife.bind(this, view);
 }
 @Override
 public void onViewCreated(View view, Bundle savedInstanceState) {
   super.onViewCreated(view, savedInstanceState);
   getListView().setDivider(new ColorDrawable(Color.WHITE));
   getListView().setDividerHeight(5);
 }