Skip to content

Commit

Permalink
New YoutubeActivity; Delete confirmations
Browse files Browse the repository at this point in the history
  • Loading branch information
feelfreelinux committed May 5, 2018
1 parent 623ec28 commit ae3395f
Show file tree
Hide file tree
Showing 25 changed files with 232 additions and 173 deletions.
9 changes: 6 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ before_install:
-iv $encrypted_110fd07a76f6_iv -in ci-release-keystore.jks.enc -out ci-release-keystore.jks
-d || travis_terminate 1; fi
before_script:
- if [ ${TRAVIS_SECURE_ENV_VARS} = "false" ]; then export apiKey="exampleKey" apiSecret="exampleSecret";
fi
- echo -e "apiKey=\"$wykopApiKey\"\napiSecret=\"$wykopApiSecret\"" >> credentials.properties
- if [ ${TRAVIS_SECURE_ENV_VARS} = "false" ]; then export apiKey="exampleKey" apiSecret="exampleSecret"
googleKey="exampleGKey"; fi
- echo -e "apiKey=\"$wykopApiKey\"\napiSecret=\"$wykopApiSecret\"\ngoogleKey=\"$googleKey\""
>> credentials.properties
script:
- "./gradlew assembleRelease"
before_deploy:
Expand All @@ -49,3 +50,5 @@ env:
- secure: L+jstmzIMMCUjcFUVlT91UtClx+UsaiYmoippcglI0FzTjxdlxickmqZOJaunwLRNL9UEjlIuxtvMrv+C8p0205Q/yAI2UEGmij3rzBnADias19pbgyOHS6xbH6E9nGReyh/EE7nxbHmjtFYZYAXSdjUn74TASYg9AZnps0WF6z3ZZtYCY/47KeYJdGJb+M9RfBZr24gUCBlZEkGxrrs/LFJCWzfoAiZPQqWP/8sO002HDrlVg99nRKaBXoMFTOhBagy9dhsp3rcdt7ylwO8TLLbvZh27JX314l3cRA3oLqR0Iw0xKGT1ws8pJ+NAsQunSfPCmh6Vgdydw1WJQC9R7/vbh4p6pev/KVBVh3nyvqvDVv8u/vzG7+hvxdJ5l2BAph2jT7nyfYuqqUui+Qt8W0mXJqbuAFnOt9GndnMaSI+h93UGk4Vbh/Osssrjev1negz9hvhv5h7UITVcOJCzfEF2J9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fG3v/AbO0XNl7L+gHjqVmXeKVEzCuWKPpvZl8zI0xJMohFSheSHwvTytfhzD6uxkdjHGdmwRX1oqUgv/qr29+VYTtM20xPycjtrP5PPl1VtFJmLcjpbbSSGDkIJoXhW8vsCYX0Q=
- secure: CH2Tdc9ATxfeH1ZmbA+A1bFBoiqNvkThyRn3aeE3sB2cxLYSsVhANlFbhumf/chS5ellqCURJm1hXbawWkchz2IdVRTY7FvJXCKZo65CtoJWPefGhQpojKq+yk+21fBfQZls4qfMV2SzNh5PFvtIs6Wvl7terHWkSuPXfce4M5rM4EZEKFKXhKsScOs2oABp5xVTrxrmchP+5pmhFWx/jk8qZQr1fyLTt5hmMOsfXpjKp6KoVF796G0XX68qEeXEqBVgO5mGgWfZAE3ItXfvWqKOn+AUgGJZewUVho8s/qPeuBVRkWRas0R+iZBbStj9lXmVsjzedsJXpmq5O7wzX1+Bd5gTFj4egjzgWvm569Rvx1aoQB6RUZFK3tv5mxiu0WuP2wlgjN9cNUoYpTZcNmoOvSulM7AdQY6v0P0BHnXB84eZYqQSMwwifpA5aXFaPW+46wmEdwWQIlWgzZnop2lDdnOYkB0ZzEhhCOtPLVdW00Z1FefFPN9WE/poUaoSDLcCynxVYxiOVivz/gYxkB+WqVXvwZwb6PhbuYwIevNAb0/rrZuiz/1vT6f//YnRHkCoNRv1NlzuWZn1x7ASDAcmxA+ot9DftUiiEOXW5DAj/mUJeUgklCkOq9PjsgOJpCZSFwZx43qaf9r2qoM6C2/Md9fEEpKQggTb2nW2yoI=
24 changes: 12 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ android {
buildConfigField "String", "BUGSNAG_KEY", "\"${getBugsnagKey()}\""
buildConfigField 'String', 'APP_SECRET', credentialsProperties['apiSecret']
buildConfigField 'String', 'APP_KEY', credentialsProperties['apiKey']
buildConfigField 'String', 'GOOGLE_KEY', credentialsProperties['googleKey']
}

