Example usage for android.widget TextView setClickable

List of usage examples for android.widget TextView setClickable

Introduction

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

Prototype

public void setClickable(boolean clickable) 

Source Link

Document

Enables or disables click events for this view.

Usage

From source file:Main.java

private static void createLink(View v, int id, String html) {
    TextView textView = (TextView) v.findViewById(id);
    textView.setClickable(true);
    textView.setMovementMethod(LinkMovementMethod.getInstance());
    textView.setText(Html.fromHtml(html));
}

From source file:com.prasanna.android.stacknetwork.utils.MarkdownFormatter.java

private static void addImgLinkText(final Context context, ArrayList<View> views, final String url,
        LinearLayout.LayoutParams params) {
    final TextView textView = new TextView(context);
    textView.setTextColor(Color.BLUE);
    textView.setLayoutParams(params);/* w  w w  . j a  v  a 2  s.co m*/
    textView.setText("View image");
    textView.setTextSize(getTextSize(context));
    textView.setPadding(3, 3, 3, 3);
    textView.setTag(url);
    textView.setClickable(true);
    setupOnLinkClick(context, url, textView);
    views.add(textView);
}

From source file:com.example.dididoit.app.MainActivity.java

private TextView makeFooter() {
    TextView foot = new TextView(this);
    foot.setText("Add new item");
    foot.setClickable(true);
    foot.setOnClickListener(new View.OnClickListener() {
        @Override//  ww  w  .jav  a2  s .c  o  m
        public void onClick(View v) {
            DialogFragment dialog = new NewItemDialogFragment();
            dialog.show(dialog.getFragmentManager(), "NewItemDialogFragment");
        }
    });
    return foot;
}

From source file:com.android.settings.widget.FooterPreference.java

@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
    super.onBindViewHolder(holder);
    TextView title = holder.itemView.findViewById(android.R.id.title);
    title.setMovementMethod(new LinkMovementMethod());
    title.setClickable(false);
    title.setLongClickable(false);/*from   w w w  .j  a  v  a 2s .  c  om*/
}

From source file:me.sudar.zxingorient.demo.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);// ww w  . j a v  a2s.c o  m

    resultTextView = (TextView) findViewById(R.id.result_text_view);
    shareEditText = (EditText) findViewById(R.id.encodeEditText);
    findViewById(R.id.button_1).setOnClickListener(this);
    findViewById(R.id.button_2).setOnClickListener(this);
    findViewById(R.id.button_3).setOnClickListener(this);
    findViewById(R.id.button_4).setOnClickListener(this);
    findViewById(R.id.button_5).setOnClickListener(this);

    TextView textView = (TextView) findViewById(R.id.github_link);
    textView.setClickable(true);
    textView.setMovementMethod(LinkMovementMethod.getInstance());
    String text = "Check out the <a href='https://github.com/SudarAbisheck/ZXing-Orient'>Github Repo !!</a>";
    textView.setText(Html.fromHtml(text));

    if (ContextCompat.checkSelfPermission(this,
            Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
        requestCameraPermission();
    }

}

From source file:com.ibm.helloauthentication.MainActivity.java

/**
 * Called when ping bluemix button is pressed.
 * Attempts to access protected Bluemix backend, kicking off the Authentication login prompt.
 * @param view the button pressed./*w w w  . j  av a  2  s.  c om*/
 */
public void pingBluemix(View view) {

    TextView buttonText = (TextView) findViewById(R.id.button_text);
    buttonText.setClickable(false);

    TextView responseText = (TextView) findViewById(R.id.response_text);
    responseText.setText(R.string.Connecting);

    Log.i(TAG, "Attempting to Connect");

    // Testing the connection to Bluemix by attempting to obtain an authorization header, using this Activity to handle the response.
    BMSClient.getInstance().getAuthorizationManager().obtainAuthorization(this, this);
    // As an alternative, you can send a Get request using the Bluemix Mobile Services Core sdk to send the request to a protected resource on the Node.js application to kick off Authentication. See example below:
    // new Request(<YOUR_BLUEMIX_APP_ROUTE> + "/protected", Request.GET).send(this, this); TODO: Replace <YOUR_BLUEMIX_APP_ROUTE> with your appRoute on Bluemix
    // The Node.js code was provided in the MobileFirst Services Starter boilerplate.
}

