How to use com.android.calendar.DayView? - android

I need a calender control in my application to show some "appointments" in a day view. As far as I see it, there are two ways: Write my own control which would be not that funny and to use com.android.calendar.
Can anyone tell me how I can use com.android.calendar.DayView or whether at all it is possible. One important thing: I do not want to show the appointments of the user but rather my own dynamical added ones.
I am talking about this control:
Just for information: I am aware that there are some similar questions on SO. However, I'm interested in com.adnroid.calendar.* and not as a general question :-).

That class is not in the SDK. It is undocumented. It is unsupported.
However, it is open source. You are welcome to copy it into your own project (and refactor it into your own package), but you will be on your own to figure out how to make it work.
FWIW, there is a similarly undocumented/unsupported/open source widget in the Google I|O 2011 app.
It is possible that there are other open source implementations of this sort of widget that are documented and supported, though I can't think of any. I will probably take one of these and use it as the basis for a documented/supported widget someday, if nobody beats me to it.

I really wanted to be able to re-use DayView, so I created the yadview project (https://code.google.com/p/yadview/). yadview is a fork of the DayView schedule in the AOSP Calendar app, but has been reworked significantly to allow for integration into any application.
Sample screenshot of an Activity with this View:

Related

How to create an Auto Clicker app which can click on other apps?

I have seen so many apps that provide auto tapping feature. But they don't provide some specific customization so I decided to create a one. I have seen many tutorials that offers auto tapping, but they are supposed to be used in the same app. But I want to create an auto tapping app that can click on other app's View. I am an intermediate java developer but new to Android studio, so I don't know much about Android APIs. Is there any class or package which can provide this feature. For more clearance, I want to do auto tap, when the color at the specific location on screen, (213, 120) for instance, becomes green.
Thanks in advance!
I am not an expert on the subject, I have experience as a BackEnd developer, I am new to the Android world, just like you I am interested in building an app to automate some farming mechanics in Android games with specific behaviors, so I investigated on the subject and the solution you are looking for is the AccessibilityService API, from Android 8.0 (API level 26) it includes several functionalities to make touches without the need for Root, I leave you links with examples of some open source repos that can guide you.
https://developer.android.com/guide/topics/ui/accessibility/service#continued-gestures (Doc)
https://github.com/nestorm001/AutoClicker (Old and abandoned project, but has the functionality of touches)
https://github.com/pylapp/SmoothClicker (A more mature App but need root, it can be helpful to guide you in how to build the UI)
For the detection in the change of the pixel I still do not have a concrete answer, I keep looking, maybe obtaining a dump of the screen every X time and validate the pixels on that is the way but it is still uncertain if it is the way to go.
Something like How to record screen and take screenshots, using Android API?.
I know that you can get a bitmap dump of the screen if you have the activity, but it's not the case, however some class in the following package may be helpful https://developer.android.com/reference/kotlin/android/graphics/package-summary.
I'm currently working in my own implementation, when I have something to show I will gladly share it.

Create custom google now cards

Google provides a variety of 'cards' for Google Now (http://www.google.com/landing/now/). Is it possible to create your own cards? The system looks pretty modular, but I haven't found any documentation or instructions to do so. (I believe you need to supply the content of the card, and some way of signaling when it is supposed to be shown. There is probably just some interface that you have to implement.)
If there is no documented solution, a hackish/undocumented way would be ok, too. I'm mostly curious how it works.
Edit: Specifically, does somebody have knowledge about the internals of Google Now, e.g. by decompiling the .apk? What I've seen suggests it is pretty modular, and it should be fairly easy to drop another class into the .apk, or to maybe inject code using Cydia Substrate. I know that there is (as of Nov. 2013) no official way to add new cards.
There is currently no way to do that. Google makes its own cards and custom application cannot register any cards. But I hope it will be possible in future.
Actually Google announced last week that developers can now develop custom Google Now cards:
http://www.google.com/landing/now/integrations.html
However, a developer guide seems not available yet.
Edit:
On the end of the page they point out that:
We'll let you know when we are able to onboard more partners
There is a work-around that will soon allow you to place cards in Google Now's stream at a particular time or a particular location: Use Google Keep (https://drive.google.com/keep/)
You can create a new card at Google Keep with a time based or location based reminder, depending on which the relevant card will show up in Google Now.
Since Google Keep is now in Drive, the API is expected to be available soon (keep a lookout for it at http://discovery-check.appspot.com/ )
There is not way to do this by your own at the moment. If you really want to do it you can fill in this form: https://services.google.com/fb/forms/nowintegrations/. You can ask Google if they want to cooperate to create a Google Now card.
Note quite an answer, as it is still not possible to create Google Now cards, but you can now hook into the Google Now search function (basically Android's Siri) and provide custom search results. For example you can say "show me the lyrics to..." and it opens a lyrics app.
Here is a link to the project which is based on the Xposed framework.
Just guessing from my impression of the Google Search apk (which includes all the Google Now functionality and even the home screen on KitKat), it should be possible to use a similar technique to inject cards into the app - however since the app is huge and very complicated, it will be a lot of work. I'd keep my eyes open on the xda-developers forums, wouldn't be surprized if someone there solves this in the future.
It appears that there is developer documentation on how to push google now info via email, eg. flight details, restaurant reservations etc.
https://developers.google.com/schemas/now/cards
I have yet to dig into this, but may update this answer if I discover anything significant.

iOS equivalent of launching an Activity in Android

I just got done writing an Android Activity that allows other Activities to call it for some result (it's not intended to be a stand-alone Activity). I'm now working on the equivalent iOS application and can't find any resources for how I would enable similar functionality on iOS.
The situation: The tool I'm producing is intended to be used by other applications, rather than as a standalone application. The thing is, the GUI that needs to be presented to the user is rather involved so I'd like to be able to provide the developer with a "all-in-one" package that they can simply launch and get results from. Doing this in Android was very straight forward. I simply wrote an Activity and instructed the developer to launch this Activity for result. I've looked around and can't find a similar functionality to allow an iOS developer to do the same. What would be the best way to go about doing this?
I think part of the problem I'm having in finding resources is that I'm not entirely sure what what I'm making is called. A library? extension? plug-in? I would think a library doesn't have a GUI and it seems extensions and plug-ins are made for an extensible application (that is, one in which the user can install the extension/plug-in).
Your API could be à single call that would pop up a modal view. A target and selector can be specified to receive an answer. Supplying it to other developers means packing it into a "framework". I'm not sure if you can include resources.
There isn't really any equivalent. The closest you can come is having the second application call UIApplication's openURL with a custom scheme that is listened to by your app, and then when your app is done it would do the same with a custom scheme that is listened to by the calling app.
In practice, the iOS app would usually include the entire activity-equivalent as some sort of library, which at the high level would take the form of a UIViewController subclass that is presented modally and then calls a delegate method or completion selector of some sort on completion.
iPhone development is a different design than Android development, so you may need to rethink what it is you are trying to do.
Most likely you will want to look at just including the code in each program, initially, just so you can get it testable, but that may not be the best solution.
But, without knowing more details about what you are trying to do it is hard to give some suggestions as to better solutions.
For example, you may find LocalNotifications as one solution (http://useyourloaf.com/blog/2010/7/31/adding-local-notifications-with-ios-4.html), but again, it depends on what your needs are.
I found that using local notifications to call a REST service, then to process it and decide if I need to inform the user was helpful, as a replacement for how I used Intents in the Android application.

Android equivalent to Java's Swing JSpinner

I want to use a control similar to Swing JSpinner in an Android application. I know that Android has a widget called Spinner, but it's more like a combo box than a JSpinner. I've noticed that DatePicker and TimePicker widgets are using components that are just like JSpinner. The only problem is that I don't really want Date or Time. I just want to get some integer, say from 1 to 50, that user chooses. Is this possible? I've searched Android API reference in and out, but I couldn't find any clue on how to do this. Any help or hint would be much appreciated.
Thanks,
Tomislav
Well, the functionality for the TimePicker is provided by a hidden internal class named NumberPicker, which would probably be exactly what you wanted if only the folks at Google had made it available.
You might want to go to the android source code and lookup the source to android.widget.NumberPicker in the frameworks/base repository. (The repository treats it as if it were a publicly available class, though I see no sign of it in the released dev jars.)
I stole the spinner from Astrid, which stole it from Android's source.
Take a gander here:
http://github.com/ralphleon/TeaTimer/tree/master/src/goo/TeaTimer/widget/
Though my app is GPL, the number picker code is under the permissive Apache license!

Android Quick Actions UI Pattern

I'm interested in incorporating the Android UI pattern called "Quick Action". Basically, it's a context menu that doesn't cover up the data that is being acted on. I'd like to implement this but I cannot find some sample code or an API to help me out.
Note this UI pattern is discussed in the YouTube video, http://www.youtube.com/watch?v=M1ZBjlCRfz0#t=15m20s.
Does anyone have an implementation of this or know what Google's standard is for adding this to an application?
Till the official Twitter app is open sourced by Google, you may want to take a look at this implementation:
http://www.londatiga.net/it/how-to-create-quickaction-dialog-in-android/
Really easy to use and works great.
Interesting Question. Android uses this pattern in their Contacts-App. You can get the source using git:
git clone git://android.git.kernel.org/platform/packages/apps/Contacts.git
I did this and quickly grepped it, but I didn't get a conclusive result. I think that's done in "Contacts/src/com/android/contacts/ui/QuickContactWindow.java", but I am not completely sure.
I you google for QuickContact android, there are a lot of images that show exactly the kind of menu that you want, so it seems likely that it is indeed called QuickContact in that context.
Looking at the Documentation, I don't see any inherited classes that you could use to do this for something other than contacts.
So, a few starting points, but no solution from me ;-)
This open source project has the same look and feel for the quick actions popup as the twitter app:
http://github.com/ruqqq/WorldHeritageSite/tree/master/src/sg/ruqqq/WHSFinder
It helps to download the whole project because you need a number of drawables, images, and other resources from that project.
The main demo class is called WHSListActivity.java. The other classes you need is QuickActionWindow.java, and QuickActionItem.java.
After that, it's really easy and works great. I use it for my apps.

Categories

Resources