The big code style cleanup
* Format using AOSP code style in Android Studio, excluding `Rearrange entries` option. * Rename static variables to use proper naming scheme * Remove empty lines Change-Id: I0d193e35f071bc288050e587b1693844d68865e1
This commit is contained in:
committed by
Timi Rautamäki
parent
ade1361e3b
commit
b7b34b96a9
@@ -18,6 +18,7 @@
|
||||
package org.lineageos.setupwizard;
|
||||
|
||||
import static android.view.View.INVISIBLE;
|
||||
|
||||
import static com.google.android.setupcompat.util.ResultCodes.RESULT_ACTIVITY_NOT_FOUND;
|
||||
import static com.google.android.setupcompat.util.ResultCodes.RESULT_RETRY;
|
||||
import static com.google.android.setupcompat.util.ResultCodes.RESULT_SKIP;
|
||||
@@ -85,7 +86,7 @@ public abstract class BaseSetupWizardActivity extends Activity implements Naviga
|
||||
|
||||
protected boolean mIsActivityVisible = false;
|
||||
protected boolean mIsExiting = false;
|
||||
private boolean mIsFirstRun = true;
|
||||
private final boolean mIsFirstRun = true;
|
||||
protected boolean mIsGoingBack = false;
|
||||
private boolean mIsPrimaryUser;
|
||||
protected int mResultCode = 0;
|
||||
@@ -312,7 +313,6 @@ public abstract class BaseSetupWizardActivity extends Activity implements Naviga
|
||||
tryEnablingWifi();
|
||||
}
|
||||
|
||||
|
||||
protected void exitIfSetupComplete() {
|
||||
if (WizardManagerHelper.isUserSetupComplete(this)) {
|
||||
Log.i(TAG, "Starting activity with USER_SETUP_COMPLETE=true");
|
||||
@@ -511,7 +511,6 @@ public abstract class BaseSetupWizardActivity extends Activity implements Naviga
|
||||
startActivityForResult(intent, requestCode);
|
||||
}
|
||||
|
||||
|
||||
protected boolean isFirstRun() {
|
||||
return mIsFirstRun;
|
||||
}
|
||||
|
@@ -24,7 +24,6 @@ import static org.lineageos.setupwizard.SetupWizardApp.REQUEST_CODE_SETUP_BIOMET
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||
@@ -39,7 +38,8 @@ public class BiometricActivity extends SubBaseActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
final TextView setupBiometricSummary = (TextView) findViewById(R.id.setup_biometric_summary);
|
||||
final TextView setupBiometricSummary = (TextView) findViewById(
|
||||
R.id.setup_biometric_summary);
|
||||
final TextView setupAddBiometric = (TextView) findViewById(R.id.setup_add_biometric);
|
||||
if (SetupWizardUtils.hasFace(this)) {
|
||||
setupBiometricSummary.setText(getString(R.string.face_setup_summary));
|
||||
|
@@ -37,7 +37,7 @@ public class BluetoothSetupActivity extends WrapperSubBaseActivity {
|
||||
protected void onStartSubactivity() {
|
||||
try {
|
||||
Intent intent = new Intent();
|
||||
intent.setComponent(SetupWizardUtils.mTvAddAccessorySettingsActivity);
|
||||
intent.setComponent(SetupWizardUtils.sTvAddAccessorySettingsActivity);
|
||||
intent.setAction(ACTION_CONNECT_INPUT);
|
||||
intent.putExtra(INTENT_EXTRA_NO_INPUT_MODE, true);
|
||||
startActivityForResult(intent, REQUEST_CODE_SETUP_BLUETOOTH);
|
||||
|
@@ -68,7 +68,8 @@ public class CaptivePortalSetupActivity extends WrapperSubBaseActivity {
|
||||
}
|
||||
|
||||
public static void checkForCaptivePortal(URL captivePortalUrl,
|
||||
CaptivePortalSetupActivity captivePortalSetupActivity, boolean cancelAndRecreateIfRunning) {
|
||||
CaptivePortalSetupActivity captivePortalSetupActivity,
|
||||
boolean cancelAndRecreateIfRunning) {
|
||||
if (sTask == null || sTask.getStatus() == Status.FINISHED) {
|
||||
sTask = new CheckForCaptivePortalTask(captivePortalUrl, captivePortalSetupActivity);
|
||||
sTask.execute();
|
||||
@@ -123,11 +124,16 @@ public class CaptivePortalSetupActivity extends WrapperSubBaseActivity {
|
||||
intent.putExtra(ConnectivityManager.EXTRA_CAPTIVE_PORTAL,
|
||||
new CaptivePortal(new ICaptivePortal.Stub() {
|
||||
@Override
|
||||
public void appResponse(int response) {}
|
||||
public void appResponse(int response) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logEvent(int eventId, String packageName) {}
|
||||
public void logEvent(int eventId, String packageName) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appRequest(int request) {}
|
||||
public void appRequest(int request) {
|
||||
}
|
||||
}));
|
||||
intent.putExtra("status_bar_color",
|
||||
context.getResources().getColor(R.color.primary_dark));
|
||||
@@ -135,7 +141,8 @@ public class CaptivePortalSetupActivity extends WrapperSubBaseActivity {
|
||||
R.color.primary_dark));
|
||||
intent.putExtra("progress_bar_color", context.getResources().getColor(
|
||||
R.color.accent));
|
||||
captivePortalSetupActivity.startSubactivity(intent, REQUEST_CODE_SETUP_CAPTIVE_PORTAL);
|
||||
captivePortalSetupActivity.startSubactivity(intent,
|
||||
REQUEST_CODE_SETUP_CAPTIVE_PORTAL);
|
||||
} else {
|
||||
captivePortalSetupActivity.finishAction(RESULT_OK);
|
||||
captivePortalSetupActivity.finish();
|
||||
|
@@ -25,7 +25,6 @@ import android.telephony.ServiceState;
|
||||
import android.telephony.SignalStrength;
|
||||
import android.telephony.SubscriptionInfo;
|
||||
import android.telephony.SubscriptionManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
@@ -75,14 +74,14 @@ public class ChooseDataSimActivity extends BaseSetupWizardActivity {
|
||||
}
|
||||
};
|
||||
|
||||
private View.OnClickListener mSetDataSimClickListener = view -> {
|
||||
SubscriptionInfo subInfoRecord = (SubscriptionInfo)view.getTag();
|
||||
private final View.OnClickListener mSetDataSimClickListener = view -> {
|
||||
SubscriptionInfo subInfoRecord = (SubscriptionInfo) view.getTag();
|
||||
if (subInfoRecord != null) {
|
||||
changeDataSub(subInfoRecord);
|
||||
}
|
||||
};
|
||||
|
||||
private PhoneMonitor.SubscriptionStateListener mSubscriptionStateListener =
|
||||
private final PhoneMonitor.SubscriptionStateListener mSubscriptionStateListener =
|
||||
new PhoneMonitor.SubscriptionStateListener() {
|
||||
@Override
|
||||
public void onServiceStateChanged(int subId, ServiceState serviceState) {
|
||||
@@ -204,7 +203,6 @@ public class ChooseDataSimActivity extends BaseSetupWizardActivity {
|
||||
}
|
||||
updateSignalStrengths();
|
||||
updateCurrentDataSub();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -317,11 +315,7 @@ public class ChooseDataSimActivity extends BaseSetupWizardActivity {
|
||||
if (mIsAttached) {
|
||||
for (int i = 0; i < mCheckBoxes.size(); i++) {
|
||||
int key = mCheckBoxes.keyAt(i);
|
||||
if (subInfoRecord.getSimSlotIndex() == key) {
|
||||
mCheckBoxes.get(key).setChecked(true);
|
||||
} else {
|
||||
mCheckBoxes.get(key).setChecked(false);
|
||||
}
|
||||
mCheckBoxes.get(key).setChecked(subInfoRecord.getSimSlotIndex() == key);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -355,7 +349,7 @@ public class ChooseDataSimActivity extends BaseSetupWizardActivity {
|
||||
for (int i = 0; i < mRows.size(); i++) {
|
||||
final View v = mRows.get(mRows.keyAt(i));
|
||||
v.setEnabled(enabled);
|
||||
final SubscriptionInfo subInfoRecord = (SubscriptionInfo)v.getTag();
|
||||
final SubscriptionInfo subInfoRecord = (SubscriptionInfo) v.getTag();
|
||||
if (subInfoRecord != null) {
|
||||
updateCarrierText(subInfoRecord);
|
||||
}
|
||||
@@ -455,7 +449,7 @@ public class ChooseDataSimActivity extends BaseSetupWizardActivity {
|
||||
// Some SIM cards are marketed as data-only and do not support voice service, and on
|
||||
// these SIM cards, we want to show signal bars for data service as well as the "no
|
||||
// service" or "emergency calls only" text that indicates that voice is not available.
|
||||
switch(serviceState.getVoiceRegState()) {
|
||||
switch (serviceState.getVoiceRegState()) {
|
||||
case ServiceState.STATE_POWER_OFF:
|
||||
retVal = false;
|
||||
break;
|
||||
|
@@ -29,7 +29,6 @@ import android.content.IntentFilter;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.format.DateFormat;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.DatePicker;
|
||||
@@ -66,10 +65,9 @@ public class DateTimeActivity extends BaseSetupWizardActivity implements
|
||||
private TextView mDateTextView;
|
||||
private TextView mTimeTextView;
|
||||
|
||||
|
||||
private final Handler mHandler = new Handler();
|
||||
|
||||
private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
|
||||
private final BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
updateTimeAndDateDisplay();
|
||||
@@ -88,8 +86,8 @@ public class DateTimeActivity extends BaseSetupWizardActivity implements
|
||||
dateView.setOnClickListener((view) -> showDatePicker());
|
||||
View timeView = findViewById(R.id.time_item);
|
||||
timeView.setOnClickListener((view) -> showTimePicker());
|
||||
mDateTextView = (TextView)findViewById(R.id.date_text);
|
||||
mTimeTextView = (TextView)findViewById(R.id.time_text);
|
||||
mDateTextView = (TextView) findViewById(R.id.date_text);
|
||||
mTimeTextView = (TextView) findViewById(R.id.time_text);
|
||||
// Pre-select current/default timezone
|
||||
mHandler.post(() -> {
|
||||
int tzIndex = getTimeZoneIndex(adapter, mCurrentTimeZone);
|
||||
@@ -201,8 +199,8 @@ public class DateTimeActivity extends BaseSetupWizardActivity implements
|
||||
}
|
||||
|
||||
private static SimpleAdapter constructTimezoneAdapter(Context context) {
|
||||
final String[] from = new String[] {KEY_DISPLAYNAME, KEY_GMT};
|
||||
final int[] to = new int[] {android.R.id.text1, android.R.id.text2};
|
||||
final String[] from = new String[]{KEY_DISPLAYNAME, KEY_GMT};
|
||||
final int[] to = new int[]{android.R.id.text1, android.R.id.text2};
|
||||
|
||||
final TimeZoneComparator comparator = new TimeZoneComparator(KEY_OFFSET);
|
||||
final List<Map<String, Object>> sortedList = ZoneGetter.getZonesList(context);
|
||||
@@ -220,8 +218,8 @@ public class DateTimeActivity extends BaseSetupWizardActivity implements
|
||||
final String defaultId = tz.getID();
|
||||
final int listSize = adapter.getCount();
|
||||
for (int i = 0; i < listSize; i++) {
|
||||
final Map<?,?> map = (Map<?,?>)adapter.getItem(i);
|
||||
final String id = (String)map.get(KEY_ID);
|
||||
final Map<?, ?> map = (Map<?, ?>) adapter.getItem(i);
|
||||
final String id = (String) map.get(KEY_ID);
|
||||
if (defaultId.equals(id)) {
|
||||
// If current timezone is in this list, move focus to it
|
||||
return i;
|
||||
@@ -293,7 +291,7 @@ public class DateTimeActivity extends BaseSetupWizardActivity implements
|
||||
public static class TimePickerFragment extends DialogFragment
|
||||
implements TimePickerDialog.OnTimeSetListener {
|
||||
|
||||
private static String TAG = TimePickerFragment.class.getSimpleName();
|
||||
private static final String TAG = TimePickerFragment.class.getSimpleName();
|
||||
|
||||
public static TimePickerFragment newInstance() {
|
||||
TimePickerFragment frag = new TimePickerFragment();
|
||||
@@ -302,7 +300,7 @@ public class DateTimeActivity extends BaseSetupWizardActivity implements
|
||||
|
||||
@Override
|
||||
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
|
||||
((DateTimeActivity)getActivity()).onTimeSet(view, hourOfDay, minute);
|
||||
((DateTimeActivity) getActivity()).onTimeSet(view, hourOfDay, minute);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -315,13 +313,12 @@ public class DateTimeActivity extends BaseSetupWizardActivity implements
|
||||
calendar.get(Calendar.MINUTE),
|
||||
DateFormat.is24HourFormat(getActivity()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class DatePickerFragment extends DialogFragment
|
||||
implements DatePickerDialog.OnDateSetListener {
|
||||
|
||||
private static String TAG = DatePickerFragment.class.getSimpleName();
|
||||
private static final String TAG = DatePickerFragment.class.getSimpleName();
|
||||
|
||||
public static DatePickerFragment newInstance() {
|
||||
DatePickerFragment frag = new DatePickerFragment();
|
||||
@@ -330,7 +327,7 @@ public class DateTimeActivity extends BaseSetupWizardActivity implements
|
||||
|
||||
@Override
|
||||
public void onDateSet(DatePicker view, int year, int month, int day) {
|
||||
((DateTimeActivity)getActivity()).onDateSet(view, year, month, day);
|
||||
((DateTimeActivity) getActivity()).onDateSet(view, year, month, day);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -17,6 +17,9 @@
|
||||
|
||||
package org.lineageos.setupwizard;
|
||||
|
||||
import static android.os.Binder.getCallingUserHandle;
|
||||
|
||||
import static org.lineageos.setupwizard.Manifest.permission.FINISH_SETUP;
|
||||
import static org.lineageos.setupwizard.SetupWizardApp.ACTION_SETUP_COMPLETE;
|
||||
import static org.lineageos.setupwizard.SetupWizardApp.DISABLE_NAV_KEYS;
|
||||
import static org.lineageos.setupwizard.SetupWizardApp.ENABLE_RECOVERY_UPDATE;
|
||||
@@ -35,8 +38,8 @@ import android.graphics.Bitmap;
|
||||
import android.graphics.Point;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.UserHandle;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.UserHandle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.view.View;
|
||||
import android.view.ViewAnimationUtils;
|
||||
@@ -48,9 +51,6 @@ import org.lineageos.setupwizard.util.EnableAccessibilityController;
|
||||
|
||||
import lineageos.providers.LineageSettings;
|
||||
|
||||
import static android.os.Binder.getCallingUserHandle;
|
||||
import static org.lineageos.setupwizard.Manifest.permission.FINISH_SETUP;
|
||||
|
||||
public class FinishActivity extends BaseSetupWizardActivity {
|
||||
|
||||
public static final String TAG = FinishActivity.class.getSimpleName();
|
||||
@@ -65,7 +65,6 @@ public class FinishActivity extends BaseSetupWizardActivity {
|
||||
|
||||
private volatile boolean mIsFinishing = false;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -162,10 +161,12 @@ public class FinishActivity extends BaseSetupWizardActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancel(Animator animation) {}
|
||||
public void onAnimationCancel(Animator animation) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animator animation) {}
|
||||
public void onAnimationRepeat(Animator animation) {
|
||||
}
|
||||
});
|
||||
anim.start();
|
||||
}
|
||||
@@ -191,7 +192,8 @@ public class FinishActivity extends BaseSetupWizardActivity {
|
||||
if (privacyData != null
|
||||
&& privacyData.containsKey(KEY_SEND_METRICS)) {
|
||||
LineageSettings.Secure.putInt(setupWizardApp.getContentResolver(),
|
||||
LineageSettings.Secure.STATS_COLLECTION, privacyData.getBoolean(KEY_SEND_METRICS)
|
||||
LineageSettings.Secure.STATS_COLLECTION,
|
||||
privacyData.getBoolean(KEY_SEND_METRICS)
|
||||
? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
@@ -25,7 +25,6 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.RemoteException;
|
||||
import android.os.UserHandle;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
@@ -34,16 +33,12 @@ import android.text.Spanned;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ClickableSpan;
|
||||
import android.util.Log;
|
||||
import android.view.IWindowManager;
|
||||
import android.view.View;
|
||||
import android.view.WindowManagerGlobal;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||
|
||||
import org.lineageos.setupwizard.R;
|
||||
|
||||
import lineageos.hardware.LineageHardwareManager;
|
||||
import lineageos.providers.LineageSettings;
|
||||
|
||||
@@ -60,13 +55,13 @@ public class LineageSettingsActivity extends BaseSetupWizardActivity {
|
||||
|
||||
private boolean mSupportsKeyDisabler = false;
|
||||
|
||||
private View.OnClickListener mMetricsClickListener = view -> {
|
||||
private final View.OnClickListener mMetricsClickListener = view -> {
|
||||
boolean checked = !mMetrics.isChecked();
|
||||
mMetrics.setChecked(checked);
|
||||
mSetupWizardApp.getSettingsBundle().putBoolean(KEY_SEND_METRICS, checked);
|
||||
};
|
||||
|
||||
private View.OnClickListener mNavKeysClickListener = view -> {
|
||||
private final View.OnClickListener mNavKeysClickListener = view -> {
|
||||
boolean checked = !mNavKeys.isChecked();
|
||||
mNavKeys.setChecked(checked);
|
||||
mSetupWizardApp.getSettingsBundle().putBoolean(DISABLE_NAV_KEYS, checked);
|
||||
|
@@ -39,7 +39,6 @@ import com.android.internal.telephony.util.LocaleUtils;
|
||||
|
||||
import com.google.android.setupcompat.util.SystemBarHelper;
|
||||
|
||||
import org.lineageos.setupwizard.R;
|
||||
import org.lineageos.setupwizard.widget.LocalePicker;
|
||||
|
||||
import java.util.List;
|
||||
@@ -76,7 +75,6 @@ public class LocaleActivity extends BaseSetupWizardActivity {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -130,8 +128,8 @@ public class LocaleActivity extends BaseSetupWizardActivity {
|
||||
fetchAndUpdateSimLocale();
|
||||
mAdapterIndices = new int[mLocaleAdapter.getCount()];
|
||||
int currentLocaleIndex = 0;
|
||||
String [] labels = new String[mLocaleAdapter.getCount()];
|
||||
for (int i=0; i<mAdapterIndices.length; i++) {
|
||||
String[] labels = new String[mLocaleAdapter.getCount()];
|
||||
for (int i = 0; i < mAdapterIndices.length; i++) {
|
||||
com.android.internal.app.LocalePicker.LocaleInfo localLocaleInfo =
|
||||
mLocaleAdapter.getItem(i);
|
||||
Locale localLocale = localLocaleInfo.getLocale();
|
||||
@@ -149,13 +147,13 @@ public class LocaleActivity extends BaseSetupWizardActivity {
|
||||
|
||||
mLanguagePicker.setOnScrollListener((view, scrollState) -> {
|
||||
if (scrollState == NumberPicker.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {
|
||||
((SetupWizardApp)getApplication()).setIgnoreSimLocale(true);
|
||||
((SetupWizardApp) getApplication()).setIgnoreSimLocale(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setLocaleFromPicker() {
|
||||
((SetupWizardApp)getApplication()).setIgnoreSimLocale(true);
|
||||
((SetupWizardApp) getApplication()).setIgnoreSimLocale(true);
|
||||
int i = mAdapterIndices[mLanguagePicker.getValue()];
|
||||
final com.android.internal.app.LocalePicker.LocaleInfo localLocaleInfo =
|
||||
mLocaleAdapter.getItem(i);
|
||||
@@ -176,7 +174,7 @@ public class LocaleActivity extends BaseSetupWizardActivity {
|
||||
}
|
||||
|
||||
private void fetchAndUpdateSimLocale() {
|
||||
if (((SetupWizardApp)getApplication()).ignoreSimLocale() || isDestroyed()) {
|
||||
if (((SetupWizardApp) getApplication()).ignoreSimLocale() || isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
if (mPaused) {
|
||||
@@ -200,7 +198,7 @@ public class LocaleActivity extends BaseSetupWizardActivity {
|
||||
TelephonyManager telephonyManager = (TelephonyManager)
|
||||
activity.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
int state = telephonyManager.getSimState();
|
||||
if(state == TelephonyManager.SIM_STATE_PIN_REQUIRED ||
|
||||
if (state == TelephonyManager.SIM_STATE_PIN_REQUIRED ||
|
||||
state == TelephonyManager.SIM_STATE_PUK_REQUIRED) {
|
||||
return null;
|
||||
}
|
||||
@@ -233,12 +231,12 @@ public class LocaleActivity extends BaseSetupWizardActivity {
|
||||
@Override
|
||||
protected void onPostExecute(Locale simLocale) {
|
||||
if (simLocale != null && !simLocale.equals(mCurrentLocale)) {
|
||||
if (!((SetupWizardApp)getApplication()).ignoreSimLocale() && !isDestroyed()) {
|
||||
if (!((SetupWizardApp) getApplication()).ignoreSimLocale() && !isDestroyed()) {
|
||||
String label = getString(R.string.sim_locale_changed,
|
||||
simLocale.getDisplayName());
|
||||
Toast.makeText(LocaleActivity.this, label, Toast.LENGTH_SHORT).show();
|
||||
onLocaleChanged(simLocale);
|
||||
((SetupWizardApp)getApplication()).setIgnoreSimLocale(true);
|
||||
((SetupWizardApp) getApplication()).setIgnoreSimLocale(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -22,9 +22,6 @@ import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.lineageos.setupwizard.util.SetupWizardUtils;
|
||||
|
||||
public class LocationSettingsActivity extends BaseSetupWizardActivity {
|
||||
|
||||
|
@@ -64,7 +64,7 @@ public class MobileDataActivity extends BaseSetupWizardActivity {
|
||||
|
||||
private final Runnable mDataConnectionReadyRunnable = this::onDataStateReady;
|
||||
|
||||
private PhoneMonitor.SubscriptionStateListener mSubscriptionStateListener =
|
||||
private final PhoneMonitor.SubscriptionStateListener mSubscriptionStateListener =
|
||||
new PhoneMonitor.SubscriptionStateListener() {
|
||||
@Override
|
||||
public void onServiceStateChanged(int subId, ServiceState serviceState) {
|
||||
@@ -95,11 +95,13 @@ public class MobileDataActivity extends BaseSetupWizardActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDefaultDataSubscriptionChanged(int subId) {}
|
||||
public void onDefaultDataSubscriptionChanged(int subId) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDefaultDataSubscriptionChangeRequested(int currentSubId,
|
||||
int newSubId) {}
|
||||
int newSubId) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSignalStrengthsChanged(int subId, SignalStrength signalStrength) {
|
||||
@@ -124,7 +126,7 @@ public class MobileDataActivity extends BaseSetupWizardActivity {
|
||||
}
|
||||
};
|
||||
|
||||
private View.OnClickListener mEnableDataClickListener = new View.OnClickListener() {
|
||||
private final View.OnClickListener mEnableDataClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
boolean checked = !mEnableMobileData.isChecked();
|
||||
@@ -153,10 +155,8 @@ public class MobileDataActivity extends BaseSetupWizardActivity {
|
||||
mNameView = (TextView) findViewById(R.id.enable_data_title);
|
||||
updateDataConnectionStatus();
|
||||
updateSignalStrength();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
@@ -283,7 +283,7 @@ public class MobileDataActivity extends BaseSetupWizardActivity {
|
||||
// Some SIM cards are marketed as data-only and do not support voice service, and on
|
||||
// these SIM cards, we want to show signal bars for data service as well as the "no
|
||||
// service" or "emergency calls only" text that indicates that voice is not available.
|
||||
switch(mServiceState.getVoiceRegState()) {
|
||||
switch (mServiceState.getVoiceRegState()) {
|
||||
case ServiceState.STATE_POWER_OFF:
|
||||
retVal = false;
|
||||
break;
|
||||
|
@@ -1,5 +1,3 @@
|
||||
package org.lineageos.setupwizard;
|
||||
|
||||
/*
|
||||
* Copyright (C) 2016 The CyanogenMod Project
|
||||
*
|
||||
@@ -16,6 +14,8 @@ package org.lineageos.setupwizard;
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.lineageos.setupwizard;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
@@ -55,7 +55,8 @@ public class SetupWizardActivity extends BaseSetupWizardActivity {
|
||||
if (isPrimaryUser()) {
|
||||
intent.putExtra(EXTRA_SCRIPT_URI, getString(R.string.lineage_wizard_script_uri));
|
||||
} else {
|
||||
intent.putExtra(EXTRA_SCRIPT_URI, getString(R.string.lineage_wizard_script_user_uri));
|
||||
intent.putExtra(EXTRA_SCRIPT_URI,
|
||||
getString(R.string.lineage_wizard_script_user_uri));
|
||||
}
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | FLAG_GRANT_READ_URI_PERMISSION);
|
||||
startActivity(intent);
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
package org.lineageos.setupwizard;
|
||||
|
||||
|
||||
import android.app.Application;
|
||||
import android.app.StatusBarManager;
|
||||
import android.os.Bundle;
|
||||
@@ -31,19 +30,19 @@ import org.lineageos.setupwizard.util.SetupWizardUtils;
|
||||
public class SetupWizardApp extends Application {
|
||||
|
||||
public static final String TAG = SetupWizardApp.class.getSimpleName();
|
||||
// Leave this off for release
|
||||
public static final boolean DEBUG = false;
|
||||
/* Verbose Logging */
|
||||
// Verbose logging
|
||||
public static final boolean LOGV = Log.isLoggable(TAG, Log.VERBOSE);
|
||||
|
||||
public static final String ACTION_ACCESSIBILITY_SETTINGS =
|
||||
"android.settings.ACCESSIBILITY_SETTINGS_FOR_SUW";
|
||||
public static final String ACTION_SETUP_COMPLETE = "org.lineageos.setupwizard.LINEAGE_SETUP_COMPLETE";
|
||||
public static final String ACTION_SETUP_COMPLETE =
|
||||
"org.lineageos.setupwizard.LINEAGE_SETUP_COMPLETE";
|
||||
public static final String ACTION_FINISHED = "org.lineageos.setupwizard.SETUP_FINISHED";
|
||||
public static final String ACTION_SETUP_WIFI = "android.net.wifi.PICK_WIFI_NETWORK";
|
||||
public static final String ACTION_SETUP_BIOMETRIC = "android.settings.BIOMETRIC_ENROLL";
|
||||
public static final String ACTION_SETUP_LOCKSCREEN = "com.android.settings.SETUP_LOCK_SCREEN";
|
||||
public static final String ACTION_RESTORE_FROM_BACKUP = "com.stevesoltys.seedvault.RESTORE_BACKUP";
|
||||
public static final String ACTION_RESTORE_FROM_BACKUP =
|
||||
"com.stevesoltys.seedvault.RESTORE_BACKUP";
|
||||
public static final String ACTION_EMERGENCY_DIAL = "com.android.phone.EmergencyDialer.DIAL";
|
||||
public static final String ACTION_NEXT = "com.android.wizard.NEXT";
|
||||
public static final String ACTION_LOAD = "com.android.wizard.LOAD";
|
||||
@@ -64,8 +63,8 @@ public class SetupWizardApp extends Application {
|
||||
public static final String UPDATE_RECOVERY_PROP = "persist.vendor.recovery_update";
|
||||
|
||||
public static final int REQUEST_CODE_SETUP_WIFI = 0;
|
||||
public static final int REQUEST_CODE_SETUP_CAPTIVE_PORTAL= 4;
|
||||
public static final int REQUEST_CODE_SETUP_BLUETOOTH= 5;
|
||||
public static final int REQUEST_CODE_SETUP_CAPTIVE_PORTAL = 4;
|
||||
public static final int REQUEST_CODE_SETUP_BLUETOOTH = 5;
|
||||
public static final int REQUEST_CODE_SETUP_BIOMETRIC = 7;
|
||||
public static final int REQUEST_CODE_SETUP_LOCKSCREEN = 9;
|
||||
public static final int REQUEST_CODE_RESTORE = 10;
|
||||
|
@@ -53,7 +53,7 @@ public class SetupWizardExitActivity extends BaseSetupWizardActivity {
|
||||
private void launchHome() {
|
||||
startActivity(new Intent("android.intent.action.MAIN")
|
||||
.addCategory("android.intent.category.HOME")
|
||||
.addFlags(FLAG_ACTIVITY_NEW_TASK|FLAG_ACTIVITY_CLEAR_TASK));
|
||||
.addFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.lineageos.setupwizard;
|
||||
|
||||
|
||||
import static org.lineageos.setupwizard.SetupWizardApp.LOGV;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
|
@@ -44,7 +44,7 @@ public class SimMissingActivity extends BaseSetupWizardActivity {
|
||||
}
|
||||
final int simLocation = getResources().getInteger(
|
||||
R.integer.sim_image_type);
|
||||
ImageView simLogo = ((ImageView)findViewById(R.id.sim_slot_image));
|
||||
ImageView simLogo = ((ImageView) findViewById(R.id.sim_slot_image));
|
||||
switch (simLocation) {
|
||||
case SIM_SIDE:
|
||||
simLogo.setImageResource(R.drawable.sim_side);
|
||||
|
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.lineageos.setupwizard;
|
||||
|
||||
|
||||
import static android.content.Intent.FLAG_ACTIVITY_FORWARD_RESULT;
|
||||
|
||||
import static com.google.android.setupcompat.util.ResultCodes.RESULT_ACTIVITY_NOT_FOUND;
|
||||
|
@@ -28,8 +28,8 @@ import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
|
||||
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||
import org.lineageos.setupwizard.util.SetupWizardUtils;
|
||||
|
||||
import org.lineageos.setupwizard.util.SetupWizardUtils;
|
||||
|
||||
public class UpdateRecoveryActivity extends BaseSetupWizardActivity {
|
||||
|
||||
|
@@ -52,7 +52,8 @@ public class WelcomeActivity extends BaseSetupWizardActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {}
|
||||
public void onBackPressed() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutResId() {
|
||||
|
@@ -30,13 +30,12 @@ public class WifiSetupActivity extends WrapperSubBaseActivity {
|
||||
|
||||
public static final String TAG = WifiSetupActivity.class.getSimpleName();
|
||||
|
||||
|
||||
@Override
|
||||
protected void onStartSubactivity() {
|
||||
tryEnablingWifi();
|
||||
Intent intent = new Intent(ACTION_SETUP_WIFI);
|
||||
if (SetupWizardUtils.hasLeanback(this)) {
|
||||
intent.setComponent(SetupWizardUtils.mTvwifisettingsActivity);
|
||||
intent.setComponent(SetupWizardUtils.sTvWifiSetupSettingsActivity);
|
||||
}
|
||||
intent.putExtra(EXTRA_PREFS_SHOW_BUTTON_BAR, true);
|
||||
intent.putExtra(EXTRA_PREFS_SET_BACK_TEXT, (String) null);
|
||||
|
@@ -17,6 +17,9 @@
|
||||
|
||||
package org.lineageos.setupwizard.backup;
|
||||
|
||||
import static org.lineageos.setupwizard.SetupWizardApp.ACTION_RESTORE_FROM_BACKUP;
|
||||
import static org.lineageos.setupwizard.SetupWizardApp.REQUEST_CODE_RESTORE;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
|
||||
@@ -26,9 +29,6 @@ import org.lineageos.setupwizard.NavigationLayout;
|
||||
import org.lineageos.setupwizard.R;
|
||||
import org.lineageos.setupwizard.SubBaseActivity;
|
||||
|
||||
import static org.lineageos.setupwizard.SetupWizardApp.ACTION_RESTORE_FROM_BACKUP;
|
||||
import static org.lineageos.setupwizard.SetupWizardApp.REQUEST_CODE_RESTORE;
|
||||
|
||||
public class RestoreIntroActivity extends SubBaseActivity {
|
||||
|
||||
@Override
|
||||
|
@@ -61,17 +61,20 @@ public class EnableAccessibilityController {
|
||||
// TODO: Fix these or remove these
|
||||
//String text = mContext.getString(R.string.continue_to_enable_accessibility);
|
||||
//mTts.speak(text, TextToSpeech.QUEUE_FLUSH, null);
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
case MESSAGE_SPEAK_ENABLE_CANCELED: {
|
||||
//String text = mContext.getString(R.string.enable_accessibility_canceled);
|
||||
//mTts.speak(text, TextToSpeech.QUEUE_FLUSH, null);
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
case MESSAGE_ENABLE_ACCESSIBILITY: {
|
||||
enableAccessibility();
|
||||
//mTone.play();
|
||||
//mTts.speak(mContext.getString(R.string.accessibility_enabled),
|
||||
// TextToSpeech.QUEUE_FLUSH, null);
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -82,7 +85,6 @@ public class EnableAccessibilityController {
|
||||
private final IAccessibilityManager mAccessibilityManager = IAccessibilityManager
|
||||
.Stub.asInterface(ServiceManager.getService("accessibility"));
|
||||
|
||||
|
||||
private final Context mContext;
|
||||
private final UserManager mUserManager;
|
||||
private final TextToSpeech mTts;
|
||||
|
@@ -106,7 +106,7 @@ public class NetworkMonitor {
|
||||
ConnectivityManager cm = context.getSystemService(ConnectivityManager.class);
|
||||
if (cm != null) {
|
||||
NetworkInfo ni = cm.getActiveNetworkInfo();
|
||||
boolean isConnected = ni != null ? ni.isConnected() : false;
|
||||
boolean isConnected = ni != null && ni.isConnected();
|
||||
if (isConnected && !mNetworkConnected) {
|
||||
onNetworkConnected(ni);
|
||||
} else if (!isConnected && mNetworkConnected) {
|
||||
|
@@ -77,15 +77,15 @@ public class PhoneMonitor {
|
||||
public static final String TAG = PhoneMonitor.class.getSimpleName();
|
||||
|
||||
private static PhoneMonitor sInstance;
|
||||
private Context mContext;
|
||||
private TelephonyManager mTelephony;
|
||||
private final Context mContext;
|
||||
private final TelephonyManager mTelephony;
|
||||
private SubscriptionManager mSubscriptionManager;
|
||||
private ArrayList<SubscriptionStateListener> mListeners = new ArrayList<>();
|
||||
private SparseArray<SubscriptionStateTracker> mTrackers = new SparseArray<>();
|
||||
private final ArrayList<SubscriptionStateListener> mListeners = new ArrayList<>();
|
||||
private final SparseArray<SubscriptionStateTracker> mTrackers = new SparseArray<>();
|
||||
|
||||
private int mChangingToDataSubId = -1;
|
||||
|
||||
private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
|
||||
private final BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (intent.getAction().equals(TelephonyIntents.ACTION_SIM_STATE_CHANGED)) {
|
||||
@@ -489,10 +489,15 @@ public class PhoneMonitor {
|
||||
|
||||
public interface SubscriptionStateListener {
|
||||
void onServiceStateChanged(int subId, ServiceState serviceState);
|
||||
|
||||
void onDataConnectionStateChanged(int subId, int state, int networkType);
|
||||
|
||||
void onDefaultDataSubscriptionChanged(int subId);
|
||||
|
||||
void onDefaultDataSubscriptionChangeRequested(int currentSubId, int newSubId);
|
||||
|
||||
void onSignalStrengthsChanged(int subId, SignalStrength signalStrength);
|
||||
|
||||
void onSimStateChanged(int subId, int simState);
|
||||
}
|
||||
|
||||
|
@@ -34,36 +34,34 @@ import android.content.ComponentName;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.ComponentInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ServiceInfo;
|
||||
import android.content.res.Resources;
|
||||
import android.hardware.face.FaceManager;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.os.Binder;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.UserHandle;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.provider.Settings;
|
||||
import android.telephony.ServiceState;
|
||||
import android.telephony.SubscriptionManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.Log;
|
||||
|
||||
import org.lineageos.internal.util.PackageManagerUtils;
|
||||
import org.lineageos.setupwizard.BiometricActivity;
|
||||
import org.lineageos.setupwizard.BluetoothSetupActivity;
|
||||
import org.lineageos.setupwizard.ChooseDataSimActivity;
|
||||
import org.lineageos.setupwizard.BiometricActivity;
|
||||
import org.lineageos.setupwizard.MobileDataActivity;
|
||||
import org.lineageos.setupwizard.SetupWizardApp;
|
||||
import org.lineageos.setupwizard.SimMissingActivity;
|
||||
import org.lineageos.setupwizard.UpdateRecoveryActivity;
|
||||
import org.lineageos.setupwizard.WifiSetupActivity;
|
||||
import org.lineageos.setupwizard.wizardmanager.WizardManager;
|
||||
|
||||
import org.lineageos.internal.util.PackageManagerUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -81,7 +79,8 @@ public class SetupWizardUtils {
|
||||
private static final String CONFIG_HIDE_RECOVERY_UPDATE = "config_hideRecoveryUpdate";
|
||||
private static final String PROP_BUILD_DATE = "ro.build.date.utc";
|
||||
|
||||
private SetupWizardUtils(){}
|
||||
private SetupWizardUtils() {
|
||||
}
|
||||
|
||||
public static SharedPreferences getPrefs(Context context) {
|
||||
return context.getSharedPreferences("SetupWizardPrefs", MODE_PRIVATE);
|
||||
@@ -134,12 +133,13 @@ public class SetupWizardUtils {
|
||||
int res = updaterResources.getIdentifier(
|
||||
CONFIG_HIDE_RECOVERY_UPDATE, "bool", UPDATER_PACKAGE);
|
||||
featureHidden = updaterResources.getBoolean(res);
|
||||
} catch (PackageManager.NameNotFoundException | Resources.NotFoundException ignored) { }
|
||||
} catch (PackageManager.NameNotFoundException | Resources.NotFoundException ignored) {
|
||||
}
|
||||
return !featureHidden;
|
||||
}
|
||||
|
||||
public static boolean isRadioReady(Context context, ServiceState state) {
|
||||
final SetupWizardApp setupWizardApp = (SetupWizardApp)context.getApplicationContext();
|
||||
final SetupWizardApp setupWizardApp = (SetupWizardApp) context.getApplicationContext();
|
||||
if (setupWizardApp.isRadioReady()) {
|
||||
return true;
|
||||
} else {
|
||||
@@ -148,7 +148,6 @@ public class SetupWizardUtils {
|
||||
setupWizardApp.setRadioReady(ready);
|
||||
return ready;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static boolean isOwner() {
|
||||
@@ -307,8 +306,7 @@ public class SetupWizardUtils {
|
||||
if (!isMultiSimDevice() || singleSimInserted()) {
|
||||
disableComponent(context, ChooseDataSimActivity.class);
|
||||
}
|
||||
if (!SetupWizardUtils.hasWifi(context) ||
|
||||
isEthernetConnected(context)) {
|
||||
if (!hasWifi(context) || isEthernetConnected(context)) {
|
||||
disableComponent(context, WifiSetupActivity.class);
|
||||
}
|
||||
}
|
||||
@@ -327,7 +325,7 @@ public class SetupWizardUtils {
|
||||
intent.addCategory("android.intent.category.HOME");
|
||||
intent.setPackage(context.getPackageName());
|
||||
ComponentName comp = intent.resolveActivity(context.getPackageManager());
|
||||
if (SetupWizardApp.LOGV) {
|
||||
if (LOGV) {
|
||||
Log.v(TAG, "resolveActivity for intent=" + intent + " returns " + comp);
|
||||
}
|
||||
return comp;
|
||||
@@ -358,7 +356,6 @@ public class SetupWizardUtils {
|
||||
COMPONENT_ENABLED_STATE_DEFAULT);
|
||||
}
|
||||
|
||||
|
||||
public static void setComponentEnabledState(Context context, ComponentName componentName,
|
||||
int enabledState) {
|
||||
context.getPackageManager().setComponentEnabledSetting(componentName,
|
||||
@@ -403,12 +400,11 @@ public class SetupWizardUtils {
|
||||
return componentNames;
|
||||
}
|
||||
|
||||
|
||||
public static final ComponentName mTvwifisettingsActivity =
|
||||
public static final ComponentName sTvWifiSetupSettingsActivity =
|
||||
new ComponentName("com.android.tv.settings",
|
||||
"com.android.tv.settings.connectivity.setup.WifiSetupActivity");
|
||||
|
||||
public static final ComponentName mTvAddAccessorySettingsActivity =
|
||||
public static final ComponentName sTvAddAccessorySettingsActivity =
|
||||
new ComponentName("com.android.tv.settings",
|
||||
"com.android.tv.settings.accessories.AddAccessoryActivity");
|
||||
|
||||
|
@@ -16,8 +16,6 @@
|
||||
|
||||
package org.lineageos.setupwizard.widget;
|
||||
|
||||
import org.lineageos.setupwizard.R;
|
||||
|
||||
import android.annotation.Widget;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
@@ -57,17 +55,18 @@ import android.widget.LinearLayout;
|
||||
import android.widget.Scroller;
|
||||
import android.widget.TextView;
|
||||
|
||||
import libcore.icu.LocaleData;
|
||||
|
||||
import org.lineageos.setupwizard.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import libcore.icu.LocaleData;
|
||||
|
||||
/**
|
||||
* A widget that enables the user to select a number form a predefined range.
|
||||
* There are two flavors of this widget and which one is presented to the user
|
||||
* depends on the current theme.
|
||||
* A widget that enables the user to select a number form a predefined range. There are two flavors
|
||||
* of this widget and which one is presented to the user depends on the current theme.
|
||||
* <ul>
|
||||
* <li>
|
||||
* If the current theme is derived from {@link android.R.style#Theme} the widget
|
||||
@@ -152,10 +151,9 @@ public class LocalePicker extends LinearLayout {
|
||||
private static final int SIZE_UNSPECIFIED = -1;
|
||||
|
||||
/**
|
||||
* Use a custom NumberPicker formatting callback to use two-digit minutes
|
||||
* strings like "01". Keeping a static formatter etc. is the most efficient
|
||||
* way to do this; it avoids creating temporary objects on every call to
|
||||
* format().
|
||||
* Use a custom NumberPicker formatting callback to use two-digit minutes strings like "01".
|
||||
* Keeping a static formatter etc. is the most efficient way to do this; it avoids creating
|
||||
* temporary objects on every call to format().
|
||||
*/
|
||||
private static class TwoDigitFormatter implements LocalePicker.Formatter {
|
||||
final StringBuilder mBuilder = new StringBuilder();
|
||||
@@ -315,7 +313,8 @@ public class LocalePicker extends LinearLayout {
|
||||
private final Paint mSelectorWheelPaint;
|
||||
|
||||
/**
|
||||
* The {@link android.graphics.drawable.Drawable} for pressed virtual (increment/decrement) buttons.
|
||||
* The {@link android.graphics.drawable.Drawable} for pressed virtual (increment/decrement)
|
||||
* buttons.
|
||||
*/
|
||||
private final Drawable mVirtualButtonPressedDrawable;
|
||||
|
||||
@@ -355,8 +354,7 @@ public class LocalePicker extends LinearLayout {
|
||||
private SetSelectionCommand mSetSelectionCommand;
|
||||
|
||||
/**
|
||||
* Handle to the reusable command for changing the current value from long
|
||||
* press by one.
|
||||
* Handle to the reusable command for changing the current value from long press by one.
|
||||
*/
|
||||
private ChangeCurrentByOneFromLongPressCommand mChangeCurrentByOneFromLongPressCommand;
|
||||
|
||||
@@ -388,17 +386,17 @@ public class LocalePicker extends LinearLayout {
|
||||
/**
|
||||
* @see android.view.ViewConfiguration#getScaledTouchSlop()
|
||||
*/
|
||||
private int mTouchSlop;
|
||||
private final int mTouchSlop;
|
||||
|
||||
/**
|
||||
* @see android.view.ViewConfiguration#getScaledMinimumFlingVelocity()
|
||||
*/
|
||||
private int mMinimumFlingVelocity;
|
||||
private final int mMinimumFlingVelocity;
|
||||
|
||||
/**
|
||||
* @see android.view.ViewConfiguration#getScaledMaximumFlingVelocity()
|
||||
*/
|
||||
private int mMaximumFlingVelocity;
|
||||
private final int mMaximumFlingVelocity;
|
||||
|
||||
/**
|
||||
* Flag whether the selector should wrap around.
|
||||
@@ -431,8 +429,8 @@ public class LocalePicker extends LinearLayout {
|
||||
private int mScrollState = OnScrollListener.SCROLL_STATE_IDLE;
|
||||
|
||||
/**
|
||||
* Flag whether to ignore move events - we ignore such when we show in IME
|
||||
* to prevent the content from scrolling.
|
||||
* Flag whether to ignore move events - we ignore such when we show in IME to prevent the
|
||||
* content from scrolling.
|
||||
*/
|
||||
private boolean mIngonreMoveEvents;
|
||||
|
||||
@@ -504,28 +502,26 @@ public class LocalePicker extends LinearLayout {
|
||||
/**
|
||||
* The view is not scrolling.
|
||||
*/
|
||||
public static int SCROLL_STATE_IDLE = 0;
|
||||
int SCROLL_STATE_IDLE = 0;
|
||||
|
||||
/**
|
||||
* The user is scrolling using touch, and his finger is still on the screen.
|
||||
*/
|
||||
public static int SCROLL_STATE_TOUCH_SCROLL = 1;
|
||||
int SCROLL_STATE_TOUCH_SCROLL = 1;
|
||||
|
||||
/**
|
||||
* The user had previously been scrolling using touch and performed a fling.
|
||||
*/
|
||||
public static int SCROLL_STATE_FLING = 2;
|
||||
int SCROLL_STATE_FLING = 2;
|
||||
|
||||
/**
|
||||
* Callback invoked while the number picker scroll state has changed.
|
||||
*
|
||||
* @param view The view whose scroll state is being reported.
|
||||
* @param scrollState The current scroll state. One of
|
||||
* {@link #SCROLL_STATE_IDLE},
|
||||
* {@link #SCROLL_STATE_TOUCH_SCROLL} or
|
||||
* {@link #SCROLL_STATE_IDLE}.
|
||||
* @param scrollState The current scroll state. One of {@link #SCROLL_STATE_IDLE}, {@link
|
||||
* #SCROLL_STATE_TOUCH_SCROLL} or {@link #SCROLL_STATE_IDLE}.
|
||||
*/
|
||||
public void onScrollStateChange(LocalePicker view, int scrollState);
|
||||
void onScrollStateChange(LocalePicker view, int scrollState);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -539,7 +535,7 @@ public class LocalePicker extends LinearLayout {
|
||||
* @param value The currently selected value.
|
||||
* @return A formatted string representation.
|
||||
*/
|
||||
public String format(int value);
|
||||
String format(int value);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -571,8 +567,9 @@ public class LocalePicker extends LinearLayout {
|
||||
public LocalePicker(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
sSelectorWheelItemCount = context.getResources().getInteger(R.integer.local_picker_items);
|
||||
sSelectorMiddleItemIndex = context.getResources().getInteger(R.integer.local_picker_items)/2;
|
||||
mSelectorIndices= new int[sSelectorWheelItemCount];
|
||||
sSelectorMiddleItemIndex = context.getResources().getInteger(R.integer.local_picker_items)
|
||||
/ 2;
|
||||
mSelectorIndices = new int[sSelectorWheelItemCount];
|
||||
// process style attributes
|
||||
TypedArray attributesArray = context.obtainStyledAttributes(
|
||||
attrs, R.styleable.LocalePicker, defStyle, 0);
|
||||
@@ -641,11 +638,7 @@ public class LocalePicker extends LinearLayout {
|
||||
public void onClick(View v) {
|
||||
hideSoftInput();
|
||||
mInputText.clearFocus();
|
||||
if (v.getId() == R.id.lp__increment) {
|
||||
changeValueByOne(true);
|
||||
} else {
|
||||
changeValueByOne(false);
|
||||
}
|
||||
changeValueByOne(v.getId() == R.id.lp__increment);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -653,11 +646,7 @@ public class LocalePicker extends LinearLayout {
|
||||
public boolean onLongClick(View v) {
|
||||
hideSoftInput();
|
||||
mInputText.clearFocus();
|
||||
if (v.getId() == R.id.lp__increment) {
|
||||
postChangeCurrentByOneFromLongPress(true, 0);
|
||||
} else {
|
||||
postChangeCurrentByOneFromLongPress(false, 0);
|
||||
}
|
||||
postChangeCurrentByOneFromLongPress(v.getId() == R.id.lp__increment, 0);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -692,7 +681,7 @@ public class LocalePicker extends LinearLayout {
|
||||
}
|
||||
}
|
||||
});
|
||||
mInputText.setFilters(new InputFilter[] {
|
||||
mInputText.setFilters(new InputFilter[]{
|
||||
new InputTextFilter()
|
||||
});
|
||||
|
||||
@@ -778,9 +767,9 @@ public class LocalePicker extends LinearLayout {
|
||||
}
|
||||
|
||||
/**
|
||||
* Move to the final position of a scroller. Ensures to force finish the scroller
|
||||
* and if it is not at its final position a scroll of the selector wheel is
|
||||
* performed to fast forward to the final position.
|
||||
* Move to the final position of a scroller. Ensures to force finish the scroller and if it is
|
||||
* not at its final position a scroll of the selector wheel is performed to fast forward to the
|
||||
* final position.
|
||||
*
|
||||
* @param scroller The scroller to whose final position to get.
|
||||
* @return True of the a move was performed, i.e. the scroller was not in final position.
|
||||
@@ -886,7 +875,8 @@ public class LocalePicker extends LinearLayout {
|
||||
invalidate();
|
||||
}
|
||||
mLastDownOrMoveEventY = currentMoveY;
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_UP: {
|
||||
removeBeginSoftInputCommand();
|
||||
removeChangeCurrentByOneFromLongPress();
|
||||
@@ -925,7 +915,8 @@ public class LocalePicker extends LinearLayout {
|
||||
}
|
||||
mVelocityTracker.recycle();
|
||||
mVelocityTracker = null;
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1016,7 +1007,8 @@ public class LocalePicker extends LinearLayout {
|
||||
mLastHoveredChildVirtualViewId = hoveredVirtualViewId;
|
||||
provider.performAction(hoveredVirtualViewId,
|
||||
AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS, null);
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_HOVER_MOVE: {
|
||||
if (mLastHoveredChildVirtualViewId != hoveredVirtualViewId
|
||||
&& mLastHoveredChildVirtualViewId != View.NO_ID) {
|
||||
@@ -1029,12 +1021,14 @@ public class LocalePicker extends LinearLayout {
|
||||
provider.performAction(hoveredVirtualViewId,
|
||||
AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS, null);
|
||||
}
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_HOVER_EXIT: {
|
||||
provider.sendAccessibilityEventForVirtualView(hoveredVirtualViewId,
|
||||
AccessibilityEvent.TYPE_VIEW_HOVER_EXIT);
|
||||
mLastHoveredChildVirtualViewId = View.NO_ID;
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -1133,13 +1127,13 @@ public class LocalePicker extends LinearLayout {
|
||||
/**
|
||||
* Set the formatter to be used for formatting the current value.
|
||||
* <p>
|
||||
* Note: If you have provided alternative values for the values this
|
||||
* formatter is never invoked.
|
||||
* Note: If you have provided alternative values for the values this formatter is never
|
||||
* invoked.
|
||||
* </p>
|
||||
*
|
||||
* @param formatter The formatter object. If formatter is <code>null</code>,
|
||||
* {@link String#valueOf(int)} will be used.
|
||||
*@see #setDisplayedValues(String[])
|
||||
* @param formatter The formatter object. If formatter is <code>null</code>, {@link
|
||||
* String#valueOf(int)} will be used.
|
||||
* @see #setDisplayedValues(String[])
|
||||
*/
|
||||
public void setFormatter(Formatter formatter) {
|
||||
if (formatter == mFormatter) {
|
||||
@@ -1153,24 +1147,24 @@ public class LocalePicker extends LinearLayout {
|
||||
/**
|
||||
* Set the current value for the number picker.
|
||||
* <p>
|
||||
* If the argument is less than the {@link LocalePicker#getMinValue()} and
|
||||
* {@link LocalePicker#getWrapSelectorWheel()} is <code>false</code> the
|
||||
* current value is set to the {@link LocalePicker#getMinValue()} value.
|
||||
* If the argument is less than the {@link LocalePicker#getMinValue()} and {@link
|
||||
* LocalePicker#getWrapSelectorWheel()} is <code>false</code> the current value is set to the
|
||||
* {@link LocalePicker#getMinValue()} value.
|
||||
* </p>
|
||||
* <p>
|
||||
* If the argument is less than the {@link LocalePicker#getMinValue()} and
|
||||
* {@link LocalePicker#getWrapSelectorWheel()} is <code>true</code> the
|
||||
* current value is set to the {@link LocalePicker#getMaxValue()} value.
|
||||
* If the argument is less than the {@link LocalePicker#getMinValue()} and {@link
|
||||
* LocalePicker#getWrapSelectorWheel()} is <code>true</code> the current value is set to the
|
||||
* {@link LocalePicker#getMaxValue()} value.
|
||||
* </p>
|
||||
* <p>
|
||||
* If the argument is less than the {@link LocalePicker#getMaxValue()} and
|
||||
* {@link LocalePicker#getWrapSelectorWheel()} is <code>false</code> the
|
||||
* current value is set to the {@link LocalePicker#getMaxValue()} value.
|
||||
* If the argument is less than the {@link LocalePicker#getMaxValue()} and {@link
|
||||
* LocalePicker#getWrapSelectorWheel()} is <code>false</code> the current value is set to the
|
||||
* {@link LocalePicker#getMaxValue()} value.
|
||||
* </p>
|
||||
* <p>
|
||||
* If the argument is less than the {@link LocalePicker#getMaxValue()} and
|
||||
* {@link LocalePicker#getWrapSelectorWheel()} is <code>true</code> the
|
||||
* current value is set to the {@link LocalePicker#getMinValue()} value.
|
||||
* If the argument is less than the {@link LocalePicker#getMaxValue()} and {@link
|
||||
* LocalePicker#getWrapSelectorWheel()} is <code>true</code> the current value is set to the
|
||||
* {@link LocalePicker#getMinValue()} value.
|
||||
* </p>
|
||||
*
|
||||
* @param value The current value.
|
||||
@@ -1256,7 +1250,6 @@ public class LocalePicker extends LinearLayout {
|
||||
* Gets whether the selector wheel wraps when reaching the min/max value.
|
||||
*
|
||||
* @return True if the selector wheel wraps.
|
||||
*
|
||||
* @see #getMinValue()
|
||||
* @see #getMaxValue()
|
||||
*/
|
||||
@@ -1265,18 +1258,17 @@ public class LocalePicker extends LinearLayout {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the selector wheel shown during flinging/scrolling should
|
||||
* wrap around the {@link LocalePicker#getMinValue()} and
|
||||
* {@link LocalePicker#getMaxValue()} values.
|
||||
* Sets whether the selector wheel shown during flinging/scrolling should wrap around the {@link
|
||||
* LocalePicker#getMinValue()} and {@link LocalePicker#getMaxValue()} values.
|
||||
* <p>
|
||||
* By default if the range (max - min) is more than the number of items shown
|
||||
* on the selector wheel the selector wheel wrapping is enabled.
|
||||
* By default if the range (max - min) is more than the number of items shown on the selector
|
||||
* wheel the selector wheel wrapping is enabled.
|
||||
* </p>
|
||||
* <p>
|
||||
* <strong>Note:</strong> If the number of items, i.e. the range (
|
||||
* {@link #getMaxValue()} - {@link #getMinValue()}) is less than
|
||||
* the number of items shown on the selector wheel, the selector wheel will
|
||||
* not wrap. Hence, in such a case calling this method is a NOP.
|
||||
* {@link #getMaxValue()} - {@link #getMinValue()}) is less than the number of items shown on
|
||||
* the selector wheel, the selector wheel will not wrap. Hence, in such a case calling this
|
||||
* method is a NOP.
|
||||
* </p>
|
||||
*
|
||||
* @param wrapSelectorWheel Whether to wrap.
|
||||
@@ -1289,14 +1281,14 @@ public class LocalePicker extends LinearLayout {
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the speed at which the numbers be incremented and decremented when
|
||||
* the up and down buttons are long pressed respectively.
|
||||
* Sets the speed at which the numbers be incremented and decremented when the up and down
|
||||
* buttons are long pressed respectively.
|
||||
* <p>
|
||||
* The default value is 300 ms.
|
||||
* </p>
|
||||
*
|
||||
* @param intervalMillis The speed (in milliseconds) at which the numbers
|
||||
* will be incremented and decremented.
|
||||
* @param intervalMillis The speed (in milliseconds) at which the numbers will be incremented
|
||||
* and decremented.
|
||||
*/
|
||||
public void setOnLongPressUpdateInterval(long intervalMillis) {
|
||||
mLongPressUpdateInterval = intervalMillis;
|
||||
@@ -1326,9 +1318,9 @@ public class LocalePicker extends LinearLayout {
|
||||
* @param minValue The min value inclusive.
|
||||
*
|
||||
* <strong>Note:</strong> The length of the displayed values array
|
||||
* set via {@link #setDisplayedValues(String[])} must be equal to the
|
||||
* range of selectable numbers which is equal to
|
||||
* {@link #getMaxValue()} - {@link #getMinValue()} + 1.
|
||||
* set via {@link #setDisplayedValues(String[])} must be equal to the range of
|
||||
* selectable numbers which is equal to {@link #getMaxValue()} - {@link
|
||||
* #getMinValue()} + 1.
|
||||
*/
|
||||
public void setMinValue(int minValue) {
|
||||
if (mMinValue == minValue) {
|
||||
@@ -1364,9 +1356,9 @@ public class LocalePicker extends LinearLayout {
|
||||
* @param maxValue The max value inclusive.
|
||||
*
|
||||
* <strong>Note:</strong> The length of the displayed values array
|
||||
* set via {@link #setDisplayedValues(String[])} must be equal to the
|
||||
* range of selectable numbers which is equal to
|
||||
* {@link #getMaxValue()} - {@link #getMinValue()} + 1.
|
||||
* set via {@link #setDisplayedValues(String[])} must be equal to the range of
|
||||
* selectable numbers which is equal to {@link #getMaxValue()} - {@link
|
||||
* #getMinValue()} + 1.
|
||||
*/
|
||||
public void setMaxValue(int maxValue) {
|
||||
if (mMaxValue == maxValue) {
|
||||
@@ -1540,9 +1532,8 @@ public class LocalePicker extends LinearLayout {
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility to reconcile a desired size and state, with constraints imposed
|
||||
* by a MeasureSpec. Tries to respect the min size, unless a different size
|
||||
* is imposed by the constraints.
|
||||
* Utility to reconcile a desired size and state, with constraints imposed by a MeasureSpec.
|
||||
* Tries to respect the min size, unless a different size is imposed by the constraints.
|
||||
*
|
||||
* @param minSize The minimal desired size.
|
||||
* @param measuredSize The currently measured size.
|
||||
@@ -1560,8 +1551,7 @@ public class LocalePicker extends LinearLayout {
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the selector indices and clear the cached string representation of
|
||||
* these indices.
|
||||
* Resets the selector indices and clear the cached string representation of these indices.
|
||||
*/
|
||||
private void initializeSelectorWheelIndices() {
|
||||
mSelectorIndexToStringCache.clear();
|
||||
@@ -1605,9 +1595,8 @@ public class LocalePicker extends LinearLayout {
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the current value by one which is increment or
|
||||
* decrement based on the passes argument.
|
||||
* decrement the current value.
|
||||
* Changes the current value by one which is increment or decrement based on the passes
|
||||
* argument. decrement the current value.
|
||||
*
|
||||
* @param increment True to increment, false to decrement.
|
||||
*/
|
||||
@@ -1712,8 +1701,8 @@ public class LocalePicker extends LinearLayout {
|
||||
}
|
||||
|
||||
/**
|
||||
* Increments the <code>selectorIndices</code> whose string representations
|
||||
* will be displayed in the selector.
|
||||
* Increments the <code>selectorIndices</code> whose string representations will be displayed in
|
||||
* the selector.
|
||||
*/
|
||||
private void incrementSelectorIndices(int[] selectorIndices) {
|
||||
for (int i = 0; i < selectorIndices.length - 1; i++) {
|
||||
@@ -1728,8 +1717,8 @@ public class LocalePicker extends LinearLayout {
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrements the <code>selectorIndices</code> whose string representations
|
||||
* will be displayed in the selector.
|
||||
* Decrements the <code>selectorIndices</code> whose string representations will be displayed in
|
||||
* the selector.
|
||||
*/
|
||||
private void decrementSelectorIndices(int[] selectorIndices) {
|
||||
for (int i = selectorIndices.length - 1; i > 0; i--) {
|
||||
@@ -1744,8 +1733,8 @@ public class LocalePicker extends LinearLayout {
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures we have a cached string representation of the given <code>
|
||||
* selectorIndex</code> to avoid multiple instantiations of the same string.
|
||||
* Ensures we have a cached string representation of the given <code> selectorIndex</code> to
|
||||
* avoid multiple instantiations of the same string.
|
||||
*/
|
||||
private void ensureCachedScrollSelectorValue(int selectorIndex) {
|
||||
SparseArray<String> cache = mSelectorIndexToStringCache;
|
||||
@@ -1777,16 +1766,15 @@ public class LocalePicker extends LinearLayout {
|
||||
updateInputTextView();
|
||||
} else {
|
||||
// Check the new value and ensure it's in range
|
||||
int current = getSelectedPos(str.toString());
|
||||
int current = getSelectedPos(str);
|
||||
setValueInternal(current, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the view of this NumberPicker. If displayValues were specified in
|
||||
* the string corresponding to the index specified by the current value will
|
||||
* be returned. Otherwise, the formatter specified in {@link #setFormatter}
|
||||
* will be used to format the number.
|
||||
* Updates the view of this NumberPicker. If displayValues were specified in the string
|
||||
* corresponding to the index specified by the current value will be returned. Otherwise, the
|
||||
* formatter specified in {@link #setFormatter} will be used to format the number.
|
||||
*
|
||||
* @return Whether the text was updated.
|
||||
*/
|
||||
@@ -1807,8 +1795,7 @@ public class LocalePicker extends LinearLayout {
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies the listener, if registered, of a change of the value of this
|
||||
* NumberPicker.
|
||||
* Notifies the listener, if registered, of a change of the value of this NumberPicker.
|
||||
*/
|
||||
private void notifyChange(int previous, int current) {
|
||||
if (mOnValueChangeListener != null) {
|
||||
@@ -1841,8 +1828,7 @@ public class LocalePicker extends LinearLayout {
|
||||
}
|
||||
|
||||
/**
|
||||
* Posts a command for beginning an edit of the current value via IME on
|
||||
* long press.
|
||||
* Posts a command for beginning an edit of the current value via IME on long press.
|
||||
*/
|
||||
private void postBeginSoftInputOnLongPressCommand() {
|
||||
if (mBeginSoftInputOnLongPressCommand == null) {
|
||||
@@ -1929,7 +1915,7 @@ public class LocalePicker extends LinearLayout {
|
||||
/**
|
||||
* The numbers accepted by the input text's {@link android.view.LayoutInflater.Filter}
|
||||
*/
|
||||
private static final char[] DIGIT_CHARACTERS = new char[] {
|
||||
private static final char[] DIGIT_CHARACTERS = new char[]{
|
||||
// Latin digits are the common case
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
// Arabic-Indic
|
||||
@@ -1941,8 +1927,8 @@ public class LocalePicker extends LinearLayout {
|
||||
};
|
||||
|
||||
/**
|
||||
* Filter for accepting only valid indices or prefixes of the string
|
||||
* representation of valid indices.
|
||||
* Filter for accepting only valid indices or prefixes of the string representation of valid
|
||||
* indices.
|
||||
*/
|
||||
class InputTextFilter extends NumberKeyListener {
|
||||
|
||||
@@ -1993,7 +1979,7 @@ public class LocalePicker extends LinearLayout {
|
||||
}
|
||||
String result = String.valueOf(dest.subSequence(0, dstart)) + filtered
|
||||
+ dest.subSequence(dend, dest.length());
|
||||
String str = String.valueOf(result).toLowerCase();
|
||||
String str = result.toLowerCase();
|
||||
for (String val : mDisplayedValues) {
|
||||
String valLowerCase = val.toLowerCase();
|
||||
if (valLowerCase.startsWith(str)) {
|
||||
@@ -2007,8 +1993,8 @@ public class LocalePicker extends LinearLayout {
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that the scroll wheel is adjusted i.e. there is no offset and the
|
||||
* middle element is in the middle of the widget.
|
||||
* Ensures that the scroll wheel is adjusted i.e. there is no offset and the middle element is
|
||||
* in the middle of the widget.
|
||||
*
|
||||
* @return Whether an adjustment has been made.
|
||||
*/
|
||||
@@ -2073,13 +2059,15 @@ public class LocalePicker extends LinearLayout {
|
||||
case BUTTON_INCREMENT: {
|
||||
mIncrementVirtualButtonPressed = true;
|
||||
invalidate(0, mBottomSelectionDividerBottom, mRight, mBottom);
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
case BUTTON_DECREMENT: {
|
||||
mDecrementVirtualButtonPressed = true;
|
||||
invalidate(0, 0, mRight, mTopSelectionDividerTop);
|
||||
}
|
||||
}
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
case MODE_TAPPED: {
|
||||
switch (mManagedButton) {
|
||||
case BUTTON_INCREMENT: {
|
||||
@@ -2089,7 +2077,8 @@ public class LocalePicker extends LinearLayout {
|
||||
}
|
||||
mIncrementVirtualButtonPressed ^= true;
|
||||
invalidate(0, mBottomSelectionDividerBottom, mRight, mBottom);
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
case BUTTON_DECREMENT: {
|
||||
if (!mDecrementVirtualButtonPressed) {
|
||||
LocalePicker.this.postDelayed(this,
|
||||
@@ -2099,7 +2088,8 @@ public class LocalePicker extends LinearLayout {
|
||||
invalidate(0, 0, mRight, mTopSelectionDividerTop);
|
||||
}
|
||||
}
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2186,7 +2176,7 @@ public class LocalePicker extends LinearLayout {
|
||||
public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) {
|
||||
switch (virtualViewId) {
|
||||
case View.NO_ID:
|
||||
return createAccessibilityNodeInfoForNumberPicker( mScrollX, mScrollY,
|
||||
return createAccessibilityNodeInfoForNumberPicker(mScrollX, mScrollY,
|
||||
mScrollX + (mRight - mLeft), mScrollY + (mBottom - mTop));
|
||||
case VIRTUAL_VIEW_ID_DECREMENT:
|
||||
return createAccessibilityNodeInfoForVirtualButton(VIRTUAL_VIEW_ID_DECREMENT,
|
||||
@@ -2247,7 +2237,8 @@ public class LocalePicker extends LinearLayout {
|
||||
requestAccessibilityFocus();
|
||||
return true;
|
||||
}
|
||||
} return false;
|
||||
}
|
||||
return false;
|
||||
case AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS: {
|
||||
if (mAccessibilityFocusedView == virtualViewId) {
|
||||
mAccessibilityFocusedView = UNDEFINED;
|
||||
@@ -2262,23 +2253,27 @@ public class LocalePicker extends LinearLayout {
|
||||
changeValueByOne(true);
|
||||
return true;
|
||||
}
|
||||
} return false;
|
||||
}
|
||||
return false;
|
||||
case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD: {
|
||||
if (LocalePicker.this.isEnabled()
|
||||
&& (getWrapSelectorWheel() || getValue() > getMinValue())) {
|
||||
changeValueByOne(false);
|
||||
return true;
|
||||
}
|
||||
} return false;
|
||||
}
|
||||
} break;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case VIRTUAL_VIEW_ID_INPUT: {
|
||||
switch (action) {
|
||||
case AccessibilityNodeInfo.ACTION_FOCUS: {
|
||||
if (LocalePicker.this.isEnabled() && !mInputText.isFocused()) {
|
||||
return mInputText.requestFocus();
|
||||
}
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
case AccessibilityNodeInfo.ACTION_CLEAR_FOCUS: {
|
||||
if (LocalePicker.this.isEnabled() && mInputText.isFocused()) {
|
||||
mInputText.clearFocus();
|
||||
@@ -2301,7 +2296,8 @@ public class LocalePicker extends LinearLayout {
|
||||
mInputText.invalidate();
|
||||
return true;
|
||||
}
|
||||
} return false;
|
||||
}
|
||||
return false;
|
||||
case AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS: {
|
||||
if (mAccessibilityFocusedView == virtualViewId) {
|
||||
mAccessibilityFocusedView = UNDEFINED;
|
||||
@@ -2310,12 +2306,14 @@ public class LocalePicker extends LinearLayout {
|
||||
mInputText.invalidate();
|
||||
return true;
|
||||
}
|
||||
} return false;
|
||||
}
|
||||
return false;
|
||||
default: {
|
||||
return mInputText.performAccessibilityAction(action, arguments);
|
||||
}
|
||||
}
|
||||
} return false;
|
||||
}
|
||||
return false;
|
||||
case VIRTUAL_VIEW_ID_INCREMENT: {
|
||||
switch (action) {
|
||||
case AccessibilityNodeInfo.ACTION_CLICK: {
|
||||
@@ -2325,7 +2323,8 @@ public class LocalePicker extends LinearLayout {
|
||||
AccessibilityEvent.TYPE_VIEW_CLICKED);
|
||||
return true;
|
||||
}
|
||||
} return false;
|
||||
}
|
||||
return false;
|
||||
case AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS: {
|
||||
if (mAccessibilityFocusedView != virtualViewId) {
|
||||
mAccessibilityFocusedView = virtualViewId;
|
||||
@@ -2334,7 +2333,8 @@ public class LocalePicker extends LinearLayout {
|
||||
invalidate(0, mBottomSelectionDividerBottom, mRight, mBottom);
|
||||
return true;
|
||||
}
|
||||
} return false;
|
||||
}
|
||||
return false;
|
||||
case AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS: {
|
||||
if (mAccessibilityFocusedView == virtualViewId) {
|
||||
mAccessibilityFocusedView = UNDEFINED;
|
||||
@@ -2343,20 +2343,24 @@ public class LocalePicker extends LinearLayout {
|
||||
invalidate(0, mBottomSelectionDividerBottom, mRight, mBottom);
|
||||
return true;
|
||||
}
|
||||
} return false;
|
||||
}
|
||||
} return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
case VIRTUAL_VIEW_ID_DECREMENT: {
|
||||
switch (action) {
|
||||
case AccessibilityNodeInfo.ACTION_CLICK: {
|
||||
if (LocalePicker.this.isEnabled()) {
|
||||
final boolean increment = (virtualViewId == VIRTUAL_VIEW_ID_INCREMENT);
|
||||
final boolean increment =
|
||||
(virtualViewId == VIRTUAL_VIEW_ID_INCREMENT);
|
||||
LocalePicker.this.changeValueByOne(increment);
|
||||
sendAccessibilityEventForVirtualView(virtualViewId,
|
||||
AccessibilityEvent.TYPE_VIEW_CLICKED);
|
||||
return true;
|
||||
}
|
||||
} return false;
|
||||
}
|
||||
return false;
|
||||
case AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS: {
|
||||
if (mAccessibilityFocusedView != virtualViewId) {
|
||||
mAccessibilityFocusedView = virtualViewId;
|
||||
@@ -2365,7 +2369,8 @@ public class LocalePicker extends LinearLayout {
|
||||
invalidate(0, 0, mRight, mTopSelectionDividerTop);
|
||||
return true;
|
||||
}
|
||||
} return false;
|
||||
}
|
||||
return false;
|
||||
case AccessibilityNodeInfo.ACTION_CLEAR_ACCESSIBILITY_FOCUS: {
|
||||
if (mAccessibilityFocusedView == virtualViewId) {
|
||||
mAccessibilityFocusedView = UNDEFINED;
|
||||
@@ -2374,9 +2379,11 @@ public class LocalePicker extends LinearLayout {
|
||||
invalidate(0, 0, mRight, mTopSelectionDividerTop);
|
||||
return true;
|
||||
}
|
||||
} return false;
|
||||
}
|
||||
} return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return super.performAction(virtualViewId, action, arguments);
|
||||
}
|
||||
@@ -2388,16 +2395,19 @@ public class LocalePicker extends LinearLayout {
|
||||
sendAccessibilityEventForVirtualButton(virtualViewId, eventType,
|
||||
getVirtualDecrementButtonText());
|
||||
}
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
case VIRTUAL_VIEW_ID_INPUT: {
|
||||
sendAccessibilityEventForVirtualText(eventType);
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
case VIRTUAL_VIEW_ID_INCREMENT: {
|
||||
if (hasVirtualIncrementButton()) {
|
||||
sendAccessibilityEventForVirtualButton(virtualViewId, eventType,
|
||||
getVirtualIncrementButtonText());
|
||||
}
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2430,10 +2440,11 @@ public class LocalePicker extends LinearLayout {
|
||||
case VIRTUAL_VIEW_ID_DECREMENT: {
|
||||
String text = getVirtualDecrementButtonText();
|
||||
if (!TextUtils.isEmpty(text)
|
||||
&& text.toString().toLowerCase().contains(searchedLowerCase)) {
|
||||
&& text.toLowerCase().contains(searchedLowerCase)) {
|
||||
outResult.add(createAccessibilityNodeInfo(VIRTUAL_VIEW_ID_DECREMENT));
|
||||
}
|
||||
} return;
|
||||
}
|
||||
return;
|
||||
case VIRTUAL_VIEW_ID_INPUT: {
|
||||
CharSequence text = mInputText.getText();
|
||||
if (!TextUtils.isEmpty(text) &&
|
||||
@@ -2447,14 +2458,16 @@ public class LocalePicker extends LinearLayout {
|
||||
outResult.add(createAccessibilityNodeInfo(VIRTUAL_VIEW_ID_INPUT));
|
||||
return;
|
||||
}
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
case VIRTUAL_VIEW_ID_INCREMENT: {
|
||||
String text = getVirtualIncrementButtonText();
|
||||
if (!TextUtils.isEmpty(text)
|
||||
&& text.toString().toLowerCase().contains(searchedLowerCase)) {
|
||||
&& text.toLowerCase().contains(searchedLowerCase)) {
|
||||
outResult.add(createAccessibilityNodeInfo(VIRTUAL_VIEW_ID_INCREMENT));
|
||||
}
|
||||
} return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -29,14 +29,15 @@ import androidx.core.view.ViewCompat;
|
||||
import org.lineageos.setupwizard.R;
|
||||
|
||||
/**
|
||||
* A layout that draws something in the insets passed to {@link #fitSystemWindows(android.graphics.Rect)}, i.e. the area above UI chrome
|
||||
* (status and navigation bars, overlay action bars).
|
||||
* A layout that draws something in the insets passed to
|
||||
* {@link #fitSystemWindows(android.graphics.Rect)},
|
||||
* i.e. the area above UI chrome (status and navigation bars, overlay action bars).
|
||||
*/
|
||||
public class ScrimInsetsFrameLayout extends FrameLayout {
|
||||
private Drawable mInsetForeground;
|
||||
|
||||
private Rect mInsets;
|
||||
private Rect mTempRect = new Rect();
|
||||
private final Rect mTempRect = new Rect();
|
||||
private OnInsetsCallback mOnInsetsCallback;
|
||||
|
||||
public ScrimInsetsFrameLayout(Context context) {
|
||||
@@ -128,16 +129,16 @@ public class ScrimInsetsFrameLayout extends FrameLayout {
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows the calling container to specify a callback for custom processing when insets change (i.e. when
|
||||
* {@link #fitSystemWindows(android.graphics.Rect)} is called. This is useful for setting padding on UI elements based on
|
||||
* UI chrome insets (e.g. a Google Map or a ListView). When using with ListView or GridView, remember to set
|
||||
* clipToPadding to false.
|
||||
* Allows the calling container to specify a callback for custom processing when insets change
|
||||
* (i.e. when {@link #fitSystemWindows(android.graphics.Rect)} is called. This is useful for
|
||||
* setting padding on UI elements based on UI chrome insets (e.g. a Google Map or a ListView).
|
||||
* When using with ListView or GridView, remember to set clipToPadding to false.
|
||||
*/
|
||||
public void setOnInsetsCallback(OnInsetsCallback onInsetsCallback) {
|
||||
mOnInsetsCallback = onInsetsCallback;
|
||||
}
|
||||
|
||||
public static interface OnInsetsCallback {
|
||||
public void onInsetsChanged(Rect insets);
|
||||
public interface OnInsetsCallback {
|
||||
void onInsetsChanged(Rect insets);
|
||||
}
|
||||
}
|
||||
|
@@ -63,7 +63,7 @@ public class WizardAction implements Parcelable {
|
||||
Intent intent = null;
|
||||
try {
|
||||
intent = Intent.parseUri(mUri, FLAG_GRANT_READ_URI_PERMISSION);
|
||||
} catch(URISyntaxException e) {
|
||||
} catch (URISyntaxException e) {
|
||||
Log.e(TAG, "Bad URI: " + mUri);
|
||||
}
|
||||
return intent;
|
||||
@@ -145,7 +145,8 @@ public class WizardAction implements Parcelable {
|
||||
}
|
||||
}
|
||||
|
||||
public static WizardAction parseWizardAction(XmlPullParser parser) throws XmlPullParserException,
|
||||
public static WizardAction parseWizardAction(XmlPullParser parser)
|
||||
throws XmlPullParserException,
|
||||
IOException {
|
||||
String id = parser.getAttributeValue(null, WizardScript.ATTR_ID);
|
||||
String uri = parser.getAttributeValue(WizardScript.WIZARD_SCRIPT_NAMESPACE,
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
package org.lineageos.setupwizard.wizardmanager;
|
||||
|
||||
|
||||
import static org.lineageos.setupwizard.SetupWizardApp.ACTION_LOAD;
|
||||
import static org.lineageos.setupwizard.SetupWizardApp.ACTION_NEXT;
|
||||
import static org.lineageos.setupwizard.SetupWizardApp.EXTRA_ACTION_ID;
|
||||
@@ -25,12 +24,6 @@ import static org.lineageos.setupwizard.SetupWizardApp.EXTRA_RESULT_CODE;
|
||||
import static org.lineageos.setupwizard.SetupWizardApp.EXTRA_SCRIPT_URI;
|
||||
import static org.lineageos.setupwizard.SetupWizardApp.LOGV;
|
||||
|
||||
import com.google.android.setupcompat.util.ResultCodes;
|
||||
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||
import com.google.android.setupdesign.util.ThemeHelper;
|
||||
|
||||
import org.lineageos.setupwizard.util.SetupWizardUtils;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
@@ -39,15 +32,19 @@ import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.HashMap;
|
||||
import com.google.android.setupcompat.util.ResultCodes;
|
||||
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||
import com.google.android.setupdesign.util.ThemeHelper;
|
||||
|
||||
import org.lineageos.setupwizard.util.SetupWizardUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class WizardManager extends Activity {
|
||||
|
||||
private static final String TAG = WizardManager.class.getSimpleName();
|
||||
|
||||
private static HashMap<String, WizardScript> sWizardScripts = new HashMap();
|
||||
|
||||
private static final HashMap<String, WizardScript> sWizardScripts = new HashMap();
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
@@ -93,13 +90,13 @@ public class WizardManager extends Activity {
|
||||
private void doAction(String scriptUri, WizardAction action, Intent extras) {
|
||||
Intent intent = action.getIntent();
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
if(LOGV) {
|
||||
if (LOGV) {
|
||||
Log.v(TAG, "doAction scriptUri=" + scriptUri + " extras=" + extras
|
||||
+ " intent=" + intent + " extras2=" + intent.getExtras() + " action=" + action);
|
||||
}
|
||||
|
||||
addExtras(intent);
|
||||
if(extras != null) {
|
||||
if (extras != null) {
|
||||
intent.putExtras(extras);
|
||||
}
|
||||
|
||||
@@ -111,7 +108,7 @@ public class WizardManager extends Activity {
|
||||
private void load(String scriptUri, Intent extras) {
|
||||
WizardScript wizardScript = getWizardScript(this, scriptUri);
|
||||
WizardAction wizardAction;
|
||||
for(wizardAction = wizardScript.getFirstAction();
|
||||
for (wizardAction = wizardScript.getFirstAction();
|
||||
wizardAction != null;
|
||||
wizardAction = wizardScript.getNextAction(wizardAction.getId(),
|
||||
ResultCodes.RESULT_ACTIVITY_NOT_FOUND)) {
|
||||
@@ -119,7 +116,7 @@ public class WizardManager extends Activity {
|
||||
break;
|
||||
}
|
||||
|
||||
if(LOGV) {
|
||||
if (LOGV) {
|
||||
Log.v(TAG, "load action not available " + wizardAction);
|
||||
}
|
||||
}
|
||||
@@ -134,7 +131,7 @@ public class WizardManager extends Activity {
|
||||
}
|
||||
|
||||
private void next(String scriptUri, String actionId, int resultCode, Intent extras) {
|
||||
if(LOGV) {
|
||||
if (LOGV) {
|
||||
Log.v(TAG, "next actionId=" + actionId + " resultCode=" + resultCode);
|
||||
}
|
||||
WizardAction wizardAction = checkNextAction(this, scriptUri,
|
||||
@@ -147,7 +144,7 @@ public class WizardManager extends Activity {
|
||||
}
|
||||
|
||||
private void exit(String scriptUri) {
|
||||
if(LOGV) {
|
||||
if (LOGV) {
|
||||
Log.v(TAG, "exit scriptUri=" + scriptUri);
|
||||
}
|
||||
WizardManager.sWizardScripts.remove(scriptUri);
|
||||
@@ -156,14 +153,14 @@ public class WizardManager extends Activity {
|
||||
|
||||
private static WizardAction checkNextAction(Context context, String scriptUri, String actionId,
|
||||
int resultCode) {
|
||||
if(LOGV) {
|
||||
if (LOGV) {
|
||||
Log.v(TAG, "checkNextAction scriptUri=" + scriptUri + " actionId="
|
||||
+ actionId + " resultCode=" + resultCode);
|
||||
}
|
||||
|
||||
WizardScript wizardScript = getWizardScript(context, scriptUri);
|
||||
WizardAction wizardAction;
|
||||
for ( wizardAction = wizardScript.getNextAction(actionId, resultCode);
|
||||
for (wizardAction = wizardScript.getNextAction(actionId, resultCode);
|
||||
wizardAction != null;
|
||||
wizardAction = wizardScript.getNextAction(wizardAction.getId(),
|
||||
ResultCodes.RESULT_ACTIVITY_NOT_FOUND)) {
|
||||
@@ -171,7 +168,7 @@ public class WizardManager extends Activity {
|
||||
break;
|
||||
}
|
||||
|
||||
if(LOGV) {
|
||||
if (LOGV) {
|
||||
Log.v(TAG, "checkNextAction action not available " + wizardAction);
|
||||
}
|
||||
}
|
||||
@@ -188,11 +185,8 @@ public class WizardManager extends Activity {
|
||||
}
|
||||
|
||||
private static boolean isIntentAvailable(Context context, Intent intent) {
|
||||
if (context.getPackageManager().queryIntentActivities(intent,
|
||||
PackageManager.MATCH_DEFAULT_ONLY).size() > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return context.getPackageManager().queryIntentActivities(intent,
|
||||
PackageManager.MATCH_DEFAULT_ONLY).size() > 0;
|
||||
}
|
||||
|
||||
private static WizardScript getWizardScript(Context context, String scriptUri) {
|
||||
|
@@ -19,11 +19,6 @@ package org.lineageos.setupwizard.wizardmanager;
|
||||
|
||||
import static org.lineageos.setupwizard.SetupWizardApp.LOGV;
|
||||
|
||||
import com.android.internal.util.XmlUtils;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
@@ -33,6 +28,11 @@ import android.os.Parcelable;
|
||||
import android.util.Log;
|
||||
import android.util.Xml;
|
||||
|
||||
import com.android.internal.util.XmlUtils;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -88,7 +88,7 @@ public class WizardScript implements Parcelable {
|
||||
|
||||
public String getNextActionId(String currentActionId, int resultCode) {
|
||||
String nextActionId = null;
|
||||
if(resultCode != Activity.RESULT_CANCELED) {
|
||||
if (resultCode != Activity.RESULT_CANCELED) {
|
||||
WizardAction wizardAction = mActions.get(currentActionId);
|
||||
if (LOGV) {
|
||||
StringBuilder currentAction =
|
||||
@@ -140,7 +140,7 @@ public class WizardScript implements Parcelable {
|
||||
ContentResolver.OpenResourceIdResult openResourceIdResult =
|
||||
context.getContentResolver().getResourceId(Uri
|
||||
.parse(uriString));
|
||||
if("xml".equals(openResourceIdResult.r.getResourceTypeName(openResourceIdResult.id))) {
|
||||
if ("xml".equals(openResourceIdResult.r.getResourceTypeName(openResourceIdResult.id))) {
|
||||
xmlPullParser =
|
||||
openResourceIdResult.r.getXml(openResourceIdResult.id);
|
||||
} else {
|
||||
@@ -164,11 +164,11 @@ public class WizardScript implements Parcelable {
|
||||
Log.e(TAG, "Ill-formatted wizard_script: " + uriString);
|
||||
Log.e(TAG, e.getMessage());
|
||||
return wizardScript;
|
||||
} catch(FileNotFoundException fnfe) {
|
||||
} catch (FileNotFoundException fnfe) {
|
||||
Log.e(TAG, "Cannot find file: " + uriString);
|
||||
Log.e(TAG, fnfe.getMessage());
|
||||
return wizardScript;
|
||||
} catch(IOException ioe) {
|
||||
} catch (IOException ioe) {
|
||||
Log.e(TAG, "Unable to read wizard_script: " + uriString);
|
||||
Log.e(TAG, ioe.getMessage());
|
||||
return wizardScript;
|
||||
@@ -178,14 +178,14 @@ public class WizardScript implements Parcelable {
|
||||
private static WizardScript parseWizardScript(XmlPullParser parser)
|
||||
throws XmlPullParserException, IOException {
|
||||
String startTag = parser.getName();
|
||||
if(!TAG_WIZARD_SCRIPT.equals(startTag)) {
|
||||
if (!TAG_WIZARD_SCRIPT.equals(startTag)) {
|
||||
throw new XmlPullParserException("XML document must start with " +
|
||||
"<WizardScript> tag; found "
|
||||
+ startTag + " at " + parser.getPositionDescription());
|
||||
}
|
||||
|
||||
String firstAction = parser.getAttributeValue(WIZARD_SCRIPT_NAMESPACE, ATTR_FIRST_ACTION);
|
||||
if(firstAction == null) {
|
||||
if (firstAction == null) {
|
||||
throw new XmlPullParserException("WizardScript must define a firstAction");
|
||||
}
|
||||
|
||||
|
@@ -24,8 +24,6 @@ import android.os.Parcelable;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
|
||||
import org.lineageos.setupwizard.SetupWizardApp;
|
||||
|
||||
public class WizardTransitions extends SparseArray<String> implements Parcelable {
|
||||
|
||||
private static final String TAG = "WizardTransitions";
|
||||
@@ -47,7 +45,8 @@ public class WizardTransitions extends SparseArray<String> implements Parcelable
|
||||
}
|
||||
};
|
||||
|
||||
public WizardTransitions() {}
|
||||
public WizardTransitions() {
|
||||
}
|
||||
|
||||
public void setDefaultAction(String action) {
|
||||
mDefaultAction = action;
|
||||
@@ -77,7 +76,8 @@ public class WizardTransitions extends SparseArray<String> implements Parcelable
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
WizardTransitions that = (WizardTransitions) o;
|
||||
return mDefaultAction != null ? mDefaultAction.equals(that.mDefaultAction) : that.mDefaultAction == null;
|
||||
return mDefaultAction != null ? mDefaultAction.equals(that.mDefaultAction)
|
||||
: that.mDefaultAction == null;
|
||||
|
||||
}
|
||||
|
||||
@@ -105,5 +105,4 @@ public class WizardTransitions extends SparseArray<String> implements Parcelable
|
||||
mDefaultAction = in.readString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user