From source file:com.ibm.helloauthentication.MainActivity.java

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[],
        @NonNull int[] grantResults) {
    switch (requestCode) {
    case PERMISSION_REQUEST_GET_ACCOUNTS: {
        TextView buttonText = (TextView) findViewById(R.id.button_text);
        if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
            buttonText.setClickable(true);

        } else {//from   w ww  .j a  v  a 2  s . c om
            setStatus("Unable to authorize without full permissions. \nPlease retry with permissions enabled.",
                    false);
            buttonText.setClickable(false);
        }
    }
    }
}

From source file:ecust.news.myWidgetTabPageIndicator.java

public TextView decorateTextView(TextView textView) {
    textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, Global.dimenConvert.dip2px(20));
    textView.setSingleLine();//  w  ww .j  a  va  2s  .  c  o  m
    textView.setTextColor(textViewUnfocusedColor);
    textView.setFocusable(true);
    textView.setClickable(true);

    //Padding
    final int paddingLeftRight = Global.dimenConvert.dip2px(12);
    final int paddingTop = Global.dimenConvert.dip2px(8);
    final int paddingBottom = Global.dimenConvert.dip2px(0);
    textView.setPadding(paddingLeftRight, paddingTop, paddingLeftRight, paddingBottom);

    return textView;
}

From source file:de.measite.contactmerger.MergeActivity.java

public void updateList() {
    progressContainer = findViewById(R.id.progress_bar_container);
    progressBar = (ProgressBar) findViewById(R.id.analyze_progress);
    progressContainer.setVisibility(View.GONE);

    loadText = (TextView) findViewById(R.id.load_text);

    TextView stopScan = (TextView) findViewById(R.id.stop_scan);
    Typeface font = Typeface.createFromAsset(getAssets(), "fontawesome-webfont.ttf");
    stopScan.setTypeface(font);/*  w  w  w  .  j  ava2  s . c  o m*/
    stopScan.setClickable(true);
    stopScan.setOnClickListener(this);

    startScan = (Button) findViewById(R.id.start_scan);
    startScan.setOnClickListener(this);

    ViewSwitcher switcher = (ViewSwitcher) findViewById(R.id.switcher);
    ViewSwitcher switcher_list = (ViewSwitcher) findViewById(R.id.switcher_list);

    Context context = getApplicationContext();
    File path = context.getDatabasePath("contactsgraph");
    File modelFile = new File(path, "model.kryo.gz");

    if (path.exists() && modelFile.exists()) {
        this.adapter.update();
        while (switcher.getCurrentView().getId() != R.id.switcher_list) {
            switcher.showNext();
        }
        if (adapter.getCount() == 0) {
            while (switcher_list.getCurrentView().getId() != R.id.all_done) {
                switcher_list.showNext();
            }
        } else {
            while (switcher_list.getCurrentView().getId() != R.id.contact_merge_list) {
                switcher_list.showPrevious();
            }
        }
        switcher_list.postInvalidate();
    } else {
        if (switcher.getCurrentView().getId() == R.id.contact_merge_list) {
            switcher.showPrevious();
        }
        Intent intent = new Intent(getApplicationContext(), AnalyzerService.class);
        intent.putExtra("forceRunning", true);
        startService(intent);
    }
    switcher.postInvalidate();
}

From source file:org.bdigi.andy.MainActivity.java

private Fragment[] getModeFragments() {

    final Context ctx = MainActivity.this;

    Mode modes[] = getModes();/*w w w  .j a va 2 s.  c  o  m*/
    Fragment frags[] = new Fragment[modes.length];
    for (int i = 0; i < modes.length; i++) {
        final Mode mode = modes[i];
        Fragment frag = new Fragment() {

            @Override
            public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
                LinearLayout layout = new LinearLayout(ctx);
                layout.setOrientation(LinearLayout.VERTICAL);
                TextView title = new TextView(ctx);
                title.setClickable(true);
                title.setOnClickListener(new OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        setMode(mode);
                    }
                });
                title.setText("Mode: " + mode.name());
                title.setTextAppearance(ctx, R.style.Title);
                layout.addView(title);

                Seq<Property<?>> props = mode.properties().properties();

                for (int i = 0; i < props.size(); i++) {
                    Property p = props.apply(i);

                    if (p instanceof BooleanProperty) {
                        layout.addView(new PropWidget.BooleanPropertyWidget(ctx, (BooleanProperty) p));
                    } else if (p instanceof RadioProperty) {
                        layout.addView(new PropWidget.RadioPropertyWidget(ctx, (RadioProperty) p));
                    }
                }
                return layout;
            }
        };
        frags[i] = frag;
    }
    return frags;
}