protected void initializeBoard() { size = 3; board = new int[size][size]; mainBoard = findViewById(R.id.mainBoard); tv_turn = findViewById(R.id.turn); if (myTurn) { tv_turn.setText(String.format(getString(R.string.your_turn), String.valueOf(myTurnChar))); } else { tv_turn.setText(String.format(getString(R.string.their_turn), rival.getNick(), String.valueOf(flipChar(myTurnChar)))); } resetBoard(null); for (int i = 0; i < mainBoard.getChildCount(); i++) { TableRow row = (TableRow) mainBoard.getChildAt(i); for (int j = 0; j < row.getChildCount(); j++) { TextView tv = (TextView) row.getChildAt(j); tv.setOnClickListener(MoveListener(i, j, tv)); tv.setTextColor(ContextCompat.getColor(getBaseContext(), R.color.black)); } } }
protected void resetBoard(int[][] board) { for (int i = 0; i < size; i++) { TableRow row = (TableRow) mainBoard.getChildAt(i); for (int j = 0; j < size; j++) { char c = board != null ? (char) board[i][j] : 0; this.board[i][j] = c; TextView tv = (TextView) row.getChildAt(j); switch (c) { case 'X': tv.setText(R.string.X); break; case 'O': tv.setText(R.string.O); break; default: tv.setText(R.string.none); break; } } } }
@Override public boolean registerNotification(Context con, View parenet, TableLayout tabLayout) { tr = new GenericTabRow(con); tr.sl1.autoScale = true; tr.sl1.autoScaleBounceBack = true; tr.sl1.setColor(255, 0, 150, 125); tr.sl1.maxVal = 100; tr.sl1.minVal = 0; tr.setIcon("sensortag2", "barometer"); tr.title.setText("Barometer Data"); tr.uuidLabel.setText(GattData); tr.value.setText("0.0mBar, 0.0m"); tr.periodBar.setProgress(100); tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT)); tabLayout.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)); super.registerNotificationImp(bytes -> { convertRaw(bytes); double h = ((baro/100.0)/PA_PER_METER - 70.0); tr.value.setText(String.format("%.1f mBar %.1f meter", baro/100.0, h)); tr.sl1.addValue(baro); if (DBG) Log.d(TAG, "Baro:" + baro); }); return false; }
@Override public boolean registerNotification(Context con, View parenet, TableLayout tabLayout) { tr = new GenericTabRow(con); tr.sl1.autoScale = true; tr.sl1.autoScaleBounceBack = true; tr.sl1.setColor(255, 0, 150, 125); tr.sl1.maxVal = 100; tr.sl1.minVal = 0; tr.setIcon("sensortag2", "humidity"); tr.title.setText("Humidity Data"); tr.uuidLabel.setText(GattData); tr.value.setText("0.0%rH"); tr.periodBar.setProgress(100); tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT)); tabLayout.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)); super.registerNotificationImp(bytes -> { convertRaw(bytes); tr.value.setText(String.format("%.1f %%rH", humidity)); tr.sl1.addValue(humidity); if (DBG) Log.d(TAG, "Humidity:" + humidity); }); return false; }
@Override public boolean registerNotification(Context con, View parenet, TableLayout tabLayout) { tr = new GenericTabRow(con); tr.sl1.autoScale = true; tr.sl1.autoScaleBounceBack = true; tr.sl1.setColor(255, 0, 150, 125); tr.setIcon("sensortag2", "lightsensor"); tr.title.setText("Luxometer Data"); tr.uuidLabel.setText(GattData); tr.value.setText("0.0 Lux"); tr.periodBar.setProgress(100); tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT)); tabLayout.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)); super.registerNotificationImp(bytes -> { convertRaw(bytes); tr.value.setText(String.format("%.1f Lux", lux)); tr.sl1.addValue(lux); if (DBG) Log.d(TAG, "Lux:" + lux); }); return false; }
@Override public boolean registerNotification(Context con, View parenet, TableLayout tabLayout) { SimpleKeyTabRow tr = new SimpleKeyTabRow(con); tr.setId(parenet.generateViewId()); tr.setIcon("sensortag2", "simplekeys"); tr.title.setText("Key press state"); tr.uuidLabel.setText(GattData); tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT)); tabLayout.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT)); super.registerNotificationImp( bytes -> { convertRaw(bytes); tr.leftKeyPressState.setImageResource(isLeftKey() ? R.drawable.leftkeyon_300 : R.drawable.leftkeyoff_300); tr.rightKeyPressState.setImageResource(isRightKey() ? R.drawable.rightkeyon_300 : R.drawable.rightkeyoff_300); tr.reedState.setImageResource(isReed() ? R.drawable.reedrelayon_300 : R.drawable.reedrelayoff_300); tr.lastKeys = keyState; if (DBG) Log.d(TAG, "Left key:" + getKeyState(true) + ", " + "Right key:" + getKeyState(false)); }); return true; }
public void showInfoGame(TableLayout table) { table.removeAllViews(); if (mStateInfoGame == INFO_STATS) { TextView textView; mNumCols = measureNumColumns(table, getItem(0), mInfoBuilder.getItemStatsHeader()); mNumCols = Math.max(2, mNumCols); mNumCols = Math.min(mNumCols, getSize() + 1); mNumRows = (int)Math.ceil( (double)getSize() / (mNumCols - 1) ); TableRow row = new TableRow(mContext); table.addView(row, TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT); for (int c = 0; c < mNumCols; c++) { textView = createTextView(getColumn(c-1)); if (c > 0) textView.setGravity(Gravity.CENTER); row.addView(textView, TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT); } } }
public MyHolder(View itemView) { super(itemView); tableLayout = (TableLayout) itemView.findViewById(R.id.sql_tabview_item); tableRow = new TableRow(mContext); tableRow.setMinimumWidth(FeViewUtils.dpToPx(100)); tableLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(mIsInformation){ mClickPosition = -1; }else { mClickPosition = (int) tableLayout.getTag(); } Bundle bundle = new Bundle(); bundle.putInt(ViewEvent.Keys.SQL_TAB_ITEM_CLICK, mClickPosition); EventBus.getDefault().post(new ViewEvent(ViewEvent.EvenType.sqlTabItemClick, bundle)); notifyDataSetChanged(); } }); }
private double[][] getData() throws SyntaxException { double[][] data = new double[rows][columns]; for(int row = 0; row < rows; row++) { TableRow tr = (TableRow) getChildAt(row); for(int column = 0; column < columns; column++) { String input = ((EditText) tr.getChildAt(column)).getText().toString(); if(input.isEmpty()) throw new SyntaxException(); try { data[row][column] = Double.valueOf(stringify(logic.evaluate(input))); } catch(Exception e) { e.printStackTrace(); data[row][column] = Double.NaN; } } } return data; }
public static Matcher<View> withTableLayout(final int tableLayoutId, final int row, final int column) { return new CustomTypeSafeMatcher<View>(format("Table layout with id: {0} at row: {1} and column: {2}", tableLayoutId, row, column)) { @Override protected boolean matchesSafely(View item) { View view = item.getRootView().findViewById(tableLayoutId); if (view == null || !(view instanceof TableLayout)) return false; TableLayout tableLayout = (TableLayout) view; TableRow tableRow = (TableRow) tableLayout.getChildAt(row); View childView = tableRow.getChildAt(column); return childView == item; } }; }
private void paintBar(TableLayout table, Integer time) { for(int i = 0 ; i < table.getChildCount(); i++) { View view = table.getChildAt(i); if (view instanceof TableRow) { TableRow row = (TableRow) view; View cell = ((TableRow) view).getChildAt(0); if(i<time){ if(((double)time/(double)table.getChildCount())<0.85d){ cell.setBackgroundColor(Color.parseColor("#4fa5d5")); }else{ cell.setBackgroundColor(Color.parseColor("#ed1c00")); } }else{ cell.setBackgroundColor(0x00000000); } } } }
public static void setChildWidthForTableLayout(View view, int width) { Object layoutParams = view.getLayoutParams(); if (layoutParams instanceof TableRow.LayoutParams) { TableRow.LayoutParams tableLayoutParams = (TableRow.LayoutParams) layoutParams; switch (width) { case Component.LENGTH_PREFERRED: tableLayoutParams.width = TableRow.LayoutParams.WRAP_CONTENT; break; case Component.LENGTH_FILL_PARENT: tableLayoutParams.width = TableRow.LayoutParams.FILL_PARENT; break; default: tableLayoutParams.width = calculatePixels(view, width); break; } view.requestLayout(); } else { Log.e("ViewUtil", "The view does not have table layout parameters"); } }
public static void setChildHeightForTableLayout(View view, int height) { Object layoutParams = view.getLayoutParams(); if (layoutParams instanceof TableRow.LayoutParams) { TableRow.LayoutParams tableLayoutParams = (TableRow.LayoutParams) layoutParams; switch (height) { case Component.LENGTH_PREFERRED: tableLayoutParams.height = TableRow.LayoutParams.WRAP_CONTENT; break; case Component.LENGTH_FILL_PARENT: tableLayoutParams.height = TableRow.LayoutParams.FILL_PARENT; break; default: tableLayoutParams.height = calculatePixels(view, height); break; } view.requestLayout(); } else { Log.e("ViewUtil", "The view does not have table layout parameters"); } }
void setNumRows(int newNumRows) { if (newNumRows > numRows) { // Add new rows Context context = layoutManager.getContext(); for (int row = numRows; row < newNumRows; row++) { TableRow tableRow = new TableRow(context); for (int col = 0; col < numColumns; col++) { tableRow.addView(newEmptyCellView(), col, newEmptyCellLayoutParams()); } layoutManager.addView(tableRow, row, new android.widget.TableLayout.LayoutParams()); } numRows = newNumRows; } else if (newNumRows < numRows) { // Remove extra rows layoutManager.removeViews(newNumRows, numRows - newNumRows); numRows = newNumRows; } }
private void addChild(AndroidViewComponent child) { int row = child.Row(); int col = child.Column(); if (row == ComponentConstants.DEFAULT_ROW_COLUMN || col == ComponentConstants.DEFAULT_ROW_COLUMN) { addChildLater(child); } else { if (row >= 0 && row < numRows) { if (col >= 0 && col < numColumns) { TableRow tableRow = (TableRow) layoutManager.getChildAt(row); tableRow.removeViewAt(col); View cellView = child.getView(); tableRow.addView(cellView, col, cellView.getLayoutParams()); } else { Log.e("TableLayout", "Child has illegal Column property: " + child); } } else { Log.e("TableLayout", "Child has illegal Row property: " + child); } } }
public void updateLayoutHolder(View vToBeAdded, boolean bRemoveAllFirst) { if (bRemoveAllFirst) { mlLayoutholderInputPadCfg.removeAllViews(); } mlLayoutholderInputPadCfg.addView(vToBeAdded); vToBeAdded.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); if (vToBeAdded instanceof TableLayout) { int nNumofRows = ((TableLayout)vToBeAdded).getChildCount(); for (int idx = 0; idx < nNumofRows; idx ++) { TableRow tr = (TableRow)((TableLayout)vToBeAdded).getChildAt(idx); tr.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); int nNumofBtns = tr.getChildCount(); for (int idx1 = 0; idx1 < nNumofBtns; idx1 ++) { View vBtn = tr.getChildAt(idx1); // height has been set before. vBtn.setLayoutParams(new TableRow.LayoutParams(0, vBtn.getLayoutParams().height, 1)); } } } }
private void addRow(TableLayout parent, String key, String value) { TableRow.LayoutParams rowParams = new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT); TextView textViewKey = new TextView(this); textViewKey.setText(key); textViewKey.setLayoutParams(rowParams); TextView textViewValue = new TextView(this); textViewValue.setText(value); textViewValue.setLayoutParams(rowParams); TableRow tableRow = new TableRow(this); tableRow.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT)); tableRow.addView(textViewKey); tableRow.addView(textViewValue); parent.addView(tableRow); }
public void altTableRow(int alt_row) { int childViewCount = tablelayout.getChildCount(); for (int i = 0; i < childViewCount; i++) { TableRow row = (TableRow) tablelayout.getChildAt(i); for (int j = 0; j < row.getChildCount(); j++) { TextView tv = (TextView) row.getChildAt(j); if (i % alt_row != 0) { tv.setBackground(getResources().getDrawable( R.drawable.alt_row_color)); } else { tv.setBackground(getResources().getDrawable( R.drawable.row_color)); } } } }
private static WindowManager.LayoutParams ParamsSet(float px, float py, WebView fwv, int width, int height) { WindowManager.LayoutParams wmParams = new WindowManager.LayoutParams(); wmParams.type = LayoutParams.TYPE_SYSTEM_ALERT; wmParams.flags = LayoutParams.FLAG_NOT_TOUCH_MODAL | LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH; wmParams.gravity = Gravity.START | Gravity.TOP; wmParams.x = (int) px; wmParams.y = (int) py; wmParams.format = PixelFormat.TRANSLUCENT; wmParams.width = LayoutParams.WRAP_CONTENT; wmParams.height = LayoutParams.WRAP_CONTENT; wmParams.windowAnimations = R.style.floatwin_anim; TableRow.LayoutParams params = new TableRow.LayoutParams(); params.width = width; params.height = height; fwv.setLayoutParams(params); return wmParams; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_rbg); sp = (Spinner)findViewById(R.id.spinner1); tb = (TableRow)findViewById(R.id.tableRow1); myView = (ColorPicker) findViewById(R.id.colorPicker); tb.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub onStop(); } }); setSpinner(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.cube_activity); sp = (Spinner)findViewById(R.id.spinner1); setSpinner(); tb = (TableRow)findViewById(R.id.tableRow1); tb.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub onStop(); } }); GLImage.load(this.getResources()); glView = new GLSurfaceView(this); glView.setRenderer(render); LinearLayout layout1 = (LinearLayout)findViewById(R.id.ddd); layout1.addView(glView); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_ota); sp = (Spinner)findViewById(R.id.spinner1); tb = (TableRow)findViewById(R.id.tableRow1); ed = (EditText)findViewById(R.id.editText1); tb.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub onStop(); } }); setSpinner(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_trh); sp = (Spinner)findViewById(R.id.spinner1); tb = (TableRow)findViewById(R.id.tableRow1); myView = (MyView)findViewById(R.id.mv); wv = (WaveView)findViewById(R.id.wv); tb.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub onStop(); } }); setSpinner(); wv.setWave(false,1.7f, 0.85f, 0.06f, 1,Color.argb(0x80, 0x36, 0xba, 0xf8), 0.5f); }
public void linkHolder(View v) { candy_icon = ((ImageView) v.findViewById(R.id.candy_icon)); candy_count = ((EditText) v.findViewById(R.id.candy_count)); remove = ((ImageButton) v.findViewById(R.id.remove_variable)); rows[0] = ((TableRow) v.findViewById(R.id.row1)); rows[1] = ((TableRow) v.findViewById(R.id.row2)); rows[2] = ((TableRow) v.findViewById(R.id.row3)); rows[3] = ((TableRow) v.findViewById(R.id.row4)); pokemon_icons[0] = ((ImageView) v.findViewById(R.id.pokemon_icon1)); pokemon_icons[1] = ((ImageView) v.findViewById(R.id.pokemon_icon2)); pokemon_icons[2] = ((ImageView) v.findViewById(R.id.pokemon_icon3)); pokemon_icons[3] = ((ImageView) v.findViewById(R.id.pokemon_icon4)); pokemon_names[0] = ((TextView) v.findViewById(R.id.pokemon_name1)); pokemon_names[1] = ((TextView) v.findViewById(R.id.pokemon_name2)); pokemon_names[2] = ((TextView) v.findViewById(R.id.pokemon_name3)); pokemon_names[3] = ((TextView) v.findViewById(R.id.pokemon_name4)); pokemon_counts[0] = ((EditText) v.findViewById(R.id.pokemon_count1)); pokemon_counts[1] = ((EditText) v.findViewById(R.id.pokemon_count2)); pokemon_counts[2] = ((EditText) v.findViewById(R.id.pokemon_count3)); pokemon_counts[3] = ((EditText) v.findViewById(R.id.pokemon_count4)); pokedex_checkboxes[0] = ((CheckBox) v.findViewById(R.id.pokedex_checkbox1)); pokedex_checkboxes[1] = ((CheckBox) v.findViewById(R.id.pokedex_checkbox2)); pokedex_checkboxes[2] = ((CheckBox) v.findViewById(R.id.pokedex_checkbox3)); pokedex_checkboxes[3] = ((CheckBox) v.findViewById(R.id.pokedex_checkbox4)); }
private void initButtons(View view) { mButton0 = (TextView) view.findViewById(R.id.button0); mButton1 = (TextView) view.findViewById(R.id.button1); mButton2 = (TextView) view.findViewById(R.id.button2); mButton3 = (TextView) view.findViewById(R.id.button3); mButton4 = (TextView) view.findViewById(R.id.button4); mButton5 = (TextView) view.findViewById(R.id.button5); mButton6 = (TextView) view.findViewById(R.id.button6); mButton7 = (TextView) view.findViewById(R.id.button7); mButton8 = (TextView) view.findViewById(R.id.button8); mButton9 = (TextView) view.findViewById(R.id.button9); mCustomButton1 = (TextView) view.findViewById(R.id.button_custom1); mCustomButton2 = (TextView) view.findViewById(R.id.button_custom2); mRow1 = (TableRow) view.findViewById(R.id.row1); mRow2 = (TableRow) view.findViewById(R.id.row2); mRow3 = (TableRow) view.findViewById(R.id.row3); mSeparator11 = (TextView) view.findViewById(R.id.vertical_1_1); mSeparator12 = (TextView) view.findViewById(R.id.vertical_1_2); mSeparator21 = (TextView) view.findViewById(R.id.vertical_2_1); mSeparator22 = (TextView) view.findViewById(R.id.vertical_2_2); mSeparator31 = (TextView) view.findViewById(R.id.vertical_3_1); mSeparator32 = (TextView) view.findViewById(R.id.vertical_3_2); mSeparator41 = (TextView) view.findViewById(R.id.vertical_4_1); mSeparator42 = (TextView) view.findViewById(R.id.vertical_4_2); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.listamedidas); info=(Button) findViewById(R.id.BotonInfo); info.setVisibility(INVISIBLE); back=(Button) findViewById(R.id.BotonBack); back.setOnClickListener(this); // Instanciamos CalibradosDataSource para // poder realizar acciones con la base de datos dataSource = new CalibradosDataSource(this); dataSource.open(); // Instanciamos los elementos //lvCalibrados = (ListView) findViewById(R.id.lvCalibrados); tabla = (TableLayout)findViewById(R.id.tablaMedidas); layoutFila = new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT,TableRow.LayoutParams.WRAP_CONTENT); // Cargamos la lista de notas disponibles List<Medidas> listaMedidas = dataSource.getAllMedidas(); agregarFilasTabla(listaMedidas); }
@Override protected void configureControls(View view) { super.configureControls(view); lastLongCellIdValueTableRow = (TableRow) view.findViewById(R.id.main_last_long_cell_id_tablerow); lastCellIdRncValueTableRow = (TableRow) view.findViewById(R.id.main_last_cell_id_rnc_tablerow); lastCellIdValueTableRow = (TableRow) view.findViewById(R.id.main_last_cell_id_tablerow); lastNumberOfCellsValueTextView = (TextView) view.findViewById(R.id.main_last_number_of_cells_value_textview); lastNetworkTypeValueTextView = (TextView) view.findViewById(R.id.main_last_network_type_value_textview); lastLongCellIdValueTextView = (TextView) view.findViewById(R.id.main_last_long_cell_id_value_textview); lastCellIdRncValueTextView = (TextView) view.findViewById(R.id.main_last_cell_id_rnc_value_textview); lastCellIdValueTextView = (TextView) view.findViewById(R.id.main_last_cell_id_value_textview); lastMccValueTextView = (TextView) view.findViewById(R.id.main_last_mcc_value_textview); lastMncValueTextView = (TextView) view.findViewById(R.id.main_last_mnc_value_textview); lastLacValueTextView = (TextView) view.findViewById(R.id.main_last_lac_value_textview); lastSignalStrengthValueTextView = (TextView) view.findViewById(R.id.main_last_signal_strength_value_textview); lastLatitudeValueTextView = (TextView) view.findViewById(R.id.main_last_latitude_value_textview); lastLongitudeValueTextView = (TextView) view.findViewById(R.id.main_last_longitude_value_textview); lastGpsAccuracyValueTextView = (TextView) view.findViewById(R.id.main_last_gps_accuracy_value_textview); lastDateTimeValueTextView = (TextView) view.findViewById(R.id.main_last_date_time_value_textview); }
protected void configureControls(View view) { gpsStatusTableRow = (TableRow) view.findViewById(R.id.main_gps_status_tablerow); gpsStatusLabelTextView = (TextView) view.findViewById(R.id.main_gps_status_label_textview); gpsStatusValueTextView = (TextView) view.findViewById(R.id.main_gps_status_value_textview); invalidSystemTimeTableRow = (TableRow) view.findViewById(R.id.main_invalid_system_time_tablerow); invalidSystemTimeValueTextView = (TextView) view.findViewById(R.id.main_invalid_system_time_value_textview); // reload preferences useImperialUnits = MyApplication.getPreferencesProvider().getUseImperialUnits(); // cache units if (useImperialUnits) { // preferredSpeedUnit = getString(R.string.unit_speed_imperial); preferredLengthUnit = getString(R.string.unit_length_imperial); } else { // preferredSpeedUnit = getString(R.string.unit_speed_metric); preferredLengthUnit = getString(R.string.unit_length_metric); } // date format dateTimeFormatStandard = new SimpleDateFormat(getString(R.string.date_time_format_standard), new Locale(getString(R.string.locale))); }
/** * alternate colors for description rows * * @param alt_row */ public void altTableRow(int alt_row) { int childViewCount = tablelayout.getChildCount(); for (int i = 0; i < childViewCount; i++) { TableRow row = (TableRow) tablelayout.getChildAt(i); for (int j = 0; j < row.getChildCount(); j++) { TextView tv = (TextView) row.getChildAt(j); if (i % alt_row != 0) { tv.setBackground(getResources().getDrawable( R.drawable.alt_row_color)); } else { tv.setBackground(getResources().getDrawable( R.drawable.row_color)); } } } }
public int columnAtPoint(Point point) { if(tableView == null){ return -1; } int[] winLoc = new int[2]; int[] viewLoc = new int[2]; tableView.getLocationInWindow(winLoc); TableRow tableRow = (TableRow)tableView.getChildAt(0); int columnNum = tableRow.getChildCount(); for (int i = 1; i < columnNum; i++) { tableRow.getVirtualChildAt(i).getLocationInWindow(viewLoc); int shiftX = viewLoc[0] - winLoc[0]; if(i == 1){ if(point.x < shiftX){ return -1; } } if(point.x < shiftX){ return i - 1; } } return columnNum - 1; }
public int rowAtPoint(Point point) { if(tableView == null){ return -1; } int[] winLoc = new int[2]; int[] viewLoc = new int[2]; tableView.getLocationInWindow(winLoc); int rowNum = tableView.getChildCount(); for (int i = 1; i < rowNum; i++) { TableRow tableRow = (TableRow)tableView.getChildAt(i); tableRow.getVirtualChildAt(0).getLocationInWindow(viewLoc); int shiftY = viewLoc[1] - winLoc[1]; if(i == 1){ if(point.y < shiftY){ return -1; } } if(point.y < shiftY){ return i - 2; } } return rowNum - 2; }
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.ingredients_fragment, container, false); this.recipe = ((RecipeActivity) getActivity()).mRecipe; TableLayout table = (TableLayout) rootView.findViewById(R.id.ingredientsTable); for (Recipe.Ingredient ingredient : recipe.getIngredients()) { TableRow row = (TableRow) inflater.inflate(R.layout.ingredients_row, null); ((TextView) row.findViewById(R.id.attrib_name)).setText(ingredient.getAmount()); ((TextView) row.findViewById(R.id.attrib_value)).setText(ingredient .getDescription()); table.addView(row); } return rootView; }
/** * alternate between 2 colors for the description item table * * @param alt_row */ public void altTableRow(int alt_row) { int childViewCount = tablelayout.getChildCount(); for (int i = 0; i < childViewCount; i++) { TableRow row = (TableRow) tablelayout.getChildAt(i); for (int j = 0; j < row.getChildCount(); j++) { TextView tv = (TextView) row.getChildAt(j); if (i % alt_row != 0) { tv.setBackground(getResources().getDrawable( R.drawable.alt_row_color)); } else { tv.setBackground(getResources().getDrawable( R.drawable.row_color)); } } } }
protected void disableInputs() { // disable play inputs for (int i = 0; i < mainBoard.getChildCount(); i++) { TableRow row = (TableRow) mainBoard.getChildAt(i); for (int j = 0; j < row.getChildCount(); j++) { TextView tv = (TextView) row.getChildAt(j); tv.setOnClickListener(null); tv.setTextColor(ContextCompat.getColor(getBaseContext(), R.color.gray)); } } }
private void appendRowInfo(TableLayout table, String key, String value) { TableRow row = (TableRow) this.getLayoutInflater().inflate(R.layout .pokemon_info_table_row, null); ((TextView) row.findViewById(R.id.attrib_name)).setText(key); ((TextView) row.findViewById(R.id.attrib_value)).setText(value); table.addView(row); }
private void appendRowBaseStat(TableLayout table, String key, int value) { TableRow row = (TableRow) this.getLayoutInflater().inflate(R.layout .pokemon_base_stat_table_row, null); ((TextView) row.findViewById(R.id.attrib_name)).setText(key); ((TextView) row.findViewById(R.id.attrib_value)).setText(String.valueOf(value)); ((ProgressBar) row.findViewById(R.id.progressbar_stat)).setProgress(value); table.addView(row); }
private void init(Context context) { TableRow tableRow = new TableRow(context); tableRow.setGravity(Gravity.CENTER); num1M = new NumberSpinner(context, digitSize); num100K = new NumberSpinner(context, digitSize); num10K = new NumberSpinner(context, digitSize); num1K = new NumberSpinner(context, digitSize); num100 = new NumberSpinner(context, digitSize); num10 = new NumberSpinner(context, digitSize); num1 = new NumberSpinner(context, digitSize); if (numDigits >= 7) { tableRow.addView(num1M); } if (numDigits >= 6) { tableRow.addView(num100K); } if (numDigits >= 5) { tableRow.addView(num10K); } if (numDigits >= 4) { tableRow.addView(num1K); } if (numDigits >= 3) { tableRow.addView(num100); } if (numDigits >= 2) { tableRow.addView(num10); } tableRow.addView(num1); // make everything disappear except the unit's place num1M.setAlpha(0.0f); num100K.setAlpha(0.0f); num10K.setAlpha(0.0f); num1K.setAlpha(0.0f); num100.setAlpha(0.0f); num10.setAlpha(0.0f); this.setGravity(Gravity.CENTER); this.addView(tableRow); }
public static TableRow getTableRow(Context context, View... views){ TableRow tableRow = new TableRow(context); tableRow.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT)); tableRow.setBackgroundColor(Color.GRAY); for (View item: views) { tableRow.addView(item); } return tableRow; }
CellInfoOverviewHolder(View view) { mNeighboringCells = (TextView) view.findViewById(R.id.neighboring_cells); mNeighboringTotal = (TextView) view.findViewById(R.id.neighboring_number); mNeighboringTotalView = (TableRow) view.findViewById(R.id.neighboring_total); mCipheringIndicatorLabel = (TextView) view.findViewById(R.id.ciphering_indicator_title); mCipheringIndicator = (TextView) view.findViewById(R.id.ciphering_indicator); }