Beispiel #1
0
        public static void Init()
        {
            try
            {
                SharedData   = PreferenceManager.GetDefaultSharedPreferences(Application.Context);
                LastPosition = Application.Context.GetSharedPreferences("last_position", FileCreationMode.Private);
                InAppReview  = Application.Context.GetSharedPreferences("In_App_Review", FileCreationMode.Private);

                string getValue = SharedData.GetString("Night_Mode_key", string.Empty);
                ApplyTheme(getValue);

                PostService.ActionPost  = Application.Context.PackageName + ".action.ACTION_POST";
                PostService.ActionStory = Application.Context.PackageName + ".action.ACTION_STORY";

                var cdv = InitFloating.CanDrawOverlays(Application.Context);
                if (cdv)
                {
                    UserDetails.SChatHead = SharedData.GetBoolean("chatheads_key", cdv);
                }

                UserDetails.SoundControl = SharedData.GetBoolean("checkBox_PlaySound_key", true);
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Beispiel #2
0
        protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            try
            {
                base.OnActivityResult(requestCode, resultCode, data);

                if (requestCode == InitFloating.ChatHeadDataRequestCode && InitFloating.CanDrawOverlays(this))
                {
                    SettingsPrefFragment.SChatHead = true;
                    MainSettings.SharedData.Edit().PutBoolean("chatheads_key", SettingsPrefFragment.SChatHead).Commit();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Beispiel #3
0
        public void DisplayChatHeadDialog()
        {
            try
            {
                Activity?.RunOnUiThread(() =>
                {
                    try
                    {
                        if (OpenDialog && InitFloating.CanDrawOverlays(Activity))
                        {
                            return;
                        }

                        ChatHeadWindow = new Dialog(Activity, AppSettings.SetTabDarkTheme ? Resource.Style.MyTheme_Dark_Base : Resource.Style.MyTheme_Base);
                        ChatHeadWindow.SetContentView(Resource.Layout.ChatHeadDialogLayout);

                        var subTitle1       = ChatHeadWindow.FindViewById <TextView>(Resource.Id.subTitle1);
                        var btnNotNow       = ChatHeadWindow.FindViewById <TextView>(Resource.Id.notNowButton);
                        var btnGoToSettings = ChatHeadWindow.FindViewById <Button>(Resource.Id.goToSettingsButton);

                        subTitle1.Text = GetText(Resource.String.Lbl_EnableChatHead_SubTitle1) + " " + AppSettings.ApplicationName + ", " + GetText(Resource.String.Lbl_EnableChatHead_SubTitle2);

                        btnNotNow.Click       += BtnNotNowOnClick;
                        btnGoToSettings.Click += BtnGoToSettingsOnClick;

                        ChatHeadWindow.Show();

                        OpenDialog = true;
                    }
                    catch (Exception e)
                    {
                        Methods.DisplayReportResultTrack(e);
                    }
                });
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Beispiel #4
0
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            try
            {
                base.OnViewCreated(view, savedInstanceState);

                Instance = this;
                Floating = new InitFloating();
                RunCall  = false;

                //Get Value And Set Toolbar
                InitComponent(view);
                //InitToolbar();

                //new Handler(Looper.MainLooper).Post(new Runnable(GetGeneralAppData));
                SetService();
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
        //ChatHeads
        private void ChatHeadsPrefOnPreferenceChange(object sender, Preference.PreferenceChangeEventArgs e)
        {
            try
            {
                if (e.Handled)
                {
                    SwitchPreferenceCompat etp = (SwitchPreferenceCompat)sender;
                    var value = e.NewValue.ToString();
                    etp.Checked          = bool.Parse(value);
                    UserDetails.ChatHead = etp.Checked;

                    if (UserDetails.ChatHead && !InitFloating.CanDrawOverlays(ActivityContext))
                    {
                        Intent intent = new Intent(Settings.ActionManageOverlayPermission, Uri.Parse("package:" + Application.Context.PackageName));
                        ActivityContext.StartActivityForResult(intent, InitFloating.ChatHeadDataRequestCode);
                    }
                }
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
        public static void Init()
        {
            try
            {
                SharedData   = PreferenceManager.GetDefaultSharedPreferences(Application.Context);
                LastPosition = Application.Context.GetSharedPreferences("last_position", FileCreationMode.Private);

                string getValue = SharedData.GetString("Night_Mode_key", string.Empty);
                ApplyTheme(getValue);

                var cdv = InitFloating.CanDrawOverlays(Application.Context);
                if (cdv)
                {
                    SettingsPrefFragment.SChatHead = SharedData.GetBoolean("chatheads_key", cdv);
                }

                SettingsPrefFragment.SSoundControl = SharedData.GetBoolean("checkBox_PlaySound_key", true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        //On Change
        public void OnSharedPreferenceChanged(ISharedPreferences sharedPreferences, string key)
        {
            try
            {
                switch (key)
                {
                case "notifications_key":
                {
                    var getvalue = MainSettings.SharedData?.GetBoolean("notifications_key", true) ?? true;
                    NotifcationPopupPref.Checked  = getvalue;
                    UserDetails.NotificationPopup = getvalue;
                    break;
                }

                case "checkBox_PlaySound_key":
                {
                    bool getvalue = MainSettings.SharedData?.GetBoolean("checkBox_PlaySound_key", true) ?? true;
                    NotifcationPlaySoundPref.Checked = getvalue;
                    UserDetails.SoundControl         = getvalue;
                    break;
                }

                case "chatheads_key":
                {
                    bool getValue = MainSettings.SharedData?.GetBoolean("chatheads_key", InitFloating.CanDrawOverlays(ActivityContext)) ?? false;
                    ChatHeadsPref.Checked = getValue;
                    UserDetails.ChatHead  = getValue;
                    break;
                }
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }