@Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = inflater.inflate(R.layout.edit_nav_tip_item, null); } NavigationInfo info = infos.get(position); TextView title = (TextView) convertView.findViewById(R.id.text); title.setText(info.getUrl()); return convertView; }
@Override public void onClick(View v) { switch (v.getId()) { case R.id.header_left: finish(); break; case R.id.header_right_2: mInputManager.hideSoftInputFromWindow(mAutoCompleteTextView.getWindowToken(), 0); String url = mAutoCompleteTextView.getText().toString().trim(); String title = mTitle.getText().toString().trim(); if (!Patterns.WEB_URL.matcher(url).matches()) { Toast.makeText(this, R.string.url_not_true, Toast.LENGTH_SHORT).show(); return; } url = URLUtil.guessUrl(url); if (TextUtils.isEmpty(title)) { title = makeTitleByUrl(url); } NavigationInfo info = new NavigationInfo(); info.setTitle(title); info.setUrl(url); NavigationInfoParser.getInstance(this).addNavigationInfo(info); Intent intent = new Intent(this, BrowserActivity.class); intent.setAction(Intent.ACTION_MAIN); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); overridePendingTransition(R.anim.activity_slide_do_nothing, R.anim.slide_down_out); break; case R.id.clear_address_button: mAutoCompleteTextView.setText(""); break; case R.id.clear_title_button: mTitle.setText(""); break; default: break; } }