Example usage for android.app Activity getFragmentManager

List of usage examples for android.app Activity getFragmentManager

Introduction

In this page you can find the example usage for android.app Activity getFragmentManager.

Prototype

@Deprecated
public FragmentManager getFragmentManager() 

Source Link

Document

Return the FragmentManager for interacting with fragments associated with this activity.

Usage

From source file:com.cyanogenmod.messaging.quickmessage.QuickMessagePopup.java

/**
 * display the sim select dialog for multi sim phones
 *//*www. j a v a  2  s.c o  m*/
private void showSimSelector(Activity activity, final ComposeMessageView.OnSimSelectedCallback cb) {
    final TelecomManager telecomMgr = (TelecomManager) activity.getSystemService(Context.TELECOM_SERVICE);
    final List<PhoneAccountHandle> handles = telecomMgr.getCallCapablePhoneAccounts();
    final List<PhoneAccountHandle> filteredHandles = new ArrayList<>();

    //trim out SIP accounts
    for (PhoneAccountHandle handle : handles) {
        PhoneAccount phoneAccount = PhoneUtils.getAccountOrNull(activity, handle);
        if (phoneAccount != null) {
            Uri address = phoneAccount.getAddress();
            if (address != null && !TextUtils.equals(address.getScheme(), PhoneAccount.SCHEME_SIP)) {
                filteredHandles.add(handle);
            }
        }
    }

    final SelectPhoneAccountDialogFragment.SelectPhoneAccountListener listener = new SelectPhoneAccountDialogFragment.SelectPhoneAccountListener() {
        @Override
        public void onPhoneAccountSelected(PhoneAccountHandle selectedAccountHandle, boolean setDefault) {
            // we need the subId and we only have a PhoneAccountHandle
            TelephonyManager telephonyManager = (TelephonyManager) mContext
                    .getSystemService(Context.TELEPHONY_SERVICE);
            Iterator<PhoneAccountHandle> phoneAccounts = telecomMgr.getCallCapablePhoneAccounts()
                    .listIterator();
            int subId = 0; // defaulting to 0, just in case
            while (phoneAccounts.hasNext()) {
                PhoneAccountHandle p = phoneAccounts.next();
                if (p.getId().equals(selectedAccountHandle.getId())) {
                    PhoneAccount phoneAccount = telecomMgr.getPhoneAccount(p);
                    subId = telephonyManager.getSubIdForPhoneAccount(phoneAccount);
                }
            }
            cb.onSimSelected(subId);
        }

        @Override
        public void onDialogDismissed() {
        }
    };

    DialogFragment dialogFragment = SelectPhoneAccountDialogFragment.newInstance(
            R.string.select_phone_account_title, false /* canSetDefault */, filteredHandles, listener);
    dialogFragment.show(activity.getFragmentManager(), "SELECT_PHONE_ACCOUNT_DIALOG_FRAGMENT");
}

From source file:com.android.mms.ui.MessageUtils.java

public static void showErrorDialog(Activity activity, int titleId, int messageId, int mediaTypeIdForTitle,
        int mediaTypeIdForMsg) {
    /** M:/*  www .ja va  2  s .  c o  m*/
    the original code is replaced by the following code.
    the original code has a bug, JE may happen.
    the case is when the activity is destoried by some reason(ex:change language),
    when dismiss the dialog, it may be throw a JE. see 298363.
    */
    ErrorDialog errDialog = ErrorDialog.newInstance(titleId, messageId, mediaTypeIdForTitle, mediaTypeIdForMsg);
    try {
        errDialog.show(activity.getFragmentManager(), "errDialog");
    } catch (IllegalStateException e) {
        try {
            MmsLog.d(TAG, "showErrorDialog catch IllegalStateException." + e);
            FragmentTransaction transaction = activity.getFragmentManager().beginTransaction();
            transaction.add(errDialog, "errDialog");
            transaction.commitAllowingStateLoss();
        } catch (Exception e2) {
            MmsLog.e(TAG, "showErrorDialog commitAllowingStateLoss catch Exception." + e2);
        }
        return;
    }
}

From source file:ch.uzh.supersede.feedbacklibrary.utils.Utils.java

