basic navigation works
This commit is contained in:
parent
76685c3cff
commit
eef4423109
3 changed files with 55 additions and 18 deletions
|
@ -1,6 +1,7 @@
|
||||||
package info.nightscout.androidaps.startupwizard;
|
package info.nightscout.androidaps.startupwizard;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Intent;
|
||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -48,19 +49,14 @@ public class SetupWizardActivity extends AppCompatActivity {
|
||||||
private View mContentView;
|
private View mContentView;
|
||||||
private LinearLayout linearLayout;
|
private LinearLayout linearLayout;
|
||||||
private TextView radioLabel;
|
private TextView radioLabel;
|
||||||
private RadioGroup radioGroup;
|
|
||||||
private RadioButton[] radioButtons;
|
|
||||||
private RadioButton radioButton1;
|
|
||||||
private RadioButton radioButton2;
|
|
||||||
private RadioButton radioButton3;
|
|
||||||
private RadioButton radioButton4;
|
|
||||||
private RadioButton radioButton5;
|
|
||||||
private TextView screenName;
|
private TextView screenName;
|
||||||
private TextView label1;
|
private TextView label1;
|
||||||
private EditText editText1;
|
private EditText editText1;
|
||||||
private TextView label2;
|
private TextView label2;
|
||||||
private EditText editText2;
|
private EditText editText2;
|
||||||
private Button skipButton;
|
private Button skipButton;
|
||||||
|
private int currentWizzardPage = 0;
|
||||||
|
public static final String INTENT_MESSAGE = "WIZZARDPAGE";
|
||||||
private final Runnable mHidePart2Runnable = new Runnable() {
|
private final Runnable mHidePart2Runnable = new Runnable() {
|
||||||
@SuppressLint("InlinedApi")
|
@SuppressLint("InlinedApi")
|
||||||
@Override
|
@Override
|
||||||
|
@ -132,10 +128,18 @@ public class SetupWizardActivity extends AppCompatActivity {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Intent intent = getIntent();
|
||||||
|
int showPage = intent.getIntExtra(SetupWizardActivity.INTENT_MESSAGE,0);
|
||||||
SWDefinition swDefinition = SWDefinition.getInstance();
|
SWDefinition swDefinition = SWDefinition.getInstance();
|
||||||
List<SWScreen> screens = swDefinition.getScreens();
|
List<SWScreen> screens = swDefinition.getScreens();
|
||||||
if(screens.size() > 0){
|
if(screens.size() > 0){
|
||||||
SWScreen currentScreen = screens.get(1);
|
SWScreen currentScreen = screens.get(showPage);
|
||||||
|
// show/hide prev/next buttons if we are at the beninning/end
|
||||||
|
if(showPage == screens.size() - 1) {
|
||||||
|
((Button) findViewById(R.id.next_button)).setVisibility(View.GONE);
|
||||||
|
((Button) findViewById(R.id.finish_button)).setVisibility(View.VISIBLE);
|
||||||
|
}else if(showPage == 0)
|
||||||
|
((Button) findViewById(R.id.previous_button)).setVisibility(View.GONE);
|
||||||
//Set screen name
|
//Set screen name
|
||||||
screenName = (TextView) findViewById(R.id.fullscreen_content);
|
screenName = (TextView) findViewById(R.id.fullscreen_content);
|
||||||
screenName.setText(currentScreen.getHeader());
|
screenName.setText(currentScreen.getHeader());
|
||||||
|
@ -254,4 +258,20 @@ public class SetupWizardActivity extends AppCompatActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void showNextPage(View view) {
|
||||||
|
Intent intent = new Intent(this, SetupWizardActivity.class);
|
||||||
|
intent.putExtra(INTENT_MESSAGE, currentWizzardPage + 1);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showPreviousPage(View view) {
|
||||||
|
Intent intent = new Intent(this, SetupWizardActivity.class);
|
||||||
|
if(currentWizzardPage > 0)
|
||||||
|
intent.putExtra(INTENT_MESSAGE, currentWizzardPage - 1);
|
||||||
|
else
|
||||||
|
intent.putExtra(INTENT_MESSAGE, 0);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,21 +98,14 @@
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
tools:ignore="UselessParent">
|
tools:ignore="UselessParent">
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/next_button"
|
|
||||||
style="?metaButtonBarButtonStyle"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:text="@string/next_button"
|
|
||||||
android:visibility="invisible" />
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/previous_button"
|
android:id="@+id/previous_button"
|
||||||
style="?metaButtonBarButtonStyle"
|
style="?metaButtonBarButtonStyle"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/previous_button" />
|
android:onClick="showPreviousPage"
|
||||||
|
android:text="@string/setupwizard_previous" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/skip_button"
|
android:id="@+id/skip_button"
|
||||||
|
@ -120,9 +113,29 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/skip_button"
|
android:text="@string/setupwizard_skip"
|
||||||
android:visibility="invisible" />
|
android:visibility="invisible" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/next_button"
|
||||||
|
style="?metaButtonBarButtonStyle"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:onClick="showNextPage"
|
||||||
|
android:text="@string/setupwizard_next"
|
||||||
|
android:visibility="visible" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/finish_button"
|
||||||
|
style="?metaButtonBarButtonStyle"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@string/setupwizard_finish"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
|
|
|
@ -1007,4 +1007,8 @@
|
||||||
<string name="skip_button">Skip</string>
|
<string name="skip_button">Skip</string>
|
||||||
<string name="dummy_content">DUMMY\nCONTENT</string>
|
<string name="dummy_content">DUMMY\nCONTENT</string>
|
||||||
<string name="nav_setupwizard">Setup Wizard</string>
|
<string name="nav_setupwizard">Setup Wizard</string>
|
||||||
|
<string name="setupwizard_next">Next</string>
|
||||||
|
<string name="setupwizard_previous">Prev</string>
|
||||||
|
<string name="setupwizard_skip">Skip</string>
|
||||||
|
<string name="setupwizard_finish">FINISH</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue