Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions app/res/layout-land/home_screen.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<androidx.drawerlayout.widget.DrawerLayout
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:tag="layout/activity_login_0"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">

<FrameLayout
android:id="@+id/nav_drawer_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
<LinearLayout
style="@style/MainPane"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down Expand Up @@ -81,3 +93,6 @@
</RelativeLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
</FrameLayout>
<include layout="@layout/nav_drawer_base"/>
</androidx.drawerlayout.widget.DrawerLayout>
14 changes: 11 additions & 3 deletions app/res/layout/first_start_screen_modern.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
<androidx.drawerlayout.widget.DrawerLayout android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:tag="layout/activity_login_0"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:tools="http://schemas.android.com/tools">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/cc_core_bg"
tools:viewBindingIgnore="true">
tools:viewBindingIgnore="true"
android:id="@+id/nav_drawer_frame">
<!-- Fragment container, will hold the actual setup app screen here -->
<FrameLayout
android:id="@+id/setup_fragment_container"
Expand All @@ -16,3 +21,6 @@


</FrameLayout>
<include layout="@layout/nav_drawer_base"/>

</androidx.drawerlayout.widget.DrawerLayout>
19 changes: 17 additions & 2 deletions app/res/layout/home_screen.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<androidx.drawerlayout.widget.DrawerLayout
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:tag="layout/activity_login_0"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">

<FrameLayout
android:id="@+id/nav_drawer_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/cc_core_bg"
Expand Down Expand Up @@ -76,3 +88,6 @@
</RelativeLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
</FrameLayout>
<include layout="@layout/nav_drawer_base"/>
</androidx.drawerlayout.widget.DrawerLayout>
24 changes: 5 additions & 19 deletions app/res/layout/nav_drawer_base.xml
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
<layout
<LinearLayout android:layout_width="@dimen/nav_drawer_width"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/cc_brand_color"
android:layout_gravity="start"
xmlns:android="http://schemas.android.com/apk/res/android">
<androidx.drawerlayout.widget.DrawerLayout
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">

<FrameLayout
android:id="@+id/nav_drawer_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />

<LinearLayout
android:layout_width="@dimen/nav_drawer_width"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/cc_brand_color"
android:layout_gravity="start">

<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
Expand Down Expand Up @@ -80,5 +68,3 @@
</androidx.core.widget.NestedScrollView>

</LinearLayout>
</androidx.drawerlayout.widget.DrawerLayout>
</layout>
56 changes: 35 additions & 21 deletions app/res/layout/screen_login.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:RectangleButtonWithText="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
<androidx.drawerlayout.widget.DrawerLayout android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="@color/white"
android:orientation="vertical"
tools:viewBindingIgnore="true">
android:layout_height="match_parent"
android:tag="layout/activity_login_0"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:RectangleButtonWithText="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/screen_login_main"
<FrameLayout
android:id="@+id/nav_drawer_frame"
android:layout_width="match_parent"
android:layout_height="fill_parent">
android:layout_height="match_parent"
android:background="@color/white">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
tools:viewBindingIgnore="true">

<RelativeLayout
android:id="@+id/screen_login_main"
android:layout_width="match_parent"
android:layout_height="fill_parent">

<LinearLayout
android:id="@+id/screen_login_bottom_pane"
Expand Down Expand Up @@ -259,15 +268,20 @@
</ScrollView>
</RelativeLayout>

<include layout="@layout/component_drop_shadow" />
<include layout="@layout/component_drop_shadow" />

<!-- Dummy item to give focus to when we want to prevent keyboard from showing -->
<LinearLayout
android:id="@+id/dummy_focusable_view"
android:layout_width="0px"
android:layout_height="0px"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="horizontal" />

</LinearLayout>

<!-- Dummy item to give focus to when we want to prevent keyboard from showing -->
<LinearLayout
android:id="@+id/dummy_focusable_view"
android:layout_width="0px"
android:layout_height="0px"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="horizontal" />
</FrameLayout>

</LinearLayout>
<include layout="@layout/nav_drawer_base"/>
</androidx.drawerlayout.widget.DrawerLayout>
6 changes: 6 additions & 0 deletions app/src/org/commcare/activities/CommCareActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,16 @@

import org.commcare.CommCareApplication;
import org.commcare.android.database.user.models.ACase;
import org.commcare.connect.PersonalIdManager;
import org.commcare.fragments.BreadcrumbBarHelper;
import org.commcare.fragments.ContainerViewModel;
import org.commcare.fragments.TaskConnectorViewModel;
import org.commcare.google.services.analytics.AnalyticsParamValue;
import org.commcare.google.services.analytics.FirebaseAnalyticsUtil;
import org.commcare.interfaces.WithUIController;
import org.commcare.logic.DetailCalloutListenerDefaultImpl;
import org.commcare.navdrawer.BaseDrawerController;
import org.commcare.navdrawer.DrawerViewRefs;
import org.commcare.preferences.LocalePreferences;
import org.commcare.services.DataSyncCompleteBroadcastReceiver;
import org.commcare.services.FCMMessageData;
Expand Down Expand Up @@ -74,6 +77,8 @@

import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
import kotlin.Unit;
import kotlin.jvm.functions.Function2;

