Java Code Examples for android.app.ListFragment

The following are top voted examples for showing how to use android.app.ListFragment. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: skill-shot-android   File: LocationListActivity.java   View source code 6 votes vote down vote up
@Override
public void filter() {
	ArrayList<Location> filteredList = new ArrayList<Location>();
	for(Location loc : getLocationsList()) {
		boolean visible = 
				(!filterAllAges  || loc.isAll_ages()) // either we're not filtering or the location is all ages (if we are filtering)
				;
		if (visible) {
			filteredList.add(loc);
		}
	}
	ListFragment fragment = ((ListFragment) getFragmentManager().findFragmentByTag(LIST_TAG));
	@SuppressWarnings("unchecked")
	ArrayAdapter<Location> adapter = (ArrayAdapter<Location>) fragment.getListAdapter();
	adapter.clear();
	adapter.addAll(filteredList);
	sort();
}
 
Example 2
Project: skill-shot-android   File: LocationListActivity.java   View source code 6 votes vote down vote up
private void sort() {
	ListFragment fragment = ((ListFragment) getFragmentManager().findFragmentByTag(LIST_TAG));
	@SuppressWarnings("unchecked")
	ArrayAdapter<Location> adapter = (ArrayAdapter<Location>) fragment.getListAdapter();
	Comparator<Location> comparator = new AlphaSort();
	if (filterSort == R.string.distance) {
		if (getUserLocation() == null) {
			Toast.makeText(this, R.string.location_unavailable, Toast.LENGTH_SHORT).show();
			return;
		}
		comparator = new DistanceSort();
	} else if (filterSort == R.string.number_of_games) {
		comparator = new NumGamesSort();
	}
	 
	adapter.sort(comparator);
	adapter.notifyDataSetChanged();
}
 
Example 3
Project: AndroidStudio-git-repo   File: FragmentDemoActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fragment_main4);

    View detailsFrame = findViewById(R.id.details);
    mDualPane = detailsFrame != null && detailsFrame.getVisibility() == View.VISIBLE;

    if (savedInstanceState != null) {
        mCurCheckPosition = savedInstanceState.getInt("index", 0);
    }

    if(mDualPane){
        headlinesFragment = (ListFragment)getFragmentManager().findFragmentById(R.id.titles);
        headlinesFragment.getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
        //onArticleSelected(mCurCheckPosition);
        headlinesFragment.getListView().setItemChecked(mCurCheckPosition,true);
        getFragmentManager().beginTransaction().add(R.id.details,
                ArticleFragment.newInstance(mCurCheckPosition)).commit();
    }
}
 
Example 4
Project: iosched-reader   File: MyScheduleActivity.java   View source code 5 votes vote down vote up
@Override
public void onFragmentViewCreated(ListFragment fragment) {
    fragment.getListView().addHeaderView(
            getLayoutInflater().inflate(R.layout.reserve_action_bar_space_header_view, null));
    int dayIndex = fragment.getArguments().getInt(ARG_CONFERENCE_DAY_INDEX, 0);
    if (dayIndex < 0) {
        fragment.setListAdapter(mDayZeroAdapter);
        fragment.getListView().setRecyclerListener(mDayZeroAdapter);
    } else {
        fragment.setListAdapter(mScheduleAdapters[dayIndex]);
        fragment.getListView().setRecyclerListener(mScheduleAdapters[dayIndex]);
    }
}
 
Example 5
Project: smconf-android   File: MyScheduleActivity.java   View source code 5 votes vote down vote up
@Override
public void onFragmentViewCreated(ListFragment fragment) {
    fragment.getListView().addHeaderView(
            getLayoutInflater().inflate(R.layout.reserve_action_bar_space_header_view, null));
    int dayIndex = fragment.getArguments().getInt(ARG_CONFERENCE_DAY_INDEX, 0);
    if (dayIndex < 0) {
        fragment.setListAdapter(mDayZeroAdapter);
        fragment.getListView().setRecyclerListener(mDayZeroAdapter);
    } else {
        fragment.setListAdapter(mScheduleAdapters[dayIndex]);
        fragment.getListView().setRecyclerListener(mScheduleAdapters[dayIndex]);
    }
}
 
Example 6
Project: truth-android   File: ListFragmentSubject.java   View source code 5 votes vote down vote up
public static SubjectFactory<ListFragmentSubject, ListFragment> type() {
  return new SubjectFactory<ListFragmentSubject, ListFragment>() {
    @Override
    public ListFragmentSubject getSubject(FailureStrategy fs, ListFragment that) {
      return new ListFragmentSubject(fs, that);
    }
  };
}
 
