List of usage examples for android.widget TextView setOnClickListener
public void setOnClickListener(@Nullable OnClickListener l)
From source file:com.micabytes.app.BaseFragment.java
@Nullable protected TextView setTextView(int resId, Typeface font) throws UIObjectNotFoundException { View root = getView();//from w w w. j a v a2s.co m if (root == null) throw new UIObjectNotFoundException("No getView in setTextView(int)"); TextView t = (TextView) root.findViewById(resId); if (t == null) throw new UIObjectNotFoundException(COULD_NOT_FIND_RES_ID + resId + IN_FIND_VIEW_BY_ID); if (font != null) t.setTypeface(font); t.setOnClickListener(this); return t; }
From source file:me.futuretechnology.blops.ui.BookmarksFragment.java
private void initUI() { // start out with a progress indicator setListShownNoAnimation(false);/*from www .j av a2 s . com*/ ListView listView = getListView(); listView.setVelocityScale(2.0f); FeedsManager feedsManager = FeedsManager.getInstance(); setEmptyText(getText(feedsManager.getFeedsCount() > 0 ? R.string.empty_bookmarks : R.string.add_feed_info)); TextView tvEmpty = (TextView) listView.getEmptyView(); tvEmpty.setTextAppearance(getActivity(), R.style.TextAppearance_AppCompat_Title); TypedValue typedValue = new TypedValue(); Resources.Theme theme = getActivity().getTheme(); theme.resolveAttribute(android.R.attr.textColorSecondary, typedValue, true); tvEmpty.setTextColor(getResources().getColor(typedValue.resourceId)); if (feedsManager.getFeedsCount() == 0) { tvEmpty.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent iAdd = new Intent(getActivity(), AddFeedActivity.class); getActivity().startActivityForResult(iAdd, 101); } }); } }
From source file:com.gdpi.app.UpdateManager.java
/** * ?//from w ww . j a v a 2s.c o m */ private void showNoticeDialog() { updateinfo = updateinfo.replaceAll("#", "<br/>"); final TextView text = new TextView(mContext);// text.setGravity(Gravity.LEFT | Gravity.CENTER); text.setTextSize(16); text.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (noticeDialog != null) { noticeDialog.dismiss(); noticeDialog = null; } Intent intent = new Intent(); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setAction(Intent.ACTION_VIEW); intent.setData(Uri.parse(Url)); mContext.startActivity(intent); } }); text.setText(Html.fromHtml("<a href=" + Url + ">" + updateinfo + "</a>")); noticeDialog = AlertUtils.showAlertBtn(mContext, text, "APP???", "?", "??", new View.OnClickListener() { @Override public void onClick(View v) { showDownloadDialog(); noticeDialog.dismiss(); noticeDialog = null; } }, new View.OnClickListener() { @Override public void onClick(View v) { noticeDialog.dismiss(); noticeDialog = null; } }); }
From source file:cn.com.hgh.view.SlideSwitch.java
protected void switchBusinessStatus() { View layout = LayoutInflater.from(context).inflate(R.layout.dialog_delete, null); TextView tv_dialogtext = (TextView) layout.findViewById(R.id.tv_dialogtext); TextView tv_delete_cancle = (TextView) layout.findViewById(R.id.tv_delete_cancle); TextView tv_delete_ok = (TextView) layout.findViewById(R.id.tv_delete_ok); tv_dialogtext.setText("???"); ers = showDioag(this, layout); tv_delete_cancle.setOnClickListener(new OnClickListener() { @Override//from ww w.ja v a 2 s . c om public void onClick(View arg0) { ers.dismiss(); } }); tv_delete_ok.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { listener.setUpDate(); moveToDest(toRight); ers.dismiss(); } }); }
From source file:com.normalexception.app.rx8club.view.profile.ProfileViewArrayAdapter.java
public View getView(int position, View convertView, ViewGroup parent) { View vi = convertView;/* w w w . jav a2 s.com*/ if (vi == null) { vi = new TextView(sourceFragment.getActivity()); } TextView tv = (TextView) vi; final ProfileModel pm = data.get(position); String text = String.format("%s\n%s", pm.getName(), pm.getText()); SpannableString spanString = new SpannableString(text); spanString.setSpan(new StyleSpan(Typeface.BOLD), 0, text.indexOf("\n"), 0); spanString.setSpan(new StyleSpan(Typeface.ITALIC), text.indexOf("\n") + 1, text.length(), 0); tv.setText(spanString); tv.setPadding(1, 10, 1, 10); tv.setBackgroundColor(Color.DKGRAY); tv.setTextColor(Color.WHITE); tv.setTextSize(10); tv.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Bundle args = new Bundle(); args.putString("link", pm.getLink()); args.putString("title", pm.getName()); FragmentUtils.fragmentTransaction(sourceFragment.getActivity(), ThreadFragment.newInstance(), false, true, args); } }); return vi; }
From source file:liqui.droid.activity.LiquiDroid.java
@SuppressWarnings("deprecation") @Override/*from w w w. ja v a 2 s.c o m*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getIntent().getAction() != null && getIntent().getAction().equals(getString(R.string.action_login_sync))) { // we create a new account } else { Cursor c = getContentResolver().query(ACCOUNT_CONTENT_URI, null, "last_active = 1", null, null); c.moveToFirst(); if (!c.isAfterLast()) { mApiName = c.getString(c.getColumnIndex(DBSystem.Account.COLUMN_NAME)); mApiUrl = c.getString(c.getColumnIndex(DBSystem.Account.COLUMN_URL)); mMemberId = c.getString(c.getColumnIndex(DBSystem.Account.COLUMN_MEMBER_ID)); mSessionKey = c.getString(c.getColumnIndex(DBSystem.Account.COLUMN_SESSION_KEY)); Log.d("XXX", "loading old session: " + mMemberId + "@" + mApiName); } c.close(); } if (isAuthenticated()) { Intent intent = new Intent().setClass(LiquiDroid.this, MemberActivity.class); Bundle extras = new Bundle(); extras.putString(Constants.Account.API_NAME, getAPIName()); extras.putString(Constants.Account.API_URL, getAPIUrl()); extras.putString(Constants.Account.MEMBER_ID, getMemberId()); extras.putString(Constants.Account.SESSION_KEY, getSessionKey()); intent.putExtras(extras); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); finish(); return; } setContentView(R.layout.act_main); /* ActionBar actionBar = (ActionBar) findViewById(R.id.actionbar); actionBar.addAction(new IntentAction(this, new Intent(getApplicationContext(), Search.class), R.drawable.ic_search)); */ mSpinnerLQFBs = (Spinner) findViewById(R.id.sp_lqfb_instance); mAdapter = new SimpleCursorAdapter(this, android.R.layout.simple_spinner_item, null, new String[] { DBSystem.Instance.COLUMN_NAME, DBSystem.Instance.COLUMN_ID }, new int[] { android.R.id.text1 }); mAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mSpinnerLQFBs.setAdapter(mAdapter); mSpinnerLQFBs.setOnItemSelectedListener(this); mEditTextApiKey = (EditText) findViewById(R.id.et_api_token); mEditTextApiKey.addTextChangedListener(mPasswortTextWatcher); mButtonLogin = (Button) findViewById(R.id.btn_login); mButtonLogin.setEnabled(false); mButtonLogin.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Cursor c = (Cursor) mSpinnerLQFBs.getSelectedItem(); if (c == null) return; mApiUrl = c.getString(c.getColumnIndex(DBSystem.Instance.COLUMN_URL)); mApiName = c.getString(c.getColumnIndex(DBSystem.Instance.COLUMN_NAME)); hideKeyboard(mButtonLogin.getWindowToken()); String key = mEditTextApiKey.getText().toString().trim(); new LoginTask(LiquiDroid.this).execute(getAPIName(), getAPIUrl(), key); } }); TextView tvExplore = (TextView) findViewById(R.id.tv_explore); tvExplore.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent().setClass(LiquiDroid.this, Explore.class); Bundle extras = new Bundle(); extras.putString(Constants.Account.API_NAME, mApiName); extras.putString(Constants.Account.API_URL, mApiUrl); extras.putString(Constants.Account.MEMBER_ID, mMemberId); extras.putString(Constants.Account.SESSION_KEY, mSessionKey); intent.putExtras(extras); startActivity(intent); } }); if (getIntent().getAction() != null && getIntent().getAction().equals(getString(R.string.action_login_sync))) { // we create a new account LinearLayout llExplore = (LinearLayout) findViewById(R.id.ll_explore); llExplore.setVisibility(View.GONE); } getSupportLoaderManager().initLoader(0, null, this); }
From source file:com.ymt.demo1.plates.exportConsult.ExportConsultMainActivity.java
protected void initNearlyHotConsult() { /*/*from w w w. j a v a 2s. c om*/ ? ? */ ListView recListView = (ListView) findViewById(R.id.rec_consult_list_view); ListView hotListView = (ListView) findViewById(R.id.hot_consult_list_view); recList = new ArrayList<>(); hotList = new ArrayList<>(); recAdapter = new HotRecConsultAdapter(this, HotRecConsultAdapter.CONSULT_MAIN_TYPE); hotAdapter = new HotRecConsultAdapter(this, HotRecConsultAdapter.CONSULT_MAIN_TYPE); recAdapter.setHotList(recList); hotAdapter.setHotList(hotList); recListView.setAdapter(recAdapter); hotListView.setAdapter(hotAdapter); TextView newListBtn = (TextView) findViewById(R.id.nearly_consult); TextView hotListBtn = (TextView) findViewById(R.id.hot_consult); newListBtn.setOnClickListener(this); hotListBtn.setOnClickListener(this); //// TODO: 2015/11/3 ? recListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { ConsultInfo consult = (ConsultInfo) recAdapter.getItem(position); Intent intent = new Intent(ExportConsultMainActivity.this, ConsultDetailActivity.class); intent.putExtra("cid", consult.getCid()); startActivity(intent); } }); hotListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { ConsultInfo consult = (ConsultInfo) hotAdapter.getItem(position); Intent intent = new Intent(ExportConsultMainActivity.this, ConsultDetailActivity.class); intent.putExtra("cid", consult.getCid()); startActivity(intent); } }); }
From source file:edu.berkeley.boinc.ProjectDetailsFragment.java
private void populateLayout() { if (project == null) { retryLayout = true;/*w w w .j a v a 2s . co m*/ return; // if data not available yet, return. frequently retrys with onReceive } retryLayout = false; View v = root; updateChangingItems(v); slideshowWrapper = (HorizontalScrollView) v.findViewById(R.id.slideshow_wrapper); slideshowHook = (LinearLayout) v.findViewById(R.id.slideshow_hook); slideshowLoading = (ProgressBar) v.findViewById(R.id.slideshow_loading); // set website TextView website = (TextView) v.findViewById(R.id.project_url); SpannableString content = new SpannableString(project.master_url); content.setSpan(new UnderlineSpan(), 0, content.length(), 0); website.setText(content); website.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(project.master_url)); startActivity(i); } }); // set general area if (projectInfo != null && projectInfo.generalArea != null) { TextView generalArea = (TextView) v.findViewById(R.id.general_area); generalArea.setText(projectInfo.generalArea); } else { LinearLayout wrapper = (LinearLayout) v.findViewById(R.id.general_area_wrapper); wrapper.setVisibility(View.GONE); } // set specific area if (projectInfo != null && projectInfo.specificArea != null) { TextView specificArea = (TextView) v.findViewById(R.id.specific_area); specificArea.setText(projectInfo.specificArea); } else { LinearLayout wrapper = (LinearLayout) v.findViewById(R.id.specific_area_wrapper); wrapper.setVisibility(View.GONE); } // set description if (projectInfo != null && projectInfo.description != null) { TextView description = (TextView) v.findViewById(R.id.description); description.setText(projectInfo.description); } else { LinearLayout wrapper = (LinearLayout) v.findViewById(R.id.description_wrapper); wrapper.setVisibility(View.GONE); } // set home if (projectInfo != null && projectInfo.home != null) { TextView home = (TextView) v.findViewById(R.id.based_at); home.setText(projectInfo.home); } else { LinearLayout wrapper = (LinearLayout) v.findViewById(R.id.based_at_wrapper); wrapper.setVisibility(View.GONE); } // load slideshow new UpdateSlideshowImagesAsync().execute(); }
From source file:com.auth0.android.lock.PasswordlessLockActivity.java
private void showLinkSentLayout() { TextView successMessage = (TextView) passwordlessSuccessCover .findViewById(R.id.com_auth0_lock_passwordless_message); successMessage.setText(String.format(getString(R.string.com_auth0_lock_title_passwordless_link_sent), lastPasswordlessEmailOrNumber)); TextView gotCodeButton = (TextView) passwordlessSuccessCover.findViewById(R.id.com_auth0_lock_got_code); gotCodeButton.setOnClickListener(new View.OnClickListener() { @Override/*from w w w . j a v a2 s . co m*/ public void onClick(View v) { passwordlessSuccessCover.setVisibility(View.GONE); } }); resendButton = (TextView) passwordlessSuccessCover.findViewById(R.id.com_auth0_lock_resend); resendButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { resendButton.setVisibility(View.GONE); rootView.removeView(lockView); lockView = new PasswordlessLockView(PasswordlessLockActivity.this, lockBus, options.getTheme()); if (configuration != null) { lockView.configure(configuration); reloadRecentPasswordlessData(); } else { lockBus.post(new FetchApplicationEvent()); } rootView.addView(lockView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); passwordlessSuccessCover.setVisibility(View.GONE); } }); passwordlessSuccessCover.setVisibility(View.VISIBLE); handler.removeCallbacks(resendTimeoutShower); handler.postDelayed(resendTimeoutShower, RESEND_TIMEOUT); }
From source file:com.gh4a.activities.IssueEditActivity.java
private void showLabelDialog() { if (mAllLabels == null) { mProgressDialog = showProgressDialog(getString(R.string.loading_msg), true); getSupportLoaderManager().initLoader(0, null, mLabelCallback); } else {/*from w w w .j a v a 2 s . c o m*/ LayoutInflater inflater = getLayoutInflater(); final List<Label> selectedLabels = mEditIssue.getLabels() != null ? new ArrayList<>(mEditIssue.getLabels()) : new ArrayList<Label>(); View labelContainerView = inflater.inflate(R.layout.generic_linear_container, null); ViewGroup container = (ViewGroup) labelContainerView.findViewById(R.id.container); View.OnClickListener clickListener = new View.OnClickListener() { @Override public void onClick(View view) { Label label = (Label) view.getTag(); if (selectedLabels.contains(label)) { selectedLabels.remove(label); setLabelSelection((TextView) view, false); } else { selectedLabels.add(label); setLabelSelection((TextView) view, true); } } }; for (final Label label : mAllLabels) { final View rowView = inflater.inflate(R.layout.row_issue_create_label, container, false); View viewColor = rowView.findViewById(R.id.view_color); viewColor.setBackgroundColor(ApiHelpers.colorForLabel(label)); final TextView tvLabel = (TextView) rowView.findViewById(R.id.tv_title); tvLabel.setText(label.getName()); tvLabel.setOnClickListener(clickListener); tvLabel.setTag(label); setLabelSelection(tvLabel, selectedLabels.contains(label)); container.addView(rowView); } new AlertDialog.Builder(this).setCancelable(true).setTitle(R.string.issue_labels) .setView(labelContainerView).setNegativeButton(R.string.cancel, null) .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { mEditIssue.setLabels(selectedLabels); updateLabels(); } }).show(); } }