Java 类android.support.design.widget.BaseTransientBottomBar 实例源码

项目:CatchSpy    文件:ApplicationMethod.java   
public static void DoubleClickCloseSnackBar(final Activity mActivity, boolean isDoubleClick) {
    if (isDoubleClick && waitDoubleClick) {
        mActivity.finish();
    } else {
        Snackbar snackbar = Snackbar.make(mActivity.findViewById(R.id.main_layout_content), R.string.action_warn_double_click_close_application, Snackbar.LENGTH_SHORT);
        snackbar.addCallback(new BaseTransientBottomBar.BaseCallback<Snackbar>() {
            @Override
            public void onDismissed(Snackbar transientBottomBar, int event) {
                waitDoubleClick = false;
                super.onDismissed(transientBottomBar, event);
            }
        });
        waitDoubleClick = true;
        snackbar.show();
    }
}
项目:mapbox-navigation-android    文件:MockNavigationActivity.java   
@Override
public void onMapReady(MapboxMap mapboxMap) {
  this.mapboxMap = mapboxMap;

  locationLayerPlugin = new LocationLayerPlugin(mapView, mapboxMap, null);
  locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.NAVIGATION);

  navigationMapRoute = new NavigationMapRoute(navigation, mapView, mapboxMap);

  mapboxMap.setOnMapClickListener(this);
  Snackbar.make(mapView, "Tap map to place waypoint", BaseTransientBottomBar.LENGTH_LONG).show();

  locationEngine = new MockLocationEngine(1000, 50, true);
  mapboxMap.setLocationSource(locationEngine);

  newOrigin();
}
项目:aftercare-app-android    文件:DCDashboardActivity.java   
@Override
public void onSyncNeeded(DCActivityRecord[] records) {
    if (records != null && !syncWarningVisible) {
        syncWarningVisible = true;
        Snacky.builder().setActivty(this).setText(R.string.dashboard_warning_sync_needed).warning().setAction(R.string.txt_yes, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                DCDashboardDataProvider.getInstance().sync(false);
            }
        }).setDuration(Snacky.LENGTH_INDEFINITE).addCallback(new BaseTransientBottomBar.BaseCallback<Snackbar>() {
            @Override
            public void onDismissed(Snackbar transientBottomBar, int event) {
                super.onDismissed(transientBottomBar, event);
                syncWarningVisible = false;
            }
        }).show();
    }
}
项目:Remindy    文件:OneTimeReminderDetailFragment.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setHasOptionsMenu(true);

    if(getArguments().containsKey(REMINDER_TO_DISPLAY)) {
        mReminder = (OneTimeReminder) getArguments().getSerializable(REMINDER_TO_DISPLAY);
    } else {
        BaseTransientBottomBar.BaseCallback<Snackbar> callback = new BaseTransientBottomBar.BaseCallback<Snackbar>() {
            @Override
            public void onDismissed(Snackbar transientBottomBar, int event) {
                super.onDismissed(transientBottomBar, event);
                getActivity().finish();
            }
        };
        SnackbarUtil.showSnackbar(mContainer, SnackbarUtil.SnackbarType.ERROR, R.string.fragment_location_based_reminder_detail_snackbar_error_no_reminder, SnackbarUtil.SnackbarDuration.LONG, callback);
    }

}
项目:Remindy    文件:LocationBasedReminderDetailFragment.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setHasOptionsMenu(true);

    if(getArguments().containsKey(REMINDER_TO_DISPLAY)) {
        mReminder = (LocationBasedReminder) getArguments().getSerializable(REMINDER_TO_DISPLAY);
    } else {
        BaseTransientBottomBar.BaseCallback<Snackbar> callback = new BaseTransientBottomBar.BaseCallback<Snackbar>() {
            @Override
            public void onDismissed(Snackbar transientBottomBar, int event) {
                super.onDismissed(transientBottomBar, event);
                getActivity().finish();
            }
        };
        SnackbarUtil.showSnackbar(mContainer, SnackbarUtil.SnackbarType.ERROR, R.string.fragment_location_based_reminder_detail_snackbar_error_no_reminder, SnackbarUtil.SnackbarDuration.LONG, callback);
    }

}
项目:Remindy    文件:RepeatingReminderDetailFragment.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setHasOptionsMenu(true);

    if(getArguments().containsKey(REMINDER_TO_DISPLAY)) {
        mReminder = (RepeatingReminder) getArguments().getSerializable(REMINDER_TO_DISPLAY);
    } else {
        BaseTransientBottomBar.BaseCallback<Snackbar> callback = new BaseTransientBottomBar.BaseCallback<Snackbar>() {
            @Override
            public void onDismissed(Snackbar transientBottomBar, int event) {
                super.onDismissed(transientBottomBar, event);
                getActivity().finish();
            }
        };
        SnackbarUtil.showSnackbar(mContainer, SnackbarUtil.SnackbarType.ERROR, R.string.fragment_location_based_reminder_detail_snackbar_error_no_reminder, SnackbarUtil.SnackbarDuration.LONG, callback);
    }

}
项目:Remindy    文件:PlaceActivity.java   
@Override
public void onReceiveAddressResult(int resultCode, Bundle resultData) {
    String alias = resultData.getString(FetchAddressIntentService.RESULT_ALIAS_KEY);
    String address = resultData.getString(FetchAddressIntentService.RESULT_ADDRESS_KEY);

    if (resultCode == FetchAddressIntentService.SUCCESS_RESULT) {
        setAliasAndAddress(alias, address);
    } else {
        BaseTransientBottomBar.BaseCallback<Snackbar> callback = new BaseTransientBottomBar.BaseCallback<Snackbar>() {
            @Override
            public void onDismissed(Snackbar transientBottomBar, int event) {
                super.onDismissed(transientBottomBar, event);
                setAliasAndAddress("", "");
            }
        };
        SnackbarUtil.showSnackbar(mMapContainer, SnackbarUtil.SnackbarType.ERROR, R.string.activity_place_snackbar_error_fetching_address, SnackbarUtil.SnackbarDuration.SHORT, callback);
    }
}
项目:Remindy    文件:EditImageAttachmentActivity.java   
private void saveThumbnailAsImageFile(Bitmap thumbnail) {
    File imageFile = new File(FileUtil.getImageAttachmentDir(this), mImageAttachment.getImageFilename());
    try {
        ImageUtil.saveBitmapAsJpeg(imageFile, thumbnail, IMAGE_COMPRESSION_PERCENTAGE);
        SnackbarUtil.showSnackbar(mContainer, SnackbarUtil.SnackbarType.ERROR, R.string.activity_edit_image_attachment_snackbar_error_image_deleted_from_device, SnackbarUtil.SnackbarDuration.LONG, null);

    }catch (IOException e) {
        BaseTransientBottomBar.BaseCallback<Snackbar> callback = new BaseTransientBottomBar.BaseCallback<Snackbar>() {
            @Override
            public void onDismissed(Snackbar transientBottomBar, int event) {
                super.onDismissed(transientBottomBar, event);
                setResult(RESULT_CANCELED);
                finish();
            }
        };
        SnackbarUtil.showSnackbar(mContainer, SnackbarUtil.SnackbarType.ERROR, R.string.error_unexpected, SnackbarUtil.SnackbarDuration.LONG, callback);
    }
}
项目:Remindy    文件:EditImageAttachmentActivity.java   
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    switch (requestCode){
        case REQUEST_TAKE_PICTURE_PERMISSION:
            for (int result : grantResults) {
                if(result != PackageManager.PERMISSION_GRANTED) {
                    BaseTransientBottomBar.BaseCallback<Snackbar> callback = new BaseTransientBottomBar.BaseCallback<Snackbar>() {
                        @Override
                        public void onDismissed(Snackbar transientBottomBar, int event) {
                            super.onDismissed(transientBottomBar, event);
                            handleImageCapture();
                        }
                    };
                    SnackbarUtil.showSnackbar(mContainer, SnackbarUtil.SnackbarType.NOTICE, R.string.activity_edit_image_attachment_snackbar_error_no_permissions, SnackbarUtil.SnackbarDuration.SHORT, callback);
                    return;
                }
            }

            //Permissions granted
            dispatchTakePictureIntent();
            break;
    }
}
项目:anitrend-app    文件:StudioActivity.java   
@Override
protected void onPostCreate(@Nullable Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    swipeRefreshLayout.setOnRefreshListener(this);
    recyclerView.setHasFixedSize(true); //originally set to fixed size true
    recyclerView.setNestedScrollingEnabled(false); //set to false if somethings fail to work properly
    mLayoutManager = new GridLayoutManager(this, getResources().getInteger(R.integer.card_col_size_home));
    recyclerView.setLayoutManager(mLayoutManager);
    progressLayout.showLoading();
    if(model_temp == null) {
        showEmpty();
        snackbar = Snackbar.make(coordinatorLayout, R.string.text_error_request, BaseTransientBottomBar.LENGTH_INDEFINITE).setAction(R.string.Ok, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        snackbar.show();
    }
    startInit();
}
项目:Obd2-Tracker    文件:MainActivity.java   
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
    // Handle navigation view item clicks here.
    int id = item.getItemId();

    if (id == R.id.nav_bluetooth_choose) {
        if (getPresenter().getAccountId() == null) {
            Snackbar.make(getCurrentFocus(), "Account Id isn't generated. Creating new account id...", BaseTransientBottomBar.LENGTH_LONG)
                    .show();
            getPresenter().initAccount();
        } else {
            Intent obdBluetoothServiceIntent = new Intent(this, ObdBluetoothService.class);
            startService(obdBluetoothServiceIntent);
            getPresenter().retrieveBluetoothDevice();
        }

    } else if (id == R.id.nav_share_www_url) {
        shareWWWUrl();
    }

    drawer.closeDrawer(GravityCompat.START);
    return true;
}
项目:RecyclerViewTutorial2017    文件:ListActivity.java   
@Override
public void showUndoSnackbar() {
    Snackbar.make(
            findViewById(R.id.root_list_activity),
            getString(R.string.action_delete_item),
            Snackbar.LENGTH_LONG
    )
            .setAction(R.string.action_undo, new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    controller.onUndoConfirmed();
                }
            })
            .addCallback(new BaseTransientBottomBar.BaseCallback<Snackbar>() {
                @Override
                public void onDismissed(Snackbar transientBottomBar, int event) {
                    super.onDismissed(transientBottomBar, event);

                    controller.onSnackbarTimeout();
                }
            })
            .show();
}
项目:android-storage-permissions    文件:ImagesFragment.java   
@Override
public void showMissingPermissions(boolean showMessage) {
    if (mPermissionSnackbar == null && !showMessage) {
        return;
    }

    if (mPermissionSnackbar == null) {
        mPermissionSnackbar = Snackbar.make(mCoordinatorLayout, R.string.missing_permissions,
                BaseTransientBottomBar.LENGTH_INDEFINITE);
        mPermissionSnackbar.setAction(R.string.request, new PermissionRequestClickListener());
    }
    if (showMessage) {
        mPermissionSnackbar.show();
    } else {
        mPermissionSnackbar.dismiss();
    }
}
项目:Mediator    文件:MainActivity.java   
private void requestPermission() {
    Mediator.request(Manifest.permission.WRITE_EXTERNAL_STORAGE)
            .onPerform(new Mediator.OnPerform() {
                @Override
                public void onPerform() {
                    openAlbum();
                    Snackbar.make(mainView, "Accepted, now performing ...", BaseTransientBottomBar.LENGTH_LONG).show();
                }
            })
            .onRejected(new Mediator.OnRejected() {
                @Override
                public void onRejected() {
                    Snackbar.make(mainView, "Rejected", BaseTransientBottomBar.LENGTH_LONG).show();
                }
            })
            .delegate();
}
项目:PosTrainer    文件:AlarmListFragment.java   
@Override
public void showUndoSnackbar() {
    Snackbar.make(
            getView().findViewById(R.id.root_alarm_list_fragment),
            getString(R.string.action_delete_item),
            Snackbar.LENGTH_LONG
    )
            .setAction(R.string.action_undo, new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    presenter.onUndoConfirmed();
                }
            })
            .addCallback(new BaseTransientBottomBar.BaseCallback<Snackbar>() {
                @Override
                public void onDismissed(Snackbar transientBottomBar, int event) {
                    super.onDismissed(transientBottomBar, event);

                    presenter.onSnackbarTimeout();
                }
            })
            .show();
}
项目:material-components-android    文件:SnackbarUtils.java   
/**
 * Helper method that shows that specified {@link Snackbar} and waits until it has been fully
 * shown.
 */
