溢出菜单单击禁用Immersive模式 – Android 4.4 Kitkat

有人知道这是一个错误还是应该这样做。 当使用KitKat的Immersive模式时点击Overflow图标,它禁用沉浸模式。 其他人遇到这个? 完整的代码由谷歌 – 在这里 public void toggleHideyBar() { // The UI options currently enabled are represented by a bitfield. // getSystemUiVisibility() gives us that bitfield. int uiOptions = getActivity().getWindow().getDecorView().getSystemUiVisibility(); int newUiOptions = uiOptions; boolean isImmersiveModeEnabled = ((uiOptions | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY) == uiOptions); if (isImmersiveModeEnabled) { Log.i(TAG, “Turning immersive mode mode off. “); } else […]

Unity C#和Layar SDK Java – AndroidJavaException

我试图将Layar SDK集成到Unity中。 但是我有一些问题。 这是AndroidManifest.xml 这是我的c# using UnityEngine; public class IntegrationLayar : MonoBehaviour { private AndroidJavaObject LayarSDK = null; private AndroidJavaObject activity = null; private AndroidJavaObject context = null; private string oauthKey = “code”; private string oauthSecret = “code2”; void Start () { if (LayarSDK == null) { using (AndroidJavaClass unityPlayer = new AndroidJavaClass(“com.unity3d.player.UnityPlayer”)) { activity […]

在Intellij中编译java 9问题

我正在尝试在最新的intellij(社区版)中使用Java9进行游戏: IntelliJ IDEA 2016.3 Build#IC-163.7743.44,构建于2016年11月17日JRE:1.8.0_112-release-408-b2 x86 JVM:由JetBrains sro开发的OpenJDK Server VM 不写任何代码Error:Abnormal build process termination: C:\Users\pisarevv\Desktop\jdk-9\bin\java -Xmx700m -Djava.awt.headless=true -Djdt.compiler.useSingleThread=true -Dcompile.parallel=false -Drebuild.on.dependency.change=true -Djava.net.preferIPv4Stack=true -Dio.netty.initialSeedUniquifier=1630946162877517857 -Dfile.encoding=windows-1252 -Djps.file.types.component.name=CommunityFileTypes -Duser.language=en -Duser.country=US -Didea.paths.selector=IdeaIC2016.3 “-Didea.home.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.3” -Didea.config.path=C:\Users\pisarevv\.IdeaIC2016.3\config -Didea.plugins.path=C:\Users\pisarevv\.IdeaIC2016.3\config\plugins -Djps.log.dir=C:/Users/pisarevv/.IdeaIC2016.3/system/log/build-log “-Djps.fallback.jdk.home=C:/Program Files (x86)/JetBrains/IntelliJ IDEA Community Edition 2016.3/jre/jre” -Djps.fallback.jdk.version=1.8.0_112-release -Djava.io.tmpdir=C:/Users/pisarevv/.IdeaIC2016.3/system/compile-server/_temp_ -Dkotlin.incremental.compilation.experimental=true -Dkotlin.daemon.enabled -Dkotlin.daemon.client.alive.path=\”C:\Users\pisarevv\AppData\Local\Temp\kotlin-idea-451096579120734544-is-running\” -classpath “C:/Program Files (x86)/JetBrains/IntelliJ IDEA Community […]

Kotlin`shl`不工作

我试图将shl应用于Kotlin中的Int值: val a = 1092455 println(a.toString()) println(toString(bits(one))) println(toString(bits(one shl 16))) println(toString(bits(one shr 16))) 这会产生以下输出: 1092455 0000000000010000 1010101101100111 0000000000000000 0000000000000000 0000000000000000 0000000000010000 正如你所看到的, shr正确的结果是最左边的16位( 0000000000010000 )被移到右边,但是shl没有给出预期的输出( 1010101101100111 0000000000000000 )。 我错过了什么? 编辑: bits方法: fun bits(value: Int): BooleanArray { var x = value.toDouble() val result = BooleanArray (32) for (i in 31 downTo 0) { val d = […]

如何使用Kotlin从Firebase数据库检索数据?

这是我在Firebase上上传的模型: public class OnlineMatch{ private User user1; private User user2; public OnlineMatch(User firstPlayer, User secondPlayer) { this.user1 = firstPlayer; this.user2 = secondPlayer; } } 然后我以这种方式将数据发送到Firebase(kotlin): fun createMatch(match: OnlineMatch) { val matchList = database.child(“multiplayer”).push() matchList.setValue(match) } 因此,我的数据库结构如下: 如果我展开一个节点,我可以看到完美的对象:OnlineMatch(User1,User2) 现在我想查询数据库并获得一个ArrayList”。 我已经find了Firebase文档,但是我没有发现任何用处。 我能怎么做? 提前致谢。

Kotlin懒惰的默认属性

在Kotlin中,我如何定义一个具有惰性默认值的variables? 比如val就是这样的: val toolbarColor by lazy {color(R.color.colorPrimary)} 我想要做的是,有一个属性( toolbarColor )的默认值,我可以改变这个值的其他任何东西。 可能吗? 编辑:这是部分把戏。 var toolbarColor = R.color.colorPrimary get() = color(field) set(value){ field = value } 有没有可能通过写作来缓解这一点 var toolbarColor = color(R.color.colorPrimary) set(value){ field = value } 在默认值的计算方式懒惰? 目前它不会工作,因为color()需要一个只在稍后初始化的Context 。

什么是Kotlin后台?

作为Java开发人员,后台字段的概念对我来说有点陌生。 鉴于: class Sample { var counter = 0 // the initializer value is written directly to the backing field set(value) { if (value >= 0) field = value } } 这个后盾有什么好处? Kotlin的文档说: Kotlin中的类不能有字段。 但是,使用自定义访问器时有时需要有后台字段 。 为什么? 在setter中使用属性名称本身的区别是什么,例如。 class Sample { var counter = 0 set(value) { if (value >= 0) this.counter = value // […]

Kotlin序列连接

val seq1 = sequenceOf(1, 2, 3) val seq2 = sequenceOf(5, 6, 7) sequenceOf(seq1, seq2).flatten().forEach { … } 这就是我正在做序列连接,但我担心它实际上是复制元素,而我所需要的是一个迭代器,它使用我给它的迭代器(seq1,seq2)中的元素。 有这样的function吗?

在lambda中使用return?

在下面的代码中,我想显示空的视图,如果旅行是空的,然后返回并避免运行下面的代码,但编译器说:“返回不允许在这里”。 mainRepo.fetchUpcomingTrips { trips -> if (trips.isEmpty()) { showEmptyViews() return } // run some code if it’s not empty } 有没有办法像那样回报? 我知道我可以把它放在一个if else块中,但是如果有其他情况,我讨厌写作,当我有更多的条件时,在我看来这是不太可理解的。

从cmd运行时,Spring AOP不工作

我正在亚马逊aws运行一个Spring启动应用程序,并且我正在使用Spring AOP登录到一个数据库,当一些注释的方法被调用。 当我使用IntelliJ Idea Ultimate(而不是使用gradle任务运行)在本地计算机上运行我的服务器时,一切正常,但是,如果将其部署到ElasticBeans(Java平台)或使用Gradle运行,则顶部是不工作。 我的function很好,我看到的结果等..但没有记录在我的数据库。 有人可以帮忙吗? @Aspect @Component public class JAspects { private final Aspects aspectWorker; public JAspects(@Autowired Aspects aspects) { this.aspectWorker = aspects; } @Around(value = “@annotation(enableLogging) && args(reqArg, resArg,..)”) public ResponseEntity around(ProceedingJoinPoint joinPoint, EnableLogging enableLogging, HttpServletRequest reqArg, HttpServletResponse resArg) { long startTime = System.currentTimeMillis(); ResponseEntity result = null; try { result = […]