⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 3.lua

📁 htc manila 2 sourcecode
💻 LUA
📖 第 1 页 / 共 3 页
字号:
   end
end

OnDurationChange = function(l_33_0, l_33_1)
   trace("[MG]OnDurationChange, Duration: " .. l_33_1 .. "\n")
   if l_33_1 <= 0 then
      return 
   end
   if gDuration ~= l_33_1 then
      gDuration = l_33_1
      remain.String = "-" .. MusicHelper_FormatTime(l_33_1)
   end
end

OnPlayStatusChange = function(l_34_0)
   if l_34_0 == MP_STATUS_PLAYING then
      playpause.Tag.name = "pause"
      UpdateControlInfo(playpause)
      gEngReloaded = true
   else
      playpause.Tag.name = "play"
      UpdateControlInfo(playpause)
      if l_34_0 == MP_STATUS_NOMUSIC then
         gizmo._visible = false
         nomusic._visible = true
         NoMusicText.String = Locale:GetString("IDS_MUSIC_NOMUSIC")
      elseif l_34_0 == MP_STATUS_SEARCHING then
         gAMBusy = true
      elseif l_34_0 == MP_STATUS_READY and gAMBusy == true then
         gAMBusy = false
         OnNavComplete()
      end
   end
end

OnPlayingIndexChange = function(l_35_0)
   gSeekPosition = 0
   trace("[MG] PlayIndex change. From " .. gCurTrackIndex .. " to " .. l_35_0 .. "\n")
   local l_35_1 = gPlayer:Database().Count
   if l_35_1 == 0 then
      return 
   end
   if l_35_0 ~= gCurTrackIndex then
      gDuration = gPlayer.CurTrackDuration
      if gDuration < 0 then
         gDuration = 0
      end
      trace("[MG] PlayIndex change. Duration: " .. gDuration .. "\n")
      if gDuration > 0 then
         setRemain(gDuration)
      else
         elapse.String = "0:00"
         remain.String = "-0:00"
         passline.Size.width = 0
         indicator.Position.x = gIndicator_Offset
         indicatorPress.Position.x = indicatorPress_startPos
      end
   end
   artistalbum.Opacity:ClearInterpolate()
   artistalbum2.Opacity:ClearInterpolate()
   title.Opacity:ClearInterpolate()
   title.String = gPlayer:GetSongTitle(l_35_0)
   artistalbum.String = gPlayer:GetSongArtist(l_35_0)
   artistalbum2.String = gPlayer:GetSongAlbum(l_35_0)
   local l_35_2 = 16
   if gFirstTimeIn == true then
      l_35_2 = 0
   end
   title.Opacity:Interpolate(0, 100, l_35_2, 0, Interpolate_EaseOutQuad)
   artistalbum.Opacity:Interpolate(0, 100, l_35_2, 0, Interpolate_EaseOutQuad)
   artistalbum2.Opacity:Interpolate(0, 100, l_35_2, 0, Interpolate_EaseOutQuad)
   gFirstTimeIn = false
   local l_35_3 = l_35_0
   local l_35_4 = gPlayer:Database():GetIndexForShuffle(gCurTrackIndex)
   if gPlayer.Shuffle == true then
      l_35_3 = gPlayer:Database():GetIndexForShuffle(l_35_0)
   end
   if l_35_1 == 1 then
      previous.Tag.state = BUTTON_DISABLED
      next.Tag.state = BUTTON_DISABLED
   elseif l_35_3 == 0 then
      previous.Tag.state = BUTTON_DISABLED
      if next.Tag.state ~= BUTTON_DOWN then
         next.Tag.state = BUTTON_UP
      end
   elseif l_35_3 == l_35_1 - 1 then
      if previous.Tag.state ~= BUTTON_DOWN then
         previous.Tag.state = BUTTON_UP
      end
      next.Tag.state = BUTTON_DISABLED
   else
      if previous.Tag.state ~= BUTTON_DOWN then
         previous.Tag.state = BUTTON_UP
      end
        if next.Tag.state ~= BUTTON_DOWN then
         next.Tag.state = BUTTON_UP
      end
   end
   OnPlayStatusChange(gPlayer.Status)
   UpdateControlInfo(previous)
   UpdateControlInfo(next)
   gCurTrackIndex = l_35_0
   local l_35_5 = MusicHelper_GetStringWidth(title, title.String)
   if title.Size.width <   l_35_5 then
     EnableMarquee(true, l_35_5)
   else
     EnableMarquee(false, l_35_5)
   end
   if l_35_4 ~= l_35_3 and l_35_4 == gPlayer:Database().Count - 1 and gIsPreviousBtnPress == false and gPlayer.Shuffle == true then
      local l_35_6 = MusicHelper_Random(gPlayer:Database().Count)
      gCurTrackIndex = l_35_6
      gPlayer:Database():ShuffleNowPlayingList(l_35_6)
      AlbumQuery = gPlayer:Database().CurAlbumArtList
      ResetListviewCollection(AlbumQuery)
      if gPlayer.Repeat == MP_REPEAT_ON then
         gPlayer:ReloadListPlay(l_35_6)
      else
         gPlayer:ReloadList(l_35_6)
      end
   else
      FlipAlbumArt()
   end
