This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class LinearPattern implements FabulousPattern { | |
| private static final int MAIN_FAB_ANIMATION_DURATION = 200; | |
| @NotNull | |
| @Override | |
| public AnimatorSet getClosingAnimation(@NotNull View element, float destX, float destY) { | |
| AnimatorSet anim = new AnimatorSet(); | |
| ObjectAnimator fabX = ObjectAnimator.ofFloat(element, View.X, destX); | |
| fabX.setDuration(MAIN_FAB_ANIMATION_DURATION); | |
| ObjectAnimator fabY = ObjectAnimator.ofFloat(element, View.Y, destY); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Override | |
| public boolean onOptionsItemSelected(MenuItem item) { | |
| Snackbar.make(binding.getRoot(), item.getTitle(), Snackbar.LENGTH_SHORT).show(); | |
| return super.onOptionsItemSelected(item); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| new Fabulous.Builder(this) | |
| .setFab(binding.exampleOne) | |
| .setFabOverlay(binding.overlay) | |
| .setMenuId(R.menu.menu_sample) | |
| .setMenuPattern(new LinearPattern()) | |
| .build(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Create the routeIntentToScreen method. This method find the Fragment associated with the URL in the intent, extract the variables and set it as {@link com.fueled.flowr.Flowr#currentFragment} | |
| * | |
| * @return The routeIntentToScreen JavaPoet object. | |
| */ | |
| private static MethodSpec routeIntentToScreen() { | |
| return MethodSpec.methodBuilder("routeIntentToScreen") | |
| .addModifiers(Modifier.PUBLIC) | |
| .returns(FlowrDeepLinkInfoClassName) | |
| .addParameter(ClassName.get("android.content", "Intent"), "intent") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void generateDeepLinkHandler(String handlerPackage, MethodSpec.Builder constructorBuilder) { | |
| TypeSpec classObject = getClassObject() | |
| .addField(linkFragmentMap()) | |
| .addMethod(constructorBuilder.build()) | |
| .addMethod(bundleUriInfo()) | |
| .addMethod(getRegexPattern()) | |
| .addMethod(getNamedGroupCandidates()) | |
| .addMethod(addFragment()) | |
| .addMethod(routeIntentToScreen()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @android.databinding.BindingAdapter("showKeyboard") | |
| public static void showKeyBoard(final EditText editText, final boolean showFlag) { | |
| editText.post(new Runnable() { | |
| @Override | |
| public void run() { | |
| if (showFlag) { | |
| KeyboardUtils.showKeyboard(editText); | |
| } else { | |
| editText.clearFocus(); | |
| + KeyboardUtils.hideKeyboard(editText.getContext(), editText); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Underline a portion of the text. | |
| * | |
| * @param view The TextView containing the text to underline. | |
| * @param spanSize an array that contain the start index and the end index. | |
| */ | |
| @android.databinding.BindingAdapter("underline") | |
| public static void underlineText(TextView view, @NonNull int[] spanSize) { | |
| if (view != null && spanSize.length == 2) { | |
| SpannableString content = new SpannableString(view.getText()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Enable a TextView to handle HTML links. | |
| * @param view The TextView where the link will be located. | |
| * @param linkRes The resource id that contains the HTML link. | |
| */ | |
| @SuppressWarnings("deprecation") | |
| @android.databinding.BindingAdapter("link") | |
| public static void addLinkToTextView(TextView view, @StringRes int linkRes) { | |
| if (view != null) { | |
| Resources resources = view.getContext().getResources(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <android.support.design.widget.TextInputEditText | |
| android:layout_width="match_parent" | |
| android:layout_height="wrap_content" | |
| android:imeOptions="actionSend" | |
| app:onKeyDone="@{()-> model.doLogin()}" | |
| /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @BindingAdapter("onKeyDone") | |
| public static void onKeyDone(EditText editText, final OnKeyPressedListener action) { | |
| if (editText != null) { | |
| editText.setOnKeyListener(new View.OnKeyListener() { | |
| @Override | |
| public boolean onKey(View v, int keyCode, KeyEvent event) { | |
| boolean handled = false; | |
| if (keyCode == KeyEvent.KEYCODE_ENTER | |
| && event.getAction() == KeyEvent.ACTION_DOWN) { | |
| action.onKeyPressed(); |