Example 7
Project: 2015-Google-I-O-app   File: MyScheduleActivity.java   View source code 5 votes vote down vote up
@Override
public void onFragmentViewCreated(ListFragment fragment) {
    fragment.getListView().addHeaderView(
            getLayoutInflater().inflate(R.layout.reserve_action_bar_space_header_view, null));
    int dayIndex = fragment.getArguments().getInt(ARG_CONFERENCE_DAY_INDEX, 0);
    if (dayIndex < 0) {
        fragment.setListAdapter(mDayZeroAdapter);
        fragment.getListView().setRecyclerListener(mDayZeroAdapter);
    } else {
        fragment.setListAdapter(mScheduleAdapters[dayIndex]);
        fragment.getListView().setRecyclerListener(mScheduleAdapters[dayIndex]);
    }
}
 
Example 8
Project: EDSApp   File: ModuleController.java   View source code 5 votes vote down vote up
public void replaceFragment(int layout, Fragment fragment) {
    if(fragment instanceof ListFragment){
        try{
            //fix some visual problems
            View vg = dashboardActivity.findViewById(layout);
            vg.invalidate();
        }catch (Exception e){}
    }

    FragmentTransaction ft = getFragmentTransaction();
    ft.replace(layout, fragment);
    ft.commit();
}
 
Example 9
Project: CutoutViewIndicator   File: PlainActivity.java   View source code 5 votes vote down vote up
@NonNull
@SuppressWarnings("unchecked")
protected Class<? extends Fragment> getPrimaryFragmentClass() {
    Class<? extends Fragment> fragmentClass = (Class<? extends Fragment>) getIntent().getSerializableExtra(ARG_FRAGMENT_CLASS);
    if (fragmentClass == null) {
        fragmentClass = ListFragment.class;
    }
    return fragmentClass;
}
 
Example 10
Project: FMTech   File: MyScheduleActivity.java   View source code 5 votes vote down vote up
@Override
public void onFragmentViewCreated(ListFragment fragment) {
    fragment.getListView().addHeaderView(
            getLayoutInflater().inflate(R.layout.reserve_action_bar_space_header_view, null));
    int dayIndex = fragment.getArguments().getInt(ARG_CONFERENCE_DAY_INDEX, 0);
    if (dayIndex < 0) {
        fragment.setListAdapter(mDayZeroAdapter);
        fragment.getListView().setRecyclerListener(mDayZeroAdapter);
    } else {
        fragment.setListAdapter(mScheduleAdapters[dayIndex]);
        fragment.getListView().setRecyclerListener(mScheduleAdapters[dayIndex]);
    }
}
 
Example 11
Project: malariapp   File: ModuleController.java   View source code 5 votes vote down vote up
public void replaceFragment(int layout, Fragment fragment) {
    if (fragment instanceof ListFragment) {
        try {
            //fix some visual problems
            View vg = dashboardActivity.findViewById(layout);
            vg.invalidate();
        } catch (Exception e) {
        }
    }

    FragmentTransaction ft = getFragmentTransaction();
    ft.replace(layout, fragment);
    ft.commit();
}
 
Example 12
Project: pictureapp   File: DashboardActivity.java   View source code 5 votes vote down vote up
/**
 * Init the fragments
 */
private void setFragmentTransaction(int layout, ListFragment fragment) {
    FragmentTransaction ft = getFragmentManager().beginTransaction();
    ft.add(layout, fragment);
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
    ft.commit();
}
 
Example 13
Project: saarang-iosched   File: MyScheduleActivity.java   View source code 5 votes vote down vote up
@Override
public void onFragmentViewCreated(ListFragment fragment) {
    fragment.getListView().addHeaderView(
            getLayoutInflater().inflate(com.saarang.samples.apps.iosched.R.layout.reserve_action_bar_space_header_view, null));
    int dayIndex = fragment.getArguments().getInt(ARG_CONFERENCE_DAY_INDEX, 0);
    fragment.setListAdapter(mScheduleAdapters[dayIndex]);
    fragment.getListView().setRecyclerListener(mScheduleAdapters[dayIndex]);
}
 
Example 14
Project: AppDevFestSudeste2015   File: MyScheduleActivity.java   View source code 5 votes vote down vote up
@Override
public void onFragmentViewCreated(ListFragment fragment) {
    fragment.getListView().addHeaderView(
            getLayoutInflater().inflate(R.layout.reserve_action_bar_space_header_view, null));
    int dayIndex = fragment.getArguments().getInt(ARG_CONFERENCE_DAY_INDEX, 0);
    fragment.setListAdapter(mScheduleAdapters[dayIndex]);
    fragment.getListView().setRecyclerListener(mScheduleAdapters[dayIndex]);
}
 
