Merge "Fix the background color of CollapsingToolbarLayout" into sc-v2-dev

This commit is contained in:
TreeHugger Robot
2021-12-02 07:19:45 +00:00
committed by Android (Google) Code Review
13 changed files with 203 additions and 15 deletions

View File

@@ -17,6 +17,7 @@
package com.android.settings.dashboard.profileselector;
import androidx.fragment.app.Fragment;
import com.android.settings.R;
import com.android.settings.accounts.AccountPersonalDashboardFragment;
import com.android.settings.accounts.AccountWorkProfileDashboardFragment;
@@ -32,4 +33,9 @@ public class ProfileSelectAccountFragment extends ProfileSelectFragment {
new AccountWorkProfileDashboardFragment()
};
}
@Override
protected int getPreferenceScreenResId() {
return R.xml.accounts_dashboard_settings_header;
}
}

View File

@@ -107,6 +107,10 @@ public abstract class ProfileSelectFragment extends DashboardFragment {
Bundle savedInstanceState) {
mContentView = (ViewGroup) super.onCreateView(inflater, container, savedInstanceState);
final Activity activity = getActivity();
final int titleResId = getTitleResId();
if (titleResId > 0) {
activity.setTitle(titleResId);
}
final int selectedTab = convertPosition(getTabId(activity, getArguments()));
final View tabContainer = mContentView.findViewById(R.id.tab_container);
@@ -166,6 +170,14 @@ public abstract class ProfileSelectFragment extends DashboardFragment {
*/
public abstract Fragment[] getFragments();
/**
* Returns a resource ID of the title
* Override this if the title needs to be updated dynamically.
*/
int getTitleResId() {
return 0;
}
@Override
protected int getPreferenceScreenResId() {
return R.xml.placeholder_preference_screen;

View File

@@ -60,4 +60,9 @@ public class ProfileSelectLocationFragment extends ProfileSelectFragment {
workFragment
};
}
@Override
protected int getPreferenceScreenResId() {
return R.xml.location_settings_header;
}
}

View File

@@ -20,6 +20,7 @@ import android.os.Bundle;
import androidx.fragment.app.Fragment;
import com.android.settings.R;
import com.android.settings.location.LocationServices;
import com.android.settings.location.LocationServicesForWork;
@@ -44,4 +45,9 @@ public class ProfileSelectLocationServicesFragment extends ProfileSelectFragment
workFragment
};
}
@Override
protected int getPreferenceScreenResId() {
return R.xml.location_services_header;
}
}

View File

@@ -16,6 +16,8 @@
package com.android.settings.dashboard.profileselector;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
@@ -43,4 +45,12 @@ public class ProfileSelectManageApplications extends ProfileSelectFragment {
workFragment
};
}
@Override
int getTitleResId() {
final Activity activity = getActivity();
final Intent intent = activity.getIntent();
final Bundle args = getArguments();
return ManageApplications.getTitleResId(intent, args);
}
}

View File

@@ -20,6 +20,7 @@ import android.os.Bundle;
import androidx.fragment.app.Fragment;
import com.android.settings.R;
import com.android.settings.location.RecentLocationAccessSeeAllFragment;
/**
@@ -43,4 +44,9 @@ public class ProfileSelectRecentLocationAccessFragment extends ProfileSelectFrag
workFragment
};
}
@Override
protected int getPreferenceScreenResId() {
return R.xml.location_recent_location_access_header;
}
}

View File

@@ -20,6 +20,7 @@ import android.os.Bundle;
import androidx.fragment.app.Fragment;
import com.android.settings.R;
import com.android.settings.location.RecentLocationRequestSeeAllFragment;
/**
@@ -43,4 +44,9 @@ public class ProfileSelectRecentLocationRequestFragment extends ProfileSelectFra
workFragment
};
}
@Override
protected int getPreferenceScreenResId() {
return R.xml.location_recent_requests_header;
}
}