/**
* Base class for CommCareActivities to simplify
Expand Down Expand Up @@ -987,4 +992,5 @@ protected void showToast(int stringResource) {
protected String getLocalizedString(int stringResource) {
return StringUtils.getStringRobust(this, stringResource);
}

}
14 changes: 7 additions & 7 deletions app/src/org/commcare/activities/CommCareSetupActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
import android.os.Bundle;
import android.os.PowerManager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.FrameLayout;
import android.view.View;
import android.widget.Toast;

import androidx.annotation.NonNull;
Expand All @@ -22,6 +21,8 @@
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.ViewModelProvider;
import kotlin.Unit;
import kotlin.jvm.functions.Function2;

import org.commcare.AppUtils;
import org.commcare.CommCareApp;
Expand All @@ -45,6 +46,8 @@
import org.commcare.logging.DataChangeLog;
import org.commcare.logging.DataChangeLogger;
import org.commcare.navdrawer.BaseDrawerActivity;
import org.commcare.navdrawer.BaseDrawerController;
import org.commcare.navdrawer.DrawerViewRefs;
import org.commcare.preferences.GlobalPrivilegesManager;
import org.commcare.resources.ResourceManager;
import org.commcare.resources.model.InvalidResourceException;
Expand Down Expand Up @@ -141,6 +144,8 @@ public enum UiState {
private boolean startAllowed = true;
private String incomingRef;
private CommCareApp ccApp;
private BaseDrawerController drawerController;


/**
* Indicates that this activity was launched from the AppManagerActivity
Expand Down Expand Up @@ -817,11 +822,6 @@ public CustomProgressDialog generateProgressDialog(int taskId) {
}
}

@Override
public void injectScreenLayout(@NonNull LayoutInflater inflater, @NonNull FrameLayout contentFrame) {
inflater.inflate(R.layout.first_start_screen_modern, contentFrame, true);
}

private CustomProgressDialog generateNormalInstallDialog(int taskId) {
String title = Localization.get("updates.resources.initialization");
String message = Localization.get("updates.resources.profile");
Expand Down
31 changes: 12 additions & 19 deletions app/src/org/commcare/activities/LoginActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,20 @@
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.FrameLayout;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import androidx.core.util.Pair;
import androidx.preference.PreferenceManager;
import androidx.work.WorkManager;
import kotlin.Unit;
import kotlin.jvm.functions.Function2;

import com.scottyab.rootbeer.RootBeer;

Expand All @@ -46,6 +45,7 @@
import org.commcare.connect.database.ConnectJobUtils;
import org.commcare.dalvik.BuildConfig;
import org.commcare.dalvik.R;
import org.commcare.dalvik.databinding.ScreenLoginBinding;
import org.commcare.engine.resource.AppInstallStatus;
import org.commcare.engine.resource.ResourceInstallUtils;
import org.commcare.google.services.analytics.AnalyticsParamValue;
Expand All @@ -55,6 +55,8 @@
import org.commcare.interfaces.WithUIController;
import org.commcare.models.database.user.DemoUserBuilder;
import org.commcare.navdrawer.BaseDrawerActivity;
import org.commcare.navdrawer.BaseDrawerController;
import org.commcare.navdrawer.DrawerViewRefs;
import org.commcare.preferences.DevSessionRestorer;
import org.commcare.preferences.HiddenPreferences;
import org.commcare.recovery.measures.RecoveryMeasuresHelper;
Expand Down Expand Up @@ -132,7 +134,6 @@ public class LoginActivity extends BaseDrawerActivity<LoginActivity>
private boolean connectLaunchPerformed;
private Map<Integer, String> menuIdToAnalyticsParam;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -148,6 +149,7 @@ protected void onCreate(Bundle savedInstanceState) {
uiController.setupUI();
formAndDataSyncer = new FormAndDataSyncer();


uiController.checkForGlobalErrors();

personalIdManager = PersonalIdManager.getInstance();
Expand All @@ -166,6 +168,7 @@ protected void onCreate(Bundle savedInstanceState) {
passwordOrPinBeforeRotation = savedInstanceState.getString(KEY_ENTERED_PW_OR_PIN);
}


if (!HiddenPreferences.allowRunOnRootedDevice()
&& new RootBeer(this).isRooted()) {
new UserfacingErrorHandling<>().createErrorDialog(this,
Expand Down Expand Up @@ -1009,27 +1012,17 @@ protected PersonalIdManager.ConnectAppMangement getConnectAppState() {
return connectAppState;
}

@Override
public void injectScreenLayout(@NonNull LayoutInflater inflater, @NonNull FrameLayout contentFrame) {
inflater.inflate(R.layout.screen_login, contentFrame, true);
}
@Override
protected void onDrawerItemClicked(@NonNull NavItemType navItemType, @Nullable String recordId) {
super.onDrawerItemClicked(navItemType, recordId); // optional: keeps analytics tracking
switch (navItemType) {
case OPPORTUNITIES:
break;
case COMMCARE_APPS:
protected void handleDrawerItemClick(BaseDrawerController.NavItemType itemType, String recordId) {
switch (itemType) {
case OPPORTUNITIES -> { /* handle */ }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we also add the click handling now that the connect code is merged.

case COMMCARE_APPS -> {
if (recordId != null) {
if (!appIdDropdownList.isEmpty()) {
selectedAppIndex = appIdDropdownList.indexOf(recordId);
}
seatAppIfNeeded(recordId);
}
break;
case MESSAGING:
break;
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
import android.content.Intent;
import android.os.Bundle;

import org.commcare.navdrawer.BaseDrawerActivity;
import org.commcare.utils.SessionRegistrationHelper;

/**
* Manage redirection to login screen when session expiration occurs.
*
* @author Phillip Mates (pmates@dimagi.com)
*/
public abstract class SessionAwareCommCareActivity<R> extends CommCareActivity<R> implements SessionAwareInterface {
public abstract class SessionAwareCommCareActivity<R> extends BaseDrawerActivity<R> implements SessionAwareInterface {

private boolean redirectedInOnCreate;

Expand Down
Loading