Example usage for android.widget FrameLayout FrameLayout

List of usage examples for android.widget FrameLayout FrameLayout

Introduction

In this page you can find the example usage for android.widget FrameLayout FrameLayout.

Prototype

public FrameLayout(@NonNull Context context) 

Source Link

Usage

From source file:com.bringcommunications.etherpay.ReceiveActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    overlay_frame_layout = new FrameLayout(getApplicationContext());
    setContentView(overlay_frame_layout);
    View activity_receive_view = getLayoutInflater().inflate(R.layout.activity_receive, overlay_frame_layout,
            false);//from   w  w  w . j  a v  a  2s.  c  om
    setContentView(activity_receive_view);
    show_private = getIntent().getBooleanExtra("SHOW_PRIVATE", false);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    int subtitle_R = show_private ? R.string.receive_subtitle_export : R.string.receive_subtitle_receive;
    String subtitle = getResources().getString(subtitle_R);
    String app_name = getResources().getString(R.string.app_name);
    toolbar.setTitle(app_name);
    toolbar.setSubtitle(subtitle);
    toolbar.setBackgroundResource(R.color.color_toolbar);
    setSupportActionBar(toolbar);
    instructions_view = (TextView) findViewById(R.id.instructions);
    String instructions = (show_private) ? getResources().getString(R.string.export_acct_prompt)
            : getResources().getString(R.string.receive_qr_prompt);
    instructions_view.setText(instructions);
    String app_uri = getResources().getString(R.string.app_uri);
    ImageView qr_code_view = (ImageView) findViewById(R.id.qr_code);
    preferences = getSharedPreferences(app_uri, MODE_PRIVATE);
    acct_addr = preferences.getString("acct_addr", acct_addr);
    private_key = preferences.getString("key", private_key);
    if (show_private) {
        //once we show the private key, we can't know if the acct is used (has tx's) or not
        SharedPreferences.Editor preferences_editor = preferences.edit();
        preferences_editor.putBoolean("acct_has_no_txs", false);
        preferences_editor.apply();
        qr_bitmap = QRCode.from(private_key).bitmap();
    } else {
        qr_bitmap = QRCode.from(acct_addr).bitmap();
    }
    qr_code_view.setImageBitmap(qr_bitmap);
}

From source file:org.septa.android.app.utilities.WebViewFragment.java

/**
 * Called to instantiate the view. Creates and returns the WebView.
 *//*w w w. j a v  a  2 s .c o m*/
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (mWebView != null) {
        mWebView.destroy();
    }
    mLayout = new FrameLayout(getActivity());
    mWebView = new WebView(getActivity());
    mIsWebViewAvailable = true;

    mWebView.getSettings().setJavaScriptEnabled(true);

    /** check if we have already set the Url to load, if yes, load it */
    if (urlToLoad != null && !urlToLoad.trim().equals("")) {
        mWebView.loadUrl(urlToLoad);
    }

    mLayout.addView(mWebView, LayoutParams.MATCH_PARENT);

    return mLayout;
}

From source file:kr.co.namsang.barista.view.InfiniteViewPager.java

public void setView() {
    if (bEnabled) {
        for (int i = 0; i < MAX_VIEW_GROUP_CNT; i++) {
            if (mCompenstateViews[i] == null)
                mCompenstateViews[i] = new FrameLayout(getContext());
            mCompenstateViews[i].removeAllViews();
        }/*from  ww w.j a va  2  s .co  m*/
        int MAX_VIEW_SIZE = mViews.size() - 1;
        int MIN_VIEW_SIZE = 0;
        if (mCompensateModeCount < MIN_VIEW_SIZE)
            mCompensateModeCount = MAX_VIEW_SIZE;
        else if (mCompensateModeCount > MAX_VIEW_SIZE)
            mCompensateModeCount = MIN_VIEW_SIZE;
        int curr = mCompensateModeCount;
        int prev = mCompensateModeCount - 1 < MIN_VIEW_SIZE ? MAX_VIEW_SIZE : mCompensateModeCount - 1;
        int next = mCompensateModeCount + 1 > MAX_VIEW_SIZE ? MIN_VIEW_SIZE : mCompensateModeCount + 1;
        mCompenstateViews[0].addView(mViews.get(prev));
        mCompenstateViews[1].addView(mViews.get(curr));
        mCompenstateViews[2].addView(mViews.get(next));
    }
}

