Java Code Examples for android.support.v4.app.ListFragment

The following are top voted examples for showing how to use android.support.v4.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: fantasywear   File: MainActivity.java   View source code 6 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mListFragment = (ListFragment) getSupportFragmentManager().findFragmentById(R.id.list);
    mListFragment.getListView().setOnItemClickListener(this);

    mAddAccountButton = (Button) findViewById(R.id.add_account);
    mAddAccountButton.setOnClickListener(this);

    mLeagueAdapter = new LeagueAdapter();
    mAccountAdapter = new AccountAdapter();

    initAccountManager();

    if (savedInstanceState != null) {
        mShowingAccounts = savedInstanceState.getBoolean(SAVED_SHOWING_ACCOUNTS);
    }

    updateActiveList(false);

    getSupportLoaderManager().initLoader(LOADER_LEAGUE, null, this);
}
 
Example 2
Project: SensorDataCollector   File: TestHelper.java   View source code 6 votes vote down vote up
public static Activity viewMostRecentExperiment(ActivityInstrumentationTestCase2<?> testCase,
        Activity activity) {
    // view the most recent experiment
    Fragment fragment = ((SensorDataCollectorActivity) activity).getSupportFragmentManager()
            .findFragmentById(R.id.fragment_container);
    Assert.assertNotNull("The Sensor List Fragment should not be null.", fragment);

    ListView listView = ((ListFragment) fragment).getListView();
    Assert.assertNotNull("ListView should not be null.", listView);

    ActivityMonitor monitor = testCase.getInstrumentation().addMonitor(
            ViewExperimentActivity.class.getName(), null, false);
    TouchUtils.clickView(testCase, listView.getChildAt(listView.getHeaderViewsCount()));
    testCase.getInstrumentation().waitForIdleSync();

    ViewExperimentActivity viewExperimentActivity = (ViewExperimentActivity) testCase
            .getInstrumentation().waitForMonitor(monitor);
    Assert.assertTrue("activity should be a ViewExperimentActivity.",
            viewExperimentActivity instanceof ViewExperimentActivity);
    testCase.getInstrumentation().removeMonitor(monitor);

    // clone the experiment
    testCase.getInstrumentation().waitForIdleSync();
    return viewExperimentActivity;
}
 
Example 3
Project: ExtraMapUtils   File: ListViewFragment.java   View source code 5 votes vote down vote up
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_list_view,
            container, false);
    mAdapter = new MapAdapter(getActivity(), LIST_OPTION_VIEW);
    mList = (ListFragment) getChildFragmentManager().findFragmentById(R.id.list);
    mList.setListAdapter(mAdapter);
    AbsListView lv = mList.getListView();
    lv.setRecyclerListener(mRecycleListener);
    return view;

}
 
Example 4
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 5
Project: binea_project_for_android   File: MainActivity.java   View source code 5 votes vote down vote up
@Override protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ListFragment listFragment = new SimpleListFragment();

    getSupportFragmentManager().beginTransaction().replace(R.id.container, listFragment).commit();
}
 
Example 6
Project: nolotiro-android   File: UpdateAdsTask.java   View source code 5 votes vote down vote up
public UpdateAdsTask(ListFragment _fragment, Integer _woeid) {
    api = NolotiroAPI.getInstance();
    context = _fragment.getActivity();
    fragment = _fragment;
    woeid = _woeid;
   // progress = new ProgressDialog(context);
   // progress.setMessage(context.getResources().getString(R.string.loading));
}
 
Example 7
Project: android-oauth-client   File: LoadableDecorator.java   View source code 5 votes vote down vote up
public LoadableDecorator(LoaderCallbacks<Result<T>> callbacks, int loaderId,
        ListFragment listFragment) {
    super();
    this.mCallbacks = Preconditions.checkNotNull(callbacks);
    this.mLoaderId = loaderId;
    this.mListFragment = Preconditions.checkNotNull(listFragment);
    this.mAdapterView = Preconditions.checkNotNull(listFragment.getListView());

    mListFragment.setListShown(false);
}
 
Example 8
Project: Android-Pasar-Malam-Locator   File: MainActivity.java   View source code 4 votes vote down vote up
@Override
public Fragment getItem(int position) {
    // if its 1st page, show our nearby UI
    if (position == 0) return new NearbyFragment();
    else return new ListFragment();
}
 
Example 9
Project: Android-Pasar-Malam-Locator   File: MainActivity.java   View source code 4 votes vote down vote up
@Override
public Fragment getItem(int position) {
    // if its 1st page, show our nearby UI
    if (position == 0) return new NearbyFragment();
    else return new ListFragment();
}
 
Example 10
Project: Android-Pasar-Malam-Locator   File: MainActivity.java   View source code 4 votes vote down vote up
@Override
public Fragment getItem(int position) {
    // temporarily use existing UI as placeholder
    return new ListFragment();
}
 
Example 11
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 12
Project: Studentenportal   File: CourseListFragment.java   View source code 4 votes vote down vote up
public CourseListAdapter(ListFragment context, List<Lehrveranstaltung> list) {
	super(context, list, R.layout.course_list_item);
}
 
Example 13
Project: Studentenportal   File: GenericListFragmentAdapter.java   View source code 4 votes vote down vote up
public GenericListFragmentAdapter(ListFragment context, List<T> list, int viewResourceId) {
	this.mContext = context;
	this.mList = list;
	this.mViewResourceId = viewResourceId;
}
 
