Add support for showing the admin disabling settings.
For settings disabled by user restrictions show the user a lock icon and allow them to click to find more info. Bug: 22543585 Change-Id: Ie8b02ac26f2b22db386a9044f3c6570098f6e14b
This commit is contained in:
committed by
Kenny Guy
parent
f467c0acac
commit
9159fe9af8
73
src/com/android/settings/ShowAdminSupportDetailsDialog.java
Normal file
73
src/com/android/settings/ShowAdminSupportDetailsDialog.java
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (C) 2015 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class ShowAdminSupportDetailsDialog extends Activity
|
||||
implements DialogInterface.OnDismissListener {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
View rootView = LayoutInflater.from(this).inflate(
|
||||
R.layout.admin_support_details_dialog, null);
|
||||
setAdminSupportDetails(rootView);
|
||||
|
||||
new AlertDialog.Builder(this)
|
||||
.setView(rootView)
|
||||
.setPositiveButton(R.string.okay, null)
|
||||
.setOnDismissListener(this)
|
||||
.show();
|
||||
}
|
||||
|
||||
private void setAdminSupportDetails(View root) {
|
||||
CharSequence adminDisabledMsg = getString(R.string.disabled_by_admin_msg,
|
||||
getString(R.string.default_organisation_name));
|
||||
TextView textView = (TextView) root.findViewById(R.id.disabled_by_admin_msg);
|
||||
textView.setText(adminDisabledMsg);
|
||||
|
||||
CharSequence adminSupportDetails = getString(R.string.default_admin_support_msg);
|
||||
textView = (TextView) root.findViewById(R.id.admin_support_msg);
|
||||
textView.setText(adminSupportDetails);
|
||||
|
||||
root.findViewById(R.id.admins_policies_list).setOnClickListener(
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent();
|
||||
intent.setClass(ShowAdminSupportDetailsDialog.this,
|
||||
Settings.DeviceAdminSettingsActivity.class);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
finish();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user