From source file:com.gandulf.guilib.view.adapter.MultiFragmentPagerAdapter.java

@Override
public Object instantiateItem(View container, int position) {
    if (mCurTransaction == null) {
        mCurTransaction = mFragmentManager.beginTransaction();
    }/*from w  w w .ja  v  a 2  s .  co  m*/

    LinearLayout v = new LinearLayout(mContext);
    v.setOrientation(LinearLayout.HORIZONTAL);
    v.setWeightSum(getCount(position));

    int startIndex = getStartIndex(position);

    int containerId = 0;
    final int size = getCount(position);
    for (int i = 0; i < size; i++) {

        containerId = startIndex + i;

        String name = makeFragmentName(container.getId(), containerId);
        Fragment fragment = mFragmentManager.findFragmentByTag(name);

        FrameLayout fragmentView = new FrameLayout(mContext);
        LayoutParams layoutParams = new LayoutParams(0, LayoutParams.MATCH_PARENT, 1);
        fragmentView.setLayoutParams(layoutParams);
        fragmentView.setId(containerId);
        v.addView(fragmentView, i);

        if (fragment != null) {
            Debug.verbose("Attaching item #" + position + ": f=" + fragment + " id:" + containerId);
            mCurTransaction.attach(fragment);
        } else {
            // index is 1 based remove 1 to get a 0-based
            fragment = getItem(position, i);
            if (fragment != null) {
                Debug.verbose("Adding item #" + position + ": f=" + fragment + " id:" + containerId);
                mCurTransaction.add(containerId, fragment, name);
            }
        }
        if (fragment != null && !mCurrentPrimaryItems.contains(fragment)) {
            fragment.setMenuVisibility(false);
            fragment.setUserVisibleHint(false);
        }
    }

    mCurTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);

    ((ViewPager) container).addView(v, 0);

    return v;
}

From source file:com.hero.fm.FileExplorerTabActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
    if (USE_HTCSTYLE) {
        requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
        SetupActionBar();/*from ww  w  . j  av a2  s.  com*/
    }
    if (!USE_ACTIONBAR)
        getActionBar().hide();

    super.onCreate(savedInstanceState);

    final int rootId = 1;
    FrameLayout viewRoot = new FrameLayout(this);
    viewRoot.setId(rootId);
    setContentView(viewRoot);
    mCarousel = new Carousel();
    FragmentTransaction ft = getFragmentManager().beginTransaction();
    ft.add(rootId, mCarousel);
    ft.commit();
    registerForContextMenu(viewRoot);
}

From source file:nkfust.selab.android.explorer.layout.view.PhotoFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    FrameLayout fl = new FrameLayout(getActivity());
    ProgressBar pb = new ProgressBar(getActivity());
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT,
            FrameLayout.LayoutParams.WRAP_CONTENT);
    params.gravity = Gravity.CENTER;//w w w  . j a  va  2  s  .  com
    pb.setLayoutParams(params);
    image = new CoustomizedImageView(getActivity());
    image.setMaxZoom(2f);
    image.setDrawingCacheEnabled(false);
    aFetcher.loadImage(path, image);

    fl.addView(pb);
    fl.addView(image);
    return fl;
}

From source file:htw.bui.openreskit.discard.InspectionActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mOverlayFramelayout = new FrameLayout(this);

    setContentView(mOverlayFramelayout);
    View view = getLayoutInflater().inflate(R.layout.inspection_fragment, mOverlayFramelayout, false);
    mOverlayFramelayout.addView(view);/*from   w ww. j ava2 s.co  m*/
    mContext = this;
    mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
    mHelpView = getLayoutInflater().inflate(R.layout.help_overlay, mOverlayFramelayout, false);
    mInspFrag = (InspectionFragment) mFragMan.findFragmentById(R.id.inspection_fragment);
    mAddInspectionButton = (Button) mOverlayFramelayout.findViewById(R.id.addInspectionButton);
    mAddInspectionButton.setOnClickListener(mButtonListener);

    if (Utils.isTablet(this)) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
        if (findViewById(R.id.inspectionLayoutContainer) != null) {
            // if we are being restored from a previous state, then we dont need to do anything and should
            // return or else we could end up with overlapping fragments.
            if (savedInstanceState != null)
                return;

            // Create an instance of inspectionInfoFragment
            mInspectionInfoFragment = new InspectionInfoFragment();
            // Create an instance of RunningInspectionFragment               
            mRunningInspectionFragment = new RunningInspectionFragment();

            // add fragment to the fragment container layout
            FragmentTransaction ft = mFragMan.beginTransaction();
            ft.add(R.id.inspectionFrameLayout, mInspectionInfoFragment);
            ft.hide(mInspectionInfoFragment).commit();

            FragmentTransaction ft1 = mFragMan.beginTransaction();
            ft1.add(R.id.inspectionFrameLayout, mRunningInspectionFragment);
            ft1.hide(mRunningInspectionFragment).commit();
        }
    } else {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
    }

    ActionBar bar = getActionBar();
    bar.setDisplayOptions(
            ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_USE_LOGO | ActionBar.DISPLAY_SHOW_TITLE);
    bar.setDisplayShowHomeEnabled(true);
}

