Merge "Finish storage wizard theming." into mnc-dev
This commit is contained in:
@@ -101,7 +101,6 @@ public class StorageVolumePreference extends Preference {
|
||||
protected void onBindView(View view) {
|
||||
final ImageView unmount = (ImageView) view.findViewById(R.id.unmount);
|
||||
if (unmount != null) {
|
||||
unmount.getDrawable().setTint(Color.parseColor("#8a000000"));
|
||||
unmount.setOnClickListener(mUnmountListener);
|
||||
}
|
||||
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.settings.deviceinfo;
|
||||
|
||||
import android.annotation.LayoutRes;
|
||||
import android.app.Activity;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
@@ -23,9 +24,10 @@ import android.os.storage.DiskInfo;
|
||||
import android.os.storage.StorageEventListener;
|
||||
import android.os.storage.StorageManager;
|
||||
import android.os.storage.VolumeInfo;
|
||||
import android.os.storage.VolumeRecord;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.ProgressBar;
|
||||
@@ -33,19 +35,20 @@ import android.widget.TextView;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.setupwizardlib.SetupWizardLayout;
|
||||
import com.android.setupwizardlib.view.NavigationBar;
|
||||
import com.android.setupwizardlib.view.NavigationBar.NavigationBarListener;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public abstract class StorageWizardBase extends Activity implements NavigationBarListener {
|
||||
public abstract class StorageWizardBase extends Activity {
|
||||
protected StorageManager mStorage;
|
||||
|
||||
protected VolumeInfo mVolume;
|
||||
protected DiskInfo mDisk;
|
||||
|
||||
private View mCustomNav;
|
||||
private Button mCustomNext;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -64,28 +67,62 @@ public abstract class StorageWizardBase extends Activity implements NavigationBa
|
||||
mDisk = mVolume.getDisk();
|
||||
}
|
||||
|
||||
setTheme(R.style.SuwThemeMaterial_Light);
|
||||
setTheme(R.style.SetupWizardStorageStyle);
|
||||
|
||||
if (mDisk != null) {
|
||||
mStorage.registerListener(mStorageListener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContentView(@LayoutRes int layoutResID) {
|
||||
super.setContentView(layoutResID);
|
||||
|
||||
// Our wizard is a unique flower, so it has custom buttons
|
||||
final ViewGroup navParent = (ViewGroup) findViewById(R.id.suw_layout_navigation_bar)
|
||||
.getParent();
|
||||
mCustomNav = getLayoutInflater().inflate(R.layout.storage_wizard_navigation,
|
||||
navParent, false);
|
||||
|
||||
mCustomNext = (Button) mCustomNav.findViewById(R.id.suw_navbar_next);
|
||||
mCustomNext.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
onNavigateNext();
|
||||
}
|
||||
});
|
||||
|
||||
// Swap our custom navigation bar into place
|
||||
for (int i = 0; i < navParent.getChildCount(); i++) {
|
||||
if (navParent.getChildAt(i).getId() == R.id.suw_layout_navigation_bar) {
|
||||
navParent.removeViewAt(i);
|
||||
navParent.addView(mCustomNav, i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostCreate(Bundle savedInstanceState) {
|
||||
super.onPostCreate(savedInstanceState);
|
||||
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS |
|
||||
final Window window = getWindow();
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS |
|
||||
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
|
||||
WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR);
|
||||
window.setStatusBarColor(Color.TRANSPARENT);
|
||||
|
||||
getNavigationBar().setSystemUiVisibility(
|
||||
mCustomNav.setSystemUiVisibility(
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
||||
|
||||
getWindow().setStatusBarColor(Color.TRANSPARENT);
|
||||
final View scrollView = findViewById(R.id.suw_bottom_scroll_view);
|
||||
scrollView.setVerticalFadingEdgeEnabled(true);
|
||||
scrollView.setFadingEdgeLength(scrollView.getVerticalFadingEdgeLength() * 2);
|
||||
|
||||
getNavigationBar().setNavigationBarListener(this);
|
||||
getBackButton().setVisibility(View.GONE);
|
||||
// Our header assets already have padding baked in
|
||||
final View title = findViewById(R.id.suw_layout_title);
|
||||
title.setPadding(title.getPaddingLeft(), 0, title.getPaddingRight(),
|
||||
title.getPaddingBottom());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -94,16 +131,8 @@ public abstract class StorageWizardBase extends Activity implements NavigationBa
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
protected NavigationBar getNavigationBar() {
|
||||
return (NavigationBar) findViewById(R.id.suw_layout_navigation_bar);
|
||||
}
|
||||
|
||||
protected Button getBackButton() {
|
||||
return getNavigationBar().getBackButton();
|
||||
}
|
||||
|
||||
protected Button getNextButton() {
|
||||
return getNavigationBar().getNextButton();
|
||||
return mCustomNext;
|
||||
}
|
||||
|
||||
protected SetupWizardLayout getSetupWizardLayout() {
|
||||
@@ -135,12 +164,16 @@ public abstract class StorageWizardBase extends Activity implements NavigationBa
|
||||
secondBody.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNavigateBack() {
|
||||
throw new UnsupportedOperationException();
|
||||
protected void setIllustrationInternal(boolean internal) {
|
||||
if (internal) {
|
||||
getSetupWizardLayout().setIllustration(R.drawable.bg_internal_storage_header,
|
||||
android.R.color.transparent);
|
||||
} else {
|
||||
getSetupWizardLayout().setIllustration(R.drawable.bg_portable_storage_header,
|
||||
android.R.color.transparent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNavigateNext() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
@@ -38,6 +38,7 @@ public class StorageWizardFormatConfirm extends StorageWizardBase {
|
||||
setContentView(R.layout.storage_wizard_generic);
|
||||
|
||||
mFormatPrivate = getIntent().getBooleanExtra(EXTRA_FORMAT_PRIVATE, false);
|
||||
setIllustrationInternal(mFormatPrivate);
|
||||
|
||||
if (mFormatPrivate) {
|
||||
setHeaderText(R.string.storage_wizard_format_confirm_title);
|
||||
@@ -49,8 +50,8 @@ public class StorageWizardFormatConfirm extends StorageWizardBase {
|
||||
mDisk.getDescription());
|
||||
}
|
||||
|
||||
// TODO: make this a big red scary button
|
||||
getNextButton().setText(R.string.storage_wizard_format_confirm_next);
|
||||
getNextButton().setBackgroundTintList(getColorStateList(R.color.storage_wizard_button_red));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -51,6 +51,7 @@ public class StorageWizardFormatProgress extends StorageWizardBase {
|
||||
|
||||
mFormatPrivate = getIntent().getBooleanExtra(
|
||||
StorageWizardFormatConfirm.EXTRA_FORMAT_PRIVATE, false);
|
||||
setIllustrationInternal(mFormatPrivate);
|
||||
|
||||
setHeaderText(R.string.storage_wizard_format_progress_title, mDisk.getDescription());
|
||||
setBodyText(R.string.storage_wizard_format_progress_body, mDisk.getDescription());
|
||||
|
@@ -39,6 +39,7 @@ public class StorageWizardInit extends StorageWizardBase {
|
||||
}
|
||||
setContentView(R.layout.storage_wizard_init);
|
||||
|
||||
setIllustrationInternal(true);
|
||||
setHeaderText(R.string.storage_wizard_init_title, mDisk.getDescription());
|
||||
|
||||
mRadioExternal = (RadioButton) findViewById(R.id.storage_wizard_init_external_title);
|
||||
@@ -70,8 +71,10 @@ public class StorageWizardInit extends StorageWizardBase {
|
||||
if (isChecked) {
|
||||
if (buttonView == mRadioExternal) {
|
||||
mRadioInternal.setChecked(false);
|
||||
setIllustrationInternal(false);
|
||||
} else if (buttonView == mRadioInternal) {
|
||||
mRadioExternal.setChecked(false);
|
||||
setIllustrationInternal(true);
|
||||
}
|
||||
getNextButton().setEnabled(true);
|
||||
}
|
||||
|
@@ -23,7 +23,6 @@ import android.widget.CompoundButton;
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||
import android.widget.RadioButton;
|
||||
|
||||
import com.android.internal.util.Preconditions;
|
||||
import com.android.settings.R;
|
||||
|
||||
public class StorageWizardMigrate extends StorageWizardBase {
|
||||
@@ -41,6 +40,7 @@ public class StorageWizardMigrate extends StorageWizardBase {
|
||||
}
|
||||
setContentView(R.layout.storage_wizard_migrate);
|
||||
|
||||
setIllustrationInternal(true);
|
||||
setHeaderText(R.string.storage_wizard_migrate_title, mDisk.getDescription());
|
||||
setBodyText(R.string.memory_calculating_size);
|
||||
|
||||
@@ -50,7 +50,7 @@ public class StorageWizardMigrate extends StorageWizardBase {
|
||||
mRadioNow.setOnCheckedChangeListener(mRadioListener);
|
||||
mRadioLater.setOnCheckedChangeListener(mRadioListener);
|
||||
|
||||
mRadioNow.setChecked(true);
|
||||
getNextButton().setEnabled(false);
|
||||
|
||||
mEstimate = new MigrateEstimateTask(this) {
|
||||
@Override
|
||||
@@ -73,6 +73,7 @@ public class StorageWizardMigrate extends StorageWizardBase {
|
||||
} else if (buttonView == mRadioLater) {
|
||||
mRadioNow.setChecked(false);
|
||||
}
|
||||
getNextButton().setEnabled(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@@ -45,6 +45,7 @@ public class StorageWizardMigrateConfirm extends StorageWizardBase {
|
||||
final String sourceDescrip = mStorage.getBestVolumeDescription(sourceVol);
|
||||
final String targetDescrip = mStorage.getBestVolumeDescription(mVolume);
|
||||
|
||||
setIllustrationInternal(true);
|
||||
setHeaderText(R.string.storage_wizard_migrate_confirm_title, targetDescrip);
|
||||
setBodyText(R.string.memory_calculating_size);
|
||||
setSecondaryBodyText(R.string.storage_wizard_migrate_details, targetDescrip);
|
||||
|
@@ -30,10 +30,11 @@ import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.android.internal.util.Preconditions;
|
||||
import com.android.settings.R;
|
||||
|
||||
public class StorageWizardMigrateProgress extends StorageWizardBase {
|
||||
private static final String ACTION_FINISH_WIZARD = "com.android.systemui.action.FINISH_WIZARD";
|
||||
|
||||
private int mMoveId;
|
||||
|
||||
@Override
|
||||
@@ -48,6 +49,7 @@ public class StorageWizardMigrateProgress extends StorageWizardBase {
|
||||
mMoveId = getIntent().getIntExtra(EXTRA_MOVE_ID, -1);
|
||||
|
||||
final String descrip = mStorage.getBestVolumeDescription(mVolume);
|
||||
setIllustrationInternal(true);
|
||||
setHeaderText(R.string.storage_wizard_migrate_progress_title, descrip);
|
||||
setBodyText(R.string.storage_wizard_migrate_details, descrip);
|
||||
|
||||
@@ -68,6 +70,12 @@ public class StorageWizardMigrateProgress extends StorageWizardBase {
|
||||
Log.d(TAG, "Finished with status " + status);
|
||||
if (status == PackageManager.MOVE_SUCCEEDED) {
|
||||
if (mDisk != null) {
|
||||
// Kinda lame, but tear down that shiny finished
|
||||
// notification, since user is still in wizard flow
|
||||
final Intent finishIntent = new Intent(ACTION_FINISH_WIZARD);
|
||||
finishIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
|
||||
sendBroadcast(finishIntent);
|
||||
|
||||
final Intent intent = new Intent(context, StorageWizardReady.class);
|
||||
intent.putExtra(DiskInfo.EXTRA_DISK_ID, mDisk.getId());
|
||||
startActivity(intent);
|
||||
|
@@ -56,6 +56,7 @@ public class StorageWizardMoveConfirm extends StorageWizardBase {
|
||||
final String appName = getPackageManager().getApplicationLabel(mApp).toString();
|
||||
final String volumeName = mStorage.getBestVolumeDescription(mVolume);
|
||||
|
||||
setIllustrationInternal(true);
|
||||
setHeaderText(R.string.storage_wizard_move_confirm_title, appName);
|
||||
setBodyText(R.string.storage_wizard_move_confirm_body, appName, volumeName);
|
||||
|
||||
|
@@ -46,6 +46,7 @@ public class StorageWizardMoveProgress extends StorageWizardBase {
|
||||
final String appName = getIntent().getStringExtra(EXTRA_TITLE);
|
||||
final String volumeName = mStorage.getBestVolumeDescription(mVolume);
|
||||
|
||||
setIllustrationInternal(true);
|
||||
setHeaderText(R.string.storage_wizard_move_progress_title, appName);
|
||||
setBodyText(R.string.storage_wizard_move_progress_body, volumeName, appName);
|
||||
|
||||
|
@@ -19,7 +19,6 @@ package com.android.settings.deviceinfo;
|
||||
import android.os.Bundle;
|
||||
import android.os.storage.VolumeInfo;
|
||||
|
||||
import com.android.internal.util.Preconditions;
|
||||
import com.android.settings.R;
|
||||
|
||||
public class StorageWizardReady extends StorageWizardBase {
|
||||
@@ -39,9 +38,11 @@ public class StorageWizardReady extends StorageWizardBase {
|
||||
final VolumeInfo publicVol = findFirstVolume(VolumeInfo.TYPE_PUBLIC);
|
||||
final VolumeInfo privateVol = findFirstVolume(VolumeInfo.TYPE_PRIVATE);
|
||||
if (publicVol != null) {
|
||||
setIllustrationInternal(false);
|
||||
setBodyText(R.string.storage_wizard_ready_external_body,
|
||||
mDisk.getDescription());
|
||||
} else if (privateVol != null) {
|
||||
setIllustrationInternal(true);
|
||||
setBodyText(R.string.storage_wizard_ready_internal_body,
|
||||
mDisk.getDescription());
|
||||
}
|
||||
|
Reference in New Issue
Block a user