--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<Image xmlns="http://xamarin.com/schemas/2014/forms"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ x:Class="TVMediaHub.Tizen.Controls.CustomImageButton" >
+</Image>
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Input;
+using Xamarin.Forms;
+
+namespace TVMediaHub.Tizen.Controls
+{
+ public partial class CustomImageButton : Image
+ {
+ public string Direction
+ {
+ get;
+ set;
+ }
+ public ICommand ChangeImageCommand
+ {
+ get;
+ set;
+ }
+
+ public CustomImageButton()
+ {
+ InitializeComponent();
+
+ ChangeImageCommand = new Command<string>((param) =>
+ {
+ if (param.Equals("keyup"))
+ {
+ Source = "ic_tizen_zoom_arrow_" + Direction + "_normal.png";
+ }
+ else if (param.Equals("keydown"))
+ {
+ Source = "ic_tizen_zoom_arrow_" + Direction + "_selected.png";
+ }
+ });
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using Xamarin.Forms;
+using Xamarin.Forms.Platform.Tizen;
+using ElmSharp;
+using TVMediaHub.Tizen.Controls;
+
+[assembly: ExportRenderer(typeof(CustomImageButton), typeof(CustomImageRenderer))]
+namespace TVMediaHub.Tizen.Controls
+{
+ public class CustomImageRenderer : ImageRenderer
+ {
+ private ElmSharp.GestureLayer GestureRecognizer;
+
+ protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Image> args)
+ {
+ base.OnElementChanged(args);
+
+ if (Control == null ||Element == null)
+ {
+ return;
+ }
+
+ if (GestureRecognizer == null)
+ {
+ GestureRecognizer = new ElmSharp.GestureLayer(Control);
+ GestureRecognizer.Attach(Control);
+ }
+
+ GestureRecognizer.SetTapCallback(ElmSharp.GestureLayer.GestureType.Tap, ElmSharp.GestureLayer.GestureState.Start, x =>
+ {
+ KeyDown();
+ });
+ GestureRecognizer.SetTapCallback(ElmSharp.GestureLayer.GestureType.Tap, ElmSharp.GestureLayer.GestureState.End, x =>
+ {
+ KeyUp();
+ });
+ }
+
+ private void KeyUp()
+ {
+ CustomImageButton BtnElement = Element as CustomImageButton;
+ BtnElement.ChangeImageCommand.Execute("keyup");
+ }
+
+ private void KeyDown()
+ {
+ CustomImageButton BtnElement = Element as CustomImageButton;
+ BtnElement.ChangeImageCommand.Execute("keydown");
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace TVMediaHub.Tizen.DataModels
+{
+ public class ImageViewerInfomation
+ {
+ public string Title { get; set; }
+ public string FilePath { get; set; }
+ public string Date { get; set; }
+ public int RotateCount { get; set; }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace TVMediaHub.Tizen.DataModels
+{
+ public enum SlideShowEffect
+ {
+ Dissolve = 0,
+ FadeOut = 1,
+ Mosaic = 2
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace TVMediaHub.Tizen.DataModels
+{
+ public enum SlideShowSpeed
+ {
+ Normal = 0,
+ Slow = 1,
+ Fast = 2
+ }
+}
* limitations under the License.
*/
-using System;
namespace TVMediaHub.Tizen.Models
{
-namespace TVMediaHub.Tizen.Models
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace TVMediaHub.Tizen.Models
{
public class VideoProvider : ContentProvider
{
<None Include="shared\res\xamediahub.png" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="Controls\CustomImageButton.xaml.cs">
+ <DependentUpon>CustomImageButton.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="Controls\CustomImageRenderer.cs" />
+ <Compile Include="DataModels\ImageViewerInfomation.cs" />
+ <Compile Include="DataModels\SlideShowEffect.cs" />
+ <Compile Include="DataModels\SlideShowSpeed.cs" />
<Compile Include="Models\ContentProvider.cs" />
<Compile Include="Models\GroupItem.cs" />
<Compile Include="Models\ImageProvider.cs" />
<Compile Include="Utils\SizeUtils.cs" />
<Compile Include="Utils\SystemSettingsPort.cs" />
<Compile Include="ViewModels\ImageTabViewModel.cs" />
+ <Compile Include="ViewModels\ImageTabViewModelLocator.cs" />
<Compile Include="ViewModels\MediaHubMainPageViewModel.cs" />
<Compile Include="ViewModels\MusicTabViewModel.cs" />
<Compile Include="ViewModels\VideoPlayerViewModel.cs" />
<Compile Include="Views\ImageViewer.xaml.cs">
<DependentUpon>ImageViewer.xaml</DependentUpon>
</Compile>
+ <Compile Include="Views\ImageViewerSlideShow.xaml.cs">
+ <DependentUpon>ImageViewerSlideShow.xaml</DependentUpon>
+ </Compile>
<Compile Include="Views\ImageViewerZoom.xaml.cs">
<DependentUpon>ImageViewerZoom.xaml</DependentUpon>
</Compile>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
- <Content Include="res\thumbnail_test.jpg" />
<Content Include="res\btn_tizen_dropdown_line_dimmed.9.png" />
<Content Include="res\btn_tizen_dropdown_line_normal.9.png" />
<Content Include="res\btn_tizen_list_thumbnail_play.png" />
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
+ <EmbeddedResource Include="Controls\CustomImageButton.xaml">
+ <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
<EmbeddedResource Include="Views\RecentlyWatchedVideoContent.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Views\ImageViewerSlideShow.xaml">
+ <Generator>MSBuild:UpdateDesignTimeXaml</Generator>
+ </EmbeddedResource>
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
using System.Collections.Generic;
using System.ComponentModel;
+using System.Runtime.CompilerServices;
+using System.Windows.Input;
+using Xamarin.Forms;
+using System.Linq;
using Tizen.Content.MediaContent;
using TVMediaHub.Tizen.Models;
-using Xamarin.Forms;
+using TVMediaHub.Tizen.DataModels;
namespace TVMediaHub.Tizen.ViewModels
{
-
- class ImageTabViewModel:INotifyPropertyChanged
+ public class ImageTabViewModel : INotifyPropertyChanged
{
- int SelectedSource;
- int SortBy;
- bool imageDelMode;
-
- public event PropertyChangedEventHandler PropertyChanged;
-
+ private IEnumerable<MediaInformation> MediaInfoList;
+ private List<ImageViewerInfomation> ImageInfoList;
public IEnumerable<GroupItem> ImageList { get; set; }
+ public Command SetSelectedImageCommand { get; set; }
+ public ImageViewerInfomation CurrentImage { get; set; }
- public Command DeleteModeChangeCommand { get; set; }
+ public IEnumerable<ImageViewerInfomation> ImageInfo { get; set; }
+ public SlideShowSpeed Speed { get; set; }
- public Command SetSelectedImageCommand { get; set; }
-
- public MediaInformation currentimage { get; set; }
+ public SlideShowEffect Effect { get; set; }
+ private int SortBy;
+ private bool imageDelMode;
public bool IsDeleteMode
{
}
}
- void GetImageData(int source, int sortby)
+ public ICommand SetCurrentImageInfo
+ {
+ protected set;
+ get;
+ }
+
+ public ICommand NavigationCommand
+ {
+ protected set;
+ get;
+ }
+
+ public ICommand SetSlideShowSpeedCommand
+ {
+ protected set;
+ get;
+ }
+
+ public ICommand SetSlideShowEffectCommand
+ {
+ protected set;
+ get;
+ }
+
+ public ICommand SetRotationCountCommand
+ {
+ protected set;
+ get;
+ }
+
+ public Command DeleteModeChangeCommand { get; set; }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ if (PropertyChanged != null)
+ {
+ PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+
+ public ImageTabViewModel()
+ {
+ InitializeCommands();
+ MakeImageInfoList();
+ ReadImageList();
+
+ // for test
+ CurrentImage = ImageInfoList[0];
+
+ OnPropertyChanged("CurrentImage");
+ }
+
+ private void InitializeCommands()
+ {
+ this.DeleteModeChangeCommand = new Command(() =>
+ {
+ OnDeleteModeChanged();
+ });
+
+ this.NavigationCommand = new Command<string>((direction) =>
+ {
+ int index = ImageInfoList.ToList<ImageViewerInfomation>().IndexOf(CurrentImage);
+ if (direction.Equals("Left"))
+ {
+ if (index > 0)
+ {
+ CurrentImage = ImageInfoList.ToList<ImageViewerInfomation>()[index - 1];
+ }
+ }
+ else if (direction.Equals("Right"))
+ {
+ if (index < ImageInfoList.Count-1)
+ {
+ CurrentImage = ImageInfoList.ToList<ImageViewerInfomation>()[index + 1];
+ }
+ }
+ OnPropertyChanged("CurrentImage");
+ });
+
+ this.SetSlideShowSpeedCommand = new Command<SlideShowSpeed>((speed) =>
+ {
+ Speed = speed;
+ OnPropertyChanged("Speed");
+ });
+
+ this.SetSlideShowEffectCommand = new Command<SlideShowEffect>((effect) =>
+ {
+ Effect = effect;
+ OnPropertyChanged("Effect");
+ });
+
+ this.SetCurrentImageInfo = new Command<MediaInformation>((info) =>
+ {
+ SetCurrentImage(info);
+ });
+
+ this.SetRotationCountCommand = new Command(() =>
+ {
+ CurrentImage.RotateCount++;
+ OnPropertyChanged("CurrentImage");
+ });
+ }
+
+ private void GetImageData(int source, int sortby)
{
}
- void OnSourceChanged(int source)
+ private void OnSourceChanged(int source)
{
}
}
}
- void OnPropertyChanged(string propertyName)
+ private ImageViewerInfomation FindImageInfoInList(MediaInformation info)
{
- PropertyChangedEventHandler handler = PropertyChanged;
- if (handler != null)
+ foreach (var item in ImageInfoList)
{
- handler(this, new PropertyChangedEventArgs(propertyName));
+ if (item.FilePath.Equals(info.FilePath))
+ {
+ return item;
+ }
}
+
+ return null;
}
- public ImageTabViewModel()
+ private void SetCurrentImage(MediaInformation info)
{
- DeleteModeChangeCommand = new Command(() =>
- {
- OnDeleteModeChanged();
- });
-
- ReadImageList();
+ CurrentImage = FindImageInfoInList(info);
+ OnPropertyChanged("CurrentImage");
}
+ private ImageViewerInfomation MakeImageViewerInfomation(MediaInformation info)
+ {
+ ImageViewerInfomation ivInfo = new ImageViewerInfomation();
- void ReadImageList()
+ ivInfo.Title = info.Title;
+ ivInfo.Date = info.ModifiedAt.ToString("ddd. d MMMM");
+ ivInfo.FilePath = info.FilePath;
+ ivInfo.RotateCount = 0;
+
+ return ivInfo;
+ }
+
+ private void ReadImageList()
{
ImageList = MediaHubImpl.GetInstance.ImageProviderInstance.Read(SortOption.Title);
OnPropertyChanged("ImageList");
}
- }
+ private void MakeImageInfoList()
+ {
+ MediaInfoList = MediaHubImpl.GetInstance.ImageProviderInstance.ReadWithoutGroup(SortOption.Title);
+ ImageInfoList = new List<ImageViewerInfomation>();
+
+ foreach (var item in MediaInfoList)
+ {
+ ImageInfoList.Add(MakeImageViewerInfomation(item));
+ }
+ ImageInfo = ImageInfoList;
+ OnPropertyChanged("ImageInfo");
+ }
+ }
}
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace TVMediaHub.Tizen.ViewModels
+{
+ public static class ImageTabViewModelLocator
+ {
+ private static ImageTabViewModel _viewModel = new ImageTabViewModel();
+ public static ImageTabViewModel ViewModel
+ {
+ get
+ {
+ return _viewModel;
+ }
+ }
+ }
+}
bool isFooterNor;
bool isFooterSel;
- // TODO : Gets the title from MediaInformation
- public string Title
- {
- get;
- set;
- }
-
- // TODO : Gets the date from MediaInformation
- public string Date
- {
- get;
- set;
- }
-
- // TODO : Gets the thumbnail from MediaInformation
- public string ThumbnailPath
- {
- get;
- set;
- }
-
public event PropertyChangedEventHandler PropertyChanged;
IsFooterNorStatus = true;
}
});
-
- SetTitleAndDate();
- SetThumbnail();
- }
-
- private void SetTitleAndDate()
- {
- // TODO : MediaInformation Title
- Title = "Stories From the NY";
- Date = "Sat 25 April";
- OnPropertyChanged("Title");
- OnPropertyChanged("Date");
- }
-
- private void SetThumbnail()
- {
- // TODO : MediaInformation ThumbnailPath
- ThumbnailPath = "thumbnail_test.jpg";
- OnPropertyChanged("ThumbnailPath");
}
}
}
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TVMediaHub.Tizen.Views.ImageItem"
xmlns:Utils="clr-namespace:TVMediaHub.Tizen.Utils"
- IsDeleteMode="{Binding IsDeleteMode}">
+ IsDeleteMode="{Binding IsDeleteMode}"
+ OnClickCommand="{Binding SetCurrentImageInfo}">
<Grid x:Name="ImgContent">
<Image x:Name="imgFocused"
Grid.Row="0" Grid.Column="0"
Source="ic_tizen_apps_launcher_pinmark.png"
IsVisible="False" />
- <!--<Button Grid.Row="0" Grid.Column="0"
+ <Button x:Name="Button"
+ Grid.Row="0" Grid.Column="0"
Opacity="0"
- Clicked="OnItemClicked"/>-->
+ Clicked="OnItemClicked"/>
</Grid>
</StackLayout>
\ No newline at end of file
*/
using System.ComponentModel;
+using System.Windows.Input;
using Tizen.Content.MediaContent;
using TVMediaHub.Tizen.Utils;
+using TVMediaHub.Tizen.ViewModels;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
static int NORMAL = 0;
static int SELECTED = 1;
- private MediaInformation ImageInfo;
+ public static readonly BindableProperty OnClickCommandProperty = BindableProperty.Create("OnClickCommand", typeof(ICommand), typeof(ImageItem), default(ICommand));
+
+ public ICommand OnClickCommand
+ {
+ get
+ {
+ return (ICommand)GetValue(OnClickCommandProperty);
+ }
+ set
+ {
+ SetValue(OnClickCommandProperty, value);
+ }
+ }
+
+ public MediaInformation ImageInfo { get; set; }
int CurStatus;
public ImageItem()
{
+ BindingContext = ImageTabViewModelLocator.ViewModel;
InitializeComponent();
ImgContent.WidthRequest = SizeUtils.GetWidthSize(180);
UpdateView();
} else
{
+ OnClickCommand.Execute(ImageInfo);
PushNavigationPage();
}
}
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
ItemsSource="{Binding ImageList}">
- <RelativeLayout.BindingContext>
- <ViewModels:ImageTabViewModel/>
- </RelativeLayout.BindingContext>
<ScrollView x:Name="ImageTabScrollView"
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0.855}"
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
using System.ComponentModel;
using TVMediaHub.Tizen.Models;
using TVMediaHub.Tizen.Utils;
+using TVMediaHub.Tizen.ViewModels;
using Xamarin.Forms;
namespace TVMediaHub.Tizen.Views
public ImageTab()
{
+ BindingContext = ImageTabViewModelLocator.ViewModel;
InitializeComponent();
TestButton.FontSize = SizeUtils.GetFontSize(26);
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TVMediaHub.Tizen.Views.ImageViewer"
xmlns:Utils="clr-namespace:TVMediaHub.Tizen.Utils"
- xmlns:ViewModels="clr-namespace:TVMediaHub.Tizen.ViewModels">
- <ContentPage.BindingContext>
- <ViewModels:MediaHubMainPageViewModel />
- </ContentPage.BindingContext>
+ RotateCount="{Binding CurrentImage.RotateCount}">
<RelativeLayout>
<Image x:Name="Thumbnail"
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0}"
RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0}"
- Source="{Binding ThumbnailPath}"
+ Source="{Binding CurrentImage.FilePath}"
Aspect="AspectFill"/>
<Utils:NinePatch x:Name="GradientDim"
VerticalOptions="Center"
<ColumnDefinition Width="050000*" />
</Grid.ColumnDefinitions>
<Grid.ColumnSpacing>0</Grid.ColumnSpacing>
- <Label Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="11"
- Text="{Binding Title}" Font="Breeze Sans Bold" TextColor="White" FontSize="56" HorizontalTextAlignment="Start"/>
- <Label Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="11"
- Text="{Binding Date}" Font="Breeze Sans Light" TextColor="White" FontSize="34" HorizontalTextAlignment="Start"/>
+ <Label Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="11" x:Name="TitleLabel"
+ Text="{Binding CurrentImage.Title}" FontFamily="Breeze Sans Bold" TextColor="White" HorizontalTextAlignment="Start"/>
+ <Label Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="11" x:Name="DateLabel"
+ Text="{Binding CurrentImage.Date}" FontFamily="Breeze Sans Light" TextColor="White" HorizontalTextAlignment="Start"/>
+ <Image Grid.Row="5" Grid.Column="1" x:Name="RotateBg" Source="btn_tizen_viewer_control_focused.png" Opacity="0"/>
<Image Grid.Row="5" Grid.Column="1" Source="btn_tizen_viewer_control_rotate.png" />
+ <Button Grid.Row="5" Grid.Column="1" x:Name="RotateImage" Opacity="0"
+ Command="{Binding SetRotationCountCommand}" />
+
+ <Image Grid.Row="5" Grid.Column="3" x:Name="ZoomBg" Source="btn_tizen_viewer_control_focused.png" Opacity="0"/>
<Image Grid.Row="5" Grid.Column="3" Source="btn_tizen_viewer_control_zoom.png" />
- <Button Grid.Row="5" Grid.Column="3" x:Name="ZoomBtn" Opacity="0"/>
+ <Button Grid.Row="5" Grid.Column="3" x:Name="ZoomBtn" Opacity="0" Clicked="ZoomBtnClicked" />
+
+ <Image Grid.Row="5" Grid.Column="5" x:Name="LeftNaviBg" Source="btn_tizen_viewer_control_focused.png" Opacity="0"/>
<Image Grid.Row="5" Grid.Column="5" Source="btn_tizen_viewer_control_left.png" />
+ <Button Grid.Row="5" Grid.Column="5" x:Name="LeftNativation" Opacity="0"
+ Command="{Binding NavigationCommand}"
+ CommandParameter="Left"/>
+
+ <Image Grid.Row="5" Grid.Column="7" x:Name="RightNaviBg" Source="btn_tizen_viewer_control_focused.png" Opacity="0"/>
<Image Grid.Row="5" Grid.Column="7" Source="btn_tizen_viewer_control_right.png" />
+ <Button Grid.Row="5" Grid.Column="7" x:Name="RightNativation" Opacity="0"
+ Command="{Binding NavigationCommand}"
+ CommandParameter="Right"/>
+
+ <Image Grid.Row="5" Grid.Column="9" x:Name="SlideShowBg" Source="btn_tizen_viewer_control_focused.png" Opacity="0"/>
<Image Grid.Row="5" Grid.Column="9" Source="btn_tizen_viewer_control_video.png" />
+ <Button Grid.Row="5" Grid.Column="9" x:Name="SlideShowBtn" Opacity="0" Clicked="SlideShowBtnClicked" />
+
<Image Grid.Row="5" Grid.Column="11" Source="btn_tizen_viewer_control_option.png" />
</Grid>
</RelativeLayout>
*/
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using TVMediaHub.Tizen.Utils;
+using TVMediaHub.Tizen.ViewModels;
using Xamarin.Forms;
namespace TVMediaHub.Tizen.Views
{
public partial class ImageViewer : ContentPage
{
+ public static readonly BindableProperty RotateCountProperty = BindableProperty.Create("RotateCount", typeof(int), typeof(ImageViewer), 0);
+
+ public int RotateCount
+ {
+ get { return (int)GetValue(RotateCountProperty); }
+ set { SetValue(RotateCountProperty, value); }
+ }
+
public ImageViewer()
{
+ BindingContext = ImageTabViewModelLocator.ViewModel;
InitializeComponent();
NavigationPage.SetHasNavigationBar(this, false);
- FadeOutControlsTest();
- ZoomBtn.Clicked += ZoomBtn_Clicked;
+
+ FadeOutControls();
+ InitializeButtonFocusImage();
+ PropertyChanged += ImageViewerPropertyChanged;
+
+ int titleSize = SizeUtils.GetFontSize(44);
+ int dateSize = SizeUtils.GetFontSize(26);
+ TitleLabel.FontSize = titleSize;
+ DateLabel.FontSize = dateSize;
+ }
+
+ private void ImageViewerPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
+ {
+ if (e.PropertyName.Equals("RotateCount"))
+ {
+ Thumbnail.RotateTo((RotateCount % 4) * 90, 0);
+ }
}
- private void ZoomBtn_Clicked(object sender, EventArgs e)
+ private void InitializeButtonFocusImage()
{
- PushNavigationPage();
+ RotateImage.Focused += (s, e) =>
+ {
+ RotateBg.ScaleTo(3, 250);
+ RotateBg.FadeTo(1, 250);
+ };
+ ZoomBtn.Focused += (s, e) =>
+ {
+ ZoomBg.ScaleTo(3, 250);
+ ZoomBg.FadeTo(1, 250);
+ };
+ LeftNativation.Focused += (s, e) =>
+ {
+ LeftNaviBg.TranslationX = 7;
+ LeftNaviBg.ScaleTo(3, 250);
+ LeftNaviBg.FadeTo(1, 250);
+ };
+ RightNativation.Focused += (s, e) =>
+ {
+ RightNaviBg.ScaleTo(3, 250);
+ RightNaviBg.FadeTo(1, 250);
+ };
+ SlideShowBtn.Focused += (s, e) =>
+ {
+ SlideShowBg.ScaleTo(3, 250);
+ SlideShowBg.FadeTo(1, 250);
+ };
+
+ RotateImage.Unfocused += (s, e) =>
+ {
+ RotateBg.ScaleTo(1, 250);
+ RotateBg.FadeTo(0, 250);
+ };
+ ZoomBtn.Unfocused += (s, e) =>
+ {
+ ZoomBg.ScaleTo(1, 250);
+ ZoomBg.FadeTo(0, 250);
+ };
+ LeftNativation.Unfocused += (s, e) =>
+ {
+ LeftNaviBg.ScaleTo(1, 250);
+ LeftNaviBg.FadeTo(0, 250);
+ };
+ RightNativation.Unfocused += (s, e) =>
+ {
+ RightNaviBg.ScaleTo(1, 250);
+ RightNaviBg.FadeTo(0, 250);
+ };
+ SlideShowBtn.Unfocused += (s, e) =>
+ {
+ SlideShowBg.ScaleTo(1, 250);
+ SlideShowBg.FadeTo(0, 250);
+ };
}
- async void PushNavigationPage()
+ private async void ZoomBtnClicked(object sender, EventArgs e)
{
await Navigation.PushAsync(new ImageViewerZoom());
}
- async void FadeOutControlsTest()
+ private async void SlideShowBtnClicked(object sender, EventArgs e)
{
- await Task.Delay(3000);
+ await Navigation.PushAsync(new ImageViewerSlideShow());
+ }
+
+ private async void FadeOutControls()
+ {
+ /*await Task.Delay(3000);
#pragma warning disable CS4014
MainGrid.FadeTo(0, 300);
await Task.Delay(3000);
MainGrid.FadeTo(1, 300);
-#pragma warning restore CS4014
+#pragma warning restore CS4014*/
}
protected override void LayoutChildren(double x, double y, double width, double height)
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ x:Class="TVMediaHub.Tizen.Views.ImageViewerSlideShow"
+ xmlns:Utils="clr-namespace:TVMediaHub.Tizen.Utils"
+ ItemsSource="{Binding ImageInfo}"
+ Speed="{Binding Speed}"
+ Effect="{Binding Effect}"
+ CurrentImage="{Binding CurrentImage}">
+ <RelativeLayout>
+ <Image x:Name="NextThumbnail"
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
+ RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0}"
+ RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0}"
+ Aspect="AspectFill"/>
+ <Image x:Name="Thumbnail"
+ RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"
+ RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
+ RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0}"
+ RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0}"
+ Source="{Binding CurrentImage.FilePath}"
+ Aspect="AspectFill"/>
+ <Utils:NinePatch x:Name="GradientDim"
+ VerticalOptions="Center"
+ HorizontalOptions="Center"
+ Aspect="Fill"
+ BorderLeft="20"
+ BorderTop="20"
+ BorderRight="20"
+ BorderBottom="20"
+ Source="img_tizen_gradient_topbottom.9.png" />
+ </RelativeLayout>
+</ContentPage>
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using TVMediaHub.Tizen.DataModels;
+using TVMediaHub.Tizen.ViewModels;
+using Xamarin.Forms;
+
+namespace TVMediaHub.Tizen.Views
+{
+ public partial class ImageViewerSlideShow : ContentPage
+ {
+ private List<ImageViewerInfomation> imageList;
+
+ public static readonly BindableProperty ItemsSourceProperty = BindableProperty.Create("ItemsSource", typeof(IEnumerable<ImageViewerInfomation>), typeof(ImageViewerSlideShow), null);
+
+ public IEnumerable<ImageViewerInfomation> ItemsSource
+ {
+ get { return (IEnumerable<ImageViewerInfomation>)GetValue(ItemsSourceProperty); }
+ set { SetValue(ItemsSourceProperty, value); }
+ }
+
+ public static readonly BindableProperty SpeedProperty = BindableProperty.Create("Speed", typeof(SlideShowSpeed), typeof(ImageViewerSlideShow), SlideShowSpeed.Normal);
+
+ public SlideShowSpeed Speed
+ {
+ get { return (SlideShowSpeed)GetValue(SpeedProperty); }
+ set { SetValue(SpeedProperty, value); }
+ }
+
+ public static readonly BindableProperty EffectProperty = BindableProperty.Create("Effect", typeof(SlideShowEffect), typeof(ImageViewerSlideShow), SlideShowEffect.Dissolve);
+
+ public SlideShowEffect Effect
+ {
+ get { return (SlideShowEffect)GetValue(EffectProperty); }
+ set { SetValue(EffectProperty, value); }
+ }
+
+ public static readonly BindableProperty CurrentImageProperty = BindableProperty.Create("CurrentImage", typeof(ImageViewerInfomation), typeof(ImageViewerSlideShow), null);
+
+ public ImageViewerInfomation CurrentImage
+ {
+ get { return (ImageViewerInfomation)GetValue(CurrentImageProperty); }
+ set { SetValue(CurrentImageProperty, value); }
+ }
+
+ public ImageViewerSlideShow()
+ {
+ imageList = new List<ImageViewerInfomation>();
+ PropertyChanged += OnPropertyChanged;
+ BindingContext = ImageTabViewModelLocator.ViewModel;
+ InitializeComponent();
+ NavigationPage.SetHasNavigationBar(this, false);
+
+ ViewSlideShow();
+ }
+
+ private void OnPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
+ {
+ if (e.PropertyName.Equals("ItemsSource"))
+ {
+ imageList.Clear();
+ foreach (var item in ItemsSource)
+ {
+ imageList.Add(item);
+ }
+ }
+ }
+
+ private void ViewSlideShow()
+ {
+ if (imageList.Count > 0)
+ {
+ if (Effect.Equals(SlideShowEffect.Dissolve))
+ {
+ DissolveSlideShow();
+ }
+ else if (Effect.Equals(SlideShowEffect.FadeOut))
+ {
+ FadeoutSlideShow();
+ }
+ else if (Effect.Equals(SlideShowEffect.Mosaic))
+ {
+ // TODO : Mosaic effect
+ }
+ }
+ }
+
+ private async void DissolveSlideShow()
+ {
+ int index = imageList.IndexOf(CurrentImage);
+ NextThumbnail.Source = imageList[(index + 1) % imageList.Count].FilePath;
+ await Task.Delay(3000);
+
+ for (int i = 1; i < imageList.Count + 1; i++)
+ {
+ await Thumbnail.FadeTo(0.0, 2000);
+ await Task.Delay(500);
+ Thumbnail.Source = imageList[(index + i) % imageList.Count].FilePath;
+
+ Thumbnail.FadeTo(1, 0);
+ await NextThumbnail.FadeTo(0, 0);
+ await Task.Delay(500);
+
+ NextThumbnail.Source = imageList[(index + i + 1) % imageList.Count].FilePath;
+ await Task.Delay(500);
+ NextThumbnail.FadeTo(1, 0);
+ }
+
+ await Navigation.PopAsync();
+ }
+
+ private async void FadeoutSlideShow()
+ {
+ int index = imageList.IndexOf(CurrentImage);
+
+ NextThumbnail.Opacity = 0;
+ NextThumbnail.Source = imageList[(index + 1) % imageList.Count].FilePath;
+ await NextThumbnail.FadeTo(0, 0);
+
+ for (int i = 1; i < imageList.Count + 1; i++)
+ {
+ Thumbnail.FadeTo(0.0, 2000);
+ await NextThumbnail.FadeTo(1.0, 2000);
+ await Task.Delay(500);
+ Thumbnail.Source = imageList[(index + i) % imageList.Count].FilePath;
+
+ Thumbnail.FadeTo(1, 0);
+ await NextThumbnail.FadeTo(0, 0);
+ await Task.Delay(500);
+
+ NextThumbnail.Source = imageList[(index + i + 1) % imageList.Count].FilePath;
+ await Task.Delay(500);
+ }
+
+ await Navigation.PopAsync();
+ }
+ }
+}
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TVMediaHub.Tizen.Views.ImageViewerZoom"
xmlns:Utils="clr-namespace:TVMediaHub.Tizen.Utils"
- xmlns:ViewModels="clr-namespace:TVMediaHub.Tizen.ViewModels">
- <ContentPage.BindingContext>
- <ViewModels:MediaHubMainPageViewModel />
- </ContentPage.BindingContext>
+ xmlns:Controls="clr-namespace:TVMediaHub.Tizen.Controls">
<RelativeLayout>
<Image x:Name="Thumbnail"
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0}"
RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0}"
- Source="{Binding ThumbnailPath}"
+ Source="{Binding CurrentImage.FilePath}"
Aspect="AspectFill"/>
<Utils:NinePatch x:Name="GradientDim"
VerticalOptions="Center"
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0}"
RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0}" >
- <Image x:Name="UpArrow"
+ <Controls:CustomImageButton x:Name="UpArrow"
+ Direction="up"
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ZoomGrid, Property=Height, Factor=0.077778}"
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ZoomGrid, Property=Width, Factor=0.04375}"
RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ZoomGrid, Property=Height, Factor=0.037037}"
RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ZoomGrid, Property=Width, Factor=0.478125}"
Source="ic_tizen_zoom_arrow_up_normal.png" />
- <Image x:Name="DownArrow"
+ <Controls:CustomImageButton x:Name="DownArrow"
+ Direction="down"
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ZoomGrid, Property=Height, Factor=0.077778}"
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ZoomGrid, Property=Width, Factor=0.04375}"
RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ZoomGrid, Property=Height, Factor=0.885185}"
RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ZoomGrid, Property=Width, Factor=0.478125}"
Source="ic_tizen_zoom_arrow_down_normal.png" />
- <Image x:Name="LeftArrow"
+ <Controls:CustomImageButton x:Name="LeftArrow"
+ Direction="left"
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ZoomGrid, Property=Height, Factor=0.077778}"
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ZoomGrid, Property=Width, Factor=0.04375}"
RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ZoomGrid, Property=Height, Factor=0.461111}"
RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ZoomGrid, Property=Width, Factor=0.02083}"
Source="ic_tizen_zoom_arrow_left_normal.png" />
- <Image x:Name="RightArrow"
+ <Controls:CustomImageButton x:Name="RightArrow"
+ Direction="right"
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ZoomGrid, Property=Height, Factor=0.077778}"
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ZoomGrid, Property=Width, Factor=0.04375}"
RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ZoomGrid, Property=Height, Factor=0.461111}"
<Image x:Name="BackIcon" Grid.Row="0" Grid.Column="0"
Source="ic_tizen_apps_additional_back.png" />
<Label x:Name="BackLabel" Grid.Row="0" Grid.Column="2"
- Text="Back" FontSize="56" Opacity="0.6" TextColor="White" HorizontalTextAlignment="Start" />
+ Text="Back" Opacity="0.6" TextColor="White" HorizontalTextAlignment="Start" />
</Grid>
<RelativeLayout x:Name="MiniMap"
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=ZoomGrid, Property=Height, Factor=0.25}"
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToView, ElementName=MiniMap, Property=Width, Factor=1}"
RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=MiniMap, Property=Height, Factor=0}"
RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToView, ElementName=MiniMap, Property=Width, Factor=0}"
- Source="{Binding ThumbnailPath}"
+ Source="{Binding CurrentImage.ThumbnailPath}"
Aspect="AspectFill"/>
<Image x:Name="MiniMapThumbnailDim"
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToView, ElementName=MiniMap, Property=Height, Factor=1}"
* limitations under the License.
*/
+using TVMediaHub.Tizen.ViewModels;
using Xamarin.Forms;
+using Tizen.Xamarin.Forms.Extension;
+using TVMediaHub.Tizen.Utils;
namespace TVMediaHub.Tizen.Views
{
{
public ImageViewerZoom()
{
+ BindingContext = ImageTabViewModelLocator.ViewModel;
InitializeComponent();
NavigationPage.SetHasNavigationBar(this, false);
+
+ int BackLabelSize = SizeUtils.GetFontSize(28);
+ BackLabel.FontSize = BackLabelSize;
+ Toast.DisplayText("Press [Back] to Escape from Zoom mode.");
}
protected override void LayoutChildren(double x, double y, double width, double height)