public static void showTransientBottomBarAndWaitUntilFullyShown(
    @NonNull BaseTransientBottomBar transientBottomBar) {
  TransientBottomBarShownCallback callback = new TransientBottomBarShownCallback();
  transientBottomBar.addCallback(callback);
  try {
    // Register our listener as idling resource so that Espresso waits until the
    // the bar has been fully shown
    Espresso.registerIdlingResources(callback);
    // Show the bar
    transientBottomBar.show();
    // Mark the callback to require waiting for idle state
    callback.needsIdle = true;
    // Perform a dummy Espresso action that loops until the UI thread is idle. This
    // effectively blocks us until the Snackbar has completed its sliding animation.
    onView(isRoot()).perform(waitUntilIdle());
    callback.needsIdle = false;
  } finally {
    // Unregister our idling resource
    Espresso.unregisterIdlingResources(callback);
    // And remove our tracker listener from Snackbar
    transientBottomBar.removeCallback(callback);
  }
}
项目:material-components-android    文件:SnackbarUtils.java   
/**
 * Helper method that dismissed that specified {@link Snackbar} and waits until it has been fully
 * dismissed.
 */
public static void performActionAndWaitUntilFullyDismissed(
    @NonNull BaseTransientBottomBar transientBottomBar, @NonNull TransientBottomBarAction action)
    throws Throwable {
  TransientBottomBarDismissedCallback callback = new TransientBottomBarDismissedCallback();
  transientBottomBar.addCallback(callback);
  try {
    // Register our listener as idling resource so that Espresso waits until the
    // the bar has been fully dismissed
    Espresso.registerIdlingResources(callback);
    // Run the action
    action.perform();
    // Mark the callback to require waiting for idle state
    callback.needsIdle = true;
    // Perform a dummy Espresso action that loops until the UI thread is idle. This
    // effectively blocks us until the Snackbar has completed its sliding animation.
    onView(isRoot()).perform(waitUntilIdle());
    callback.needsIdle = false;
  } finally {
    // Unregister our idling resource
    Espresso.unregisterIdlingResources(callback);
    // And remove our tracker listener from Snackbar
    transientBottomBar.removeCallback(null);
  }
}
项目:material-components-android    文件:SnackbarUtils.java   
/** Helper method that waits until the given bar has been fully dismissed. */
public static void waitUntilFullyDismissed(@NonNull BaseTransientBottomBar transientBottomBar) {
  TransientBottomBarDismissedCallback callback = new TransientBottomBarDismissedCallback();
  transientBottomBar.addCallback(callback);
  try {
    // Register our listener as idling resource so that Espresso waits until the
    // the bar has been fully dismissed
    Espresso.registerIdlingResources(callback);
    // Mark the callback to require waiting for idle state
    callback.needsIdle = true;
    // Perform a dummy Espresso action that loops until the UI thread is idle. This
    // effectively blocks us until the Snackbar has completed its sliding animation.
    onView(isRoot()).perform(waitUntilIdle());
    callback.needsIdle = false;
  } finally {
    // Unregister our idling resource
    Espresso.unregisterIdlingResources(callback);
    // And remove our tracker listener from Snackbar
    transientBottomBar.removeCallback(null);
  }
}
项目:mapbox-navigation-android    文件:NavigationViewActivity.java   
@Override
public void onResponse(Call<DirectionsResponse> call, Response<DirectionsResponse> response) {
  if (validRouteResponse(response)) {
    hideLoading();
    route = response.body().routes().get(0);
    if (route.distance() > 25d) {
      launchRouteBtn.setEnabled(true);
      mapRoute.addRoutes(response.body().routes());
      boundCameraToRoute();
    } else {
      Snackbar.make(mapView, "Please select a longer route", BaseTransientBottomBar.LENGTH_SHORT).show();
    }
  }
}
项目:mapbox-navigation-android    文件:NavigationViewActivity.java   
private void onLocationFound(Location location) {
  if (!locationFound) {
    animateCamera(new LatLng(location.getLatitude(), location.getLongitude()));
    Snackbar.make(mapView, "Long press map to place waypoint", BaseTransientBottomBar.LENGTH_LONG).show();
    locationFound = true;
    hideLoading();
  }
}
项目:Remindy    文件:SnackbarUtil.java   
public static void showSnackbar(View container, @NonNull SnackbarType snackbarType,
                                @StringRes int textStringRes, @Nullable SnackbarDuration duration,
                                @Nullable BaseTransientBottomBar.BaseCallback<Snackbar> callback) {

    duration = (duration == null ? SnackbarDuration.LONG : duration);

    Snackbar snackbar = Snackbar.make(container, textStringRes, duration.getDuration());
    snackbar.getView().setBackgroundResource(snackbarType.getColorRes());
    TextView snackbarText = (TextView) snackbar.getView().findViewById(android.support.design.R.id.snackbar_text);
    snackbarText.setCompoundDrawablesWithIntrinsicBounds(0, 0,snackbarType.getIconRes(), 0);
    snackbarText.setGravity(Gravity.CENTER);
    if(callback != null)
        snackbar.addCallback(callback);
    snackbar.show();
}
项目:anitrend-app    文件:ListBrowseActivity.java   
/**
 * Optionally allowed to override
 */