From source file:com.android.settings.PreviewPagerAdapter.java

public PreviewPagerAdapter(Context context, boolean isLayoutRtl, int[] previewSampleResIds,
        Configuration[] configurations) {
    mIsLayoutRtl = isLayoutRtl;/*  w w  w . ja  v a 2s.  c o  m*/
    mPreviewFrames = new FrameLayout[previewSampleResIds.length];
    mViewStubInflated = new boolean[previewSampleResIds.length][configurations.length];

    for (int i = 0; i < previewSampleResIds.length; ++i) {
        int p = mIsLayoutRtl ? previewSampleResIds.length - 1 - i : i;
        mPreviewFrames[p] = new FrameLayout(context);
        mPreviewFrames[p].setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                LinearLayout.LayoutParams.MATCH_PARENT));

        for (int j = 0; j < configurations.length; ++j) {
            // Create a new configuration for the specified value. It won't
            // have any theme set, so manually apply the current theme.
            final Context configContext = context.createConfigurationContext(configurations[j]);
            configContext.setTheme(context.getThemeResId());

            final LayoutInflater configInflater = LayoutInflater.from(configContext);
            final ViewStub sampleViewStub = new ViewStub(configContext);
            sampleViewStub.setLayoutResource(previewSampleResIds[i]);
            final int fi = i, fj = j;
            sampleViewStub.setOnInflateListener(new OnInflateListener() {
                @Override
                public void onInflate(ViewStub stub, View inflated) {
                    inflated.setVisibility(stub.getVisibility());
                    mViewStubInflated[fi][fj] = true;
                }
            });

            mPreviewFrames[p].addView(sampleViewStub);
        }
    }
}

From source file:dev.vision.shopping.center.Fragments.GourmetFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    v = new FrameLayout(getActivity());
    View fm = inflater.inflate(R.layout.tabbed_list_fragment, null);
    ((FrameLayout) v).addView(fm);/*from   w w w . ja v  a  2  s  .c  om*/
    tabs = (TabHost) v.findViewById(android.R.id.tabhost); //Id of tab host
    iv = new ImageView(getActivity());
    ((FrameLayout) v).addView(iv);
    iv.setImageResource(R.drawable.gourmetb);
    iv.setBackgroundColor(Color.WHITE);
    iv.setScaleType(ScaleType.CENTER_INSIDE);
    Animation mLoadAnimation = AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out);
    mLoadAnimation.setStartOffset(1000);
    mLoadAnimation.setDuration(1500);
    mLoadAnimation.setAnimationListener(new AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {

            iv.setVisibility(View.GONE);

        }
    });

    iv.setAnimation(mLoadAnimation);

    return v;
}

From source file:de.memorian.ps4trophaen.util.ExpandableListFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (savedInstanceState != null) {
        lastExpandedPosition = savedInstanceState.getInt(LAST_EXP_POS, -1);
    }/*from www  .ja va  2 s .  co m*/
    FrameLayout root = new FrameLayout(getActivity());

    FrameLayout lframe = new FrameLayout(getActivity());
    lframe.setId(INTERNAL_LIST_CONTAINER_ID);

    TextView tv = new TextView(getActivity());
    tv.setId(INTERNAL_EMPTY_ID);
    tv.setGravity(Gravity.CENTER);
    lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    ExpandableListView lv = new ExpandableListView(getActivity());
    lv.setId(android.R.id.list);
    lv.setDrawSelectorOnTop(false);
    lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    root.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));

    ListView.LayoutParams lp = new ListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    root.setLayoutParams(lp);

    return root;
}