Example usage for android.widget TextView setOnClickListener

List of usage examples for android.widget TextView setOnClickListener

Introduction

In this page you can find the example usage for android.widget TextView setOnClickListener.

Prototype

public void setOnClickListener(@Nullable OnClickListener l) 

Source Link

Document

Register a callback to be invoked when this view is clicked.

Usage

From source file:eu.inmite.apps.smsjizdenka.framework.about.OpenSourceAdapter.java

private void openPlayServices(TextView textView) {
    textView.setPaintFlags(textView.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
    textView.setOnClickListener(new View.OnClickListener() {

        @Override/*from w w w.jav a 2  s .c o  m*/
        public void onClick(View v) {
            PlayServicesLicenceDialogFragment.show(mFragmentManager);
        }
    });
}

From source file:com.example.drawerarrowdrawable.DrawerArrowSample.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.home_view);/*from   ww w  .jav  a  2  s .  com*/

    final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    final ImageView imageView = (ImageView) findViewById(R.id.drawer_indicator);
    final Resources resources = getResources();

    drawerArrowDrawable = new DrawerArrowDrawable(resources);
    drawerArrowDrawable.setStrokeColor(resources.getColor(R.color.light_gray));
    imageView.setImageDrawable(drawerArrowDrawable);

    drawer.setDrawerListener(new DrawerLayout.SimpleDrawerListener() {
        @Override
        public void onDrawerSlide(View drawerView, float slideOffset) {
            offset = slideOffset;

            // Sometimes slideOffset ends up so close to but not quite 1 or 0.
            if (slideOffset >= .995) {
                flipped = true;
                drawerArrowDrawable.setFlip(flipped);
            } else if (slideOffset <= .005) {
                flipped = false;
                drawerArrowDrawable.setFlip(flipped);
            }

            drawerArrowDrawable.setParameter(offset);
        }
    });

    imageView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (drawer.isDrawerVisible(START)) {
                drawer.closeDrawer(START);
            } else {
                drawer.openDrawer(START);
            }
        }
    });

    final TextView styleButton = (TextView) findViewById(R.id.indicator_style);
    styleButton.setOnClickListener(new View.OnClickListener() {
        boolean rounded = false;

        @Override
        public void onClick(View v) {
            styleButton.setText(rounded //
                    ? resources.getString(R.string.rounded) //
                    : resources.getString(R.string.squared));

            rounded = !rounded;

            drawerArrowDrawable = new DrawerArrowDrawable(resources, rounded);
            drawerArrowDrawable.setParameter(offset);
            drawerArrowDrawable.setFlip(flipped);
            drawerArrowDrawable.setStrokeColor(resources.getColor(R.color.light_gray));

            imageView.setImageDrawable(drawerArrowDrawable);
        }
    });
}

From source file:mobi.cangol.mobile.uiframe.demo.Main2Activity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.home_view);//  w  ww.  j a v  a  2  s .  c  om

    final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    final ImageView imageView = (ImageView) findViewById(R.id.drawer_indicator);
    final Resources resources = getResources();

    drawerArrowDrawable = new DrawerArrowDrawable(resources);
    drawerArrowDrawable.setStrokeColor(resources.getColor(R.color.light_gray));
    imageView.setImageDrawable(drawerArrowDrawable);

    drawer.setDrawerListener(new DrawerLayout.SimpleDrawerListener() {
        @Override
        public void onDrawerSlide(View drawerView, float slideOffset) {
            offset = slideOffset;

            // Sometimes slideOffset ends up so close to but not quite 1 or
            // 0.
            if (slideOffset >= .995) {
                flipped = true;
                drawerArrowDrawable.setFlip(flipped);
            } else if (slideOffset <= .005) {
                flipped = false;
                drawerArrowDrawable.setFlip(flipped);
            }

            drawerArrowDrawable.setParameter(offset);
        }
    });

    imageView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (drawer.isDrawerVisible(START)) {
                drawer.closeDrawer(START);
            } else {
                drawer.openDrawer(START);
            }
        }
    });

    final TextView styleButton = (TextView) findViewById(R.id.indicator_style);
    styleButton.setOnClickListener(new View.OnClickListener() {
        boolean rounded = false;

        @Override
        public void onClick(View v) {
            styleButton.setText(rounded //
                    ? resources.getString(R.string.rounded) //
                    : resources.getString(R.string.squared));

            rounded = !rounded;

            drawerArrowDrawable = new DrawerArrowDrawable(resources, rounded);
            drawerArrowDrawable.setParameter(offset);
            drawerArrowDrawable.setFlip(flipped);
            drawerArrowDrawable.setStrokeColor(resources.getColor(R.color.light_gray));

            imageView.setImageDrawable(drawerArrowDrawable);
        }
    });
}

