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:moose.com.ac.MainActivity.java

private void initView() {
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);/*from ww  w .  j  av a 2  s .c  o  m*/

    final ActionBar ab = getSupportActionBar();
    //noinspection ConstantConditions
    ab.setHomeAsUpIndicator(R.drawable.ic_menu);
    ab.setDisplayHomeAsUpEnabled(true);

    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.drawer_open, R.string.drawer_close);
    mDrawerLayout.setDrawerListener(mDrawerToggle);
    mDrawerToggle.syncState();

    navigationView = (NavigationView) findViewById(R.id.nav_view);
    View drawerHeader = navigationView.inflateHeaderView(R.layout.nav_header);

    if (navigationView != null) {
        setupDrawerContent(navigationView);
    }
    logo = (CircleImageView) drawerHeader.findViewById(R.id.login_userimg);
    userName = (AppCompatTextView) drawerHeader.findViewById(R.id.login_username);
    linearLayout = (LinearLayout) findViewById(R.id.linear_layout);

    TextView textViewComplex = (TextView) findViewById(R.id.tv_complex);
    TextView textViewHot = (TextView) findViewById(R.id.tv_hot);
    TextView textViewWork = (TextView) findViewById(R.id.tv_work);
    TextView textViewAnimation = (TextView) findViewById(R.id.tv_animation);
    TextView textViewCartoon = (TextView) findViewById(R.id.tv_cartoon);
    TextView textViewGame = (TextView) findViewById(R.id.tv_game);

    textViewComplex.setOnClickListener(mOnClickListener);
    textViewHot.setOnClickListener(mOnClickListener);
    textViewWork.setOnClickListener(mOnClickListener);
    textViewAnimation.setOnClickListener(mOnClickListener);
    textViewCartoon.setOnClickListener(mOnClickListener);
    textViewGame.setOnClickListener(mOnClickListener);

}

From source file:com.sft.blackcatapp.SearchCoachActivity.java

