/** * Instantiates a new {@value #TAG} with a specified style. * * @param activity {@link android.app.Activity} * @param style {@link com.github.johnpersano.supertoasts.util.Style} */ public SuperActivityToast(Activity activity, Style style) { if (activity == null) { throw new IllegalArgumentException(TAG + ERROR_ACTIVITYNULL); } this.mActivity = activity; mLayoutInflater = (LayoutInflater) activity .getSystemService(Context.LAYOUT_INFLATER_SERVICE); mViewGroup = (ViewGroup) activity .findViewById(android.R.id.content); mToastView = mLayoutInflater.inflate(R.layout.supertoast, mViewGroup, false); mMessageTextView = (TextView) mToastView .findViewById(R.id.message_textview); mRootLayout = (LinearLayout) mToastView .findViewById(R.id.root_layout); this.setStyle(style); }
.findViewById(R.id.root_layout); this.setStyle(style);
/** * Returns a {@value #TAG} with a specified style. * * @param activity {@link android.app.Activity} * @param textCharSequence {@link CharSequence} * @param durationInteger {@link com.github.johnpersano.supertoasts.SuperToast.Duration} * @param style {@link com.github.johnpersano.supertoasts.util.Style} * * @return {@link SuperActivityToast} */ public static SuperActivityToast create(Activity activity, CharSequence textCharSequence, int durationInteger, Style style) { final SuperActivityToast superActivityToast = new SuperActivityToast(activity); superActivityToast.setText(textCharSequence); superActivityToast.setDuration(durationInteger); superActivityToast.setStyle(style); return superActivityToast; }