Search in sources :

Example 1 with Tag

use of org.wordpress.android.util.HelpshiftHelper.Tag in project WordPress-Android by wordpress-mobile.

the class HelpActivity method initHelpshiftLayout.

private void initHelpshiftLayout() {
    setContentView(R.layout.help_activity_with_helpshift);
    WPTextView version = (WPTextView) findViewById(R.id.nux_help_version);
    version.setText(getString(R.string.version) + " " + WordPress.versionName);
    WPTextView contactUsButton = (WPTextView) findViewById(R.id.contact_us_button);
    contactUsButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Bundle extras = getIntent().getExtras();
            Tag origin = Tag.ORIGIN_UNKNOWN;
            if (extras != null) {
                // This could be moved to WelcomeFragmentSignIn directly, but better to have all Helpshift
                // related code at the same place (Note: value can be null).
                HelpshiftHelper.getInstance().addMetaData(MetadataKey.USER_ENTERED_URL, extras.getString(SignInFragment.ENTERED_URL_KEY));
                HelpshiftHelper.getInstance().addMetaData(MetadataKey.USER_ENTERED_USERNAME, extras.getString(SignInFragment.ENTERED_USERNAME_KEY));
                origin = (Tag) extras.get(HelpshiftHelper.ORIGIN_KEY);
            }
            HelpshiftHelper.getInstance().showConversation(HelpActivity.this, mSiteStore, origin, mAccountStore.getAccount().getUserName());
        }
    });
    WPTextView faqbutton = (WPTextView) findViewById(R.id.faq_button);
    faqbutton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Bundle extras = getIntent().getExtras();
            Tag origin = Tag.ORIGIN_UNKNOWN;
            if (extras != null) {
                origin = (Tag) extras.get(HelpshiftHelper.ORIGIN_KEY);
            }
            HelpshiftHelper.getInstance().showFAQ(HelpActivity.this, mSiteStore, origin, mAccountStore.getAccount().getUserName());
        }
    });
}
Also used : Bundle(android.os.Bundle) OnClickListener(android.view.View.OnClickListener) WPTextView(org.wordpress.android.widgets.WPTextView) Tag(org.wordpress.android.util.HelpshiftHelper.Tag) View(android.view.View) WPTextView(org.wordpress.android.widgets.WPTextView)

Example 2 with Tag

use of org.wordpress.android.util.HelpshiftHelper.Tag in project WordPress-Android by wordpress-mobile.

the class SignInDialogFragment method onClickAction.

private void onClickAction(View v, int action, Bundle arguments) {
    if (!isAdded()) {
        return;
    }
    switch(action) {
        case ACTION_OPEN_URL:
            String url = arguments.getString(ARG_OPEN_URL_PARAM);
            if (TextUtils.isEmpty(url)) {
                return;
            }
            ActivityLauncher.openUrlExternal(getContext(), url);
            break;
        case ACTION_OPEN_SUPPORT_CHAT:
            HelpshiftHelper.getInstance().addMetaData(MetadataKey.USER_ENTERED_URL, arguments.getString(SignInFragment.ENTERED_URL_KEY));
            HelpshiftHelper.getInstance().addMetaData(MetadataKey.USER_ENTERED_USERNAME, arguments.getString(SignInFragment.ENTERED_USERNAME_KEY));
            Tag origin = (Tag) arguments.getSerializable(HelpshiftHelper.ORIGIN_KEY);
            HelpshiftHelper.getInstance().showConversation(getActivity(), mSiteStore, origin, mAccountStore.getAccount().getUserName());
            dismissAllowingStateLoss();
            break;
        case ACTION_OPEN_APPLICATION_LOG:
            startActivity(new Intent(v.getContext(), AppLogViewerActivity.class));
            dismissAllowingStateLoss();
            break;
        case ACTION_OPEN_FAQ_PAGE:
            String faqid = arguments.getString(ARG_TELL_ME_MORE_BUTTON_PARAM_NAME_FAQ_ID);
            String sectionid = arguments.getString(ARG_TELL_ME_MORE_BUTTON_PARAM_NAME_SECTION_ID);
            if (faqid != null) {
                Support.showSingleFAQ(getActivity(), faqid);
            } else if (sectionid != null) {
                Support.showFAQSection(getActivity(), sectionid);
            }
            break;
        default:
        case ACTION_FINISH:
            getActivity().finish();
            break;
    }
}
Also used : Intent(android.content.Intent) Tag(org.wordpress.android.util.HelpshiftHelper.Tag) AppLogViewerActivity(org.wordpress.android.ui.AppLogViewerActivity)

Aggregations

Tag (org.wordpress.android.util.HelpshiftHelper.Tag)2 Intent (android.content.Intent)1 Bundle (android.os.Bundle)1 View (android.view.View)1 OnClickListener (android.view.View.OnClickListener)1 AppLogViewerActivity (org.wordpress.android.ui.AppLogViewerActivity)1 WPTextView (org.wordpress.android.widgets.WPTextView)1