android

Firebase rules: dynamically give access to a specific user

前提是你 提交于 2021-02-19 02:31:12
问题 I'm building an Android app which requires me to store some pictures for the user. Let's say I have 2 users: A and B. They should be able to read / write on their specific folders: user A can read and write to bucket/images/userA and user B can read and write to bucket/images/userB. They should not have access to anything else. Now let's say user A uploaded picture1.jpg and picture2.jpg. How can user A grant access to bucket/images/userA/picture1.jpg to user B? User B should not have access

android --------System.err: java.net.UnknownServiceException: CLEARTEXT .....

余生长醉 提交于 2021-02-19 02:28:30
1,当调用远程接口进行网络通信时,报如下错误: W/ System.err: java.net.UnknownServiceException: CLEARTEXT communication to 10.240.35.113 not permitted by network security policy 这是因为新的保护机制对于仅使用安全通信的应用,Android 6.0 Marshmallow(API 级别 23)引入了两种机制来解决回退到明文通信的问题:(1) 在生产/安装库中,禁止明文通信,以及 (2) 在开发/QA 期间,在遇到任何非 TLS/SSL 通信时,予以记录或者触发崩溃。下文将更详细地介绍这两种机制。 2,解决方法: 如果一定要使用明文通信的话,则可以打开AndroidManifest.xml 文件,在 application 元素中添加: android:usesCleartextTraffic=” true ” 备注: 1)为了安全,不建议上面的使用明文的通信方式,不过上面的这种方法可以作为一种临时的通信策略 2)如果声明不使用明文通信,则可以在application元素中添加: android:usesCleartextTraffic=” false ” 此声明指示该应用不使用明文网络通信,并使 Android Marshmallow

Creating a chat bubble using Shapes or 9-patch image

旧城冷巷雨未停 提交于 2021-02-19 02:27:29
问题 I am trying to create a template for my chat bubbles in an android app i am currently working on. The end result should look something like this: I tried it with Shapes, but i could not get the multiple layers right. I also tried a 9-patch image, but creating the 9-patch was as far as i got. I hade no clue as to how to use it, specifically with the avatar, message header and content placements. Can anyone help out? My knowledge on shapes is fairly limited, although, i think i know just enough

Creating a chat bubble using Shapes or 9-patch image

匆匆过客 提交于 2021-02-19 02:26:59
问题 I am trying to create a template for my chat bubbles in an android app i am currently working on. The end result should look something like this: I tried it with Shapes, but i could not get the multiple layers right. I also tried a 9-patch image, but creating the 9-patch was as far as i got. I hade no clue as to how to use it, specifically with the avatar, message header and content placements. Can anyone help out? My knowledge on shapes is fairly limited, although, i think i know just enough

Reference String Resource in custom XML Resource

馋奶兔 提交于 2021-02-19 02:24:28
问题 In the assets folder of my Android App Project I am storing custom XML files which describe actions in my game. Since they are a little more complex, they can not be directly written as Android Resources. Update: I am storing my custom (complex) XML files in the res/xml folder now. Simple Example: <dialog> <npc>1</npc> <text>Hello! How are you?</text> </dialog> What I want is to use the convenient advantages of Android String resources for language localisation. In the example above, I want

How to randomize ProGuard dictionaries on each build?

倾然丶 夕夏残阳落幕 提交于 2021-02-19 02:24:07
问题 I found an article which introduces the concept of randomizing the dictionary entries instead of using the standard "a, b, c, ..." for class names and variables when obfuscating. He explains that tasks can be run in gradle on build to generate a randomized text file which can replace the one provided by default: tasks.whenTaskAdded { currentTask -> //Android Gradle plugin may change this task name in the future def prefix = 'transformClassesAndResourcesWithProguardFor' if (currentTask.name

canvas drawtext with multiline

大憨熊 提交于 2021-02-19 02:19:32
问题 I am developing a image commenting application. I draw text in canvas with canvas.drawText(text, x, y, imgPaint); This appears in a single line. I need to break the line to multiline when the text crosses the canvas width Thanks in advance 回答1: You need to use StaticLayout : TextPaint mTextPaint=new TextPaint(); StaticLayout mTextLayout = new StaticLayout("my text\nNext line is very long text that does not definitely fit in a single line on an android device. This will show you how!",

RecyclerView notifyItemInserted() Animation not showing when position is 0 but works fine with other position

孤者浪人 提交于 2021-02-19 02:19:06
问题 I am using data.add(0,item); notifyItemInserted(0); This works fine as long as the items space is not filled up. After that, animation is not seen. animation works fine when i do data.add(1,item); notifyItemInserted(1); How to add items in 0 position and show animation all the time. Do I have to use scrollToPosition? 回答1: call scrollToPosition(0) if you wan't it to scroll to position 0 after new item is added. RecyclerView will just keep the current top item in place, which is why you are not

How request permissions with Jetpack Compose?

随声附和 提交于 2021-02-19 02:18:34
问题 How should be implemented requesting permission from Jetpack Compose View? I'm trying implement application accessing Camera with Jetpack Compose. I tried example from How to get Current state or context in Jetpack Compose Unfortunately example is no longer working with dev06. fun hasPermissions(context: Context) = PERMISSIONS_REQUIRED.all { ContextCompat.checkSelfPermission(context, it) == PackageManager.PERMISSION_GRANTED } } } 回答1: A little late but this might help as I had the problem

How request permissions with Jetpack Compose?

孤人 提交于 2021-02-19 02:16:54
问题 How should be implemented requesting permission from Jetpack Compose View? I'm trying implement application accessing Camera with Jetpack Compose. I tried example from How to get Current state or context in Jetpack Compose Unfortunately example is no longer working with dev06. fun hasPermissions(context: Context) = PERMISSIONS_REQUIRED.all { ContextCompat.checkSelfPermission(context, it) == PackageManager.PERMISSION_GRANTED } } } 回答1: A little late but this might help as I had the problem