public static <LI extends ListItem> void attach(
      @Nonnull android.app.ListFragment listFragment,
      @Nonnull ListItemAdapter<? extends LI> adapter) {
    listFragment.setListAdapter(adapter);

    fillListView(listFragment.getListView(), adapter, listFragment.getActivity());
  }
Пример #2
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    GroceryListAdapter adapter = new GroceryListAdapter(this.getActivity());

    db = DataAccessStub.getInstance();
    db.open("GroceryList");
    groceryList = db.getGroceriesByDepartment();

    Set<String> departments = groceryList.keySet();
    ArrayList<Grocery> departmentGroceries;

    for (String department : departments) {
      adapter.addHeaderItem(department);

      departmentGroceries = groceryList.get(department);

      for (Grocery grocery : departmentGroceries) {
        adapter.addGroceryItem(grocery.getName());
      }
    }

    setListAdapter(adapter);
  }
 @Override
 public void onResume() {
   super.onResume();
   mHandler.postDelayed(mTimeUpdateRunnable, REFRESH_INTERVAL_MILLIS);
   mCore = KegbotCore.getInstance(getActivity());
   mCore.getBus().register(this);
 }
Пример #4
0
 @Override
 public void onAttach(Activity activity) {
   super.onAttach(activity);
   if (activity instanceof MainActivity) {
     mActivity = (MainActivity) activity;
   }
 }
  @Override
  public void onStop() {
    Log.d(TAG, "onStop");
    unregisterSurveysReceiver();

    super.onStop();
  }
Пример #6
0
  @Override
  public void onPause() {
    super.onPause();

    Log.d(TAG, "onPause()");
    getActivity().getApplicationContext().unregisterReceiver(mLeServiceReceiver);
  }
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    // Always call the superclass so it can save the view hierarchy state
    super.onActivityCreated(savedInstanceState);

    getListView().setOnScrollListener(this);
  }
  @Override
  public void onResume() {
    super.onResume();

    Network connectNetwork = new Network(getActivity(), this);
    connectNetwork.execute("http://www.washingtonpost.com/wp-srv/simulation/simulation_test.json");
  }
Пример #9
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   PDroidAppListLoader appListLoader =
       new PDroidAppListLoader(getActivity(), new LoadTaskCompleteHandler());
   appListLoader.execute();
 }
Пример #10
0
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    // Populate list with our static array of titles.
    setListAdapter(
        new ArrayAdapter<String>(
            getActivity(), android.R.layout.simple_list_item_activated_1, FunctionsList.FUNCTIONS));

    // Check to see if we have a frame in which to embed the details
    // fragment directly in the containing UI.
    View detailsFrame = getActivity().findViewById(R.id.details);
    dual = detailsFrame != null && detailsFrame.getVisibility() == View.VISIBLE;

    if (savedInstanceState != null) {
      // Restore last state for checked position.
      position = savedInstanceState.getInt("currentChoice", 0);
    }

    if (dual) {
      // In dual-pane mode, the list view highlights the selected item.
      getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
      // Make sure our UI is in the correct state.
      showDetails(position);
    }
  }
Пример #11
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   mNsdHelper = new NsdHelper(this.getActivity());
   initializeListAdapter();
   this.setListAdapter(mListAdapter);
 }
Пример #12
0
  @Override
  public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    listAdapter = new ListAdapter();
    setListAdapter(listAdapter);
  }
 @Override
 public void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   outState.putParcelableArrayList(STATE_LIST, getListAdapter().getList());
   outState.putParcelableArrayList(
       STATE_CAB_CHECKED_ITEMS, new ArrayList<Parcelable>(mCheckedItems));
 }
  @Override
  public void onAttach(Activity activity) {
    super.onAttach(activity);
    this.activity = (FourthTaskAndroid) activity;

    preferencesManager = new PreferencesManager(activity);
  }
Пример #15
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setHasOptionsMenu(true);

    getActivity().getActionBar().setHomeButtonEnabled(true);
  }
  @Override
  public void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);

    Info info = infoList.get(position);

    if (LLAMAR.equals(info.accion)) {
      this.startActivity(UtilesIntents.getCallPhoneIntent(info.valor));

    } else if (SMS.equals(info.accion)) {
      this.startActivity(UtilesIntents.getSendSmsIntent(info.valor));

    } else if (EMAIL.equals(info.accion)) {
      this.startActivity(UtilesIntents.getSendEmailIntent(info.valor));

    } else if (MSGWEB.equals(info.accion)) {

      // Es una busqueda MUY simple, la hacemos desde la UI...

      String contactUsername = Database.getDatabase(getActivity()).getUsernameDeContacto(contactId);

      this.startActivity(
          EnviarMensajeWebActivity.getEnviarMensajeWebActivityIntent(
              getActivity().getApplicationContext(), contactUsername, contactId, displayName));

    } else {

      Toast.makeText(
              getActivity().getApplicationContext(), "Accion desconocida", Toast.LENGTH_SHORT)
          .show();
    }
  }
