diff options
| author | David van Tonder <david.vantonder@gmail.com> | 2012-11-15 16:48:15 -0800 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@review.cyanogenmod.com> | 2012-11-15 16:48:15 -0800 |
| commit | a0eb955991e6e6275c0276b0e651785e30d3e64a (patch) | |
| tree | d2cc8648535c08bcb308eab3a581507696cf839d | |
| parent | 57633421229a08e5d0ebe3bdae66a304b6c53b43 (diff) | |
| parent | b3d9e642a5f1d7483d579c18f74255a830aa4a2c (diff) | |
| download | android_packages_apps_CMFileManager-a0eb955991e6e6275c0276b0e651785e30d3e64a.tar.gz android_packages_apps_CMFileManager-a0eb955991e6e6275c0276b0e651785e30d3e64a.tar.bz2 android_packages_apps_CMFileManager-a0eb955991e6e6275c0276b0e651785e30d3e64a.zip | |
Merge "Issue 6624: CM File manager: Mount RW does not work if i slide the slider from ro to rw." into jellybean
| -rw-r--r-- | src/com/cyanogenmod/filemanager/ui/dialogs/FilesystemInfoDialog.java | 73 |
1 files changed, 43 insertions, 30 deletions
diff --git a/src/com/cyanogenmod/filemanager/ui/dialogs/FilesystemInfoDialog.java b/src/com/cyanogenmod/filemanager/ui/dialogs/FilesystemInfoDialog.java index 19ca2934..b9752df4 100644 --- a/src/com/cyanogenmod/filemanager/ui/dialogs/FilesystemInfoDialog.java +++ b/src/com/cyanogenmod/filemanager/ui/dialogs/FilesystemInfoDialog.java @@ -23,6 +23,8 @@ import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; +import android.widget.CompoundButton; +import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.Switch; import android.widget.TextView; @@ -46,7 +48,7 @@ import com.cyanogenmod.filemanager.util.MountPointHelper; * A class that wraps a dialog for showing information about a mount point.<br /> * This class display information like mount point name, device name, size, type, ... */ -public class FilesystemInfoDialog implements OnClickListener { +public class FilesystemInfoDialog implements OnClickListener, OnCheckedChangeListener { /** * An interface to communicate when the user change the mount state @@ -178,7 +180,7 @@ public class FilesystemInfoDialog implements OnClickListener { //Gets text views this.mSwStatus = (Switch)contentView.findViewById(R.id.filesystem_info_status); - this.mSwStatus.setOnClickListener(this); + this.mSwStatus.setOnCheckedChangeListener(this); TextView tvMountPoint = (TextView)contentView.findViewById(R.id.filesystem_info_mount_point); TextView tvDevice = (TextView)contentView.findViewById(R.id.filesystem_info_device); @@ -290,14 +292,50 @@ public class FilesystemInfoDialog implements OnClickListener { }); break; + case R.id.filesystem_info_msg: + //Change the console + boolean superuser = ConsoleBuilder.changeToPrivilegedConsole(this.mContext); + if (superuser) { + this.mInfoMsgView.setOnClickListener(null); + + // Is filesystem able to be mounted? + boolean mountAllowed = MountPointHelper.isMountAllowed(this.mMountPoint); + if (mountAllowed) { + this.mInfoMsgView.setVisibility(View.GONE); + this.mInfoMsgView.setBackground(null); + this.mSwStatus.setEnabled(true); + this.mIsMountAllowed = true; + break; + } + + // Show the message + this.mInfoMsgView.setText( + this.mContext.getString( + R.string.filesystem_info_cant_be_mounted_msg)); + this.mInfoMsgView.setVisibility(View.VISIBLE); + this.mIsMountAllowed = false; + } + break; + + default: + break; + } + } + + /** + * {@inheritDoc} + */ + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + switch (buttonView.getId()) { case R.id.filesystem_info_status: //Mount the filesystem - Switch sw = (Switch)v; + Switch sw = (Switch)buttonView; boolean ret = false; try { ret = CommandHelper.remount( this.mContext, - this.mMountPoint, sw.isChecked(), null); + this.mMountPoint, isChecked, null); //Hide warning message this.mInfoMsgView.setVisibility(View.GONE); //Communicate the mount change @@ -315,32 +353,7 @@ public class FilesystemInfoDialog implements OnClickListener { //Show warning message this.mInfoMsgView.setText(R.string.filesystem_info_mount_failed_msg); this.mInfoMsgView.setVisibility(View.VISIBLE); - sw.setChecked(!sw.isChecked()); - } - break; - - case R.id.filesystem_info_msg: - //Change the console - boolean superuser = ConsoleBuilder.changeToPrivilegedConsole(this.mContext); - if (superuser) { - this.mInfoMsgView.setOnClickListener(null); - - // Is filesystem able to be mounted? - boolean mountAllowed = MountPointHelper.isMountAllowed(this.mMountPoint); - if (mountAllowed) { - this.mInfoMsgView.setVisibility(View.GONE); - this.mInfoMsgView.setBackground(null); - this.mSwStatus.setEnabled(true); - this.mIsMountAllowed = true; - break; - } - - // Show the message - this.mInfoMsgView.setText( - this.mContext.getString( - R.string.filesystem_info_cant_be_mounted_msg)); - this.mInfoMsgView.setVisibility(View.VISIBLE); - this.mIsMountAllowed = false; + sw.setChecked(!isChecked); } break; |
