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:htw.bui.openreskit.discard.InspectionActivity.java

private void toggleInspectionList() {
    FrameLayout inspListLayout = (FrameLayout) findViewById(R.id.inspectionListFrameLayout);
    if (inspListLayout.getVisibility() == View.VISIBLE) {
        inspListLayout.setVisibility(View.GONE);
    } else {/*from w  w  w  .jav a  2 s.  c o  m*/
        //Animation slideIn = AnimationUtils.loadAnimation(this, R.anim.slide_in);
        //inspListLayout.startAnimation(slideIn);
        inspListLayout.setVisibility(View.VISIBLE);
    }
}

From source file:sg.fxl.topekaport.QuizActivity.java

private void revealFragmentContainer(final View clickedView, final FrameLayout fragmentContainer) {
    if (ApiLevelHelper.isAtLeast(Build.VERSION_CODES.LOLLIPOP)) {
        revealFragmentContainerLollipop(clickedView, fragmentContainer);
    } else {// w w  w  .  j  ava  2 s  .  c om
        fragmentContainer.setVisibility(View.VISIBLE);
        clickedView.setVisibility(View.GONE);
        icon.setVisibility(View.GONE);
    }
}

From source file:at.jclehner.rxdroid.ui.DialogLike.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View v = inflater.inflate(R.layout.layout_dialogue_like, container, false);

    mTitle = (TextView) v.findViewById(R.id.title);
    mMessage = (TextView) v.findViewById(R.id.message);
    mDetail = (TextView) v.findViewById(R.id.detail);
    mIcon = (ImageView) v.findViewById(R.id.icon);
    mButtonBar = v.findViewById(R.id.button_bar);

    final int posBtn, negBtn;

    if (!isRtlLanguage()) {
        posBtn = R.id.btn_right;/*from ww  w  .  j  a v a 2 s .  c om*/
        negBtn = R.id.btn_left;
    } else {
        posBtn = R.id.btn_left;
        negBtn = R.id.btn_right;
    }

    mPositiveBtn = (Button) v.findViewById(posBtn);
    mNegativeBtn = (Button) v.findViewById(negBtn);

    mPositiveBtn.setOnClickListener(mBtnListener);
    mNegativeBtn.setOnClickListener(mBtnListener);

    final int customView = getArguments().getInt("custom_view");
    final FrameLayout customViewFrame = (FrameLayout) v.findViewById(R.id.custom);

    if (mCustomView != null)
        customViewFrame.addView(mCustomView);
    else if (customView != 0)
        mCustomView = inflater.inflate(customView, customViewFrame, true);

    if (mCustomView != null) {
        customViewFrame.setVisibility(View.VISIBLE);
        onBindCustomView(mCustomView);
    }

    applyArguments();

    return v;
}

From source file:com.google.samples.apps.topeka.activity.QuizActivity.java

private void revealFragmentContainer(final View clickedView, final FrameLayout fragmentContainer) {
    if (ApiLevelHelper.isAtLeast(Build.VERSION_CODES.LOLLIPOP)) {
        revealFragmentContainerLollipop(clickedView, fragmentContainer);
    } else {/*from   w w  w. j  a v  a 2  s  . c  o  m*/
        fragmentContainer.setVisibility(View.VISIBLE);
        clickedView.setVisibility(View.GONE);
        mIcon.setVisibility(View.GONE);
    }
}

From source file:com.launcher.silverfish.launcher.appdrawer.TabbedAppDrawerFragment.java

private void showUninstallIndicator() {
    // Get the layout
    FrameLayout uninstall_indicator;
    uninstall_indicator = (FrameLayout) rootView.findViewById(R.id.uninstall_indicator);

    // Make it visible
    uninstall_indicator.setVisibility(View.VISIBLE);

    // And start the animation
    AlphaAnimation animation = new AlphaAnimation(0.0f, 1.0f);
    animation.setDuration(500);//from   w w w  .  j a  v  a 2  s.  c  om
    uninstall_indicator.startAnimation(animation);
}