Example 15
Project: JJCamera   File: MyScheduleActivity.java   View source code 5 votes vote down vote up
@Override
public void onFragmentViewCreated(ListFragment fragment) {
    fragment.getListView().addHeaderView(
            getLayoutInflater().inflate(R.layout.reserve_action_bar_space_header_view, null));
    int dayIndex = fragment.getArguments().getInt(ARG_CONFERENCE_DAY_INDEX, 0);
    if (dayIndex < 0) {
        fragment.setListAdapter(mDayZeroAdapter);
        fragment.getListView().setRecyclerListener(mDayZeroAdapter);
    } else {
        fragment.setListAdapter(mScheduleAdapters[dayIndex]);
        fragment.getListView().setRecyclerListener(mScheduleAdapters[dayIndex]);
    }
}
 
Example 16
Project: FishApp   File: ProductVendorListFragment.java   View source code 5 votes vote down vote up
public static ListFragment newInstance(String param1, String param2) {
    ListFragment fragment = new ListFragment();
    Bundle args = new Bundle();
    args.putString(ARG_PARAM1, param1);
    args.putString(ARG_PARAM2, param2);
    fragment.setArguments(args);
    return fragment;
}
 
Example 17
Project: FishApp   File: ProductListFragment.java   View source code 5 votes vote down vote up
public static ListFragment newInstance(String param1, String param2) {
    ListFragment fragment = new ListFragment();
    Bundle args = new Bundle();
    args.putString(ARG_PARAM1, param1);
    args.putString(ARG_PARAM2, param2);
    fragment.setArguments(args);
    return fragment;
}
 
Example 18
Project: FishApp   File: VendorListFragment.java   View source code 5 votes vote down vote up
public static ListFragment newInstance(String param1, String param2) {
    ListFragment fragment = new ListFragment();
    Bundle args = new Bundle();
    args.putString(ARG_PARAM1, param1);
    args.putString(ARG_PARAM2, param2);
    fragment.setArguments(args);
    return fragment;
}
 
Example 19
Project: FishApp   File: VendorProductListFragment.java   View source code 5 votes vote down vote up
public static ListFragment newInstance(String param1, String param2) {
    ListFragment fragment = new ListFragment();
    Bundle args = new Bundle();
    args.putString(ARG_PARAM1, param1);
    args.putString(ARG_PARAM2, param2);
    fragment.setArguments(args);
    return fragment;
}
 
Example 20
Project: devfestnorte-app   File: MyScheduleActivity.java   View source code 5 votes vote down vote up
@Override
public void onFragmentViewCreated(ListFragment fragment) {
    fragment.getListView().addHeaderView(
            getLayoutInflater().inflate(R.layout.reserve_action_bar_space_header_view, null));
    int dayIndex = fragment.getArguments().getInt(ARG_CONFERENCE_DAY_INDEX, 0);
    fragment.setListAdapter(mScheduleAdapters[dayIndex]);
    fragment.getListView().setRecyclerListener(mScheduleAdapters[dayIndex]);
}
 
Example 21
Project: rss   File: ListFragmentTag.java   View source code 5 votes vote down vote up
static
AdapterFeedItems getFavouritesAdapter(Activity activity)
{
    FragmentManager manager = activity.getFragmentManager();
    ListFragment fragment = (ListFragment) manager.findFragmentById(R.id.fragment_favourites);
    return (AdapterFeedItems) fragment.getListAdapter();
}
 
Example 22
Project: saarang-iosched   File: MyScheduleActivity.java   View source code 5 votes vote down vote up
@Override
public void onFragmentViewCreated(ListFragment fragment) {
    fragment.getListView().addHeaderView(
            getLayoutInflater().inflate(com.saarang.samples.apps.iosched.R.layout.reserve_action_bar_space_header_view, null));
    int dayIndex = fragment.getArguments().getInt(ARG_CONFERENCE_DAY_INDEX, 0);
    fragment.setListAdapter(mScheduleAdapters[dayIndex]);
    fragment.getListView().setRecyclerListener(mScheduleAdapters[dayIndex]);
}
 
