Java Code Examples for android.support.design.widget.Snackbar#LENGTH_LONG
The following examples show how to use
android.support.design.widget.Snackbar#LENGTH_LONG .
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: UserNotifierTest.java From GNSS_Compare with Apache License 2.0 | 6 votes |
/** * Testing creation from description * @throws Exception */ @Test public void UserNotifierSnackbarTimeConversionTest() throws Exception{ TestUserNotifier notifier = new TestUserNotifier(); final String []messageText = {"test", "test2", "testtest\ntest"}; final int[] duration = {1000, Snackbar.LENGTH_SHORT, Snackbar.LENGTH_LONG}; final String []id = {"A", "B", "C"}; for (int i=0; i<3; i++){ notifier.notifyUser(messageText[i], duration[i], id[i]); assertEquals(messageText[i], notifier.getLastMessage()); if(duration[i] == Snackbar.LENGTH_SHORT) assertEquals(TestUserNotifier.DURATION_SHORT, notifier.getLastDuration()); if(duration[i] == Snackbar.LENGTH_LONG) assertEquals(TestUserNotifier.DURATION_LONG, notifier.getLastDuration()); assertEquals(id[i], notifier.getLastId()); } }
Example 2
Source File: UtilsDisplay.java From AppUpdater with Apache License 2.0 | 6 votes |
static Snackbar showUpdateAvailableSnackbar(final Context context, String content, Boolean indefinite, final UpdateFrom updateFrom, final URL apk) { Activity activity = (Activity) context; int snackbarTime = indefinite ? Snackbar.LENGTH_INDEFINITE : Snackbar.LENGTH_LONG; /*if (indefinite) { snackbarTime = Snackbar.LENGTH_INDEFINITE; } else { snackbarTime = Snackbar.LENGTH_LONG; }*/ Snackbar snackbar = Snackbar.make(activity.findViewById(android.R.id.content), content, snackbarTime); snackbar.setAction(context.getResources().getString(R.string.appupdater_btn_update), new View.OnClickListener() { @Override public void onClick(View view) { UtilsLibrary.goToUpdate(context, updateFrom, apk); } }); return snackbar; }
Example 3
Source File: UserNotifier.java From GNSS_Compare with Apache License 2.0 | 5 votes |
public void notifyUser(String text, int duration, String id){ if(duration == Snackbar.LENGTH_SHORT) duration = 2000; else if (duration == Snackbar.LENGTH_LONG) duration = 3500; displayMessage(text, duration, id); }
Example 4
Source File: UtilsDisplay.java From AppUpdater with Apache License 2.0 | 5 votes |
static Snackbar showUpdateNotAvailableSnackbar(final Context context, String content, Boolean indefinite) { Activity activity = (Activity) context; int snackbarTime = indefinite ? Snackbar.LENGTH_INDEFINITE : Snackbar.LENGTH_LONG; /*if (indefinite) { snackbarTime = Snackbar.LENGTH_INDEFINITE; } else { snackbarTime = Snackbar.LENGTH_LONG; }*/ return Snackbar.make(activity.findViewById(android.R.id.content), content, snackbarTime); }
Example 5
Source File: FluentSnackbar.java From FluentSnackbar with MIT License | 5 votes |
private Builder(CharSequence text) { mText = text; mMaxLines = 1; mTextColor = Color.WHITE; mBackgroundColor = ContextCompat.getColor(mView.getContext(), R.color.default_background); mIsImportant = false; mDuration = Snackbar.LENGTH_LONG; mActionText = mView.getContext().getString(R.string.default_action); }
Example 6
Source File: InsulinIntegrationNotify.java From HAPP with GNU General Public License v3.0 | 5 votes |
public Snackbar getSnackbar(View v){ if (recentlyUpdated.size() > 0) { int snackbarLength = Snackbar.LENGTH_LONG; Snackbar snackbar = Snackbar.make(v, snackbarMsg, snackbarLength); View snackbarView = snackbar.getView(); TextView textView = (TextView) snackbarView.findViewById(android.support.design.R.id.snackbar_text); //textView.setTextSize(TypedValue.COMPLEX_UNIT_SP,10F); textView.setMaxLines(recentlyUpdated.size()); snackbar.setAction("DETAILS", new View.OnClickListener() { @Override public void onClick(View view) { Dialog dialog = new Dialog(view.getContext()); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.integration_dialog); dialog.setCancelable(true); dialog.setCanceledOnTouchOutside(true); ListView list = (ListView) dialog.findViewById(R.id.integrationList); mySimpleAdapter adapter = new mySimpleAdapter(MainActivity.getInstance(), detailList, R.layout.integration_list_layout_insulin_summary, new String[]{"value", "summary", "state", "details", "happObjectType", "action", "date"}, new int[]{R.id.insulinSummaryAmount, R.id.insulinSummarySummary, R.id.insulinSummaryState, R.id.insulinSummaryDetails, R.id.insulinSummaryHappObjectType, R.id.insulinSummaryAction, R.id.insulinSummaryDate}); list.setAdapter(adapter); dialog.show(); } }); return snackbar; } else { return null; } }