private void showPopupWindow(View parent) {
    if (popupWindow == null) {
        View view = View.inflate(mContext, R.layout.pop_window, null);

        TextView c1Car = (TextView) view.findViewById(R.id.pop_window_one);
        c1Car.setText(R.string.c1_automatic_gear_car);
        TextView c2Car = (TextView) view.findViewById(R.id.pop_window_two);
        c2Car.setText(R.string.c2_manual_gear_car);
        c1Car.setOnClickListener(this);
        c2Car.setOnClickListener(this);

        popupWindow = new PopupWindow(view, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    }/* w  w  w  .ja  v a 2  s  .  co  m*/
    popupWindow.setFocusable(true);
    popupWindow.setOutsideTouchable(true);
    // Back???
    popupWindow.setBackgroundDrawable(new BitmapDrawable());

    popupWindow.showAsDropDown(parent);
}

From source file:com.cssweb.android.quote.QHSCGridActivity.java

private void AddViewItem(int paramInt1, LinearLayout paramLinearLayout, int paramInt2, int paramInt3,
        int paramInt4, boolean paramBoolean) {
    TextView localTextView = new TextView(this);
    float f = this.mFontSize;
    localTextView.setTextSize(f);/*www  .  j a  v  a 2 s  . c om*/

    localTextView.setGravity(Gravity.CENTER);
    localTextView.setFocusable(paramBoolean);
    localTextView.setOnClickListener(mClickListener);
    localTextView.setOnLongClickListener(mLongClickListener);
    localTextView.setOnTouchListener(this); // touch
    localTextView.setTag(paramInt2);
    localTextView.setEnabled(paramBoolean);
    localTextView.setSingleLine(true);
    Resources localResources = getResources();
    Drawable localDrawable = null;
    if (paramInt4 == 0 && paramInt3 >= 0) {// 
        int i1 = this.residTitleCol;
        int i8 = 0;
        localTextView.setTextColor(paramInt1);
        if (paramInt3 == 0) {
            localDrawable = localResources.getDrawable(i1);
            i8 = localDrawable.getIntrinsicWidth();
        } else if (paramInt3 == 100) {
            localDrawable = localResources.getDrawable(this.residTitleScrollCol[2]);
            i8 = localDrawable.getIntrinsicWidth();
            i8 += 20;
        } else if (paramInt3 == 13) {
            localDrawable = localResources.getDrawable(this.residTitleScrollCol[0]);
            i8 = localDrawable.getIntrinsicWidth();

        } else if (paramInt3 % 2 == 0) {
            localDrawable = localResources.getDrawable(this.residTitleScrollCol[1]);
            i8 = localDrawable.getIntrinsicWidth();
        } else {
            localDrawable = localResources.getDrawable(this.residTitleScrollCol[0]);
            i8 = localDrawable.getIntrinsicWidth();
        }
        localTextView.setBackgroundDrawable(localDrawable);
        int i6 = localDrawable.getIntrinsicHeight();
        localTextView.setHeight(i6 + CssSystem.getTableTitleHeight(this));
        localTextView.setWidth(i8);
        paramLinearLayout.addView(localTextView);
        return;
    }
    if (paramInt4 != 0 && paramInt3 >= 0) {
        int i8 = 0;
        localTextView.setTextColor(paramInt1);
        if (paramInt3 == 0) {
            localDrawable = localResources.getDrawable(this.residCol);
            i8 = localDrawable.getIntrinsicWidth();
        } else if (paramInt3 == 100) {
            localDrawable = localResources.getDrawable(this.residScrollCol[2]);
            localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
            i8 = localDrawable.getIntrinsicWidth();
            i8 += 20;
        } else if (paramInt3 == 13) {
            localDrawable = localResources.getDrawable(this.residScrollCol[0]);
            localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
            i8 = localDrawable.getIntrinsicWidth();

        } else if (paramInt3 % 2 == 0) {
            localDrawable = localResources.getDrawable(this.residScrollCol[1]);
            localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
            i8 = localDrawable.getIntrinsicWidth();
        } else {
            localDrawable = localResources.getDrawable(this.residScrollCol[0]);
            localTextView.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
            i8 = localDrawable.getIntrinsicWidth();
        }
        localTextView.setBackgroundDrawable(localDrawable);
        int i6 = localDrawable.getIntrinsicHeight();
        localTextView.setHeight(i6 + rowHeight);
        localTextView.setWidth(i8);
        paramLinearLayout.addView(localTextView);
        return;
    }
}

From source file:cs.umass.edu.prepare.view.activities.CalendarActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_calendar);

    // on first run, create dummy data: // TODO : get rid of this when deploying
    SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(this);
    boolean firstRun = p.getBoolean("PREFERENCE_FIRST_RUN", true);
    if (firstRun) {
        Log.i("PrEPare", "Initial run... Creating dummy data...");
        Utils.setDummyAdherenceData(this);
        p.edit().putBoolean("PREFERENCE_FIRST_RUN", false).apply();
    }/*from  www.  j av  a 2  s .  c om*/
    if (preferences == null) {
        preferences = DataIO.getInstance(this);
        preferences.addOnDataChangedListener(
                () -> CalendarActivity.this.runOnUiThread(CalendarActivity.this::refresh));
    }
    loadData();

    Toolbar myToolbar = (Toolbar) findViewById(R.id.my_toolbar);
    setSupportActionBar(myToolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayShowTitleEnabled(false);
        actionBar.setDisplayShowCustomEnabled(true);
    }

    final View v = View.inflate(this, R.layout.menu_item_today, null);

    TextView txtDate = (TextView) v.findViewById(R.id.txt_today);
    txtDate.setText(String.valueOf(today.get(Calendar.DATE)));

    v.setOnClickListener(view -> {
        finish();
        startActivity(getIntent()); // refresh activity
    });

    getSupportActionBar().setCustomView(v);

    adapter = new CalendarAdapter(this, month, selectedDate);
    GridView gridview = (GridView) findViewById(R.id.gridview);
    gridview.setAdapter(adapter);

    handler = new Handler();
    handler.post(calendarUpdater);

    GridView headers = (GridView) findViewById(R.id.gvHeaders);

    ArrayAdapter<String> headersAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1,
            new String[] { "S", "M", "T", "W", "T", "F", "S" });
    headers.setAdapter(headersAdapter);

    TextView title = (TextView) findViewById(R.id.title);
    title.setText(android.text.format.DateFormat.format("MMMM yyyy", month));
    final TextView previous = (TextView) findViewById(R.id.previous);
    previous.setOnClickListener(v13 -> previousMonth());

    TextView next = (TextView) findViewById(R.id.next);
    next.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v1) {
            CalendarActivity.this.nextMonth();
        }
    });

    detailsView = findViewById(R.id.details);

    gridview.setOnItemClickListener((parent, v12, position, id) -> {
        TextView date = (TextView) v12.findViewById(R.id.date);
        if (date != null && !date.getText().equals("")) {
            if (date.getText().toString().equals(String.valueOf(selectedDate.get(Calendar.DATE)))) {
                displayDetailsView = !displayDetailsView;
            } else {
                displayDetailsView = true;
            }
            selectedDate.set(Calendar.MONTH, month.get(Calendar.MONTH));
            selectedDate.set(Calendar.YEAR, month.get(Calendar.YEAR));
            selectedDate.set(Calendar.DATE, Integer.valueOf(date.getText().toString()));
            refresh();
        }
    });

    motionEventListener.setOnSwipeListener(gridview, direction -> {
        if (direction == CustomMotionEventListener.OnSwipeListener.Direction.LEFT) {
            nextMonth();
        } else if (direction == CustomMotionEventListener.OnSwipeListener.Direction.RIGHT) {
            previousMonth();
        }
    });

    //      motionEventListener.setOnSwipeListener(detailsView, onDetailsSwiped);
    //      motionEventListener.setOnSwipeListener(this, onDetailsSwiped);

    if (addressMapping == null) { // TODO
        Intent selectDeviceIntent = new Intent(this, SelectDeviceActivity.class);
        startActivity(selectDeviceIntent);
    }

    new CheckForUpdatesTask(this).execute(true);

    Intent wearableServiceIntent = new Intent(this, WearableService.class);
    wearableServiceIntent.setAction(Constants.ACTION.START_SERVICE);
    startService(wearableServiceIntent);

    Intent dataServiceIntent = new Intent(this, DataService.class);
    dataServiceIntent.setAction(Constants.ACTION.START_SERVICE);
    startService(dataServiceIntent);
}

