Search in sources :

Example 71 with NonNull

use of android.support.annotation.NonNull in project material-components-android by material-components.

the class Snackbar method setText.

/**
   * Update the text in this {@link Snackbar}.
   *
   * @param message The new text for this {@link BaseTransientBottomBar}.
   */
@NonNull
public Snackbar setText(@NonNull CharSequence message) {
    final SnackbarContentLayout contentLayout = (SnackbarContentLayout) mView.getChildAt(0);
    final TextView tv = contentLayout.getMessageView();
    tv.setText(message);
    return this;
}
Also used : SnackbarContentLayout(android.support.design.internal.SnackbarContentLayout) TextView(android.widget.TextView) NonNull(android.support.annotation.NonNull)

Example 72 with NonNull

use of android.support.annotation.NonNull in project material-components-android by material-components.

the class Snackbar method make.

/**
   * Make a Snackbar to display a message
   *
   * <p>Snackbar will try and find a parent view to hold Snackbar's view from the value given to
   * {@code view}. Snackbar will walk up the view tree trying to find a suitable parent, which is
   * defined as a {@link CoordinatorLayout} or the window decor's content view, whichever comes
   * first.
   *
   * <p>Having a {@link CoordinatorLayout} in your view hierarchy allows Snackbar to enable certain
   * features, such as swipe-to-dismiss and automatically moving of widgets like {@link
   * FloatingActionButton}.
   *
   * @param view The view to find a parent from.
   * @param text The text to show. Can be formatted text.
   * @param duration How long to display the message. Either {@link #LENGTH_SHORT} or {@link
   *     #LENGTH_LONG}
   */
@NonNull
public static Snackbar make(@NonNull View view, @NonNull CharSequence text, @Duration int duration) {
    final ViewGroup parent = findSuitableParent(view);
    if (parent == null) {
        throw new IllegalArgumentException("No suitable parent found from the given view. Please provide a valid view.");
    }
    final LayoutInflater inflater = LayoutInflater.from(parent.getContext());
    final SnackbarContentLayout content = (SnackbarContentLayout) inflater.inflate(R.layout.design_layout_snackbar_include, parent, false);
    final Snackbar snackbar = new Snackbar(parent, content, content);
    snackbar.setText(text);
    snackbar.setDuration(duration);
    return snackbar;
}
Also used : SnackbarContentLayout(android.support.design.internal.SnackbarContentLayout) ViewGroup(android.view.ViewGroup) LayoutInflater(android.view.LayoutInflater) NonNull(android.support.annotation.NonNull)

Example 73 with NonNull

use of android.support.annotation.NonNull in project material-components-android by material-components.

the class Snackbar method setActionTextColor.

/**
   * Sets the text color of the action specified in {@link #setAction(CharSequence,
   * View.OnClickListener)}.
   */
@NonNull
public Snackbar setActionTextColor(@ColorInt int color) {
    final SnackbarContentLayout contentLayout = (SnackbarContentLayout) mView.getChildAt(0);
    final TextView tv = contentLayout.getActionView();
    tv.setTextColor(color);
    return this;
}
Also used : SnackbarContentLayout(android.support.design.internal.SnackbarContentLayout) TextView(android.widget.TextView) NonNull(android.support.annotation.NonNull)

Example 74 with NonNull

use of android.support.annotation.NonNull in project flow by square.

the class Installer method install.

@NonNull
public Context install() {
    if (InternalLifecycleIntegration.find(activity) != null) {
        throw new IllegalStateException("Flow is already installed in this Activity.");
    }
    Dispatcher dispatcher = this.dispatcher;
    if (dispatcher == null) {
        dispatcher = //
        KeyDispatcher.configure(activity, new DefaultKeyChanger(activity)).build();
    }
    final Object defState = defaultKey == null ? "Hello, World!" : defaultKey;
    final History defaultHistory = History.single(defState);
    final Application app = (Application) baseContext.getApplicationContext();
    final KeyManager keyManager = new KeyManager(contextFactories);
    InternalLifecycleIntegration.install(app, activity, parceler, defaultHistory, dispatcher, keyManager);
    return new InternalContextWrapper(baseContext, activity);
}
Also used : Application(android.app.Application) NonNull(android.support.annotation.NonNull)

Example 75 with NonNull

use of android.support.annotation.NonNull in project sqlbrite by square.

the class NewItemFragment method onCreateDialog.

@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final Context context = getActivity();
    View view = LayoutInflater.from(context).inflate(R.layout.new_item, null);
    EditText name = findById(view, android.R.id.input);
    Observable.combineLatest(createClicked, RxTextView.textChanges(name), new Func2<String, CharSequence, String>() {

        @Override
        public String call(String ignored, CharSequence text) {
            return text.toString();
        }
    }).observeOn(Schedulers.io()).subscribe(new Action1<String>() {

        @Override
        public void call(String description) {
            db.insert(TodoItem.TABLE, new TodoItem.Builder().listId(getListId()).description(description).build());
        }
    });
    return //
    new AlertDialog.Builder(context).setTitle(R.string.new_item).setView(view).setPositiveButton(R.string.create, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            createClicked.onNext("clicked");
        }
    }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(@NonNull DialogInterface dialog, int which) {
        }
    }).create();
}
Also used : Context(android.content.Context) EditText(android.widget.EditText) AlertDialog(android.app.AlertDialog) TodoItem(com.example.sqlbrite.todo.db.TodoItem) DialogInterface(android.content.DialogInterface) View(android.view.View) RxTextView(com.jakewharton.rxbinding.widget.RxTextView) NonNull(android.support.annotation.NonNull) NonNull(android.support.annotation.NonNull)

Aggregations

NonNull (android.support.annotation.NonNull)747 View (android.view.View)94 TextView (android.widget.TextView)90 ArrayList (java.util.ArrayList)83 Intent (android.content.Intent)53 ContentValues (android.content.ContentValues)46 Bundle (android.os.Bundle)46 Test (org.junit.Test)45 AlertDialog (android.support.v7.app.AlertDialog)41 Cursor (android.database.Cursor)38 List (java.util.List)34 IOException (java.io.IOException)32 MaterialDialog (com.afollestad.materialdialogs.MaterialDialog)31 LayoutInflater (android.view.LayoutInflater)29 RecyclerView (android.support.v7.widget.RecyclerView)28 ImageView (android.widget.ImageView)28 File (java.io.File)28 DialogAction (com.afollestad.materialdialogs.DialogAction)25 HashMap (java.util.HashMap)25 Bitmap (android.graphics.Bitmap)24