/**
 * This method opens the FeedbackActivity from the feedback library in case if a PULL feedback is triggered with a specific PULL configuration.
 *
 * @param baseURL                the base URL
 * @param activity               the activity in which the method is called
 * @param applicationId          the application id
 * @param language               the language
 * @param pullConfigurationId    the pull configuration id
 * @param intermediateDialogText the text to show in the intermediate dialog
 *//*w ww  . j  a v  a 2 s  . c o  m*/
public static void triggerSpecificPullFeedback(@NonNull final String baseURL, @NonNull final Activity activity,
        final long applicationId, final @NonNull String language, final long pullConfigurationId,
        final @NonNull String intermediateDialogText) {
    Retrofit rtf = new Retrofit.Builder().baseUrl(baseURL).addConverterFactory(GsonConverterFactory.create())
            .build();
    feedbackAPI fbAPI = rtf.create(feedbackAPI.class);
    final Call<ResponseBody> checkUpAndRunning = fbAPI.pingOrchestrator();

    if (checkUpAndRunning != null) {
        checkUpAndRunning.enqueue(new Callback<ResponseBody>() {
            @Override
            public void onFailure(Call<ResponseBody> call, Throwable t) {
                Log.e(TAG, "Failed to ping the server. onFailure method called", t);
            }

            @Override
            public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
                if (response.code() == 200) {
                    Retrofit rtf = new Retrofit.Builder().baseUrl(baseURL)
                            .addConverterFactory(GsonConverterFactory.create()).build();
                    feedbackAPI fbAPI = rtf.create(feedbackAPI.class);
                    Call<OrchestratorConfigurationItem> result = fbAPI.getConfiguration(language,
                            applicationId);

                    // Asynchronous call
                    if (result != null) {
                        result.enqueue(new Callback<OrchestratorConfigurationItem>() {
                            @Override
                            public void onFailure(Call<OrchestratorConfigurationItem> call, Throwable t) {
                                Log.e(TAG, "Failed to retrieve the configuration. onFailure method called", t);
                                DialogUtils.showInformationDialog(activity,
                                        new String[] { activity.getResources().getString(
                                                R.string.supersede_feedbacklibrary_feedback_application_unavailable_text) },
                                        true);
                            }

                            @Override
                            public void onResponse(Call<OrchestratorConfigurationItem> call,
                                    Response<OrchestratorConfigurationItem> response) {
                                if (response.code() == 200) {
                                    Log.i(TAG, "Configuration successfully retrieved");
                                    OrchestratorConfigurationItem configuration = response.body();
                                    if (configuration != null) {
                                        List<ConfigurationItem> configurationItems = configuration
                                                .getConfigurationItems();
                                        long[] selectedPullConfigurationIndex = { -1L };
                                        ConfigurationItem selectedConfigurationItem = null;
                                        for (ConfigurationItem configurationItem : configurationItems) {
                                            if (configurationItem.getType().equals("PULL")
                                                    && configurationItem.getId() == pullConfigurationId) {
                                                selectedPullConfigurationIndex[0] = configurationItem.getId();
                                                selectedConfigurationItem = configurationItem;
                                                break;
                                            }
                                        }

                                        if (selectedPullConfigurationIndex[0] != -1
                                                && selectedConfigurationItem != null) {
                                            // If no "showIntermediateDialog" is provided, show it
                                            boolean showIntermediateDialog = true;
                                            for (Map<String, Object> parameter : selectedConfigurationItem
                                                    .getGeneralConfigurationItem().getParameters()) {
                                                String key = (String) parameter.get("key");
                                                // Intermediate dialog
                                                if (key.equals("showIntermediateDialog")) {
                                                    showIntermediateDialog = (Utils.intToBool(
                                                            ((Double) parameter.get("value")).intValue()));
                                                }
                                            }

                                            Intent intent = new Intent(activity, FeedbackActivity.class);
                                            String jsonString = new Gson().toJson(configuration);
                                            intent.putExtra(FeedbackActivity.IS_PUSH_STRING, false);
                                            intent.putExtra(FeedbackActivity.JSON_CONFIGURATION_STRING,
                                                    jsonString);
                                            intent.putExtra(
                                                    FeedbackActivity.SELECTED_PULL_CONFIGURATION_INDEX_STRING,
                                                    selectedPullConfigurationIndex[0]);
                                            intent.putExtra(FeedbackActivity.EXTRA_KEY_BASE_URL, baseURL);
                                            intent.putExtra(FeedbackActivity.EXTRA_KEY_LANGUAGE, language);
                                            if (!showIntermediateDialog) {
                                                // Start the feedback activity without asking the user
                                                activity.startActivity(intent);
                                            } else {
                                                // Ask the user if (s)he would like to give feedback or not
                                                DialogUtils.PullFeedbackIntermediateDialog d = DialogUtils.PullFeedbackIntermediateDialog
                                                        .newInstance(intermediateDialogText, jsonString,
                                                                selectedPullConfigurationIndex[0], baseURL,
                                                                language);
                                                d.show(activity.getFragmentManager(), "feedbackPopupDialog");
                                            }
                                        } else {
                                            DialogUtils.showInformationDialog(activity,
                                                    new String[] { activity.getResources().getString(
                                                            R.string.supersede_feedbacklibrary_feedback_application_unavailable_text) },
                                                    true);
                                        }
                                    }
                                } else {
                                    Log.e(TAG, "Failed to retrieve the configuration. Response code == "
                                            + response.code());
                                }
                            }
                        });
                    } else {
                        Log.e(TAG,
                                "Failed to retrieve the configuration. Call<OrchestratorConfigurationItem> result is null");
                    }
                } else {
                    Log.e(TAG, "The server is not up and running. Response code == " + response.code());
                }
            }
        });
    } else {
        Log.e(TAG, "Failed to ping the server. Call<ResponseBody> checkUpAndRunning result is null");
    }
}

