android.widget.ViewAnimator Java Examples

The following examples show how to use android.widget.ViewAnimator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DisplayOptionsPopupFragment.java    From IslamicLibraryAndroid with GNU General Public License v3.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment

    View v = inflater.inflate(R.layout.display_options_popup, container);
    final ViewAnimator viewAnimator = v.findViewById(R.id.settings_view_container);
    viewAnimator.setDisplayedChild(mCurrentView);
    Window window = getDialog().getWindow();
    if (window != null) {
        window.setGravity(Gravity.TOP | Gravity.END);
        // window.setDimAmount(0);
        window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
        //getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        //window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }
    return v;
}
 
Example #2
Source File: MainActivity.java    From views-widgets-samples with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example #3
Source File: MainActivity.java    From animation-samples with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example #4
Source File: BookActivity.java    From AnimationApiDemos with Apache License 2.0 6 votes vote down vote up
private void useCodeAnimation(ViewAnimator pages) {
	// 用代码定义一个动画
	AnimationSet slideAnimationSet = new AnimationSet(true);

	// 平移动画
	TranslateAnimation slide = new TranslateAnimation(
			Animation.RELATIVE_TO_PARENT, 1f, Animation.RELATIVE_TO_PARENT,
			0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0);

	// 缩放动画
	ScaleAnimation scale = new ScaleAnimation(10, 1, 10, 1);
	// 把平移和缩放动画加入动画集合
	slideAnimationSet.addAnimation(slide);
	slideAnimationSet.addAnimation(scale);

	// 持续时间设置为1000ms
	slideAnimationSet.setDuration(1000);

	// 设置动画
	pages.setInAnimation(slideAnimationSet);
}
 
Example #5
Source File: MainActivity.java    From user-interface-samples with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example #6
Source File: MainActivity.java    From graphics-samples with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            invalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example #7
Source File: MainActivity.java    From graphics-samples with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example #8
Source File: MainActivity.java    From enterprise-samples with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example #9
Source File: MainActivity.java    From enterprise-samples with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example #10
Source File: PDFFragment.java    From PowerFileExplorer with GNU General Public License v3.0 6 votes vote down vote up
private void makeButtonsView() {
	mButtonsView = fragActivity.getLayoutInflater().inflate(R.layout.document_mu_activity, null);
	mFilenameView = (TextView)mButtonsView.findViewById(R.id.docNameText);
	mPageSlider = (SeekBar)mButtonsView.findViewById(R.id.pageSlider);
	mPageNumberView = (TextView)mButtonsView.findViewById(R.id.pageNumber);
	mSearchButton = (ImageButton)mButtonsView.findViewById(R.id.searchButton);
	mOutlineButton = (ImageButton)mButtonsView.findViewById(R.id.outlineButton);
	mTopBarSwitcher = (ViewAnimator)mButtonsView.findViewById(R.id.switcher);
	mSearchBack = (ImageButton)mButtonsView.findViewById(R.id.searchBack);
	mSearchFwd = (ImageButton)mButtonsView.findViewById(R.id.searchForward);
	mSearchClose = (ImageButton)mButtonsView.findViewById(R.id.searchClose);
	mSearchText = (EditText)mButtonsView.findViewById(R.id.searchText);
	mLinkButton = (ImageButton)mButtonsView.findViewById(R.id.linkButton);
	mTopBarSwitcher.setVisibility(View.INVISIBLE);
	mPageNumberView.setVisibility(View.INVISIBLE);

	mPageSlider.setVisibility(View.INVISIBLE);
}
 
Example #11
Source File: DocumentActivity.java    From PowerFileExplorer with GNU General Public License v3.0 6 votes vote down vote up
private void makeButtonsView() {
	mButtonsView = getLayoutInflater().inflate(R.layout.document_mu_activity, null);
	mFilenameView = (TextView)mButtonsView.findViewById(R.id.docNameText);
	mPageSlider = (SeekBar)mButtonsView.findViewById(R.id.pageSlider);
	mPageNumberView = (TextView)mButtonsView.findViewById(R.id.pageNumber);
	mSearchButton = (ImageButton)mButtonsView.findViewById(R.id.searchButton);
	mOutlineButton = (ImageButton)mButtonsView.findViewById(R.id.outlineButton);
	mTopBarSwitcher = (ViewAnimator)mButtonsView.findViewById(R.id.switcher);
	mSearchBack = (ImageButton)mButtonsView.findViewById(R.id.searchBack);
	mSearchFwd = (ImageButton)mButtonsView.findViewById(R.id.searchForward);
	mSearchClose = (ImageButton)mButtonsView.findViewById(R.id.searchClose);
	mSearchText = (EditText)mButtonsView.findViewById(R.id.searchText);
	mLinkButton = (ImageButton)mButtonsView.findViewById(R.id.linkButton);
	mTopBarSwitcher.setVisibility(View.INVISIBLE);
	mPageNumberView.setVisibility(View.INVISIBLE);

	mPageSlider.setVisibility(View.INVISIBLE);
}
 
