Wear add title to grid layout

This commit is contained in:
Andries Smit 2021-12-01 21:13:10 +01:00
parent d7caa39ff3
commit bc05eaa309
8 changed files with 37 additions and 14 deletions

View file

@ -50,9 +50,8 @@ public class AcceptActivity extends ViewSelectorActivity {
}
setContentView(R.layout.grid_layout);
final Resources res = getResources();
final GridViewPager pager = findViewById(R.id.pager);
final GridViewPager pager = findViewById(R.id.pager);
pager.setAdapter(new MyGridViewPagerAdapter());
DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator);
dotsPageIndicator.setPager(pager);

View file

@ -10,6 +10,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import java.text.DecimalFormat;
@ -32,9 +33,11 @@ public class BolusActivity extends ViewSelectorActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.grid_layout);
final Resources res = getResources();
final GridViewPager pager = findViewById(R.id.pager);
final TextView title = findViewById(R.id.title);
title.setText(getString(R.string.menu_bolus));
final GridViewPager pager = findViewById(R.id.pager);
pager.setAdapter(new MyGridViewPagerAdapter());
DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator);
dotsPageIndicator.setPager(pager);

View file

@ -10,6 +10,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import java.text.DecimalFormat;
@ -47,9 +48,11 @@ public class CPPActivity extends ViewSelectorActivity {
if (timeshift < 0) timeshift += 24;
setContentView(R.layout.grid_layout);
final Resources res = getResources();
final GridViewPager pager = findViewById(R.id.pager);
final TextView title = findViewById(R.id.title);
title.setText(getString(R.string.status_cpp));
final GridViewPager pager = findViewById(R.id.pager);
pager.setAdapter(new MyGridViewPagerAdapter());
DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator);
dotsPageIndicator.setPager(pager);

View file

@ -10,6 +10,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import java.text.DecimalFormat;
@ -34,9 +35,11 @@ public class ECarbActivity extends ViewSelectorActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.grid_layout);
final Resources res = getResources();
final GridViewPager pager = findViewById(R.id.pager);
final TextView title = findViewById(R.id.title);
title.setText(getString(R.string.menu_ecarb));
final GridViewPager pager = findViewById(R.id.pager);
pager.setAdapter(new MyGridViewPagerAdapter());
DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator);
dotsPageIndicator.setPager(pager);

View file

@ -10,6 +10,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import java.text.DecimalFormat;
@ -31,9 +32,11 @@ public class FillActivity extends ViewSelectorActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.grid_layout);
final Resources res = getResources();
final GridViewPager pager = findViewById(R.id.pager);
final TextView title = findViewById(R.id.title);
title.setText(getString(R.string.menu_prime_fill));
final GridViewPager pager = findViewById(R.id.pager);
pager.setAdapter(new MyGridViewPagerAdapter());
DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator);
dotsPageIndicator.setPager(pager);

View file

@ -38,9 +38,11 @@ public class TempTargetActivity extends ViewSelectorActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.grid_layout);
final Resources res = getResources();
final GridViewPager pager = findViewById(R.id.pager);
final TextView title = findViewById(R.id.title);
title.setText(getString(R.string.menu_tempt));
final GridViewPager pager = findViewById(R.id.pager);
pager.setAdapter(new MyGridViewPagerAdapter());
DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator);
dotsPageIndicator.setPager(pager);

View file

@ -12,6 +12,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import java.text.DecimalFormat;
@ -37,9 +38,11 @@ public class WizardActivity extends ViewSelectorActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.grid_layout);
final Resources res = getResources();
final GridViewPager pager = findViewById(R.id.pager);
final TextView title = findViewById(R.id.title);
title.setText(getString(R.string.menu_wizard));
final GridViewPager pager = findViewById(R.id.pager);
pager.setAdapter(new MyGridViewPagerAdapter());
DotsPageIndicator dotsPageIndicator = findViewById(R.id.page_indicator);
dotsPageIndicator.setPager(pager);

View file

@ -3,6 +3,13 @@
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="22dp"
android:gravity="center"
android:textSize="18sp"/>
<android.support.wearable.view.GridViewPager
android:id="@+id/pager"
android:layout_width="match_parent"