Example usage for android.widget FrameLayout setVisibility

List of usage examples for android.widget FrameLayout setVisibility

Introduction

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

Prototype

@RemotableViewMethod
public void setVisibility(@Visibility int visibility) 

Source Link

Document

Set the visibility state of this view.

Usage

From source file:com.zainsoft.ramzantimetable.QiblaActivity.java

private void requestForValidationOfQibla() {
    // TextView textView = (TextView)
    // findViewById(R.id.location_text_line1);
    TextView textView2 = (TextView) findViewById(R.id.location_text_line2);
    ImageView arrow = ((ImageView) findViewById(R.id.arrowImage));
    ImageView compass = ((ImageView) findViewById(R.id.compassImage));
    ImageView frame = ((ImageView) findViewById(R.id.frameImage));
    FrameLayout qiblaFrame = ((FrameLayout) findViewById(R.id.qiblaLayout));
    LinearLayout noLocationLayout = ((LinearLayout) findViewById(R.id.noLocationLayout));

    if (faceUp && (gpsLocationFound || currentLocation != null)) {
        textView2.setVisibility(View.VISIBLE);
        textView2.setText(location_line2);
        ((LinearLayout) findViewById(R.id.textLayout)).setVisibility(View.VISIBLE);
        noLocationLayout.setVisibility(View.INVISIBLE);
        qiblaFrame.setVisibility(View.VISIBLE);
        arrow.setVisibility(View.VISIBLE);
        compass.setVisibility(View.VISIBLE);
        frame.setVisibility(View.VISIBLE);
    } else {//from w  ww  .j a v  a 2  s . co m
        if (!faceUp) {
            onScreenDown();
        } else if (!(gpsLocationFound || currentLocation != null)) {
            onGPSOn();
        }
    }
}

From source file:net.sylvek.sharemyposition.ShareMyPosition.java

@Override
protected void onPrepareDialog(int id, Dialog dialog) {
    switch (id) {
    default:/*from   w  w  w  .  j  av  a 2s. com*/
        super.onPrepareDialog(id, dialog);
        break;
    case MAP_DLG:
        final View optionsLayout = (View) dialog.findViewById(R.id.custom_layout);
        final FrameLayout map = (FrameLayout) dialog.findViewById(R.id.sharedmap);
        /* to catch dismiss event from AlertControler, we need to "override" onClickListener */
        final Button neutral = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_NEUTRAL);
        neutral.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View arg0) {
                if (optionsLayout.getVisibility() == View.GONE) {
                    optionsLayout.setVisibility(View.VISIBLE);
                    map.setVisibility(View.GONE);
                    neutral.setText(R.string.hide);
                } else {
                    optionsLayout.setVisibility(View.GONE);
                    map.setVisibility(View.VISIBLE);
                    neutral.setText(R.string.options);
                }
            }
        });
        if (location != null && sharedMap != null) {
            sharedMap.getController().setZoom(ZOOM_LEVEL);
            sharedMap.getController().setCenter(new GeoPoint(location.getLatitude(), location.getLongitude()));
        }

        if (!isConnected()) {
            final CheckBox geocodeAddress = (CheckBox) dialog.findViewById(R.id.add_address_location);
            geocodeAddress.setEnabled(false);
            neutral.setEnabled(false);
            map.setVisibility(View.GONE);
            optionsLayout.setVisibility(View.VISIBLE);
        }

        break;
    }
}

From source file:com.concentricsky.android.khanacademy.app.VideoDetailActivity.java

