Search in sources :

Example 1 with WPTextView

use of org.wordpress.android.widgets.WPTextView 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 WPTextView

use of org.wordpress.android.widgets.WPTextView in project WordPress-Android by wordpress-mobile.

the class NewBlogFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout containing a title and body text.
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.create_blog_fragment, container, false);
    mSignupButton = (WPTextView) rootView.findViewById(R.id.signup_button);
    mSignupButton.setOnClickListener(mSignupClickListener);
    mSignupButton.setEnabled(false);
    mCancelButton = (WPTextView) rootView.findViewById(R.id.cancel_button);
    mCancelButton.setOnClickListener(mCancelClickListener);
    mProgressTextSignIn = (WPTextView) rootView.findViewById(R.id.nux_sign_in_progress_text);
    mProgressBarSignIn = (RelativeLayout) rootView.findViewById(R.id.nux_sign_in_progress_bar);
    mSiteUrlTextField = (EditText) rootView.findViewById(R.id.site_url);
    mSiteUrlTextField.setOnKeyListener(mSiteUrlKeyListener);
    mSiteUrlTextField.setOnEditorActionListener(mEditorAction);
    mSiteUrlTextField.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            checkIfFieldsFilled();
        }

        @Override
        public void afterTextChanged(Editable editable) {
            lowerCaseEditable(editable);
        }
    });
    mSiteTitleTextField = (EditText) rootView.findViewById(R.id.site_title);
    mSiteTitleTextField.addTextChangedListener(this);
    mSiteTitleTextField.addTextChangedListener(mSiteTitleWatcher);
    mSiteTitleTextField.setOnFocusChangeListener(new View.OnFocusChangeListener() {

        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (hasFocus) {
                mAutoCompleteUrl = EditTextUtils.getText(mSiteTitleTextField).equals(EditTextUtils.getText(mSiteUrlTextField)) || EditTextUtils.isEmpty(mSiteUrlTextField);
            }
        }
    });
    return rootView;
}
Also used : ViewGroup(android.view.ViewGroup) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) View(android.view.View) WPTextView(org.wordpress.android.widgets.WPTextView) TextView(android.widget.TextView)

Example 3 with WPTextView

use of org.wordpress.android.widgets.WPTextView in project WordPress-Android by wordpress-mobile.

the class NewUserFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout containing a title and body text.
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.new_account_user_fragment_screen, container, false);
    WPTextView termsOfServiceTextView = (WPTextView) rootView.findViewById(R.id.l_agree_terms_of_service);
    termsOfServiceTextView.setText(Html.fromHtml(String.format(getString(R.string.agree_terms_of_service), "<u>", "</u>")));
    termsOfServiceTextView.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            ActivityLauncher.openUrlExternal(getContext(), getString(R.string.wordpresscom_tos_url));
        }
    });
    mSignupButton = (WPTextView) rootView.findViewById(R.id.signup_button);
    mSignupButton.setOnClickListener(mSignupClickListener);
    mSignupButton.setEnabled(false);
    mProgressTextSignIn = (WPTextView) rootView.findViewById(R.id.nux_sign_in_progress_text);
    mProgressBarSignIn = (RelativeLayout) rootView.findViewById(R.id.nux_sign_in_progress_bar);
    mEmailTextField = (EditText) rootView.findViewById(R.id.email_address);
    mEmailTextField.setText(UserEmailUtils.getPrimaryEmail(getActivity()));
    mEmailTextField.setSelection(EditTextUtils.getText(mEmailTextField).length());
    mPasswordTextField = (EditText) rootView.findViewById(R.id.password);
    mUsernameTextField = (EditText) rootView.findViewById(R.id.username);
    mSiteUrlTextField = (EditText) rootView.findViewById(R.id.site_url);
    mEmailTextField.addTextChangedListener(this);
    mPasswordTextField.addTextChangedListener(this);
    mUsernameTextField.addTextChangedListener(this);
    mSiteUrlTextField.setOnKeyListener(mSiteUrlKeyListener);
    mSiteUrlTextField.setOnEditorActionListener(mEditorAction);
    mSiteUrlTextField.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            checkIfFieldsFilled();
        }

        @Override
        public void afterTextChanged(Editable editable) {
            lowerCaseEditable(editable);
        }
    });
    mUsernameTextField.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            // auto fill blog address
            mSiteUrlTextField.setError(null);
            if (mAutoCompleteUrl) {
                mSiteUrlTextField.setText(EditTextUtils.getText(mUsernameTextField));
            }
        }

        @Override
        public void afterTextChanged(Editable editable) {
            lowerCaseEditable(editable);
        }
    });
    mUsernameTextField.setOnFocusChangeListener(new View.OnFocusChangeListener() {

        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (hasFocus) {
                mAutoCompleteUrl = EditTextUtils.getText(mUsernameTextField).equals(EditTextUtils.getText(mSiteUrlTextField)) || EditTextUtils.isEmpty(mSiteUrlTextField);
            }
        }
    });
    mEmailTextField.setOnFocusChangeListener(new View.OnFocusChangeListener() {

        public void onFocusChange(View v, boolean hasFocus) {
            if (!hasFocus) {
                autocorrectEmail();
            }
        }
    });
    initPasswordVisibilityButton(rootView, mPasswordTextField);
    initInfoButton(rootView);
    return rootView;
}
Also used : ViewGroup(android.view.ViewGroup) OnClickListener(android.view.View.OnClickListener) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) WPTextView(org.wordpress.android.widgets.WPTextView) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) WPTextView(org.wordpress.android.widgets.WPTextView)

