As stated in the subject, I'd like to implement in my project that little auto-dismissing text popup that sometimes appears when applying an action in certain apps.
It's a simple floating text with a dark rectangle as background positioned in the bottom part of the app that remains between activities/application switches and goes away automatically after X seconds.
Does anybody know how it's called?
It was called Toast.
You can easily custom a toast to have a interface like whatever you want, look Titanium Backup for example.
Default usage like below:
Code:
Toast.makeText(mContext, "Hello", Toast.LENGTH_LONG).show();
As a side note, the App-Msg(Crouton) library provides a good alternative to toasts : in that it is context-centric, the message will only be displayed on the activity/fragment it was generated from, whereas if the user quits your app while a toast is displayed, for example, the toast will be displayed on his launcher or on he app he switched to, which could be confusing.
Its usage is also very simple :
Code:
AppMsg.makeText(/*Activity*/, /*CharSequence*/, /*AppMsg.Style*/).show();
Maybe this library can be helpful on my app. I have a custom toast, which still displayed after I choose to leave the activity via a button. So with this library the toast dissapear when the activity goes to background? And also can customize the look of toast?
dancer_69 said:
Maybe this library can be helpful on my app. I have a custom toast, which still displayed after I choose to leave the activity via a button. So with this library the toast dissapear when the activity goes to background? And also can customize the look of toast?
Click to expand...
Click to collapse
Yeah exactly.
And yes, you can modify the appearance of the toast to a certain extent (background color, gravity and display length afaik) using the static methods already setup in the library, but nothing prevents you from forking the library and modifying it to suit your needs.
You can also choose to have a toast which will only be dismissed when the user clicks it.
There are 3 types of preset styles for the croutons (from left to right in the image below) :
AppMsg.STYLE_ALERT (red) AppMsg.STYLE_CONFIRM (yellow) AppMsg.STYLE_INFO (green)
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
But you can create your own using something like this :
Changing length & color :
Code:
AppMsg.Style style = new AppMsg.Style(AppMsg.LENGTH_SHORT, R.color.holo_blue); [COLOR="SeaGreen"]// the default length is [I]AppMsg.LENGTH_LONG[/COLOR][/I]
colors.xml :
Code:
<resources>
<color name="holo_blue">#33B5E5</color>
</resources>
Changing gravity :
Code:
appMsg.setLayoutGravity(Gravity.BOTTOM); [COLOR="SeaGreen"] // the crouton is displayed at the top by default[/COLOR]
Result in the thumbnail
Thanks to Evgeny Shishkin for his work on this library by the way.
Related
I was messing with my JAM the other day, and I tried to find a hidden screen in the today menu, just like the one you get when you press the action button in the middle of the directional pad + touch the clock icon on the today screen in the top right corner....
I know this is the RUN command just like the one in other windows OS...
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
so I tried pressing the action button for a second + pressing something else..
and when I tried the space between the start icon and Sync( or G or E.. etc) icon... I get a message as in the screenshot...
does anybody know what is this? or what is it for??
BTW.. it appears that it doesn't mater whether I press Yes or NO... nothing seems to happen, and no files or what ever is stored in the root or in My Documents..
Excellent find, very useful for developers!
V
wow, in substance u can retrieve infos on the current window in the screen like size name etc (but u can do it only if there is enough space between the title bar and the notification icons) even if I'm not a programmer, I guess it's very useful for others.. cool find :wink:
By MocciJ
Nice of MS to leave a built in functionality of the Spy++ utility.
Regarding the yes / no it doesn't create a file. If the window is a child (any window but the today screen) it shows the info on its parent.
For those who are not developers little explanation:
hwnd - window handle that the OS uses to identify and control windows
style / ex - windows style (border / ok button etc.) and extended style, determines how window looks and behaves.
Class - type of window (like button)
Window - total window size.
client - "client area" size. Internal par of the window not counting border scroll bars, menus etc.
Owner - parent window (the window that contains this one).
thank you levenum for your helpful explanation..
tested working in Wizard not only in Today screen but also while playing games
I do not want to be the one to spoil the moment but you can get that same info (and more) just by using a TaskManager with Windows Management feature :roll:
Hello,
Is there a parameter to pass ":MSCONTACTS" to go directly to an individual contact? I'm interested in adding start menu shortcuts for some of my favorite contacts. Thanks in advance...
As far as I know there's no direct way to launch a contact. However I'm currently working on a new version of Taskbar launcher which allows to launch contacts directly. I also can easily add a command line parameter so you can launch your contacts through a link....
When you use WM 6.5's "search" program, you can parse through and launch contacts individually, so I'm sure there's a way to do it. I just don't know how it does what it does....
You can connect to POutlook, parse through contacts and call the Show() function and you see the original contact dialog. At least that's how I do it in my app and let me guess: search function is doing just the same. I don't think you can do this through a simple :MSCONTACTS command line parameter....
this might help
http://forum.xda-developers.com/showpost.php?p=5492828&postcount=6
Create a direct link for a certain telephone nr/sms/mms/email/more..
In a way it's easy. Start reading a thread I created specific for it
http://forum.xda-developers.com/showthread.php?t=623195
In short, start a text editor (no unicode) like notepad and type ;
39#"\Windows\cprog.exe"-url tel:0123456789
where 0123456789 = any telephone number.
Make sure you press the ENTER key after your phone nr. and before saving the file!
Give it a name. Rename the file from YourContactName.txt to YourContactName.LNK (capitals are not nessecary, it's just for clarity).Another example;
Direct SMS (I called it SMS2.lnk);
51#"\Windows\tmail.exe" -service "SMS" -to "" -body ""
I've been amazed too...! Once. Now I have MortScripts with icons
Senax
http://www.vijay555.com/?Releases:VJPhoneTools
I wonder, if this could work with 6.5.x..
@Senax
With your approach you can directly call a hard coded number or send message, right!? With the method I'm using however you can directly open the contact page for a particular person, see the contact picture and choose whether you want to make a call, write message or email etc.
I mean this one:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
go2contact is what you want. It's a really cool, tiny, super fast cmd app.
I added a dynamic contact shortcuts page to my HS++ theme (I can manage them on-the-fly in the Today screen) by means of Mortscripts that use go2contact and ContactRetriever (this last conponent is C# which makes this process slower... but it seems like Cyclone is learning C++ so there may be a faster version ).
Hello Guys,
How can i add an ongoing notification with 2 or 3 buttons... play stop next !?
Something like this
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
...When i tap a button i want to do an url post.
android 4+
Thanks
Its actually very easy to just add an expandable button to the bottom of your notification (android 4.1+ only I believe):
Code:
Intent mIntent = new Intent();
mIntent.setClass(context, MyClass.class);
PendingIntent mPendingIntent = PendingIntent.getService(context, 0, mIntent, PendingIntent.FLAG_UPDATE_CURRENT);
mNotificationBuilder.addAction(R.drawable.icon, "Test", mPendingIntent);
This call will simply add a button at the bottom of the layout with a little icon called "icon" from your drawables, the text "Test" next to it, and when clicked on will take you to the class that you set as the pending intent.
you can add up to 3 of these (i believe, someone correct me if i'm wrong) per notification.
To get layouts that have buttons on the side (or anywhere other then just under the actual notification) is little trickier though. you'll have to create a layout and then use remote views to get the job done and I dont have an example for that! check out here at the bottom of the page though and it talks about using remote views a little bit. Just be careful with the layout that it will work for different screen sizes and devices!
as for an ongoing notification, here is what you want to call:
Code:
mNotificationBuilder.setOngoing(true)
its also a good idea to set priority for ongoing notifications in my opinion so that they appear where you want them to in the drawer.
Code:
mNotificationBuilder.setPriority(Notification.PRIORITY_MIN); // there are lots of options other then PRIORITY_MIN as well to check out
Hope that helps get you started!
@klinkdawg what you are describing are the action buttons which appear below the notification. In the Google Music app the play/stop buttons are embedded within a custom notification design. You can set a RemoveView with your layout with SetContent function:
http://developer.android.com/refere...er.html#setContent(android.widget.RemoteViews)
However all this good stuff is only available in API level 11+, and the notification with bigger content in API level 16+.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
GitHub- Source
Hey Guys i was fiddling around with the PlayView developed by GadgetCheck and thought it would be nice to recreate the whole Google Market Layout so that's what i did . Soon i realised the easiest way to implement Card like layout of Google Play was using a 9 patch drawable. During the process i also observed that the market listview had different no of cards for various screen orientations and resolutions like an auto adjust gridview . So it seemed that Every Single Listitem was holding a variable no of cards according to the dimensions of the screen that's when the Bucket-ListAdapter came into play . This is an adapter contributed by rzsombor at GitHub similar to what you see in the Google Play application. It features a grid-like layout of list elements, with the advantage that you can still use list headers and footers - something that's not possible with the standard GridView.The market like PagerSlidingTabStrip have already been implemented by astuetz . So In an hour or so i was ready with my implementation of the Android Market .
Listview with Simple ListAdapter
Listview with Bucket-ListAdapter
Listview with Bucket-ListAdapter Emulating GridView
GitHub Projects Used
Bucket-ListAdapter
Pager-SlidngTabStip
GitHub- Source-PlayCardsGrid
Note :
The bucket-List Adapter is still a work in progress and there are optimization issues .The adapter does not use recycling of views. Neither does it use the viewHolder pattern. So, it is very likely that the app will go out of memory if the number of items in list goes high. Also, the rendering of the items is very slow and the scrolling is not much smooth. We need to work on it to optimize it. Any Developers who wish to Contribute can fork the project and Share their implementation of the Bucket List Adapter in this thread.
Thanks . Happy Coding !
how to implement context menu on the items?
cHu-X said:
how to implement context menu on the items?
Click to expand...
Click to collapse
Its super simple to implement context menu on items. Register a onClickListener on the Overflow ImageView and start a PopupMenu when the overflow icon is clicked. That's it..hope it helped. Also you can now check the code on GitHub. I have added a GitHuB repo for PlayCards GridView
Here you go. :angel:
GitHub - Source
I want to develop an app that can be trained to recognise certain characters. It's some sort of a word recognition app but for single characters. The problem with this is that i cannot find an appropriate input method even tough I've been struggling for two days to make it work using some sort of a GridLayout wich contains buttons. The problem with this method seems to be that i can't resize the buttons or remove the space between them. LinearLayout doesn't seem to be a good option either, since I can't swipe over the buttons and mark the letter.
THE ACTUAL PROBLEM:
I want to use an input similar to the picture i attached. That would be the letter A.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
.
The user will swipe over the matrix and leave a trail colored in blue. Then the matrix should be translated into the phone's memory to a binary matrix with 0 and 1 values.
RESTRICTIONS:
I want to tackle this problem programmatically.
The matrix will be 64x64
I use Android Studio.
---XML would be the easiest way to go, but a 64x64 matrix is pretty hard to create this way.
---API level does not matter at all. I just want this app to run on CM12 phone.
**After creating this app, I'll use a jpg picture of a character for input and refine the processing algorithms. I just need the algorithm to work for this 64x64 binary matrix first**
THE ACTUAL QUESTION:
How do I create the input matrix so it would be swipe-friendly and not bad looking ?
I think if you would like to use the button method you described above, you can call setOnTouchListener() on the buttons. The onTouch method is called when the user touches or swipes over the button so you could put your coloring code in there. But i dont know if a matrix of 64x64 buttons looks nice, that is the other problem
But basically you can as well use other views instead of the buttons because every view has the option to call an onTouchListener
--------------------
Phone: Nexus 4
OS: rooted Lollipop LRX21T
Bootloader: unlocked
Recovery: TWRP 2.8.2.0