favoritesetting.luac.lua

来自「htc manila 2 sourcecode」· LUA 代码 · 共 216 行

LUA
216
字号
-- Decompiled using luadec 0.6 by sztupy (http://winmo.sztupy.hu)
-- Command line was: -l ;;;;;0,9;0,9,15,21;0,0,4,8,12,16;;0,4;0,4;0,6,77,79,85,97,102;20;3,19,26,28,31;6,26;; 122cccd9_manila.luac 

trace("Load Favorite Setting")
require("transitions")
require("people\\ContactProperty")
require("people\\ContactObject")
require("theme")
require("machine_status_svc")
machineStatus = nil
PropertyObj = nil
gbRequireLandscape = false
FavoriteSettingScreenRotation = nil
g_SelectedIndex = nil
objs3D = {}
objs3D[1] = Camera3D
setOffScreen()
OnNavigateOut = function(l_1_0)
   _request.NavigateOutTo:disconnect(OnNavigateOut)
   Transition(l_1_0, "Out")
end

OnNavigateIn = function(l_2_0)
   Transition(l_2_0, "In")
   if machineStatus == nil then
      machineStatus = MachineStatus()
      machineStatus.PhotoPickerStatus.OnValueChanged:connect(OnPhotoValueChange)
   end
   if PropertyObj.Collection:GetCount() == 0 then
      ShowErrorDialog()
   end
end

machineStatus = nil
YesToAddFavorite = function()
   _application.Navigation:Navigate(URL("Manila://people.page"), false)
end

CancelAddFavorite = function()
   _application.Navigation:NavigateBack()
end

CancelMyContactCallback = function(l_5_0)
   l_5_0.OnExit:disconnect(CancelMyContactCallback)
   local l_5_1 = PropertyObj.DataList[g_SelectedIndex].Value
   if l_5_0.Result.ExitType ~= DialogExitType_Cancel then
      CvCardWrapper_SendMMSNoUI(l_5_1, "MyContact Information", "Me.vcf")
   end
   _application.Navigation:NavigateBack()
end

CancelOtherContactCallback = function(l_6_0)
   l_6_0.OnExit:disconnect(CancelOtherContactCallback)
   local l_6_1 = PropertyObj.DataList[g_SelectedIndex].Value
   local l_6_2 = _request.URL.Parameters:GetParameter("File")
   local l_6_3 = _request.URL.Parameters:GetParameter("Oid")
   PeopleList_StoreOid2(l_6_3)
   if l_6_0.Result.ExitType ~= DialogExitType_Cancel then
      CvCardWrapper_SendMMSNoUI(l_6_1, "MyContact Information", l_6_2)
   end
   _application.Navigation:Navigate(URL("Manila://PeopleDetail/PeopleContact.page"), false)
end

HandleItemCreated = function(l_7_0, l_7_1)
   local l_7_2 = l_7_1.Namespace:FindName("Title")
   local l_7_3 = l_7_1.Namespace:FindName("Desp")
   local l_7_4 = l_7_1.Namespace:FindName("Icon")
   local l_7_5 = l_7_1.Namespace:FindName("line")
   l_7_5.Size.width = PropertyView.Viewport.x
   l_7_4:SetTextureRef(PropertyObj.DataList[l_7_0].Icon)
   l_7_2.String = PropertyObj:GetTypeNameAll(PropertyObj.DataList[l_7_0].Type)
   l_7_3.String = PropertyObj.DataList[l_7_0].Value
   l_7_1.OnSelected:connect(HandleItemSelected)
   l_7_1.OnDeselected:connect(HandleItemDeselected)
end

HandleItemDestroyed = function(l_8_0)
   l_8_0.OnSelected:disconnect(HandleItemSelected)
   l_8_0.OnDeselected:disconnect(HandleItemDeselected)
end

HandleItemSelected = function(l_9_0)
   local l_9_1 = l_9_0.Namespace:FindName("Title")
   local l_9_2 = l_9_0.Namespace:FindName("Desp")
   if l_9_1 ~= nil then
      l_9_1.Color = GetMainTextSelectedColor()
    end
   if l_9_2 ~= nil then
      l_9_2.Color = GetSubTextSelectedColor()
   end
end

HandleItemDeselected = function(l_10_0)
   local l_10_1 = l_10_0.Namespace:FindName("Title")
   local l_10_2 = l_10_0.Namespace:FindName("Desp")
   if l_10_1 ~= nil then
      l_10_1.Color = GetMainTextUnselectedColor()
    end
   if l_10_2 ~= nil then
      l_10_2.Color = GetSubTextUnselectedColor()
   end      
end

HandleItemSelection = function(l_11_0)
   local l_11_1 = _request.URL.Parameters:GetParameter("category")
   g_SelectedIndex = l_11_0
   if l_11_1 == "MyContact" then
      local url = URL("Manila://Confirmation.dialog")
      url.Parameters:AddParameter("Title", Locale:GetString("IDS_SEND_VCARD"))
      url.Parameters:AddParameter("ContentString", Locale:GetString("IDS_SEND_ME_VCARD"))
      local dlg = _application.DialogManager:GetDialog(url)
      dlg.OnExit:connect(CancelMyContactCallback)
      dlg:Show()
   elseif l_11_1 == "OtherContact" then
      local url = URL("Manila://Confirmation.dialog")     
      url.Parameters:AddParameter("Title", Locale:GetString("IDS_SEND_VCARD"))
      url.Parameters:AddParameter("ContentString", Locale:GetString("IDS_SEND_OTHERS_VCARD"))
      local dlg = _application.DialogManager:GetDialog(url)
      dlg.OnExit:connect(CancelOtherContactCallback)
      dlg:Show()
   elseif l_11_0 >= 0 then
      local l_11_2 = PeopleEngine_Instance()
      local l_11_3 = PeopleList()
      local l_11_4 = l_11_3:SaveFavorite(PropertyObj.DataList[l_11_0].Type)
      trace("PropertyObj.DataList[index].Value=" .. tostring(PropertyObj.DataList[l_11_0].Type))
      local l_11_5 = PersonInfo()
      l_11_2:GetPersonInfo(l_11_5)
      local l_11_6 = l_11_5:GetPersonPicture()
      if not l_11_6:HasValue() then
        Shell_PickPicture(false, "", false)
     else
        YesToAddFavorite()
     end
  end
end

PrepareFunction = function()
   trace("PrepareFunction start")
   ContactDisplayName.String = PropertyObj.Name
   PropertyObj:SetContactPicture(ContactPhoto)
   Detail.String = "[[IDS_FAVPEO_ADD_DEP]]"
   PropertyObj.DataList = {}
   local l_12_0 = PropertyObj.ContactInfo:GetMobilePhoneNum()
   PropertyObj:SetPropertyValue(ContactPropertyID_MobileTelephoneNumber, l_12_0, "CallMobile_Up")
   PropertyObj:SetPropertyValue(ContactPropertyID_CompanyTelephoneNumber, PropertyObj.ContactInfo:GetCompanyPhoneNum(), "Company_Up")
   PropertyObj:SetPropertyValue(ContactPropertyID_BusinessTelephoneNumber, PropertyObj.ContactInfo:GetWork1PhoneNum(), "Callwork_Up")
   PropertyObj:SetPropertyValue(ContactPropertyID_BusinessTelephoneNumber2, PropertyObj.ContactInfo:GetWork2PhoneNum(), "Callwork_Up")
   PropertyObj:SetPropertyValue(ContactPropertyID_HomeTelephoneNumber, PropertyObj.ContactInfo:GetHome1PhoneNum(), "Callhome_Up")
   PropertyObj:SetPropertyValue(ContactPropertyID_HomeTelephoneNumber2, PropertyObj.ContactInfo:GetHome2PhoneNum(), "Callhome_Up")
   PropertyObj:SetPropertyValue(ContactPropertyID_CarTelephoneNumber, PropertyObj.ContactInfo:GetCarPhoneNum(), "Car_Up")
   PropertyObj:SetPropertyValue(ContactPropertyID_AssistantTelephoneNumber, PropertyObj.ContactInfo:GetAssistantPhoneNum(), "Assistant_Up")
   PropertyObj:SetPropertyValue(ContactPropertyID_PagerNumber, PropertyObj.ContactInfo:GetPegerPhoneNum(), "Pager_Up")
   PropertyObj:SetPropertyValue(ContactPropertyID_RadioTelephoneNumber, PropertyObj.ContactInfo:GetRadioPhoneNum(), "Radio_Up")
   if l_12_0 ~= nil and l_12_0 ~= "" then
      PropertyObj:SetPropertyValue(ContactPropertyID_MMS, l_12_0, "SendSMS_Up")
   end
   PropertyObj:SetPropertyValue(ContactPropertyID_EmailAddress1, PropertyObj.ContactInfo:GetEmailAddress1(), "SendEmail_Up")
   PropertyObj:SetPropertyValue(ContactPropertyID_EmailAddress2, PropertyObj.ContactInfo:GetEmailAddress2(), "SendEmail_Up")
   PropertyObj:SetPropertyValue(ContactPropertyID_EmailAddress3, PropertyObj.ContactInfo:GetEmailAddress3(), "SendEmail_Up")
   trace("PropertyObj.Collection:GetCount()=" .. PropertyObj.Collection:GetCount())
   trace("PrepareFunction end")
end

OnPhotoValueChange = function()
   local l_13_0 = machineStatus.PhotoPickerStatus.Value
   trace("+++++++++++++++++++++++++" .. l_13_0)
   if l_13_0 == 0 then
      trace("photo picker init")
   elseif l_13_0 == 1 then
      local l_13_1 = machineStatus.PhotoPickerFilePath.Value
      trace("OnPhotoValueChange++++" .. l_13_1)
      local l_13_2 = PeopleEngine_Instance()
      local l_13_3 = PeopleList()
      local l_13_4 = l_13_3:SetFavPic(l_13_1)
      YesToAddFavorite()
   elseif l_13_0 == 2 then
      YesToAddFavorite()
   elseif l_13_0 == 3 then
      trace("photo picker deactive")
   end
   trace("setResult=" .. tostring(result))
end

ShowErrorDialog = function()
   trace("ShowErrorDialog")
   local l_14_0 = URL("Manila://Confirmation.dialog")
   l_14_0.Parameters:AddParameter("Title", "Information")
   l_14_0.Parameters:AddParameter("ContentString", "Please add contact information first.")
   l_14_0.Parameters:AddParameter("Type", "OK")
   local l_14_1 = _application.DialogManager:GetDialog(l_14_0)
   l_14_1.OnExit:connect(CancelAddFavorite)
   l_14_1:Show()
end

main = function()
   if _application.Store:GetStringValue(Lifetime_Permanent, "EnableLandscape") == "true" then
      trace("[ContactPicker] : EnableLandscape")
      require("people\\FavoriteSetting_Landscape")
      gbRequireLandscape = true
      FavoriteSettingScreenRotation = FavoriteSetting_ScreenRotation(PropertyView, FavoriteCamera2D, Camera3D)
   end
   _request.NavigateOutTo:connect(OnNavigateOut)
   _request.NavigateInFrom:connect(OnNavigateIn)
   _application:SetLeftSoftkey(Softkey((Locale:GetString("")), nil))
   _application:SetRightSoftkey(Softkey(Locale:GetString("IDS_CANCEL"), CancelAddFavorite))
   PropertyObj = PropertyObject(PropertyView, PrepareFunction, HandleItemCreated, HandleItemDestroyed, HandleItemSelection, SelectorFull)
   PropertyObj:PrepareFunction()
   if FavoriteSettingScreenRotation then
      FavoriteSettingScreenRotation:OnScreenRotation()
   end
end

main()
trace("select favorite setting end")

⌨️ 快捷键说明

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