diff options
author | Parménides GV <parmegv@sdf.org> | 2015-04-29 12:47:43 +0200 |
---|---|---|
committer | Parménides GV <parmegv@sdf.org> | 2015-04-29 12:47:43 +0200 |
commit | 8833acbafe00eb2941cfa052cb679fc2684b5290 (patch) | |
tree | af1e225d222d0e5df02ec5364b16e9efc1a90b25 | |
parent | f008b5ec8e1c74968e4a605d2de5423edf91b854 (diff) |
Dynamically load user session fragment.
Tests click new button, instead of action bar's.
Fixing more bugs...
5 files changed, 16 insertions, 12 deletions
diff --git a/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java b/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java index 262310bd..7551091b 100644 --- a/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java +++ b/app/src/androidTest/java/se/leap/bitmaskclient/test/testDashboardIntegration.java @@ -169,7 +169,11 @@ public class testDashboardIntegration extends ActivityInstrumentationTestCase2<D } private void clickLogIn() { - solo.clickOnActionBarItem(R.id.user_session_button); + solo.clickOnView(getLogInButton()); + } + + private View getLogInButton() { + return solo.getView(R.id.user_session_button); } private void logIn(String username, String password) { solo.enterText(0, username); diff --git a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java index f541283a..a854ffd4 100644 --- a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java +++ b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java @@ -200,6 +200,7 @@ public class Dashboard extends Activity implements ProviderAPIResultReceiver.Rec provider_name.setText(provider.getDomain()); user_session_fragment = new UserSessionFragment(); + fragment_manager.replace(R.id.user_session_fragment, user_session_fragment, UserSessionFragment.TAG); if (provider.hasEIP()) { fragment_manager.removePreviousFragment(EipFragment.TAG); diff --git a/app/src/main/java/se/leap/bitmaskclient/userstatus/SessionDialog.java b/app/src/main/java/se/leap/bitmaskclient/userstatus/SessionDialog.java index f51a6779..18f16301 100644 --- a/app/src/main/java/se/leap/bitmaskclient/userstatus/SessionDialog.java +++ b/app/src/main/java/se/leap/bitmaskclient/userstatus/SessionDialog.java @@ -81,7 +81,7 @@ public class SessionDialog extends DialogFragment { ButterKnife.inject(this, view); Bundle arguments = getArguments(); - if (arguments != Bundle.EMPTY) { + if (arguments != Bundle.EMPTY && arguments != null) { setUp(arguments); } @@ -165,8 +165,9 @@ public class SessionDialog extends DialogFragment { @Override public void onAttach(Activity activity) { super.onAttach(activity); + try { - interface_with_Dashboard = (SessionDialogInterface) activity; + interface_with_Dashboard = (SessionDialogInterface) activity.getFragmentManager().findFragmentById(R.id.user_session_fragment);; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement LogInDialogListener"); diff --git a/app/src/main/res/layout/dashboard.xml b/app/src/main/res/layout/dashboard.xml index 30074b6a..95445d63 100644 --- a/app/src/main/res/layout/dashboard.xml +++ b/app/src/main/res/layout/dashboard.xml @@ -18,19 +18,17 @@ android:singleLine="true" android:text="@string/provider_label_none" android:textAppearance="?android:attr/textAppearanceMedium" /> - - <fragment android:name="se.leap.bitmaskclient.userstatus.UserSessionFragment" + + <LinearLayout android:id="@+id/user_session_fragment" - android:tag="user_session_fragment" android:layout_width="match_parent" - android:layout_height="wrap_content"/> + android:layout_height="wrap_content" + android:orientation="horizontal"/> <LinearLayout android:id="@+id/servicesCollection" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="0.11" - android:orientation="vertical" > - </LinearLayout> - + android:orientation="vertical" /> </LinearLayout> diff --git a/app/src/main/res/layout/fragment_user_session.xml b/app/src/main/res/layout/fragment_user_session.xml index 3b7b23c6..2abd6f22 100644 --- a/app/src/main/res/layout/fragment_user_session.xml +++ b/app/src/main/res/layout/fragment_user_session.xml @@ -1,12 +1,12 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" - android:layout_height="match_parent" + android:layout_height="wrap_content" android:orientation="horizontal" tools:context="se.leap.bitmaskclient.userstatus.UserSessionFragment"> <LinearLayout - android:layout_width="match_parent" + android:layout_width="wrap_content" android:layout_height="wrap_content"> <ProgressBar |