use of android.support.v4.app.FragmentManager in project RxJava-Android-Samples by kaushikgopal.
the class RotationPersist1Fragment method startOperationFromWorkerFrag.
// -----------------------------------------------------------------------------------
@OnClick(R.id.btn_rotate_persist)
public void startOperationFromWorkerFrag() {
_logs = new ArrayList<>();
_adapter.clear();
FragmentManager fm = getActivity().getSupportFragmentManager();
RotationPersist1WorkerFragment frag = (RotationPersist1WorkerFragment) fm.findFragmentByTag(RotationPersist1WorkerFragment.TAG);
if (frag == null) {
frag = new RotationPersist1WorkerFragment();
fm.beginTransaction().add(frag, RotationPersist1WorkerFragment.TAG).commit();
} else {
Timber.d("Worker frag already spawned");
}
}
use of android.support.v4.app.FragmentManager in project nmid-headline by miao1007.
the class HomeActivity method onNavigationDrawerItemSelected.
@Override
public void onNavigationDrawerItemSelected(int position) {
FragmentManager fragmentManager = getSupportFragmentManager();
Fragment fragment = null;
switch(position) {
case 0:
fragment = new SlidingTabFragment();
break;
case 1:
fragment = new ImagesFeedFragment();
break;
case 2:
fragment = new FavFeedFragment();
break;
}
if (fragment != null) {
fragmentManager.beginTransaction().replace(R.id.base_fragment_container, fragment).commit();
}
}
use of android.support.v4.app.FragmentManager in project AndroidChangeSkin by hongyangAndroid.
the class MainActivity method initView.
private void initView() {
mDrawerLayout = (DrawerLayout) findViewById(R.id.id_drawerLayout);
FragmentManager fm = getSupportFragmentManager();
Fragment fragment = fm.findFragmentById(R.id.id_left_menu_container);
if (fragment == null) {
fm.beginTransaction().add(R.id.id_left_menu_container, new MenuLeftFragment()).commit();
}
}
use of android.support.v4.app.FragmentManager in project zxingfragmentlib by mitoyarzun.
the class SampleStretchedActivity method onCreate.
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_stretched_sample);
FragmentManager fm = getSupportFragmentManager();
mScannerFragment = (BarCodeScannerFragment) fm.findFragmentById(R.id.scanner_fragment);
layoutContent = (LinearLayout) findViewById(R.id.layout_content);
final ViewTreeObserver observer = layoutContent.getViewTreeObserver();
observer.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
// We're assuming that the other layout is under the scanner
int activityWidth = layoutContent.getWidth();
int activityHeight = findViewById(R.id.scanner_fragment).getHeight();
int usableWidth = layoutContent.getWidth();
int usableHeight = activityHeight - layoutContent.getHeight();
int desiredHeight = (int) (usableHeight * 0.8);
int desiredWidth = (int) (usableWidth * 0.75);
Rect framingRect = new Rect(// left
(usableWidth - desiredWidth) / 2, // top
(usableHeight - desiredHeight) / 2, // right
(usableWidth - desiredWidth) / 2 + desiredWidth, // bottom
(usableHeight - desiredHeight) / 2 + desiredHeight);
Log.v("RECT", "left: " + framingRect.left + " top: " + framingRect.top + " right: " + framingRect.right + " bottom: " + framingRect.bottom + " activityHeight: " + activityHeight + " activitiWidth: " + activityWidth);
// mScannerFragment.setFramingRect(framingRect);
}
});
// mToggleButton = (Button) findViewById(R.id.button_flash);
// mToggleButton.setOnClickListener(createToggleFlashListener());
}
use of android.support.v4.app.FragmentManager in project AboutLibraries by mikepenz.
the class FragmentActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fragment);
//Remove line to test RTL support
//getWindow().getDecorView().setLayoutDirection(View.LAYOUT_DIRECTION_RTL);
// Handle Toolbar
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
new DrawerBuilder(this).withToolbar(toolbar).addDrawerItems(new PrimaryDrawerItem().withName("Home"), new PrimaryDrawerItem().withName(R.string.action_manifestactivity).withIdentifier(R.id.action_manifestactivity).withSelectable(false), new PrimaryDrawerItem().withName(R.string.action_extendactivity).withIdentifier(R.id.action_extendactivity).withSelectable(false), new PrimaryDrawerItem().withName(R.string.action_customsortactivity).withIdentifier(R.id.action_customsortactivity).withSelectable(false), new PrimaryDrawerItem().withName(R.string.action_opensource).withIdentifier(R.id.action_opensource).withSelectable(false)).withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
@Override
public boolean onItemClick(View view, int i, IDrawerItem drawerItem) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
long id = drawerItem.getIdentifier();
if (id == R.id.action_opensource) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/mikepenz/AboutLibraries"));
startActivity(browserIntent);
} else if (id == R.id.action_extendactivity) {
Intent intent = new Intent(getApplicationContext(), ExtendActivity.class);
startActivity(intent);
} else if (id == R.id.action_customsortactivity) {
Intent intent = new Intent(getApplicationContext(), CustomSortActivity.class);
startActivity(intent);
} else if (id == R.id.action_manifestactivity) {
new LibsBuilder().withLibraries("crouton, actionbarsherlock", "showcaseview").withAutoDetect(true).withLicenseShown(true).withVersionShown(true).withActivityTitle("Open Source").withActivityStyle(Libs.ActivityStyle.LIGHT_DARK_TOOLBAR).withListener(libsListener).withLibTaskCallback(libTaskCallback).withUiListener(libsUIListener).start(FragmentActivity.this);
}
return false;
}
}).build();
/*
//NOTE: This is how you can modify a specific library definition during runtime
HashMap<String, HashMap<String, String>> libsModification = new HashMap<String, HashMap<String, String>>();
HashMap<String, String> modifyAboutLibraries = new HashMap<String, String>();
modifyAboutLibraries.put("name", "_AboutLibraries");
libsModification.put("aboutlibraries", modifyAboutLibraries);
.withLibraryModification(libsModification);
*/
LibsSupportFragment fragment = new LibsBuilder().withLibraries("crouton", "activeandroid", "actionbarsherlock", "showcaseview").withVersionShown(false).withLicenseShown(false).withLibraryModification("aboutlibraries", Libs.LibraryFields.LIBRARY_NAME, "_AboutLibraries").supportFragment();
FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction().replace(R.id.frame_container, fragment).commit();
}
Aggregations