Example 23
Project: gasp-android   File: TwitterRESTServiceActivity.java   View source code 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_rest_service);
    
    mAdapter = new ArrayAdapter<String>(this, R.layout.item_label_list);
    
    FragmentManager     fm = getFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    
    ListFragment list = new ListFragment();
    ft.add(R.id.fragment_content, list);
    
    // Let's set our list adapter to a simple ArrayAdapter.
    list.setListAdapter(mAdapter);
    
    // RESTResponderFragments call setRetainedInstance(true) in their onCreate() method. So that means
    // we need to check if our FragmentManager is already storing an instance of the responder.
    TwitterSearchResponderFragment responder = 
            (TwitterSearchResponderFragment) fm.findFragmentByTag("RESTResponder");
    if (responder == null) {
        responder = new TwitterSearchResponderFragment();
        
        // We add the fragment using a Tag since it has no views. It will make the Twitter REST call
        // for us each time this Activity is created.
        ft.add(responder, "RESTResponder");
    }

    // Make sure you commit the FragmentTransaction or your fragments
    // won't get added to your FragmentManager. Forgetting to call ft.commit()
    // is a really common mistake when starting out with Fragments.
    ft.commit();
}
 
Example 24
Project: gasp-android   File: GaspRESTServiceActivity.java   View source code 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_rest_service);
    
    mAdapter = new ArrayAdapter<String>(this, R.layout.item_label_list);
    
    FragmentManager     fm = getFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    
    ListFragment list = new ListFragment();
    ft.add(R.id.fragment_content, list);
    
    list.setListAdapter(mAdapter);
    
    // RESTResponderFragments call setRetainedInstance(true) in their onCreate() method. So that means
    // we need to check if our FragmentManager is already storing an instance of the responder.
    GaspReviewsResponderFragment responder = 
            (GaspReviewsResponderFragment) fm.findFragmentByTag("RESTResponder");
    if (responder == null) {
        responder = new GaspReviewsResponderFragment();
        
        // We add the fragment using a Tag since it has no views. It will make the Twitter REST call
        // for us each time this Activity is created.
        ft.add(responder, "RESTResponder");
    }

    ft.commit();
}
 
Example 25
Project: truth-android   File: ListFragmentSubject.java   View source code 4 votes vote down vote up
protected ListFragmentSubject(FailureStrategy failureStrategy, ListFragment subject) {
  super(failureStrategy, subject);
}
 
Example 26
Project: pictureapp   File: DashboardActivity.java   View source code 4 votes vote down vote up
public void replaceListFragment(int layout, ListFragment fragment) {
    FragmentTransaction ft = getFragmentTransaction();
    ft.replace(layout, fragment);
    ft.commit();
}
 
Example 27
Project: rss   File: AsyncManageAdapter.java   View source code 4 votes vote down vote up
public
AsyncManageAdapter(FeedsActivity activity, ListFragment listFragment)
{
    m_activity = activity;
    m_listFragment = listFragment;
}
 
Example 28
Project: assertj-android   File: ListFragmentAssert.java   View source code 4 votes vote down vote up
public ListFragmentAssert(ListFragment actual) {
  super(actual, ListFragmentAssert.class);
}
 
Example 29
Project: iosched-reader   File: MyScheduleFragment.java   View source code votes vote down vote up
public void onFragmentViewCreated(ListFragment fragment); 
Example 30
Project: smconf-android   File: MyScheduleFragment.java   View source code votes vote down vote up
public void onFragmentViewCreated(ListFragment fragment); 
Example 31
Project: 2015-Google-I-O-app   File: MyScheduleFragment.java   View source code votes vote down vote up
public void onFragmentViewCreated(ListFragment fragment); 
Example 32
Project: FMTech   File: MyScheduleFragment.java   View source code votes vote down vote up
public void onFragmentViewCreated(ListFragment fragment); 
Example 33
Project: saarang-iosched   File: MyScheduleFragment.java   View source code votes vote down vote up
public void onFragmentViewCreated(ListFragment fragment); 
Example 34
Project: AppDevFestSudeste2015   File: MyScheduleFragment.java   View source code votes vote down vote up
public void onFragmentViewCreated(ListFragment fragment); 
Example 35
Project: JJCamera   File: MyScheduleFragment.java   View source code votes vote down vote up
public void onFragmentViewCreated(ListFragment fragment); 
Example 36
Project: devfestnorte-app   File: MyScheduleFragment.java   View source code votes vote down vote up
public void onFragmentViewCreated(ListFragment fragment); 
Example 37
Project: saarang-iosched   File: MyScheduleFragment.java   View source code votes vote down vote up
public void onFragmentViewCreated(ListFragment fragment);