add row selection logic with background highlighting on click

This commit is contained in:
2019-03-10 16:56:27 +01:00
parent c2a14c5b66
commit 2b7dca8e2f
2 changed files with 371 additions and 296 deletions

View File

@@ -14,6 +14,8 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import android.widget.Toast;
@@ -44,6 +46,28 @@ public class MainNativeActivity extends AppCompatActivity {
String urlGlobal = settings.getString("urlGlobal", getString(R.string.url_global));
if (savedInstanceState == null) {
TableLayout tr1 = findViewById(R.id.tableRow1);
tr1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO: do your logic here
}
});
TableLayout tr2 = findViewById(R.id.tableRow2);
tr2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO: do your logic here
}
});
TableLayout tr3 = findViewById(R.id.tableRow3);
tr3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO: do your logic here
}
});
String urlPre = "";
if (SettingsActivity.isLocal(getApplicationContext())) {
//Toast.makeText(getApplicationContext(), "intern", Toast.LENGTH_LONG).show();

View File

@@ -9,8 +9,8 @@
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
@@ -42,10 +42,24 @@
</TableRow>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<TableLayout
android:id="@+id/tableRow1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/widget_vertical_margin"
android:paddingBottom="@dimen/widget_vertical_margin"
android:background="?android:attr/selectableItemBackground">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/widget_vertical_margin">
android:layout_height="match_parent">
<TextView
android:id="@+id/textViewTemperatureValue1"
@@ -155,11 +169,26 @@
</LinearLayout>
</TableRow>
</TableLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<TableLayout
android:id="@+id/tableRow2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/widget_vertical_margin"
android:paddingBottom="@dimen/widget_vertical_margin"
android:background="?android:attr/selectableItemBackground">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/widget_vertical_margin">
android:layout_height="match_parent">
<TextView
android:id="@+id/textViewTemperatureValue2"
@@ -269,11 +298,26 @@
</LinearLayout>
</TableRow>
</TableLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<TableLayout
android:id="@+id/tableRow3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/widget_vertical_margin"
android:paddingBottom="@dimen/widget_vertical_margin"
android:background="?android:attr/selectableItemBackground">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/widget_vertical_margin">
android:layout_height="match_parent">
<TextView
android:id="@+id/textViewTemperatureValue3"
@@ -386,7 +430,14 @@
</TableLayout>
<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</TableLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="80dp"