From source file:cn.flyrise.android3.test.graphic.DrawerArrowSample.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.home_view);/*from  www.  j  a  v  a 2  s.com*/

    final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    final ImageView imageView = (ImageView) findViewById(R.id.drawer_indicator);
    final Resources resources = getResources();

    drawerArrowDrawable = new DrawerArrowDrawable(resources);
    drawerArrowDrawable.setStrokeColor(resources.getColor(R.color.light_gray));
    imageView.setImageDrawable(drawerArrowDrawable);

    drawer.setDrawerListener(new DrawerLayout.SimpleDrawerListener() {
        @Override
        public void onDrawerSlide(View drawerView, float slideOffset) {
            Log.e("Test", "slideOffset==" + slideOffset);
            offset = slideOffset;

            // Sometimes slideOffset ends up so close to but not quite 1 or 0.
            if (slideOffset >= .995) {
                flipped = true;
                drawerArrowDrawable.setFlip(flipped);
            } else if (slideOffset <= .005) {
                flipped = false;
                drawerArrowDrawable.setFlip(flipped);
            }

            drawerArrowDrawable.setParameter(offset);
        }
    });

    imageView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (drawer.isDrawerVisible(START)) {
                drawer.closeDrawer(START);
            } else {
                drawer.openDrawer(START);
            }
        }
    });

    final TextView styleButton = (TextView) findViewById(R.id.indicator_style);
    styleButton.setOnClickListener(new View.OnClickListener() {
        boolean rounded = false;

        @Override
        public void onClick(View v) {
            styleButton.setText(rounded //
                    ? resources.getString(R.string.rounded) //
                    : resources.getString(R.string.squared));

            rounded = !rounded;

            drawerArrowDrawable = new DrawerArrowDrawable(resources, rounded);
            drawerArrowDrawable.setParameter(offset);
            drawerArrowDrawable.setFlip(flipped);
            drawerArrowDrawable.setStrokeColor(resources.getColor(R.color.light_gray));

            imageView.setImageDrawable(drawerArrowDrawable);
        }
    });
}

From source file:com.grottworkshop.gwsdrawerdrawableapp.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.home_view);//from w  w w  . ja  v  a  2s.  c om

    final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    final ImageView imageView = (ImageView) findViewById(R.id.drawer_indicator);
    final Resources resources = getResources();

    drawerArrowDrawable = new DrawerArrowDrawable(resources);
    drawerArrowDrawable.setStrokeColor(resources.getColor(R.color.light_gray));
    imageView.setImageDrawable(drawerArrowDrawable);

    drawer.setDrawerListener(new DrawerLayout.SimpleDrawerListener() {
        @Override
        public void onDrawerSlide(View drawerView, float slideOffset) {
            offset = slideOffset;

            // Sometimes slideOffset ends up so close to but not quite 1 or 0.
            if (slideOffset >= .995) {
                flipped = true;
                drawerArrowDrawable.setFlip(flipped);
            } else if (slideOffset <= .005) {
                flipped = false;
                drawerArrowDrawable.setFlip(flipped);
            }

            drawerArrowDrawable.setParameter(offset);
        }
    });

    imageView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (drawer.isDrawerVisible(GravityCompat.START)) {
                drawer.closeDrawer(GravityCompat.START);
            } else {
                drawer.openDrawer(GravityCompat.START);
            }
        }
    });

    final TextView styleButton = (TextView) findViewById(R.id.indicator_style);
    styleButton.setOnClickListener(new View.OnClickListener() {
        boolean rounded = false;

        @Override
        public void onClick(View v) {
            styleButton.setText(rounded //
                    ? resources.getString(R.string.rounded) //
                    : resources.getString(R.string.squared));

            rounded = !rounded;

            drawerArrowDrawable = new DrawerArrowDrawable(resources, rounded);
            drawerArrowDrawable.setParameter(offset);
            drawerArrowDrawable.setFlip(flipped);
            drawerArrowDrawable.setStrokeColor(resources.getColor(R.color.light_gray));

            imageView.setImageDrawable(drawerArrowDrawable);
        }
    });
}

From source file:com.nextgis.libngui.fragment.NGIDLoginFragment.java

