List of usage examples for android.widget TextView setOnLongClickListener
public void setOnLongClickListener(@Nullable OnLongClickListener l)
From source file:com.github.kanata3249.ffxieq.android.MagicSelectorActivity.java
@Override protected void onStop() { MagicListView flv;/*ww w . j a v a 2 s.com*/ flv = (MagicListView) findViewById(R.id.ListView); if (flv != null) { flv.setOnItemClickListener(null); flv.setOnItemLongClickListener(null); } TextView tv; tv = (TextView) findViewById(R.id.Name); if (tv != null) { tv.setOnLongClickListener(null); } tv = (TextView) findViewById(R.id.Description); if (tv != null) { tv.setOnLongClickListener(null); } super.onStop(); }
From source file:org.mozilla.mozstumbler.client.subactivities.DeveloperActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_developer); if (savedInstanceState == null) { FragmentManager fm = getSupportFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); ft.add(R.id.frame1, new KMLFragment()); ft.add(R.id.frame2, new DeveloperOptions()); ft.commit();/*w w w .ja v a 2 s .c om*/ } TextView tv = (TextView) findViewById(R.id.textViewDeveloperTitle); tv.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { final AlertDialog.Builder b = new AlertDialog.Builder(DeveloperActivity.this); final String[] menuList = { "ACRA Crash Test", "Fake no motion", "Fake motion", "Battery Low", "Battery OK" }; b.setTitle("Secret testing.. shhh."); b.setItems(menuList, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { switch (item) { case 0: Object a = null; a.hashCode(); break; case 1: LocationChangeSensor.debugSendLocationUnchanging(); break; case 2: MotionSensor.debugMotionDetected(); break; case 3: int pct = ClientPrefs.getInstance(DeveloperActivity.this).getMinBatteryPercent(); BatteryCheckReceiver.debugSendBattery(pct - 1); break; case 4: BatteryCheckReceiver.debugSendBattery(99); break; } } }); b.create().show(); return true; } }); }
From source file:com.github.kanata3249.ffxieq.android.VWAtmaLevelSelectorActivity.java
@Override protected void onStop() { VWAtmaListView flv;/*from w ww .ja v a2s. c o m*/ flv = (VWAtmaListView) findViewById(R.id.ListView); if (flv != null) { flv.setOnItemClickListener(null); flv.setOnItemLongClickListener(null); } TextView tv; tv = (TextView) findViewById(R.id.Name); if (tv != null) { tv.setOnLongClickListener(null); } tv = (TextView) findViewById(R.id.Description); if (tv != null) { tv.setOnLongClickListener(null); } super.onStop(); }
From source file:com.italankin.dictionary.ui.translation.TranslationActivity.java
/** * Add separate view for every attribute in array. * * @param parent a parent view group to which views will be added * @param attributes array of attributes *//*from w w w . ja va 2s .c om*/ private void addViewsForAttributes(ViewGroup parent, Attribute[] attributes) { LayoutInflater inflater = getLayoutInflater(); TextView view; for (Attribute a : attributes) { view = (TextView) inflater.inflate(R.layout.item_translation_text, parent, false); view.setText(a.text); view.setOnClickListener(this); view.setOnLongClickListener(this); parent.addView(view); } }
From source file:com.github.kanata3249.ffxieq.android.FoodSelectorActivity.java
@Override protected void onStop() { FoodListView flv;/*w w w . jav a 2s. c o m*/ flv = (FoodListView) findViewById(R.id.ListView); if (flv != null) { flv.setOnItemClickListener(null); flv.setOnItemLongClickListener(null); } TextView tv; tv = (TextView) findViewById(R.id.Name); if (tv != null) { tv.setOnLongClickListener(null); } tv = (TextView) findViewById(R.id.Description); if (tv != null) { tv.setOnLongClickListener(null); } super.onStop(); }
From source file:me.acristoffers.tracker.fragments.PackageDetailsFragment.java
private void setupUI() { final Activity activity = getActivity(); final View view = getView(); if (activity == null || view == null) { return;//w w w . j av a 2 s. c o m } String code = null; final Bundle arguments = getArguments(); if (arguments != null) { code = arguments.getString(PackageDetailsActivity.PACKAGE_CODE); } if (code == null || code.isEmpty()) { final Intent intent = activity.getIntent(); if (intent != null) { code = intent.getStringExtra(PackageDetailsActivity.PACKAGE_CODE); } } if (code == null || code.isEmpty()) { return; } final RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.steps); final RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(activity); recyclerView.setLayoutManager(layoutManager); pkg = new Package(code, getActivity(), null); final StepListAdapter stepListAdapter = new StepListAdapter(pkg, activity); recyclerView.setAdapter(stepListAdapter); TextView textView = (TextView) view.findViewById(R.id.name); textView.setText(pkg.getName()); textView = (TextView) view.findViewById(R.id.code); textView.setText(pkg.getCod()); textView.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { final ClipboardManager clipboardManager = (ClipboardManager) activity .getSystemService(Context.CLIPBOARD_SERVICE); if (clipboardManager != null) { final String code = pkg.getCod(); final ClipData clipData = ClipData.newPlainText(code, code); clipboardManager.setPrimaryClip(clipData); final Toast toast = Toast.makeText(activity, R.string.code_copied, Toast.LENGTH_SHORT); toast.show(); return true; } return false; } }); if (!pkg.getSteps().isEmpty()) { textView = (TextView) view.findViewById(R.id.emptyStepView); textView.setVisibility(View.INVISIBLE); } final NotificationManager nm = (NotificationManager) activity .getSystemService(Context.NOTIFICATION_SERVICE); nm.cancel(pkg.getId()); }
From source file:com.github.crvv.wubinput.wubi.dictionary.suggestions.SuggestionStripView.java
public SuggestionStripView(final Context context, final AttributeSet attrs, final int defStyle) { super(context, attrs, defStyle); final LayoutInflater inflater = LayoutInflater.from(context); inflater.inflate(R.layout.suggestions_strip, this); mSuggestionsStrip = (ViewGroup) findViewById(R.id.suggestions_strip); mStripVisibilityGroup = new StripVisibilityGroup(this, mSuggestionsStrip, null, null); for (int pos = 0; pos < SuggestedWords.MAX_SUGGESTIONS; pos++) { final TextView word = new TextView(context, null, R.attr.suggestionWordStyle); word.setOnClickListener(this); word.setOnLongClickListener(this); mWordViews.add(word);/*w w w .j a v a2s.c o m*/ final View divider = inflater.inflate(R.layout.suggestion_divider, null); mDividerViews.add(divider); final TextView info = new TextView(context, null, R.attr.suggestionWordStyle); info.setTextColor(Color.WHITE); info.setTextSize(TypedValue.COMPLEX_UNIT_DIP, DEBUG_INFO_TEXT_SIZE_IN_DIP); } mLayoutHelper = new SuggestionStripLayoutHelper(context, attrs, defStyle, mWordViews, mDividerViews, null); mMoreSuggestionsContainer = inflater.inflate(R.layout.more_suggestions, null); mMoreSuggestionsView = (MoreSuggestionsView) mMoreSuggestionsContainer .findViewById(R.id.more_suggestions_view); mMoreSuggestionsBuilder = new MoreSuggestions.Builder(context, mMoreSuggestionsView); final Resources res = context.getResources(); mMoreSuggestionsModalTolerance = res .getDimensionPixelOffset(R.dimen.config_more_suggestions_modal_tolerance); mMoreSuggestionsSlidingDetector = new GestureDetector(context, mMoreSuggestionsSlidingListener); final TypedArray keyboardAttr = context.obtainStyledAttributes(attrs, R.styleable.Keyboard, defStyle, R.style.SuggestionStripView); keyboardAttr.recycle(); }
From source file:com.github.kanata3249.ffxieq.android.EquipmentSelectorActivity.java
@Override protected void onStop() { EquipmentListView elv;//from www . j a v a2 s . com elv = (EquipmentListView) findViewById(R.id.ListView); if (elv != null) { elv.setOnItemClickListener(null); elv.setOnItemLongClickListener(null); } TextView tv; tv = (TextView) findViewById(R.id.Name); if (tv != null) { tv.setOnLongClickListener(null); } tv = (TextView) findViewById(R.id.Job); if (tv != null) { tv.setOnLongClickListener(null); } tv = (TextView) findViewById(R.id.Description); if (tv != null) { tv.setOnLongClickListener(null); } tv = (TextView) findViewById(R.id.Augment); if (tv != null) { tv.setOnLongClickListener(null); } tv = (TextView) findViewById(R.id.Level); if (tv != null) { tv.setOnLongClickListener(null); } tv = (TextView) findViewById(R.id.Race); if (tv != null) { tv.setOnLongClickListener(null); } super.onStop(); }
From source file:com.orangemoo.com.beta.widget.ViewPagerTabs.java
private void addTab(CharSequence tabTitle, final int position) { final TextView textView = new TextView(getContext()); textView.setText(tabTitle);//from ww w. j a v a 2s.c o m // textView.setBackgroundResource(R.drawable.view_pager_tab_background); textView.setGravity(Gravity.CENTER); textView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mPager.setCurrentItem(getRtlPosition(position)); } }); textView.setOnLongClickListener(new OnTabLongClickListener(position)); // Assign various text appearance related attributes to child views. if (mTextStyle > 0) { textView.setTypeface(textView.getTypeface(), mTextStyle); } if (mTextSize > 0) { textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextSize); } if (mTextColor != null) { textView.setTextColor(mTextColor); } textView.setAllCaps(mTextAllCaps); // textView.setPadding(mSidePadding, 0, mSidePadding, 0); mTabStrip.addView(textView, new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1)); // Default to the first child being selected if (position == 0) { mPrevSelected = 0; textView.setSelected(true); } }
From source file:com.cyanogenmod.eleven.widgets.ViewPagerTabs.java
private void addTab(CharSequence tabTitle, final int position) { final TextView textView = new TextView(getContext()); textView.setText(tabTitle);//from w w w.j a v a2s . co m textView.setBackgroundResource(R.drawable.view_pager_tab_background); textView.setGravity(Gravity.CENTER); textView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { mPager.setCurrentItem(getRtlPosition(position)); } }); textView.setOnLongClickListener(new OnTabLongClickListener(position)); // Assign various text appearance related attributes to child views. if (mTextStyle > 0) { textView.setTypeface(textView.getTypeface(), mTextStyle); } if (mTextSize > 0) { textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextSize); } if (mTextColor != null) { textView.setTextColor(mTextColor); } textView.setAllCaps(mTextAllCaps); textView.setPadding(mSidePadding, 0, mSidePadding, 0); mTabStrip.addView(textView, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT, 1)); // Default to the first child being selected if (position == 0) { mPrevSelected = 0; textView.setSelected(true); } }