public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Android.OS.Bundle savedInstanceState) { var view = inflater.Inflate(Resource.Layout.fragment_photo, container, false); R = new fragment_photo(view); BackupLocationCell = new key_value_cell(R.backup_location_cell); BackupLocationCell.title_label.Text = GetString(Resource.String.photos_backup_location); BackupLocationCell.detail_label.Text = string.IsNullOrEmpty(Globals.Database.LoadSetting(UserSettings.PhotoBackupPrefix)) ? null : GetString(Resource.String.photos_backup_location_set); AutoBackupCell = new switch_cell(R.backup_cell); AutoBackupCell.title_label.Text = GetString(Resource.String.enable_photos_backup); AutoBackupCell.switch_button.Checked = Globals.Database.CheckSetting(UserSettings.AutoBackupPhotos, "1"); R.backup_location_cell.Click += ChangeBackupDevice; AutoBackupCell.switch_button.CheckedChange += ToggleAutoBackup; R.backup_now.Click += BackupNow; return(view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Android.OS.Bundle savedInstanceState) { var view = inflater.Inflate(Resource.Layout.fragment_settings, container, false); R = new fragment_settings(view); var privacyCell = new basic_cell(R.about_privacy_cell); privacyCell.title_label.Text = GetString(Resource.String.about_privacy); R.about_privacy_cell.Click += (o, e) => { var intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse("https://daoyehuo.com/privacy.txt")); if (intent.ResolveActivity(Context.PackageManager) != null) { StartActivity(intent); } else { Activity.ShowAlert(GetString(Resource.String.error_web_browser), GetString(Resource.String.cannot_open_browser, "https://daoyehuo.com/privacy.txt")); } }; var contactCell = new basic_cell(R.about_contact_cell); contactCell.title_label.Text = GetString(Resource.String.about_contact); R.about_contact_cell.Click += async(o, e) => { try { var builder = new StringBuilder(); builder.AppendLine($"App Version: {AppInfo.VersionString} | Build: {AppInfo.BuildString}"); builder.AppendLine($"OS: {DeviceInfo.Platform}"); builder.AppendLine($"OS Version: {DeviceInfo.VersionString}"); builder.AppendLine($"Manufacturer: {DeviceInfo.Manufacturer}"); builder.AppendLine($"Device Model: {DeviceInfo.Model}"); builder.AppendLine(string.Empty); builder.AppendLine(GetString(Resource.String.contact_mail_prompt)); var message = new EmailMessage { Subject = GetString(Resource.String.contact_mail_title), To = new List <string>(new[] { "*****@*****.**" }), Body = builder.ToString(), }; await Email.ComposeAsync(message); } catch (Xamarin.Essentials.FeatureNotSupportedException ex) { Activity.ShowAlert(GetString(Resource.String.error_email), GetString(Resource.String.cannot_send_email, "*****@*****.**")); } catch (Exception ex) { LegacySendMail(); } }; DeviceCell = new key_value_cell(R.device_cell); DeviceCell.title_label.Text = GetString(Resource.String.device_name); DeviceCell.detail_label.Text = Globals.CloudManager.PersonalClouds[0].NodeDisplayName; CloudCell = new key_value_cell(R.cloud_cell); CloudCell.title_label.Text = GetString(Resource.String.cloud_name); CloudCell.detail_label.Text = Globals.CloudManager.PersonalClouds[0].DisplayName; FileSharingCell = new switch_cell(R.file_sharing_cell); FileSharingCell.title_label.Text = GetString(Resource.String.enable_file_sharing); FileSharingCell.switch_button.Checked = Globals.Database.CheckSetting(UserSettings.EnableSharing, "1"); R.file_sharing_root.Enabled = FileSharingCell.switch_button.Checked; R.device_cell.Click += ChangeDeviceName; R.toggle_invite.Click += InviteDevices; FileSharingCell.switch_button.CheckedChange += ToggleFileSharing; R.file_sharing_root.Click += ChangeSharingRoot; R.leave_cloud.Click += LeaveCloud; return(view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Android.OS.Bundle savedInstanceState) { var view = inflater.Inflate(Resource.Layout.fragment_settings, container, false); R = new fragment_settings(view); var privacyCell = new basic_cell(R.about_privacy_cell); privacyCell.title_label.Text = GetString(Resource.String.about_privacy); R.about_privacy_cell.Click += (o, e) => { var intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse("https://daoyehuo.com/privacy.txt")); if (intent.ResolveActivity(Context.PackageManager) != null) { StartActivity(intent); } else { Activity.ShowAlert(GetString(Resource.String.error_web_browser), GetString(Resource.String.cannot_open_browser, "https://daoyehuo.com/privacy.txt")); } }; var contactCell = new basic_cell(R.about_contact_cell); contactCell.title_label.Text = GetString(Resource.String.about_contact); R.about_contact_cell.Click += (o, e) => { var intent = new Intent(Intent.ActionSendto) .SetData(Android.Net.Uri.Parse("mailto:[email protected]")) .PutExtra(Intent.ExtraEmail, new[] { "*****@*****.**" }) .PutExtra(Intent.ExtraSubject, "Personal Cloud Feedback: " + Context.GetPackageVersion()); if (intent.ResolveActivity(Context.PackageManager) != null) { StartActivity(intent); return; } intent = new Intent(Intent.ActionSend).SetType("text/plain") .PutExtra(Intent.ExtraEmail, new[] { "*****@*****.**" }) .PutExtra(Intent.ExtraSubject, "Personal Cloud Feedback: " + Context.GetPackageVersion()); if (intent.ResolveActivity(Context.PackageManager) != null) { StartActivity(intent); } else { Activity.ShowAlert(GetString(Resource.String.error_email), GetString(Resource.String.cannot_send_email, "*****@*****.**")); } }; DeviceCell = new key_value_cell(R.device_cell); DeviceCell.title_label.Text = GetString(Resource.String.device_name); DeviceCell.detail_label.Text = Globals.CloudManager.PersonalClouds[0].NodeDisplayName; CloudCell = new key_value_cell(R.cloud_cell); CloudCell.title_label.Text = GetString(Resource.String.cloud_name); CloudCell.detail_label.Text = Globals.CloudManager.PersonalClouds[0].DisplayName; FileSharingCell = new switch_cell(R.file_sharing_cell); FileSharingCell.title_label.Text = GetString(Resource.String.enable_file_sharing); FileSharingCell.switch_button.Checked = Globals.Database.CheckSetting(UserSettings.EnableSharing, "1"); R.file_sharing_root.Enabled = FileSharingCell.switch_button.Checked; BackupLocationCell = new key_value_cell(R.backup_location_cell); BackupLocationCell.title_label.Text = GetString(Resource.String.photos_backup_location); BackupLocationCell.detail_label.Text = string.IsNullOrEmpty(Globals.Database.LoadSetting(UserSettings.PhotoBackupPrefix)) ? null : GetString(Resource.String.photos_backup_location_set); AutoBackupCell = new switch_cell(R.backup_cell); AutoBackupCell.title_label.Text = GetString(Resource.String.enable_photos_backup); AutoBackupCell.switch_button.Checked = Globals.Database.CheckSetting(UserSettings.AutoBackupPhotos, "1"); R.device_cell.Click += ChangeDeviceName; R.toggle_invite.Click += InviteDevices; FileSharingCell.switch_button.CheckedChange += ToggleFileSharing; R.file_sharing_root.Click += ChangeSharingRoot; R.backup_location_cell.Click += ChangeBackupDevice; AutoBackupCell.switch_button.CheckedChange += ToggleAutoBackup; R.leave_cloud.Click += LeaveCloud; return(view); }