Example #12
Source File: DocumentActivity.java    From AndroidMuPDF with Apache License 2.0 6 votes vote down vote up
private void makeButtonsView() {
	mButtonsView = getLayoutInflater().inflate(R.layout.document_activity, null);
	mFilenameView = (TextView)mButtonsView.findViewById(R.id.docNameText);
	mPageSlider = (SeekBar)mButtonsView.findViewById(R.id.pageSlider);
	mPageNumberView = (TextView)mButtonsView.findViewById(R.id.pageNumber);
	mSearchButton = (ImageButton)mButtonsView.findViewById(R.id.searchButton);
	mOutlineButton = (ImageButton)mButtonsView.findViewById(R.id.outlineButton);
	mTopBarSwitcher = (ViewAnimator)mButtonsView.findViewById(R.id.switcher);
	mSearchBack = (ImageButton)mButtonsView.findViewById(R.id.searchBack);
	mSearchFwd = (ImageButton)mButtonsView.findViewById(R.id.searchForward);
	mSearchClose = (ImageButton)mButtonsView.findViewById(R.id.searchClose);
	mSearchText = (EditText)mButtonsView.findViewById(R.id.searchText);
	mLinkButton = (ImageButton)mButtonsView.findViewById(R.id.linkButton);
	mTopBarSwitcher.setVisibility(View.INVISIBLE);
	mPageNumberView.setVisibility(View.INVISIBLE);
	mPageSlider.setVisibility(View.INVISIBLE);
}
 
Example #13
Source File: MainActivity.java    From android-CardEmulation with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example #14
Source File: MainActivity.java    From android-DragAndDropAcrossApps with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example #15
Source File: MainActivity.java    From android-DragAndDropAcrossApps with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example #16
Source File: DocumentActivity.java    From AndroidDocumentViewer with MIT License 6 votes vote down vote up
private void makeButtonsView() {
    mButtonsView = getLayoutInflater().inflate(R.layout.document_activity, null);
    mFilenameView = (TextView) mButtonsView.findViewById(R.id.docNameText);
    mPageSlider = (SeekBar) mButtonsView.findViewById(R.id.pageSlider);
    mPageNumberView = (TextView) mButtonsView.findViewById(R.id.pageNumber);
    mSearchButton = (ImageButton) mButtonsView.findViewById(R.id.searchButton);
    mOutlineButton = (ImageButton) mButtonsView.findViewById(R.id.outlineButton);
    mTopBarSwitcher = (ViewAnimator) mButtonsView.findViewById(R.id.switcher);
    mSearchBack = (ImageButton) mButtonsView.findViewById(R.id.searchBack);
    mSearchFwd = (ImageButton) mButtonsView.findViewById(R.id.searchForward);
    mSearchClose = (ImageButton) mButtonsView.findViewById(R.id.searchClose);
    mSearchText = (EditText) mButtonsView.findViewById(R.id.searchText);
    mButtonsView.findViewById(R.id.ib_go_back).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });
    mLinkButton = (ImageButton) mButtonsView.findViewById(R.id.linkButton);
    mLinkButton.setVisibility(View.GONE);
    mTopBarSwitcher.setVisibility(View.INVISIBLE);
    mPageNumberView.setVisibility(View.INVISIBLE);

    mPageSlider.setVisibility(View.INVISIBLE);
}
 
Example #17
Source File: MainActivity.java    From auid2 with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example #18
Source File: MuPDFFragment.java    From mupdf-android with GNU Affero General Public License v3.0 6 votes vote down vote up
private void makeButtonsView() {
	mButtonsView = getActivity().getLayoutInflater().inflate(R.layout.buttons,null);
	mFilenameView = (TextView)mButtonsView.findViewById(R.id.docNameText);
	mPageSlider = (SeekBar)mButtonsView.findViewById(R.id.pageSlider);
	mPageNumberView = (TextView)mButtonsView.findViewById(R.id.pageNumber);
	mInfoView = (TextView)mButtonsView.findViewById(R.id.info);
	mSearchButton = (ImageButton)mButtonsView.findViewById(R.id.searchButton);
	mReflowButton = (ImageButton)mButtonsView.findViewById(R.id.reflowButton);
	mOutlineButton = (ImageButton)mButtonsView.findViewById(R.id.outlineButton);
	mAnnotButton = (ImageButton)mButtonsView.findViewById(R.id.editAnnotButton);
	mAnnotTypeText = (TextView)mButtonsView.findViewById(R.id.annotType);
	mTopBarSwitcher = (ViewAnimator)mButtonsView.findViewById(R.id.switcher);
	mSearchBack = (ImageButton)mButtonsView.findViewById(R.id.searchBack);
	mSearchFwd = (ImageButton)mButtonsView.findViewById(R.id.searchForward);
	mSearchText = (EditText)mButtonsView.findViewById(R.id.searchText);
	mLinkButton = (ImageButton)mButtonsView.findViewById(R.id.linkButton);
	mMoreButton = (ImageButton)mButtonsView.findViewById(R.id.moreButton);
	mTopBarSwitcher.setVisibility(View.INVISIBLE);
	mPageNumberView.setVisibility(View.INVISIBLE);
	mInfoView.setVisibility(View.INVISIBLE);
	mPageSlider.setVisibility(View.INVISIBLE);
}
 