Example 14
Project: Studentenportal   File: ExamListFragment.java   View source code 4 votes vote down vote up
public ExamListAdapter(ListFragment context, List<Pruefung> list) {
	super(context, list, R.layout.exam_list_item);
}
 
Example 15
Project: Ingress-Portals-Navigation   File: ShunixHandler.java   View source code 4 votes vote down vote up
public ShunixHandler(ListFragment fragment) {
	this.fragment = fragment;
}
 
Example 16
Project: secu3droid   File: DiagnosticsActivity.java   View source code 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	setTheme(PreferenceManager.getDefaultSharedPreferences(this).getBoolean(getString(R.string.pref_night_mode_key), false) ? R.style.AppBaseTheme : R.style.AppBaseTheme_Light);
	setContentView(R.layout.activity_diagnostics);
	
	protocolversion = SettingsActivity.getProtocolVersion(this);
	List<Fragment> pages = new ArrayList<>();
	ArrayList<BaseParamItem> inputItems = new ArrayList<>();
	outputItems = new ArrayList<>();
	
	inputItems.add(new ParamItemFloat(this, R.string.diag_input_voltage_title, 0, R.string.units_volts,0,0,100,0).setFormat("%.3f"));
	inputItems.add(new ParamItemFloat(this, R.string.diag_input_map_s, 0, R.string.units_volts,0,0,100,0).setFormat("%.3f"));
	inputItems.add(new ParamItemFloat(this, R.string.diag_input_temp, 0, R.string.units_volts,0,0,100,0).setFormat("%.3f"));
	inputItems.add(new ParamItemFloat(this, R.string.diag_input_add_io1, 0, R.string.units_volts,0,0,100,0).setFormat("%.3f"));
	inputItems.add(new ParamItemFloat(this, R.string.diag_input_add_io2, 0, R.string.units_volts,0,0,100,0).setFormat("%.3f"));
	inputItems.add(new ParamItemFloat(this, R.string.diag_input_carb_title, 0, R.string.units_volts,0,0,100,0).setFormat("%.3f"));
	inputItems.add(new ParamItemBoolean(this, R.string.diag_input_gas_v, 0, false,false));
	inputItems.add(new ParamItemBoolean(this, R.string.diag_input_ckps, 0, false,false));
	inputItems.add(new ParamItemBoolean(this, R.string.diag_input_ref_s, 0, false,false));
	inputItems.add(new ParamItemBoolean(this, R.string.diag_input_ps, 0, false,false));
	inputItems.add(new ParamItemBoolean(this, R.string.diag_input_bl, 0, false,false));
	inputItems.add(new ParamItemBoolean(this, R.string.diag_input_de, 0, false,false));
	inputItems.add(new ParamItemFloat(this, R.string.diag_input_ks1_title, 0, R.string.units_volts,0,0,100,0).setFormat("%.3f"));
	inputItems.add(new ParamItemFloat(this, R.string.diag_input_ks2_title, 0, R.string.units_volts,0,0,100,0).setFormat("%.3f"));

	createOutputs();
	
	inputFragment = new ListFragment();
	inputFragment.setListAdapter(new ParamItemsAdapter(inputItems));
	OutputDiagListFragment outputsFragment = new OutputDiagListFragment();
	outputsFragment.setOnItemClickListener(this);
	outputsFragment.setListAdapter(new ParamItemsAdapter(outputItems));
	pages.add(inputFragment);
	pages.add(outputsFragment);

	DiagnosticsPagerAdapter diagnosticsAdapter = new DiagnosticsPagerAdapter(getSupportFragmentManager(),pages);
	receiver = new ReceiveMessages();
	textViewStatus = (TextView) findViewById(R.id.diagnosticsStatusTextView);		
	pager = (ViewPager)findViewById(R.id.diagnosticsPager);
	pager.setAdapter(diagnosticsAdapter);	
	
	if (savedInstanceState != null) {
		int outputs = savedInstanceState.getInt(OUTPUTS);
		setOutputs(outputs);
		boolean blde = savedInstanceState.getBoolean(BLDEENABLED);
		setBlDeEnabled(blde);
		int page = savedInstanceState.getInt(PAGE);
		pager.setCurrentItem(page);
	}
	
	CheckBox checkBoxEnableBlDeDiagnostics = (CheckBox) findViewById(R.id.diagnosticsEnableBlDe);
	checkBoxEnableBlDeDiagnostics.setVisibility((protocolversion >= SettingsActivity.PROTOCOL_14012014_WINTER_RELEASE)?View.VISIBLE:View.GONE);
	checkBoxEnableBlDeDiagnostics.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
		
		@Override
		public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {				
			setBlDeEnabled(isChecked);
		}
	});
	
	super.onCreate(savedInstanceState);		
}
 
Example 17
Project: assertj-android   File: ListFragmentAssert.java   View source code 4 votes vote down vote up
public ListFragmentAssert(ListFragment actual) {
  super(actual, ListFragmentAssert.class);
}
 
Example 18
Project: TheMovies   File: TabsAdapter.java   View source code 3 votes vote down vote up
private void setTabs() {
    tabs = new ArrayList<>();


    ListFragment uno = new ListFragment();
    ListFragment myMovies = new ListFragment();
    ListFragment theMoviesDbMovies = new ListFragment();


    tabs.add(uno);
    tabs.add(myMovies);
    tabs.add(theMoviesDbMovies);
}