public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = base.OnCreateView(inflater, container, savedInstanceState); SetupToolbar(view, Resource.String.prefAutoBackupTitle, true); _preferences = new PreferenceWrapper(Context); var selectLocationButton = view.FindViewById <LinearLayout>(Resource.Id.buttonSelectLocation); selectLocationButton.Click += OnSelectLocationClick; var setPasswordButton = view.FindViewById <LinearLayout>(Resource.Id.buttonSetPassword); setPasswordButton.Click += OnSetPasswordButtonClick; _locationStatusText = view.FindViewById <TextView>(Resource.Id.textLocationStatus); _passwordStatusText = view.FindViewById <TextView>(Resource.Id.textPasswordStatus); _backupNowButton = view.FindViewById <MaterialButton>(Resource.Id.buttonBackupNow); _backupNowButton.Click += OnBackupNowButtonClick; _restoreNowButton = view.FindViewById <MaterialButton>(Resource.Id.buttonRestoreNow); _restoreNowButton.Click += OnRestoreNowButtonClick; _okButton = view.FindViewById <MaterialButton>(Resource.Id.buttonOk); _okButton.Click += delegate { Dismiss(); }; void SwitchChecked(object sender, CompoundButton.CheckedChangeEventArgs args) { if (args.IsChecked) { ShowBatteryOptimisationDialog(); } } _backupEnabledSwitch = view.FindViewById <SwitchMaterial>(Resource.Id.switchBackupEnabled); _backupEnabledSwitch.CheckedChange += SwitchChecked; _restoreEnabledSwitch = view.FindViewById <SwitchMaterial>(Resource.Id.switchRestoreEnabled); _restoreEnabledSwitch.CheckedChange += SwitchChecked; UpdateLocationStatusText(); UpdateSwitchesAndTriggerButton(); if (_preferences.DatabasePasswordBackup) { setPasswordButton.Visibility = ViewStates.Gone; } else { UpdatePasswordStatusText(); } return(view); }
void DeactivateTiles() { foreach (GameObject d in movetiles) { if (d.activeSelf) { SwitchMaterial sm = d.GetComponent <SwitchMaterial>(); sm.SetNormalState(); d.SetActive(false); } } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = inflater.Inflate(Resource.Layout.sheetAutoBackupSetup, null); SetupToolbar(view, Resource.String.prefAutoBackupTitle, true); _preferences = new PreferenceWrapper(Context); var selectLocationButton = view.FindViewById <LinearLayout>(Resource.Id.buttonSelectLocation); selectLocationButton.Click += OnSelectLocationClick; var setPasswordButton = view.FindViewById <LinearLayout>(Resource.Id.buttonSetPassword); setPasswordButton.Click += OnSetPasswordButtonClick; _locationStatusText = view.FindViewById <TextView>(Resource.Id.textLocationStatus); _passwordStatusText = view.FindViewById <TextView>(Resource.Id.textPasswordStatus); _backupNowButton = view.FindViewById <MaterialButton>(Resource.Id.buttonBackupNow); _backupNowButton.Click += OnBackupNowButtonClick; _restoreNowButton = view.FindViewById <MaterialButton>(Resource.Id.buttonRestoreNow); _restoreNowButton.Click += OnRestoreNowButtonClick; _batOptimLayout = view.FindViewById <LinearLayout>(Resource.Id.layoutBatOptim); var disableBatOptimButton = view.FindViewById <MaterialButton>(Resource.Id.buttonDisableBatOptim); disableBatOptimButton.Click += OnDisableBatOptimButtonClick; _okButton = view.FindViewById <MaterialButton>(Resource.Id.buttonOk); _okButton.Click += delegate { Dismiss(); }; _backupEnabledSwitch = view.FindViewById <SwitchMaterial>(Resource.Id.switchBackupEnabled); _restoreEnabledSwitch = view.FindViewById <SwitchMaterial>(Resource.Id.switchRestoreEnabled); UpdateLocationStatusText(); UpdatePasswordStatusText(); UpdateSwitchesAndTriggerButton(); return(view); }
public override void OnInspectorGUI() { SwitchMaterial sm = serializedObject.targetObject as SwitchMaterial; EditorGUILayout.PropertyField(_mat1, new GUIContent("Material 1")); if (sm.Material1 == null && GUILayout.Button("Set material 1 as current material")) { foreach (Object targetObject in serializedObject.targetObjects) { sm = targetObject as SwitchMaterial; if (sm.Material1 == null) { sm.Material1 = sm.Renderer.sharedMaterial; } } } EditorGUILayout.PropertyField(_mat2, new GUIContent("Material 2")); EditorGUILayout.Space(); EditorGUILayout.LabelField("Set material :", EditorStyles.boldLabel); GUILayout.BeginHorizontal(); if (GUILayout.Button("Material 1")) { foreach (Object targetObject in serializedObject.targetObjects) { sm = targetObject as SwitchMaterial; sm.SetMaterial(SwitchMaterial.Type.First); } } if (GUILayout.Button("Material 2")) { foreach (Object targetObject in serializedObject.targetObjects) { sm = targetObject as SwitchMaterial; sm.SetMaterial(SwitchMaterial.Type.Second); } } GUILayout.EndHorizontal(); EditorGUILayout.LabelField("Change all materials with this script :", EditorStyles.boldLabel); GUILayout.BeginHorizontal(); sm = serializedObject.targetObject as SwitchMaterial; if (GUILayout.Button("Material 1")) { sm.SetAll(SwitchMaterial.Type.First); } if (GUILayout.Button("Material 2")) { sm.SetAll(SwitchMaterial.Type.Second); } GUILayout.EndHorizontal(); serializedObject.ApplyModifiedProperties(); }