end

OnSettingChange = function(l_36_0, l_36_1)
   updateSetting(l_36_0, l_36_1)
   local l_36_2 = gPlayer:Database().CurAlbumArtList
   ResetListviewCollection(l_36_2)
   OnPlayingIndexChange(gCurTrackIndex)
end

OnListChange = function()
   local l_37_0 = gPlayer:Database().Count
   local l_37_1 = true
   if l_37_0 > 0 then
      for i = 0, l_37_0 - 1 do
         local glp = gPlayer:GetSongFilePath(i)
         if MusicHelper_FileExists(glp) == true then
           l_37_1 = false
         end
      end
   else
      getPlayingList()
      return 
   end
   if l_37_1 == true then
      gizmo._visible = false
      nomusic._visible = true
      NoMusicText.String = Locale:GetString("IDS_MUSIC_NOMUSIC")
   else
      gizmo._visible = true
      nomusic._visible = false
      AlbumGenerator.Collection = nil
      AlbumGenerator.Collection = AlbumQuery
   end
end

OnMediaSearching = function(l_38_0)
   if l_38_0 == 1 then
      ShowSearchingIndicator()
   else
      HideSearchingIndicator()
      OnListChange()
   end
end

OnPlaySpecificMeidaPath = function(l_39_0)
   if l_39_0 ~= nil and l_39_0 ~= "" then
      trace("[MG] OnPlaySpecificMeidaPath:Play media path [" .. l_39_0 .. "]\n")
      local l_39_1 = gPlayer:Database()
      local l_39_2 = MusicWhereConditions()
      l_39_2:AddCondition(l_39_0)
      l_39_1:Select(VID_SONG_OF_FILEPATH, l_39_2)
      local l_39_3 = l_39_1.Count
      if l_39_3 > 0 then
         l_39_1:SetPlayingList()
         MusicConfig_Instance():SetSetting(CONFIG_NOWPLAYING_ORDER, 0)
         gCurTrackIndex = 0
         trace("[MG] Reload list and play it\n")
         gPlayer:ReloadListPlay(gCurTrackIndex)
         title.String = gPlayer:GetSongTitle(gCurTrackIndex)
         artistalbum.String = gPlayer:GetSongArtist(gCurTrackIndex)
         artistalbum2.String = gPlayer:GetSongAlbum(gCurTrackIndex)
         setRemain(gDuration)
         AlbumQuery = gPlayer:Database().CurAlbumArtList
         ResetListviewCollection(AlbumQuery)
      end
      MusicConfig_Instance():SetSetting(CONFIG_ASSIGN_PLAYMEDIA_PATH, "")
   end
end

updateSetting = function(l_40_0, l_40_1)
   if l_40_0 == MP_REPEAT_OFF then
      repeatOn._visible = false
      repeatOff._visible = true
      repeatOne._visible = false
   elseif l_40_0 == MP_REPEAT_ON then
      repeatOn._visible = true
      repeatOff._visible = false
      repeatOne._visible = false
   else
      repeatOn._visible = false
      repeatOff._visible = false
      repeatOne._visible = true
   end
   if l_40_1 == false then
      shuffleOn._visible = false
      shuffleOff._visible = true
   else
      shuffleOn._visible = true
      shuffleOff._visible = false
   end
end

previous.Tag = {state = BUTTON_UP, action = DoPrevious, name = "prev"}
previous.onPress:connect(OnBtnPress)
previous.onRelease:connect(OnBtnRelease)
previous.onReleaseOutside:connect(OnBtnReleaseOutside)
next.Tag = {state = BUTTON_UP, action = DoNext, name = "next"}
next.onPress:connect(OnBtnPress)
next.onRelease:connect(OnBtnRelease)
next.onReleaseOutside:connect(OnBtnReleaseOutside)
playpause.Tag = {state = BUTTON_UP, action = DoPlayPause, name = "play"}
playpause.onPress:connect(OnBtnPress)
playpause.onRelease:connect(OnBtnRelease)
playpause.onReleaseOutside:connect(OnBtnReleaseOutside)
KeyboardHandler:Focus()

