List of usage examples for android.widget FrameLayout setId
public void setId(@IdRes int id)
From source file:com.google.android.apps.iosched.ui.StarredActivity.java
/** * Build and add "vendors" tab.// w w w .java2s. c om */ private void setupVendorsTab() { // TODO: this is very inefficient and messy, clean it up FrameLayout fragmentContainer = new FrameLayout(this); fragmentContainer.setId(R.id.fragment_vendors); fragmentContainer.setLayoutParams( new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); ((ViewGroup) findViewById(android.R.id.tabcontent)).addView(fragmentContainer); final Intent intent = new Intent(Intent.ACTION_VIEW, Vendors.CONTENT_STARRED_URI); final FragmentManager fm = getSupportFragmentManager(); mVendorsFragment = (VendorsFragment) fm.findFragmentByTag("vendors"); if (mVendorsFragment == null) { mVendorsFragment = new VendorsFragment(); mVendorsFragment.setArguments(intentToFragmentArguments(intent)); fm.beginTransaction().add(R.id.fragment_vendors, mVendorsFragment, "vendors").commit(); } // Vendors content comes from reused activity mTabHost.addTab(mTabHost.newTabSpec(TAG_VENDORS).setIndicator(buildIndicator(R.string.starred_vendors)) .setContent(R.id.fragment_vendors)); }
From source file:com.android.example.github.testing.SingleFragmentActivity.java
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); FrameLayout content = new FrameLayout(this); content.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); content.setId(R.id.container); setContentView(content);/*from w ww .j a v a2s .c o m*/ }
From source file:com.infine.android.devoxx.ui.StarredActivity.java
private void setupContent() { FrameLayout fragmentContainer = new FrameLayout(this); fragmentContainer.setId(R.id.fragment_sessions); fragmentContainer.setLayoutParams(//from www. j a v a 2 s. c o m new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); ((ViewGroup) findViewById(R.id.starredcontent)).addView(fragmentContainer); final Intent intent = new Intent(Intent.ACTION_VIEW, Sessions.CONTENT_STARRED_URI); final FragmentManager fm = getSupportFragmentManager(); mSessionsFragment = (SessionsFragment) fm.findFragmentByTag("sessions"); if (mSessionsFragment == null) { mSessionsFragment = new SessionsFragment(); mSessionsFragment.setArguments(intentToFragmentArguments(intent)); fm.beginTransaction().add(R.id.fragment_sessions, mSessionsFragment, "sessions").commit(); } }
From source file:com.infine.android.devoxx.ui.StarredActivity.java
/** * Build and add "vendors" tab./* w w w.ja v a 2s. c o m*/ */ private void setupVendorsTab() { // TODO: this is very inefficient and messy, clean it up FrameLayout fragmentContainer = new FrameLayout(this); fragmentContainer.setId(R.id.fragment_speakers); fragmentContainer.setLayoutParams( new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); ((ViewGroup) findViewById(android.R.id.tabcontent)).addView(fragmentContainer); final Intent intent = new Intent(Intent.ACTION_VIEW, Vendors.CONTENT_STARRED_URI); final FragmentManager fm = getSupportFragmentManager(); // mVendorsFragment = (VendorsFragment) fm.findFragmentByTag("vendors"); // if (mVendorsFragment == null) { // mVendorsFragment = new VendorsFragment(); // mVendorsFragment.setArguments(intentToFragmentArguments(intent)); // fm.beginTransaction() // .add(R.id.fragment_speakers, mVendorsFragment, "vendors") // .commit(); // } // Vendors content comes from reused activity mTabHost.addTab(mTabHost.newTabSpec(TAG_VENDORS).setIndicator(buildIndicator(R.string.starred_speakers)) .setContent(R.id.fragment_speakers)); }
From source file:com.codeslap.topy.BaseActivity.java
/** * Helper method that allows to initialize and add a fragment to activities that usually have * just one single fragment. Fragment is added using its class.getName() as tag. * * @param containerId resource id of the fragment container (must be created through android resources) * @param fragmentClass the class of the fragment to setup * @param args bundle with the arguments to pass to the fragment *///from w w w. j a v a 2 s . com protected void setupBaseFragment(int containerId, Class<? extends Fragment> fragmentClass, Bundle args) { if (mSetContentViewAlreadyCalled) { View view = findViewById(containerId); if (!(view instanceof ViewGroup)) { throw new IllegalStateException( "Since you already called setContentView, it must has a ViewGroup whose id is 'containerId'"); } } else { FrameLayout container = new FrameLayout(this); container.setId(containerId); setContentView(container); } // let's check whether fragment is already added Fragment fragment = findFragment(fragmentClass); if (fragment == null) { // if not, let's create it and add it fragment = Fragment.instantiate(this, fragmentClass.getName(), args); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.add(containerId, fragment, fragmentClass.getSimpleName()); ft.commit(); } }
From source file:net.peterkuterna.android.apps.devoxxfrsched.ui.ProgressFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Context context = getActivity(); FrameLayout root = new FrameLayout(context); LinearLayout pframe = new LinearLayout(context); pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID); pframe.setOrientation(LinearLayout.VERTICAL); pframe.setVisibility(View.GONE); pframe.setGravity(Gravity.CENTER);/*from w ww . ja va2 s . c o m*/ ProgressBar progress = new ProgressBar(context, null, android.R.attr.progressBarStyleLarge); pframe.addView(progress, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); root.addView(pframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); FrameLayout cframe = new FrameLayout(context); cframe.setId(INTERNAL_CONTENT_CONTAINER_ID); TextView tv = new TextView(context); tv.setId(INTERNAL_EMPTY_ID); tv.setGravity(Gravity.CENTER); cframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); View contentView = onCreateContentView(inflater, cframe, savedInstanceState); cframe.addView(contentView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); root.addView(cframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); return root; }
From source file:com.google.android.apps.iosched2.ui.StarredActivity.java
/** * Build and add "vendors" tab./*from w w w . j a v a 2 s . c o m*/ */ private void setupVendorsTab() { // TODO: this is very inefficient and messy, clean it up FrameLayout fragmentContainer = new FrameLayout(this); fragmentContainer.setId(R.id.fragment_vendors); fragmentContainer.setLayoutParams( new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); ((ViewGroup) findViewById(android.R.id.tabcontent)).addView(fragmentContainer); final Intent intent = new Intent(Intent.ACTION_VIEW, Vendors.CONTENT_STARRED_URI); final FragmentManager fm = getSupportFragmentManager(); mVendorsFragment = (VendorsFragment) fm.findFragmentByTag("vendors"); if (mVendorsFragment == null) { mVendorsFragment = new VendorsFragment(); mVendorsFragment.setArguments(intentToFragmentArguments(intent)); fm.beginTransaction().add(R.id.fragment_vendors, mVendorsFragment, "vendors").commit(); } // Vendors content comes from reused activity /* * removed vendors */ if (Setup.FEATURE_VENDORS_ON) { mTabHost.addTab(mTabHost.newTabSpec(TAG_VENDORS).setIndicator(buildIndicator(R.string.starred_vendors)) .setContent(R.id.fragment_vendors)); } }
From source file:com.infine.android.devoxx.ui.SearchActivity.java
/** * Build and add "speaker" tab.//from w w w.j a va 2 s. c o m * TODO : update it to search in speaker names ? */ private void setupSpeakersTab() { // TODO: this is very inefficient and messy, clean it up FrameLayout fragmentContainer = new FrameLayout(this); fragmentContainer.setId(R.id.fragment_speakers); fragmentContainer.setLayoutParams( new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); ((ViewGroup) findViewById(android.R.id.tabcontent)).addView(fragmentContainer); final FragmentManager fm = getSupportFragmentManager(); mSpeakersFragment = (SpeakersFragment) fm.findFragmentByTag("speakers"); if (mSpeakersFragment == null) { mSpeakersFragment = new SpeakersFragment(); mSpeakersFragment.setArguments(getSpeakersFragmentArguments()); fm.beginTransaction().add(R.id.fragment_speakers, mSpeakersFragment, "speakers").commit(); } else { mSpeakersFragment.reloadFromArguments(getSpeakersFragmentArguments()); } // Vendors content comes from reused activity mTabHost.addTab(mTabHost.newTabSpec(TAG_SPEAKERS).setIndicator(buildIndicator(R.string.starred_speakers)) .setContent(R.id.fragment_speakers)); }
From source file:com.google.android.apps.iosched.ui.SearchActivity.java
/** * Build and add "sessions" tab.//from w ww . j a v a2s . co m */ private void setupSessionsTab() { // TODO: this is very inefficient and messy, clean it up FrameLayout fragmentContainer = new FrameLayout(this); fragmentContainer.setId(R.id.fragment_sessions); fragmentContainer.setLayoutParams( new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); ((ViewGroup) findViewById(android.R.id.tabcontent)).addView(fragmentContainer); final FragmentManager fm = getSupportFragmentManager(); mSessionsFragment = (SessionsFragment) fm.findFragmentByTag("sessions"); if (mSessionsFragment == null) { mSessionsFragment = new SessionsFragment(); mSessionsFragment.setArguments(getSessionsFragmentArguments()); fm.beginTransaction().add(R.id.fragment_sessions, mSessionsFragment, "sessions").commit(); } else { mSessionsFragment.reloadFromArguments(getSessionsFragmentArguments()); } // Sessions content comes from reused activity mTabHost.addTab(mTabHost.newTabSpec(TAG_SESSIONS).setIndicator(buildIndicator(R.string.starred_sessions)) .setContent(R.id.fragment_sessions)); }
From source file:com.google.android.apps.iosched.ui.SearchActivity.java
/** * Build and add "vendors" tab./*from w w w.j a v a 2 s .c o m*/ */ private void setupVendorsTab() { // TODO: this is very inefficient and messy, clean it up FrameLayout fragmentContainer = new FrameLayout(this); fragmentContainer.setId(R.id.fragment_vendors); fragmentContainer.setLayoutParams( new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); ((ViewGroup) findViewById(android.R.id.tabcontent)).addView(fragmentContainer); final FragmentManager fm = getSupportFragmentManager(); mVendorsFragment = (VendorsFragment) fm.findFragmentByTag("vendors"); if (mVendorsFragment == null) { mVendorsFragment = new VendorsFragment(); mVendorsFragment.setArguments(getVendorsFragmentArguments()); fm.beginTransaction().add(R.id.fragment_vendors, mVendorsFragment, "vendors").commit(); } else { mVendorsFragment.reloadFromArguments(getVendorsFragmentArguments()); } // Vendors content comes from reused activity mTabHost.addTab(mTabHost.newTabSpec(TAG_VENDORS).setIndicator(buildIndicator(R.string.starred_vendors)) .setContent(R.id.fragment_vendors)); }