Example 4 with WPTextView

use of org.wordpress.android.widgets.WPTextView in project WordPress-Android by wordpress-mobile.

the class SignInFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.signin_fragment, container, false);
    mIconSwitcher = (ViewSwitcher) rootView.findViewById(R.id.icon_switcher);
    mWpcomLogotype = rootView.findViewById(R.id.nux_wordpress_logotype);
    mUrlButtonLayout = (RelativeLayout) rootView.findViewById(R.id.url_button_layout);
    mTwoStepLayout = (RelativeLayout) rootView.findViewById(R.id.two_factor_layout);
    mTwoStepFooter = (LinearLayout) rootView.findViewById(R.id.two_step_footer);
    mUsernameLayout = (RelativeLayout) rootView.findViewById(R.id.nux_username_layout);
    mUsernameLayout.setOnClickListener(mOnLoginFormClickListener);
    mPasswordLayout = (RelativeLayout) rootView.findViewById(R.id.nux_password_layout);
    mPasswordLayout.setOnClickListener(mOnLoginFormClickListener);
    mUsernameEditText = (EditText) rootView.findViewById(R.id.nux_username);
    mUsernameEditText.addTextChangedListener(this);
    mUsernameEditText.setOnClickListener(mOnLoginFormClickListener);
    mPasswordEditText = (EditText) rootView.findViewById(R.id.nux_password);
    mPasswordEditText.addTextChangedListener(this);
    mPasswordEditText.setOnClickListener(mOnLoginFormClickListener);
    mJetpackAuthLabel = (WPTextView) rootView.findViewById(R.id.nux_jetpack_auth_label);
    mUrlEditText = (EditText) rootView.findViewById(R.id.nux_url);
    mSignInButton = (WPTextView) rootView.findViewById(R.id.nux_sign_in_button);
    mSignInButton.setOnClickListener(mSignInClickListener);
    mProgressBarSignIn = (RelativeLayout) rootView.findViewById(R.id.nux_sign_in_progress_bar);
    mProgressTextSignIn = (WPTextView) rootView.findViewById(R.id.nux_sign_in_progress_text);
    mCreateAccountButton = (WPTextView) rootView.findViewById(R.id.nux_create_account_button);
    mCreateAccountButton.setOnClickListener(mCreateAccountListener);
    mAddSelfHostedButton = (WPTextView) rootView.findViewById(R.id.nux_add_selfhosted_button);
    mAddSelfHostedButton.setText(getString(R.string.nux_add_selfhosted_blog));
    mAddSelfHostedButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            toggleSignInMode();
        }
    });
    mForgotPassword = (WPTextView) rootView.findViewById(R.id.forgot_password);
    mForgotPassword.setOnClickListener(mForgotPasswordListener);
    mUsernameEditText.setOnFocusChangeListener(new View.OnFocusChangeListener() {

        public void onFocusChange(View v, boolean hasFocus) {
            if (!hasFocus) {
                autocorrectUsername();
                // Show the self-hosted sign-in form if the user entered a username that can't be for WordPress.com
                if (!mSelfHosted) {
                    mReservedNameMatcher.reset(mUsernameEditText.getText().toString());
                    if (mReservedNameMatcher.matches()) {
                        showSelfHostedSignInForm();
                    }
                }
            }
        }
    });
    mPasswordEditText.setOnEditorActionListener(mEditorAction);
    mUrlEditText.setOnEditorActionListener(mEditorAction);
    mTwoStepEditText = (ContextMenuEditText) rootView.findViewById(R.id.nux_two_step);
    mTwoStepEditText.addTextChangedListener(this);
    mTwoStepEditText.setOnKeyListener(new View.OnKeyListener() {

        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (keyCode == EditorInfo.IME_ACTION_DONE)) {
                if (fieldsFilled()) {
                    signIn();
                }
            }
            return false;
        }
    });
    mTwoStepEditText.setOnContextMenuListener(new ContextMenuEditText.OnContextMenuListener() {

        @Override
        public void onCut() {
        }

        @Override
        public void onCopy() {
        }

        @Override
        public void onPaste() {
            mTwoStepEditText.setText(getAuthCodeFromClipboard());
            if (TextUtils.isEmpty(mTwoStepEditText.getText().toString())) {
                showTwoStepCodeError(R.string.invalid_verification_code_format);
            }
        }
    });
    WPTextView twoStepFooterButton = (WPTextView) rootView.findViewById(R.id.two_step_footer_button);
    twoStepFooterButton.setText(Html.fromHtml("<u>" + getString(R.string.two_step_footer_button) + "</u>"));
    twoStepFooterButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            requestSMSTwoStepCode();
        }
    });
    mBottomButtonsLayout = (LinearLayout) rootView.findViewById(R.id.nux_bottom_buttons);
    initPasswordVisibilityButton(rootView, mPasswordEditText);
    initInfoButtons(rootView);
    moveBottomButtons();
    if (mSelfHosted) {
        showSelfHostedSignInForm();
    }
    autofillFromBuildConfig();
    if (savedInstanceState == null) {
        configureMagicLinkUI();
    }
    mUsernameEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {

        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if ((didPressNextKey(actionId, event) || didPressEnterKey(actionId, event)) && mIsMagicLinksEnabled) {
                signIn();
                return true;
            } else {
                return false;
            }
        }
    });
    return rootView;
}
Also used : ViewGroup(android.view.ViewGroup) WPTextView(org.wordpress.android.widgets.WPTextView) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) WPTextView(org.wordpress.android.widgets.WPTextView) ContextMenuEditText(org.wordpress.android.widgets.ContextMenuEditText) KeyEvent(android.view.KeyEvent) OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) WPTextView(org.wordpress.android.widgets.WPTextView)

