-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
222 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package dev.lucalewin.planer; | ||
|
||
import android.annotation.SuppressLint; | ||
import android.content.Context; | ||
import android.content.res.XmlResourceParser; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.widget.TableLayout; | ||
import android.widget.TableRow; | ||
import android.widget.TextView; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import dev.lucalewin.planer.iserv.IservPlan; | ||
import dev.lucalewin.planer.iserv.IservPlanRow; | ||
|
||
public class PlanerTable { | ||
|
||
/** | ||
* | ||
* @param context the context of the current activity | ||
* @param clazz the class the user is in | ||
* @param plan the plan | ||
* @return a list of table rows | ||
*/ | ||
public static TableLayout initTable(Context context, String clazz, IservPlan plan) { | ||
@SuppressLint("InflateParams") | ||
TableLayout tableLayout = (TableLayout) LayoutInflater.from(context).inflate(R.layout.planer_table_layout, null, false); | ||
|
||
final Map<String, List<IservPlanRow>> affectedData = plan.getClasses(); | ||
|
||
final List<IservPlanRow> rows = affectedData.get(clazz); | ||
|
||
if (rows != null) { | ||
rows.forEach(row -> tableLayout.addView(row.toTableRow(context))); | ||
} else { | ||
tableLayout.findViewById(R.id.planer_table_header).setVisibility(View.GONE); | ||
|
||
TextView notAffectedTextView = new TextView(context); | ||
notAffectedTextView.setText(context.getString(R.string.not_affected)); | ||
tableLayout.addView(notAffectedTextView); | ||
} | ||
|
||
return tableLayout; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.