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

📄 3.lua

📁 htc manila 2 sourcecode
💻 LUA
📖 第 1 页 / 共 3 页
字号:
      trace("[MG] gbWantPlaySpecificFile = true, Reload list and play it\n")
      gPlayer:ReloadListPlay(gCurTrackIndex)
   end
   gEngReloaded = true
end

OnNavigateOutTo = function(l_19_0)
   _application.OnVisibilityChanged:disconnect(OnActivate)
   _request.NavigateOutTo:disconnect(OnNavigateOutTo)
   _application.Navigator.OnWheel:disconnect(OnNavWheel)
   indicatorPress.onPress:disconnect(OnIndicatorPress)
   indicatorPress.onRelease:disconnect(OnIndicatorRelease)
   indicatorPress.onReleaseOutside:disconnect(OnIndicatorRelease)
   indicatorPress.onMouseMove:disconnect(OnIndicatorMove)
   gPlayer.onPositionChange:disconnect(OnPositionChange)
   gPlayer.onDurationChange:disconnect(OnDurationChange)
   gPlayer.onPlayStatusChange:disconnect(OnPlayStatusChange)
   gPlayer.onPlayingIndexChange:disconnect(OnPlayingIndexChange)
   gPlayer.onSettingChange:disconnect(OnSettingChange)
   gPlayer.onMediaSearching:disconnect(OnMediaSearching)
   gPlayer.onPlaySpecificMediaPath:disconnect(OnPlaySpecificMeidaPath)
   Transition(l_19_0, "Out")
end

OnNavigateInFrom = function(l_20_0)
   if _config_os == "windowsmobile" then
      SetNavCompleteCallback(OnNavComplete)
   end
   _request.NavigateInFrom:disconnect(OnNavigateInFrom)
   Transition(l_20_0, "In")
end

OnWheelTimer = function(l_21_0)
   gWheelTimerCount = gWheelTimerCount + 1
   if gWheelTimerCount > 5 then
      if gWheelTimerCount > 10 then
         gWheelTimer:Stop()
         trackbar._visible = true
         dragbar._visible = false
         SongInfo._visible = true
         local l_21_1 = tracklineDrag.Size.width / tracklineDrag_maxWidth
         local l_21_2 = l_21_1 * gDuration
         local mhid = MusicHelper_IntDevide(l_21_2, 1)
         if gDuration <= 0 then
           l_21_1 = 0
         else
           l_21_1 = mhid / gDuration
         end
         local l_21_4 = l_21_1 * remainingline.Size.width         
         passline.Size.width = l_21_4
         indicator.Position.x = l_21_4 + gIndicator_Offset
         indicatorPress.Position.x = indicatorPress_startPos + l_21_4
         indicatorPress._visible = true
         gPlayer:SetTimePos(mhid)
         if gPlayer.Status ~= MP_STATUS_PLAYING then
            local t = gDuration - mhid
            elapse.String = MusicHelper_FormatTime(mhid)            
            remain.String = "-" .. MusicHelper_FormatTime(t)
         end
         gWheelOrigState = nil
      end
      return 
   end
   local l_21_1 = 5
   if gWheelDirection == WheelDirection_Clockwise then
      if l_21_1 + tracklineDrag.Size.width > tracklineDrag_maxWidth then
         l_21_1 = tracklineDrag_maxWidth - tracklineDrag.Size.width
      end
   else
      l_21_1 = -5
      if l_21_1 + tracklineDrag.Size.width < 0 then
         l_21_1 = -tracklineDrag.Size.width
      end
   end
   tracklineDrag.Size.width = tracklineDrag.Size.width + l_21_1
   indicatorDrag.Position.x = indicatorDrag.Position.x + l_21_1
end

OnNavWheel = function(l_22_0)
   gWheelCount = gWheelCount + 1
   if gWheelCount < gWheelSkipValue then
      return 
   end
   gWheelCount = 0
   if gDuration <= 0 or gPlayer.Status ~= MP_STATUS_PAUSED and gPlayer.Status ~= MP_STATUS_PLAYING then
      return 
   end
   if trackbar._visible == true then
      trackbar._visible = false
      dragbar._visible = true
      SongInfo._visible = false
      local l_22_1 = (indicator.Position.x - gIndicator_Offset) / remainingline.Size.width * tracklineDrag_maxWidth      
      tracklineDrag.Size.width = l_22_1
      indicatorDrag.Position.x = l_22_1 + gIndicator_Offset
      indicatorPress._visible = false
   end
   gWheelTimerCount = 0
   gWheelDirection = l_22_0.direction
   if gWheelTimer == nil then
      gWheelTimer = timer(0.099990844726563)
      gWheelTimer.OnElapsed:connect(OnWheelTimer)
   else
      gWheelTimer:Stop()
      gWheelTimer:Start()
   end
