小编The*_*o95的帖子

RxJava2: Alternative to rx.Observable method first(predicate)

I wanted to use RxJava but can't come up with alternative for method

public final Observable<T> first(Func1<? super T,java.lang.Boolean> predicate)
Run Code Online (Sandbox Code Playgroud)

in RxJava2.

What I want to do is following:

return io.reactivex.Observable
    .concat(source1, source2, source3, source4)
    .first(obj -> obj != null);
Run Code Online (Sandbox Code Playgroud)

Parameters source1 to source4 are io.reactivex.Observable instances that I concatenate and I want resulting Observable to emit only the very first item that isn't null but this of course fails because io.reactivex.Observable doesn't have method first(Func1 predicate) like rx.Observable. …

java rx-java reactivex rx-java2

4
推荐指数
1
解决办法
1239
查看次数

将 Android 矢量 drawable 转换为启动器图标 PNG

我已经将 Android 启动器图标设为矢量,但我发现我应该使用 PNG 而不是矢量(XML)。如何将我的矢量图像转换为启动器图标的 PNG。

如果它有任何帮助,这是向量:

<?xml version="1.0" encoding="utf-8"?>
<layer-list
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="100dp"
    android:height="100dp">
    <item>
        <shape xmlns:android="http://schemas.android.com/apk/res/android"
               android:shape="oval">
            <solid
                android:color="#5FB0C9"/>
            <size
                android:width="100dp"
                android:height="100dp"/>
            <stroke
                android:width="5dip"
                android:color="#3DA8C9"/>
        </shape>
    </item>
    <item
        android:gravity="center">
        <vector
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:width="60dp"
            android:height="60dp"
            android:viewportHeight="100.0"
            android:viewportWidth="100.0">
            <path
                android:fillColor="#2c819b"
                android:pathData="M72.4,3.5c-2,0 -3.9,0 -5.9,0c-4.5,0 -7,3.4 -7.5,7.5c-0.9,7.3 -1.8,14.6 -2.7,21.9c2.5,-2.5 5,-5 7.5,-7.5c-7.8,-0.2 -15.6,-0.3 -23.3,-0.5c2.5,2.5 5,5 7.5,7.5c0.9,-7.1 1.8,-14.3 2.7,-21.4c0.5,-4.1 -3.8,-7.5 -7.5,-7.5c-2,0 -3.9,0 -5.8,0c-4.5,0 -7,3.4 -7.5,7.5c-0.9,7.1 -1.8,14.2 -2.7,21.3c2.5,-2.5 5,-5 7.5,-7.5c-7.1,-0.2 -14.3,-0.3 -21.4,-0.5c-3,-0.1 -6.8,2.3 -7.2,5.5c-0.3,1.9 -0.6,3.9 -0.8,5.8c-0.7,4.8 1.9,9.4 7.2,9.5c7.2,0.2 14.4,0.3 21.5,0.5c-2.5,-2.5 -5,-5 -7.5,-7.5c-1,7.7 -1.9,15.4 -2.9,23.2c2.5,-2.5 5,-5 7.5,-7.5c-7.3,-0.2 -14.7,-0.3 …
Run Code Online (Sandbox Code Playgroud)

xml png android vector android-vectordrawable

2
推荐指数
1
解决办法
3828
查看次数