|
35 | 35 | @SuppressWarnings({ "unused", "WeakerAccess" })
|
36 | 36 | public class EasyDialog extends Dialog implements LayoutWrapper {
|
37 | 37 |
|
| 38 | + // <editor-fold desc="Constructors"> |
| 39 | + |
38 | 40 | /**
|
39 | 41 | * Creates a dialog window that uses the default dialog theme.
|
40 | 42 | * <p>
|
@@ -69,145 +71,159 @@ public EasyDialog(@NonNull final Context context, @StyleRes final int themeResId
|
69 | 71 | /**
|
70 | 72 | * {@inheritDoc}
|
71 | 73 | */
|
72 |
| - protected EasyDialog(@NonNull final Context context, final boolean cancelable, @Nullable final OnCancelListener cancelListener) { |
| 74 | + public EasyDialog(@NonNull final Context context, final boolean cancelable, @Nullable final OnCancelListener cancelListener) { |
73 | 75 | super(context, cancelable, cancelListener);
|
74 | 76 | }
|
| 77 | + // </editor-fold> |
| 78 | + |
| 79 | + // <editor-fold desc="Internal methods"> |
| 80 | + |
| 81 | + /** |
| 82 | + * Returns the result from {@link SillyAndroid#equal(Object, Object)}. |
| 83 | + */ |
| 84 | + protected final boolean equal(@Nullable final Object first, @Nullable final Object second) { |
| 85 | + return SillyAndroid.equal(first, second); |
| 86 | + } |
75 | 87 |
|
76 | 88 | /**
|
77 | 89 | * Returns the result from {@link SillyAndroid#countIntentHandlers(Context, Intent)}.
|
78 | 90 | */
|
79 | 91 | @IntRange(from = 0)
|
80 |
| - public int countIntentHandlers(@Nullable final Intent intent) { |
| 92 | + protected final int countIntentHandlers(@Nullable final Intent intent) { |
81 | 93 | return SillyAndroid.countIntentHandlers(getContext(), intent);
|
82 | 94 | }
|
83 | 95 |
|
84 | 96 | /**
|
85 | 97 | * Returns the result from {@link SillyAndroid#canHandleIntent(Context, Intent)}.
|
86 | 98 | */
|
87 |
| - public boolean canHandleIntent(@Nullable final Intent intent) { |
| 99 | + protected final boolean canHandleIntent(@Nullable final Intent intent) { |
88 | 100 | return SillyAndroid.canHandleIntent(getContext(), intent);
|
89 | 101 | }
|
90 | 102 |
|
91 | 103 | /**
|
92 | 104 | * Returns the result from {@link SillyAndroid#getContentView(android.app.Activity)}.
|
93 | 105 | */
|
94 |
| - public <ViewType extends View> ViewType getContentView() { |
| 106 | + protected final <ViewType extends View> ViewType getContentView() { |
95 | 107 | return SillyAndroid.getContentView(this);
|
96 | 108 | }
|
97 | 109 |
|
98 | 110 | /**
|
99 | 111 | * Returns the result from {@link SillyAndroid#findViewById(android.support.v4.app.Fragment, int)}.
|
100 | 112 | */
|
101 |
| - public <ViewType extends View> ViewType findView(@IdRes final int viewId) { |
| 113 | + public final <ViewType extends View> ViewType findView(@IdRes final int viewId) { |
102 | 114 | return SillyAndroid.findViewById(this, viewId);
|
103 | 115 | }
|
104 | 116 |
|
105 | 117 | /**
|
106 | 118 | * Returns the result from {@link SillyAndroid#isEmpty(String)}.
|
107 | 119 | */
|
108 |
| - public boolean isEmpty(@Nullable final String text) { |
| 120 | + protected final boolean isEmpty(@Nullable final String text) { |
109 | 121 | return SillyAndroid.isEmpty(text);
|
110 | 122 | }
|
111 | 123 |
|
112 | 124 | /**
|
113 | 125 | * Returns the result from {@link SillyAndroid#dismiss(PopupMenu)}.
|
114 | 126 | */
|
115 |
| - public boolean dismiss(@Nullable final PopupMenu menu) { |
| 127 | + protected final boolean dismiss(@Nullable final PopupMenu menu) { |
116 | 128 | return SillyAndroid.dismiss(menu);
|
117 | 129 | }
|
118 | 130 |
|
119 | 131 | /**
|
120 | 132 | * Returns the result from {@link SillyAndroid#dismiss(android.app.Dialog)}.
|
121 | 133 | */
|
122 |
| - public boolean dismiss(@Nullable final EasyDialog dialog) { |
| 134 | + protected final boolean dismiss(@Nullable final Dialog dialog) { |
123 | 135 | return SillyAndroid.dismiss(dialog);
|
124 | 136 | }
|
125 | 137 |
|
126 | 138 | /**
|
127 | 139 | * Returns the result from {@link SillyAndroid#close(Closeable)}.
|
128 | 140 | */
|
129 |
| - public boolean close(@Nullable final Closeable closeable) { |
| 141 | + protected final boolean close(@Nullable final Closeable closeable) { |
130 | 142 | return SillyAndroid.close(closeable);
|
131 | 143 | }
|
132 | 144 |
|
133 | 145 | /**
|
134 | 146 | * Returns the result from {@link SillyAndroid#close(Cursor)}.
|
135 | 147 | */
|
136 | 148 | @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
|
137 |
| - public boolean close(@Nullable final Cursor cursor) { |
| 149 | + protected final boolean close(@Nullable final Cursor cursor) { |
138 | 150 | return SillyAndroid.close(cursor);
|
139 | 151 | }
|
140 | 152 |
|
141 | 153 | /**
|
142 | 154 | * Returns the result from {@link ContextCompat#getDrawable(Context, int)}.
|
143 | 155 | */
|
144 | 156 | @Nullable
|
145 |
| - public Drawable getDrawableCompat(@DrawableRes final int drawableId) { |
| 157 | + protected final Drawable getDrawableCompat(@DrawableRes final int drawableId) { |
146 | 158 | return ContextCompat.getDrawable(getContext(), drawableId);
|
147 | 159 | }
|
148 | 160 |
|
149 | 161 | /**
|
150 | 162 | * Invokes {@link ViewCompat#setBackground(View, Drawable)} with the same arguments.
|
151 | 163 | */
|
152 |
| - public void setBackgroundCompat(@NonNull final EasyView view, @Nullable final Drawable drawable) { |
| 164 | + protected final void setBackgroundCompat(@NonNull final View view, @Nullable final Drawable drawable) { |
153 | 165 | ViewCompat.setBackground(view, drawable);
|
154 | 166 | }
|
155 | 167 |
|
156 | 168 | /**
|
157 | 169 | * Invokes {@link SillyAndroid#setPadding(View, int, int, int, int)} with the same arguments.
|
158 | 170 | */
|
159 |
| - public void setPadding(@NonNull final EasyView view, @Px final int start, @Px final int top, @Px final int end, @Px final int bottom) { |
| 171 | + protected final void setPadding(@NonNull final View view, @Px final int start, @Px final int top, @Px final int end, @Px final int bottom) { |
160 | 172 | SillyAndroid.setPadding(view, start, top, end, bottom);
|
161 | 173 | }
|
162 | 174 |
|
163 | 175 | /**
|
164 | 176 | * Invokes {@link SillyAndroid#setPadding(View, int)} with the same arguments.
|
165 | 177 | */
|
166 |
| - public void setPadding(@NonNull final EasyView view, @Px final int padding) { |
| 178 | + protected final void setPadding(@NonNull final View view, @Px final int padding) { |
167 | 179 | SillyAndroid.setPadding(view, padding);
|
168 | 180 | }
|
169 | 181 |
|
170 | 182 | /**
|
171 | 183 | * Returns the result from {@link SillyAndroid#isNetworkConnected(Context)}.
|
172 | 184 | */
|
173 | 185 | @RequiresPermission(allOf = { Manifest.permission.ACCESS_WIFI_STATE, Manifest.permission.ACCESS_NETWORK_STATE })
|
174 |
| - public boolean isNetworkConnected() { |
| 186 | + protected final boolean isNetworkConnected() { |
175 | 187 | return SillyAndroid.isNetworkConnected(getContext());
|
176 | 188 | }
|
177 | 189 |
|
178 | 190 | /**
|
179 | 191 | * Returns the result from {@link SillyAndroid#isVoiceInputAvailable(Context)}.
|
180 | 192 | */
|
181 |
| - public boolean isVoiceInputAvailable() { |
| 193 | + protected final boolean isVoiceInputAvailable() { |
182 | 194 | return SillyAndroid.isVoiceInputAvailable(getContext());
|
183 | 195 | }
|
| 196 | + // </editor-fold> |
| 197 | + |
| 198 | + // <editor-fold desc="Toasts"> |
184 | 199 |
|
185 | 200 | /**
|
186 | 201 | * Invokes {@link SillyAndroid#toastShort(Context, int)}.
|
187 | 202 | */
|
188 |
| - public void toastShort(@StringRes final int stringId) { |
| 203 | + protected final void toastShort(@StringRes final int stringId) { |
189 | 204 | SillyAndroid.toastShort(getContext(), stringId);
|
190 | 205 | }
|
191 | 206 |
|
192 | 207 | /**
|
193 | 208 | * Invokes {@link SillyAndroid#toastShort(Context, String)}.
|
194 | 209 | */
|
195 |
| - public void toastShort(@NonNull final String string) { |
| 210 | + protected final void toastShort(@NonNull final String string) { |
196 | 211 | SillyAndroid.toastShort(getContext(), string);
|
197 | 212 | }
|
198 | 213 |
|
199 | 214 | /**
|
200 | 215 | * Invokes {@link SillyAndroid#toastLong(Context, int)}.
|
201 | 216 | */
|
202 |
| - public void toastLong(@StringRes final int stringId) { |
| 217 | + protected final void toastLong(@StringRes final int stringId) { |
203 | 218 | SillyAndroid.toastLong(getContext(), stringId);
|
204 | 219 | }
|
205 | 220 |
|
206 | 221 | /**
|
207 | 222 | * Invokes {@link SillyAndroid#toastLong(Context, String)}.
|
208 | 223 | */
|
209 |
| - public void toastLong(@NonNull final String string) { |
| 224 | + protected final void toastLong(@NonNull final String string) { |
210 | 225 | SillyAndroid.toastLong(getContext(), string);
|
211 | 226 | }
|
| 227 | + // </editor-fold> |
212 | 228 |
|
213 | 229 | }
|
0 commit comments