From source file:palamarchuk.smartlife.app.RegisterActivity.java

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

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);

    setContentView(R.layout.register_activity);

    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);

    dialogAttachCard = new DialogAttachCard(this);
    dialogAttachCard.setObtainResultListener(cardNumberResult);

    cities = new Cities(RegisterActivity.this);

    email = (EditText) findViewById(R.id.register_activity_email);
    password = (EditText) findViewById(R.id.register_activity_password);
    passwordAgain = (EditText) findViewById(R.id.register_activity_password_again);
    phone = (EditText) findViewById(R.id.register_activity_phone);
    registerActivitySecret = (EditText) findViewById(R.id.registerActivitySecret);
    registerActivityCity = (Button) findViewById(R.id.registerActivityCity);
    registerActivityCity.setOnClickListener(cities);

    ETcardNumber = (EditText) findViewById(R.id.registerActivityAttachCard);
    ETcardNumber.setOnClickListener(onCardNumberClick);

    phone.setText("+7(");
    phone.addTextChangedListener(new PhoneValidator(phone));

    name = (EditText) findViewById(R.id.register_activity_name);
    //        name.setInputType(InputType.TYPE_CLASS_TEXT);
    //        name.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);

    lastName = (EditText) findViewById(R.id.register_activity_last_name);
    //        lastName.setInputType(InputType.TYPE_CLASS_TEXT);
    //        lastName.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);

    birthDate = (EditText) findViewById(R.id.register_activity_birthdate);
    birthDate.setOnTouchListener(new View.OnTouchListener() {
        @Override//from   w w w .  jav  a2  s  .c o m
        public boolean onTouch(View v, MotionEvent event) {
            showDialog(DATE_PICKER);
            return true;
        }
    });
    birthDate.setOnFocusChangeListener(new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (hasFocus)
                showDialog(DATE_PICKER);
        }
    });

    Button submit = (Button) findViewById(R.id.register_activity_submit);
    licenseCheckBox = (CheckBox) findViewById(R.id.register_activity_license_agreement);

    TextView licenseAgreementLink = (TextView) findViewById(R.id.register_activity_license_agreement_link);
    licenseAgreementLink.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            openUrl(RegisterActivity.this, ServerRequest.LICENSE);
        }
    });

    //        male = (Button) findViewById(R.id.register_activity_male);
    //        female = (Button) findViewById(R.id.register_activity_female);

    male = (CheckBox) findViewById(R.id.register_activity_checkbox_male);
    male.setChecked(false);
    male.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            male.setChecked(true);
            female.setChecked(false);

            gender = 1;
        }
    });

    female = (CheckBox) findViewById(R.id.register_activity_checkbox_female);
    female.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            female.setChecked(true);
            male.setChecked(false);

            gender = 0;
        }
    });

    sharedPreferences = getSharedPreferences(FragmentHolderActivity.SHARE_PREF_NAME, MODE_PRIVATE);

    email.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                submit();
            }
            return false;
        }
    });

    submit.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            submit();
        }
    });
}