end

OnKeyDown = function(l_23_0, l_23_1, l_23_2)
   if l_23_1.Code == KeyCode_Up then
      OnBtnPress(previous)
      l_23_2.value = true
   else
      if l_23_1.Code == KeyCode_Down then
         OnBtnPress(next)
         l_23_2.value = true
      else
         if l_23_1.Code == KeyCode_Return then
            OnBtnPress(playpause)
            l_23_2.value = true
         end
      end
   end
end

OnKeyUp = function(l_24_0, l_24_1, l_24_2)
   if gTrackDown == false then
     if l_24_1.Code == KeyCode_SwipeUp then
       DoPrevious()
       l_24_2.value = true
     elseif l_24_1.Code == KeyCode_SwipeDown then
       DoNext()
       l_24_2.value = true
     end
   end
   if l_24_1.Code == KeyCode_Up then
      OnBtnRelease(previous)
      l_24_2.value = true
   elseif l_24_1.Code == KeyCode_Down then
      OnBtnRelease(next)
      l_24_2.value = true
   elseif l_24_1.Code == KeyCode_Return then
      OnBtnRelease(playpause)
      l_24_2.value = true
   end
end

OnActivate = function()
   if _application.Visibility == true then
      gPlayer:Activated()
   end
end

KeyboardConnect = function(l_26_0)
   if l_26_0 == true then
      KeyboardHandler.onKeyDown:connect(OnKeyDown)
      KeyboardHandler.onKeyUp:connect(OnKeyUp)
   else
      KeyboardHandler.onKeyDown:disconnect(OnKeyDown)
      KeyboardHandler.onKeyUp:disconnect(OnKeyUp)
   end
end

setRemain = function(l_27_0)
   if (gPlayer.Status == MP_STATUS_PAUSED or gPlayer.Status == MP_STATUS_PLAYING) then
     local l_27_1 = gPlayer.CurTrackPosition            
     if l_27_0 > 0 and l_27_1 < l_27_0 then
      elapse.String = MusicHelper_FormatTime(l_27_1)
      local l_27_2 = l_27_1 / l_27_0 * remainingline.Size.width      
      passline.Size.width = l_27_2
      indicator.Position.x = l_27_2 + gIndicator_Offset
      indicatorPress.Position.x = indicatorPress_startPos + l_27_2
      remain.String = "-" .. MusicHelper_FormatTime(l_27_0 - l_27_1)
    end
 else
   local s = "-" .. MusicHelper_FormatTime(l_27_0)
   remain.String = s
 end
end

LSKFunction = function()
   _application.Navigation:Navigate(URL("Manila://music/musicnowplaying.page"))
end

ShowMenu = function()
   local l_29_0 = gPlayer.Shuffle
   local l_29_1 = gPlayer.Repeat
   local l_29_2 = ""
   local l_29_3 = ".dialog"
   if l_29_1 == MP_REPEAT_OFF and l_29_0 == false then
      l_29_2 = "Manila://music-main-1"
   elseif l_29_1 == MP_REPEAT_OFF and l_29_0 == true then
      l_29_2 = "Manila://music-main-2"
   elseif l_29_1 == MP_REPEAT_ON and l_29_0 == false then
      l_29_2 = "Manila://music-main-3"
   elseif l_29_1 == MP_REPEAT_ON and l_29_0 == true then
      l_29_2 = "Manila://music-main-4"
   elseif l_29_1 == MP_REPEAT_ONE and l_29_0 == false then
      l_29_2 = "Manila://music-main-5"
   else
      l_29_2 = "Manila://music-main-6"
   end
   if OperatorShowMenu ~= nil then
      DialogRequest = OperatorShowMenu(l_29_2, l_29_3, DialogCallback)
   else
      DialogRequest = _application.DialogManager:GetDialog(URL(l_29_2 .. l_29_3))
      DialogRequest.OnExit:connect(DialogCallback)
   end
   KeyboardConnect(false)
   DialogRequest:Show()
