Cleveroad / Cleveroad/AdaptiveTableLayout

Table not updating with multiple textviews in item_card

Abierto
#30 2 comentarios 1 reacción 0 asignados Ver en GitHub
bug
Lenguaje dominante
Java
Estrellas
1.9k
Forks
238
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Hello,
I've wanted to display a table with 4 TextViews per item, but the table isn't getting updated when I use my modified version of EditItemDialog(to support the 4 TVs I mentioned above).
The data in the csv gets updated immediately, also if I switch to another fragment and back to the table-fragment, the data's displayed correctly!

How can I fix that?

Code handling EditItemDialog response(GH is bugging...):

`

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == EditItemDialog.REQUEST_CODE_EDIT_ITEM && resultCode == Activity.RESULT_OK && data != null) {
int columnIndex = data.getIntExtra(EditItemDialog.EXTRA_COLUMN_NUMBER, 0);
int rowIndex = data.getIntExtra(EditItemDialog.EXTRA_ROW_NUMBER, 0);
String s = data.getStringExtra(EditItemDialog.EXTRA_SUBJECT);
String t = data.getStringExtra(EditItemDialog.EXTRA_TEACHER);
String r = data.getStringExtra(EditItemDialog.EXTRA_ROOM);

// My attempts to update the layout:
mCsvFileDataSource.updateItem(rowIndex, columnIndex,
CsvFileDataSourceImpl.prepItem(s, t, r));
mTableAdapter.notifyItemChanged(rowIndex, columnIndex);
mTableLayout.notifyItemChanged(rowIndex, columnIndex);
mCsvFileDataSource.applyChanges(getLoaderManager(),
mTableLayout.getLinkedAdapterRowsModifications(),
mTableLayout.getLinkedAdapterColumnsModifications(),
mTableLayout.isSolidRowHeader(),
ScheduleFragment.this);
mTableLayout.setVisibility(View.GONE);
mTableLayout.setVisibility(View.VISIBLE);
//mTableLayout.invalidate();
onFileUpdated(StorageUtils.getScheduleFile(getActivity()).getAbsolutePath(), true); // .getScheduleFile() returns File object
}
}
`

`

public static String prepItem(String s, String t, String r) {
return s + ";" + t + ";" + r;
}

//...

public String getItemData(int rowIndex, int columnIndex, int position) { // helper method for schedule, splits item and returns data at position's index
try {
List rowList = getRow(rowIndex);
return (rowList == null ? "" : rowList.get(columnIndex)).split(";")[position];
} catch (Exception e) {
Log.e(TAG, "get rowIndex=" + rowIndex + "; colIndex=" + columnIndex + "; position:" + position + "\ncache = " +
mItemsCache.toString(), e);
return null;
}
}
`

Best regards,
Felipe

PS: Except for above issue, it works like a charm!

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Start by tracing onActivityResult in the schedule fragment, including the calls to mTableAdapter, mTableLayout, and onFileUpdated, then inspect how getItemData splits the updated CSV value for the four TextViews. Done means an edited item refreshes all displayed TextViews immediately without switching fragments, while the CSV data remains updated.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
android, java
Área
mobile
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.