From source file:com.grarak.kerneladiutor.activities.SecurityActivity.java

private void loadFingerprint() {
    try {/*from w  ww.  j a  v  a  2  s  .  c o m*/
        KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore");
        KeyGenerator keyGenerator = KeyGenerator.getInstance(KeyProperties.KEY_ALGORITHM_AES,
                "AndroidKeyStore");
        mCipher = Cipher.getInstance(KeyProperties.KEY_ALGORITHM_AES + "/" + KeyProperties.BLOCK_MODE_CBC + "/"
                + KeyProperties.ENCRYPTION_PADDING_PKCS7);

        keyStore.load(null);
        keyGenerator.init(new KeyGenParameterSpec.Builder(KEY_NAME,
                KeyProperties.PURPOSE_ENCRYPT | KeyProperties.PURPOSE_DECRYPT)
                        .setBlockModes(KeyProperties.BLOCK_MODE_CBC).setUserAuthenticationRequired(true)
                        .setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_PKCS7).build());
        keyGenerator.generateKey();

        SecretKey key = (SecretKey) keyStore.getKey(KEY_NAME, null);
        mCipher.init(Cipher.ENCRYPT_MODE, key);
    } catch (KeyStoreException | NoSuchProviderException | NoSuchAlgorithmException | NoSuchPaddingException
            | UnrecoverableKeyException | InvalidKeyException | CertificateException
            | InvalidAlgorithmParameterException | IOException e) {
        return;
    }

    mCryptoObject = new FingerprintManagerCompat.CryptoObject(mCipher);
    FrameLayout fingerprintParent = (FrameLayout) findViewById(R.id.fingerprint_parent);
    final SwirlView swirlView = new SwirlView(new ContextThemeWrapper(this, R.style.Swirl));
    swirlView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    fingerprintParent.addView(swirlView);
    fingerprintParent.setVisibility(View.VISIBLE);

    mFingerprintUiHelper = new FingerprintUiHelper.FingerprintUiHelperBuilder(mFingerprintManagerCompat)
            .build(swirlView, new FingerprintUiHelper.Callback() {
                @Override
                public void onAuthenticated() {
                    try {
                        mCipher.doFinal(SECRET_MESSAGE.getBytes());
                        mPasswordWrong.setVisibility(View.GONE);
                        setResult(1);
                        finish();
                    } catch (IllegalBlockSizeException | BadPaddingException e) {
                        e.printStackTrace();
                        swirlView.setState(SwirlView.State.ERROR);
                    }
                }

                @Override
                public void onError() {
                }
            });
    mFingerprintUiHelper.startListening(mCryptoObject);
}

From source file:com.android.eventspace.MainActivity.java

private void selectItem(int position) {
    Toast.makeText(getApplicationContext(), "number" + position, Toast.LENGTH_SHORT).show();
    FrameLayout f;
    Fragment fragment;//from  w w w  . j  a v  a  2  s . c om
    Bundle args;
    FragmentManager fragmentManager;
    switch (position) {
    case (3):

        f = (FrameLayout) findViewById(R.id.map_frame);
        f.setVisibility(View.GONE);
        final LatLng SITTERSON = new LatLng(35.910057, -79.053470);
        final LatLng OLDWELL = new LatLng(35.912045, -79.051181);

        GoogleMap googleMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
        if (googleMap == null) {
            Toast.makeText(getApplicationContext(), "Sorry! unable to create maps", Toast.LENGTH_SHORT).show();
        } else {

            Marker hamburg = googleMap
                    .addMarker(new MarkerOptions().position(SITTERSON).title("My Second Home"));
            Marker kiel = googleMap
                    .addMarker(new MarkerOptions().position(OLDWELL).title("Oldwell").snippet("The Old Well")
                            .icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_launcher)));

            googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(SITTERSON, 2));

            // Zoom in, animating the camera.
            googleMap.animateCamera(CameraUpdateFactory.zoomTo(21), 15000, null);

        }
        break;
    case 1:

        f = (FrameLayout) findViewById(R.id.map_frame);
        f.setVisibility(View.VISIBLE);

        // update the main content by replacing fragments
        fragment = new OptionFragment(position);
        args = new Bundle();
        args.putInt(OptionFragment.ARG_OPTION_NUMBER, position);
        fragment.setArguments(args);
        fragmentManager = getFragmentManager();

        fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();
        break;
    case 2:
        f = (FrameLayout) findViewById(R.id.map_frame);
        f.setVisibility(View.VISIBLE);

        // update the main content by replacing fragments
        fragment = new OptionFragment(position);
        args = new Bundle();
        args.putInt(OptionFragment.ARG_OPTION_NUMBER, position);
        fragment.setArguments(args);
        fragmentManager = getFragmentManager();

        fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();
        break;
    }

    // update selected item and title, then close the drawer
    mDrawerList.setItemChecked(position, true);
    setTitle(optionTitles[position]);
    mDrawerLayout.closeDrawer(mDrawerList);
}