end

DialogCallback = function(l_30_0)
   l_30_0.OnExit:disconnect(DialogCallback)
   if l_30_0.Result.ExitType == DialogExitType_Cancel then
     KeyboardConnect(true)
     return 
   end
   local l_30_1 = nomusic._visible
   if l_30_0.Result.UserValue == "Repeat all" then
      gPlayer.Repeat = MP_REPEAT_ON
   elseif l_30_0.Result.UserValue == "Repeat one" then
      gPlayer.Repeat = MP_REPEAT_ONE
   elseif l_30_0.Result.UserValue == "Repeat none" then
      gPlayer.Repeat = MP_REPEAT_OFF
   elseif l_30_0.Result.UserValue == "Shuffle on" then
      if gPlayer.Shuffle ~= true then
        gPlayer.Shuffle = true
      end
   elseif l_30_0.Result.UserValue == "Shuffle off" then
      if gPlayer.Shuffle ~= false then
        gPlayer.Shuffle = false
      end
   elseif l_30_0.Result.UserValue == "Add to playlist" then
     if l_30_1 == false then
       local l_30_2 = gPlayer:GetSongFilePath(gCurTrackIndex)
       MusicConfig_Instance():SetSetting(CONFIG_ADDTOPLAYLIST_FILEPATH, l_30_2)
       _application.Navigation:Navigate(URL("Manila://music/playlist/AddCopyTo/Addto/addtoplaylist.page"))
     end
   elseif l_30_0.Result.UserValue == "Info" then
      if l_30_1 == false then
         _application.Navigation:Navigate(URL("Manila://music/properties/properties.page"))
      end
   elseif l_30_0.Result.UserValue == "AudioBooster" then
      Shell_NavigateTo(ShellLocation_AudioBooster)
   end
   KeyboardConnect(true)
end

getPlayingList = function()
   local l_31_0 = gPlayer:Database()
   local l_31_1 = MusicWhereConditions()
   if l_31_0.Count == 0 then
      trace("[MG] get all song\n")
      l_31_0:Select(TID_SONG, l_31_1)
      if l_31_0.Count > 0 then
         gizmo._visible = true
         nomusic._visible = false
         gCurTrackIndex = 0
         if gPlayer.Shuffle == true then
            l_31_0:ShuffleNowPlayingList(gCurTrackIndex)
         end
         l_31_0:SetPlayingList()
         MusicConfig_Instance():SetSetting(CONFIG_NOWPLAYING_ORDER, 4)
         title.String = gPlayer:GetSongTitle(gCurTrackIndex)
         artistalbum.String = gPlayer:GetSongArtist(gCurTrackIndex)
         artistalbum2.String = gPlayer:GetSongAlbum(gCurTrackIndex)
         setRemain(gDuration)
         ControlPanel._visible = true
         InfoPanel._visible = true
         SongInfo._visible = true
         AlbumList._visible = true
         AlbumQuery = gPlayer:Database().CurAlbumArtList
         ResetListviewCollection(AlbumQuery)
         gPlayer:ReloadList(gCurTrackIndex)
         OnPlayingIndexChange(gCurTrackIndex)
         gEngReloaded = true
      else
         gizmo._visible = false
         nomusic._visible = true
      end
   end
end

OnPositionChange = function(l_32_0, l_32_1, l_32_2)
   if l_32_0 == "" then
      elapse.String = "0:00"
      remain.String = "-0:00"
      passline.Size.width = 0
      indicator.Position.x = 0 + gIndicator_Offset
      indicatorPress.Position.x = indicatorPress_startPos
      return 
   end
   elapse.String = l_32_0
   if l_32_1 ~= "" then
      remain.String = l_32_1
   end
   if gDuration == 0 and gPlayer.CurTrackDuration ~= 0 then
      gDuration = gPlayer.CurTrackDuration
   end
   if gDuration > 0 then
      local l_32_3 = gPlayer.CurTrackPosition / gDuration
      local l_32_4 = l_32_3 * remainingline.Size.width
      passline.Size.width = l_32_4
      indicator.Position.x = l_32_4 + gIndicator_Offset
      indicatorPress.Position.x = indicatorPress_startPos + l_32_4

⌨️ 快捷键说明

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