use of android.support.v4.app.FragmentPagerAdapter in project leo-app by LCA311.
the class WrapperQRActivity method onCreate.
/* private ZXingScannerView scV;
public static Button scan;
private final int MY_PERMISSIONS_REQUEST_USE_CAMERA = 0;
private boolean runningScan; */
@Override
protected void onCreate(Bundle savedInstanceState) {
/* super.onCreate(savedInstanceState);
setContentView(R.layout.activity_wrapper_qr); */
//---- START TOOLBAR ---- //
Toolbar myToolbar = (Toolbar) findViewById(R.id.toolbar);
// runningScan = false;
setSupportActionBar(myToolbar);
//If it's stupid, but it works it's not stupid
getSupportActionBar().setTitle(Html.fromHtml("<font color=\"#ffffff\">" + getString(R.string.toolbar_title) + "</font>"));
getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_menu_white_24dp);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
//---- ENDE TOOLBAR ---- //
//---- START TABS ---- //
mViewPager = (ViewPager) findViewById(R.id.pager);
FragmentPagerAdapter adapt = new FragmentPagerAdapter(getSupportFragmentManager()) {
@Override
public Fragment getItem(int position) {
if (position == 0)
//QRActivity ist ein Fragment trotz des Namens
return new QRActivity();
else
//ScanActivity ist ein Fragment trotz des Namens
return new ScanActivity();
}
@Override
public int getCount() {
return 2;
}
@Override
public CharSequence getPageTitle(int position) {
if (position == 0)
return getString(R.string.toolbar_qr);
else
return getString(R.string.toolbar_scan);
}
};
mViewPager.setAdapter(adapt);
TabLayout tabLayout = (TabLayout) findViewById(R.id.tablayout);
tabLayout.setupWithViewPager(mViewPager);
//---- ENDE TABS ---- //
/* sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
sqlh = new SQLiteHandler(getApplicationContext());
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
scan.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
scan();
}
});
}
}, 100); */
}
use of android.support.v4.app.FragmentPagerAdapter in project ride-read-android by Ride-Read.
the class LoginActivity method initViewPager.
private void initViewPager() {
mFragments = new ArrayList<>(2);
mFragments.add(new LoginFragment());
mFragments.add(new RegisterFragment());
FragmentPagerAdapter fpa = new FragmentPagerAdapter(getSupportFragmentManager()) {
@Override
public Fragment getItem(int position) {
return mFragments.get(position);
}
@Override
public int getCount() {
return mFragments.size();
}
};
mViewpagerTabView.setAdapter(fpa);
}
use of android.support.v4.app.FragmentPagerAdapter in project RxBus by ViTess.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById(R.id.main_bt).setOnClickListener(this);
findViewById(R.id.main_bt_void).setOnClickListener(this);
findViewById(R.id.main_bt_tag1).setOnClickListener(this);
findViewById(R.id.main_bt_tag2).setOnClickListener(this);
findViewById(R.id.main_bt_tag3).setOnClickListener(this);
vp = (ViewPager) findViewById(R.id.main_vp);
arrayList.add(f1);
arrayList.add(f2);
adapter = new FragmentPagerAdapter(getSupportFragmentManager()) {
@Override
public Fragment getItem(int position) {
return arrayList.get(position);
}
@Override
public int getCount() {
return arrayList.size();
}
};
vp.setAdapter(adapter);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.main_fl, f3);
transaction.commit();
RxBus.register(this);
}
use of android.support.v4.app.FragmentPagerAdapter in project ViewPagerIndicator by JakeWharton.
the class SampleTabsDefault method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.simple_tabs);
FragmentPagerAdapter adapter = new GoogleMusicAdapter(getSupportFragmentManager());
ViewPager pager = (ViewPager) findViewById(R.id.pager);
pager.setAdapter(adapter);
TabPageIndicator indicator = (TabPageIndicator) findViewById(R.id.indicator);
indicator.setViewPager(pager);
}
use of android.support.v4.app.FragmentPagerAdapter in project AndroidDevelop by 7449.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
viewPager = (ViewPager) findViewById(R.id.viewpager);
RadioGroup radioGroup = (RadioGroup) findViewById(R.id.rg_group);
imageView = (ImageView) findViewById(R.id.iv_line);
Display display = getWindow().getWindowManager().getDefaultDisplay();
DisplayMetrics dm = new DisplayMetrics();
display.getMetrics(dm);
ivWidth = (dm.widthPixels / 3);
viewPager.addOnPageChangeListener(this);
radioGroup.setOnCheckedChangeListener(this);
viewPager.setAdapter(new FragmentPagerAdapter(getSupportFragmentManager()) {
@Override
public Fragment getItem(int position) {
return ViewPagerFragment.startFragment(position);
}
@Override
public int getCount() {
return 3;
}
});
}
Aggregations