From source file:com.google.samples.apps.ourstreets.fragment.StreetViewFragment.java

@Override
public void onBackPressed() {
    if (isRestored) {
        getFragmentManager().popBackStack();
    } else {/*w w  w. j  a  v a 2s.  com*/
        // Perform a circular conceal, then pop this fragment off the back stack.
        final FrameLayout view = ((FrameLayout) getView());
        //noinspection ConstantConditions
        Animator circularConceal = ViewUtils.createCircularConceal(mRevealCenter, mRevealWidth, view,
                INTERPOLATOR);
        circularConceal.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                view.setVisibility(View.GONE);
                getFragmentManager().popBackStack();
            }
        });
        circularConceal.start();
    }
}

From source file:sg.fxl.topekaport.QuizActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    interpolator = new FastOutSlowInInterpolator();
    if (null != savedInstanceState) {
        savedStateIsPlaying = savedInstanceState.getBoolean(STATE_IS_PLAYING);
    }/*from   w w w . ja  v a 2 s  . c om*/
    // If quiz settings not given, default will be used.
    if (getIntent().hasExtra(QuizSetting.TAG)) {
        this.quizSetting = QuizSetting.Json.from(getIntent());
    } else {
        this.quizSetting = new QuizSetting();
    }
    super.onCreate(savedInstanceState);
    populate(CategoryJson.from(getIntent()));
    int categoryNameTextSize = getResources().getDimensionPixelSize(R.dimen.category_item_text_size);
    int paddingStart = getResources().getDimensionPixelSize(R.dimen.spacing_double);
    final int startDelay = getResources().getInteger(R.integer.toolbar_transition_duration);
    ActivityCompat.setEnterSharedElementCallback(this,
            new TextSharedElementCallback(categoryNameTextSize, paddingStart) {
                @Override
                public void onSharedElementStart(List<String> sharedElementNames, List<View> sharedElements,
                        List<View> sharedElementSnapshots) {
                    super.onSharedElementStart(sharedElementNames, sharedElements, sharedElementSnapshots);
                    toolbarBack.setScaleX(0f);
                    toolbarBack.setScaleY(0f);
                }

                @Override
                public void onSharedElementEnd(List<String> sharedElementNames, List<View> sharedElements,
                        List<View> sharedElementSnapshots) {
                    super.onSharedElementEnd(sharedElementNames, sharedElements, sharedElementSnapshots);
                    // Make sure to perform this animation after the transition has ended.
                    ViewCompat.animate(toolbarBack).setStartDelay(startDelay).scaleX(1f).scaleY(1f).alpha(1f);
                }
            });

    // Jump to first question, skip introduction page
    if (!quizSetting.showStartScreen) {
        initQuizFragment();
        getSupportFragmentManager().beginTransaction()
                .replace(R.id.quiz_fragment_container, quizFragment, FRAGMENT_TAG).commit();
        final FrameLayout container = (FrameLayout) findViewById(R.id.quiz_fragment_container);
        container.setBackgroundColor(ContextCompat.getColor(this, quiz.getTheme().getWindowBackgroundColor()));
        container.setVisibility(View.VISIBLE);
        quizFab.setVisibility(View.GONE);
        icon.setVisibility(View.GONE);
        // the toolbar should not have more elevation than the content while playing
        setToolbarElevation(false);
    }
}