@Override
protected void startInit() {
    if(mUserId != 0 && mContentType != -1)
        updateUI();
    else {
        snackbar = Snackbar.make(coordinatorLayout, R.string.text_error_request, BaseTransientBottomBar.LENGTH_INDEFINITE).setAction(R.string.Ok, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        snackbar.show();
    }
}
项目:android-storage-permissions    文件:ImageImportActivity.java   
private void showPermissionError(boolean showMessage) {
    if (mPermissionSnackbar == null && !showMessage) {
        return;
    }

    if (mPermissionSnackbar == null) {
        mPermissionSnackbar = Snackbar.make(mCoordinatorLayout, "Missing Permissions", BaseTransientBottomBar.LENGTH_INDEFINITE);
        mPermissionSnackbar.setAction("Request", new PermissionRequestClickListener());
    }
    if (showMessage) {
        mPermissionSnackbar.show();
    } else {
        mPermissionSnackbar.dismiss();
    }
}
项目:NCBSinfo    文件:Home.java   
@OnClick(R.id.hm_fav)
public void setFavorite() {
    CommonTasks.sendFavoriteRoute(getApplicationContext(), currentObject.getRouteNo());
    currentObject.setFavoriteRoute(currentObject.getRouteNo());
    favorite.setImageResource(R.drawable.icon_favorite);
    Snackbar snackbar = Snackbar.make(mainLayout, "Default route changed!", BaseTransientBottomBar.LENGTH_SHORT);
    snackbar.getView().setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.green));
    snackbar.show();
}
项目:aptoide-client-v8    文件:GridStoreMetaWidget.java   
private void showFollowStoreError() {
  followStoreButton.setText(R.string.follow);
  followStoreButton.setEnabled(true);
  Snackbar.make(itemView, R.string.storetab_short_follow_error,
      BaseTransientBottomBar.LENGTH_LONG)
      .show();
}
项目:material-components-android    文件:SnackbarUtils.java   
@Override
public void onShown(BaseTransientBottomBar transientBottomBar) {
  isShown = true;
  if (callback != null) {
    callback.onTransitionToIdle();
  }
}
项目:material-components-android    文件:SnackbarUtils.java   
@Override
public void onDismissed(BaseTransientBottomBar transientBottomBar, @DismissEvent int event) {
  isDismissed = true;
  if (callback != null) {
    callback.onTransitionToIdle();
  }
}
项目:material-components-android    文件:SnackbarUtils.java   
/**
 * Helper method that dismissed that specified {@link Snackbar} and waits until it has been fully
 * dismissed.
 */
