public CustomSeekBarPreference(Context context, IAttributeSet attrs, int defStyleAttr) : base(context, attrs, defStyleAttr) { //if (LayoutResource <= 0) // LayoutResource = Android.Resource.Layout.sbp_preference_dialog_seekbar; LayoutResource = Resource.Layout.custom_preference_widget_seekbar; SeekBar = new AppCompatSeekBar(context, attrs) { Id = Resource.Id.seekbar, Enabled = true }; _needDispose = true; var attr = context.ObtainStyledAttributes(attrs, Resource.Styleable.CustomSeekBarPreference); try { Max = attr.GetInt(Resource.Styleable.CustomSeekBarPreference_maximum, SeekBar.Max); MinTitle = attr.GetString(Resource.Styleable.CustomSeekBarPreference_minTitle); MaxTitle = attr.GetString(Resource.Styleable.CustomSeekBarPreference_maxTitle); } finally { attr?.Recycle(); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.Inflate(Resource.Layout.fragment_animation, container, false); this.toolbar = view.FindViewById <Toolbar>(Resource.Id.toolbar); this.instructionsContainer = view.FindViewById <ViewGroup>(Resource.Id.instructions); this.animationContainer = view.FindViewById <ViewGroup>(Resource.Id.animation_container); this.animationView = view.FindViewById <LottieAnimationView>(Resource.Id.animation_view); this.seekBar = view.FindViewById <AppCompatSeekBar>(Resource.Id.seek_bar); this.invertButton = view.FindViewById <ImageButton>(Resource.Id.invert_colors); this.playButton = view.FindViewById <ImageButton>(Resource.Id.play_button); this.scaleSeekBar = view.FindViewById <AppCompatSeekBar>(Resource.Id.scale_seek_bar); this.scaleTextView = view.FindViewById <TextView>(Resource.Id.scale_text); this.loopButton = view.FindViewById <ImageButton>(Resource.Id.loop); this.animationNameView = view.FindViewById <TextView>(Resource.Id.animation_name); ImageButton restartButton = view.FindViewById <ImageButton>(Resource.Id.restart); ImageButton loadAssetButton = view.FindViewById <ImageButton>(Resource.Id.load_asset); ImageButton qrscanButton = view.FindViewById <ImageButton>(Resource.Id.qrscan); ImageButton loadFieButton = view.FindViewById <ImageButton>(Resource.Id.load_file); ImageButton loadUrlButton = view.FindViewById <ImageButton>(Resource.Id.load_url); playButton.Click += PlayButton_Click; restartButton.Click += RestartButton_Click; loopButton.Click += LoopButton_Click; invertButton.Click += InvertButton_Click; loadAssetButton.Click += LoadAssetButton_Click; loadFieButton.Click += LoadFileButton_Click; loadUrlButton.Click += LoadUrlButton_Click; qrscanButton.Click += QRScanButton_Click; (this.Activity as AppCompatActivity).SetSupportActionBar(toolbar); toolbar.SetNavigationIcon(Resource.Drawable.ic_back); toolbar.NavigationClick += (sender, e) => FragmentManager.PopBackStack(); this.HasOptionsMenu = true; PostUpdatePlayButtonText(); LoopButton_Click(null, EventArgs.Empty); this.animationView.AddAnimatorListener(this); this.animationView.AddAnimatorUpdateListener(this); this.seekBar.ProgressChanged += (sender, e) => { if (!animationView.IsAnimating) { animationView.Progress = e.Progress / 100f; } }; this.scaleSeekBar.ProgressChanged += (sender, e) => { this.animationView.Scale = e.Progress / ScaleSliderFactor; this.scaleTextView.Text = String.Format("{0:0.00}", this.animationView.Scale); }; return(view); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); this.shadow = FindViewById <Com.Yinglan.Shadowimageview.ShadowImageView>(Resource.Id.shadow); this.seekBar = FindViewById <AppCompatSeekBar>(Resource.Id.seekbar); shadow.Click += (sender, args) => { int res = Resource.Mipmap.lotus; switch (resId) { case 1: res = Resource.Mipmap.mountain; resId = 2; break; case 2: res = Resource.Mipmap.sunset; resId = 3; break; case 3: res = Resource.Mipmap.red; resId = 4; break; case 4: res = Resource.Mipmap.lotus; resId = 1; break; } if (resId == 1 || resId == 3) { shadow.SetImageResource(res); } else { shadow.SetImageDrawable(ContextCompat.GetDrawable(this, res)); } }; seekBar.ProgressChanged += (sender, args) => { shadow.SetImageRadius(args.Progress); }; LoadNetImage(); }
/// <summary> /// <see cref="T:Xamarin.Forms.Platform.Android.SliderRenderer"/> override that is called whenever the associated /// <see cref="T:Xamarin.Forms.Slider"/> instance changes /// </summary> /// <param name="e"><see cref="T:Xamarin.Forms.Platform.Android.ElementChangedEventArgs"/> that specifies the /// previously and newly assigned <see cref="T:Xamarin.Forms.Slider"/> instances /// </param> protected override void OnElementChanged(ElementChangedEventArgs <Slider> e) { base.OnElementChanged(e); // BEGIN default XF SliderRenderer implementation if (e.OldElement == null) { SeekBar ctrl = null; if (Android.OS.Build.VERSION.SdkInt < Android.OS.BuildVersionCodes.M && XFGloss.Droid.Library.UsingAppCompat) { // We want to create an AppCompatSeekBar instance if we're running on pre-Marshmallow and using the // AppCompat library ctrl = new AppCompatSeekBar(Context); } else { // If we're running on Marshmallow or newer, or aren't using the AppCompat library, create a // standard SeekBar control ctrl = new SeekBar(Context); } if (ctrl != null) { SetNativeControl(ctrl); ctrl.Max = 1000; ctrl.SetOnSeekBarChangeListener(this); } Slider newElement = e.NewElement; _min = newElement.Minimum; _max = newElement.Maximum; Value = newElement.Value; } // END default XF SliderRenderer implementation UpdateSliderProperties(); }
private void BindResources() { _coordinatorLayout = FindViewById <CoordinatorLayout>(Resource.Id.nav_coordinator_content); _drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); _toolbar = FindViewById <Toolbar>(Resource.Id.nav_toolbar); _customToolbarTitleWrapper = FindViewById <LinearLayout>(Resource.Id.toolbar_title_wrapper); _customToolbarTitle = FindViewById <AppCompatTextView>(Resource.Id.toolbar_title); _customToolbarSubtitle = FindViewById <AppCompatTextView>(Resource.Id.toolbar_subtitle); _profileView = FindViewById <CircularProfileView>(Resource.Id.img_profile); _profileNameView = FindViewById <AppCompatTextView>(Resource.Id.profile_name); _logoutButton = FindViewById <AppCompatTextView>(Resource.Id.logout_button); _page_container = FindViewById <FrameLayout>(Resource.Id.page_container); BottomSheet = FindViewById <LinearLayout>(Resource.Id.bottom_sheet); //BottomSheetBehaviour = Edison.Mobile.Android.Common.Behaviors.BottomSheetBehavior.From(_bottomSheet); // _bottomSheetBehaviour = BottomSheet4StateBehaviour.From(_bottomSheet); BottomSheetBehaviour = new Edison.Mobile.Android.Common.Behaviors.BottomSheetBehavior(); CoordinatorLayout.LayoutParams lp = BottomSheet.LayoutParameters as CoordinatorLayout.LayoutParams; lp.Behavior = BottomSheetBehaviour; BottomSheet.LayoutParameters = lp; _brightnessControlContainer = FindViewById <LinearLayout>(Resource.Id.brightness_slider_container); _brightnessControl = FindViewById <AppCompatSeekBar>(Resource.Id.brightness_slider); _moon = FindViewById <AppCompatImageView>(Resource.Id.moon); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); View view = this.BindingInflate(Resource.Layout.PlayerQueue, null); var prefs = Application.Context.GetSharedPreferences("Fildo", FileCreationMode.Private); this.cultureInfo = ((MainView)this.Activity).CultureInfo; this.Lyrics = new Dictionary <double, string>(); this.playpause = view.FindViewById <ToggleButton>(Resource.Id.btnPlayPause); this.btnNext = view.FindViewById <AppCompatImageButton>(Resource.Id.btnNext); this.btnPrev = view.FindViewById <AppCompatImageButton>(Resource.Id.btnPrevious); this.shuffle = view.FindViewById <ToggleButton>(Resource.Id.btnShuffle); this.repeat = view.FindViewById <ToggleButton>(Resource.Id.btnRepeat); this.playingSong = view.FindViewById <TextView>(Resource.Id.playingSong); this.lyricScroll = view.FindViewById <NestedScrollView>(Resource.Id.lyricScroll); this.lyricContainer = view.FindViewById <TextView>(Resource.Id.lyricContainer); this.listQueue = view.FindViewById <MvxRecyclerView>(Resource.Id.listQueue); ((MainView)this.Activity).FindViewById <LinearLayout>(Resource.Id.miniPlayer).Visibility = ViewStates.Gone; this.lyricScroll.Visibility = ViewStates.Gone; BackgroundStreamingService.posChanged -= this.BackgroundStreamingService_posChanged; BackgroundStreamingService.percentChanged -= this.BackgroundStreamingService_percentChanged; BackgroundStreamingService.posChanged += this.BackgroundStreamingService_posChanged; BackgroundStreamingService.percentChanged += this.BackgroundStreamingService_percentChanged; if (BackgroundStreamingService.Player == null) { this.playpause.Checked = false; this.shuffle.Checked = false; this.repeat.Checked = false; } else { try { BackgroundStreamingService.SongNameChanged -= this.BackgroundStreamingService_SongName; BackgroundStreamingService.SongNameChanged += this.BackgroundStreamingService_SongName; } catch (Exception) { } this.playingSong.Text = BackgroundStreamingService.SongName; this.SetLyric(); if (BackgroundStreamingService.Player.PlayWhenReady) { this.playpause.Checked = true; } if (BackgroundStreamingService.IsRepeat) { this.repeat.Checked = true; } if (BackgroundStreamingService.IsShuffle) { this.shuffle.Checked = true; } } this.playpause.CheckedChange += this.Playpause_CheckedChange; this.btnNext.Click += this.BtnNext_Click; this.btnPrev.Click += this.BtnPrev_Click; this.shuffle.CheckedChange += this.Shuffle_CheckedChange; this.repeat.CheckedChange += this.Repeat_CheckedChange; TabLayout tabs = view.FindViewById <TabLayout>(Resource.Id.tabs); tabs.Visibility = ViewStates.Visible; tabs.AddTab(tabs.NewTab().SetText("QUEUE")); tabs.AddTab(tabs.NewTab().SetText("LYRICS")); tabs.TabSelected += this.Tabs_TabSelected; if (this.ViewModel != null) { } else { } this.progress = new BindableProgress(view.Context, this.ViewModel); var set = this.CreateBindingSet <PlayerView, PlayerViewModel>(); set.Bind(this.progress).For(p => p.Visible).To(vm => vm.IsBusy); set.Apply(); this.SetHasOptionsMenu(true); AppCompatSeekBar seekbar = view.FindViewById <AppCompatSeekBar>(Resource.Id.seekBar); seekbar.ProgressChanged += this.Seekbar_ProgressChanged; GAService.GetGASInstance().Track_App_Page("Player"); return(view); }