androidannotations

AndroidAnnotations is an Open Source framework that speeds up Android development. It takes care of the plumbing, and lets you concentrate on what’s really important. By simplifying your code, it facilitates its maintenance.

 

Link:https://github.com/excilys/androidannotations

Dagger

Dagger 2 is a compile-time evolution approach to dependency injection. Taking the approach started in Dagger 1.x to its ultimate conclusion, Dagger 2.0 eliminates all reflection, and improves code clarity by removing the traditional ObjectGraph/Injector in favor of user-specified @Component interfaces.

This github project represents the Dagger 2 development stream. The earlier project page (Square, Inc’s repository) represents the earlier 1.0 development stream.
Both versions have benefitted from strong involvement from Square, Google, and other contributors.

 

 

Link: https://github.com/google/dagger

Roboguice

RoboGuice 3 smoothes out some of the wrinkles in your Android development experience and makes things simple and fun. Do you always forget to check for null when you getIntent().getExtras()? RoboGuice 3 will help you. Think casting findViewById() to a TextView shouldn’t be necessary? RoboGuice 3 is on it.

RoboGuice 3 takes the guesswork out of development. Inject your View, Resource, System Service, or any other object, and let RoboGuice 3 take care of the details.

RoboGuice 3 slims down your application code. Less code means fewer opportunities for bugs. It also makes your code easier to follow — no longer is your code littered with the mechanics of the Android platform, but now it can focus on the actual logic unique to your application.

There’s no “magic”. Everything you need is configured explicitly for you by RoboGuice 3 or can be overridden by you.

RoboGuice 3 applications have been Featured on the Android Market for years. It leverages the award-winning and production-ready Google Guice library to bring you simple dependency injection lightweight enough to use in a mobile application.

 

Link:https://github.com/roboguice/roboguice

 

 

 

Butter Knife

Field and method binding for Android views which uses annotation processing to generate boilerplate code for you.

  • Eliminate findViewById calls by using @Bind on fields.
  • Group multiple views in a list or array. Operate on all of them at once with actions, setters, or properties.
  • Eliminate anonymous inner-classes for listeners by annotating methods with @OnClick and others.
  • Eliminate resource lookups by using resource annotations on fields.

For documentation and additional information see the website.

Link:http://jakewharton.github.io/butterknife/

Universal Image Loader

ic_launcher

Universal Image Loader

 

Android library #1 on GitHub. UIL aims to provide a powerful, flexible and highly customizable instrument for image loading, caching and displaying. It provides a lot of configuration options and good control over the image loading and caching process.

 

Link: https://github.com/nostra13/Android-Universal-Image-Loader

Add custum tags in Message Using Smack 4.1.+

hi,

In this post we are going to discuss about  how to add custom tags in message using smack

if we send a message using default method it only send the recipient,sender info along with the message only

To view the Logs in detail add the following line for debugging.

SmackConfiguration.DEBUG=true;

so if we send a message the following log you can see

<r xmlns='urn:xmpp:sm:3'/>
<a xmlns='urn:xmpp:sm:3' h='5'/>
<message from='xxxx@localhost/Smack' to='xxxxx@localhost' 
xml:lang='en' id='ywF9d-33' type='chat'>
<body>hiiii</body>
<thread>e199d18d-bPed-400d-aa97-98888888767517</thread>
</message><r xmlns='urn:xmpp:sm:3'/>

So what if you need to add the Timestamp with your message?

we use DefaultExtensionElement 

Default implementation of the ExtensionElement interface. 
Unless a ExtensionElementProvider is registered with ProviderManager, 
instances of this class will be returned when getting stanza(/packet) 
extensions.

This class provides a very simple representation of an XML sub-document. Each element is a key in a Map with its CDATA being the value.

SENDING CUSTOM ATTRIBUTE

Let get started to add custom Tag

DefaultExtensionElement extTime = new DefaultExtensionElement(
        "time", "urn:xmpp:time");

so we are creating a tag time with xml attribute urn:xmpp:time

Ok now let set value to tag  time

String messageTimeStamp = String.valueOf(System.currentTimeMillis());
extTime.setValue("time", messageTimeStamp);

setting the extension to the message body

Message msg = new Message();
msg.addExtension(extTime);

The complete method is as below for sending custom message

//To sent message
public void sendLocaTimeMessage() throws SmackException.NotConnectedException {

Message msg = new Message();
msg.setBody(YOUR MESSAGE);

//Getting current timestamp in string format
String messageTimeStamp = String.valueOf(System.currentTimeMillis());

//Creating default packet extension with name as ‘timestamp’ and urn as ‘urn:xmpp:timestamp’

DefaultExtensionElement extTime = new DefaultExtensionElement(
“time”, “urn:xmpp:time”);

//Setting value in extension
extTime.setValue(“time”, messageTimeStamp);

//Add extension to message tag
msg.addExtension(extTime);
Chat newChat = chatManager.createChat(RECIPIENT);

//Send message
newChat.sendMessage(msg);

}

Continue reading “Add custum tags in Message Using Smack 4.1.+”

DeliveryReceiptManager Smack 4.1.+

Hi, in this topic we are going to discuss about delivery manager,

So what is a delivery manager?

DeliveryReceiptManager is user to get the delivery result of messages
that we send to the recipient is delivered or not.
DeliveryReceiptManager is Manager for XEP-0184: Message Delivery Receipts.
This class implements the manager for DeliveryReceipt support, 
enabling and disabling of automatic DeliveryReceipt transmission.(more) 

Let go to the coding part first we need to add the extension of
DeliveryReceipt using ProviderManager (Manages providers for parsing custom XML sub-documents of XMPP packets)

ProviderManager.addExtensionProvider(DeliveryReceipt.ELEMENT, DeliveryReceipt.NAMESPACE, new DeliveryReceipt.Provider());
ProviderManager.addExtensionProvider(DeliveryReceiptRequest.ELEMENT, new DeliveryReceiptRequest().getNamespace(), new DeliveryReceiptRequest.Provider());

 

after that register a delivery receiver

 DeliveryReceiptManager.getInstanceFor(connection).addReceiptReceivedListener(new ReceiptReceivedListener() {
                @Override
                public void onReceiptReceived(String fromJid, String toJid, String receiptId, Stanza receipt) {
                    Log.d(TAG, fromJid);
                    Log.d(TAG, toJid);
                    Log.d(TAG, "PACKED GOT--"+receiptId); 
                }
            });

Continue reading “DeliveryReceiptManager Smack 4.1.+”