Search in sources :

Example 1 with MaterialTabs

use of io.karim.MaterialTabs in project cw-omnibus by commonsguy.

the class MainActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    pager = (ViewPager) findViewById(R.id.pager);
    adapter = new SampleAdapter(this, getFragmentManager());
    pager.setAdapter(adapter);
    MaterialTabs tabs = (MaterialTabs) findViewById(R.id.tabs);
    tabs.setViewPager(pager);
}
Also used : MaterialTabs(io.karim.MaterialTabs)

Example 2 with MaterialTabs

use of io.karim.MaterialTabs in project cw-omnibus by commonsguy.

the class MainActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    pager = (ViewPager) findViewById(R.id.pager);
    adapter = new SampleAdapter(this, getFragmentManager());
    pager.setAdapter(adapter);
    MaterialTabs tabs = (MaterialTabs) findViewById(R.id.tabs);
    tabs.setViewPager(pager);
}
Also used : MaterialTabs(io.karim.MaterialTabs)

Example 3 with MaterialTabs

use of io.karim.MaterialTabs in project cw-omnibus by commonsguy.

the class MainActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    pager = (ViewPager) findViewById(R.id.pager);
    adapter = new SampleAdapter(this, getFragmentManager());
    pager.setAdapter(adapter);
    MaterialTabs tabs = (MaterialTabs) findViewById(R.id.tabs);
    tabs.setViewPager(pager);
}
Also used : MaterialTabs(io.karim.MaterialTabs)

Example 4 with MaterialTabs

use of io.karim.MaterialTabs in project cw-omnibus by commonsguy.

the class MainActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    final ViewPager pager = (ViewPager) findViewById(R.id.pager);
    final MaterialTabs tabs = (MaterialTabs) findViewById(R.id.tabs);
    observable = (Observable<PermissionRoster>) getLastNonConfigurationInstance();
    if (observable == null) {
        observable = Observable.create(new PermissionSource(this)).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).cache();
    }
    sub = observable.subscribe(new Consumer<PermissionRoster>() {

        @Override
        public void accept(PermissionRoster roster) throws Exception {
            pager.setAdapter(new PermissionTabAdapter(MainActivity.this, getFragmentManager(), roster));
            tabs.setViewPager(pager);
        }
    }, new Consumer<Throwable>() {

        @Override
        public void accept(Throwable error) throws Exception {
            Toast.makeText(MainActivity.this, error.getMessage(), Toast.LENGTH_LONG).show();
            Log.e(getClass().getSimpleName(), "Exception processing request", error);
        }
    });
}
Also used : MaterialTabs(io.karim.MaterialTabs) Consumer(io.reactivex.functions.Consumer) ViewPager(android.support.v4.view.ViewPager)

Example 5 with MaterialTabs

use of io.karim.MaterialTabs in project cw-omnibus by commonsguy.

the class EmPubLiteActivity method setupPager.

private void setupPager(BookContents contents) {
    adapter = new ContentsAdapter(this, contents);
    pager.setAdapter(adapter);
    MaterialTabs tabs = (MaterialTabs) findViewById(R.id.tabs);
    tabs.setViewPager(pager);
    SharedPreferences prefs = mfrag.getPrefs();
    if (prefs != null) {
        if (prefs.getBoolean(PREF_SAVE_LAST_POSITION, false)) {
            pager.setCurrentItem(prefs.getInt(PREF_LAST_POSITION, 0));
        }
        pager.setKeepScreenOn(prefs.getBoolean(PREF_KEEP_SCREEN_ON, false));
    }
}
Also used : MaterialTabs(io.karim.MaterialTabs) SharedPreferences(android.content.SharedPreferences)

Aggregations

MaterialTabs (io.karim.MaterialTabs)10 ViewPager (android.support.v4.view.ViewPager)2 SharedPreferences (android.content.SharedPreferences)1 Consumer (io.reactivex.functions.Consumer)1