public static void dismissTransientBottomBarAndWaitUntilFullyDismissed(
    @NonNull final BaseTransientBottomBar transientBottomBar) throws Throwable {
  performActionAndWaitUntilFullyDismissed(
      transientBottomBar,
      new TransientBottomBarAction() {
        @Override
        public void perform() throws Throwable {
          transientBottomBar.dismiss();
        }
      });
}
项目:roboclub-amu    文件:ProfileActivity.java   
private void updateProfile(Map<String, Object> objectMap) {
    FirebaseDatabase.getInstance()
            .getReference(reference)
            .updateChildren(objectMap, (databaseError, databaseReference) -> {
                if(databaseError != null){
                    Log.d("UpdateProfile", "updateProfile: " + databaseError);
                    Snackbar.make(rootLayout, R.string.profile_update_failed, BaseTransientBottomBar.LENGTH_SHORT).show();
                } else {
                    Snackbar.make(rootLayout, R.string.profile_updated, BaseTransientBottomBar.LENGTH_SHORT).show();
                }
            });
}
项目:edx-app-android    文件:SnackbarErrorNotification.java   
/**
 * Show the error notification as a persistent Snackbar, according to the provided details.
 *
 * @param errorResId      The resource ID of the error message.
 * @param icon            The error icon. This is ignored here, since Snackbar doesn't really support
 *                        icons.
 * @param actionTextResId The resource ID of the action button text.
 * @param actionListener  The callback to be invoked when the action button is clicked.
 */