Example #19
Source File: MuPDFActivity.java    From mupdf-android with GNU Affero General Public License v3.0 6 votes vote down vote up
private void makeButtonsView() {
	mButtonsView = getLayoutInflater().inflate(R.layout.buttons,null);
	mFilenameView = (TextView)mButtonsView.findViewById(R.id.docNameText);
	mPageSlider = (SeekBar)mButtonsView.findViewById(R.id.pageSlider);
	mPageNumberView = (TextView)mButtonsView.findViewById(R.id.pageNumber);
	mInfoView = (TextView)mButtonsView.findViewById(R.id.info);
	mSearchButton = (ImageButton)mButtonsView.findViewById(R.id.searchButton);
	mReflowButton = (ImageButton)mButtonsView.findViewById(R.id.reflowButton);
	mOutlineButton = (ImageButton)mButtonsView.findViewById(R.id.outlineButton);
	mAnnotButton = (ImageButton)mButtonsView.findViewById(R.id.editAnnotButton);
	mAnnotTypeText = (TextView)mButtonsView.findViewById(R.id.annotType);
	mTopBarSwitcher = (ViewAnimator)mButtonsView.findViewById(R.id.switcher);
	mSearchBack = (ImageButton)mButtonsView.findViewById(R.id.searchBack);
	mSearchFwd = (ImageButton)mButtonsView.findViewById(R.id.searchForward);
	mSearchText = (EditText)mButtonsView.findViewById(R.id.searchText);
	mLinkButton = (ImageButton)mButtonsView.findViewById(R.id.linkButton);
	mMoreButton = (ImageButton)mButtonsView.findViewById(R.id.moreButton);
	mTopBarSwitcher.setVisibility(View.INVISIBLE);
	mPageNumberView.setVisibility(View.INVISIBLE);
	mInfoView.setVisibility(View.INVISIBLE);
	mPageSlider.setVisibility(View.INVISIBLE);
}
 
Example #20
Source File: MainActivity.java    From android-NfcProvisioning with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example #21
Source File: MainActivity.java    From android-DrawableTinting with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example #22
Source File: DocumentActivity.java    From Mupdf with Apache License 2.0 6 votes vote down vote up
private void makeButtonsView() {
    mButtonsView = getLayoutInflater().inflate(R.layout.document_activity, null);
    mFilenameView = (TextView) mButtonsView.findViewById(R.id.docNameText);
    mPageSlider = (SeekBar) mButtonsView.findViewById(R.id.pageSlider);
    mPageNumberView = (TextView) mButtonsView.findViewById(R.id.pageNumber);
    mSearchButton = (ImageButton) mButtonsView.findViewById(R.id.searchButton);
    mOutlineButton = (ImageButton) mButtonsView.findViewById(R.id.outlineButton);
    mTopBarSwitcher = (ViewAnimator) mButtonsView.findViewById(R.id.switcher);
    mSearchBack = (ImageButton) mButtonsView.findViewById(R.id.searchBack);
    mSearchFwd = (ImageButton) mButtonsView.findViewById(R.id.searchForward);
    mSearchClose = (ImageButton) mButtonsView.findViewById(R.id.searchClose);
    mSearchText = (EditText) mButtonsView.findViewById(R.id.searchText);
    mLinkButton = (ImageButton) mButtonsView.findViewById(R.id.linkButton);
    mTopBarSwitcher.setVisibility(View.INVISIBLE);
    mPageNumberView.setVisibility(View.INVISIBLE);

    mPageSlider.setVisibility(View.INVISIBLE);
}
 
Example #23
Source File: MainActivity.java    From android-ElevationDrag with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example #24
Source File: MainActivity.java    From android-FloatingActionButtonBasic with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example #25
Source File: MainActivity.java    From android-ElevationBasic with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example #26
Source File: MainActivity.java    From android-PermissionRequest with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example #27
Source File: MainActivity.java    From android-BluetoothChat with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example #28
Source File: MainActivity.java    From android-SwipeRefreshLayoutBasic with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example #29
Source File: MainActivity.java    From android-RecyclerView with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example #30
Source File: MainActivity.java    From android-AppRestrictionSchema with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}