List of usage examples for android.widget TextView setOnClickListener
public void setOnClickListener(@Nullable OnClickListener l)
From source file:com.kaku.weac.fragment.RingSelectFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fm_ring_select, container, false); // ?/*from ww w . j a v a2 s . co m*/ ViewGroup viewGroup = (ViewGroup) view.findViewById(R.id.ring_select_llyt); // ? MyUtil.setBackground(viewGroup, getActivity()); // Fragment initFragment(); // ViewPager initViewPager(view); // ImageView actionCancel = (ImageView) view.findViewById(R.id.ring_select_cancel); actionCancel.setOnClickListener(this); // ? TextView actionSave = (TextView) view.findViewById(R.id.ring_select_save); actionSave.setOnClickListener(this); return view; }
From source file:com.sbhstimetable.sbhs_timetable_android.TimetableFragment.java
@Override public View onCreateView(LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment if (!ApiAccessor.isLoggedIn()) { View v = inflater.inflate(R.layout.fragment_pls2login, container, false); TextView t = (TextView) v.findViewById(R.id.textview); t.setOnClickListener(new View.OnClickListener() { @Override/*from w ww .j a v a 2s .c o m*/ public void onClick(View view) { Intent i = new Intent(container.getContext(), LoginActivity.class); container.getContext().startActivity(i); } }); return v; } final SwipeRefreshLayout v = (SwipeRefreshLayout) inflater.inflate(R.layout.fragment_timetable, container, false); this.layout = v; final Context c = this.getActivity(); v.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { refreshing = true; ApiAccessor.getBelltimes(c, false); ApiAccessor.getNotices(c, false); ApiAccessor.getToday(c, false); } }); if (ThemeHelper.isBackgroundDark()) { v.setProgressBackgroundColor(R.color.background_floating_material_dark); } else { v.setProgressBackgroundColor(R.color.background_floating_material_light); } v.setColorSchemeColors(getResources().getColor(R.color.blue), getResources().getColor(R.color.green), getResources().getColor(R.color.yellow), getResources().getColor(R.color.red)); ListView z = (ListView) this.getActivity().findViewById(R.id.timetable_listview); if (z != null) { ApiAccessor.getToday(this.getActivity()); } return v; }
From source file:com.gaadikey.gaadikey.gaadikey.Fragment_Home.java
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_home, container, false); ImageView thumbnail = (ImageView) view.findViewById(R.id.thumbnail); TextView gaadiname_field = (TextView) view.findViewById(R.id.GaadiName); TextView gaadimsg_field = (TextView) view.findViewById(R.id.GaadiMsg); TextView numberplate_textview = (TextView) view.findViewById(R.id.numberplate); numberplate_textview.setOnClickListener(new View.OnClickListener() { @Override//from w w w . j a v a 2 s . com public void onClick(View view) { ((LaunchActivity_NavDrawer) getActivity()).displayView(6); // This opens up numberplate view! } }); thumbnail.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // Open up the settings view when clicked from here! ((LaunchActivity_NavDrawer) getActivity()).displayView(8); // The 7th option is settings! } }); // Download the Image dynamically, Pinging the Image URL // Get the image path URL by rading the persistant storage SharedPreferences sharedPref = getActivity().getSharedPreferences("android_shared", Context.MODE_PRIVATE); IMAGE_PATH = sharedPref.getString(getString(R.string.KEY_GaadiImage), "default"); // IMAGE_PATH = "http://gaadikey.com/images/GaadiKey_bikes/bajaj/bajaj-discover-100m.jpg"; // hARD CODING THE IMAGE url TO CHECK IF 37KB IMAGE LOADING IS THE ISSUE GAADI_MSG = sharedPref.getString(getString(R.string.KEY_GaadiMsg), "Set status"); GAADI_NAME = sharedPref.getString(getString(R.string.KEY_GaadiName), "Your Vehicle Name here"); gaadimsg_field.setText(GAADI_MSG); gaadiname_field.setText(GAADI_NAME); Log.e("Retrieved IMAGE_PATH ", IMAGE_PATH); Log.e("Retrieved GAADI_MSG ", GAADI_MSG); Log.e("Retrieved GAADI NAME ", GAADI_NAME); if (!IMAGE_PATH.equals("default")) { Picasso.with(getActivity().getBaseContext()).load(IMAGE_PATH).into(thumbnail); } TextView numberplateText = (TextView) view.findViewById(R.id.numberplate); SharedPreferences sharedPref1 = getActivity().getSharedPreferences("android_shared", Context.MODE_PRIVATE); String numberplatestring = sharedPref1.getString(getString(R.string.KEY_GaadiKey_Number_Saved), "KA50Q7896"); Log.e("The retreived number plate string is ", numberplatestring); numberplateText.setText(numberplatestring); // setting the string obtained from the KEY set by number picker change listener Typeface typface = Typeface.createFromAsset(getActivity().getAssets(), "LicensePlate.ttf"); numberplateText.setTypeface(typface); lanes.add("Public Lane"); lanes.add("Friends Lane"); lanes.add("Safety Lane"); lanes.add("Shopping Lane"); lanes.add("News"); listview = (ListView) view.findViewById(R.id.list); listview.setAdapter(new StickyHomeAdapter(getActivity(), lanes)); listview.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> arg0, View arg1, final int position, long arg3) { SharedPreferences sharedPref4 = getActivity().getSharedPreferences("android_shared", Context.MODE_PRIVATE); SharedPreferences.Editor editor_4 = sharedPref4.edit(); editor_4.putString(getString(R.string.KEY_HomeMenu), "" + position); // Incrementing the position by 1 editor_4.commit(); Log.e(" The Item clicked in the list is ", "" + position); ((LaunchActivity_NavDrawer) getActivity()).displayView(position + 1); } }); // Removing the edittext for now // final EditText edittext = (EditText) view.findViewById(R.id.editText_search); // // edittext.setOnEditorActionListener( // new EditText.OnEditorActionListener() { // @Override // public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { // // // // if (event != null) { // // if shift key is down, then we want to insert the '\n' char in the TextView; // // otherwise, the default action is to send the message. // // if (!event.isShiftPressed()) // { // Log.e(" Enter is pressed! ", "Yes"); // //return true; // // Start the activity here // // } // return false; // } // // Log.e("here we are ", "Yes"); // // Intent i = new Intent(getActivity(), LaunchActivity_NavDrawer.class); // i.putExtra("searchString",edittext.getText().toString()); // i.putExtra("view", "normal"); // // SharedPreferences sharedPref4 = getActivity().getSharedPreferences("android_shared", Context.MODE_PRIVATE); // SharedPreferences.Editor editor_4 = sharedPref4.edit(); // editor_4.putString(getString(R.string.KEY_HomeMenu), "0" ); // Incrementing the position by 1 // editor_4.commit(); // startActivity(i); // // return true; // } // }); return view; }
From source file:com.morlunk.mumbleclient.servers.FavouriteServerListFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_server_list, container, false); mServerGrid = (GridView) view.findViewById(R.id.server_list_grid); mServerGrid.setOnItemClickListener(this); mServerGrid.setEmptyView(view.findViewById(R.id.server_list_grid_empty)); TextView donateText = (TextView) view.findViewById(R.id.donate_box); donateText.setVisibility(BuildConfig.DONATE_NAG ? View.VISIBLE : View.GONE); donateText.setOnClickListener(new OnClickListener() { @Override/*from w ww .j a va 2s. c o m*/ public void onClick(View v) { Intent playIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.morlunk.mumbleclient")); startActivity(playIntent); } }); registerForContextMenu(mServerGrid); return view; }
From source file:com.philliphsu.bottomsheetpickers.time.numberpad.GridLayoutNumberPad.java
private void init() { setAlignmentMode(ALIGN_BOUNDS);//from ww w . ja v a 2 s.c om setColumnCount(COLUMNS); View.inflate(getContext(), contentLayout(), this); mButtons[0] = (TextView) findViewById(R.id.bsp_zero); mButtons[1] = (TextView) findViewById(R.id.bsp_one); mButtons[2] = (TextView) findViewById(R.id.bsp_two); mButtons[3] = (TextView) findViewById(R.id.bsp_three); mButtons[4] = (TextView) findViewById(R.id.bsp_four); mButtons[5] = (TextView) findViewById(R.id.bsp_five); mButtons[6] = (TextView) findViewById(R.id.bsp_six); mButtons[7] = (TextView) findViewById(R.id.bsp_seven); mButtons[8] = (TextView) findViewById(R.id.bsp_eight); mButtons[9] = (TextView) findViewById(R.id.bsp_nine); for (TextView tv : mButtons) { tv.setOnClickListener(this); } // If capacity() < 0, we let the system throw the exception. mInput = new int[capacity()]; Arrays.fill(mInput, UNMODIFIED); }
From source file:com.desno365.mods.Tabs.FragmentTab2.java
@Override public View onCreateView(LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragmenttab2, container, false); // xml tab TextView textVersion = (TextView) rootView.findViewById(R.id.latest_version_portal_is); // id TextView version textVersion.setText(MainActivity.modsContainer.portal.getVersion()); // MainActivity variable that holds the latest version TextView textCompatibility = (TextView) rootView.findViewById(R.id.portal_compatibility); // id TextView compatibility textCompatibility.setText(MainActivity.modsContainer.portal.getCompatibility()); // MainActivity variable that holds the versions compatibility final TextView textChangelog = (TextView) rootView.findViewById(R.id.portal_changelog); // id TextView changelog textChangelog.setText(android.text.Html.fromHtml(MainActivity.modsContainer.portal.getChangelog())); // MainActivity variable that holds the latest changelog textChangelog.setMovementMethod(android.text.method.LinkMovementMethod.getInstance()); textChangelog.setMaxLines(SharedConstants.CHANGELOG_TEXT_MAX_LINES); final TextView textShowHide = (TextView) rootView.findViewById(R.id.changelog_show_hide_tab2); // id TextView show/hide changelog textShowHide.setText(getResources().getString(R.string.show_changelog)); textShowHide.setOnClickListener(new View.OnClickListener() { @Override/*from w w w . j a v a2 s . co m*/ public void onClick(View v) { if (!displayingAllChangelog) { // get the TextView height that will be used when hiding the changelog changelogHiddenHeight = textChangelog.getHeight(); DesnoUtils.expandTextView(container, textChangelog); displayingAllChangelog = true; textShowHide.setText(getResources().getString(R.string.hide_changelog)); } else { DesnoUtils.collapseTextView(container, textChangelog, changelogHiddenHeight); displayingAllChangelog = false; textShowHide.setText(getResources().getString(R.string.show_changelog)); } } }); // make the show/hide button invisible if it is not necessary ViewTreeObserver vto = textShowHide.getViewTreeObserver(); vto.addOnGlobalLayoutListener(new android.view.ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { if (textChangelog.getLineCount() <= SharedConstants.CHANGELOG_TEXT_MAX_LINES) { textShowHide.setVisibility(View.GONE); } else { textShowHide.setVisibility(View.VISIBLE); } } }); return rootView; }
From source file:com.desno365.mods.Tabs.FragmentTab3.java
@Override public View onCreateView(LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragmenttab3, container, false); // xml tab TextView textVersion = (TextView) rootView.findViewById(R.id.latest_version_laser_is); // id TextView version textVersion.setText(MainActivity.modsContainer.laser.getVersion()); // MainActivity variable that holds the latest version TextView textCompatibility = (TextView) rootView.findViewById(R.id.laser_compatibility); // id TextView compatibility textCompatibility.setText(MainActivity.modsContainer.laser.getCompatibility()); // MainActivity variable that holds the versions compatibility final TextView textChangelog = (TextView) rootView.findViewById(R.id.laser_changelog); // id TextView changelog textChangelog.setText(android.text.Html.fromHtml(MainActivity.modsContainer.laser.getChangelog())); // MainActivity variable that holds the latest changelog textChangelog.setMovementMethod(android.text.method.LinkMovementMethod.getInstance()); textChangelog.setMaxLines(SharedConstants.CHANGELOG_TEXT_MAX_LINES); final TextView textShowHide = (TextView) rootView.findViewById(R.id.changelog_show_hide_tab3); // id TextView show/hide changelog textShowHide.setText(getResources().getString(R.string.show_changelog)); textShowHide.setOnClickListener(new View.OnClickListener() { @Override//ww w.jav a2 s .co m public void onClick(View v) { if (!displayingAllChangelog) { // get the TextView height that will be used when hiding the changelog changelogHiddenHeight = textChangelog.getHeight(); DesnoUtils.expandTextView(container, textChangelog); displayingAllChangelog = true; textShowHide.setText(getResources().getString(R.string.hide_changelog)); } else { DesnoUtils.collapseTextView(container, textChangelog, changelogHiddenHeight); displayingAllChangelog = false; textShowHide.setText(getResources().getString(R.string.show_changelog)); } } }); // make the show/hide button invisible if it is not necessary ViewTreeObserver vto = textShowHide.getViewTreeObserver(); vto.addOnGlobalLayoutListener(new android.view.ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { if (textChangelog.getLineCount() <= SharedConstants.CHANGELOG_TEXT_MAX_LINES) { textShowHide.setVisibility(View.GONE); } else { textShowHide.setVisibility(View.VISIBLE); } } }); return rootView; }
From source file:com.desno365.mods.Tabs.FragmentTab4.java
@Override public View onCreateView(LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragmenttab4, container, false); // xml tab TextView textVersion = (TextView) rootView.findViewById(R.id.latest_version_turrets_is); // id TextView version textVersion.setText(MainActivity.modsContainer.turrets.getVersion()); // MainActivity variable that holds the latest version TextView textCompatibility = (TextView) rootView.findViewById(R.id.turrets_compatibility); // id TextView compatibility textCompatibility.setText(MainActivity.modsContainer.turrets.getCompatibility()); // MainActivity variable that holds the versions compatibility final TextView textChangelog = (TextView) rootView.findViewById(R.id.turrets_changelog); // id TextView changelog textChangelog.setText(android.text.Html.fromHtml(MainActivity.modsContainer.turrets.getChangelog())); // MainActivity variable that holds the latest changelog textChangelog.setMovementMethod(android.text.method.LinkMovementMethod.getInstance()); textChangelog.setMaxLines(SharedConstants.CHANGELOG_TEXT_MAX_LINES); final TextView textShowHide = (TextView) rootView.findViewById(R.id.changelog_show_hide_tab4); // id TextView show/hide changelog textShowHide.setText(getResources().getString(R.string.show_changelog)); textShowHide.setOnClickListener(new View.OnClickListener() { @Override/* ww w. j a va 2s . c o m*/ public void onClick(View v) { if (!displayingAllChangelog) { // get the TextView height that will be used when hiding the changelog changelogHiddenHeight = textChangelog.getHeight(); DesnoUtils.expandTextView(container, textChangelog); displayingAllChangelog = true; textShowHide.setText(getResources().getString(R.string.hide_changelog)); } else { DesnoUtils.collapseTextView(container, textChangelog, changelogHiddenHeight); displayingAllChangelog = false; textShowHide.setText(getResources().getString(R.string.show_changelog)); } } }); // make the show/hide button invisible if it is not necessary ViewTreeObserver vto = textShowHide.getViewTreeObserver(); vto.addOnGlobalLayoutListener(new android.view.ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { if (textChangelog.getLineCount() <= SharedConstants.CHANGELOG_TEXT_MAX_LINES) { textShowHide.setVisibility(View.GONE); } else { textShowHide.setVisibility(View.VISIBLE); } } }); return rootView; }
From source file:com.desno365.mods.Tabs.FragmentTab5.java
@Override public View onCreateView(LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragmenttab5, container, false); // xml tab TextView textVersion = (TextView) rootView.findViewById(R.id.latest_version_jukebox_is); // id TextView version textVersion.setText(MainActivity.modsContainer.jukebox.getVersion()); // MainActivity variable that holds the latest version TextView textCompatibility = (TextView) rootView.findViewById(R.id.jukebox_compatibility); // id TextView compatibility textCompatibility.setText(MainActivity.modsContainer.jukebox.getCompatibility()); // MainActivity variable that holds the versions compatibility final TextView textChangelog = (TextView) rootView.findViewById(R.id.jukebox_changelog); // id TextView changelog textChangelog.setText(android.text.Html.fromHtml(MainActivity.modsContainer.jukebox.getChangelog())); // MainActivity variable that holds the latest changelog textChangelog.setMovementMethod(android.text.method.LinkMovementMethod.getInstance()); textChangelog.setMaxLines(SharedConstants.CHANGELOG_TEXT_MAX_LINES); final TextView textShowHide = (TextView) rootView.findViewById(R.id.changelog_show_hide_tab5); // id TextView show/hide changelog textShowHide.setText(getResources().getString(R.string.show_changelog)); textShowHide.setOnClickListener(new View.OnClickListener() { @Override//from w w w . j a va 2 s .c o m public void onClick(View v) { if (!displayingAllChangelog) { // get the TextView height that will be used when hiding the changelog changelogHiddenHeight = textChangelog.getHeight(); DesnoUtils.expandTextView(container, textChangelog); displayingAllChangelog = true; textShowHide.setText(getResources().getString(R.string.hide_changelog)); } else { DesnoUtils.collapseTextView(container, textChangelog, changelogHiddenHeight); displayingAllChangelog = false; textShowHide.setText(getResources().getString(R.string.show_changelog)); } } }); // make the show/hide button invisible if it is not necessary ViewTreeObserver vto = textShowHide.getViewTreeObserver(); vto.addOnGlobalLayoutListener(new android.view.ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { if (textChangelog.getLineCount() <= SharedConstants.CHANGELOG_TEXT_MAX_LINES) { textShowHide.setVisibility(View.GONE); } else { textShowHide.setVisibility(View.VISIBLE); } } }); return rootView; }
From source file:com.desno365.mods.Tabs.FragmentTab6.java
@Override public View onCreateView(LayoutInflater inflater, final ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragmenttab6, container, false); // xml tab TextView textVersion = (TextView) rootView.findViewById(R.id.latest_version_guns_is); // id TextView version textVersion.setText(MainActivity.modsContainer.desnoGuns.getVersion()); // MainActivity variable that holds the latest version TextView textCompatibility = (TextView) rootView.findViewById(R.id.guns_compatibility); // id TextView compatibility textCompatibility.setText(MainActivity.modsContainer.desnoGuns.getCompatibility()); // MainActivity variable that holds the versions compatibility final TextView textChangelog = (TextView) rootView.findViewById(R.id.guns_changelog); // id TextView changelog textChangelog.setText(android.text.Html.fromHtml(MainActivity.modsContainer.desnoGuns.getChangelog())); // MainActivity variable that holds the latest changelog textChangelog.setMovementMethod(android.text.method.LinkMovementMethod.getInstance()); textChangelog.setMaxLines(SharedConstants.CHANGELOG_TEXT_MAX_LINES); final TextView textShowHide = (TextView) rootView.findViewById(R.id.changelog_show_hide_tab6); // id TextView show/hide changelog textShowHide.setText(getResources().getString(R.string.show_changelog)); textShowHide.setOnClickListener(new View.OnClickListener() { @Override// www . j a va 2s .c om public void onClick(View v) { if (!displayingAllChangelog) { // get the TextView height that will be used when hiding the changelog changelogHiddenHeight = textChangelog.getHeight(); DesnoUtils.expandTextView(container, textChangelog); displayingAllChangelog = true; textShowHide.setText(getResources().getString(R.string.hide_changelog)); } else { DesnoUtils.collapseTextView(container, textChangelog, changelogHiddenHeight); displayingAllChangelog = false; textShowHide.setText(getResources().getString(R.string.show_changelog)); } } }); // make the show/hide button invisible if it is not necessary ViewTreeObserver vto = textShowHide.getViewTreeObserver(); vto.addOnGlobalLayoutListener(new android.view.ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { if (textChangelog.getLineCount() <= SharedConstants.CHANGELOG_TEXT_MAX_LINES) { textShowHide.setVisibility(View.GONE); } else { textShowHide.setVisibility(View.VISIBLE); } } }); return rootView; }