Exemplo n.º 1
0
        protected override void OnResume()
        {
            try
            {
                base.OnResume();
                SearchViewBar.ClearFocus();

                //Add Event
                if (Settings.Show_Story)
                {
                    Btn_story.Click += CreateStories_OnClick;
                }

                FloatingActionButton.Click += Btn_AddPsot_OnClick;
            }
            catch (Exception exception)
            {
                Crashes.TrackError(exception);
            }
        }
Exemplo n.º 2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                //Window.SetFlags(WindowManagerFlags.HardwareAccelerated, WindowManagerFlags.HardwareAccelerated);
                base.OnCreate(savedInstanceState);

                // Check if we're running on Android 5.0 or higher
                if ((int)Build.VERSION.SdkInt < 23)
                {
                }
                else
                {
                    //Window.AddFlags(WindowManagerFlags.LayoutNoLimits);
                    Window.AddFlags(WindowManagerFlags.TranslucentNavigation);
                }

                IMethods.IApp.FullScreenApp(this);


                //Create your application here
                var view = MyContextWrapper.GetContentView(this, Settings.Lang, Resource.Layout.Tabbed_Main_Layout);
                if (view != null)
                {
                    SetContentView(view);
                }
                else
                {
                    SetContentView(Resource.Layout.Tabbed_Main_Layout);
                }


                //App Center Errors
                //AppCenter.Start("adb501d0-8566-4078-8ae6-30fb14639509", typeof(Analytics), typeof(Crashes));

                navigationTabBar = FindViewById <NavigationTabBar>(Resource.Id.ntb_horizontal);

                viewPager     = FindViewById <ViewPager>(Resource.Id.vp_horizontal_ntb);
                Tabadapter    = new Main_Tab_Adapter(SupportFragmentManager);
                SearchViewBar = FindViewById <SearchView>(Resource.Id.searchView);
                if (SearchViewBar != null)
                {
                    SearchViewBar.SetIconifiedByDefault(false);
                    SearchViewBar.SetOnClickListener(this);
                    SearchViewBar.SetOnSearchClickListener(this);
                    SearchViewBar.SetOnQueryTextFocusChangeListener(this);
                }

                FloatingActionButton            = FindViewById <FloatingActionButton>(Resource.Id.floatingActionButtonView);
                FloatingActionButton.Visibility = ViewStates.Invisible;

                Btn_story = FindViewById <ImageButton>(Resource.Id.storybutton);

                if (!Directory.Exists(IMethods.IPath.FolderDcimStory))
                {
                    Directory.CreateDirectory(IMethods.IPath.FolderDcimStory);
                }

                if (Settings.Show_Story)
                {
                    Btn_story.Visibility = ViewStates.Visible;
                }
                else
                {
                    Btn_story.Visibility = ViewStates.Gone;
                }

                Models = new JavaList <NavigationTabBar.Model>();
                AddFargmentsTabbs();


                JobRescheduble = new JobRescheduble(this, 10000);
                JobRescheduble.StartJob();

                Window.SetSoftInputMode(SoftInput.StateAlwaysHidden);

                // Check if we're running on Android 5.0 or higher
                if ((int)Build.VERSION.SdkInt < 23)
                {
                }
                else
                {
                    if (CheckSelfPermission(Manifest.Permission.ReadExternalStorage) == Permission.Granted &&
                        CheckSelfPermission(Manifest.Permission.WriteExternalStorage) == Permission.Granted &&
                        CheckSelfPermission(Manifest.Permission.Camera) == Permission.Granted &&
                        CheckSelfPermission(Manifest.Permission.AccessFineLocation) == Permission.Granted &&
                        CheckSelfPermission(Manifest.Permission.AccessCoarseLocation) == Permission.Granted)
                    {
                    }
                    else
                    {
                        RequestPermissions(new[]
                        {
                            Manifest.Permission.ReadExternalStorage,
                            Manifest.Permission.WriteExternalStorage,
                            Manifest.Permission.Camera,
                            Manifest.Permission.AccessFineLocation,
                            Manifest.Permission.AccessCoarseLocation
                        }, 101);
                    }
                }

                //IMethods.IApp.GetKeyHashesConfigured(this);
            }
            catch (Exception exception)
            {
                Crashes.TrackError(exception);
            }
        }
Exemplo n.º 3
0
        //Result
        protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            try
            {
                base.OnActivityResult(requestCode, resultCode, data);

                //If its from Camera or Gallery
                if (requestCode == CropImage.CropImageActivityRequestCode)
                {
                    var result = CropImage.GetActivityResult(data);

                    if (resultCode == Result.Ok)
                    {
                        var imageUri = CropImage.GetPickImageResultUri(this, data);

                        if (result.IsSuccessful)
                        {
                            var resultUri = result.Uri;

                            if (!string.IsNullOrEmpty(resultUri.Path))
                            {
                                var intent = new Intent(this, typeof(AddStory_Activity));
                                intent.PutExtra("Uri", resultUri.Path);
                                intent.PutExtra("Type", "image");
                                StartActivity(intent);
                            }
                            else
                            {
                                Toast.MakeText(this, GetText(Resource.String.Lbl_something_went_wrong),
                                               ToastLength.Long).Show();
                            }
                        }
                    }
                }
                else if (requestCode == CropImage.CropImageActivityResultErrorCode)
                {
                    var       result = CropImage.GetActivityResult(data);
                    Exception error  = result.Error;
                }
                else if (requestCode == 100 && resultCode == Result.Ok)
                {
                    var FullPath = IMethods.MultiMedia.GetRealVideoPathFromURI(data.Data);
                    if (!string.IsNullOrEmpty(FullPath))
                    {
                        var intent = new Intent(this, typeof(AddStory_Activity));
                        intent.PutExtra("Uri", FullPath);
                        intent.PutExtra("Type", "video");
                        StartActivity(intent);
                    }
                    else
                    {
                        Toast.MakeText(this, GetText(Resource.String.Lbl_something_went_wrong), ToastLength.Long)
                        .Show();
                    }
                }
                else if (requestCode == 2 && resultCode == Result.Ok)
                {
                    SearchViewBar.Focusable            = false;
                    SearchViewBar.FocusableInTouchMode = false;
                    SearchViewBar.ClearFocus();
                }
                else if (requestCode == 2500)
                {
                    News_Feed_Tab.HybridController.EvaluateJavascript("Wo_GetNewPosts();");
                }
                else if (requestCode == 3500)
                {
                    string ID   = data.GetStringExtra("PostId");
                    string Text = data.GetStringExtra("PostText");

                    string JavaCode = "$('#post-' + " + ID + ").find('#edit-post').attr('onclick', '{*type*:*edit_post*,*post_id*:*" + ID + "*,*edit_text*:*" + Text + "*}');";
                    string Decode   = JavaCode.Replace("*", "&quot;");

                    News_Feed_Tab.HybridController.EvaluateJavascript(Decode);
                    News_Feed_Tab.HybridController.EvaluateJavascript("$('#post-' + " + ID + ").find('.post-description p').html('" + Text + "');");
                }
            }
            catch (Exception e)
            {
                Crashes.TrackError(e);
            }
        }