Add remote input setting to redaction interstitial

Bug: 26440855
Change-Id: I8cd16074c63778defab767096261bcc99956b8fc
This commit is contained in:
Adrian Roos
2016-03-02 15:37:52 -08:00
parent 20f53b7cbb
commit 6f4edf822f
2 changed files with 37 additions and 1 deletions

View File

@@ -65,4 +65,14 @@
</RadioGroup>
<CheckBox
android:id="@+id/lockscreen_remote_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/redaction_vertical_margins"
android:layout_marginStart="?android:attr/listPreferredItemPaddingStart"
android:layout_marginEnd="?android:attr/listPreferredItemPaddingEnd"
android:text="@string/lockscreen_remote_input"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>

View File

@@ -24,6 +24,8 @@ import android.provider.Settings;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
@@ -74,11 +76,12 @@ public class RedactionInterstitial extends SettingsActivity {
}
public static class RedactionInterstitialFragment extends SettingsPreferenceFragment
implements RadioGroup.OnCheckedChangeListener {
implements RadioGroup.OnCheckedChangeListener, CompoundButton.OnCheckedChangeListener {
private RadioGroup mRadioGroup;
private RestrictedRadioButton mShowAllButton;
private RestrictedRadioButton mRedactSensitiveButton;
private CheckBox mRemoteInputCheckbox;
private int mUserId;
@Override
@@ -99,6 +102,8 @@ public class RedactionInterstitial extends SettingsActivity {
mShowAllButton = (RestrictedRadioButton) view.findViewById(R.id.show_all);
mRedactSensitiveButton =
(RestrictedRadioButton) view.findViewById(R.id.redact_sensitive);
mRemoteInputCheckbox = (CheckBox) view.findViewById(R.id.lockscreen_remote_input);
mRemoteInputCheckbox.setOnCheckedChangeListener(this);
mRadioGroup.setOnCheckedChangeListener(this);
mUserId = Utils.getUserIdFromBundle(
@@ -150,6 +155,12 @@ public class RedactionInterstitial extends SettingsActivity {
}
mRadioGroup.check(checkedButtonId);
boolean allowRemoteInput = Settings.Secure.getIntForUser(getContentResolver(),
Settings.Secure.LOCK_SCREEN_ALLOW_REMOTE_INPUT, 0, mUserId) != 0;
mRemoteInputCheckbox.setChecked(!allowRemoteInput);
updateRemoteInputCheckboxVisibility();
}
@Override
@@ -161,6 +172,21 @@ public class RedactionInterstitial extends SettingsActivity {
Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, show ? 1 : 0, mUserId);
Settings.Secure.putIntForUser(getContentResolver(),
Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, enabled ? 1 : 0, mUserId);
updateRemoteInputCheckboxVisibility();
}
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean checked) {
if (buttonView == mRemoteInputCheckbox) {
Settings.Secure.putIntForUser(getContentResolver(),
Settings.Secure.LOCK_SCREEN_ALLOW_REMOTE_INPUT, checked ? 0 : 1, mUserId);
}
}
private void updateRemoteInputCheckboxVisibility() {
boolean visible = mRadioGroup.getCheckedRadioButtonId() == R.id.show_all;
mRemoteInputCheckbox.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
}
}
}