This commit is contained in:
Mateusz Hinc 2020-01-12 11:44:58 +01:00
parent 61f2af2cb9
commit bd164ff832
4 changed files with 18 additions and 10 deletions

View File

@ -77,7 +77,7 @@
<!-- <meta-data android:name="com.snapchat.kit.sdk.scopes" android:resource="@array/snap_connect_scopes" />--> <!-- <meta-data android:name="com.snapchat.kit.sdk.scopes" android:resource="@array/snap_connect_scopes" />-->
<provider <provider
android:authorities="${applicationId}.fileprovider,pl.edu.amu.wmi.socialaggregator.activity.NewPostActivity" android:authorities="${applicationId}.fileprovider"
android:name="androidx.core.content.FileProvider" android:name="androidx.core.content.FileProvider"
android:exported="false" android:exported="false"
android:grantUriPermissions="true"> android:grantUriPermissions="true">

View File

@ -16,6 +16,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
import com.jakewharton.rxbinding2.view.RxView import com.jakewharton.rxbinding2.view.RxView
import io.reactivex.Observable import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.BiFunction import io.reactivex.functions.BiFunction
import io.reactivex.schedulers.Schedulers import io.reactivex.schedulers.Schedulers
import io.reactivex.subjects.PublishSubject import io.reactivex.subjects.PublishSubject
@ -75,12 +76,14 @@ class NewPostActivity : AppCompatActivity() {
} }
.observeOn(Schedulers.io()) .observeOn(Schedulers.io())
.doOnNext { .doOnNext {
resumedSubject.zipWith( resumedSubject
.zipWith(
Observable.fromIterable(availablesRecycler.chips.entries Observable.fromIterable(availablesRecycler.chips.entries
.filter { (_, chip) -> chip.isChecked } .filter { (_, chip) -> chip.isChecked }
.map { it.key }), .map { it.key }),
BiFunction<Any, SocialPlatform, SocialPlatform> { _, t2 -> t2 } BiFunction<Any, SocialPlatform, SocialPlatform> { _, t2 -> t2 }
) )
.observeOn(Schedulers.io())
.doOnNext { .doOnNext {
val bitmap = BitmapFactory.decodeFile(file!!) val bitmap = BitmapFactory.decodeFile(file!!)
it.addPost( it.addPost(
@ -90,8 +93,9 @@ class NewPostActivity : AppCompatActivity() {
listOf(file!!) listOf(file!!)
) )
} }
.take(availablesRecycler.chips.count { it.value.isChecked }.toLong()) .take(availablesRecycler.chips.count { it.value.isChecked }.toLong() + 1)
.toList() .toList()
.observeOn(AndroidSchedulers.mainThread())
.subscribe { _ -> .subscribe { _ ->
finish() finish()
} }

View File

@ -47,6 +47,10 @@ class Snapchat : SocialPlatform {
SnapPhotoContent(photoFile!!) SnapPhotoContent(photoFile!!)
}.first() }.first()
if (text.isNotBlank()) {
content.captionText = text
}
snapCreativeKitApi.sendWithCompletionHandler( snapCreativeKitApi.sendWithCompletionHandler(
content, content,
object : SnapCreativeKitCompletionCallback { object : SnapCreativeKitCompletionCallback {

View File

@ -1,8 +1,8 @@
<resources> <resources>
<string name="app_name">Social Aggregator</string> <string name="app_name">Social Aggregator</string>
<string name="title_activity_new_post">NewPostActivity</string> <string name="title_activity_new_post">Create new post!</string>
<string name="title_activity_add_social">AddSocialActivity</string> <string name="title_activity_add_social">AddSocialActivity</string>
<string name="title_activity_post_history">PostHistoryActivity</string> <string name="title_activity_post_history">Posts history</string>
<string name="facebook_app_id">2437098899888167</string> <string name="facebook_app_id">2437098899888167</string>
<string name="fb_login_protocol_scheme">fb2437098899888167</string> <string name="fb_login_protocol_scheme">fb2437098899888167</string>