@Override
public void showError(@StringRes final int errorResId,
                      @Nullable final Icon icon,
                      @StringRes final int actionTextResId,
                      @Nullable final View.OnClickListener actionListener) {
    if (snackbar == null) {
        snackbar = Snackbar.make(view, errorResId, LENGTH_INDEFINITE);
        if (actionTextResId != 0) {
            // SnackBar automatically dimisses when the action item is pressed.
            // This workaround has been implemented to by pass that behaviour.
            snackbar.setAction(actionTextResId, new View.OnClickListener() {
                @Override
                public void onClick(View v) {

                }
            });
        }
        snackbar.addCallback(new BaseTransientBottomBar.BaseCallback<Snackbar>() {
            @Override
            public void onDismissed(Snackbar transientBottomBar, int event) {
                super.onDismissed(transientBottomBar, event);
                snackbar = null;
            }
        });
        // By applying the listener to the button like we have done below, the Snackbar
        // doesn't automatically dismiss and we have to manually dismiss it.
        final Button actionButton = (Button) snackbar.getView().findViewById(android.support.design.R.id.snackbar_action);
        actionButton.setOnClickListener(actionListener);
        snackbar.show();
    }
}
项目:nonet    文件:ShadowSnackbar.java   
@Implementation
public static Snackbar make(@NonNull View view, @NonNull CharSequence text, int duration) {
    Snackbar snackbar = null;

    try {
        Constructor<SnackbarContentLayout> layoutConstructor = SnackbarContentLayout.class.getDeclaredConstructor(Context.class);
        if (Modifier.isPrivate(layoutConstructor.getModifiers())) {
            layoutConstructor.setAccessible(true);
        }
        SnackbarContentLayout content = layoutConstructor.newInstance(view.getContext());

        Constructor<Snackbar> constructor = Snackbar.class.getDeclaredConstructor(ViewGroup.class, View.class, BaseTransientBottomBar.ContentViewCallback.class);
        if (Modifier.isPrivate(constructor.getModifiers())) {
            constructor.setAccessible(true);
        }

        snackbar = constructor.newInstance(findSuitableParent(view), content, content);
        snackbar.setText(text);
        snackbar.setDuration(duration);
    } catch (Exception e) {
        e.printStackTrace();
    }

    shadowOf(snackbar).text = text.toString();

    shadowSnackbars.add(shadowOf(snackbar));

    return snackbar;
}
项目:redux-observable    文件:HomeActivity.java   
private void renderLoadError(Throwable error) {
    sRefresh.setRefreshing(false);
    errorSnackbar = Snackbar.make(ltView, error.getMessage(),
            BaseTransientBottomBar.LENGTH_INDEFINITE);
    errorSnackbar.show();
}
项目:Architecture    文件:TopRepoListActivity.java   
private void renderLoadError(Throwable error) {
  swipeRefreshLayout.setRefreshing(false);
  errorSnackbar = Snackbar.make(contentView, error.getMessage(),
      BaseTransientBottomBar.LENGTH_INDEFINITE);
  errorSnackbar.show();
}
项目:REDAndroid    文件:RequestSearchActivity.java   
@Override
public void showError() {
    Snackbar.make(getCurrentFocus(), getString(R.string.error_empty_search), BaseTransientBottomBar.LENGTH_LONG);
}
项目:REDAndroid    文件:UserSearchActivity.java   
@Override
public void showError() {
    Snackbar.make(getCurrentFocus(), getString(R.string.error_empty_search), BaseTransientBottomBar.LENGTH_LONG);
}
项目:REDAndroid    文件:ArtistSearchActivity.java   
@Override
public void showError() {
    Snackbar.make(getCurrentFocus(), getString(R.string.error_empty_search), BaseTransientBottomBar.LENGTH_LONG);
}
项目:REDAndroid    文件:TorrentSearchActivity.java   
@Override
public void showError() {
    Snackbar.make(getCurrentFocus(), getString(R.string.error_empty_search), BaseTransientBottomBar.LENGTH_LONG);
}
项目:odoo-work    文件:LoginActivity.java   
@Override
public void onLoginFail(OdooError error) {
    progressDialog.dismiss();
    Snackbar.make(getContentView(), R.string.error_login_failed, BaseTransientBottomBar.LENGTH_LONG)
            .show();
}
项目:ChatExchange-old    文件:RecyclerAdapter.java   
public void removeItemWithSnackbar(Activity activity, final int position, final SnackbarListener listener)
{
    getSwipeManager().performFakeSwipe(mVHs.get(position), SwipeableItemConstants.RESULT_SWIPED_LEFT);

    if (mChatroomObjects.get(position) != null)
    {
        final ChatroomRecyclerObject huehuehue = removeItem(position);

        if (huehuehue != null)
        {
            final SharedPreferences mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(activity);

            huehuehue.setIsPinned(false);
            String chatroomName = huehuehue.getName();
            String snackTextDel = "Deleted " + chatroomName;
            final String snackTextRestore = "Chatroom restored!";

            final SpannableStringBuilder snackTextDelSSB = new SpannableStringBuilder().append(snackTextDel);
            final SpannableStringBuilder snackTextRestoreSSB = new SpannableStringBuilder().append(snackTextRestore);


            if (mSharedPrefs.getBoolean("darkTheme", false))
            {
                snackTextDelSSB.setSpan(new ForegroundColorSpan(activity.getResources().getColor(R.color.colorDark)), 0, snackTextDel.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
                snackTextRestoreSSB.setSpan(new ForegroundColorSpan(activity.getResources().getColor(R.color.colorDark)), 0, snackTextRestore.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            }

            else
            {
                snackTextDelSSB.setSpan(new ForegroundColorSpan(activity.getResources().getColor(R.color.white)), 0, snackTextDel.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
                snackTextRestoreSSB.setSpan(new ForegroundColorSpan(activity.getResources().getColor(R.color.white)), 0, snackTextRestore.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            }

            final View parentLayout = activity.findViewById(android.R.id.content);
            Snackbar snackbar = Snackbar
                    .make(parentLayout, snackTextDelSSB, Snackbar.LENGTH_LONG)
                    .setAction("UNDO", new View.OnClickListener()
                    {
                        @Override
                        public void onClick(View view)
                        {
                            Snackbar hue = Snackbar.make(parentLayout, snackTextRestoreSSB, Snackbar.LENGTH_SHORT);

                            if (mSharedPrefs.getBoolean("darkTheme", false))
                            {
                                hue.getView().setBackgroundColor(Color.WHITE);
                            }

                            hue.show();
                            addItem(huehuehue);
                            listener.onUndo();
                        }
                    });

            if (mSharedPrefs.getBoolean("darkTheme", false))
            {
                snackbar.getView().setBackgroundColor(activity.getResources().getColor(R.color.white));
            }

            snackbar.show();
            snackbar.addCallback(new BaseTransientBottomBar.BaseCallback<Snackbar>()
            {
                @Override
                public void onDismissed(Snackbar transientBottomBar, int event)
                {
                    switch (event)
                    {
                        case DISMISS_EVENT_TIMEOUT:
                            listener.onUndoExpire(huehuehue.getUrl());
                            break;
                    }
                }
            });
        }
    }
}
项目:Remindy    文件:EditImageAttachmentActivity.java   
@Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_edit_image_attachment);

        mContainer = (RelativeLayout) findViewById(R.id.activity_edit_image_attachment_container);
        mImage = (ImageView) findViewById(R.id.activity_edit_image_attachment_image);
        mCrop = (FloatingActionButton) findViewById(R.id.activity_edit_image_attachment_crop);
        mRotate = (FloatingActionButton) findViewById(R.id.activity_edit_image_attachment_rotate);
        mCamera = (FloatingActionButton) findViewById(R.id.activity_edit_image_attachment_camera);
        mOk = (Button) findViewById(R.id.activity_edit_image_attachment_ok);
        mCancel = (Button) findViewById(R.id.activity_edit_image_attachment_cancel);

        //If screen was rotated, for example
        if (savedInstanceState != null) {
            //Load values from savedInstanceState
            mImageAttachment = (ImageAttachment) savedInstanceState.getSerializable(IMAGE_ATTACHMENT_EXTRA);
            mHolderPosition = savedInstanceState.getInt(HOLDER_POSITION_EXTRA);
            mEditingExistingImageAttachment = savedInstanceState.getBoolean(EDITING_ATTACHMENT_EXTRA);

            //Get jpeg from SD Card
            mImageBackup = ImageUtil.getBitmap(new File(FileUtil.getImageAttachmentDir(this), mImageAttachment.getImageFilename()));
            if(mImageBackup == null) {  //If jpeg was deleted from device, use thumbnail
                mImageBackup = ImageUtil.getBitmap(mImageAttachment.getThumbnail());
                saveThumbnailAsImageFile(mImageBackup);
            }

            mImage.setImageBitmap(mImageBackup);
            showTapTargetSequence();
        } else {

            //Coming from another activity: Check if intent has required extras
            if(getIntent().hasExtra(HOLDER_POSITION_EXTRA) && getIntent().hasExtra(IMAGE_ATTACHMENT_EXTRA)) {
                mHolderPosition = getIntent().getIntExtra(HOLDER_POSITION_EXTRA, -1);
                mImageAttachment = (ImageAttachment) getIntent().getSerializableExtra(IMAGE_ATTACHMENT_EXTRA);

                if (mImageAttachment.getImageFilename() != null && !mImageAttachment.getImageFilename().isEmpty()) {
                    mImageBackup = ImageUtil.getBitmap(new File(FileUtil.getImageAttachmentDir(this), mImageAttachment.getImageFilename()));
                    if(mImageBackup == null) {  //IF image was deleted from device
                        mImageBackup = ImageUtil.getBitmap(mImageAttachment.getThumbnail());
                        saveThumbnailAsImageFile(mImageBackup);
                    }

                    mEditingExistingImageAttachment = true;
                    mImage.setImageBitmap(mImageBackup);
                    showTapTargetSequence();
                } else {
                    mImageAttachment = new ImageAttachment();
                    mImageAttachment.setImageFilename(UUID.randomUUID().toString() + IMAGE_FILE_EXTENSION);
                    handleShowCameraGalleryDialog();
                }
            } else {
                BaseTransientBottomBar.BaseCallback<Snackbar> callback = new BaseTransientBottomBar.BaseCallback<Snackbar>() {
                    @Override
                    public void onDismissed(Snackbar transientBottomBar, int event) {
                        super.onDismissed(transientBottomBar, event);
                        setResult(RESULT_CANCELED);
                        finish();
                    }
                };
                Log.e(TAG, "Missing HOLDER_POSITION_EXTRA and/or IMAGE_ATTACHMENT_EXTRA parameters in EditImageAttachmentActivity.");
                SnackbarUtil.showSnackbar(mContainer, SnackbarUtil.SnackbarType.ERROR, R.string.error_unexpected, SnackbarUtil.SnackbarDuration.LONG, callback);
                finish();
            }

//            mImageAttachment = new ImageAttachment(new byte[0], "09ce7135-86d6-4d93-bcc5-1fbff5651d0f.jpg");
//            mImageBackup = ImageUtil.getBitmap(new File(FileUtil.getImageAttachmentDir(this), mImageAttachment.getImageFilename()));
//            mEditingExistingImageAttachment = true;
//            mImage.setImageBitmap(mImageBackup);

        }


        mRotation = 0;
        mCrop.setOnClickListener(this);
        mRotate.setOnClickListener(this);
        mCamera.setOnClickListener(this);
        mOk.setOnClickListener(this);
        mCancel.setOnClickListener(this);
    }