Support contextual suggestion

- add a suggestion layout
- add an interface to get fragment in suggestion feature provider
- remove the first preference category of homepage IA to align its top
  with the bottom of the search box

Bug: 173768418
Test: robotest
Change-Id: I784e3eef29ca474c4c89f07b916c6500fabbf7d4
This commit is contained in:
Jason Chiu
2020-11-20 17:16:41 +08:00
parent 3932b07365
commit bd854ccd10
8 changed files with 148 additions and 40 deletions

View File

@@ -21,6 +21,7 @@ import android.content.Context;
import android.content.SharedPreferences;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
/** Interface should be implemented if you have added new suggestions */
public interface SuggestionFeatureProvider {
@@ -42,4 +43,9 @@ public interface SuggestionFeatureProvider {
* Returns the {@link SharedPreferences} that holds metadata for suggestions.
*/
SharedPreferences getSharedPrefs(Context context);
/**
* Returns the class of {@link Fragment} that supports contextual suggestion.
*/
Class<? extends Fragment> getContextualSuggestionFragment();
}

View File

@@ -22,6 +22,7 @@ import android.content.Context;
import android.content.SharedPreferences;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import com.android.settings.Settings.NightDisplaySuggestionActivity;
import com.android.settings.biometrics.fingerprint.FingerprintEnrollSuggestionActivity;
@@ -86,6 +87,11 @@ public class SuggestionFeatureProviderImpl implements SuggestionFeatureProvider
return context.getSharedPreferences(SHARED_PREF_FILENAME, Context.MODE_PRIVATE);
}
@Override
public Class<? extends Fragment> getContextualSuggestionFragment() {
return null;
}
public SuggestionFeatureProviderImpl(Context context) {
final Context appContext = context.getApplicationContext();
mMetricsFeatureProvider = FeatureFactory.getFactory(appContext)