add row selection logic with background highlighting on click
This commit is contained in:
@@ -14,6 +14,8 @@ import android.view.Menu;
|
|||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
|
import android.widget.TableLayout;
|
||||||
|
import android.widget.TableRow;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
@@ -44,6 +46,28 @@ public class MainNativeActivity extends AppCompatActivity {
|
|||||||
String urlGlobal = settings.getString("urlGlobal", getString(R.string.url_global));
|
String urlGlobal = settings.getString("urlGlobal", getString(R.string.url_global));
|
||||||
|
|
||||||
if (savedInstanceState == null) {
|
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 = "";
|
String urlPre = "";
|
||||||
if (SettingsActivity.isLocal(getApplicationContext())) {
|
if (SettingsActivity.isLocal(getApplicationContext())) {
|
||||||
//Toast.makeText(getApplicationContext(), "intern", Toast.LENGTH_LONG).show();
|
//Toast.makeText(getApplicationContext(), "intern", Toast.LENGTH_LONG).show();
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
<TableLayout
|
<TableLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="@dimen/activity_horizontal_margin"
|
|
||||||
android:layout_marginTop="@dimen/activity_vertical_margin"
|
android:layout_marginTop="@dimen/activity_vertical_margin"
|
||||||
|
android:layout_marginStart="@dimen/activity_horizontal_margin"
|
||||||
android:layout_marginEnd="@dimen/activity_horizontal_margin"
|
android:layout_marginEnd="@dimen/activity_horizontal_margin"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="1.0"
|
app:layout_constraintHorizontal_bias="1.0"
|
||||||
@@ -42,10 +42,24 @@
|
|||||||
|
|
||||||
</TableRow>
|
</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
|
<TableRow
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:layout_marginTop="@dimen/widget_vertical_margin">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textViewTemperatureValue1"
|
android:id="@+id/textViewTemperatureValue1"
|
||||||
@@ -155,11 +169,26 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</TableRow>
|
</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
|
<TableRow
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:layout_marginTop="@dimen/widget_vertical_margin">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textViewTemperatureValue2"
|
android:id="@+id/textViewTemperatureValue2"
|
||||||
@@ -269,11 +298,26 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</TableRow>
|
</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
|
<TableRow
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:layout_marginTop="@dimen/widget_vertical_margin">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textViewTemperatureValue3"
|
android:id="@+id/textViewTemperatureValue3"
|
||||||
@@ -386,7 +430,14 @@
|
|||||||
</TableLayout>
|
</TableLayout>
|
||||||
|
|
||||||
<View
|
<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_width="match_parent"
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:layout_marginBottom="80dp"
|
android:layout_marginBottom="80dp"
|
||||||
|
|||||||
Reference in New Issue
Block a user