Пример #17
0
 @Override
 public void onActivityCreated(Bundle savedInstanceState) {
   super.onActivityCreated(savedInstanceState);
   adapter =
       new ArrayAdapter<String>(
           getActivity(), android.R.layout.simple_list_item_1, new ArrayList<String>());
   setListAdapter(adapter);
   if (task == null || task.getStatus() == MyAsyncTask.Status.FINISHED) {
     task = new DBTask();
     task.executeOnExecutor(MyAsyncTask.THREAD_POOL_EXECUTOR);
   }
   getListView()
       .setOnItemLongClickListener(
           new AdapterView.OnItemLongClickListener() {
             @Override
             public boolean onItemLongClick(
                 AdapterView<?> parent, View view, int position, long id) {
               String word = adapter.getItem(position);
               List<String> newWordList =
                   DatabaseManager.getInstance().removeAndGetNewFilterList(word);
               adapter.clear();
               adapter.addAll(newWordList);
               return true;
             }
           });
 }
Пример #18
0
 @Override
 public void onListItemClick(ListView l, View v, int position, long id) {
   super.onListItemClick(l, v, position, id);
   if (mAdapter != null) {
     mAdapter.remove(position);
   }
 }
 @Override
 public void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   if (mActivatedPosition != ListView.INVALID_POSITION) {
     outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition);
   }
 }
 @Override
 public void onListItemClick(ListView l, View v, int position, long id) {
   super.onListItemClick(l, v, position, id);
   if (null != this.galleryListFragmentListener) {
     this.galleryListFragmentListener.onGallerySelected(position);
   }
 }
  @Override
  public void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);

    getListView().setItemChecked(position, true);
    callback.onCourseSelected(allCourses.get(position));
  }
 @Override
 public void onActivityCreated(Bundle savedInstanceState) {
   Log.d(TAG, "onActivityCreated");
   super.onActivityCreated(savedInstanceState);
   initAdapter();
   initListView();
 }
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    mAdapter = new EventListArrayAdapter(getActivity(), R.layout.event_list_item, R.id.eventText);

    AnimationSet set = new AnimationSet(true);

    Animation animation = new AlphaAnimation(0.0f, 1.0f);
    animation.setDuration(300);
    set.addAnimation(animation);
    animation =
        new TranslateAnimation(
            Animation.RELATIVE_TO_SELF,
            0.0f,
            Animation.RELATIVE_TO_SELF,
            0.0f,
            Animation.RELATIVE_TO_SELF,
            -1.0f,
            Animation.RELATIVE_TO_SELF,
            0.0f);
    animation.setDuration(300);
    set.addAnimation(animation);

    LayoutAnimationController controller = new LayoutAnimationController(set, 0.3f);
    getListView().setLayoutAnimation(controller);
    setListAdapter(mAdapter);
  }
Пример #24
0
 @Override
 public void onResume() {
   super.onResume();
   atualizarAdapter();
   getListView().setItemChecked(position_selecionado, false);
   if (mActionMode != null) mActionMode.finish();
 }
Пример #25
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getActivity().setTitle(R.string.family_members_title);

    FamilyMemberAdapter adapter = new FamilyMemberAdapter(mFamily.returnFamilyArray());
    setListAdapter(adapter);
  }
Пример #26
0
 @Override
 public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
   // TODO Auto-generated method stub
   super.onCreateOptionsMenu(menu, inflater);
   menu.add("Menu 1a").setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
   menu.add("Menu 1b").setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
 }
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   adapter = new AlbumAdapter(this);
   loadData();
   setListAdapter(adapter);
 }
  @Override
  public void onDetach() {
    super.onDetach();

    // Reset the active callbacks interface to the dummy implementation.
    mCallbacks = sDummyCallbacks;
  }
  @Override
  public void onListItemClick(ListView listView, View view, int position, long id) {
    super.onListItemClick(listView, view, position, id);

    // Notify the active callbacks interface (the activity, if the
    // fragment is attached to one) that an item has been selected.
    mCallbacks.onItemSelected(FrameContent.ITEMS.get(position).id);
  }
 @Override
 public void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   if (mActivatedPosition != ListView.INVALID_POSITION) {
     // Serialize and persist the activated item position.
     outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition);
   }
 }