List of usage examples for android.widget TextView setTextAppearance
@Deprecated public void setTextAppearance(Context context, @StyleRes int resId)
From source file:org.samcrow.ridgesurvey.ObservationActivity.java
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Set up layout setContentView(R.layout.activity_data_entry); final ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); }//from ww w. ja v a2s . c o m mNotesField = (EditText) findViewById(R.id.notes_field); mSpeciesContainer = (ViewGroup) findViewById(R.id.species_container); // Add the no-species checkbox, checked by default mNoSpeciesView = new SpeciesView(this, new Species("None", "none", null, 0)); mNoSpeciesView.setChecked(true); mNoSpeciesView.setOnCheckedChangeListener(mNoSpeciesListener); mSpeciesContainer.addView(mNoSpeciesView); // Load species final InputStream source = getResources().openRawResource(R.raw.species); try { final List<SpeciesGroup> groups = SpeciesStorage.loadSpeciesGroups(this, source); for (SpeciesGroup group : groups) { // Add a medium text view for the species group final TextView groupLabel = new TextView(this, null); groupLabel.setTextAppearance(this, android.R.style.TextAppearance_Medium); groupLabel.setText(group.getName()); mSpeciesContainer.addView(groupLabel); for (Species species : group.getSpecies()) { final SpeciesView speciesView = new SpeciesView(this, species); speciesView.setOnCheckedChangeListener(mOtherSpeciesListener); mSpeciesViews.put(species, speciesView); mSpeciesContainer.addView(speciesView); } } } catch (IOException e) { Log.e(TAG, "Failed to read species input", e); } finally { IOUtils.closeQuietly(source); } }
From source file:me.futuretechnology.blops.ui.BookmarksFragment.java
private void initUI() { // start out with a progress indicator setListShownNoAnimation(false);//from w w w . j a v a 2 s .co m 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.slushpupie.deskclock.ChangelogDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); // Standard AlertDialog does not support HTML-style links. // So rebuild the ScrollView->TextView with the appropriate // settings and set the view directly. TextView tv = new TextView(getActivity()); tv.setPadding(5, 5, 5, 5);/*from w ww. j a v a 2 s. c om*/ tv.setLinksClickable(true); tv.setMovementMethod(LinkMovementMethod.getInstance()); tv.setText(R.string.changeLog); tv.setTextAppearance(getActivity(), android.R.style.TextAppearance_Medium); ScrollView sv = new ScrollView(getActivity()); sv.setPadding(14, 2, 10, 12); sv.addView(tv); builder.setView(sv).setCancelable(false).setTitle(R.string.changeLogTitle).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { ((DeskClock) getActivity()).acknoledgeChangelog(); } }); return builder.create(); }
From source file:com.github.tetravex_android.fragment.HiScoreTableFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_score_table, container, false); // Set the label for the size of the board TextView tableSize = (TextView) rootView.findViewById(R.id.hi_score_board_size); tableSize.setText(mLabel);/*w ww . jav a 2 s . c o m*/ TableLayout table = (TableLayout) rootView.findViewById(R.id.hi_score_table_layout); // fill the table from the database cursor if (mScoreCursor != null) { // move cursor to first row, will return false if cursor is empty if (mScoreCursor.moveToFirst()) { do { // set time from the database entry, format text TextView timeTv = new TextView(rootView.getContext()); timeTv.setText(mScoreCursor.getString(Constants.DB_TIME_COL_IDX)); timeTv.setTextAppearance(rootView.getContext(), R.style.score_table_entry); // set date from the database entry, format text TextView dateTv = new TextView(rootView.getContext()); String unixTimeStr = mScoreCursor.getString(Constants.DB_DATE_COL_IDX); long unixSeconds = Long.valueOf(unixTimeStr); Date date = new Date(unixSeconds); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String formattedDate = sdf.format(date); dateTv.setText(formattedDate); dateTv.setTextAppearance(rootView.getContext(), R.style.score_table_entry); // add the Views from the database entry to the TableLayout TableRow row = new TableRow(rootView.getContext()); row.addView(timeTv); row.addView(dateTv); table.addView(row); // add row separator View spacerView = new View(rootView.getContext()); TableLayout.LayoutParams params = new TableLayout.LayoutParams(); params.width = TableLayout.LayoutParams.MATCH_PARENT; params.height = 1; spacerView.setLayoutParams(params); spacerView.setBackgroundColor(getResources().getColor(R.color.tile_bkgnd_gray)); table.addView(spacerView); // move to next row } while (mScoreCursor.moveToNext()); } } return rootView; }
From source file:io.palaima.debugdrawer.location.LocationModule.java
@NonNull @Override/*w ww . j a v a2 s . com*/ public View onCreateView(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent) { checkPermission(); GoogleApiAvailability api = GoogleApiAvailability.getInstance(); boolean available = api.isGooglePlayServicesAvailable(context) == ConnectionResult.SUCCESS; if (available && hasPermission) { locationController = LocationController.newInstance(context); if (locationRequest != null) { locationController.setLocationRequest(locationRequest); } } if (locationController != null && hasPermission) { View view = inflater.inflate(R.layout.dd_debug_drawer_module_location, parent, false); latitude = (TextView) view.findViewById(R.id.dd_debug_location_latitude); longitude = (TextView) view.findViewById(R.id.dd_debug_location_longitude); accuracy = (TextView) view.findViewById(R.id.dd_debug_location_accuracy); time = (TextView) view.findViewById(R.id.dd_debug_location_time); provider = (TextView) view.findViewById(R.id.dd_debug_location_provider); view.findViewById(R.id.dd_debug_location_map).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { openMaps(context); } }); locationController.setLocationListener(new LocationListener() { @Override public void onLocationChanged(Location location) { if (opened) { updateLocation(location); } } }); updateLastLocation(); return view; } else if (!hasPermission) { TextView errorText = new TextView(context); errorText.setTextAppearance(context, R.style.Widget_DebugDrawer_Base_Header); errorText.setText(R.string.dd_debug_drawer_location_no_permission); return errorText; } else { TextView errorText = new TextView(context); errorText.setTextAppearance(context, R.style.Widget_DebugDrawer_Base_Header); errorText.setText(R.string.dd_debug_drawer_location_google_play_unavailable); return errorText; } }
From source file:de.fahrgemeinschaft.util.ReoccuringWeekDaysView.java
private TextView makeRecurringDayButton(Context ctx) { TextView day = new UnScrollingTextView(ctx); if (clickable) day.setOnClickListener(toggleSelectedState); LayoutParams lp = new LayoutParams(0, LayoutParams.MATCH_PARENT); lp.weight = 1;/*from www . j a v a2 s.co m*/ day.setLayoutParams(lp); day.setTextAppearance(getContext(), R.style.dark_Bold); day.setBackgroundResource(R.drawable.btn_night); day.setGravity(Gravity.CENTER); day.setFocusable(true); return day; }
From source file:org.mariotaku.twidere.fragment.support.BaseSupportListFragment.java
/** * Provide default implementation to return a simple list view. Subclasses * can override to replace with their own layout. If doing so, the returned * view hierarchy <em>must</em> have a ListView whose id is * {@link android.R.id#list android.R.id.list} and can optionally have a * sibling view id {@link android.R.id#empty android.R.id.empty} that is to * be shown when the list is empty.//from w w w. j a va2 s . com * * <p> * If you are overriding this method with your own custom content, consider * including the standard layout {@link android.R.layout#list_content} in * your layout file, so that you continue to retain all of the standard * behavior of ListFragment. In particular, this is currently the only way * to have the built-in indeterminant progress state be shown. */ @Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { final Context context = getActivity(); final FrameLayout root = new FrameLayout(context); // ------------------------------------------------------------------ final LinearLayout pframe = new LinearLayout(context); pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID); pframe.setOrientation(LinearLayout.VERTICAL); pframe.setVisibility(View.GONE); pframe.setGravity(Gravity.CENTER); final ProgressBar progress = new ProgressBar(context, null, android.R.attr.progressBarStyleLarge); pframe.addView(progress, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); root.addView(pframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ final FrameLayout lframe = new FrameLayout(context); lframe.setId(INTERNAL_LIST_CONTAINER_ID); final TextView tv = new TextView(getActivity()); tv.setTextAppearance(context, ThemeUtils.getTextAppearanceLarge(context)); tv.setId(INTERNAL_EMPTY_ID); tv.setGravity(Gravity.CENTER); lframe.addView(tv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); final ListView lv = new ListView(getActivity()); lv.setId(android.R.id.list); lv.setDrawSelectorOnTop(false); lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); root.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); // ------------------------------------------------------------------ root.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); return root; }
From source file:yahier.exst.widget.SlidingTabLayout.java
/** * Create a default view to be used for tabs. This is called if a custom tab view is not set via * {@link #setCustomTabView(int, int)}.//ww w. ja v a 2 s .c o m */ protected TextView createDefaultTabView(Context context) { TextView textView = new TextView(context); textView.setGravity(Gravity.CENTER); textView.setTextAppearance(getContext(), R.style.TabTextStyle); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { //textView.setBackgroundResource(R.drawable.list_selector_white); } int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density); textView.setPadding(padding, padding, padding, padding); return textView; }
From source file:org.mmi.android.genericquest.QuestManager.java
@Override protected void onResume() { super.onResume(); /// show results if work is done if (_results != null && _results.size() > 0) { /// do it using textviews // fill the GUI int i = 0; Iterator it = _results.iterator(); LinearLayout layout = (LinearLayout) findViewById(R.id.mainLayout); ScrollView sview = (ScrollView) findViewById(R.id.svResults); while (it.hasNext()) { TextView tv = new TextView(this); tv.setText("Q" + i + ": " + it.next()); tv.setTextAppearance(this, android.R.style.TextAppearance_DeviceDefault_Medium); layout.addView(tv);/*www. j a v a2s . c o m*/ i++; } /// do it using a model /* // create a modified results list ArrayList aux_l = new ArrayList<String>(); int i = 0; Iterator it = _results.iterator(); while (it.hasNext()){ String original = (String)it.next(); aux_l.add("Question " + i + ": " + original); i++; } // fill the list... ListView lv = (ListView)findViewById(R.id.lvResults); ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, aux_l); lv.setAdapter(adapter); */ } }
From source file:com.repay.android.StartFragment.java
public void showTotalDialog() { AlertDialog.Builder dialog = new AlertDialog.Builder(getActivity()); dialog.setTitle(R.string.action_total); TextView txt = new TextView(getActivity()); txt.setText(SettingsFragment.getCurrencySymbol(getActivity()) + calculateTotalDebt().toString()); dialog.setView(txt);//ww w. j a v a 2 s.c om txt.setTextAppearance(getActivity(), R.style.TotalDialog); txt.setGravity(Gravity.CENTER); dialog.setPositiveButton(R.string.done, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); dialog.show(); }