private void goPortrait() {
    isFullscreen = false;//w ww  . jav  a2 s. c  o m
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);

    VideoController videoControls = (VideoController) findViewById(R.id.controller);
    if (videoControls != null) {
        videoControls.setFullscreen(false);
    }

    ThumbnailWrapper videoContainer = (ThumbnailWrapper) findViewById(R.id.video_fragment_container);
    videoContainer.setMaintainAspectRatio(true);

    FrameLayout headerContainer = (FrameLayout) findViewById(R.id.detail_header_container);
    LinearLayout.LayoutParams p = (LinearLayout.LayoutParams) headerContainer.getLayoutParams();
    p.weight = 0;
    headerContainer.setLayoutParams(p);

    createAndAttachCaptionFragment(R.id.detail_bottom_container);
    FrameLayout captionContainer = (FrameLayout) findViewById(R.id.detail_bottom_container);
    captionContainer.setVisibility(View.VISIBLE);
    p = (LinearLayout.LayoutParams) captionContainer.getLayoutParams();
    p.weight = 1;
    captionContainer.setLayoutParams(p);

    if (isBigScreen) {
        findViewById(R.id.detail_right_container).setVisibility(View.GONE);
        findViewById(R.id.detail_center_divider).setVisibility(View.GONE);
    }

    setNavVisibility(true);
    createAndAttachHeader();

    getDecorViewTreeObserver().addOnGlobalLayoutListener(layoutFixer);
}

From source file:com.taobao.weex.ui.component.list.BasicListComponent.java

private ListBaseViewHolder createVHForRefreshComponent(int viewType) {
    FrameLayout view = new FrameLayout(getContext());
    view.setBackgroundColor(Color.WHITE);
    view.setLayoutParams(new FrameLayout.LayoutParams(1, 1));
    view.setVisibility(View.GONE);
    return new ListBaseViewHolder(view, viewType);
}

From source file:com.concentricsky.android.khanacademy.app.VideoDetailActivity.java

private void goLargeLandscape() {
    isFullscreen = false;/*w  w w.j ava 2  s .c o  m*/
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);

    VideoController videoControls = (VideoController) findViewById(R.id.controller);
    if (videoControls != null) {
        videoControls.setFullscreen(false);
    }

    ThumbnailWrapper videoContainer = (ThumbnailWrapper) findViewById(R.id.video_fragment_container);
    videoContainer.setMaintainAspectRatio(true);

    FrameLayout headerContainer = (FrameLayout) findViewById(R.id.detail_header_container);
    LinearLayout.LayoutParams p = (LinearLayout.LayoutParams) headerContainer.getLayoutParams();
    p.weight = 1;
    headerContainer.setLayoutParams(p);
    headerContainer.setVisibility(View.VISIBLE);

    FrameLayout emptyContainer = (FrameLayout) findViewById(R.id.detail_bottom_container);
    p = (LinearLayout.LayoutParams) emptyContainer.getLayoutParams();
    p.weight = 0;
    emptyContainer.setLayoutParams(p);
    emptyContainer.setVisibility(View.GONE);

    findViewById(R.id.detail_right_container).setVisibility(View.VISIBLE);
    createAndAttachCaptionFragment(R.id.detail_right_caption_container);
    createAndAttachHeader();

    findViewById(R.id.detail_center_divider).setVisibility(View.VISIBLE);

    getDecorViewTreeObserver().addOnGlobalLayoutListener(layoutFixer);
}

From source file:com.forrestguice.suntimeswidget.LocationConfigView.java

