Search in sources :

Example 11 with WPTextView

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

the class HelpActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ((WordPress) getApplication()).component().inject(this);
    initHelpshiftLayout();
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setHomeAsUpIndicator(R.drawable.ic_cross_white_24dp);
        actionBar.setHomeButtonEnabled(true);
        actionBar.setDisplayHomeAsUpEnabled(true);
        //remove shadow
        actionBar.setElevation(0);
    }
    // Init common elements
    WPTextView version = (WPTextView) findViewById(R.id.nux_help_version);
    version.setText(getString(R.string.version) + " " + WordPress.versionName);
    WPTextView applogButton = (WPTextView) findViewById(R.id.applog_button);
    applogButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            startActivity(new Intent(v.getContext(), AppLogViewerActivity.class));
        }
    });
}
Also used : OnClickListener(android.view.View.OnClickListener) WPTextView(org.wordpress.android.widgets.WPTextView) Intent(android.content.Intent) View(android.view.View) WPTextView(org.wordpress.android.widgets.WPTextView) ActionBar(android.support.v7.app.ActionBar)

Example 12 with WPTextView

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

the class SignInDialogFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    getDialog().getWindow().setBackgroundDrawable(getResources().getDrawable(R.color.nux_alert_bg));
    View v = inflater.inflate(R.layout.signin_dialog_fragment, container, false);
    mImageView = (ImageView) v.findViewById(R.id.nux_dialog_image);
    mTitleTextView = (WPTextView) v.findViewById(R.id.nux_dialog_title);
    mDescriptionTextView = (WPTextView) v.findViewById(R.id.nux_dialog_description);
    mFooterBottomButton = (WPTextView) v.findViewById(R.id.nux_dialog_first_button);
    mFooterTopButton = (WPTextView) v.findViewById(R.id.nux_dialog_third_button);
    mFooterCenterButton = (WPTextView) v.findViewById(R.id.nux_dialog_second_button);
    final Bundle arguments = getArguments();
    mTitleTextView.setText(arguments.getString(ARG_TITLE));
    mDescriptionTextView.setText(arguments.getString(ARG_DESCRIPTION));
    mImageView.setImageResource(arguments.getInt(ARG_IMAGE));
    View.OnClickListener clickListenerDismiss = new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            dismissAllowingStateLoss();
        }
    };
    View.OnClickListener clickListenerSecondButton = new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            onClickAction(v, arguments.getInt(ARG_SECOND_BUTTON_ACTION, 0), arguments);
        }
    };
    View.OnClickListener clickListenerThirdButton = new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            onClickAction(v, arguments.getInt(ARG_THIRD_BUTTON_ACTION, 0), arguments);
        }
    };
    switch(arguments.getInt(ARG_NUMBER_OF_BUTTONS, 1)) {
        case 1:
            // One button: we keep only the centered button
            mFooterCenterButton.setText(arguments.getString(ARG_FIRST_BUTTON_LABEL));
            mFooterCenterButton.setOnClickListener(clickListenerDismiss);
            mFooterBottomButton.setVisibility(View.GONE);
            mFooterTopButton.setVisibility(View.GONE);
            break;
        case 2:
            // Two buttons: we keep only the left and right buttons
            mFooterBottomButton.setText(arguments.getString(ARG_FIRST_BUTTON_LABEL));
            mFooterTopButton.setText(arguments.getString(ARG_SECOND_BUTTON_LABEL));
            mFooterCenterButton.setVisibility(View.GONE);
            mFooterTopButton.setOnClickListener(clickListenerSecondButton);
            break;
        case 3:
            mFooterBottomButton.setText(arguments.getString(ARG_FIRST_BUTTON_LABEL));
            mFooterCenterButton.setText(arguments.getString(ARG_SECOND_BUTTON_LABEL));
            mFooterCenterButton.setOnClickListener(clickListenerSecondButton);
            mFooterTopButton.setText(arguments.getString(ARG_THIRD_BUTTON_LABEL));
            mFooterTopButton.setOnClickListener(clickListenerThirdButton);
            break;
    }
    v.setClickable(true);
    v.setOnClickListener(clickListenerDismiss);
    mFooterBottomButton.setOnClickListener(clickListenerDismiss);
    return v;
}
Also used : Bundle(android.os.Bundle) ImageView(android.widget.ImageView) View(android.view.View) WPTextView(org.wordpress.android.widgets.WPTextView)

Example 13 with WPTextView

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

the class PromoDialog method onViewCreated.

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    Button btn = (Button) view.findViewById(R.id.promo_dialog_cancel_button);
    btn.setText(mButtonLabelId);
    ImageView image = (ImageView) view.findViewById(R.id.promo_dialog_image);
    Drawable drawable = VectorDrawableCompat.create(getResources(), mDrawableId, null);
    image.setImageDrawable(drawable);
    WPTextView title = (WPTextView) view.findViewById(R.id.promo_dialog_title);
    title.setText(mTitleId);
    WPTextView desc = (WPTextView) view.findViewById(R.id.promo_dialog_description);
    desc.setText(mDescriptionId);
    btn.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            getDialog().cancel();
        }
    });
}
Also used : Button(android.widget.Button) Drawable(android.graphics.drawable.Drawable) WPTextView(org.wordpress.android.widgets.WPTextView) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) View(android.view.View) WPTextView(org.wordpress.android.widgets.WPTextView)

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