From source file:ch.uzh.supersede.feedbacklibrary.utils.Utils.java

/**
 * This method opens the FeedbackActivity from the feedback library in case if a PULL feedback is triggered with a random PULL configuration.
 *
 * @param baseURL       the base URL/*from  ww  w . ja va 2 s .c o  m*/
 * @param activity      the activity in which the method is called
 * @param applicationId the application id
 * @param language      the language
 */
public static void triggerRandomPullFeedback(@NonNull final String baseURL, @NonNull final Activity activity,
        final long applicationId, final @NonNull String language) {
    Retrofit rtf = new Retrofit.Builder().baseUrl(baseURL).addConverterFactory(GsonConverterFactory.create())
            .build();
    feedbackAPI fbAPI = rtf.create(feedbackAPI.class);
    final Call<ResponseBody> checkUpAndRunning = fbAPI.pingOrchestrator();

    if (checkUpAndRunning != null) {
        checkUpAndRunning.enqueue(new Callback<ResponseBody>() {
            @Override
            public void onFailure(Call<ResponseBody> call, Throwable t) {
                Log.e(TAG, "Failed to ping the server. onFailure method called", t);
            }

            @Override
            public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
                if (response.code() == 200) {
                    Retrofit rtf = new Retrofit.Builder().baseUrl(baseURL)
                            .addConverterFactory(GsonConverterFactory.create()).build();
                    feedbackAPI fbAPI = rtf.create(feedbackAPI.class);
                    Call<OrchestratorConfigurationItem> result = fbAPI.getConfiguration(language,
                            applicationId);

                    // Asynchronous call
                    if (result != null) {
                        result.enqueue(new Callback<OrchestratorConfigurationItem>() {
                            @Override
                            public void onFailure(Call<OrchestratorConfigurationItem> call, Throwable t) {
                                Log.e(TAG, "Failed to retrieve the configuration. onFailure method called", t);
                                DialogUtils.showInformationDialog(activity,
                                        new String[] { activity.getResources().getString(
                                                R.string.supersede_feedbacklibrary_feedback_application_unavailable_text) },
                                        true);
                            }

                            @Override
                            public void onResponse(Call<OrchestratorConfigurationItem> call,
                                    Response<OrchestratorConfigurationItem> response) {
                                if (response.code() == 200) {
                                    Log.i(TAG, "Configuration successfully retrieved");
                                    OrchestratorConfigurationItem configuration = response.body();
                                    if (configuration != null) {
                                        List<ConfigurationItem> configurationItems = configuration
                                                .getConfigurationItems();
                                        List<Long> shuffleIds = new ArrayList<>();
                                        Map<Long, List<Map<String, Object>>> idParameters = new HashMap<>();
                                        for (ConfigurationItem configurationItem : configurationItems) {
                                            if (configurationItem.getType().equals("PULL")) {
                                                shuffleIds.add(configurationItem.getId());
                                                idParameters.put(configurationItem.getId(), configurationItem
                                                        .getGeneralConfigurationItem().getParameters());
                                            }
                                        }

                                        Random rnd = new Random(System.nanoTime());
                                        Collections.shuffle(shuffleIds, rnd);
                                        for (int i = 0; i < shuffleIds.size(); ++i) {
                                            double likelihood = -1;
                                            // If no "showIntermediateDialog" is provided, show it
                                            boolean showIntermediateDialog = true;
                                            for (Map<String, Object> parameter : idParameters
                                                    .get(shuffleIds.get(i))) {
                                                String key = (String) parameter.get("key");
                                                // Likelihood
                                                if (key.equals("likelihood")) {
                                                    likelihood = (((Double) parameter.get("value"))
                                                            .floatValue());
                                                }
                                                // Intermediate dialog
                                                if (key.equals("showIntermediateDialog")) {
                                                    showIntermediateDialog = (Utils.intToBool(
                                                            ((Double) parameter.get("value")).intValue()));
                                                }
                                            }

                                            if (!(rnd.nextDouble() > likelihood)) {
                                                Intent intent = new Intent(activity, FeedbackActivity.class);
                                                String jsonString = new Gson().toJson(configuration);
                                                intent.putExtra(FeedbackActivity.IS_PUSH_STRING, false);
                                                intent.putExtra(FeedbackActivity.JSON_CONFIGURATION_STRING,
                                                        jsonString);
                                                intent.putExtra(
                                                        FeedbackActivity.SELECTED_PULL_CONFIGURATION_INDEX_STRING,
                                                        shuffleIds.get(i));
                                                intent.putExtra(FeedbackActivity.EXTRA_KEY_BASE_URL, baseURL);
                                                intent.putExtra(FeedbackActivity.EXTRA_KEY_LANGUAGE, language);
                                                if (!showIntermediateDialog) {
                                                    // Start the feedback activity without asking the user
                                                    activity.startActivity(intent);
                                                    break;
                                                } else {
                                                    // Ask the user if (s)he would like to give feedback or not
                                                    DialogUtils.PullFeedbackIntermediateDialog d = DialogUtils.PullFeedbackIntermediateDialog
                                                            .newInstance(activity.getResources().getString(
                                                                    ch.uzh.supersede.feedbacklibrary.R.string.supersede_feedbacklibrary_pull_feedback_question_string),
                                                                    jsonString, shuffleIds.get(i), baseURL,
                                                                    language);
                                                    d.show(activity.getFragmentManager(),
                                                            "feedbackPopupDialog");
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                } else {
                                    Log.e(TAG, "Failed to retrieve the configuration. Response code == "
                                            + response.code());
                                }
                            }
                        });
                    } else {
                        Log.e(TAG,
                                "Failed to retrieve the configuration. Call<OrchestratorConfigurationItem> result is null");
                    }
                } else {
                    Log.e(TAG, "The server is not up and running. Response code == " + response.code());
                }
            }
        });
    } else {
        Log.e(TAG, "Failed to ping the server. Call<ResponseBody> checkUpAndRunning result is null");
    }
}

From source file:org.quantumbadger.redreader.reddit.prepared.RedditPreparedPost.java

public static void onActionMenuItemSelected(final RedditPreparedPost post, final Activity activity,
        final Action action) {

    switch (action) {

    case UPVOTE://from  w  ww .  j  av a  2  s  .  c o m
        post.action(activity, RedditAPI.RedditAction.UPVOTE);
        break;

    case DOWNVOTE:
        post.action(activity, RedditAPI.RedditAction.DOWNVOTE);
        break;

    case UNVOTE:
        post.action(activity, RedditAPI.RedditAction.UNVOTE);
        break;

    case SAVE:
        post.action(activity, RedditAPI.RedditAction.SAVE);
        break;

    case UNSAVE:
        post.action(activity, RedditAPI.RedditAction.UNSAVE);
        break;

    case HIDE:
        post.action(activity, RedditAPI.RedditAction.HIDE);
        break;

    case UNHIDE:
        post.action(activity, RedditAPI.RedditAction.UNHIDE);
        break;

    case DELETE:
        new AlertDialog.Builder(activity).setTitle(R.string.accounts_delete).setMessage(R.string.delete_confirm)
                .setPositiveButton(R.string.action_delete, new DialogInterface.OnClickListener() {
                    public void onClick(final DialogInterface dialog, final int which) {
                        post.action(activity, RedditAPI.RedditAction.DELETE);
                    }
                }).setNegativeButton(R.string.dialog_cancel, null).show();
        break;

    case REPORT:

        new AlertDialog.Builder(activity).setTitle(R.string.action_report)
                .setMessage(R.string.action_report_sure)
                .setPositiveButton(R.string.action_report, new DialogInterface.OnClickListener() {
                    public void onClick(final DialogInterface dialog, final int which) {
                        post.action(activity, RedditAPI.RedditAction.REPORT);
                        // TODO update the view to show the result
                        // TODO don't forget, this also hides
                    }
                }).setNegativeButton(R.string.dialog_cancel, null).show();

        break;

    case EXTERNAL: {
        final Intent intent = new Intent(Intent.ACTION_VIEW);
        String url = (activity instanceof WebViewActivity) ? ((WebViewActivity) activity).getCurrentUrl()
                : post.url;
        intent.setData(Uri.parse(url));
        activity.startActivity(intent);
        break;
    }

    case SELFTEXT_LINKS: {

        final HashSet<String> linksInComment = LinkHandler
                .computeAllLinks(StringEscapeUtils.unescapeHtml4(post.src.selftext));

        if (linksInComment.isEmpty()) {
            General.quickToast(activity, R.string.error_toast_no_urls_in_self);

        } else {

            final String[] linksArr = linksInComment.toArray(new String[linksInComment.size()]);

            final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
            builder.setItems(linksArr, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    LinkHandler.onLinkClicked(activity, linksArr[which], false, post.src);
                    dialog.dismiss();
                }
            });

            final AlertDialog alert = builder.create();
            alert.setTitle(R.string.action_selftext_links);
            alert.setCanceledOnTouchOutside(true);
            alert.show();
        }

        break;
    }

    case SAVE_IMAGE: {

        final RedditAccount anon = RedditAccountManager.getAnon();

        LinkHandler.getImageInfo(activity, post.url, Constants.Priority.IMAGE_VIEW, 0,
                new GetImageInfoListener() {

                    @Override
                    public void onFailure(final RequestFailureType type, final Throwable t,
                            final StatusLine status, final String readableMessage) {
                        final RRError error = General.getGeneralErrorForFailure(activity, type, t, status,
                                post.url);
                        General.showResultDialog(activity, error);
                    }

                    @Override
                    public void onSuccess(final ImgurAPI.ImageInfo info) {

                        CacheManager.getInstance(activity)
                                .makeRequest(new CacheRequest(General.uriFromString(info.urlOriginal), anon,
                                        null, Constants.Priority.IMAGE_VIEW, 0,
                                        CacheRequest.DownloadType.IF_NECESSARY, Constants.FileType.IMAGE, false,
                                        false, false, activity) {

                                    @Override
                                    protected void onCallbackException(Throwable t) {
                                        BugReportActivity.handleGlobalError(context, t);
                                    }

                                    @Override
                                    protected void onDownloadNecessary() {
                                        General.quickToast(context, R.string.download_downloading);
                                    }

                                    @Override
                                    protected void onDownloadStarted() {
                                    }

                                    @Override
                                    protected void onFailure(RequestFailureType type, Throwable t,
                                            StatusLine status, String readableMessage) {
                                        final RRError error = General.getGeneralErrorForFailure(context, type,
                                                t, status, url.toString());
                                        General.showResultDialog(activity, error);
                                    }

                                    @Override
                                    protected void onProgress(boolean authorizationInProgress, long bytesRead,
                                            long totalBytes) {
                                    }

                                    @Override
                                    protected void onSuccess(CacheManager.ReadableCacheFile cacheFile,
                                            long timestamp, UUID session, boolean fromCache, String mimetype) {

                                        File dst = new File(
                                                Environment.getExternalStoragePublicDirectory(
                                                        Environment.DIRECTORY_PICTURES),
                                                General.uriFromString(info.urlOriginal).getPath());

                                        if (dst.exists()) {
                                            int count = 0;

                                            while (dst.exists()) {
                                                count++;
                                                dst = new File(
                                                        Environment.getExternalStoragePublicDirectory(
                                                                Environment.DIRECTORY_PICTURES),
                                                        count + "_" + General.uriFromString(info.urlOriginal)
                                                                .getPath().substring(1));
                                            }
                                        }

                                        try {
                                            final InputStream cacheFileInputStream = cacheFile.getInputStream();

                                            if (cacheFileInputStream == null) {
                                                notifyFailure(RequestFailureType.CACHE_MISS, null, null,
                                                        "Could not find cached image");
                                                return;
                                            }

                                            General.copyFile(cacheFileInputStream, dst);

                                        } catch (IOException e) {
                                            notifyFailure(RequestFailureType.STORAGE, e, null,
                                                    "Could not copy file");
                                            return;
                                        }

                                        activity.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE,
                                                Uri.parse("file://" + dst.getAbsolutePath())));

                                        General.quickToast(context,
                                                context.getString(R.string.action_save_image_success) + " "
                                                        + dst.getAbsolutePath());
                                    }
                                });

                    }

                    @Override
                    public void onNotAnImage() {
                        General.quickToast(activity, R.string.selected_link_is_not_image);
                    }
                });

        break;
    }

    case SHARE: {

        final Intent mailer = new Intent(Intent.ACTION_SEND);
        mailer.setType("text/plain");
        mailer.putExtra(Intent.EXTRA_SUBJECT, post.title);
        mailer.putExtra(Intent.EXTRA_TEXT, post.url);
        activity.startActivity(Intent.createChooser(mailer, activity.getString(R.string.action_share)));
        break;
    }

    case SHARE_COMMENTS: {

        final Intent mailer = new Intent(Intent.ACTION_SEND);
        mailer.setType("text/plain");
        mailer.putExtra(Intent.EXTRA_SUBJECT, "Comments for " + post.title);
        mailer.putExtra(Intent.EXTRA_TEXT,
                Constants.Reddit.getUri(Constants.Reddit.PATH_COMMENTS + post.idAlone).toString());
        activity.startActivity(
                Intent.createChooser(mailer, activity.getString(R.string.action_share_comments)));
        break;
    }

    case COPY: {

        ClipboardManager manager = (ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE);
        manager.setText(post.url);
        break;
    }

    case GOTO_SUBREDDIT: {

        try {
            final Intent intent = new Intent(activity, PostListingActivity.class);
            intent.setData(SubredditPostListURL.getSubreddit(post.src.subreddit).generateJsonUri());
            activity.startActivityForResult(intent, 1);

        } catch (RedditSubreddit.InvalidSubredditNameException e) {
            Toast.makeText(activity, R.string.invalid_subreddit_name, Toast.LENGTH_LONG).show();
        }

        break;
    }

    case USER_PROFILE:
        LinkHandler.onLinkClicked(activity, new UserProfileURL(post.src.author).toString());
        break;

    case PROPERTIES:
        PostPropertiesDialog.newInstance(post.src).show(activity.getFragmentManager(), null);
        break;

    case COMMENTS:
        ((RedditPostView.PostSelectionListener) activity).onPostCommentsSelected(post);
        break;

    case LINK:
        ((RedditPostView.PostSelectionListener) activity).onPostSelected(post);
        break;

    case COMMENTS_SWITCH:
        if (!(activity instanceof MainActivity))
            activity.finish();
        ((RedditPostView.PostSelectionListener) activity).onPostCommentsSelected(post);
        break;

    case LINK_SWITCH:
        if (!(activity instanceof MainActivity))
            activity.finish();
        ((RedditPostView.PostSelectionListener) activity).onPostSelected(post);
        break;

    case ACTION_MENU:
        showActionMenu(activity, post);
        break;

    case REPLY:
        final Intent intent = new Intent(activity, CommentReplyActivity.class);
        intent.putExtra("parentIdAndType", post.idAndType);
        activity.startActivity(intent);
        break;
    }
}