public void setMode(LocationViewMode mode) {
    //Log.d("DEBUG", "LocationViewMode setMode " + mode.name());
    FrameLayout autoButtonLayout = (FrameLayout) findViewById(R.id.appwidget_location_auto_layout);

    if (this.mode != mode) {
        getFixHelper.cancelGetFix();/*from  w w w . j a  v  a  2s .  co m*/
    }

    this.mode = mode;
    switch (mode) {
    case MODE_AUTO:
        labl_locationLon.setEnabled(false);
        text_locationLon.setEnabled(false);
        labl_locationLat.setEnabled(false);
        text_locationLat.setEnabled(false);
        inputOverlay.setVisibility(View.VISIBLE);

        labl_locationName.setEnabled(false);
        text_locationName.setEnabled(false);

        spin_locationName.setSelection(GetFixDatabaseAdapter.findPlaceByName(
                myParent.getString(R.string.gps_lastfix_title_found), getFixAdapter.getCursor()));
        spin_locationName.setEnabled(false);
        flipper.setDisplayedChild(1);

        autoButtonLayout.setVisibility(View.VISIBLE);
        button_edit.setVisibility(View.GONE);
        button_save.setVisibility(View.GONE);
        flipper2.setDisplayedChild(1);
        break;

    case MODE_CUSTOM_ADD:
    case MODE_CUSTOM_EDIT:
        labl_locationLon.setEnabled(true);
        text_locationLon.setEnabled(true);
        labl_locationLat.setEnabled(true);
        text_locationLat.setEnabled(true);
        inputOverlay.setVisibility(View.GONE);

        labl_locationName.setEnabled(true);
        text_locationName.setEnabled(true);
        spin_locationName.setEnabled(false);
        flipper.setDisplayedChild(0);
        text_locationName.requestFocus();

        autoButtonLayout.setVisibility(View.GONE);
        button_edit.setVisibility(View.GONE);
        button_save.setVisibility(View.VISIBLE);
        flipper2.setDisplayedChild(0);
        break;

    case MODE_CUSTOM_SELECT:
    default:
        labl_locationLon.setEnabled(false);
        text_locationLon.setEnabled(false);
        labl_locationLat.setEnabled(false);
        text_locationLat.setEnabled(false);
        inputOverlay.setVisibility(View.VISIBLE);

        labl_locationName.setEnabled(true);
        text_locationName.setEnabled(false);
        spin_locationName.setEnabled(true);
        flipper.setDisplayedChild(1);

        autoButtonLayout.setVisibility(View.GONE);
        button_edit.setVisibility(View.VISIBLE);
        button_save.setVisibility(View.GONE);
        flipper2.setDisplayedChild(1);
        break;
    }
}

From source file:com.farmerbb.taskbar.service.DashboardService.java

private void addPlaceholder(int cellId) {
    FrameLayout placeholder = (FrameLayout) cells.get(cellId).findViewById(R.id.placeholder);
    SharedPreferences pref = U.getSharedPreferences(this);
    String providerName = pref.getString("dashboard_widget_" + Integer.toString(cellId) + "_provider", "null");

    if (!providerName.equals("null")) {
        ImageView imageView = (ImageView) placeholder.findViewById(R.id.placeholder_image);
        ComponentName componentName = ComponentName.unflattenFromString(providerName);

        List<AppWidgetProviderInfo> providerInfoList = mAppWidgetManager
                .getInstalledProvidersForProfile(Process.myUserHandle());
        for (AppWidgetProviderInfo info : providerInfoList) {
            if (info.provider.equals(componentName)) {
                Drawable drawable = info.loadPreviewImage(this, -1);
                if (drawable == null)
                    drawable = info.loadIcon(this, -1);

                ColorMatrix matrix = new ColorMatrix();
                matrix.setSaturation(0);

                imageView.setImageDrawable(drawable);
                imageView.setColorFilter(new ColorMatrixColorFilter(matrix));
                break;
            }/*from   w  w w  .j a va  2  s .co  m*/
        }
    }

    placeholder.setVisibility(View.VISIBLE);
}

From source file:org.opendatakit.survey.android.activities.MainMenuActivity.java

@Override
public void swapOffCustomView() {
    FrameLayout shadow = (FrameLayout) findViewById(R.id.shadow_content);
    View frags = findViewById(R.id.main_content);
    View wkt = findViewById(R.id.webkit_view);
    shadow.setVisibility(View.GONE);
    shadow.removeAllViews();//from ww w .  j  a  va 2 s. co m
    frags.setVisibility(View.GONE);
    wkt.setVisibility(View.VISIBLE);
    wkt.invalidate();
    currentFragment = ScreenList.WEBKIT;
    levelSafeInvalidateOptionsMenu();
}

From source file:com.nextgis.mobile.fragment.MapFragment.java