Example 5 with WPTextView

use of org.wordpress.android.widgets.WPTextView in project WordPress-Android by wordpress-mobile.

the class MySiteFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.my_site_fragment, container, false);
    int fabHeight = getResources().getDimensionPixelSize(android.support.design.R.dimen.design_fab_size_normal);
    int fabMargin = getResources().getDimensionPixelSize(R.dimen.fab_margin);
    mFabTargetYTranslation = (fabHeight + fabMargin) * 2;
    mBlavatarSz = getResources().getDimensionPixelSize(R.dimen.blavatar_sz_small);
    mBlavatarImageView = (WPNetworkImageView) rootView.findViewById(R.id.my_site_blavatar);
    mBlogTitleTextView = (WPTextView) rootView.findViewById(R.id.my_site_title_label);
    mBlogSubtitleTextView = (WPTextView) rootView.findViewById(R.id.my_site_subtitle_label);
    mLookAndFeelHeader = (LinearLayout) rootView.findViewById(R.id.my_site_look_and_feel_header);
    mThemesContainer = (RelativeLayout) rootView.findViewById(R.id.row_themes);
    mPeopleView = (RelativeLayout) rootView.findViewById(R.id.row_people);
    mPlanContainer = (RelativeLayout) rootView.findViewById(R.id.row_plan);
    mConfigurationHeader = rootView.findViewById(R.id.row_configuration);
    mSettingsView = rootView.findViewById(R.id.row_settings);
    mAdminView = (RelativeLayout) rootView.findViewById(R.id.row_admin);
    mScrollView = (ScrollView) rootView.findViewById(R.id.scroll_view);
    mNoSiteView = (LinearLayout) rootView.findViewById(R.id.no_site_view);
    mNoSiteDrakeImageView = (ImageView) rootView.findViewById(R.id.my_site_no_site_view_drake);
    mFabView = rootView.findViewById(R.id.fab_button);
    mCurrentPlanNameTextView = (WPTextView) rootView.findViewById(R.id.my_site_current_plan_text_view);
    mPageView = (RelativeLayout) rootView.findViewById(R.id.row_pages);
    // hide the FAB the first time the fragment is created in order to animate it in onResume()
    if (savedInstanceState == null) {
        mFabView.setVisibility(View.INVISIBLE);
    }
    mFabView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ActivityLauncher.addNewPostOrPageForResult(getActivity(), getSelectedSite(), false);
        }
    });
    rootView.findViewById(R.id.switch_site).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            showSitePicker();
        }
    });
    rootView.findViewById(R.id.row_view_site).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ActivityLauncher.viewCurrentSite(getActivity(), getSelectedSite());
        }
    });
    rootView.findViewById(R.id.row_stats).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ActivityLauncher.viewBlogStats(getActivity(), getSelectedSite());
        }
    });
    mPlanContainer.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ActivityLauncher.viewBlogPlans(getActivity(), getSelectedSite());
        }
    });
    rootView.findViewById(R.id.row_blog_posts).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ActivityLauncher.viewCurrentBlogPosts(getActivity(), getSelectedSite());
        }
    });
    rootView.findViewById(R.id.row_media).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ActivityLauncher.viewCurrentBlogMedia(getActivity(), getSelectedSite());
        }
    });
    rootView.findViewById(R.id.row_pages).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ActivityLauncher.viewCurrentBlogPages(getActivity(), getSelectedSite());
        }
    });
    rootView.findViewById(R.id.row_comments).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ActivityLauncher.viewCurrentBlogComments(getActivity(), getSelectedSite());
        }
    });
    mThemesContainer.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ActivityLauncher.viewCurrentBlogThemes(getActivity(), getSelectedSite());
        }
    });
    mPeopleView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ActivityLauncher.viewCurrentBlogPeople(getActivity(), getSelectedSite());
        }
    });
    mSettingsView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ActivityLauncher.viewBlogSettingsForResult(getActivity(), getSelectedSite());
        }
    });
    rootView.findViewById(R.id.row_admin).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ActivityLauncher.viewBlogAdmin(getActivity(), getSelectedSite());
        }
    });
    rootView.findViewById(R.id.my_site_add_site_btn).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SitePickerActivity.addSite(getActivity(), mAccountStore.hasAccessToken());
        }
    });
    return rootView;
}
Also used : ViewGroup(android.view.ViewGroup) ImageView(android.widget.ImageView) WPNetworkImageView(org.wordpress.android.widgets.WPNetworkImageView) View(android.view.View) WPTextView(org.wordpress.android.widgets.WPTextView) ScrollView(android.widget.ScrollView)

Aggregations

WPTextView (org.wordpress.android.widgets.WPTextView)13 View (android.view.View)12 ImageView (android.widget.ImageView)6 TextView (android.widget.TextView)6 OnClickListener (android.view.View.OnClickListener)4 ViewGroup (android.view.ViewGroup)4 Bundle (android.os.Bundle)3 Editable (android.text.Editable)2 TextWatcher (android.text.TextWatcher)2 AlertDialog (android.app.AlertDialog)1 DialogInterface (android.content.DialogInterface)1 Intent (android.content.Intent)1 Drawable (android.graphics.drawable.Drawable)1 ActionBar (android.support.v7.app.ActionBar)1 KeyEvent (android.view.KeyEvent)1 LayoutInflater (android.view.LayoutInflater)1 WebView (android.webkit.WebView)1 Button (android.widget.Button)1 EditText (android.widget.EditText)1 ProgressBar (android.widget.ProgressBar)1