if _config_os == "windowsmobile" then
   _request.NavigateOutTo:connect(OnNavigateOutTo)
   _request.NavigateInFrom:connect(OnNavigateInFrom)
   _application.Navigator.OnWheel:connect(OnNavWheel)
   _application.OnVisibilityChanged:connect(OnActivate)
   if _application.Store:GetStringValue(Lifetime_Permanent, "EnableLandscape") == "true" then
      trace("[MG] : EnableLandscape")
      require("Audio\\Music_Landscape")
      _MusicMain_ScreenRotation = MusicMain_ScreenRotation()
   end
   gPlayer.onPositionChange:connect(OnPositionChange)
   gPlayer.onDurationChange:connect(OnDurationChange)
   gPlayer.onPlayStatusChange:connect(OnPlayStatusChange)
   gPlayer.onPlayingIndexChange:connect(OnPlayingIndexChange)
   gPlayer.onSettingChange:connect(OnSettingChange)
   gPlayer.onMediaSearching:connect(OnMediaSearching)
   gCurTrackIndex = gPlayer.CurTrackIndex
   local l_0_0 = gPlayer:Database()
   gDoNotReloadList = tonumber(_request.URL.Parameters:GetParameter("donotreload"))
   trace("[MG] before check [assign_playmedia_path] registry key.\n")
   local l_0_1 = MusicConfig_Instance():GetSetting(CONFIG_ASSIGN_PLAYMEDIA_PATH)
   local l_0_2 = 0
   gbWantPlaySpecificFile = false
   if l_0_1 ~= nil and l_0_1 ~= "" then
      trace("[MG] Play media path " .. l_0_1 .. "\n")
      local mwc = MusicWhereConditions()
      mwc:AddCondition(l_0_1)
      l_0_0:Select(VID_SONG_OF_FILEPATH, mwc)
      l_0_2 = l_0_0.Count
      if l_0_2 > 0 then
         l_0_0:SetPlayingList()
         MusicConfig_Instance():SetSetting(CONFIG_NOWPLAYING_ORDER, 0)
         gCurTrackIndex = 0
         gbWantPlaySpecificFile = true
         trace("[MG] Select [" .. l_0_1 .. "] as playlist.\n")
      end
      MusicConfig_Instance():SetSetting(CONFIG_ASSIGN_PLAYMEDIA_PATH, "")
   end
   l_0_0:SelectPlayingList()
   l_0_2 = l_0_0.Count
   trace("[MG] After database:SelectPlayingList(), count: " .. tostring(l_0_2) .. "\n")
   local l_0_3 = true
   if l_0_2 > 0 then
      for i = 0, l_0_2 - 1 do
         local gsp = gPlayer:GetSongFilePath(i)
         if MusicHelper_FileExists(gsp) == true then
           l_0_3 = false
         end
      end
   end
   if l_0_0.Count > 0 and l_0_3 == false then
      if gCurTrackIndex >= l_0_0.Count then
         gCurTrackIndex = 0
      end
      title.String = gPlayer:GetSongTitle(gCurTrackIndex)
      artistalbum.String = gPlayer:GetSongArtist(gCurTrackIndex)
      artistalbum2.String = gPlayer:GetSongAlbum(gCurTrackIndex)
      gDuration = gPlayer.CurTrackDuration
      setRemain(gDuration)
   else
      gizmo._visible = false
      nomusic._visible = true
      NoMusicText.String = Locale:GetString("IDS_MUSIC_SEARCHING")
   end
   updateSetting(gPlayer.Repeat, gPlayer.Shuffle)
   _application:SetLeftSoftkey(Softkey(Locale:GetString("IDS_MUSIC_LIBRARY"), LSKFunction))
   _application:SetRightSoftkey(Softkey(Locale:GetString("IDS_MUSIC_MENU"), ShowMenu))
end

indicatorPress.onPress:connect(OnIndicatorPress)
indicatorPress.onRelease:connect(OnIndicatorRelease)
indicatorPress.onReleaseOutside:connect(OnIndicatorRelease)
indicatorPress.onMouseMove:connect(OnIndicatorMove)
KeyboardConnect(true)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -