Android Open Source - RavenChat Intent Creator






From Project

Back to project page RavenChat.

License

The source code is released under:

Copyright (c) 2014 Sumit Gouthaman. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Softwar...

If you think the Android project RavenChat listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.sumitgouthaman.raven.IntentHelpers;
/*  w w w .ja v  a2  s .  c o m*/
import android.content.Context;
import android.content.Intent;

import com.sumitgouthaman.raven.ChatThreadActivity;

/**
 * Created by sumit on 27/5/14.
 */

/**
 * This class helps to correctly create a intent that properly passes all the required extra
 * parameters
 */
public class IntentCreator {
    /**
     * Method helps create a Intent for a chat thread when the resulting chat window has to be
     * auto populated by a message in the message field.
     * It is intetnded to be used in situations when the activity is invoked to enable sharing from
     * other apps
     * passed
     *
     * @param context             - The current context
     * @param secretUsername      - The secret username of the contact whose chat thread will be opened
     * @param prepopulatedMessage - The message that will be populated in the message box of the
     *                            opened activity
     * @return - The constructed intent
     */
    public static Intent getChatThreadIntent(Context context, String secretUsername, String prepopulatedMessage) {
        Intent chatThreadIntent = new Intent(context, ChatThreadActivity.class);
        chatThreadIntent.putExtra("secretUsername", secretUsername);
        /**
         * If the prepopulatedMessage string is null, it indicates that there is no pre-populated
         * message.
         */
        if (prepopulatedMessage != null) {
            chatThreadIntent.putExtra("prepopulatedMessage", prepopulatedMessage);
        }
        return chatThreadIntent;
    }

    /**
     * Method helps create a Intent for a chat thread with no pre-populated message
     *
     * @param context        - The current context
     * @param secretUsername - The secret username of the contact whose chat thread will be opened
     * @return - The constructed intent
     */
    public static Intent getChatThreadIntent(Context context, String secretUsername) {
        /**
         * The version of the getChatThreadIntent method that takes a pre-populated message option
         * interprets a null value in the prepopulatedMessage field as an absence of any
         * pre-populated messages.
         * Hence this message simply has to call that version of the method with a null value for
         * prepopulatedMessage.
         */
        return getChatThreadIntent(context, secretUsername, null);
    }
}




Java Source Code List

com.sumitgouthaman.raven.AddContactActivity.java
com.sumitgouthaman.raven.ChatThreadActivity.java
com.sumitgouthaman.raven.DebugActivity.java
com.sumitgouthaman.raven.DispatchGCMMessage.java
com.sumitgouthaman.raven.GCMBroadcastReceiver.java
com.sumitgouthaman.raven.MessageListActivity.java
com.sumitgouthaman.raven.NFCPairing.java
com.sumitgouthaman.raven.SelfDestructingMessageCompose.java
com.sumitgouthaman.raven.SelfDestructingMessageDisplay.java
com.sumitgouthaman.raven.SettingsActivity.java
com.sumitgouthaman.raven.ShareViaRaven.java
com.sumitgouthaman.raven.IntentHelpers.IntentCreator.java
com.sumitgouthaman.raven.listadapters.ChatThreadAdapter.java
com.sumitgouthaman.raven.listadapters.MessageListAdapter.java
com.sumitgouthaman.raven.models.Contact.java
com.sumitgouthaman.raven.models.MessageListItem.java
com.sumitgouthaman.raven.models.MessageTypes.java
com.sumitgouthaman.raven.models.Message.java
com.sumitgouthaman.raven.persistence.Persistence.java
com.sumitgouthaman.raven.services.DispatchMessageIntentService.java
com.sumitgouthaman.raven.services.DispatchNameUpdateMessageIntentService.java
com.sumitgouthaman.raven.services.DispatchRegUpdateMessageIntentService.java
com.sumitgouthaman.raven.services.DispatchRejectionMessageIntentService.java
com.sumitgouthaman.raven.services.TTSService.java
com.sumitgouthaman.raven.utils.CheckPlayServices.java
com.sumitgouthaman.raven.utils.MessageDispatcher.java
com.sumitgouthaman.raven.utils.RandomStrings.java
com.sumitgouthaman.raven.utils.SimpleNotificationMaker.java
com.sumitgouthaman.raven.utils.SimpleSoundNotificationMaker.java
com.sumitgouthaman.raven.utils.StringToQRBitmap.java
com.sumitgouthaman.raven.utils.TimestampFormatter.java
com.sumitgouthaman.raven.utils.crypto.Base64Utils.java
com.sumitgouthaman.raven.utils.crypto.EncryptionUtils.java
com.sumitgouthaman.raven.utils.crypto.KeyGeneratorUtils.java