protected void checkCompass(boolean showCompass) {
    int compassContainer = R.id.fl_compass;
    final FrameLayout compass = (FrameLayout) mMapRelativeLayout.findViewById(compassContainer);

    if (!showCompass) {
        compass.setVisibility(View.GONE);
        return;//from www .  ja v  a  2  s  .  com
    }

    FragmentManager fragmentManager = mActivity.getSupportFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    //get or create fragment
    CompassFragment compassFragment = (CompassFragment) fragmentManager.findFragmentByTag("NEEDLE_COMPASS");
    if (null == compassFragment)
        compassFragment = new CompassFragment();

    compass.setClickable(false);
    compassFragment.setStyle(true);
    if (!compassFragment.isAdded())
        fragmentTransaction.add(compassContainer, compassFragment, "NEEDLE_COMPASS")
                .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);

    if (!compassFragment.isVisible()) {
        fragmentTransaction.show(compassFragment);
    }

    fragmentTransaction.commit();

    compass.setVisibility(View.VISIBLE);
    compass.setOnClickListener(this);
    compass.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            mIsCompassDragging = true;
            mVibrator.vibrate(5);
            return true;
        }
    });
    // Thanks to http://javatechig.com/android/how-to-drag-a-view-in-android
    compass.setOnTouchListener(new View.OnTouchListener() {
        private int _xDelta;
        private int _yDelta;

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            final int X = (int) event.getRawX();
            final int Y = (int) event.getRawY();
            switch (event.getActionMasked()) {
            case MotionEvent.ACTION_DOWN:
                RelativeLayout.LayoutParams lParams = (RelativeLayout.LayoutParams) v.getLayoutParams();
                _xDelta = X - lParams.leftMargin;
                _yDelta = Y - lParams.topMargin;
                return false;
            case MotionEvent.ACTION_UP:
                mIsCompassDragging = false;
                return false;
            case MotionEvent.ACTION_MOVE:
                if (!mIsCompassDragging)
                    return false;

                RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) v.getLayoutParams();
                int width = v.getWidth();
                int height = v.getHeight();
                int toolbarHeight = 0;
                if (mActivity.getSupportActionBar() != null)
                    toolbarHeight = mActivity.getSupportActionBar().getHeight();
                if (X > width / 3 && X < v.getRootView().getWidth() - width / 3)
                    layoutParams.leftMargin = X - _xDelta;
                if (Y > height / 2 + toolbarHeight && Y < v.getRootView().getHeight() - height / 2)
                    layoutParams.topMargin = Y - _yDelta;

                v.setLayoutParams(layoutParams);
                break;
            }
            mMapRelativeLayout.invalidate();
            return true;
        }
    });
}

From source file:org.opendatakit.survey.android.activities.MainMenuActivity.java

