diff --git a/VideoLocker/AndroidManifest.xml b/VideoLocker/AndroidManifest.xml
index 8cd87cb0ce..d372a4b154 100644
--- a/VideoLocker/AndroidManifest.xml
+++ b/VideoLocker/AndroidManifest.xml
@@ -62,6 +62,12 @@
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
+
+
+
+
+
+
+ -
+
+
+
+
+
+
\ No newline at end of file
diff --git a/VideoLocker/res/drawable/edx_creation_button.xml b/VideoLocker/res/drawable/edx_creation_button.xml
index cc8d9637b6..aed20eadff 100755
--- a/VideoLocker/res/drawable/edx_creation_button.xml
+++ b/VideoLocker/res/drawable/edx_creation_button.xml
@@ -1,15 +1,20 @@
-
- -
-
-
-
-
-
+
-
-
-
-
-
+
+
-
+
+
+
+
+
+ -
+
+
+
+
+
+
-
\ No newline at end of file
+
+
\ No newline at end of file
diff --git a/VideoLocker/res/drawable/light_selectable_rounded_box_overlay.xml b/VideoLocker/res/drawable/light_selectable_rounded_box_overlay.xml
new file mode 100644
index 0000000000..8f6269b3ed
--- /dev/null
+++ b/VideoLocker/res/drawable/light_selectable_rounded_box_overlay.xml
@@ -0,0 +1,15 @@
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+
\ No newline at end of file
diff --git a/VideoLocker/res/layout/activity_discovery_launch.xml b/VideoLocker/res/layout/activity_discovery_launch.xml
new file mode 100755
index 0000000000..11ff7613ec
--- /dev/null
+++ b/VideoLocker/res/layout/activity_discovery_launch.xml
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/VideoLocker/res/layout/activity_find_course_info.xml b/VideoLocker/res/layout/activity_find_course_info.xml
index 1a542bdafc..c223f21710 100755
--- a/VideoLocker/res/layout/activity_find_course_info.xml
+++ b/VideoLocker/res/layout/activity_find_course_info.xml
@@ -1,26 +1,39 @@
-
-
-
-
+ android:orientation="vertical">
+
+
+
+
-
+
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/VideoLocker/res/layout/activity_find_courses.xml b/VideoLocker/res/layout/activity_find_courses.xml
index 68648b88a4..15f3f1dcc4 100755
--- a/VideoLocker/res/layout/activity_find_courses.xml
+++ b/VideoLocker/res/layout/activity_find_courses.xml
@@ -1,36 +1,48 @@
+ android:splitMotionEvents="false">
-
+ android:orientation="vertical">
-
-
-
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:background="@color/grey_act_background">
+
+
+
+
-
+
-
+
-
+
+
+
+
diff --git a/VideoLocker/res/layout/activity_single_fragment_base.xml b/VideoLocker/res/layout/activity_single_fragment_base.xml
index 28d45cf71c..10db9bf8cf 100644
--- a/VideoLocker/res/layout/activity_single_fragment_base.xml
+++ b/VideoLocker/res/layout/activity_single_fragment_base.xml
@@ -42,6 +42,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/VideoLocker/res/values/colors.xml b/VideoLocker/res/values/colors.xml
index ba5f73b91a..71b98f7ce7 100755
--- a/VideoLocker/res/values/colors.xml
+++ b/VideoLocker/res/values/colors.xml
@@ -31,6 +31,7 @@
#000000
#90000000
#CC000000
+ #e5000000
#80000000
#19000000
#E6FFFFFF
diff --git a/VideoLocker/res/values/strings.xml b/VideoLocker/res/values/strings.xml
index 518f5d410e..ef248c254a 100755
--- a/VideoLocker/res/values/strings.xml
+++ b/VideoLocker/res/values/strings.xml
@@ -22,8 +22,6 @@
Unable to show dashboard.
-
-
@@ -477,6 +475,14 @@
or sign up with email
+
+
+ Register
+
+ Discover Courses
+
+ Explore Subjects
+
By creating an {platform_name} account, you agree to the
diff --git a/VideoLocker/res/values/styles.xml b/VideoLocker/res/values/styles.xml
index 63a2748627..81e501a647 100755
--- a/VideoLocker/res/values/styles.xml
+++ b/VideoLocker/res/values/styles.xml
@@ -301,6 +301,15 @@
- false
+
+
diff --git a/VideoLocker/src/main/java/org/edx/mobile/base/BaseFragmentActivity.java b/VideoLocker/src/main/java/org/edx/mobile/base/BaseFragmentActivity.java
index cb98651e9c..ee8bf030cc 100755
--- a/VideoLocker/src/main/java/org/edx/mobile/base/BaseFragmentActivity.java
+++ b/VideoLocker/src/main/java/org/edx/mobile/base/BaseFragmentActivity.java
@@ -220,6 +220,18 @@ public void onDrawerOpened(View drawerView) {
}
}
+ /**
+ * Call this function if you do not want to allow
+ * opening/showing the drawer(Navigation Fragment) on swiping left to right
+ */
+ protected void blockDrawerFromOpening(){
+ DrawerLayout drawerLayout = (DrawerLayout)
+ findViewById(R.id.drawer_layout);
+ if (drawerLayout != null) {
+ drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
+ }
+ }
+
//Closing the Navigation Drawer
public void closeDrawer() {
DrawerLayout mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
diff --git a/VideoLocker/src/main/java/org/edx/mobile/base/BaseSingleFragmentActivity.java b/VideoLocker/src/main/java/org/edx/mobile/base/BaseSingleFragmentActivity.java
index bd698423dc..2e62e8a785 100644
--- a/VideoLocker/src/main/java/org/edx/mobile/base/BaseSingleFragmentActivity.java
+++ b/VideoLocker/src/main/java/org/edx/mobile/base/BaseSingleFragmentActivity.java
@@ -106,18 +106,6 @@ protected void hideLoadingProgress(){
}
}
- /**
- * Call this function if you do not want to allow
- * opening/showing the drawer(Navigation Fragment) on swiping left to right
- */
- protected void blockDrawerFromOpening(){
- DrawerLayout drawerLayout = (DrawerLayout)
- findViewById(R.id.drawer_layout);
- if (drawerLayout != null) {
- drawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
- }
- }
-
/**
* implements TaskProcessCallback
*/
diff --git a/VideoLocker/src/main/java/org/edx/mobile/base/FindCoursesBaseActivity.java b/VideoLocker/src/main/java/org/edx/mobile/base/FindCoursesBaseActivity.java
index ebe12d4de0..a3143bffc0 100644
--- a/VideoLocker/src/main/java/org/edx/mobile/base/FindCoursesBaseActivity.java
+++ b/VideoLocker/src/main/java/org/edx/mobile/base/FindCoursesBaseActivity.java
@@ -1,11 +1,13 @@
package org.edx.mobile.base;
+import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.Handler;
+import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.text.TextUtils;
import android.view.View;
@@ -18,6 +20,7 @@
import org.edx.mobile.model.api.EnrolledCoursesResponse;
import org.edx.mobile.task.EnrollForCourseTask;
import org.edx.mobile.task.GetEnrolledCourseTask;
+import org.edx.mobile.view.LoginActivity;
import org.edx.mobile.view.custom.URLInterceptorWebViewClient;
import org.edx.mobile.view.dialog.EnrollmentFailureDialogFragment;
import org.edx.mobile.view.dialog.IDialogCallback;
@@ -29,6 +32,10 @@ public abstract class FindCoursesBaseActivity extends BaseFragmentActivity imple
URLInterceptorWebViewClient.IActionListener,
URLInterceptorWebViewClient.IPageStatusListener {
+ private static final int LOG_IN_REQUEST_CODE = 42;
+ private static final String INSTANCE_COURSE_ID = "enrollCourseId";
+ private static final String INSTANCE_EMAIL_OPT_IN = "enrollEmailOptIn";
+
private static final String ACTION_ENROLLED = "ACTION_ENROLLED_TO_COURSE";
private View offlineBar;
@@ -36,10 +43,12 @@ public abstract class FindCoursesBaseActivity extends BaseFragmentActivity imple
private boolean isWebViewLoaded;
private ProgressBar progressWheel;
private boolean isTaskInProgress = false;
+ private String lastClickEnrollCourseId;
+ private boolean lastClickEnrollEmailOptIn;
@Override
- protected void onCreate(Bundle arg0) {
- super.onCreate(arg0);
+ protected void onCreate(@Nullable Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
webview = (WebView) findViewById(R.id.webview);
offlineBar = findViewById(R.id.offline_bar);
@@ -47,12 +56,11 @@ protected void onCreate(Bundle arg0) {
setupWebView();
enableEnrollCallback();
- }
- @Override
- protected void onStart() {
- super.onStart();
- setTitle(getString(R.string.find_courses_title));
+ if (null != savedInstanceState) {
+ lastClickEnrollCourseId = savedInstanceState.getString(INSTANCE_COURSE_ID);
+ lastClickEnrollEmailOptIn = savedInstanceState.getBoolean(INSTANCE_EMAIL_OPT_IN);
+ }
}
@Override
@@ -168,6 +176,21 @@ public void onClickCourseInfo(String pathId) {
}
}
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+ if (requestCode == LOG_IN_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
+ onClickEnroll(lastClickEnrollCourseId, lastClickEnrollEmailOptIn);
+ }
+ }
+
+ @Override
+ protected void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ outState.putString(INSTANCE_COURSE_ID, lastClickEnrollCourseId);
+ outState.putBoolean(INSTANCE_EMAIL_OPT_IN, lastClickEnrollEmailOptIn);
+ }
+
@Override
public void onClickEnroll(final String courseId, final boolean emailOptIn) {
if (isTaskInProgress) {
@@ -176,6 +199,13 @@ public void onClickEnroll(final String courseId, final boolean emailOptIn) {
return;
}
+ if (environment.getLoginPrefs().getUsername() == null) {
+ lastClickEnrollCourseId = courseId;
+ lastClickEnrollEmailOptIn = emailOptIn;
+ startActivityForResult(environment.getRouter().getRegisterIntent(), LOG_IN_REQUEST_CODE);
+ return;
+ }
+
environment.getSegment().trackEnrollClicked(courseId, emailOptIn);
isTaskInProgress = true;
diff --git a/VideoLocker/src/main/java/org/edx/mobile/module/analytics/ISegment.java b/VideoLocker/src/main/java/org/edx/mobile/module/analytics/ISegment.java
index cdc0ca5645..aa14bd19e8 100644
--- a/VideoLocker/src/main/java/org/edx/mobile/module/analytics/ISegment.java
+++ b/VideoLocker/src/main/java/org/edx/mobile/module/analytics/ISegment.java
@@ -84,6 +84,10 @@ Properties trackSingleVideoDownload(String videoId, String courseId,
Properties trackVideoOrientation(String videoId, Double currentTime,
boolean isLandscape, String courseId, String unitUrl);
+ Properties trackDiscoverCoursesClicked();
+
+ Properties trackExploreSubjectsClicked();
+
Properties trackUserSignUpForAccount();
Properties trackUserFindsCourses();
@@ -199,10 +203,12 @@ interface Values {
String USERLOGOUT = "edx.bi.app.user.logout";
String USERLOGIN = "edx.bi.app.user.login";
String APP_NAME = "edx.mobileapp.android";
- String USER_NO_ACCOUNT = "edx.bi.app.user.signup.clicked";
+ String DISCOVER_COURSES_CLICK = "edx.bi.app.discover.courses.tapped";
+ String EXPLORE_SUBJECTS_CLICK = "edx.bi.app.discover.explore.tapped";
String USER_FIND_COURSES = "edx.bi.app.search.find_courses.clicked";
String CREATE_ACCOUNT_CLICK = "edx.bi.app.user.register.clicked";
String USER_COURSE_ENROLL = "edx.bi.app.course.enroll.clicked";
+ String USER_NO_ACCOUNT = "edx.bi.app.user.signup.clicked";
String CONVERSION = "conversion";
String USER_ENGAGEMENT = "user-engagement";
String COURSE_DISCOVERY = "course-discovery";
@@ -292,6 +298,8 @@ interface Events {
String FIND_COURSES = "Find Courses Clicked";
String CREATE_ACCOUNT_CLICKED = "Create Account Clicked";
String ENROLL_COURSES = "Enroll Course Clicked";
+ String DISCOVER_COURSES = "Discover Courses";
+ String EXPLORE_SUBJECTS = "Explore Subjects";
String SPEED = "Connected Speed Report";
String SOCIAL_CERTIFICATE_SHARED = "Shared a certificate";
String SOCIAL_COURSE_DETAIL_SHARED = "Shared a course";
diff --git a/VideoLocker/src/main/java/org/edx/mobile/module/analytics/ISegmentEmptyImpl.java b/VideoLocker/src/main/java/org/edx/mobile/module/analytics/ISegmentEmptyImpl.java
index 386a82e650..e450cf4cd1 100644
--- a/VideoLocker/src/main/java/org/edx/mobile/module/analytics/ISegmentEmptyImpl.java
+++ b/VideoLocker/src/main/java/org/edx/mobile/module/analytics/ISegmentEmptyImpl.java
@@ -128,6 +128,16 @@ public Properties trackVideoOrientation(String videoId, Double currentTime, bool
return null;
}
+ @Override
+ public Properties trackDiscoverCoursesClicked() {
+ return null;
+ }
+
+ @Override
+ public Properties trackExploreSubjectsClicked() {
+ return null;
+ }
+
@Override
public Properties trackUserSignUpForAccount() {
return null;
diff --git a/VideoLocker/src/main/java/org/edx/mobile/module/analytics/ISegmentImpl.java b/VideoLocker/src/main/java/org/edx/mobile/module/analytics/ISegmentImpl.java
index eb46bcb9d3..4d1f8936c1 100644
--- a/VideoLocker/src/main/java/org/edx/mobile/module/analytics/ISegmentImpl.java
+++ b/VideoLocker/src/main/java/org/edx/mobile/module/analytics/ISegmentImpl.java
@@ -501,6 +501,24 @@ public Properties trackVideoOrientation(String videoId, Double currentTime,
return aEvent.properties;
}
+ @Override
+ public Properties trackDiscoverCoursesClicked() {
+ SegmentAnalyticsEvent aEvent = new SegmentAnalyticsEvent();
+ aEvent.properties.putValue(Keys.NAME, Values.DISCOVER_COURSES_CLICK);
+ aEvent.setAppNameContext();
+ tracker.track(Events.DISCOVER_COURSES, aEvent.properties);
+ return aEvent.properties;
+ }
+
+ @Override
+ public Properties trackExploreSubjectsClicked() {
+ SegmentAnalyticsEvent aEvent = new SegmentAnalyticsEvent();
+ aEvent.properties.putValue(Keys.NAME, Values.EXPLORE_SUBJECTS_CLICK);
+ aEvent.setAppNameContext();
+ tracker.track(Events.EXPLORE_SUBJECTS, aEvent.properties);
+ return aEvent.properties;
+ }
+
/**
* This function is used to track User Login activity
* Method will take the following inputs “Password”|”Google”|”Facebook”
diff --git a/VideoLocker/src/main/java/org/edx/mobile/util/Config.java b/VideoLocker/src/main/java/org/edx/mobile/util/Config.java
index 8151966fc0..947eb83713 100644
--- a/VideoLocker/src/main/java/org/edx/mobile/util/Config.java
+++ b/VideoLocker/src/main/java/org/edx/mobile/util/Config.java
@@ -55,6 +55,7 @@ public class Config {
private static final String BADGES_ENABLED = "BADGES_ENABLED";
private static final String SERVER_SIDE_CHANGED_THREAD = "SERVER_SIDE_CHANGED_THREAD";
private static final String END_TO_END_TEST = "END_TO_END_TEST";
+ private static final String NEW_LOGISTRATION_ENABLED = "NEW_LOGISTRATION_ENABLED";
public static class ZeroRatingConfig {
@SerializedName("ENABLED")
@@ -105,16 +106,20 @@ public boolean isWebviewCourseDiscoveryEnabled() {
}
}
+ public WebViewConfig getWebViewConfig() {
+ return mWebViewConfig;
+ }
+
public String getCourseSearchUrl() {
- return mWebViewConfig.getCourseSearchUrl();
+ return getWebViewConfig().getCourseSearchUrl();
}
public String getCourseInfoUrlTemplate() {
- return mWebViewConfig.getCourseInfoUrlTemplate();
+ return getWebViewConfig().getCourseInfoUrlTemplate();
}
public boolean isWebCourseSearchEnabled() {
- return mWebViewConfig.isWebCourseSearchEnabled();
+ return getWebViewConfig().isWebCourseSearchEnabled();
}
}
@@ -122,6 +127,9 @@ public static class WebViewConfig {
@SerializedName("COURSE_SEARCH_URL")
private String mSearchUrl;
+ @SerializedName("EXPLORE_SUBJECTS_URL")
+ private String mExploreSubjectsUrl;
+
@SerializedName("COURSE_INFO_URL_TEMPLATE")
private String mCourseInfoUrlTemplate;
@@ -132,6 +140,10 @@ public String getCourseSearchUrl() {
return mSearchUrl;
}
+ public String getExploreSubjectsUrl() {
+ return mExploreSubjectsUrl;
+ }
+
public String getCourseInfoUrlTemplate() {
return mCourseInfoUrlTemplate;
}
@@ -369,6 +381,10 @@ public boolean isNotificationEnabled() {
return getBoolean(PUSH_NOTIFICATIONS_FLAG, false);
}
+ public boolean isNewLogistrationEnabled() {
+ return getBoolean(NEW_LOGISTRATION_ENABLED, false);
+ }
+
/**
* Empty or no config returns false.
* Otherwise, returns the value from the config.
diff --git a/VideoLocker/src/main/java/org/edx/mobile/util/IntentFactory.java b/VideoLocker/src/main/java/org/edx/mobile/util/IntentFactory.java
new file mode 100644
index 0000000000..5182526c28
--- /dev/null
+++ b/VideoLocker/src/main/java/org/edx/mobile/util/IntentFactory.java
@@ -0,0 +1,20 @@
+package org.edx.mobile.util;
+
+import android.app.Activity;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.support.annotation.NonNull;
+
+import org.edx.mobile.BuildConfig;
+
+public enum IntentFactory {
+ ;
+
+ /**
+ * @return a new Intent that will start the given activity.
+ */
+ @NonNull
+ public static Intent newIntentForComponent(@NonNull Class activityClass) {
+ return new Intent().setComponent(new ComponentName(BuildConfig.APPLICATION_ID, activityClass.getName()));
+ }
+}
diff --git a/VideoLocker/src/main/java/org/edx/mobile/util/images/IntentFactory.java b/VideoLocker/src/main/java/org/edx/mobile/util/images/IntentFactory.java
deleted file mode 100644
index 09af02d9f7..0000000000
--- a/VideoLocker/src/main/java/org/edx/mobile/util/images/IntentFactory.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.edx.mobile.util.images;
-
-import android.content.ComponentName;
-import android.content.Intent;
-
-import org.edx.mobile.BuildConfig;
-
-public enum IntentFactory {
- ;
- /**
- * @return a new Intent that will start the activity that this method was called from
- */
- public static Intent newIntentForComponent() {
- final StackTraceElement[] s = new RuntimeException().getStackTrace();
- return new Intent().setComponent(new ComponentName(BuildConfig.APPLICATION_ID, s[1].getClassName()));
- }
-}
diff --git a/VideoLocker/src/main/java/org/edx/mobile/view/CourseDetailFragment.java b/VideoLocker/src/main/java/org/edx/mobile/view/CourseDetailFragment.java
index 56835be4ab..ba827d8688 100644
--- a/VideoLocker/src/main/java/org/edx/mobile/view/CourseDetailFragment.java
+++ b/VideoLocker/src/main/java/org/edx/mobile/view/CourseDetailFragment.java
@@ -7,6 +7,7 @@
package org.edx.mobile.view;
+import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
@@ -19,7 +20,6 @@
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
-import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
@@ -30,7 +30,6 @@
import org.apache.http.protocol.HTTP;
import org.edx.mobile.R;
-import org.edx.mobile.base.FindCoursesBaseActivity;
import org.edx.mobile.core.IEdxEnvironment;
import org.edx.mobile.course.CourseDetail;
import org.edx.mobile.course.GetCourseDetailTask;
@@ -39,7 +38,6 @@
import org.edx.mobile.services.ServiceManager;
import org.edx.mobile.task.EnrollForCourseTask;
import org.edx.mobile.task.GetEnrolledCourseTask;
-import org.edx.mobile.util.UrlUtil;
import org.edx.mobile.util.WebViewUtil;
import org.edx.mobile.util.images.CourseCardUtils;
import org.edx.mobile.util.images.TopAnchorFillWidthTransformation;
@@ -54,6 +52,8 @@
public class CourseDetailFragment extends BaseFragment {
+ private static final int LOG_IN_REQUEST_CODE = 42;
+
@Nullable
private GetCourseDetailTask getCourseDetailTask;
@@ -308,10 +308,22 @@ public void onClick(View v) {
});
}
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+ if (requestCode == LOG_IN_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
+ enrollInCourse();
+ }
+ }
+
/**
* Enroll in a course, Then open the course dashboard of the enrolled course.
*/
public void enrollInCourse() {
+ if (null == environment.getLoginPrefs().getUsername()) {
+ startActivityForResult(environment.getRouter().getRegisterIntent(), LOG_IN_REQUEST_CODE);
+ return;
+ }
environment.getSegment().trackEnrollClicked(courseDetail.course_id, emailOptIn);
EnrollForCourseTask enrollForCourseTask = new EnrollForCourseTask(getActivity(),
courseDetail.course_id, emailOptIn) {
diff --git a/VideoLocker/src/main/java/org/edx/mobile/view/DiscoveryLaunchActivity.java b/VideoLocker/src/main/java/org/edx/mobile/view/DiscoveryLaunchActivity.java
new file mode 100644
index 0000000000..a3951742cf
--- /dev/null
+++ b/VideoLocker/src/main/java/org/edx/mobile/view/DiscoveryLaunchActivity.java
@@ -0,0 +1,63 @@
+package org.edx.mobile.view;
+
+import android.databinding.DataBindingUtil;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.view.Menu;
+import android.view.View;
+import android.view.View.OnClickListener;
+
+import com.google.inject.Inject;
+
+import org.edx.mobile.R;
+import org.edx.mobile.base.BaseFragmentActivity;
+import org.edx.mobile.databinding.ActivityDiscoveryLaunchBinding;
+import org.edx.mobile.module.analytics.ISegment;
+import org.edx.mobile.module.prefs.LoginPrefs;
+
+public class DiscoveryLaunchActivity extends BaseFragmentActivity {
+
+ @Inject
+ LoginPrefs loginPrefs;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ final ActivityDiscoveryLaunchBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_discovery_launch);
+ binding.discoverCourses.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ environment.getSegment().trackDiscoverCoursesClicked();
+ environment.getRouter().showFindCourses(DiscoveryLaunchActivity.this);
+ }
+ });
+ if (environment.getConfig().getCourseDiscoveryConfig().isWebviewCourseDiscoveryEnabled()
+ && !TextUtils.isEmpty(environment.getConfig().getCourseDiscoveryConfig().getWebViewConfig().getExploreSubjectsUrl())) {
+ binding.exploreSubjects.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ environment.getSegment().trackExploreSubjectsClicked();
+ environment.getRouter().showExploreSubjects(DiscoveryLaunchActivity.this);
+ }
+ });
+ } else {
+ // Explore Subjects is only supported for web course discovery
+ binding.exploreSubjects.setVisibility(View.INVISIBLE);
+ }
+ environment.getSegment().trackScreenView(ISegment.Screens.LAUNCH_ACTIVITY);
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ if (environment.getLoginPrefs().getUsername() != null) {
+ finish();
+ environment.getRouter().showMyCourses(this);
+ }
+ }
+
+ @Override
+ protected boolean createOptionsMenu(Menu menu) {
+ return false; // Disable menu inherited from BaseFragmentActivity
+ }
+}
diff --git a/VideoLocker/src/main/java/org/edx/mobile/view/LaunchActivity.java b/VideoLocker/src/main/java/org/edx/mobile/view/LaunchActivity.java
index 24f007a6d7..a3c9d04bef 100644
--- a/VideoLocker/src/main/java/org/edx/mobile/view/LaunchActivity.java
+++ b/VideoLocker/src/main/java/org/edx/mobile/view/LaunchActivity.java
@@ -2,71 +2,50 @@
import android.databinding.DataBindingUtil;
import android.os.Bundle;
-import android.support.annotation.NonNull;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
-import android.widget.Button;
import com.google.inject.Inject;
import org.edx.mobile.R;
-import org.edx.mobile.authentication.LogInEvent;
-import org.edx.mobile.authentication.LoginAPI;
import org.edx.mobile.base.BaseFragmentActivity;
import org.edx.mobile.databinding.ActivityLaunchBinding;
import org.edx.mobile.module.analytics.ISegment;
import org.edx.mobile.module.prefs.LoginPrefs;
-import org.edx.mobile.util.observer.Observer;
-import org.edx.mobile.util.observer.Subscription;
public class LaunchActivity extends BaseFragmentActivity {
@Inject
LoginPrefs loginPrefs;
- @Inject
- LoginAPI loginAPI;
-
- private Subscription logInSubscription;
-
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- // Finish this activity if the user logs in from another activity
- logInSubscription = loginAPI.getLogInEvents().subscribe(new Observer() {
- @Override
- public void onData(@NonNull LogInEvent data) {
- finish();
- }
-
- @Override
- public void onError(@NonNull Throwable error) {
- // This will never happen
- throw new RuntimeException(error);
- }
- });
final ActivityLaunchBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_launch);
binding.signInTv.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
- environment.getRouter().showLogin(LaunchActivity.this);
+ startActivity(environment.getRouter().getLogInIntent());
}
});
binding.signUpBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
environment.getSegment().trackUserSignUpForAccount();
- environment.getRouter().showRegistration(LaunchActivity.this);
+ startActivity(environment.getRouter().getRegisterIntent());
}
});
environment.getSegment().trackScreenView(ISegment.Screens.LAUNCH_ACTIVITY);
}
@Override
- protected void onDestroy() {
- super.onDestroy();
- logInSubscription.unsubscribe();
+ protected void onResume() {
+ super.onResume();
+ if (environment.getLoginPrefs().getUsername() != null) {
+ finish();
+ environment.getRouter().showMyCourses(this);
+ }
}
@Override
diff --git a/VideoLocker/src/main/java/org/edx/mobile/view/LogInSignUpFragment.java b/VideoLocker/src/main/java/org/edx/mobile/view/LogInSignUpFragment.java
new file mode 100644
index 0000000000..ec89890e10
--- /dev/null
+++ b/VideoLocker/src/main/java/org/edx/mobile/view/LogInSignUpFragment.java
@@ -0,0 +1,60 @@
+package org.edx.mobile.view;
+
+import android.databinding.DataBindingUtil;
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.google.inject.Inject;
+
+import org.edx.mobile.R;
+import org.edx.mobile.base.BaseFragment;
+import org.edx.mobile.core.IEdxEnvironment;
+import org.edx.mobile.databinding.FragmentAuthPanelBinding;
+
+public class LogInSignUpFragment extends BaseFragment {
+
+ @Inject
+ protected IEdxEnvironment environment;
+
+ FragmentAuthPanelBinding binding;
+
+ @Nullable
+ @Override
+ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
+ binding = DataBindingUtil.inflate(inflater, R.layout.fragment_auth_panel, container, false);
+ return binding.getRoot();
+ }
+
+ @Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ if (environment.getConfig().isNewLogistrationEnabled()) {
+ binding.logIn.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ startActivity(environment.getRouter().getLogInIntent());
+ }
+ });
+ binding.signUp.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ environment.getSegment().trackUserSignUpForAccount();
+ startActivity(environment.getRouter().getRegisterIntent());
+ }
+ });
+ } else {
+ binding.container.setVisibility(View.GONE);
+ }
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ if (environment.getLoginPrefs().getUsername() != null) {
+ binding.container.setVisibility(View.GONE);
+ }
+ }
+}
diff --git a/VideoLocker/src/main/java/org/edx/mobile/view/LoginActivity.java b/VideoLocker/src/main/java/org/edx/mobile/view/LoginActivity.java
index 6ccd8046c0..39494b8fc5 100644
--- a/VideoLocker/src/main/java/org/edx/mobile/view/LoginActivity.java
+++ b/VideoLocker/src/main/java/org/edx/mobile/view/LoginActivity.java
@@ -1,7 +1,5 @@
package org.edx.mobile.view;
-import android.app.Activity;
-import android.content.Context;
import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
@@ -35,6 +33,7 @@
import org.edx.mobile.util.NetworkUtil;
import org.edx.mobile.util.ResourceUtil;
import org.edx.mobile.util.ViewAnimationUtil;
+import org.edx.mobile.util.IntentFactory;
import org.edx.mobile.view.dialog.ResetPasswordDialog;
import org.edx.mobile.view.dialog.SimpleAlertDialog;
import org.edx.mobile.view.dialog.SuccessDialogFragment;
@@ -56,11 +55,9 @@ public class LoginActivity extends PresenterActivity