use of android.widget.ViewAnimator in project muzei by romannurik.
the class GallerySettingsActivity method onDataSetChanged.
private void onDataSetChanged() {
View emptyView = findViewById(android.R.id.empty);
TextView emptyDescription = (TextView) findViewById(R.id.empty_description);
if (mChosenUris != null && mChosenUris.getCount() > 0) {
emptyView.setVisibility(View.GONE);
// We have at least one image, so consider the Gallery source properly setup
setResult(RESULT_OK);
} else {
// No chosen images, show the empty View
emptyView.setVisibility(View.VISIBLE);
ViewAnimator animator = (ViewAnimator) findViewById(R.id.empty_animator);
if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
// Permission is granted, we can show the random camera photos image
animator.setDisplayedChild(0);
emptyDescription.setText(R.string.gallery_empty);
setResult(RESULT_OK);
} else {
// We have no images until they enable the permission
setResult(RESULT_CANCELED);
if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.READ_EXTERNAL_STORAGE)) {
// We should show rationale on why they should enable the storage permission and
// random camera photos
animator.setDisplayedChild(1);
emptyDescription.setText(R.string.gallery_permission_rationale);
} else {
// The user has permanently denied the storage permission. Give them a link to app settings
animator.setDisplayedChild(2);
emptyDescription.setText(R.string.gallery_denied_explanation);
}
}
}
}
use of android.widget.ViewAnimator in project RoboBinding by RoboBinding.
the class DisplayedChildAttributeTest method whenUpdateView_thenViewShouldReflectChanges.
@Test
public void whenUpdateView_thenViewShouldReflectChanges() {
ViewAnimator view = new ViewAnimator(RuntimeEnvironment.application);
DisplayedChildAttribute attribute = new DisplayedChildAttribute();
int numChilds = 5;
int displayedChild = RandomValues.nextInt(numChilds);
for (int i = 0; i < numChilds; i++) {
view.addView(new TextView(view.getContext()));
}
attribute.updateView(view, displayedChild);
assertThat(view.getDisplayedChild(), equalTo(displayedChild));
}
use of android.widget.ViewAnimator in project mobile-android by photo.
the class FeatherActivity method onContentChanged.
/*
* (non-Javadoc)
*
* @see android.app.Activity#onContentChanged()
*/
@Override
public void onContentChanged() {
super.onContentChanged();
mDragLayer = (DragLayer) findViewById(R.id.dragLayer);
mToolbar = (ToolbarView) findViewById(R.id.toolbar);
mBottomBarFlipper = (BottombarViewFlipper) findViewById(R.id.bottombar_view_flipper);
mWorkspace = (Workspace) mBottomBarFlipper.findViewById(R.id.workspace);
mImageView = (ImageViewTouch) findViewById(R.id.image);
mDrawingViewContainer = (ViewGroup) findViewById(R.id.drawing_view_container);
mInlineProgressLoader = findViewById(R.id.image_loading_view);
mWorkspaceIndicator = (WorkspaceIndicator) findViewById(R.id.workspace_indicator);
mViewFlipper = ((ViewAnimator) findViewById(R.id.main_flipper));
mToolbarMainAnimator = ((ViewFlipper) mToolbar.findViewById(R.id.top_indicator_main));
mToolbarContentAnimator = ((ViewFlipper) mToolbar.findViewById(R.id.top_indicator_panel));
mPopupContainer = (ViewGroup) findViewById(R.id.feather_dialogs_container);
// update the progressbar animation drawable
AnimatedRotateDrawable d = new AnimatedRotateDrawable(getResources(), R.drawable.feather_spinner_white_16);
ProgressBar view = (ProgressBar) mToolbarContentAnimator.getChildAt(1);
view.setIndeterminateDrawable(d);
// adding the bottombar content view at runtime, otherwise fail to get the corrent child
// LayoutInflater inflater = (LayoutInflater) getSystemService( Context.LAYOUT_INFLATER_SERVICE );
// View contentView = inflater.inflate( R.layout.feather_option_panel_content, mBottomBarFlipper, false );
// FrameLayout.LayoutParams p = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT,
// FrameLayout.LayoutParams.WRAP_CONTENT );
// p.gravity = Gravity.BOTTOM;
// mBottomBarFlipper.addView( contentView, 0, p );
mBottomBarFlipper.setDisplayedChild(1);
}
Aggregations