The dynamic index implementation for time zone preferences.
Disable the region settings page if auto time zone is enabled. Fixes: 146849126 Test: manual Change-Id: Icce1e5aca14539d6c9149e05a3321429bd337f17
This commit is contained in:
@@ -25,6 +25,7 @@ import android.content.Intent;
|
|||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.icu.util.TimeZone;
|
import android.icu.util.TimeZone;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.provider.Settings;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuInflater;
|
import android.view.MenuInflater;
|
||||||
@@ -353,6 +354,7 @@ public class TimeZoneSettings extends DashboardFragment {
|
|||||||
* Find the a region associated with the specified time zone, based on the time zone data.
|
* Find the a region associated with the specified time zone, based on the time zone data.
|
||||||
* If there are multiple regions associated with the given time zone, the priority will be given
|
* If there are multiple regions associated with the given time zone, the priority will be given
|
||||||
* to the region the user last picked and the country in user's locale.
|
* to the region the user last picked and the country in user's locale.
|
||||||
|
*
|
||||||
* @return null if no region associated with the time zone
|
* @return null if no region associated with the time zone
|
||||||
*/
|
*/
|
||||||
private String findRegionIdForTzId(String tzId) {
|
private String findRegionIdForTzId(String tzId) {
|
||||||
@@ -392,5 +394,13 @@ public class TimeZoneSettings extends DashboardFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||||
new BaseSearchIndexProvider(R.xml.time_zone_prefs);
|
new BaseSearchIndexProvider(R.xml.time_zone_prefs) {
|
||||||
|
@Override
|
||||||
|
protected boolean isPageSearchEnabled(Context context) {
|
||||||
|
// We can't enter this page if the auto time zone is enabled.
|
||||||
|
final int autoTimeZone = Settings.Global.getInt(context.getContentResolver(),
|
||||||
|
Settings.Global.AUTO_TIME_ZONE, 1);
|
||||||
|
return autoTimeZone == 1 ? false : true;
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user