List of usage examples for android.widget TextView setTextAppearance
@Deprecated public void setTextAppearance(Context context, @StyleRes int resId)
From source file:hu.fnf.devel.atlas.Atlas.java
private void setDetailProperties(int page_id) { LinearLayout root = (LinearLayout) findViewById(R.id.detailcatRoot); root.setOrientation(android.widget.LinearLayout.VERTICAL); LinearLayout in = new LinearLayout(getApplicationContext()); in.setId(AtlasData.INCOME);/* w w w. j av a2 s . co m*/ in.setOnClickListener(onCatClick); LinearLayout out = new LinearLayout(getApplicationContext()); out.setId(AtlasData.OUTCOME); out.setOnClickListener(onCatClick); TextView intext = new TextView(getApplicationContext()); intext.setText(getResources().getString(R.string.income)); intext.setOnClickListener(onCatClick); intext.setId(AtlasData.INCOME); intext.setTextAppearance(getApplicationContext(), android.R.style.TextAppearance_Medium_Inverse); TextView outtext = new TextView(getApplicationContext()); outtext.setText(getResources().getString(R.string.outcome)); outtext.setOnClickListener(onCatClick); outtext.setId(AtlasData.OUTCOME); outtext.setTextAppearance(getApplicationContext(), android.R.style.TextAppearance_Medium_Inverse); in.addView(intext); out.addView(outtext); root.addView(in); addChilds(in, root); root.addView(out); addChilds(out, root); }
From source file:ru.adios.budgeter.widgets.DataTableLayout.java
private void populateColumn(TextView view, Context context, float weight) { view.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT, weight)); view.setId(ElementsIdProvider.getNextId()); view.setBackground(ContextCompat.getDrawable(context, R.drawable.cell_shape)); final int fiveDp = getDpAsPixels(5, context); view.setPadding(fiveDp, fiveDp, fiveDp, fiveDp); view.setTextAppearance(context, android.R.style.TextAppearance_Small); }
From source file:com.github.vseguip.sweet.contacts.SweetConflictResolveActivity.java
/** * @param fieldTable//from w w w . j a v a2 s . c om * @param nameOfField * @param field */ private void addConflictRow(TableLayout fieldTable, final String nameOfField, final String fieldLocal, final String fieldRemote) { if (mCurrentLocal == null || mCurrentSugar == null) return; // String fieldLocal = mCurrentLocal.get(nameOfField); // String fieldRemote = mCurrentSugar.get(nameOfField); TableRow row = new TableRow(this); final Spinner sourceSelect = new Spinner(this); sourceSelect.setBackgroundResource(R.drawable.black_underline); ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, this.getResources().getStringArray(R.array.conflict_sources)); spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); sourceSelect.setAdapter(spinnerArrayAdapter); // Open the spinner when pressing any of the text fields OnClickListener spinnerOpener = new OnClickListener() { @Override public void onClick(View v) { sourceSelect.performClick(); } }; row.addView(sourceSelect); fieldTable.addView(row); row = new TableRow(this); TextView fieldName = new TextView(this); int stringId = this.getResources().getIdentifier(nameOfField, "string", this.getPackageName()); fieldName.setText(this.getString(stringId)); fieldName.setTextSize(16); fieldName.setPadding(fieldName.getPaddingLeft(), fieldName.getPaddingTop(), fieldName.getPaddingRight() + 10, fieldName.getPaddingBottom()); fieldName.setOnClickListener(spinnerOpener); row.addView(fieldName); final TextView fieldValueLocal = new TextView(this); fieldValueLocal.setText(fieldLocal); fieldValueLocal.setTextSize(16); row.addView(fieldValueLocal); fieldValueLocal.setOnClickListener(spinnerOpener); fieldTable.addView(row); row = new TableRow(this); row.addView(new TextView(this));// add dummy control final TextView fieldValueRemote = new TextView(this); fieldValueRemote.setText(fieldRemote); fieldValueRemote.setTextSize(16); fieldValueRemote.setOnClickListener(spinnerOpener); row.addView(fieldValueRemote); sourceSelect.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (position == 0) { fieldValueLocal.setTextAppearance(SweetConflictResolveActivity.this, R.style.textSelected); fieldValueRemote.setTextAppearance(SweetConflictResolveActivity.this, R.style.textUnselected); resolvedContacts[mPosResolved].set(nameOfField, fieldLocal); } else { fieldValueLocal.setTextAppearance(SweetConflictResolveActivity.this, R.style.textUnselected); fieldValueRemote.setTextAppearance(SweetConflictResolveActivity.this, R.style.textSelected); resolvedContacts[mPosResolved].set(nameOfField, fieldRemote); } } @Override public void onNothingSelected(AdapterView<?> view) { } }); row.setPadding(row.getLeft(), row.getTop() + 5, row.getRight(), row.getBottom() + 10); // Restore appropiate selections according to resolved contact if (resolvedContacts[mPosResolved].get(nameOfField).equals(fieldLocal)) { sourceSelect.setSelection(0); } else { sourceSelect.setSelection(1); } fieldTable.addView(row); }
From source file:eu.trentorise.smartcampus.jp.MonitorJourneyFragment.java
@Override protected void setUpMainOperation() { // if (params.getClientId() == null) { // getView().findViewById(R.id.recurr_delete).setVisibility(View.GONE); // } else {//from w w w .ja v a2 s. com // ((Button) // getView().findViewById(R.id.recurr_delete)).setOnClickListener(new // View.OnClickListener() { // // @Override // public void onClick(View v) { // SCAsyncTask<String, Void, Void> task = new SCAsyncTask<String, Void, // Void>(getSherlockActivity(), // new DeleteMyRecurItineraryProcessor(getSherlockActivity())); // task.execute(params.getName(), params.getClientId()); // } // }); // } Button nextButton = (Button) getView().findViewById(R.id.recurr_next); nextButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // user preferences View userPrefsLayout = (View) getView().findViewById(R.id.plannew_userprefs); alwaysCheckbox = (CheckBox) getView().findViewById(R.id.always_checkbox); if (userPrefsLayout.isShown()) { TableLayout tTypesTableLayout = (TableLayout) userPrefsLayout .findViewById(R.id.transporttypes_table); RadioGroup rTypesRadioGroup = (RadioGroup) userPrefsLayout .findViewById(R.id.routetypes_radioGroup); userPrefsHolder = PrefsHelper.userPrefsViews2Holder(tTypesTableLayout, rTypesRadioGroup, userPrefs); } else { userPrefsHolder = PrefsHelper.sharedPreferences2Holder(userPrefs); } // EditText name = (EditText) getView().findViewById(R.id.name); // if (name.getText() == null || // name.getText().toString().length() == 0) { // Toast.makeText(getActivity(), R.string.name_field_empty, // Toast.LENGTH_SHORT).show(); // return; // } // params.setName(name.getText().toString().trim()); // params.setMonitor(((CheckBox) // getView().findViewById(R.id.recur_monitor)).isChecked()); RecurrentJourneyParameters rj = params.getData().getParameters(); if (fromPosition == null) { // Toast.makeText(getActivity(), R.string.from_field_empty, // Toast.LENGTH_SHORT).show(); ValidatorHelper.highlight(getSherlockActivity(), fromEditText, getResources().getString(R.string.from_field_empty)); return; } if (toPosition == null) { // Toast.makeText(getActivity(), R.string.to_field_empty, // Toast.LENGTH_SHORT).show(); ValidatorHelper.highlight(getSherlockActivity(), toEditText, getResources().getString(R.string.to_field_empty)); return; } rj.setFrom(fromPosition); rj.setTo(toPosition); Date fromDateD; Date fromTimeD; Date toDateD; Date toTimeD; CharSequence timeString = fromDate.getText(); if (timeString == null) { // Toast.makeText(getActivity(), // R.string.from_date_field_empty, // Toast.LENGTH_SHORT).show(); ValidatorHelper.highlight(getSherlockActivity(), fromDate, getResources().getString(R.string.from_date_field_empty)); return; } else { try { fromDateD = Config.FORMAT_DATE_UI.parse(timeString.toString()); rj.setFromDate(fromDateD.getTime()); } catch (ParseException e) { // Toast.makeText(getActivity(), // R.string.from_date_field_empty, // Toast.LENGTH_SHORT).show(); ValidatorHelper.highlight(getSherlockActivity(), fromDate, getResources().getString(R.string.from_date_field_empty)); return; } } timeString = fromTime.getText(); if (timeString == null) { // Toast.makeText(getActivity(), // R.string.from_time_field_empty, // Toast.LENGTH_SHORT).show(); ValidatorHelper.highlight(getSherlockActivity(), fromTime, getResources().getString(R.string.from_time_field_empty)); return; } else { try { fromTimeD = Config.FORMAT_TIME_UI.parse(timeString.toString()); rj.setTime(Config.FORMAT_TIME_SMARTPLANNER.format(fromTimeD)); } catch (ParseException e) { // Toast.makeText(getActivity(), // R.string.from_time_field_empty, // Toast.LENGTH_SHORT).show(); ValidatorHelper.highlight(getSherlockActivity(), fromTime, getResources().getString(R.string.from_time_field_empty)); return; } } // if // (!eu.trentorise.smartcampus.jp.helper.Utils.validFromDateTime(fromDateD, // fromTimeD)) { // Toast.makeText(getActivity(), R.string.datetime_before_now, // Toast.LENGTH_SHORT).show(); // return; // } if (alwaysCheckbox.isChecked()) { rj.setToDate(Config.ALWAYS_DATE); } timeString = toDate.getText(); if (!alwaysCheckbox.isChecked()) if (timeString == null) { // Toast.makeText(getActivity(), // R.string.to_date_field_empty, // Toast.LENGTH_SHORT).show(); ValidatorHelper.highlight(getSherlockActivity(), toDate, getResources().getString(R.string.to_date_field_empty)); return; } else { try { toDateD = Config.FORMAT_DATE_UI.parse(timeString.toString()); rj.setToDate(toDateD.getTime()); if (rj.getFromDate() == rj.getToDate()) rj.setToDate(rj.getToDate() + (24 * 60 * 60 * 1000)); if ((rj.getToDate() < rj.getFromDate()) && !alwaysCheckbox.isChecked()) { // Toast.makeText(getActivity(), // R.string.to_date_before_from_date, // Toast.LENGTH_SHORT).show(); ValidatorHelper.highlight(getSherlockActivity(), toDate, getResources().getString(R.string.to_date_before_from_date)); return; } } catch (ParseException e) { // Toast.makeText(getActivity(), // R.string.to_date_field_empty, // Toast.LENGTH_SHORT).show(); ValidatorHelper.highlight(getSherlockActivity(), toDate, getResources().getString(R.string.to_date_field_empty)); return; } } else toDateD = new Date(Config.ALWAYS_DATE); timeString = toTime.getText(); if (timeString == null) { // Toast.makeText(getActivity(), // R.string.to_time_field_empty, Toast.LENGTH_SHORT).show(); ValidatorHelper.highlight(getSherlockActivity(), toTime, getResources().getString(R.string.to_time_field_empty)); return; } else { try { // if the interval is negative, add an entire day toTimeD = Config.FORMAT_TIME_UI.parse(timeString.toString()); rj.setInterval(toTimeD.getTime() - fromTimeD.getTime()); if (rj.getInterval() < 0) rj.setInterval(rj.getInterval() + 24 * 60 * 60 * 1000); if (rj.getInterval() > Config.MAX_RECUR_INTERVAL) { // Toast.makeText(getActivity(), // R.string.interval_too_large, // Toast.LENGTH_SHORT).show(); ValidatorHelper.highlight(getSherlockActivity(), toTime, getResources().getString(R.string.interval_too_large)); return; } } catch (ParseException e) { // Toast.makeText(getActivity(), // R.string.to_time_field_empty, // Toast.LENGTH_SHORT).show(); ValidatorHelper.highlight(getSherlockActivity(), toTime, getResources().getString(R.string.to_time_field_empty)); return; } } if (!eu.trentorise.smartcampus.jp.helper.Utils.validFromDateTimeToDateTime(fromDateD, fromTimeD, toDateD, toTimeD) && !alwaysCheckbox.isChecked()) { // Toast.makeText(getActivity(), // R.string.datetime_to_before_from, // Toast.LENGTH_SHORT).show(); ValidatorHelper.highlight(getSherlockActivity(), toTime, getResources().getString(R.string.datetime_to_before_from)); return; } rj.setTransportTypes((TType[]) userPrefsHolder.getTransportTypes()); rj.setRouteType(userPrefsHolder.getRouteType()); /* set recurrence on the ui */ rj.setRecurrence(new ArrayList<Integer>()); ToggleButton tmpToggle = (ToggleButton) getView().findViewById(R.id.monday_toggle); if (tmpToggle.isChecked()) rj.getRecurrence().add(2); tmpToggle = (ToggleButton) getView().findViewById(R.id.tuesday_toggle); if (tmpToggle.isChecked()) rj.getRecurrence().add(3); tmpToggle = (ToggleButton) getView().findViewById(R.id.wednesday_toggle); if (tmpToggle.isChecked()) rj.getRecurrence().add(4); tmpToggle = (ToggleButton) getView().findViewById(R.id.thursday_toggle); if (tmpToggle.isChecked()) rj.getRecurrence().add(5); tmpToggle = (ToggleButton) getView().findViewById(R.id.friday_toggle); if (tmpToggle.isChecked()) rj.getRecurrence().add(6); tmpToggle = (ToggleButton) getView().findViewById(R.id.saturday_toggle); if (tmpToggle.isChecked()) rj.getRecurrence().add(7); tmpToggle = (ToggleButton) getView().findViewById(R.id.sunday_toggle); if (tmpToggle.isChecked()) rj.getRecurrence().add(1); if (rj.getRecurrence().isEmpty()) { ValidatorHelper.highlight(getSherlockActivity(), getView().findViewById(R.id.monday_toggle), getResources().getString(R.string.no_days_selected)); // Toast.makeText(getActivity(), R.string.no_days_selected, Toast.LENGTH_SHORT).show(); return; } FragmentTransaction fragmentTransaction = getSherlockActivity().getSupportFragmentManager() .beginTransaction(); Fragment fragment = new MyRecurItineraryFragment(); Bundle b = new Bundle(); b.putSerializable(MyRecurItineraryFragment.PARAMS, params); b.putBoolean(MyRecurItineraryFragment.PARAM_EDITING, true); fragment.setArguments(b); fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); fragmentTransaction.replace(Config.mainlayout, fragment, MonitorJourneyFragment.this.getTag()); fragmentTransaction.addToBackStack(fragment.getTag()); fragmentTransaction.commit(); // SCAsyncTask<BasicRecurrentJourneyParameters, Void, // RecurrentJourney> task = new // SCAsyncTask<BasicRecurrentJourneyParameters, Void, // RecurrentJourney>( // getSherlockActivity(), new // PlanRecurJourneyProcessor(getSherlockActivity())); // /*creare i parametri per la chiamata*/ // BasicRecurrentJourneyParameters parameters = new // BasicRecurrentJourneyParameters(); // /*fill the params*/ // parameters.setClientId(params.getClientId()); // parameters.setData(rj); // parameters.setMonitor(monitorToggleBtn.isChecked()); // parameters.setName(params.getName()); // task.execute(parameters); } }); // add listener on alwayscheck alwaysCheckbox = (CheckBox) getView().findViewById(R.id.always_checkbox); alwaysCheckbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { // disable the toDate toDate.setEnabled(false); } else { // enable the toDate toDate.setEnabled(true); } } }); monitorLayout = (LinearLayout) getView().findViewById(R.id.myitinerary_toggle_layout); if (params.getClientId() != null) { monitorLayout.setVisibility(View.VISIBLE); monitorToggleBtn = (ToggleButton) getView().findViewById(R.id.myitinerary_toggle); TextView monitorLabel = (TextView) getView().findViewById(R.id.myitinerary_monitor_label); // monitorToggleBtn.setChecked(myItinerary.isMonitor()); monitorToggleBtn.setOnCheckedChangeListener(null); monitorToggleBtn.setChecked(params.isMonitor()); if (params.isMonitor()) { monitorToggleBtn.setBackgroundResource(R.drawable.ic_monitor_on); monitorLabel.setText(getString(R.string.monitor_on)); monitorLabel.setTextAppearance(getSherlockActivity(), R.style.label_jp); } else { monitorToggleBtn.setBackgroundResource(R.drawable.ic_monitor_off); monitorLabel.setText(getString(R.string.monitor_off)); monitorLabel.setTextAppearance(getSherlockActivity(), R.style.label_black_jp); } monitorToggleBtn.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { SCAsyncTask<String, Void, Boolean> task = new SCAsyncTask<String, Void, Boolean>( getSherlockActivity(), new MonitorMyRecItineraryProcessor(getSherlockActivity())); task.execute(Boolean.toString(isChecked), params.getClientId()); } }); } else monitorLayout.setVisibility(View.GONE); }
From source file:terse.a1.TerseActivity.java
@Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); glSurfaceView = null; // Forget gl on new activity. requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); if (savedInstanceState != null && savedInstanceState.containsKey("TerseActivity")) { taSaveMe = savedInstanceState.getString("TerseActivity"); } else {//from w w w . j a va 2 s . c om taSaveMe = null; } Runnable bg = new Runnable() { @Override public void run() { resetTerp(); } }; Runnable fg = new Runnable() { @Override public void run() { Intent intent = getIntent(); Uri uri = intent.getData(); Bundle extras = intent.getExtras(); String path = uri == null ? "/" : uri.getPath(); String query = uri == null ? "" : uri.getQuery(); viewPath(path, query, extras, savedInstanceState); } }; if (terp == null) { TextView tv = new TextView(TerseActivity.this); tv.setText(Static.fmt("Building new TerseTalk VM for world <%s>...", world)); tv.setTextAppearance(this, R.style.teletype); tv.setBackgroundColor(Color.BLACK); tv.setTextColor(Color.DKGRAY); tv.setTextSize(24); setContentView(tv); setContentViewThenBgThenFg("ResetSplash", tv, bg, fg); } else { fg.run(); } }
From source file:terse.a1.TerseActivity.java
public void viewPath(String path, String queryStr, Bundle extras, Bundle savedInstanceState) { // Stop any running WorkThread before we continue. viewPath1prepare(path, queryStr);// w w w . ja v a2 s . c o m viewPath2parseQuery(queryStr, extras); final LayoutParams widgetParams = new LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT, 1.0f); TextView splash = new TextView(TerseActivity.this); splash.setText("Launching\n\n" + taPath + "\n\n" + Static.hashMapToMultiLineString(taQuery)); splash.setTextAppearance(this, R.style.teletype); splash.setBackgroundColor(Color.BLACK); splash.setTextColor(Color.DKGRAY); splash.setTextSize(24); Runnable bg = new Runnable() { @Override public void run() { try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } } }; Runnable fg = new Runnable() { @Override public void run() { viewPath9display(taPath, widgetParams); } }; setContentViewThenBgThenFg("viewPath8", splash, bg, fg); }
From source file:com.adarshahd.indianrailinfo.donate.PNRStat.java
private void createTableLayoutPsnDtls() { if (mPageResult.contains("FLUSHED PNR / ") || mPageResult.contains("Invalid PNR")) { mTextViewPNRSts.setText("The PNR entered is either invalid or expired! Please check."); mFrameLayout.removeAllViews();/* w w w. j ava2 s . co m*/ mFrameLayout.addView(mTextViewPNRSts); mStrPassengerDetails = null; return; } if (mPageResult.contains("Connectivity Failure") || mPageResult.contains("try again")) { mTextViewPNRSts.setText("Looks like server is busy or currently unavailable. Please try again later!"); mFrameLayout.removeAllViews(); mFrameLayout.addView(mTextViewPNRSts); mStrPassengerDetails = null; return; } List<List<String>> passengersList; if (mPassengerDetails == null || mPassengerDetails.getPNR() != mPNRNumber) { Elements elements = Jsoup.parse(mPageResult).select("table tr td:containsOwn(S. No.)"); Iterator iterator = null; try { iterator = elements.first().parent().parent().getElementsByTag("tr").iterator(); } catch (Exception e) { Log.i("PNRStat", mPageResult); return; } passengersList = new ArrayList<List<String>>(); List<String> list; Element tmp; while (iterator.hasNext()) { tmp = (Element) iterator.next(); if (tmp.toString().contains("Passenger")) { list = new ArrayList<String>(); list.add(tmp.select("td").get(0).text()); list.add(tmp.select("td").get(1).text()); list.add(tmp.select("td").get(2).text()); if (!tmp.select("td").get(2).text().toUpperCase().contains("CNF") && !tmp.select("td").get(2).text().toUpperCase().contains("CAN")) { isWaitingList = true; } passengersList.add(list); } } mPassengerDetails = new PassengerDetails(passengersList, mPNRNumber); } else { passengersList = mPassengerDetails.getPassengerList(); } mTableLayoutPsn = new TableLayout(mActivity); TableRow row; TextView tv1, tv2, tv3, tv4; mStrPassengerDetails = new ArrayList<String>(); int current; mTableLayoutPsn.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); for (int i = 0; i < passengersList.size(); ++i) { current = i + 1; row = new TableRow(mActivity); row.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); tv1 = new TextView(mActivity); tv2 = new TextView(mActivity); tv3 = new TextView(mActivity); tv4 = new TextView(mActivity); tv1.setText("" + (i + 1) + "."); tv2.setText(" " + passengersList.get(i).get(0)); tv3.setText(" " + passengersList.get(i).get(1)); tv4.setText(" " + passengersList.get(i).get(2)); tv1.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Medium); tv2.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Medium); tv3.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Medium); tv4.setTextAppearance(mActivity, android.R.style.TextAppearance_DeviceDefault_Medium); tv1.setPadding(10, 10, 10, 10); tv2.setPadding(10, 10, 10, 10); tv3.setPadding(10, 10, 10, 10); tv4.setPadding(10, 10, 10, 10); row.addView(tv1); row.addView(tv2); row.addView(tv3); row.addView(tv4); row.setBackgroundResource(R.drawable.card_background); row.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); mTableLayoutPsn.addView(row); String strPsn = "" + current + ". " + passengersList.get(i).get(0) + " " + passengersList.get(i).get(1) + " " + passengersList.get(i).get(2); mStrPassengerDetails.add(strPsn); } }
From source file:com.vonglasow.michael.satstat.MainActivity.java
protected static void showCellCdma(CellTowerCdma cell) { TableRow row = new TableRow(rilCdmaCells.getContext()); row.setWeightSum(26);/*from www. j a va2 s. c om*/ TextView newType = new TextView(rilCdmaCells.getContext()); newType.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 2)); newType.setTextAppearance(rilCdmaCells.getContext(), android.R.style.TextAppearance_Medium); newType.setTextColor( rilCdmaCells.getContext().getResources().getColor(getColorFromGeneration(cell.getGeneration()))); newType.setText(rilCdmaCells.getContext().getResources().getString(R.string.smallDot)); row.addView(newType); TextView newSid = new TextView(rilCdmaCells.getContext()); newSid.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 6)); newSid.setTextAppearance(rilCdmaCells.getContext(), android.R.style.TextAppearance_Medium); newSid.setText(formatCellData(rilCdmaCells.getContext(), null, cell.getSid())); row.addView(newSid); TextView newNid = new TextView(rilCdmaCells.getContext()); newNid.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 5)); newNid.setTextAppearance(rilCdmaCells.getContext(), android.R.style.TextAppearance_Medium); newNid.setText(formatCellData(rilCdmaCells.getContext(), null, cell.getNid())); row.addView(newNid); TextView newBsid = new TextView(rilCdmaCells.getContext()); newBsid.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 9)); newBsid.setTextAppearance(rilCdmaCells.getContext(), android.R.style.TextAppearance_Medium); newBsid.setText(formatCellData(rilCdmaCells.getContext(), null, cell.getBsid())); row.addView(newBsid); TextView newDbm = new TextView(rilCdmaCells.getContext()); newDbm.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 4)); newDbm.setTextAppearance(rilCdmaCells.getContext(), android.R.style.TextAppearance_Medium); newDbm.setText(formatCellDbm(rilCdmaCells.getContext(), null, cell.getDbm())); row.addView(newDbm); rilCdmaCells.addView(row, new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); }
From source file:com.vonglasow.michael.satstat.MainActivity.java
protected static void showCellGsm(CellTowerGsm cell) { TableRow row = new TableRow(rilCells.getContext()); row.setWeightSum(29);//from ww w . ja v a 2 s.co m TextView newType = new TextView(rilCells.getContext()); newType.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 2)); newType.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium); newType.setTextColor( rilCells.getContext().getResources().getColor(getColorFromGeneration(cell.getGeneration()))); newType.setText(rilCells.getContext().getResources().getString(R.string.smallDot)); row.addView(newType); TextView newMcc = new TextView(rilCells.getContext()); newMcc.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3)); newMcc.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium); newMcc.setText(formatCellData(rilCells.getContext(), "%03d", cell.getMcc())); row.addView(newMcc); TextView newMnc = new TextView(rilCells.getContext()); newMnc.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3)); newMnc.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium); newMnc.setText(formatCellData(rilCells.getContext(), "%02d", cell.getMnc())); row.addView(newMnc); TextView newLac = new TextView(rilCells.getContext()); newLac.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 5)); newLac.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium); newLac.setText(formatCellData(rilCells.getContext(), null, cell.getLac())); row.addView(newLac); TextView newCid = new TextView(rilCells.getContext()); newCid.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 9)); newCid.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium); newCid.setText(formatCellData(rilCells.getContext(), null, cell.getCid())); row.addView(newCid); TextView newPsc = new TextView(rilCells.getContext()); newPsc.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3)); newPsc.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium); newPsc.setText(formatCellData(rilCells.getContext(), null, cell.getPsc())); row.addView(newPsc); TextView newDbm = new TextView(rilCells.getContext()); newDbm.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 4)); newDbm.setTextAppearance(rilCells.getContext(), android.R.style.TextAppearance_Medium); newDbm.setText(formatCellDbm(rilCells.getContext(), null, cell.getDbm())); row.addView(newDbm); rilCells.addView(row, new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); }
From source file:com.vonglasow.michael.satstat.MainActivity.java
protected static void showCellLte(CellTowerLte cell) { TableRow row = new TableRow(rilLteCells.getContext()); row.setWeightSum(29);//from w ww . j av a2 s . c o m TextView newType = new TextView(rilLteCells.getContext()); newType.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 2)); newType.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium); newType.setTextColor( rilLteCells.getContext().getResources().getColor(getColorFromGeneration(cell.getGeneration()))); newType.setText(rilLteCells.getContext().getResources().getString(R.string.smallDot)); row.addView(newType); TextView newMcc = new TextView(rilLteCells.getContext()); newMcc.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3)); newMcc.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium); newMcc.setText(formatCellData(rilLteCells.getContext(), "%03d", cell.getMcc())); row.addView(newMcc); TextView newMnc = new TextView(rilLteCells.getContext()); newMnc.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3)); newMnc.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium); newMnc.setText(formatCellData(rilLteCells.getContext(), "%02d", cell.getMnc())); row.addView(newMnc); TextView newTac = new TextView(rilLteCells.getContext()); newTac.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 5)); newTac.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium); newTac.setText(formatCellData(rilLteCells.getContext(), null, cell.getTac())); row.addView(newTac); TextView newCi = new TextView(rilLteCells.getContext()); newCi.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 9)); newCi.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium); newCi.setText(formatCellData(rilLteCells.getContext(), null, cell.getCi())); row.addView(newCi); TextView newPci = new TextView(rilLteCells.getContext()); newPci.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 3)); newPci.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium); newPci.setText(formatCellData(rilLteCells.getContext(), null, cell.getPci())); row.addView(newPci); TextView newDbm = new TextView(rilLteCells.getContext()); newDbm.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 4)); newDbm.setTextAppearance(rilLteCells.getContext(), android.R.style.TextAppearance_Medium); newDbm.setText(formatCellDbm(rilLteCells.getContext(), null, cell.getDbm())); row.addView(newDbm); rilLteCells.addView(row, new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); }