本文整理汇总了Java中android.support.design.widget.BaseTransientBottomBar类的典型用法代码示例。如果您正苦于以下问题:Java BaseTransientBottomBar类的具体用法?Java BaseTransientBottomBar怎么用?Java BaseTransientBottomBar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BaseTransientBottomBar类属于android.support.design.widget包,在下文中一共展示了BaseTransientBottomBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DoubleClickCloseSnackBar
import android.support.design.widget.BaseTransientBottomBar; //导入依赖的package包/类
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();
}
}
示例2: onMapReady
import android.support.design.widget.BaseTransientBottomBar; //导入依赖的package包/类
@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();
}
示例3: onSyncNeeded
import android.support.design.widget.BaseTransientBottomBar; //导入依赖的package包/类
@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();
}
}
示例4: onCreate
import android.support.design.widget.BaseTransientBottomBar; //导入依赖的package包/类
@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);
}
}
示例5: onCreate
import android.support.design.widget.BaseTransientBottomBar; //导入依赖的package包/类
@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);
}
}
示例6: onCreate
import android.support.design.widget.BaseTransientBottomBar; //导入依赖的package包/类
@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);
}
}
示例7: onReceiveAddressResult
import android.support.design.widget.BaseTransientBottomBar; //导入依赖的package包/类
@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);
}
}
示例8: saveThumbnailAsImageFile
import android.support.design.widget.BaseTransientBottomBar; //导入依赖的package包/类
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);
}
}
示例9: onRequestPermissionsResult
import android.support.design.widget.BaseTransientBottomBar; //导入依赖的package包/类
@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;
}
}
示例10: onPostCreate
import android.support.design.widget.BaseTransientBottomBar; //导入依赖的package包/类
@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();
}
示例11: onNavigationItemSelected
import android.support.design.widget.BaseTransientBottomBar; //导入依赖的package包/类
@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;
}
示例12: showUndoSnackbar
import android.support.design.widget.BaseTransientBottomBar; //导入依赖的package包/类
@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();
}
示例13: showMissingPermissions
import android.support.design.widget.BaseTransientBottomBar; //导入依赖的package包/类
@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();
}
}
示例14: requestPermission
import android.support.design.widget.BaseTransientBottomBar; //导入依赖的package包/类
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();
}
示例15: showUndoSnackbar
import android.support.design.widget.BaseTransientBottomBar; //导入依赖的package包/类
@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();
}