public override void OnCreatePreferences(Bundle savedInstanceState, string rootKey) { AddPreferencesFromResource(Resource.Xml.about); PreferenceManager.SetDefaultValues(Application.Context, Resource.Xml.about, false); Preference githubprojectpreference = FindPreference("contributetoproject"); githubprojectpreference.PreferenceClick += Githubprojectpreference_PreferenceClick; }
public override void OnResume() { base.OnResume(); GetOfflineVersions(); PreferenceManager.SetDefaultValues(Activity, Resource.Xml.fragment_navigation_preferences, false); }
private void LoadDefaultSettings() { PreferenceManager.SetDefaultValues(Application.Context, Resource.Xml.awake_prefs, true); PreferenceManager.SetDefaultValues(Application.Context, Resource.Xml.lockscreen_prefs, true); PreferenceManager.SetDefaultValues(Application.Context, Resource.Xml.music_widget_prefs, true); PreferenceManager.SetDefaultValues(Application.Context, Resource.Xml.notification_prefs, true); PreferenceManager.SetDefaultValues(Application.Context, "weatherpreferences", (int)FileCreationMode.Private, Resource.Xml.weather_widget_prefs, true); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); AddPreferencesFromResource(Resource.Xml.preferences); PreferenceManager.SetDefaultValues(this, Resource.Xml.preferences, false); for (int i = 0; i < PreferenceScreen.PreferenceCount; i++) { InitSummary(PreferenceScreen.GetPreference(i)); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); PreferenceManager.SetDefaultValues(this, Resource.Xml.Preferences, false); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); FragmentManager.BeginTransaction().Replace(Resource.Id.Content, new SettingsFragment()).Commit(); }
protected override void OnCreate(Bundle savedInstance) { base.OnCreate(savedInstance); SetContentView(R.Layouts.MainLayout); main = this; PreferenceManager.SetDefaultValues(this, R.Xmls.preferences, false); ISharedPreferences sharedPrefs = PreferenceManager.GetDefaultSharedPreferences(this); sharedPrefs.RegisterOnSharedPreferenceChangeListener(this); var btnTopPilots = FindViewById <Button>(R.Ids.btnPilotStats); btnTopPilots.Click += delegate { var topPilotsIntent = new Intent(this, typeof(TopPilotsActivity)); StartActivity(topPilotsIntent); }; var btnOnlinePilots = FindViewById <Button>(R.Ids.btnOnlinePilots); btnOnlinePilots.Click += delegate { var onlinePilotsIntent = new Intent(this, typeof(OnlinePilotsActivity)); StartActivity(onlinePilotsIntent); }; var btnStationInventories = FindViewById <Button>(R.Ids.btnStationInventories); btnStationInventories.Click += delegate { var stationInventoriesIntent = new Intent(this, typeof(StationInventoryActivity)); StartActivity(stationInventoriesIntent); }; var btnItemStocks = FindViewById <Button>(R.Ids.btnItemStocks); btnItemStocks.Click += delegate { var itemStocksIntent = new Intent(this, typeof(ItemStocksActivity)); StartActivity(itemStocksIntent); }; var btnMyPilotStats = FindViewById <Button>(R.Ids.btnMyPilotStats); string pilotName = sharedPrefs.GetString("pref_pilotname", ""); OnSharedPreferenceChanged(sharedPrefs, "pref_pilotname"); btnMyPilotStats.Click += delegate { var pilotDetails = new Intent(this, typeof(PilotDetailActivity)); string curPilotName = sharedPrefs.GetString("pref_pilotname", ""); pilotDetails.PutExtra("pilotID", long.MinValue); pilotDetails.PutExtra("pilotName", curPilotName); StartActivity(pilotDetails); }; CheckForUpdate(); }
//------------------------------------------------------------------------------ protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Context context = global::Android.App.Application.Context; PreferenceManager.SetDefaultValues(context, Resource.Xml.preferences, false); SetContentView(Resource.Layout.Main); s_TextView.Target = FindViewById(Resource.Id.textView); UpdatePropertiesText(); ((MainApplication)Application).SetCognitoSyncListerner(this); m_CallbackManager = CallbackManagerFactory.Create(); LoginManager.Instance.RegisterCallback(m_CallbackManager, new FacebookCallback <LoginResult>() { HandleSuccess = loginResult => { var accessToken = loginResult.AccessToken; UpdateCredentials(accessToken.Token); SynchronizeSettings(); }, HandleCancel = () => { UpdateCredentials(string.Empty); }, HandleError = loginError => { UpdateCredentials(string.Empty); } }); LoginManager.Instance.LogInWithReadPermissions(this, new List <string> { "public_profile" }); Button changesPrefsButton = FindViewById <Button>(Resource.Id.changePrefsButton); changesPrefsButton.Click += delegate { StartActivity(typeof(CognitoSyncSettingsActivity)); }; Button synchronizeSettingsButton = FindViewById <Button>(Resource.Id.synchronize_settings); synchronizeSettingsButton.Click += delegate { SynchronizeSettings(); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); System.Console.WriteLine("AnnotationActivity >> OnCreate"); app = this; try { if (FindViewById(Resource.Id.lines) != null) { AnnTask.UpdateVars(this); CheckIsShared(); return; } curFilePath = ""; isFirstAnnotation = true; isFirstFileAnnotation = true; PreferenceManager.SetDefaultValues(this, Resource.Xml.preferences, false); sharedPrefs = PreferenceManager.GetDefaultSharedPreferences(this); SetContentView(Resource.Layout.MainActivity); mToolbar = (Toolbar)FindViewById(Resource.Id.toolbar); // Attaching the layout to the toolbar object SetSupportActionBar(mToolbar); SupportActionBar.SetDisplayShowHomeEnabled(true); SupportActionBar.SetIcon(Resource.Drawable.logo_toolbar); wPopup = new WordPopup(this); testView = new LineView(this); testView.UpdateVars(); lines = new List <List <object> >(); linesRecyclerView = (CustomRecyclerView)FindViewById(Resource.Id.lines); linesRecyclerView.mMainActivity = this; linesLayoutManager = new LinearLayoutManager(this); linesRecyclerView.SetLayoutManager(linesLayoutManager); linesAdapter = new AnnListAdapter(this, this.lines, linesRecyclerView, wPopup); linesRecyclerView.SetAdapter(linesAdapter); defaultItemAnimator = linesRecyclerView.GetItemAnimator(); linesRecyclerView.AddOnScrollListener(new RecyclerViewOnScrollListener(this)); mBookmarks = new List <Bookmark>(); mFoundBookmarks = new List <Bookmark>(); } catch (Exception e) { Toast.MakeText(this, "Error: " + e.Message, ToastLength.Long).Show(); } }
protected override void OnCreate(Bundle bundle) { /*base.OnCreate (bundle); * SetContentView(Resource.Layout.CameraView); * camera = (SurfaceView)FindViewById(Resource.Id.smallcameraview); * camera.Holder.SetType(SurfaceType.PushBuffers); * holder = camera.Holder; * Session.setSurfaceHolder(holder);*/ base.OnCreate(bundle); base.RequestedOrientation = Android.Content.PM.ScreenOrientation.Portrait; SetContentView(Resource.Layout.Main); startButton = FindViewById <ImageButton> (Resource.Id.startButton); connectButton = FindViewById <ImageButton> (Resource.Id.connectToClientButton); settingsButton = FindViewById <ImageButton> (Resource.Id.settingsButton); connectLight = FindViewById <ImageView> (Resource.Id.connectLight); streamingLight = FindViewById <ImageView> (Resource.Id.streamingLight); connectText = FindViewById <TextView> (Resource.Id.connectStatus); streamText = FindViewById <TextView> (Resource.Id.streamingStatus); logView = FindViewById <TextView> (Resource.Id.log); scrollView = FindViewById <ScrollView> (Resource.Id.logScrollView); scrollView.FullScroll(FocusSearchDirection.Down); logView.SetText(savedText, TextView.BufferType.Editable); scrollView.ScrollTo(0, logView.Height); scrollView.FullScroll(FocusSearchDirection.Down); camera = (SurfaceView)FindViewById(Resource.Id.smallcameraview); camera.Holder.SetType(SurfaceType.PushBuffers); //holder = camera.Holder; Session.SetSurfaceHolder(camera.Holder); startButton.Click += OnStartClicked; connectButton.Click += OnConnectToClientClicked; settingsButton.Click += OnStettingsClicked; //this should be set based on something DisableButton(connectButton); EnableButton(settingsButton); SetStartICon(); SetDisableLight(connectLight); SetDisableLight(streamingLight); connectText.Text = "Client is not connected"; streamText.Text = "Not streaming"; PreferenceManager.SetDefaultValues(this, Resource.Layout.Settings, false); }
protected override async void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); PreferenceManager.SetDefaultValues(this, Resource.Xml.Preferences, false); _remote = new PTZRemote(); AttachHandlers(); await ConnectToRelay(); }
private void ReadPreferenceSetting() { // Sets default values only once, first time this is called. // The third argument is a boolean that indicates whether the default values should be set more than once. // When false, the system sets the default values only if this method has never been called in the past. PreferenceManager.SetDefaultValues(this, Resource.Xml.preferences_compat, false); PreferenceManager.SetDefaultValues(this, Resource.Xml.pref_group_accounts, false); PreferenceManager.SetDefaultValues(this, Resource.Xml.pref_group_general, false); PreferenceManager.SetDefaultValues(this, Resource.Xml.pref_group_notifications, false); // Read the settings from the shared preferences var sharedPref = PreferenceManager.GetDefaultSharedPreferences(this); var switchPref = sharedPref.GetBoolean(SettingsCompatActivity.KEY_PREF_EXAMPLE_SWITCH, false); }
public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); AddPreferencesFromResource(Resource.Xml.prefs); PreferenceManager.SetDefaultValues(Application.Context, Resource.Xml.prefs, false); Preference wallpapersettingspreference = FindPreference("wallpapersettings"); Preference githubprojectpreference = FindPreference("contributetoproject"); Preference blacklistpreference = FindPreference("blacklist"); Preference weathersettingspreference = FindPreference("weathersettings"); wallpapersettingspreference.PreferenceClick += WallpaperSettingsPreference_PreferenceClick; blacklistpreference.PreferenceClick += Blacklistpreference_PreferenceClick; githubprojectpreference.PreferenceClick += Githubprojectpreference_PreferenceClick; weathersettingspreference.PreferenceClick += Weathersettingspreference_PreferenceClick; }
public FgoPreferences(Context Context) { _context = Context; DefaultPrefs = PreferenceManager.GetDefaultSharedPreferences(Context); if (!DefaultPrefs.GetBoolean(PreferenceManager.KeyHasSetDefaultValues, false)) { PreferenceManager.SetDefaultValues(Context, Resource.Xml.main_preferences, true); PreferenceManager.SetDefaultValues(Context, Resource.Xml.app_preferences, true); PreferenceManager.SetDefaultValues(Context, Resource.Xml.autoskill_preferences, true); PreferenceManager.SetDefaultValues(Context, Resource.Xml.refill_preferences, true); PreferenceManager.SetDefaultValues(Context, Resource.Xml.support_preferences, true); } Refill = new FgoRefillPreferences(this); Support = new FgoSupportPreferences(this, Context); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); // Set default values defined in preferences when the Activity starts PreferenceManager.SetDefaultValues(this, Resource.Xml.Preferences, false); ActionBar.NavigationMode = ActionBarNavigationMode.Tabs; var generatorTab = ActionBar.NewTab(); generatorTab.SetText("generator"); generatorTab.TabSelected += (object sender, ActionBar.TabEventArgs e) => { e.FragmentTransaction.Replace(Android.Resource.Id.Content, new ChordGeneratorFragment()); }; ActionBar.AddTab(generatorTab); // NOTE: this line of code must go after the event handler (throws exception - no callback) var trainerTab = ActionBar.NewTab(); trainerTab.SetText("trainer"); trainerTab.TabSelected += (object sender, ActionBar.TabEventArgs e) => { e.FragmentTransaction.Replace(Android.Resource.Id.Content, new ChordTrainerFragment()); }; ActionBar.AddTab(trainerTab); // Keep the current tab selected after rotation if (bundle != null) { int currentTab = bundle.GetInt("currentTab"); if (currentTab == 0) { ActionBar.SelectTab(generatorTab); } else { ActionBar.SelectTab(trainerTab); } } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); PreferenceManager.SetDefaultValues(this, Resource.Xml.preferences, false); _pager = FindViewById <ViewPager>(Resource.Id.pager); _pager.Adapter = new SectionsPagerAdapter(SupportFragmentManager); _pager.SetOnPageChangeListener(this); ActionBar.NavigationMode = ActionBarNavigationMode.Tabs; ActionBar.AddTab(ActionBar.NewTab().SetText("New").SetTabListener(this).SetTag("New")); ActionBar.AddTab(ActionBar.NewTab().SetText("Favorites").SetTabListener(this).SetTag("Favorites")); _serviceConnection = new InAppBillingServiceConnection(this, PublicKey); _serviceConnection.OnConnected += HandleOnConnected; _serviceConnection.Connect(); }
//------------------------------------------------------------------------------ protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Context context = global::Android.App.Application.Context; PreferenceManager.SetDefaultValues(context, Resource.Xml.preferences, false); SetContentView(Resource.Layout.Main); s_TextView.Target = FindViewById(Resource.Id.textView); UpdatePropertiesText(); Button button = FindViewById <Button>(Resource.Id.changePrefsButton); button.Click += delegate { StartActivity(typeof(DynamicPreferencesActivity)); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); PreferenceManager.SetDefaultValues(this, Resource.Xml.preferences, false); mLightOrganReceiver.OnReceiveImpl = (context, intent) => { float b = intent.GetFloatExtra(MusicService.BassLevel, 0); float m = intent.GetFloatExtra(MusicService.MidLevel, 0); float t = intent.GetFloatExtra(MusicService.TrebleLevel, 0); SetLight(Resource.Id.bass_light, b); SetLight(Resource.Id.mid_light, m); SetLight(Resource.Id.treble_light, t); //Title = "b=" + b + " m=" + m + " t=" + t; }; }
/// <summary> /// Called when the activity is starting. /// </summary> /// <param name="savedInstanceState"> /// If the activity is being re-initialized after previously being shut down then /// this <see cref="Bundle"/> contains the data it most recently supplied in /// <see cref="Android.App.Activity.OnSaveInstanceState(Android.OS.Bundle)"/>. /// Note: Otherwise it is <b>null</b>. /// </param> protected override void OnCreate(Bundle savedInstanceState) { // subscribe to the unhandled exception events AndroidEnvironment.UnhandledExceptionRaiser += AndroidEnvironment_UnhandledExceptionRaiser; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; base.OnCreate(savedInstanceState); // add "fullscreen" window flag Window.AddFlags(WindowManagerFlags.Fullscreen); // set our view from the "main" layout resource SetContentView(Resource.Layout.main); try { // set the default values from an XML preference file PreferenceManager.SetDefaultValues(this, Resource.Xml.settings_page, false); // get preferences ISharedPreferences preferences = PreferenceManager.GetDefaultSharedPreferences(this); // get the language name string languageToLoad = preferences.GetString("list_languages", "auto"); // if language name is not auto if (languageToLoad != "auto") { // set choosen locale Locale locale = new Locale(languageToLoad); Locale.Default = locale; Configuration config = new Configuration(); config.Locale = locale; BaseContext.Resources.UpdateConfiguration(config, BaseContext.Resources.DisplayMetrics); this.SetContentView(Resource.Layout.main); } } catch { } SupportActionBar.SetHomeButtonEnabled(false); SupportActionBar.SetDisplayHomeAsUpEnabled(false); // check licence CheckLicense(); // if Android version is equal or higher than 6.0 (API 23) if (Android.OS.Build.VERSION.SdkInt >= BuildVersionCodes.M) { if (CheckSelfPermission(Android.Manifest.Permission.Camera) != Permission.Granted || CheckSelfPermission(Android.Manifest.Permission.Flashlight) != Permission.Granted || CheckSelfPermission(Android.Manifest.Permission.Vibrate) != Permission.Granted) { RequestPermissions( new string[] { Android.Manifest.Permission.Camera, Android.Manifest.Permission.Flashlight, Android.Manifest.Permission.Vibrate }, PERMISSION_REQUEST_CODE); } else { _isCameraPermissionGranted = true; // create fragments _barcodeScannerFragment = new BarcodeScannerFragment(this, RecognizedBarcodes, true, true); _historyFragment = new HistoryFragment(this); _settingsFragment = new SettingsFragment(this); // show barcode scanner fragment SwitchToBarcodeScanner(null); } } // if Android version is less than 6.0 (API 23) else { _isCameraPermissionGranted = true; // create fragments _barcodeScannerFragment = new BarcodeScannerFragment(this, RecognizedBarcodes, true, true); _historyFragment = new HistoryFragment(this); _settingsFragment = new SettingsFragment(this); // show barcode scanner fragment SwitchToBarcodeScanner(null); } }
protected override async void OnCreate(Bundle bundle) { base.OnCreate(bundle); Log.SetLogger(new LogAndroid()); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // Set support action bar based on toolbar from layout XML var mainToolbar = FindViewById <Toolbar>(Resource.Id.mainToolbar); SetSupportActionBar(mainToolbar); // Set flag to allow status bar colour to be managed by this activity. Window.SetFlags(WindowManagerFlags.DrawsSystemBarBackgrounds, WindowManagerFlags.DrawsSystemBarBackgrounds); Settings settings = new Settings(ApplicationContext); var statusLabel = FindViewById <TextView>(Resource.Id.loginStatus); var enabled = FindViewById <CheckBox>(Resource.Id.checkEnable); var buttonNotifications = FindViewById <Button>(Resource.Id.buttonNotifications); var login = FindViewById <TextView>(Resource.Id.editLogin); var password = FindViewById <TextView>(Resource.Id.editPassword); // First run initialisation. if (!settings.afterFirstRun) { // Set default values from NotificationPreferences.xml PreferenceManager.SetDefaultValues(ApplicationContext, Resource.Xml.NotificationPreferences, true); // If notification sound is null, set it to the system-default sound if (settings.downloadSound == null) { settings.downloadSound = RingtoneManager.GetDefaultUri(RingtoneType.Notification).ToString(); } if (settings.uploadSound == null) { settings.uploadSound = RingtoneManager.GetDefaultUri(RingtoneType.Notification).ToString(); } // Indicate that first run init is complete. settings.afterFirstRun = true; settings.commit(); } // Load up defaults from Settings. enabled.Checked = settings.enabled; login.Text = settings.userName; password.Text = settings.password; if (settings.authToken.IsNullOrEmpty()) { statusLabel.Text = "Not logged in"; } else { statusLabel.Text = "Logged in as " + settings.userName; } // Wire up UI events. enabled.CheckedChange += delegate { bool oldSetting = settings.enabled; settings.enabled = enabled.Checked; settings.commit(); if (!oldSetting) { LifeSharpService.Start(this); } }; buttonNotifications.Click += delegate { Intent intent = new Intent(this, typeof(ConfigureNotificationsActivity)); StartActivity(intent); }; var defaultStreamSpinner = FindViewById <Spinner>(Resource.Id.defaultStream); await fillStreams(settings); defaultStreamSpinner.ItemSelected += delegate { if (_streamIds == null) { return; } settings.defaultStream = _streamIds[defaultStreamSpinner.SelectedItemPosition]; settings.commit(); Log.Info("LifeSharp", "Setting new default stream to {0}", settings.defaultStream); }; Button button = FindViewById <Button>(Resource.Id.buttonLogin); button.Click += async delegate { settings.userName = login.Text; settings.password = password.Text; settings.commit(); Log.Info("LifeSharp", "Logging in with user {0} and password {1}", login.Text, password.Text); try { string result = await Network.Login(settings); if (result == null) { statusLabel.Text = "Log in failed"; settings.authToken = null; enabled.Checked = false; } else { statusLabel.Text = "Logged in successfully"; settings.authToken = result; enabled.Checked = true; } // Get our user ID. Protocol.LoginInfo loginInfo = await Network.GetLoginInfo(result, settings.userName); if (loginInfo.succeeded()) { settings.userId = loginInfo.id; // Commit so that user ID is available to upcoming fillStreams() call. settings.commit(); } // Obtain list of streams owned by user. await fillStreams(settings); settings.commit(); // This won't have already happened if we didn't have login info. LifeSharpService.Start(this); } catch (Exception ex) { Log.Info("LifeSharp", "Can't contact server: {0}", ex); statusLabel.Text = "Exception during login"; } }; button = FindViewById <Button>(Resource.Id.buttonGallery); button.Click += delegate(object sender, EventArgs e) { StartActivity(typeof(GalleryActivity)); }; ReceiveBoot.CompleteStartup(this, settings); }
protected override void OnStart() { base.OnStart(); PreferenceManager.SetDefaultValues(this, Resource.Xml.Preferences, false); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); PreferenceManager.SetDefaultValues(this, Resource.Xml.preferences, false); }