Skip to content

Instantly share code, notes, and snippets.

@peterli888
Last active June 17, 2017 10:15
Show Gist options
  • Save peterli888/b7d223d32f552b71e7a2b85a10ec67d7 to your computer and use it in GitHub Desktop.
Save peterli888/b7d223d32f552b71e7a2b85a10ec67d7 to your computer and use it in GitHub Desktop.
tiapp.xml
<property name="ti.android.root.actas.launcher" type="bool">true</property>下面用到作为判断
<property name="ti.android.root.reappears.restart" type="bool">false</property>这个在ti代码里面查得到
<activity
android:configChanges="keyboardHidden|orientation"
android:label="Lyapp上升"
android:name=".LyappActivity" android:theme="@style/Theme.Titanium"
android:screenOrientation="nosensor"
android:excludeFromRecents="false"
android:resumeWhilePausing="false"
android:clearTaskOnLaunch="true"-----这个不能要 否则每次home键重新启动
>
<intent-filter>
<category android:name="android.intent.category.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/> 没有这一个 原桌面没有图标
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.MONKEY"/> 这个特殊 可以查,但是没什么用
</intent-filter>
问题:桌面切换时的空白时间,第一次按Home键会重启
原因:spalsh-tiapp-LyappActivity是tootactivity
但是window-proxy-是->TiTranslucentActivity->TiActivity->TiBaseActivity-是另外一个activity
方案:合并-融合-沟通 这两个 activity
launcheractivity
restartActivity()######################relaunch.addCategory(Intent.CATEGORY_LAUNCHER);
==>
TiApplication tiApp = getTiApp();
TiProperties systemProperties = tiApp.getAppProperties();
if( systemProperties.getBool("ti.android.root.actas.launcher", false)==false){//liyong add
relaunch.addCategory(Intent.CATEGORY_LAUNCHER);
}
rootactivity.onCreate##############################
!categories.contains(Intent.CATEGORY_LAUNCHER) 下面本来是要删除cateroty 加上launcher
改为
TiProperties systemProperties = tiApp.getAppProperties();
if( systemProperties.getBool("ti.android.root.actas.launcher", false)==false){如果没有 继续原来的
else 尝试直接重新启动 避免桌面切换时的空白时间 但是失败
如果直接 不(删除cateroty 加上launcher )会反复重启
如果靠这个 if(categories.contains(Intent.CATEGORY_MONKEY))直接crash
靠这个 if(intent.hasExtra("hasrestared")==false){
intent.putExtra("hasrestared",true);
接下来不(删除cateroty 加上launcher ) 而直接重启 可行,但是没有用 还是会桌面切换时的空白时间
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment