private void MusicTypeSelector_Click(object sender, EventArgs e) { LinearLayout layout = sender as LinearLayout; try { switch (layout.Id) { case Resource.Id.MusicDicMusicTypeSelector_Vocal: MusicTypeFilter[0] = !MusicTypeFilter[0]; ImageView iv_vocal = FindViewById <ImageView>(Resource.Id.MusicDicMusicTypeIndicator_Vocal); if (MusicTypeFilter[0] == true) { iv_vocal.Visibility = ViewStates.Visible; } else { iv_vocal.Visibility = ViewStates.Invisible; } break; case Resource.Id.MusicDicMusicTypeSelector_Dance: MusicTypeFilter[1] = !MusicTypeFilter[1]; ImageView iv_dance = FindViewById <ImageView>(Resource.Id.MusicDicMusicTypeIndicator_Dance); if (MusicTypeFilter[1] == true) { iv_dance.Visibility = ViewStates.Visible; } else { iv_dance.Visibility = ViewStates.Invisible; } break; case Resource.Id.MusicDicMusicTypeSelector_Session: MusicTypeFilter[2] = !MusicTypeFilter[2]; ImageView iv_session = FindViewById <ImageView>(Resource.Id.MusicDicMusicTypeIndicator_Session); if (MusicTypeFilter[2] == true) { iv_session.Visibility = ViewStates.Visible; } else { iv_session.Visibility = ViewStates.Invisible; } break; } } catch (Exception ex) { ETC.LogError(this, ex.ToString()); } ListMusic(SearchText.Text); }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.StarDetailLayout); star = new Star(ETC.FindDataRow(ETC.CharacterList, "DicNumber", Intent.GetIntExtra("DicNumber", 0))); StarCropImage = FindViewById <ImageView>(Resource.Id.StarDetailStarCropImage); await DownloadProcess(); InitLoadProcess(); }
private async void ListMusic(string searchText) { SubList.Clear(); searchText = searchText.ToUpper(); try { for (int i = 0; i < RootList.Count; ++i) { Music music = RootList[i]; if (CheckFilter(music) == false) { continue; } if (searchText != "") { string name = music.Name.ToUpper(); if (name.Contains(searchText) == false) { continue; } } SubList.Add(music); } SubList.Sort(SortMusic); var adapter = new MusicListAdapter(SubList, this); if (adapter.HasOnItemClick() == false) { adapter.ItemClick += Adapter_ItemClick; } await Task.Delay(100); RunOnUiThread(() => { MusicRecyclerView.SetAdapter(adapter); }); } catch (Exception ex) { ETC.LogError(this, ex.ToString()); } }
private void CreateListObject() { try { foreach (DataRow dr in ETC.MusicList.Rows) { RootList.Add(new Music(dr)); } RootList.TrimExcess(); } catch (Exception ex) { ETC.LogError(this, ex.ToString()); } }
private async Task LoadNotification() { try { LoadingLayout.Visibility = ViewStates.Visible; await Task.Delay(500); using (WebClient wc = new WebClient()) ETC.Notification_String = await wc.DownloadStringTaskAsync(Path.Combine(ETC.Server, "Notification.txt")); } catch (Exception ex) { ETC.LogError(Activity, ex.ToString()); ETC.Notification_String = "Loading Fail..."; } finally { NotificationView.Text = ETC.Notification_String; LoadingLayout.Visibility = ViewStates.Gone; } }
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { MusicListViewHolder vh = holder as MusicListViewHolder; var item = items[position]; try { string AlbumImagePath = Path.Combine(ETC.CachePath, "Music", "Album", "Crop", $"{item.CodeName}.tsgp"); if (File.Exists(AlbumImagePath) == true) { vh.AlbumImage.SetImageDrawable(Android.Graphics.Drawables.Drawable.CreateFromPath(AlbumImagePath)); } vh.Name.Text = item.Name; vh.Artist.Text = item.Artist; } catch (Exception ex) { ETC.LogError(context, ex.ToString()); Toast.MakeText(context, "Error Create View", ToastLength.Short).Show(); } }
private void HelpFAB_Click(object sender, EventArgs e) { try { FloatingActionButton fab = sender as FloatingActionButton; Intent intent = null; string url = ""; switch (fab.Id) { case Resource.Id.DiscordFAB: url = "https://discord.gg/5cJ5WQD"; break; } intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse(url)); StartActivity(intent); } catch (Exception ex) { ETC.LogError(this, ex.ToString()); } }
private async Task InitLoadProcess() { try { try { string crop_normal_path = Path.Combine(ETC.CachePath, "Character", "Crop", "Normal", $"{star.DicNumber}.tsgp"); if (File.Exists(crop_normal_path) == false) { StarCropImage.SetImageResource(Resource.Drawable.No_StarCrop); } else { StarCropImage.SetImageDrawable(Android.Graphics.Drawables.Drawable.CreateFromPath(crop_normal_path)); } int GradeId = 0; switch (star.BornGrade) { default: case 1: GradeId = Resource.Drawable.GradeStar_1; break; case 2: GradeId = Resource.Drawable.GradeStar_2; break; case 3: GradeId = Resource.Drawable.GradeStar_3; break; case 4: GradeId = Resource.Drawable.GradeStar_4; break; case 5: GradeId = Resource.Drawable.GradeStar_5; break; } FindViewById <ImageView>(Resource.Id.StarDetailStarGrade).SetImageResource(GradeId); FindViewById <TextView>(Resource.Id.StarDetailStarName).Text = star.Name; TextView attribute = FindViewById <TextView>(Resource.Id.StarDetailStarAttribute); int attr_color_id = 0; switch (star.Attribute) { default: case "Support": attr_color_id = Resource.Color.Attr_SupportColor; break; case "Vocal": attr_color_id = Resource.Color.Attr_VocalColor; break; case "Session": attr_color_id = Resource.Color.Attr_SessionColor; break; case "Dance": attr_color_id = Resource.Color.Attr_DanceColor; break; } attribute.Text = star.Attribute.ToUpper(); attribute.SetBackgroundResource(attr_color_id); int TypeIconId = 0; switch (star.Type) { case "Tap": TypeIconId = Resource.Drawable.Type_Tap_Icon; break; case "Long": TypeIconId = Resource.Drawable.Type_Long_Icon; break; case "Slide": TypeIconId = Resource.Drawable.Type_Slide_Icon; break; case "Flick": TypeIconId = Resource.Drawable.Type_Flick_Icon; break; case "Support": TypeIconId = Resource.Drawable.Type_Support_Icon; break; default: case "Special": TypeIconId = Resource.Drawable.Type_Special_Icon; break; } FindViewById <ImageView>(Resource.Id.StarDetailStarTypeIcon).SetImageResource(TypeIconId); FindViewById <TextView>(Resource.Id.StarDetailStarType).Text = star.Type.ToUpper(); } catch (Exception ex) { ETC.LogError(this, ex.ToString()); } } catch (Exception ex) { ETC.LogError(this, ex.ToString()); } }
private void MusicPreviewButton_Click(object sender, EventArgs e) { Button bt = sender as Button; bt.Enabled = false; try { if (mp == null) { mp = new MediaPlayer(); } string preview_path = Path.Combine(ETC.CachePath, "Music", "Preview", $"{music.CodeName}.tsgp"); try { mp.SetDataSource(preview_path); } catch (Exception) { if (ETC.IsServerDown == false) { try { using (WebClient wc = new WebClient()) wc.DownloadFile(Path.Combine(ETC.Server, "Resource", "Music", "Preview", $"{music.CodeName}.opus"), preview_path); mp.SetDataSource(preview_path); } catch (Exception ex) { ETC.LogError(this, ex.ToString()); Toast.MakeText(this, $"Preview 음원 {Resources.GetString(Resource.String.Download_Fail)}", ToastLength.Short).Show(); return; } } else { Toast.MakeText(this, Resource.String.Server_Down_Error, ToastLength.Short).Show(); return; } } finally { } mp.Completion += delegate { bt.Enabled = true; mp.Release(); mp.Dispose(); }; mp.Prepare(); mp.Start(); } catch (Exception ex) { ETC.LogError(this, ex.ToString()); } }
private async Task InitLoadProcess() { try { try { string album_path = Path.Combine(ETC.CachePath, "Music", "Album", $"{music.CodeName}.tsgp"); if (File.Exists(album_path) == false) { if (ETC.IsServerDown == false) { using (WebClient wc = new WebClient()) await wc.DownloadFileTaskAsync(Path.Combine(ETC.Server, "Resource", "Images", "Music", "Album_Big", $"{music.CodeName}_big.png"), album_path); BigAlbumView.SetImageDrawable(Android.Graphics.Drawables.Drawable.CreateFromPath(album_path)); } else { BigAlbumView.SetImageResource(Resource.Drawable.No_Album_Big); } } else { BigAlbumView.SetImageDrawable(Android.Graphics.Drawables.Drawable.CreateFromPath(album_path)); } } catch (Exception ex) { ETC.LogError(this, ex.ToString()); } FindViewById <TextView>(Resource.Id.MusicDetailMusicName).Text = music.Name; FindViewById <TextView>(Resource.Id.MusicDetailMusicArtist).Text = music.Artist; FindViewById <TextView>(Resource.Id.MusicDetailMusicBPM).Text = $"BPM\n{music.BPM}"; FindViewById <TextView>(Resource.Id.MusicDetailMusicAddVersion).Text = $"최초수록\n{music.AddVersion_Full}"; int[] LevelIcon_Id = { Resource.Id.MusicDetailLevel_Easy, Resource.Id.MusicDetailLevel_Normal, Resource.Id.MusicDetailLevel_Hard, Resource.Id.MusicDetailLevel_Expert }; for (int i = 0; i < LevelIcon_Id.Length; ++i) { int id = 0; switch (music.Level[i]) { case 1: id = Resource.Drawable.Number_1; break; case 2: id = Resource.Drawable.Number_2; break; case 3: id = Resource.Drawable.Number_3; break; case 4: id = Resource.Drawable.Number_4; break; case 5: id = Resource.Drawable.Number_5; break; case 6: id = Resource.Drawable.Number_6; break; case 7: id = Resource.Drawable.Number_7; break; case 8: id = Resource.Drawable.Number_8; break; case 9: id = Resource.Drawable.Number_9; break; case 10: id = Resource.Drawable.Number_10; break; } FindViewById <ImageView>(LevelIcon_Id[i]).SetImageResource(id); } } catch (Exception ex) { ETC.LogError(this, ex.ToString()); } }