public void swapToFragmentView(ScreenList newFragment) {
    WebLogger.getLogger(getAppName()).i(t, "swapToFragmentView: " + newFragment.toString());
    FragmentManager mgr = getFragmentManager();
    Fragment f;//from   w w w  .  ja v  a 2s  .  c om
    if (newFragment == ScreenList.MAIN_SCREEN) {
        throw new IllegalStateException("unexpected reference to generic main screen");
    } else if (newFragment == ScreenList.CUSTOM_VIEW) {
        WebLogger.getLogger(getAppName()).w(t,
                "swapToFragmentView: changing navigation to move to WebKit (was custom view)");
        f = mgr.findFragmentById(WebViewFragment.ID);
        if (f == null) {
            f = new WebViewFragment();
        }
        newFragment = ScreenList.WEBKIT;
    } else if (newFragment == ScreenList.FORM_CHOOSER) {
        f = mgr.findFragmentById(FormChooserListFragment.ID);
        if (f == null) {
            f = new FormChooserListFragment();
        }
    } else if (newFragment == ScreenList.INITIALIZATION_DIALOG) {
        if (currentFragment == ScreenList.INITIALIZATION_DIALOG) {
            WebLogger.getLogger(getAppName()).e(t, "Unexpected: currentFragment == INITIALIZATION_DIALOG");
            return;
        } else {
            f = mgr.findFragmentById(InitializationFragment.ID);
            if (f == null) {
                f = new InitializationFragment();
            }
            ((InitializationFragment) f).setFragmentToShowNext(
                    (currentFragment == null) ? ScreenList.FORM_CHOOSER.name() : currentFragment.name());
        }
    } else if (newFragment == ScreenList.FORM_DELETER) {
        f = mgr.findFragmentById(FormDeleteListFragment.ID);
        if (f == null) {
            f = new FormDeleteListFragment();
        }
    } else if (newFragment == ScreenList.FORM_DOWNLOADER) {
        f = mgr.findFragmentById(FormDownloadListFragment.ID);
        if (f == null) {
            f = new FormDownloadListFragment();
        }
    } else if (newFragment == ScreenList.INSTANCE_UPLOADER_TABLE_CHOOSER) {
        f = mgr.findFragmentById(InstanceUploaderTableChooserListFragment.ID);
        if (f == null) {
            f = new InstanceUploaderTableChooserListFragment();
        }
    } else if (newFragment == ScreenList.INSTANCE_UPLOADER) {
        f = mgr.findFragmentById(InstanceUploaderListFragment.ID);
        if (f == null) {
            f = new InstanceUploaderListFragment();
        }
        ((InstanceUploaderListFragment) f).changeUploadTableId();
    } else if (newFragment == ScreenList.WEBKIT) {
        f = mgr.findFragmentById(WebViewFragment.ID);
        if (f == null) {
            f = new WebViewFragment();
        }
    } else if (newFragment == ScreenList.ABOUT_MENU) {
        f = mgr.findFragmentById(AboutMenuFragment.ID);
        if (f == null) {
            f = new AboutMenuFragment();
        }

    } else {
        throw new IllegalStateException("Unrecognized ScreenList type");
    }

    FrameLayout shadow = (FrameLayout) findViewById(R.id.shadow_content);
    View frags = findViewById(R.id.main_content);
    View wkt = findViewById(R.id.webkit_view);
    shadow.setVisibility(View.GONE);
    shadow.removeAllViews();
    if (newFragment == ScreenList.WEBKIT) {
        frags.setVisibility(View.GONE);
        wkt.setVisibility(View.VISIBLE);
        wkt.invalidate();
    } else {
        wkt.setVisibility(View.GONE);
        frags.setVisibility(View.VISIBLE);
    }

    currentFragment = newFragment;
    BackStackEntry entry = null;
    for (int i = 0; i < mgr.getBackStackEntryCount(); ++i) {
        BackStackEntry e = mgr.getBackStackEntryAt(i);
        if (e.getName().equals(currentFragment.name())) {
            entry = e;
            break;
        }
    }
    if (entry != null) {
        // flush backward, including the screen want to go back to
        mgr.popBackStackImmediate(currentFragment.name(), FragmentManager.POP_BACK_STACK_INCLUSIVE);
    }

    // add transaction to show the screen we want
    FragmentTransaction trans = mgr.beginTransaction();
    trans.replace(R.id.main_content, f);
    trans.addToBackStack(currentFragment.name());
    trans.commit();

    // and see if we should re-initialize...
    if ((currentFragment != ScreenList.INITIALIZATION_DIALOG)
            && Survey.getInstance().shouldRunInitializationTask(getAppName())) {
        WebLogger.getLogger(getAppName()).i(t, "swapToFragmentView -- calling clearRunInitializationTask");
        // and immediately clear the should-run flag...
        Survey.getInstance().clearRunInitializationTask(getAppName());
        // OK we should swap to the InitializationFragment view
        swapToFragmentView(ScreenList.INITIALIZATION_DIALOG);
    } else {
        levelSafeInvalidateOptionsMenu();
    }
}