Search in sources :

Example 1 with AppsListAdapter

use of ru.playsoftware.j2meloader.applist.AppsListAdapter in project J2ME-Loader by nikita36078.

the class MainActivity method setupActivity.

private void setupActivity() {
    initFolders();
    checkActionBar();
    appsListFragment = new AppsListFragment();
    ArrayList<AppItem> apps = new ArrayList<>();
    AppsListAdapter adapter = new AppsListAdapter(this, apps);
    appsListFragment.setListAdapter(adapter);
    FragmentManager fragmentManager = getSupportFragmentManager();
    fragmentManager.beginTransaction().replace(R.id.container, appsListFragment).commitAllowingStateLoss();
    initDb();
    updateAppsList();
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) AppsListAdapter(ru.playsoftware.j2meloader.applist.AppsListAdapter) AppsListFragment(ru.playsoftware.j2meloader.applist.AppsListFragment) AppItem(ru.playsoftware.j2meloader.applist.AppItem) ArrayList(java.util.ArrayList)

Example 2 with AppsListAdapter

use of ru.playsoftware.j2meloader.applist.AppsListAdapter in project J2ME-Loader by nikita36078.

the class MainActivity method updateAppsList.

private void updateAppsList() {
    String appSort = sp.getString("pref_app_sort", "name");
    List<AppItem> apps;
    if (appSort.equals("name")) {
        apps = appItemDao.getAllByName();
    } else {
        apps = appItemDao.getAllByDate();
    }
    AppsListAdapter adapter = (AppsListAdapter) appsListFragment.getListAdapter();
    adapter.setItems(apps);
    adapter.notifyDataSetChanged();
}
Also used : AppsListAdapter(ru.playsoftware.j2meloader.applist.AppsListAdapter) AppItem(ru.playsoftware.j2meloader.applist.AppItem)

Aggregations

AppItem (ru.playsoftware.j2meloader.applist.AppItem)2 AppsListAdapter (ru.playsoftware.j2meloader.applist.AppsListAdapter)2 FragmentManager (android.support.v4.app.FragmentManager)1 ArrayList (java.util.ArrayList)1 AppsListFragment (ru.playsoftware.j2meloader.applist.AppsListFragment)1