signingConfigs {
Expand Down Expand Up @@ -103,7 +104,7 @@ dependencies {
implementation "com.android.support:support-v4:$versions.supportLibrary"
implementation "com.android.support:customtabs:$versions.supportLibrary"
implementation 'com.android.support.constraint:constraint-layout:1.1.0-beta5'
implementation "com.google.android.gms:play-services-gcm:11.8.0"
implementation 'com.google.android.gms:play-services-gcm:11.8.0'
implementation 'com.android.support:multidex:1.0.2'
implementation 'com.devbrackets.android:exomedia:4.1.0'
implementation 'com.google.android.exoplayer:extension-okhttp:2.6.0'
Expand All @@ -112,12 +113,11 @@ dependencies {
implementation 'com.google.code.gson:gson:2.8.2'

// Utils
implementation 'com.github.PierfrancescoSoffritti:AndroidYouTubePlayer:4.1.5'
implementation "com.bugsnag:bugsnag-android:4.1.3"
implementation 'com.bugsnag:bugsnag-android:4.1.3'
implementation "org.ocpsoft.prettytime:prettytime:$versions.prettytime"
implementation "com.jsibbold:zoomage:1.1.0"
implementation "com.github.chrisbanes:PhotoView:2.1.3"
implementation "com.pavelsikun:material-seekbar-preference:2.3.0"
implementation 'com.jsibbold:zoomage:1.1.0'
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
implementation 'com.pavelsikun:material-seekbar-preference:2.3.0'
implementation 'com.github.feelfreelinux:Slidr:v2.2'

// Retrofit
Expand All @@ -134,18 +134,17 @@ dependencies {
implementation "io.reactivex.rxjava2:rxandroid:$versions.rxandroid"
implementation "io.reactivex.rxjava2:rxjava:$versions.rxjava"
implementation 'com.jakewharton.threetenabp:threetenabp:1.0.5'
implementation 'org.jetbrains:markdown:0.1.25'
implementation 'org.jetbrains:markdown:0.1.25'

// AppUpdater
implementation "com.github.javiersantos:AppUpdater:$versions.appUpdater"


// Dagger 2
implementation "com.google.dagger:dagger:2.13"
implementation 'com.google.dagger:dagger:2.13'
kapt "com.google.dagger:dagger-compiler:2.13"
kapt "com.google.dagger:dagger-android-processor:2.13"
implementation "com.google.dagger:dagger-android:2.13"
implementation "com.google.dagger:dagger-android-support:2.13"
implementation 'com.google.dagger:dagger-android:2.13'
implementation 'com.google.dagger:dagger-android-support:2.13'
provided 'org.glassfish:javax.annotation:10.0-b28'

// Glide
Expand All @@ -156,7 +155,7 @@ dependencies {

// Android-Job
implementation "com.evernote:android-job:$versions.androidjob"
implementation "com.github.suckgamony.RapidDecoder:library:7cdfca47fa"
implementation 'com.github.suckgamony.RapidDecoder:library:7cdfca47fa'

// Unit tests
testImplementation "org.mockito:mockito-core:$versions.mockito"
Expand All @@ -165,4 +164,5 @@ dependencies {
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation files('libs/YouTubeAndroidPlayerApi.jar')
}
Binary file added app/libs/YouTubeAndroidPlayerApi.jar
Binary file not shown.
7 changes: 4 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@
<activity android:name=".ui.modules.embedview.EmbedViewActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:theme="@style/TransparentActivityTheme" />
<activity android:name=".ui.modules.embedview.YoutubeViewActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:theme="@style/TransparentActivityTheme"/>
<activity android:name=".ui.modules.blacklist.BlacklistActivity" />
<activity android:name=".ui.modules.addlink.AddlinkActivity">
<intent-filter
Expand All @@ -123,6 +120,10 @@
<data android:mimeType="text/plain" />
</intent-filter>
</activity>
<activity android:name=".ui.modules.embedview.YoutubeActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:theme="@style/FullscreenActivityTheme"/>

<receiver android:name=".ui.modules.notifications.notificationsservice.WykopNotificationsBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package io.github.feelfreelinux.wykopmobilny

const val APP_KEY = BuildConfig.APP_KEY
const val APP_SECRET = BuildConfig.APP_SECRET
const val APP_SECRET = BuildConfig.APP_SECRET
const val GOOGLE_KEY = BuildConfig.GOOGLE_KEY
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import io.github.feelfreelinux.wykopmobilny.ui.modules.blacklist.BlacklistFragme
import io.github.feelfreelinux.wykopmobilny.ui.modules.blacklist.BlacklistModule
import io.github.feelfreelinux.wykopmobilny.ui.modules.embedview.EmbedViewActivity
import io.github.feelfreelinux.wykopmobilny.ui.modules.embedview.EmbedViewModule
import io.github.feelfreelinux.wykopmobilny.ui.modules.embedview.YoutubeViewActivity
import io.github.feelfreelinux.wykopmobilny.ui.modules.embedview.YoutubeActivity
import io.github.feelfreelinux.wykopmobilny.ui.modules.input.entry.add.AddEntryActivity
import io.github.feelfreelinux.wykopmobilny.ui.modules.input.entry.add.AddEntryActivityModule
import io.github.feelfreelinux.wykopmobilny.ui.modules.input.entry.comment.EditEntryCommentActivity
Expand All @@ -19,7 +19,6 @@ import io.github.feelfreelinux.wykopmobilny.ui.modules.input.entry.edit.EditEntr
import io.github.feelfreelinux.wykopmobilny.ui.modules.input.entry.edit.EditEntryActivityModule
import io.github.feelfreelinux.wykopmobilny.ui.modules.input.link.edit.LinkCommentEditActivity
import io.github.feelfreelinux.wykopmobilny.ui.modules.input.link.edit.LinkCommentEditModule
import io.github.feelfreelinux.wykopmobilny.ui.modules.input.link.edit.LinkCommentEditView
import io.github.feelfreelinux.wykopmobilny.ui.modules.links.downvoters.DownvotersActivity
import io.github.feelfreelinux.wykopmobilny.ui.modules.links.downvoters.DownvotersModule
import io.github.feelfreelinux.wykopmobilny.ui.modules.links.linkdetails.LinkDetailsActivity
Expand Down Expand Up @@ -101,6 +100,9 @@ abstract class ActivityBuilder {
@ContributesAndroidInjector(modules = [RelatedModule::class])
abstract fun bindRelatedActivity() : RelatedActivity

@ContributesAndroidInjector(modules = [])
abstract fun bindYoutubeActivity() : YoutubeActivity

@ContributesAndroidInjector(modules = [ProfileModule::class, ProfileFragmentProvider::class])
abstract fun bindProfileActivity() : ProfileActivity

Expand All @@ -113,8 +115,6 @@ abstract class ActivityBuilder {
@ContributesAndroidInjector(modules = [EmbedViewModule::class])
abstract fun bindEmbedActivity() : EmbedViewActivity

@ContributesAndroidInjector(modules = [])
abstract fun bindYoutubeActivity() : YoutubeViewActivity

@ContributesAndroidInjector(modules = [BlacklistModule::class, BlacklistFragmentProvider::class])
abstract fun bindBlacklistACtivity() : BlacklistActivity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ package io.github.feelfreelinux.wykopmobilny.ui.modules

import android.app.Activity
import android.content.Intent
import com.google.android.youtube.player.YouTubeStandalonePlayer
import io.github.feelfreelinux.wykopmobilny.GOOGLE_KEY
import io.github.feelfreelinux.wykopmobilny.api.ENTRYCOMMENT_REPORT_URL
import io.github.feelfreelinux.wykopmobilny.api.ENTRY_REPORT_URL
import io.github.feelfreelinux.wykopmobilny.models.dataclass.Link
import io.github.feelfreelinux.wykopmobilny.ui.modules.addlink.AddlinkActivity
import io.github.feelfreelinux.wykopmobilny.ui.modules.embedview.EmbedViewActivity
import io.github.feelfreelinux.wykopmobilny.ui.modules.embedview.YoutubeViewActivity
import io.github.feelfreelinux.wykopmobilny.ui.modules.embedview.YoutubeActivity
import io.github.feelfreelinux.wykopmobilny.ui.modules.input.BaseInputActivity
import io.github.feelfreelinux.wykopmobilny.ui.modules.input.entry.add.AddEntryActivity
import io.github.feelfreelinux.wykopmobilny.ui.modules.input.entry.comment.EditEntryCommentActivity
Expand All @@ -27,6 +29,7 @@ import io.github.feelfreelinux.wykopmobilny.ui.modules.profile.ProfileActivity
import io.github.feelfreelinux.wykopmobilny.ui.modules.settings.SettingsActivity
import io.github.feelfreelinux.wykopmobilny.ui.modules.tag.TagActivity
import io.github.feelfreelinux.wykopmobilny.utils.openBrowser
import java.util.regex.Pattern


interface NewNavigatorApi {
Expand Down Expand Up @@ -140,10 +143,12 @@ class NewNavigator(val context : Activity) : NewNavigatorApi {
}

override fun openYoutubeActivity(url: String) {
context.startActivity(YoutubeViewActivity.createIntent(context, url))
context.startActivity(YoutubeActivity.createIntent(context, url))
}

override fun openAddLinkActivity() {
context.startActivity(AddlinkActivity.createIntent(context))
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class EmbedLinkPresenter (val embedApi: ExternalApi, val schedulers: Schedulers)
}
when (linkDomain) {
GFYCAT_MATCHER -> {
view?.checkEmbedSettings()
val id = url.formatGfycat()
embedApi.getGfycat(id)
.subscribeOn(schedulers.backgroundThread())
Expand All @@ -38,6 +39,7 @@ class EmbedLinkPresenter (val embedApi: ExternalApi, val schedulers: Schedulers)
}

COUB_MATCHER -> {
view?.checkEmbedSettings()
val id = url.removeSuffix("/").substringAfterLast("/view/")
embedApi.getCoub(id)
.subscribeOn(schedulers.backgroundThread())
Expand All @@ -46,6 +48,7 @@ class EmbedLinkPresenter (val embedApi: ExternalApi, val schedulers: Schedulers)
}

STREAMABLE_MATCHER -> {
view?.checkEmbedSettings()
val id = url.removeSuffix("/").substringAfterLast("/")
embedApi.getStreamableUrl(id)
.subscribeOn(schedulers.backgroundThread())
Expand All @@ -57,7 +60,10 @@ class EmbedLinkPresenter (val embedApi: ExternalApi, val schedulers: Schedulers)
}

SIMPLE_YOUTUBE_MATCHER, YOUTUBE_MATCHER -> view?.exitAndOpenYoutubeActivity()
else -> Single.just(url)
else -> {
view?.checkEmbedSettings()
Single.just(url)
}
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ interface EmbedView : BaseView {
fun playUrl(url : URL)
fun playCoub(coub: Coub)
fun exitAndOpenYoutubeActivity()
fun checkEmbedSettings()
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@ import io.github.feelfreelinux.wykopmobilny.base.WykopSchedulers
import io.github.feelfreelinux.wykopmobilny.models.pojo.apiv2.embed.Coub
import io.github.feelfreelinux.wykopmobilny.ui.modules.NewNavigatorApi
import io.github.feelfreelinux.wykopmobilny.ui.modules.photoview.PhotoViewActions
import io.github.feelfreelinux.wykopmobilny.utils.ClipboardHelperApi
import io.github.feelfreelinux.wykopmobilny.utils.getActivityContext
import io.github.feelfreelinux.wykopmobilny.utils.isVisible
import io.github.feelfreelinux.wykopmobilny.utils.printout
import io.github.feelfreelinux.wykopmobilny.utils.*
import io.github.feelfreelinux.wykopmobilny.utils.preferences.SettingsPreferencesApi
import io.reactivex.Completable
import io.reactivex.Single
import kotlinx.android.synthetic.main.activity_embedview.*
Expand All @@ -62,6 +60,7 @@ class EmbedViewActivity : BaseActivity(), EmbedView {
@Inject lateinit var presenter : EmbedLinkPresenter
@Inject lateinit var navigatorApi : NewNavigatorApi
@Inject lateinit var clipboardHelper : ClipboardHelperApi
@Inject lateinit var settingsPreferencesApi : SettingsPreferencesApi
val audioPlayer by lazy { ExoPlayerFactory.newSimpleInstance(applicationContext, DefaultTrackSelector(AdaptiveTrackSelection.Factory(DefaultBandwidthMeter())), DefaultLoadControl(), null, DefaultRenderersFactory.EXTENSION_RENDERER_MODE_OFF) }
var usingMuxedAudio = false
val extraUrl by lazy { intent.getStringExtra(EXTRA_URL) }
Expand Down Expand Up @@ -108,6 +107,13 @@ class EmbedViewActivity : BaseActivity(), EmbedView {

}

override fun checkEmbedSettings() {
if (settingsPreferencesApi.enableEmbedPlayer) {
openBrowser(extraUrl)
finish()
}
}

override fun playUrl(url: URL) {
prepareVideoView()
playLoopingSource(Uri.parse(url.toString()))
Expand Down Expand Up @@ -163,7 +169,11 @@ class EmbedViewActivity : BaseActivity(), EmbedView {
}

override fun exitAndOpenYoutubeActivity() {
navigatorApi.openYoutubeActivity(extraUrl)
if (settingsPreferencesApi.enableYoutubePlayer) {
navigatorApi.openYoutubeActivity(extraUrl)
} else {
openBrowser(extraUrl)
}
finish()
}

Expand Down
Loading

0 comments on commit ae3395f

Please sign in to comment.