List of usage examples for android.widget TextView setOnClickListener
public void setOnClickListener(@Nullable OnClickListener l)
From source file:liqui.droid.activity.Base.java
/** * Creates the breadcrumb./*from w w w . j av a 2s . co m*/ * * @param subTitle the sub title * @param breadCrumbHolders the bread crumb holders */ public void createBreadcrumb(String subTitle, BreadCrumbHolder... breadCrumbHolders) { if (breadCrumbHolders != null) { LinearLayout llPart = (LinearLayout) this.findViewById(R.id.ll_part); for (int i = 0; i < breadCrumbHolders.length; i++) { TextView tvBreadCrumb = new TextView(getApplication()); SpannableString part = new SpannableString(breadCrumbHolders[i].getLabel()); part.setSpan(new UnderlineSpan(), 0, part.length(), 0); tvBreadCrumb.append(part); tvBreadCrumb.setTag(breadCrumbHolders[i]); tvBreadCrumb.setBackgroundResource(R.drawable.default_link); tvBreadCrumb.setTextAppearance(getApplication(), R.style.default_text_small); tvBreadCrumb.setSingleLine(true); tvBreadCrumb.setOnClickListener(new OnClickBreadCrumb(this)); llPart.addView(tvBreadCrumb); if (i < breadCrumbHolders.length - 1) { TextView slash = new TextView(getApplication()); slash.setText(" / "); slash.setTextAppearance(getApplication(), R.style.default_text_small); llPart.addView(slash); } } } ScrollingTextView tvSubtitle = (ScrollingTextView) this.findViewById(R.id.tv_subtitle); tvSubtitle.setText(subTitle); }
From source file:com.markupartist.sthlmtraveling.PlannerFragment.java
public void initViews() { mSearchView = getActivity().getLayoutInflater().inflate(R.layout.search, null); getListView().addHeaderView(mSearchView, null, false); final TextView historyView = (TextView) getActivity().getLayoutInflater().inflate(R.layout.header, null); historyView.setText(R.string.history_label); historyView.setOnClickListener(null); // Makes the header un-clickable, hack! getListView().addHeaderView(historyView); // Hide dividers on the header view. getListView().setHeaderDividersEnabled(false); if (!mStartPoint.hasName()) { mStartPoint.setName(Site.TYPE_MY_LOCATION); }//w w w .j a v a2 s .co m mStartPointAutoComplete = createAutoCompleteTextView(R.id.from, /*R.id.from_progress*/ -1, mStartPoint); mEndPointAutoComplete = createAutoCompleteTextView(R.id.to, /*R.id.to_progress*/ -1, mEndPoint); mViaPointAutoComplete = createAutoCompleteTextView(R.id.via, /*R.id.via_progress*/ -1, mViaPoint, true); try { mHistoryDbAdapter = new HistoryDbAdapter(getActivity()).open(); } catch (final Exception e) { showDialog(createDialogReinstallApp()); return; } // Setup view for choosing other data for start and end point. final ImageButton fromDialog = (ImageButton) mSearchView.findViewById(R.id.from_menu); fromDialog.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View v) { mStartPointAutoComplete.setError(null); showDialog(createDialogStartPoint()); } }); final ImageButton toDialog = (ImageButton) mSearchView.findViewById(R.id.to_menu); toDialog.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View v) { mEndPointAutoComplete.setError(null); showDialog(createDialogEndPoint()); } }); final ImageButton viaDialog = (ImageButton) mSearchView.findViewById(R.id.via_menu); viaDialog.setOnClickListener(new View.OnClickListener() { @Override public void onClick(final View v) { mViaPointAutoComplete.setError(null); showDialog(createDialogViaPoint()); } }); // Views for date and time mChangeTimeLayout = (LinearLayout) mSearchView.findViewById(R.id.planner_change_time_layout); mDateButton = (Button) mSearchView.findViewById(R.id.planner_route_date); mDateButton.setOnClickListener(new OnClickListener() { @Override public void onClick(final View v) { showDialog(createDialogDate()); } }); mTimeButton = (Button) mSearchView.findViewById(R.id.planner_route_time); mTimeButton.setOnClickListener(new OnClickListener() { @Override public void onClick(final View v) { showDialog(createDialogTime()); } }); // Views for radio buttons final RadioButton nowRadioButton = (RadioButton) mSearchView.findViewById(R.id.planner_check_now); nowRadioButton.setOnCheckedChangeListener(this); final RadioButton laterRadioButton = (RadioButton) mSearchView .findViewById(R.id.planner_check_more_choices); laterRadioButton.setOnCheckedChangeListener(this); mWhenSpinner = (Spinner) mSearchView.findViewById(R.id.departure_arrival_choice); final ArrayAdapter<CharSequence> whenChoiceAdapter = ArrayAdapter.createFromResource(getActivity(), R.array.when_choice, android.R.layout.simple_spinner_item); whenChoiceAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); mWhenSpinner.setAdapter(whenChoiceAdapter); // Handle create shortcut. if (mCreateShortcut) { registerScreen("Planner create shortcut"); getActivity().setTitle(R.string.create_shortcut_label); // Add search label to button RadioGroup chooseTimeGroup = (RadioGroup) mSearchView.findViewById(R.id.planner_choose_time_group); chooseTimeGroup.setVisibility(View.GONE); historyView.setVisibility(View.GONE); // Fake an adapter. This needs to be fixed later on so we can use the history. setListAdapter(new ArrayAdapter<String>(getActivity(), R.layout.journey_history_row)); } else { setListAdapter(mAdapter); } }
From source file:com.cypress.cysmart.DataLoggerFragments.DataLoggerFragment.java
@Override public View onCreateView(LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.datalogger, container, false); mLogList = (ListView) rootView.findViewById(R.id.txtlog); mFileName = (TextView) rootView.findViewById(R.id.txt_file_name); mScrollDown = (Button) rootView.findViewById(R.id.btn_scroll_down); /*// w w w . j a v a 2s .c o m /History option text */ TextView mDataHistory = (TextView) rootView.findViewById(R.id.txthistory); //mScrollView = (CustumScrollView) rootView.findViewById(R.id.scroll_view_logger); Bundle bundle = this.getArguments(); if (bundle != null) { mFilepath = bundle.getString(Constants.DATA_LOGGER_FILE_NAAME); mVisible = bundle.getBoolean(Constants.DATA_LOGGER_FLAG); File fileinView = new File(mFilepath); mFileName.setText(fileinView.getName()); } // Handling the history text visibility based on the received Arguments if (mVisible) { mDataHistory.setVisibility(View.GONE); } else { Toast.makeText(getActivity(), getResources().getString(R.string.data_logger_timestamp) + Utils.GetTimeandDateUpdate(), Toast.LENGTH_SHORT).show(); mDataHistory.setVisibility(View.VISIBLE); } mDataHistory.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent dataloggerHistory = new Intent(getActivity(), DataLoggerHistoryList.class); startActivityForResult(dataloggerHistory, 123); } }); prepareData(); setHasOptionsMenu(true); mScrollDown.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { mLogList.post(new Runnable() { public void run() { mLogList.setSelection(mLogList.getCount() - 1); } }); } }); return rootView; }
From source file:edu.stanford.mobisocial.dungbeetle.model.DbObject.java
/** * @param v the view to bind/*from www .ja va2 s . co m*/ * @param context standard activity context * @param c the cursor source for the object in the db object table. * Must include _id in the projection. * * @param allowInteractions controls whether the bound view is * allowed to intercept touch events and do its own processing. */ public static void bindView(View v, final Context context, Cursor cursor, boolean allowInteractions) { TextView nameText = (TextView) v.findViewById(R.id.name_text); ViewGroup frame = (ViewGroup) v.findViewById(R.id.object_content); frame.removeAllViews(); // make sure we have all the columns we need Long objId = cursor.getLong(cursor.getColumnIndexOrThrow(DbObj.COL_ID)); String[] projection = null; String selection = DbObj.COL_ID + " = ?"; String[] selectionArgs = new String[] { Long.toString(objId) }; String sortOrder = null; Cursor c = context.getContentResolver().query(DbObj.OBJ_URI, projection, selection, selectionArgs, sortOrder); if (!c.moveToFirst()) { Log.w(TAG, "could not find obj " + objId); c.close(); return; } DbObj obj = App.instance().getMusubi().objForCursor(c); if (obj == null) { nameText.setText("Failed to access database."); Log.e("DbObject", "cursor was null for bindView of DbObject"); return; } DbUser sender = obj.getSender(); Long timestamp = c.getLong(c.getColumnIndexOrThrow(DbObj.COL_TIMESTAMP)); Long hash = obj.getHash(); short deleted = c.getShort(c.getColumnIndexOrThrow(DELETED)); String feedName = obj.getFeedName(); String type = obj.getType(); Date date = new Date(timestamp); c.close(); c = null; if (sender == null) { nameText.setText("Message from unknown contact."); return; } nameText.setText(sender.getName()); final ImageView icon = (ImageView) v.findViewById(R.id.icon); if (sViewProfileAction == null) { sViewProfileAction = new OnClickViewProfile((Activity) context); } icon.setTag(sender.getLocalId()); if (allowInteractions) { icon.setOnClickListener(sViewProfileAction); v.setTag(objId); } icon.setImageBitmap(sender.getPicture()); if (deleted == 1) { v.setBackgroundColor(sDeletedColor); } else { v.setBackgroundColor(Color.TRANSPARENT); } TextView timeText = (TextView) v.findViewById(R.id.time_text); timeText.setText(RelativeDate.getRelativeDate(date)); frame.setTag(objId); // TODO: error prone! This is database id frame.setTag(R.id.object_entry, cursor.getPosition()); // this is cursor id FeedRenderer renderer = DbObjects.getFeedRenderer(type); if (renderer != null) { renderer.render(context, frame, obj, allowInteractions); } if (!allowInteractions) { v.findViewById(R.id.obj_attachments_icon).setVisibility(View.GONE); v.findViewById(R.id.obj_attachments).setVisibility(View.GONE); } else { if (!MusubiBaseActivity.isDeveloperModeEnabled(context)) { v.findViewById(R.id.obj_attachments_icon).setVisibility(View.GONE); v.findViewById(R.id.obj_attachments).setVisibility(View.GONE); } else { ImageView attachmentCountButton = (ImageView) v.findViewById(R.id.obj_attachments_icon); TextView attachmentCountText = (TextView) v.findViewById(R.id.obj_attachments); attachmentCountButton.setVisibility(View.VISIBLE); if (hash == 0) { attachmentCountButton.setVisibility(View.GONE); } else { //int color = DbObject.colorFor(hash); boolean selfPost = false; DBHelper helper = new DBHelper(context); try { Cursor attachments = obj.getSubfeed().query("type=?", new String[] { LikeObj.TYPE }); try { attachmentCountText.setText("+" + attachments.getCount()); if (attachments.moveToFirst()) { while (!attachments.isAfterLast()) { if (attachments.getInt(attachments.getColumnIndex(CONTACT_ID)) == -666) { selfPost = true; break; } attachments.moveToNext(); } } } finally { attachments.close(); } } finally { helper.close(); } if (selfPost) { attachmentCountButton.setImageResource(R.drawable.ic_menu_love_red); } else { attachmentCountButton.setImageResource(R.drawable.ic_menu_love); } attachmentCountText.setTag(R.id.object_entry, hash); attachmentCountText.setTag(R.id.feed_label, Feed.uriForName(feedName)); attachmentCountText.setOnClickListener(LikeListener.getInstance(context)); } } } }
From source file:com.cairoconfessions.MainActivity.java
public void addLocation(View view) { TextView newView = new TextView(this); AutoCompleteTextView addLoc = ((AutoCompleteTextView) findViewById(R.id.addLocation)); String newLoc = addLoc.getText().toString(); ViewGroup locList = ((ViewGroup) findViewById(R.id.locations)); boolean notFound = true; for (int i = 0; i < locList.getChildCount(); i++) { if (newLoc.equals(((TextView) locList.getChildAt(i)).getText().toString())) notFound = false;//from w w w . j av a 2 s .co m break; } if (Arrays.asList(COUNTRIES).contains(newLoc) && notFound) { newView.setText(newLoc); newView.setClickable(true); newView.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { addItem(view); } }); float scale = getResources().getDisplayMetrics().density; newView.setGravity(17); newView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 30); newView.setBackgroundResource(R.drawable.city2); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, (int) (150 * scale)); lp.setMargins((int) (0 * scale), (int) (0 * scale), (int) (0 * scale), (int) (2 * scale)); newView.setLayoutParams(lp); locList.addView(newView, 0); addLoc.setText(""); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(addLoc.getWindowToken(), 0); addLoc.setCursorVisible(false); } else { Toast.makeText(this, "Invalid location", Toast.LENGTH_LONG).show(); } }
From source file:de.grobox.liberario.DirectionsFragment.java
private void setToUI() { // To text input final AutoCompleteTextView to = (AutoCompleteTextView) mView.findViewById(R.id.to); final TextView toText = (TextView) mView.findViewById(R.id.toText); OnClickListener toListener = new OnClickListener() { @Override/*from ww w. j av a 2 s .com*/ public void onClick(View view) { if (to.getText().length() > 0) { to.showDropDown(); } else { handleInputClick(FavLocation.LOC_TYPE.TO); } } }; to.setOnClickListener(toListener); toText.setOnClickListener(toListener); // To Location List for Dropdown final LocationAdapter locAdapter = new LocationAdapter(getActivity(), FavLocation.LOC_TYPE.TO); locAdapter.setFavs(true); locAdapter.setHome(true); to.setAdapter(locAdapter); to.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long rowId) { handleLocationItemClick(locAdapter.getItem(position), view, FavLocation.LOC_TYPE.TO); } }); // TODO implement something to allow change of homeLocation final ImageView toStatusButton = (ImageView) mView.findViewById(R.id.toStatusButton); toStatusButton.setImageDrawable(null); toStatusButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { handleInputClick(FavLocation.LOC_TYPE.TO); } }); // clear from text button final ImageButton toClearButton = (ImageButton) mView.findViewById(R.id.toClearButton); toClearButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { to.requestFocus(); clearLocation(FavLocation.LOC_TYPE.TO); toClearButton.setVisibility(View.GONE); } }); // To text input changed to.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // show clear button if (s.length() > 0) { toClearButton.setVisibility(View.VISIBLE); // clear location setLocation(null, FavLocation.LOC_TYPE.TO, null, false); } else { toClearButton.setVisibility(View.GONE); clearLocation(FavLocation.LOC_TYPE.TO); // clear drop-down list locAdapter.resetList(); } } public void afterTextChanged(Editable s) { } public void beforeTextChanged(CharSequence s, int start, int count, int after) { } }); }
From source file:com.garlicg.screenrecord4cm.SettingsActivity.java
/** * Create auto stop setting view/*w w w . java2 s . co m*/ */ private void createFireCutin(Bundle savedInstanceState) { // init value setup final TextView valueView = ViewFinder.byId(this, R.id.fireCutinValue); int value = mPrefs.getFireCutinOffsetMilliSec(); valueView.setText(getString(R.string.x_ms_later, value)); // handle value from dialog callback final InputSecondDialogBuilder.Callback callback = new InputSecondDialogBuilder.Callback() { @Override public boolean onValidate(int value) { int msec = value * 100; //noinspection PointlessArithmeticExpression return msec >= 0 && msec <= 1 * 1000 * 1000 - 1; // 999 } @Override public void onOk(int value) { int msec = value * 100; valueView.setText(getString(R.string.x_ms_later, msec)); mPrefs.saveFireCutinOffsetMilliSec(msec); } }; // show dialog on click valueView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int value = mPrefs.getFireCutinOffsetMilliSec() / 100; AlertDialog ad = InputSecondDialogBuilder.build(v.getContext(), value, getString(R.string.unit_00ms_later), callback); ad.show(); } }); }
From source file:com.ximai.savingsmore.save.activity.AddGoodsAcitivyt.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.add_good_activity); setCenterTitle("?"); setLeftBackMenuVisibility(AddGoodsAcitivyt.this, ""); head_view = (ImageView) findViewById(R.id.head_image); my_name = (TextView) findViewById(R.id.name); MyImageLoader.displayDefaultImage(URLText.img_url + MyUserInfoUtils.getInstance().myUserInfo.PhotoPath, head_view);//w w w . j a va 2 s . c o m if (null != MyUserInfoUtils.getInstance().myUserInfo.UserExtInfo) { my_name.setText(MyUserInfoUtils.getInstance().myUserInfo.UserExtInfo.StoreName); } cuxiaoshuoming = (TextView) findViewById(R.id.cuxiaoshuoming); shangpingmiaoshu = (TextView) findViewById(R.id.shangpingmiaoshu); horizontalListView = (HorizontalListView) findViewById(R.id.myGridview); yijifenlei = (TextView) findViewById(R.id.one_classity); erjifenlei = (TextView) findViewById(R.id.two_classity); brand = (TextView) findViewById(R.id.brand_name); xingshi_item = (LinearLayout) findViewById(R.id.xingshi_item); xingshi = (TextView) findViewById(R.id.xingshi); yuanyin_item = (LinearLayout) findViewById(R.id.yuanyin_item); yuanyin = (TextView) findViewById(R.id.yuanyin); dizhi_item = (LinearLayout) findViewById(R.id.dizhi_item); dizhi = (TextView) findViewById(R.id.dizhi); satrt_item = (LinearLayout) findViewById(R.id.start_time_item); start = (TextView) findViewById(R.id.start_time); end_item = (LinearLayout) findViewById(R.id.end_time_item); end = (TextView) findViewById(R.id.end_time); danwei_item = (LinearLayout) findViewById(R.id.danwei_item); danwei = (TextView) findViewById(R.id.danwei); bizhong_item = (LinearLayout) findViewById(R.id.bizhong_item); bizhong = (TextView) findViewById(R.id.bizhong); fapiao_item = (LinearLayout) findViewById(R.id.fapiao_item); fapiao = (TextView) findViewById(R.id.fapiao); yuan_price = (EditText) findViewById(R.id.yuan_price); cuxiao_price = (EditText) findViewById(R.id.cuxiao_price); cuxiao_text = (TextView) findViewById(R.id.cuxiao_text); fabu = (TextView) findViewById(R.id.fabu); product_bianhao = (EditText) findViewById(R.id.product_bianhao); product_name = (EditText) findViewById(R.id.product_name); xiangxi_address = (EditText) findViewById(R.id.xiangxi_address); servise = (TextView) findViewById(R.id.servise); servise.setOnClickListener(this); fabu.setOnClickListener(this); yijifenlei.setOnClickListener(this); erjifenlei.setOnClickListener(this); brand.setOnClickListener(this); xingshi_item.setOnClickListener(this); yuanyin_item.setOnClickListener(this); dizhi_item.setOnClickListener(this); satrt_item.setOnClickListener(this); end_item.setOnClickListener(this); danwei_item.setOnClickListener(this); bizhong_item.setOnClickListener(this); fapiao_item.setOnClickListener(this); yuan_price.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { if (null != xingshi_id) { if (xingshi_id.equals("2") || xingshi_id.equals("3") || xingshi_id.equals("7") || xingshi_id.equals("12")) { cuxiao_price.setText(s.toString()); } } } }); myAdapter = new MyAdapter(); horizontalListView.setAdapter(myAdapter); queryDicNode(); queryDicNode2(); explain = (EditText) findViewById(R.id.explain); descript = (EditText) findViewById(R.id.decript); shuoming_number = explain.getText().length(); miaoshu_number = descript.getText().length(); explain.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { shuoming_number = explain.getText().length(); cuxiaoshuoming.setText("(?" + (200 - shuoming_number) + ")"); } @Override public void afterTextChanged(Editable s) { } }); descript.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { miaoshu_number = descript.getText().length(); shangpingmiaoshu.setText("???(?" + (200 - miaoshu_number) + ")"); } @Override public void afterTextChanged(Editable s) { } }); zidingyi_brand = (TextView) findViewById(R.id.zidingyi_brand); custom_type = (TextView) findViewById(R.id.custom_type); zidingyi_brand.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { classity_dialog = new AlertDialog.Builder(AddGoodsAcitivyt.this).create(); View view = LayoutInflater.from(AddGoodsAcitivyt.this).inflate(R.layout.save_brand, null); final TextView queding, quxiao; final EditText content; queding = (TextView) view.findViewById(R.id.comfirm); quxiao = (TextView) view.findViewById(R.id.cannel); content = (EditText) view.findViewById(R.id.content); queding.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (null != content.getText() && !TextUtils.isEmpty(content.getText())) { save_brand(content.getText().toString()); } } }); quxiao.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { classity_dialog.dismiss(); } }); classity_dialog.setView(view); classity_dialog.show(); } }); custom_type.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (oneId != null && !TextUtils.isEmpty(oneId)) { brand_dialog = new AlertDialog.Builder(AddGoodsAcitivyt.this).create(); View view = LayoutInflater.from(AddGoodsAcitivyt.this).inflate(R.layout.custom_classfy, null); final TextView queding, quxiao; final EditText content; queding = (TextView) view.findViewById(R.id.comfirm); quxiao = (TextView) view.findViewById(R.id.cannel); content = (EditText) view.findViewById(R.id.content); queding.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (null != content.getText() && !TextUtils.isEmpty(content.getText())) { apply_calssity(content.getText().toString(), oneId); } } }); quxiao.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { brand_dialog.dismiss(); } }); brand_dialog.setView(view); brand_dialog.show(); } else { Toast.makeText(AddGoodsAcitivyt.this, "", Toast.LENGTH_SHORT).show(); } } }); cuxiao_price.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (cuxiao_text.getText().equals("N?N")) { bug_dialog = new AlertDialog.Builder(AddGoodsAcitivyt.this).create(); View view = LayoutInflater.from(AddGoodsAcitivyt.this).inflate(R.layout.bug_give, null); final TextView queding, quxiao; final EditText number1, number2; queding = (TextView) view.findViewById(R.id.comfirm); quxiao = (TextView) view.findViewById(R.id.cannel); number1 = (EditText) view.findViewById(R.id.number1); number2 = (EditText) view.findViewById(R.id.number2); queding.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (null != number1.getText() && !TextUtils.isEmpty(number1.getText()) && null != number2.getText() && !TextUtils.isEmpty(number2.getText())) { cuxiao_price.setText("" + number1.getText().toString() + "?" + number2.getText().toString()); bug_dialog.dismiss(); } } }); quxiao.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { bug_dialog.dismiss(); } }); bug_dialog.setView(view); bug_dialog.show(); } } }); myProduct = new MyProduct(); if (null != getIntent().getStringExtra("id")) { Id = getIntent().getStringExtra("id"); getgood_detial(Id); } }
From source file:com.flipzu.flipzu.Player.java
@Override public void onResponseReceived(BroadcastDataSet bcast) { /* unset loading progress */ setProgressBarIndeterminateVisibility(Boolean.FALSE); if (bcast != null) { debug.logV(TAG, "onResponseReceived called with bcast " + bcast.getId()); } else {//ww w . ja v a 2s.com debug.logV(TAG, "onResponseReceived called with bcast NULL"); } boolean newBcast = false; if (bcast != null) { /* start async call to fetch user data */ AsyncFlipInterface.getUser(bcast.getUsername(), user.getToken(), this); if (isNewBcast(bcast)) { debug.logV(TAG, "onResponseReceived, is a new broadcast"); saveBcast(bcast); newBcast = true; } else { debug.logV(TAG, "onResponseReceived, is not a new broadcast"); } } else { // try again with bcast from settings... if (!mSavedBcast) { mSavedBcast = true; AsyncFlipInterface.getBroadcast(getBcastFromSettings(), this); } return; } this.bcast = bcast; mUrl = getCurrentUrl(bcast); if (bcast != null) { mTitle = bcast.getUsername(); if (bcast.getText() != null) mTitle += " - " + bcast.getText(); } debug.logV(TAG, "onResponseReceived, got URL " + mUrl); /* layout */ ImageView bg = (ImageView) findViewById(R.id.user_avatar); final TextView title_tv = (TextView) findViewById(R.id.title); final TextView time_tv = (TextView) findViewById(R.id.time_str); final TextView listeners_tv = (TextView) findViewById(R.id.listeners); final TextView username_tv = (TextView) findViewById(R.id.username); username_tv.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(Player.this, Profile.class); i.putExtra("user", ((TextView) findViewById(R.id.username)).getText()); startActivity(i); } }); bg.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(Player.this, Profile.class); i.putExtra("user", ((TextView) findViewById(R.id.username)).getText()); startActivity(i); } }); final TextView bottom_title_tv = (TextView) findViewById(R.id.player_title_bottom); // fix padding for player // ScrollingTextView sc_tv = (ScrollingTextView) findViewById(R.id.actionbar_title); // sc_tv.setPadding(35, 0, 0, 0); /* action bar */ // ActionBar actionBar = (ActionBar) findViewById(R.id.actionbar); // actionBar.setHomeLogo(R.drawable.logo2); if (bcast != null) { UrlImageViewHelper.setUrlDrawable(bg, bcast.getImgUrl(), R.drawable.icon_sq); getSupportActionBar().setTitle(bcast.getUsername()); username_tv.setText(bcast.getUsername()); CharSequence title = bcast.getText(); if (title == null) title = getText(R.string.empty_title); title_tv.setText(title); bottom_title_tv.setText(mTitle); bottom_title_tv.setSelected(true); // hack to make text scroll if (bcast.getTimeStr() != null) { time_tv.setText(bcast.getTimeStr()); } if (bcast.getListens() == null) { // maybe erased? Go back... Player.this.finish(); } try { Integer listens = Integer.parseInt(bcast.getListens()) + 1; listeners_tv.setText(listens.toString()); } catch (NumberFormatException e) { Player.this.finish(); } } // EditText comment listener final EditText comment_et = (EditText) findViewById(R.id.post_comment_et); comment_et.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { // If the event is a key-down event on the "enter" button if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { // Perform action on key press postComment(); return true; } return false; } }); /* start bcast if it's a new one */ if (newBcast) { debug.logV(TAG, "onResponseReceived, newBcast, sending PLAY"); sendPlay(); } else { if (mState == playerState.STOPPED) sendPlay(); } /* stats thread */ if (bcast != null) { if (bcast.getId() != null) { AsyncFlipInterface.getComments(Integer.parseInt(bcast.getId()), Player.this); } if (bcast.isLive()) { if (mState == playerState.PLAYING) setLiveVisible(true); liveHandler.removeCallbacks(mCheckLiveTask); liveHandler.postDelayed(mCheckLiveTask, 5000); } else { timerHandler.removeCallbacks(mTimerTask); timerHandler.postDelayed(mTimerTask, 1000); } } }
From source file:de.grobox.liberario.DirectionsFragment.java
private void setFromUI() { // From text input final AutoCompleteTextView from = (AutoCompleteTextView) mView.findViewById(R.id.from); final TextView fromText = (TextView) mView.findViewById(R.id.fromText); OnClickListener fromListener = new OnClickListener() { @Override/* w ww .j a v a 2 s. c o m*/ public void onClick(View view) { if (from.getText().length() > 0) { from.showDropDown(); } else { handleInputClick(FavLocation.LOC_TYPE.FROM); } } }; from.setOnClickListener(fromListener); fromText.setOnClickListener(fromListener); // From Location List for Dropdown final LocationAdapter locAdapter = new LocationAdapter(getActivity(), FavLocation.LOC_TYPE.FROM); locAdapter.setFavs(true); locAdapter.setHome(true); locAdapter.setGPS(true); from.setAdapter(locAdapter); from.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long rowId) { handleLocationItemClick(locAdapter.getItem(position), view, FavLocation.LOC_TYPE.FROM); } }); // TODO itemLongClickListener to change homeLocation final ImageView fromStatusButton = (ImageView) mView.findViewById(R.id.fromStatusButton); fromStatusButton.setImageDrawable(null); fromStatusButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { handleInputClick(FavLocation.LOC_TYPE.FROM); } }); // clear from text button final ImageButton fromClearButton = (ImageButton) mView.findViewById(R.id.fromClearButton); fromClearButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { from.requestFocus(); clearLocation(FavLocation.LOC_TYPE.FROM); fromClearButton.setVisibility(View.GONE); } }); // From text input changed from.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { // show clear button if (s.length() > 0) { fromClearButton.setVisibility(View.VISIBLE); // clear location setLocation(null, FavLocation.LOC_TYPE.FROM, null, false); } else { fromClearButton.setVisibility(View.GONE); clearLocation(FavLocation.LOC_TYPE.FROM); // clear drop-down list locAdapter.resetList(); } cancelGpsButton(); } public void afterTextChanged(Editable s) { } public void beforeTextChanged(CharSequence s, int start, int count, int after) { } }); }