@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.fragment_ngid_login, container, false);
    mLogin = (EditText) view.findViewById(R.id.login);
    mPassword = (EditText) view.findViewById(R.id.password);
    mSignInButton = (Button) view.findViewById(R.id.signin);
    mSignInButton.setOnClickListener(this);
    TextView signUp = (TextView) view.findViewById(R.id.signup);
    signUp.setText(signUp.getText().toString().toUpperCase());
    signUp.setOnClickListener(this);
    return view;/*from   w  w w . ja va  2s .c o m*/
}

From source file:de.persoapp.android.activity.dialog.AboutDialog.java

@SuppressWarnings("ConstantConditions")
@Override//from  w  w  w  .j a v a  2  s  . c  o m
public Dialog onCreateDialog(Bundle savedInstanceState) {

    setCancelable(true);

    DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            switch (which) {
            case DialogInterface.BUTTON_POSITIVE:
                startActivity(new Intent(getActivity(), LicenseActivity.class));
                break;
            }
        }
    };

    View view = LayoutInflater.from(getActivity()).inflate(R.layout.dialog_about, null);

    TextView versionTextView = (TextView) view.findViewById(R.id.textView_version);
    versionTextView.setText(getString(R.string.version_string, getVersionName()));

    TextView homepageTextView = (TextView) view.findViewById(R.id.textview_homepage);
    homepageTextView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.persoapp.de")));
        }
    });

    return new AlertDialog.Builder(getActivity()).setTitle(R.string.app_name).setIcon(R.drawable.ic_launcher)
            .setView(view).setNegativeButton(R.string.close, null)
            .setPositiveButton(R.string.licenses, onClickListener).create();
}

From source file:com.facebook.getrecommendations.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    GetAppsApplication application = (GetAppsApplication) getApplication();
    final AppEventsLogger appEventsLogger = application.getLogger();
    mAppEventsCustomLogger = appEventsLogger;

    setContentView(R.layout.activity_main);

    final TextView adChoices = (TextView) findViewById(R.id.ad_choices);
    final FragmentActivity act = this;
    adChoices.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            appEventsLogger.logEvent(Utils.AD_CHOICES_TAP_EVENT);
            InfoDialog.showWebDialog(act, R.string.ad_choices_url);
        }//from w  w  w  .j av  a 2s.c  om
    });
    showNux(act);
}

From source file:com.telestax.mayday_customer.fragment.CustomerSupportFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View viewInfo = inflater.inflate(R.layout.customer_support, container, false);

    // Initialize UI
    mImageViewCustomerMayDayCall = (ImageView) viewInfo.findViewById(R.id.imageView_customer_two_mayday);
    ImageView imageViewCustomerSupportBack = (ImageView) viewInfo
            .findViewById(R.id.imageView_customer_support_back);

    TextView textViewSupport = (TextView) viewInfo.findViewById(R.id.customer_support);
    textViewSupport.setOnClickListener(this);
    mImageViewCustomerMayDayCall.setOnClickListener(this);
    imageViewCustomerSupportBack.setOnClickListener(this);

    String mayDayAction = MainActivity.getMaydaySharePref(getActivity());
    if (mayDayAction != null) {
        if (mayDayAction.equalsIgnoreCase(Constant.YES)) {
            mImageViewCustomerMayDayCall.setVisibility(View.INVISIBLE);
        } else {/* w w  w.j  a  v a  2 s. co  m*/
            mImageViewCustomerMayDayCall.setVisibility(View.VISIBLE);
        }
    }

    mInitReceiver = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            mImageViewCustomerMayDayCall.setVisibility(View.VISIBLE);
        }
    };

    //Register broadcast receiver
    LocalBroadcastManager.getInstance(getActivity()).registerReceiver(mInitReceiver,
            new IntentFilter(Constant.BROADCAST_INTENT));
    return viewInfo;
}

From source file:id.zelory.tanipedia.activity.LoginActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    if (PrefUtils.ambilString(this, "nama") != null) {
        Intent intent = new Intent(LoginActivity.this, CuacaActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
        startActivity(intent);/* ww w  . j  av a  2s  . com*/
    }

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

    Animation animation = AnimationUtils.loadAnimation(this, R.anim.simple_grow);
    findViewById(R.id.tanipedia).startAnimation(animation);
    findViewById(R.id.card).startAnimation(animation);
    Button login = (Button) findViewById(R.id.login);
    login.startAnimation(animation);
    login.setOnClickListener(this);
    TextView daftar = (TextView) findViewById(R.id.register);
    daftar.startAnimation(animation);
    daftar.setOnClickListener(this);
    editEmail = (EditText) findViewById(R.id.email);
    editPass = (EditText) findViewById(R.id.password);
}