From source file:com.uoit.freeroomfinder.FreeRoom.java

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

    // Add the root view container.
    rootView = inflater.inflate(R.layout.activity_free_room, container, false);

    // Load the shared preferences.
    sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this.getActivity().getBaseContext());

    // Get the current date and time.
    curDate = new Date();

    // Set up default values for the display elements in the fragment.

    // Default campus selection.
    Spinner campus = (Spinner) rootView.findViewById(R.id.campus);
    campus.setSelection(Integer.valueOf(sharedPrefs.getString("default_campus", "0")) - 1);

    // Default booking duration.
    Spinner duration = (Spinner) rootView.findViewById(R.id.duration);
    duration.setSelection(Integer.valueOf(sharedPrefs.getString("default_duration", "0")) - 1);

    // Default time selection.
    timeSpinner = (Spinner) rootView.findViewById(R.id.time);
    // Set the current date to show as Today.
    TextView date = (TextView) rootView.findViewById(R.id.date);
    date.setText(DateTimeUtility.formatDate(curDate) + " (Today)");

    datePicked = DateTimeUtility.formatDate(curDate);

    // Instantiate the list of available rooms.
    availableRooms = new ArrayList<Rooms>();

    // Logic for when a date is clicked on. This initiates the custom date spinner control.
    date.setOnClickListener(new OnClickListener() {
        /*//from   ww  w . java2s . c o  m
         * (non-Javadoc)
         * 
         * @see android.view.View.OnClickListener#onClick(android.view.View)
         */
        @Override
        public void onClick(View v) {
            // parse the date that's currently in there.
            Date d = null;
            try {
                d = DateTimeUtility.parseDate(datePicked);
            } catch (ParseException e) {
                e.printStackTrace();
            }

            Calendar c = Calendar.getInstance();
            // Grab the year, month, and day from the spinners.
            if (d != null) {
                c.setTime(d);
            }
            int yy = c.get(Calendar.YEAR);
            int mm = c.get(Calendar.MONTH);
            int dd = c.get(Calendar.DAY_OF_MONTH);

            DatePickerDialog alert = new DatePickerDialog(rootView.getContext(),

                    /**
                     * Set up the listener for when the date is set from the custom spinner alert
                     * dialog.
                     */
                    new DatePickerDialog.OnDateSetListener() {
                        @Override
                        public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                            // Parse the date - year, month, day.
                            datePicked = year + "-" + (monthOfYear + 1) + "-" + dayOfMonth;
                            TextView date = (TextView) rootView.findViewById(R.id.date);

                            // If the date is today's date, set it to Today.
                            date.setText(datePicked);
                            if (datePicked.contains(DateTimeUtility.formatDate(curDate))) {
                                date.setText(datePicked + " (Today)");
                            }
                        }
                    }, yy, mm, dd);

            alert.show();
        }
    });

    // Add the search buttom.
    Button search = (Button) rootView.findViewById(R.id.search);
    search.setOnClickListener(new OnClickListener() {
        /*
         * (non-Javadoc)
         * 
         * @see android.view.View.OnClickListener#onClick(android.view.View)
         */
        @Override
        public void onClick(View v) {
            // When the search button is pressed, fetch the results.
            Date curDate = new Date();

            Spinner timeSpinner = (Spinner) rootView.findViewById(R.id.time);
            Spinner durationSpinner = (Spinner) rootView.findViewById(R.id.duration);
            Spinner campusSpinner = (Spinner) rootView.findViewById(R.id.campus);

            try {
                // Formulate a query based on the time. If we're using the current time, make
                // sure we use the actual current time rather than "Now" because that's invalid.
                if (timeSpinner.getSelectedItem().toString().compareTo("Now") == 0) {
                    timePicked = DateTimeUtility.formatFullTime(DateTimeUtility.formatTime(curDate));
                } else {
                    timePicked = DateTimeUtility.formatFullTime(timeSpinner.getSelectedItem().toString());
                }

                // Add the campus we've selected to the query.
                campusPicked = rootView.getResources().getStringArray(R.array.campus_names)[campusSpinner
                        .getSelectedItemPosition()];

                // Add the duration of the search to the query.
                durationPicked = Integer.valueOf(durationSpinner.getSelectedItem().toString());

                // Formulate the search task.
                ((MainActivity) FreeRoom.this.getActivity()).showProgress(true);
                searchTask = new SearchTask();
                searchTask
                        .setOnFinshedTaskListener((Results) MainActivity.switchTabs(MainActivity.RESULTS_TAB));
                searchTask.execute();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });

    return rootView;
}

From source file:com.gh4a.activities.IssueActivity.java

private void fillData() {
    // set details inside listview header
    ImageView ivGravatar = (ImageView) mListHeaderView.findViewById(R.id.iv_gravatar);
    AvatarHandler.assignAvatar(ivGravatar, mIssue.getUser());
    ivGravatar.setOnClickListener(this);

    TextView tvState = (TextView) mHeader.findViewById(R.id.tv_state);
    boolean closed = Constants.Issue.STATE_CLOSED.equals(mIssue.getState());
    int stateTextResId = closed ? R.string.closed : R.string.open;
    int stateColorAttributeId = closed ? R.attr.colorIssueClosed : R.attr.colorIssueOpen;

    tvState.setText(getString(stateTextResId).toUpperCase(Locale.getDefault()));
    transitionHeaderToColor(stateColorAttributeId,
            closed ? R.attr.colorIssueClosedDark : R.attr.colorIssueOpenDark);
    UiUtils.trySetListOverscrollColor(mRecyclerView, UiUtils.resolveColor(this, stateColorAttributeId));

    TextView tvExtra = (TextView) mListHeaderView.findViewById(R.id.tv_extra);
    tvExtra.setText(ApiHelpers.getUserLogin(this, mIssue.getUser()));

    TextView tvTimestamp = (TextView) mListHeaderView.findViewById(R.id.tv_timestamp);
    tvTimestamp.setText(StringUtils.formatRelativeTime(this, mIssue.getCreatedAt(), true));

    TextView tvTitle = (TextView) mHeader.findViewById(R.id.tv_title);
    tvTitle.setText(mIssue.getTitle());/* w  w  w.  jav a2  s  .  c  o  m*/

    String body = mIssue.getBodyHtml();
    TextView descriptionView = (TextView) mListHeaderView.findViewById(R.id.tv_desc);
    if (!StringUtils.isBlank(body)) {
        body = HtmlUtils.format(body).toString();
        mImageGetter.bind(descriptionView, body, mIssue.getNumber());
    }
    descriptionView.setMovementMethod(UiUtils.CHECKING_LINK_METHOD);

    View milestoneGroup = mListHeaderView.findViewById(R.id.milestone_container);
    if (mIssue.getMilestone() != null) {
        TextView tvMilestone = (TextView) mListHeaderView.findViewById(R.id.tv_milestone);
        tvMilestone.setText(mIssue.getMilestone().getTitle());
        milestoneGroup.setVisibility(View.VISIBLE);
    } else {
        milestoneGroup.setVisibility(View.GONE);
    }

    View assigneeGroup = mListHeaderView.findViewById(R.id.assignee_container);
    if (mIssue.getAssignee() != null) {
        TextView tvAssignee = (TextView) mListHeaderView.findViewById(R.id.tv_assignee);
        tvAssignee.setText(mIssue.getAssignee().getLogin());

        ImageView ivAssignee = (ImageView) mListHeaderView.findViewById(R.id.iv_assignee);
        AvatarHandler.assignAvatar(ivAssignee, mIssue.getAssignee());
        ivAssignee.setOnClickListener(this);
        assigneeGroup.setVisibility(View.VISIBLE);
    } else {
        assigneeGroup.setVisibility(View.GONE);
    }

    List<Label> labels = mIssue.getLabels();
    View labelGroup = mListHeaderView.findViewById(R.id.label_container);
    if (labels != null && !labels.isEmpty()) {
        TextView labelView = (TextView) mListHeaderView.findViewById(R.id.labels);
        SpannableStringBuilder builder = new SpannableStringBuilder();

        for (Label label : labels) {
            int pos = builder.length();
            IssueLabelSpan span = new IssueLabelSpan(this, label, true);
            builder.append(label.getName());
            builder.setSpan(span, pos, pos + label.getName().length(), 0);
        }
        labelView.setText(builder);
        labelGroup.setVisibility(View.VISIBLE);
    } else {
        labelGroup.setVisibility(View.GONE);
    }

    TextView tvPull = (TextView) mListHeaderView.findViewById(R.id.tv_pull);
    if (mIssue.getPullRequest() != null && mIssue.getPullRequest().getDiffUrl() != null) {
        tvPull.setVisibility(View.VISIBLE);
        tvPull.setOnClickListener(this);
    } else {
        tvPull.setVisibility(View.GONE);
    }

    mHeader.setVisibility(View.VISIBLE);
    updateFabVisibility();
    updateCommentLockState();
}

From source file:com.yomii.view.PagerSlidingTab.java

private void addTextTab(final int position, String title) {

    TextView tab = new TextView(getContext());
    tab.setText(title);//from   w ww. j  a  va 2  s .c  o  m
    tab.setFocusable(true);
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();

    tab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            pager.setCurrentItem(position);
            if (delegateTabClickListener != null)
                delegateTabClickListener.onClick(v);
        }
    });
    tabsContainer.addView(tab);

}

From source file:cn.com.zzwfang.view.indicator.PagerSlidingTabStrip.java

private void addTextTab(final int position, String title) {

    TextView tab = new TextView(getContext());
    tab.setLayoutParams(getLayoutParams());
    tab.setText(title);/* ww w  .ja va2s. co  m*/
    tab.setFocusable(true);
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();

    tab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            pager.setCurrentItem(position);
        }
    });

    tabsContainer.addView(tab);

}

From source file:com.android.mms.rcs.FavoriteDetailAdapter.java

private void initTextMsgView(final TextView bodyText) {
    bodyText.setText(//from   w  ww  . jav  a  2 s  . co  m
            mCursor.getString(mCursor.getColumnIndexOrThrow(FavoriteMessageProvider.FavoriteMessage.CONTENT)));
    bodyText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mBodyFontSize);
    bodyText.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
    bodyText.setTextIsSelectable(true);
    bodyText.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            MessageUtils.onMessageContentClick(mContext, bodyText);
        }
    });
}