From source file:de.gebatzens.ggvertretungsplan.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(GGApp.GG_APP.provider.getTheme());
    super.onCreate(savedInstanceState);
    GGApp.GG_APP.activity = this;
    savedState = savedInstanceState;/*  w  w w . j  a  v a 2  s .  c o  m*/

    Intent intent = getIntent();
    if (intent != null && intent.getStringExtra("fragment") != null) {
        GGApp.FragmentType type = GGApp.FragmentType.valueOf(intent.getStringExtra("fragment"));
        GGApp.GG_APP.setFragmentType(type);
    }

    mStrings = new String[] { getResources().getString(R.string.substitutionplan),
            getResources().getString(R.string.news), getResources().getString(R.string.cafeteria),
            getResources().getString(R.string.exams) };

    NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    nm.cancel(123);

    setContentView(getLayoutInflater().inflate(R.layout.activity_main, null));

    removeAllFragments();

    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    mContent = createFragment();
    transaction.replace(R.id.content_fragment, mContent, "gg_content_fragment");
    transaction.commit();

    if (GGApp.GG_APP.getDataForFragment(GGApp.GG_APP.getFragmentType()) == null)
        GGApp.GG_APP.refreshAsync(null, true, GGApp.GG_APP.getFragmentType());

    mToolbar = (Toolbar) findViewById(R.id.toolbar);

    mToolbar.setBackgroundColor(GGApp.GG_APP.provider.getColor());
    mToolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem menuItem) {

            if (menuItem.getItemId() == R.id.action_refresh) {
                ((SwipeRefreshLayout) mContent.getView().findViewById(R.id.refresh)).setRefreshing(true);
                GGApp.GG_APP.refreshAsync(new Runnable() {
                    @Override
                    public void run() {
                        ((SwipeRefreshLayout) mContent.getView().findViewById(R.id.refresh))
                                .setRefreshing(false);
                    }
                }, true, GGApp.GG_APP.getFragmentType());
            } else if (menuItem.getItemId() == R.id.action_settings) {
                Intent i = new Intent(MainActivity.this, SettingsActivity.class);
                startActivityForResult(i, 1);
            }

            return false;
        }
    });

    mToolbar.setTitle(GGApp.GG_APP.provider.getFullName());
    mToolbar.setSubtitle(
            mStrings[Arrays.asList(GGApp.FragmentType.values()).indexOf(GGApp.GG_APP.getFragmentType())]);
    mToolbar.inflateMenu(R.menu.toolbar_menu);
    mToolbar.setTitleTextColor(Color.WHITE);
    mToolbar.setSubtitleTextColor(Color.WHITE);

    ((TextView) findViewById(R.id.drawer_image_text)).setText(GGApp.GG_APP.provider.getFullName());

    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        GGApp.GG_APP.setStatusBarColorTransparent(getWindow());
        mDrawerLayout.setStatusBarBackgroundColor(GGApp.GG_APP.provider.getDarkColor());
    }

    mToggle = new ActionBarDrawerToggle(this, mDrawerLayout, mToolbar, R.string.drawer_open,
            R.string.drawer_close) {

        /** Called when a drawer has settled in a completely closed state. */
        public void onDrawerClosed(View view) {
            super.onDrawerClosed(view);
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }

        /** Called when a drawer has settled in a completely open state. */
        public void onDrawerOpened(View drawerView) {
            super.onDrawerOpened(drawerView);
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }
    };

    mNacvigationImage = (ImageView) findViewById(R.id.navigation_schoolpicture);
    mNacvigationImage.setImageResource(GGApp.GG_APP.provider.getImage());
    mNavigationSchoolpictureLink = (View) findViewById(R.id.navigation_schoolpicture_link);
    mNavigationSchoolpictureLink.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View viewIn) {
            mDrawerLayout.closeDrawers();
            Intent linkIntent = new Intent(Intent.ACTION_VIEW);
            linkIntent.setData(Uri.parse(GGApp.GG_APP.provider.getWebsite()));
            startActivity(linkIntent);
        }
    });

    mDrawerLayout.setDrawerListener(mToggle);

    mDrawerList = (ListView) findViewById(R.id.left_drawer);
    //ArrayAdapter<String> aa = new ArrayAdapter<String>(this, R.layout.drawer_list_item, mStrings);
    NavigationListAdapter aa = new NavigationListAdapter(this, mStrings, mIcons);
    mDrawerList.setAdapter(aa);
    mDrawerList.setItemChecked(
            Arrays.asList(GGApp.FragmentType.values()).indexOf(GGApp.GG_APP.getFragmentType()), true);

    mDrawerList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (GGApp.GG_APP.getFragmentType() != GGApp.FragmentType.values()[position]) {
                GGApp.GG_APP.setFragmentType(GGApp.FragmentType.values()[position]);
                mDrawerLayout.closeDrawers();
                mToolbar.setSubtitle(mStrings[position]);
                mContent = createFragment();
                Animation fadeOut = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fade_out);
                fadeOut.setAnimationListener(new Animation.AnimationListener() {
                    @Override
                    public void onAnimationStart(Animation animation) {
                        // Called when the Animation starts
                    }

                    @Override
                    public void onAnimationEnd(Animation animation) {
                        FrameLayout contentFrame = (FrameLayout) findViewById(R.id.content_fragment);
                        contentFrame.setVisibility(View.INVISIBLE);
                        if (GGApp.GG_APP.getDataForFragment(GGApp.GG_APP.getFragmentType()) == null)
                            GGApp.GG_APP.refreshAsync(null, true, GGApp.GG_APP.getFragmentType());

                        removeAllFragments();

                        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
                        transaction.replace(R.id.content_fragment, mContent, "gg_content_fragment");
                        transaction.commit();
                    }

                    @Override
                    public void onAnimationRepeat(Animation animation) {
                        // This is called each time the Animation repeats
                    }
                });
                FrameLayout contentFrame = (FrameLayout) findViewById(R.id.content_fragment);
                contentFrame.startAnimation(fadeOut);
            } else {
                mDrawerLayout.closeDrawers();
            }
        }
    });
    ListviewHelper.getListViewSize(mDrawerList);

    /*mDrawerFirstUse = (TextView) findViewById(R.id.left_drawer_firstuse);
    mDrawerFirstUse.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View viewIn) {
        mDrawerLayout.closeDrawers();
        Intent i = new Intent(MainActivity.this, FirstUseActivity.class);
        startActivityForResult(i, 1);
    }
    });*/

    mDrawerSettings = (TextView) findViewById(R.id.left_drawer_settings);
    mDrawerSettings.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View viewIn) {
            mDrawerLayout.closeDrawers();
            Intent i = new Intent(MainActivity.this, SettingsActivity.class);
            startActivityForResult(i, 1);
        }
    });

    //wait for vps
    new AsyncTask<Object, Void, Void>() {

        @Override
        protected Void doInBackground(Object... params) {
            boolean b = true;
            while (b) {
                switch (GGApp.GG_APP.getFragmentType()) {
                case PLAN:
                    b = GGApp.GG_APP.plans == null;
                    break;
                case NEWS:
                    b = GGApp.GG_APP.news == null;
                    break;
                case MENSA:
                    b = GGApp.GG_APP.mensa == null;
                    break;
                case EXAMS:
                    b = GGApp.GG_APP.exams == null;
                    break;
                }
            }

            return null;
        }
    }.execute();

}