Example usage for android.widget FrameLayout addView

List of usage examples for android.widget FrameLayout addView

Introduction

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

Prototype

public void addView(View child) 

Source Link

Document

Adds a child view.

Usage

From source file:com.nubisa.jxcore.MainActivity.java

@SuppressLint("SetJavaScriptEnabled")
public static void JXCoreAssetsReady() { // assets are sent. call start event
    FrameLayout layout = (FrameLayout) AppManager.currentActivity.findViewById(R.id.container);

    web = new JXWebView(AppManager.currentContext);
    web.getSettings().setJavaScriptEnabled(true);
    web.getSettings().setDomStorageEnabled(true);
    web.setWebChromeClient(new JXClient());
    web.setJXcoreInterface(new JXWebBridge());

    layout.addView(web);

    web.loadHTML("file:///android_asset/ui/index.html", "home");
}

From source file:org.brandroid.openmanager.fragments.DialogHandler.java

public static AlertDialog showSeekBarDialog(final Context context, String title, int progress, int max,
        OnSeekBarChangeListener onSeekListener) {
    FrameLayout view = new FrameLayout(context);
    SeekBar sb = new SeekBar(context);
    view.addView(sb);
    view.setPadding(20, 20, 20, 20);//w  ww .j a  v a2 s .  com

    sb.setOnSeekBarChangeListener(onSeekListener);
    sb.setProgress(progress);
    sb.setMax(max);
    return new AlertDialog.Builder(context).setTitle(title).setView(view).show();
}

From source file:com.esminis.server.library.dialog.pager.DialogPager.java

protected DialogPager(Context context, Presenter presenter) {
    super(context, presenter);
    final FrameLayout layout = new FrameLayout(context);
    layout.addView(
            pager = (ViewPager) LayoutInflater.from(context).inflate(R.layout.dialog_pager, layout, false));
    setContentView(layout);// w ww  . j a v a 2s . c  o  m

    super.setOnShowListener(new OnShowListener() {
        public void onShow(DialogInterface dialog) {
            if (listener != null) {
                listener.onShow(dialog);
            }
        }
    });
}

From source file:org.strongswan.android.ui.fragment.RemediationInstructionFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    /* while the documentation recommends to include "@android:layout/list_content" to retain
     * the default functionality, this does not actually work with the ListFragment provided by
     * the support library as it builds the view manually and uses different IDs */
    View layout = inflater.inflate(R.layout.remediation_instruction, container, false);
    FrameLayout list = (FrameLayout) layout.findViewById(R.id.list_container);
    list.addView(super.onCreateView(inflater, list, savedInstanceState));
    return layout;
}

From source file:com.example.android.support.transition.widget.ChangeTransformUsage.java

private void showRedSquare(FrameLayout container) {
    final View view = LayoutInflater.from(this).inflate(R.layout.red_square, container, false);
    container.addView(view);
}

From source file:com.gosuncn.cu.module.permission.fragment.CameraPreviewFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    // Open an instance of the first camera and retrieve its info.
    mCamera = getCameraInstance(CAMERA_ID);
    Camera.CameraInfo cameraInfo = null;

    if (mCamera != null) {
        // Get camera info only if the camera is available
        cameraInfo = new Camera.CameraInfo();
        Camera.getCameraInfo(CAMERA_ID, cameraInfo);
    }/*from   w  w w .  j a  v a2 s  .com*/

    View root = inflater.inflate(R.layout.fragment_camera, null);

    // Get the rotation of the screen to adjust the preview image accordingly.
    final int displayRotation = getActivity().getWindowManager().getDefaultDisplay().getRotation();

    // Create the Preview view and set it as the content of this Activity.
    mPreview = new CameraPreview(getActivity(), mCamera, cameraInfo, displayRotation);
    FrameLayout preview = (FrameLayout) root.findViewById(R.id.camera_preview);
    preview.addView(mPreview);

    return root;
}

From source file:com.example.android.system.runtimepermissions.camera.CameraPreviewFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    // Open an instance of the first camera and retrieve its info.
    mCamera = getCameraInstance(CAMERA_ID);
    Camera.CameraInfo cameraInfo = null;

    if (mCamera != null) {
        // Get camera info only if the camera is available
        cameraInfo = new Camera.CameraInfo();
        Camera.getCameraInfo(CAMERA_ID, cameraInfo);
    }/*from w  w  w.  ja  v a2 s .  co  m*/

    if (mCamera == null || cameraInfo == null) {
        // Camera is not available, display error message
        Toast.makeText(getActivity(), "Camera is not available.", Toast.LENGTH_SHORT).show();
        return inflater.inflate(R.layout.fragment_camera_unavailable, null);
    }

    View root = inflater.inflate(R.layout.fragment_camera, null);

    // Get the rotation of the screen to adjust the preview image accordingly.
    final int displayRotation = getActivity().getWindowManager().getDefaultDisplay().getRotation();

    // Create the Preview view and set it as the content of this Activity.
    mPreview = new CameraPreview(getActivity(), mCamera, cameraInfo, displayRotation);
    FrameLayout preview = (FrameLayout) root.findViewById(R.id.camera_preview);
    preview.addView(mPreview);

    return root;
}

From source file:org.namelessrom.devicecontrol.modules.info.hardware.FingerprintView.java

@Override
protected void init(@Nullable AttributeSet attrs) {
    super.init(attrs);
    statusView = new TextView(getContext());

    final FrameLayout content = getContentView();
    content.addView(statusView);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        setSupported(true);/*from   w w  w . j a va2 s .co m*/
        statusView.setText(R.string.fingerprint_press_to_authenticate);

        fingerprinter = new Fingerprinter(getContext(), new Fingerprinter.FingerprinterCallback() {
            @Override
            public void onAuthenticationError(int errMsgId, CharSequence errString) {
                statusView.setText(errString);
            }

            @Override
            public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) {
                statusView.setText(helpString);
            }

            @Override
            public void onAuthenticationSucceeded(FingerprintManagerCompat.AuthenticationResult result) {
                statusView.setText(R.string.fingerprint_success);
            }

            @Override
            public void onAuthenticationFailed() {
                statusView.setText(R.string.fingerprint_failed);
            }
        });
    } else {
        setSupported(false);
    }
}

From source file:com.ibm.mil.readyapps.telco.onboarding.appintrolib.AppIntro.java

private void initController() {
    if (mController == null)
        mController = new DefaultIndicatorController();

    FrameLayout indicatorContainer = (FrameLayout) findViewById(R.id.indicator_container);
    indicatorContainer.addView(mController.newInstance(this));

    mController.initialize(slidesNumber);
}

From source file:org.namelessrom.devicecontrol.modules.info.hardware.GpsView.java

@Override
protected void init(@Nullable AttributeSet attrs) {
    super.init(attrs);
    final Context context = getContext();

    unknownLocation = context.getString(R.string.gps_unknown_location);
    statusView = new TextView(context);

    final FrameLayout content = getContentView();
    content.addView(statusView);
    statusView.setText(R.string.gps_requesting_location);

    final ReactiveLocationProvider provider = new ReactiveLocationProvider(context);

    final LocationRequest locationRequest = LocationRequest.create()
            .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY).setFastestInterval(1000).setInterval(10000);

    // get last known location, to display something quite fast
    subscribe(provider, provider.getLastKnownLocation());

    // then subscribe to get location updates
    addressObservable = subscribe(provider, provider.getUpdatedLocation(locationRequest));
}