I'm trying to create a graceful, distraction-free text editor.
One of the features I really would like to implement is a pop-up with simple text formatting commands, such as bold, italic, underline, font color, and font face.
To give you an idea, here is a picture of the popup in iOS(Obviously, this is just the idea. I want to create a custom design for the popup):
I have a few questions:
1) Is there such thing as a text selection listener, or some equivalent?
2) Will I need to override the default android action for text selection?
3) How would I display/create this popup? (Vague question, I know...)
I am just starting out in Java and Android development, but I have already created a few apps and have gotten the hang of it.
The key term you're looking for here, to help you with your research, is ActionMode, provided that your target is honeycomb or newer.
The API docs (scroll down to "using the contextual action mode) do an ok job of explaining things, once you find what you're looking for, which is the biggest barrier to their use, but basically what you're going to need to do is this:
set your EditText to be selectable (android:textIsSelectable="true" or setTextIsSelectable(true);
Implement the ActionMode.Callback interface and provide your own menu items.
NOTE: as mentioned above, this only works for API level 11+. If you're targeting earlier platforms, getting the events for text selection is much more complicated.
Related
Is there a Material component that will easily let me set the left of a TextInputEditText to be a dropdown like this image below? If not, I can create something, but wanted to see if anyone knew more about Material components before I start doing too much custom work. Looks custom to me, though.
With material component, Google has removed spinner from its UI Elements.
Preferred way to do it is TextInputLayout along with AutoCompleteTextView just like Ashu has mentioned in the comment section.
Here is a more thorough article, which can help you in implementing AutoCompleteTextView.
https://blog.usejournal.com/there-is-no-material-design-spinner-for-android-3261b7c77da8
So far, both answers say to use AutoCompleteTextView. However, that doesn't answer my question. As you can see in the image I posted with the question, only the left side is a drop down. The right side is just a normal text input that isn't affected by the drop down.
However, I think it is safe to assume there isn't a component that will do this for me easily and that it would indeed be custom work to make these two components appear to be one single component.
I have successfully made a very basic custom keyboard for Android based off of this tutorial. The problem is, this keyboard looks very odd and outdated for Android lollipop:
Image of the current keyboard:
I have been looking at other keyboards such as the default OS keyboard and this one:
And they look much better for Android.
How can I modify the color scheme and style of my keyboard to look better?
It is also worth noting I am making a keyboard that is very similar to the second example (it will just have a few extra buttons).
If you want a lot of control and be able to do things dynamically, I suggest you ditch the xml layout and KeyboardView class and make your own custom keyboard view
Is there a library for creating Floating Action Buttons with labels (similar to the Evernote app)?
Evernote Screenshot
The popular libraries seem to be
https://github.com/futuresimple/android-floating-action-button (closest to what I want... ability to expand hide "sub" actions)
https://github.com/makovkastar/FloatingActionButton (Primary function is to hide/show with a scrollview, recyclerview, or listview)
https://github.com/oguzbilgener/CircularFloatingActionMenu (library which has been around pre-lollipop)
Neither of these, to my knowledge, have this capability. Before re-inventing the wheel, has somebody already done this?
This feature request ended up being implemented in https://github.com/futuresimple/android-floating-action-button. This includes labels on both the left and right sides.
If you're interested, see the discussion here: https://github.com/futuresimple/android-floating-action-button/issues/22#issuecomment-66155108
Disclaimer: I haven't used this (yet).
I'd recommend this library over others that I've seen.
Nowadays there are available techniques of manipulating behaviour of the view that enable you to program FloatinActionButton as you want and to have joy that you have made it by yourself!
Fade in/out FloatingActionButton while scrolling RecyclerView . DETAILS
Slide down/up , beside it blog says how to:
Expand floatingActionButton and show subFloatingButtons. DETAILS HERE
There is to much details, "how to do". Therefore I've attached just links to blogs. Anyway I encourage you guys to take a look at those blogs. You will have total control over your application. Currenty I use all solutions from both blog's. Enjoy!
Especially the last library you mentioned looks quite sophisticated. To my knowledge, you can set any kind of View you want to be shown as a Button.
This View could simply be a custom-view of yours that shows an image as well as a label.
In case anyone is still looking for this functionality: I made an Android library that has this ability and much more, called ExpandableFab (https://github.com/nambicompany/expandable-fab).
The Material Design spec refers to this functionality as 'Speed Dial' and ExpandableFab implements it along with many additional features.
Nearly everything is customizable (colors, text, size, placement, margins, animations and more) and optional (don't need an Overlay, or FabOptions, or Labels, or icons, etc). Every property can be accessed or set through XML layouts or programmatically - whatever you prefer.
Written 100% in Kotlin but comes with full JavaDoc and KDoc (published API is well documented). Also comes with an example app so you can see different use cases with 0 coding.
Github: https://github.com/nambicompany/expandable-fab
Library website (w/ links to full documentation): https://nambicompany.github.io/expandable-fab/
is there any way to add a custom contextual action bar when text is selected like this:
I have had a look around like here: http://developer.android.com/guide/topics/ui/menus.html#context-menu
But it really doesn't have much information an the EditText selection.
I am using a physical Android 4.0.3 device so all the API is available to me.
Anyone have any ideas?
Edit for anyone who wants to know how to do this I documented the code here
http://www.muktware.com/4022/text-selection-cab
Try setting a custom ActionMode.Callback on your EditText. You've got control over the default actions, as well as the ability to add new ones.
I have made my own version of this editing the code a bit to meet my needs, I do not believe that there is any actual way of doing this.
I've implemented a simple search dialog that performs a custom search of the data within my app (Via a custom provider) as according to the guidelines here: http://developer.android.com/guide/topics/search/search-dialog.html
The problem is that the search bar's colors and size (exceeds the height of the action bar, etc) do not work within the design of my app. I know how to create a theme in my styles.xml file, but I do not know how to target the Android search dialog and suggestions listView. Does anyone know how I can do this?
After 13 hours spent on the question, it turns out it's not possible for some reason. Apps that do have visually customized search dialogs- even if it's just the colours - must implement them manually, and probably don't use the standard search interfaces.
as per google docs SearchDialog is
"The search dialog is a UI component that's controlled by the Android system."
So to have a control over search visuals use as for today :
ActionBarSherlock dev branch
https://github.com/JakeWharton/ActionBarSherlock/tree/dev
and this :
http://developer.android.com/guide/topics/search/search-dialog.html#ConfiguringWidget
to implement fully controlable search